161211d186
(__ctype_default): New character class array for default ASCII character set. (__ctype_iso): New array of character class array for ISO charsets. (__ctype_cp): Ditto for singlebyte Windows codepages. (tolower): Implement as distinct function to support any singlebyte charset. (toupper): Ditto. (__set_ctype): New function to copy singlebyte character classes corresponding to current charset to ctype_b array. Align copyright text to upstream. * dcrt0.cc (dll_crt0_1): Reset current locale to "C" per POSIX. * environ.cc (set_file_api_mode): Remove. (codepage_init): Remove. (parse_thing): Remove "codepage" setting. (environ_init): Set locale according to environment settings, or to current codepage, before converting environment to multibyte. * fhandler.h (fhandler_console::write_replacement_char): Drop argument. * fhandler_console.cc (dev_console::str_to_con): Call sys_cp_mbstowcs rather than MultiByteToWideChar. (fhandler_console::write_replacement_char): Always print a funny half filled square if a character isn't in the current charset. (fhandler_console::write_normal): Convert to using __mbtowc rather than next_char. * fork.cc (frok::child): Drop call to set_file_api_mode. * globals.cc (enum codepage_type) Remove. (current_codepage): Remove. * miscfuncs.cc (cygwin_wcslwr): Unused, dangerous. Remove. (cygwin_wcsupr): Ditto. (is_cp_multibyte): Remove. (next_char): Remove. * miscfuncs.h (is_cp_multibyte): Drop declaration. (next_char): Ditto. * strfuncs.cc (get_cp): Remove. (__db_wctomb): New function to implement _wctomb_r functionality for doublebyte charsets using WideCharToMultiByte. (__sjis_wctomb): New function to replace unusable newlib function. (__jis_wctomb): Ditto. (__eucjp_wctomb): Ditto. (__gbk_wctomb): New function. (__kr_wctomb): Ditto. (__big5_wctomb): Ditto. (__db_mbtowc): New function to implement _mbtowc_r functionality for doublebyte charsets using MultiByteToWideChar. (__sjis_mbtowc): New function to replace unusable newlib function. (__jis_mbtowc): Ditto. (__eucjp_mbtowc): Ditto. (__gbk_mbtowc): New function. (__kr_mbtowc): New function (__big5_mbtowc): New function (__set_charset_from_codepage): New function. (sys_wcstombs): Reimplement, basically using same wide char to multibyte conversion as newlib's application level functions. Plus extras. Add lengthy comment to explain. Change return type to size_t. (sys_wcstombs_alloc): Just use sys_wcstombs. Change return type to size_t. (sys_cp_mbstowcs): Replace sys_mbstowcs, take additional codepage argument. Explain why. Change return type to size_t. (sys_mbstowcs_alloc): Just use sys_mbstowcs. Change return type to size_t. * wchar.h: Declare internal functions implemented in strfuncs.cc. (wcscasecmp): Remove. (wcsncasecmp): Remove. (wcslwr): Remove. (wcsupr): Remove. * winsup.h (codepage_init): Remove declaration. (get_cp): Ditto. (sys_wcstombs): Align declaration to new implementation. (sys_wcstombs_alloc): Ditto. (sys_cp_mbstowcs): Add declaration. (sys_mbstowcs): Define as inline function. (sys_mbstowcs_alloc): Align declaration to new implementation. (set_file_api_mode): Remove declaration. * include/ctype.h (isblank): Redefine to use _B character class. (toupper): Remove ASCII-only definition. (tolower): Ditto.
114 lines
2.7 KiB
C++
114 lines
2.7 KiB
C++
/* globals.cc - Define global variables here.
|
|
|
|
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
|
2006, 2007, 2008, 2009 Red Hat, Inc.
|
|
|
|
This file is part of Cygwin.
|
|
|
|
This software is a copyrighted work licensed under the terms of the
|
|
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
|
details. */
|
|
|
|
#define _GLOBALS_H 1
|
|
#include "winsup.h"
|
|
#include "cygtls.h"
|
|
#include "perprocess.h"
|
|
#include "thread.h"
|
|
#include <malloc.h>
|
|
#include <cygwin/version.h>
|
|
|
|
HANDLE NO_COPY hMainProc = (HANDLE) -1;
|
|
HANDLE NO_COPY hMainThread;
|
|
HANDLE NO_COPY hProcToken;
|
|
HANDLE NO_COPY hProcImpToken;
|
|
HMODULE NO_COPY cygwin_hmodule;
|
|
HANDLE hExeced;
|
|
|
|
/* Codepage and multibyte string specific stuff. */
|
|
UINT active_codepage;
|
|
|
|
/* program exit the program */
|
|
|
|
enum exit_states
|
|
{
|
|
ES_NOT_EXITING = 0,
|
|
ES_PROCESS_LOCKED,
|
|
ES_GLOBAL_DTORS,
|
|
ES_EVENTS_TERMINATE,
|
|
ES_THREADTERM,
|
|
ES_SIGNAL,
|
|
ES_CLOSEALL,
|
|
ES_HUP_PGRP,
|
|
ES_HUP_SID,
|
|
ES_EXEC_EXIT,
|
|
ES_TITLE,
|
|
ES_TTY_TERMINATE,
|
|
ES_FINAL
|
|
};
|
|
|
|
exit_states NO_COPY exit_state;
|
|
|
|
SYSTEM_INFO system_info;
|
|
|
|
/* Set in init.cc. Used to check if Cygwin DLL is dynamically loaded. */
|
|
int NO_COPY dynamically_loaded;
|
|
|
|
bool display_title;
|
|
bool strip_title_path;
|
|
bool allow_glob = true;
|
|
bool NO_COPY in_forkee;
|
|
|
|
int __argc_safe;
|
|
int __argc;
|
|
char **__argv;
|
|
#ifdef NEWVFORK
|
|
vfork_save NO_COPY *main_vfork;
|
|
#endif
|
|
|
|
_cygtls NO_COPY *_main_tls /* !globals.h */;
|
|
|
|
bool NO_COPY cygwin_finished_initializing;
|
|
|
|
bool NO_COPY _cygwin_testing;
|
|
|
|
char NO_COPY almost_null[1];
|
|
|
|
char *old_title;
|
|
|
|
extern "C"
|
|
{
|
|
/* This is an exported copy of environ which can be used by DLLs
|
|
which use cygwin.dll. */
|
|
char **__cygwin_environ;
|
|
char ***main_environ = &__cygwin_environ;
|
|
/* __progname used in getopt error message */
|
|
char *__progname;
|
|
static MTinterface _mtinterf;
|
|
struct per_process __cygwin_user_data =
|
|
{/* initial_sp */ 0, /* magic_biscuit */ 0,
|
|
/* dll_major */ CYGWIN_VERSION_DLL_MAJOR,
|
|
/* dll_major */ CYGWIN_VERSION_DLL_MINOR,
|
|
/* impure_ptr_ptr */ NULL, /* envptr */ NULL,
|
|
/* malloc */ malloc, /* free */ free,
|
|
/* realloc */ realloc,
|
|
/* fmode_ptr */ NULL, /* main */ NULL, /* ctors */ NULL,
|
|
/* dtors */ NULL, /* data_start */ NULL, /* data_end */ NULL,
|
|
/* bss_start */ NULL, /* bss_end */ NULL,
|
|
/* calloc */ calloc,
|
|
/* premain */ {NULL, NULL, NULL, NULL},
|
|
/* run_ctors_p */ 0,
|
|
/* unused */ {0, 0, 0, 0, 0, 0, 0},
|
|
/* UNUSED forkee */ 0,
|
|
/* hmodule */ NULL,
|
|
/* api_major */ CYGWIN_VERSION_API_MAJOR,
|
|
/* api_minor */ CYGWIN_VERSION_API_MINOR,
|
|
/* unused2 */ {0, 0, 0, 0, 0, 0},
|
|
/* threadinterface */ &_mtinterf,
|
|
/* impure_ptr */ _GLOBAL_REENT,
|
|
};
|
|
bool ignore_case_with_glob;
|
|
int _check_for_executable = true;
|
|
};
|
|
|
|
int NO_COPY __api_fatal_exit_val = 1;
|