diff --git a/src/kernel/libroot/posix/glibc/ctype/Jamfile b/src/kernel/libroot/posix/glibc/ctype/Jamfile new file mode 100644 index 0000000000..ba97189535 --- /dev/null +++ b/src/kernel/libroot/posix/glibc/ctype/Jamfile @@ -0,0 +1,11 @@ +SubDir OBOS_TOP src kernel libroot posix glibc ctype ; + +SubDirHdrs $(OBOS_TOP) src kernel libroot posix glibc include arch $(OBOS_ARCH) ; +SubDirHdrs $(OBOS_TOP) src kernel libroot posix glibc include ; +SubDirHdrs $(OBOS_TOP) src kernel libroot posix glibc locale ; +SubDirHdrs $(OBOS_TOP) src kernel libroot posix glibc ; + +KernelMergeObject posix_gnu_ctype.o : + ctype-info.c + : -fPIC -DPIC + ; diff --git a/src/kernel/libroot/posix/glibc/ctype/ctype-info.c b/src/kernel/libroot/posix/glibc/ctype/ctype-info.c index 35f2fb540f..f683ce3346 100644 --- a/src/kernel/libroot/posix/glibc/ctype/ctype-info.c +++ b/src/kernel/libroot/posix/glibc/ctype/ctype-info.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991,92,95,96,97,99,2000,02 Free Software Foundation, Inc. +/* Copyright (C) 1991, 92, 95, 96, 97, 99, 2000 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -16,35 +16,29 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define CTYPE_EXTERN_INLINE /* Define real functions for accessors. */ #include #include -__libc_tsd_define (, CTYPE_B) -__libc_tsd_define (, CTYPE_TOLOWER) -__libc_tsd_define (, CTYPE_TOUPPER) - - -#include -#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3) - /* Defined in locale/C-ctype.c. */ -extern const char _nl_C_LC_CTYPE_class[] attribute_hidden; -extern const char _nl_C_LC_CTYPE_class32[] attribute_hidden; -extern const char _nl_C_LC_CTYPE_toupper[] attribute_hidden; -extern const char _nl_C_LC_CTYPE_tolower[] attribute_hidden; -extern const char _nl_C_LC_CTYPE_class_upper[] attribute_hidden; -extern const char _nl_C_LC_CTYPE_class_lower[] attribute_hidden; -extern const char _nl_C_LC_CTYPE_class_alpha[] attribute_hidden; -extern const char _nl_C_LC_CTYPE_class_digit[] attribute_hidden; -extern const char _nl_C_LC_CTYPE_class_xdigit[] attribute_hidden; -extern const char _nl_C_LC_CTYPE_class_space[] attribute_hidden; -extern const char _nl_C_LC_CTYPE_class_print[] attribute_hidden; -extern const char _nl_C_LC_CTYPE_class_graph[] attribute_hidden; -extern const char _nl_C_LC_CTYPE_class_blank[] attribute_hidden; -extern const char _nl_C_LC_CTYPE_class_cntrl[] attribute_hidden; -extern const char _nl_C_LC_CTYPE_class_punct[] attribute_hidden; -extern const char _nl_C_LC_CTYPE_class_alnum[] attribute_hidden; +extern const char _nl_C_LC_CTYPE_class[]; +extern const char _nl_C_LC_CTYPE_class32[]; +extern const char _nl_C_LC_CTYPE_toupper[]; +extern const char _nl_C_LC_CTYPE_tolower[]; +extern const char _nl_C_LC_CTYPE_class_upper[]; +extern const char _nl_C_LC_CTYPE_class_lower[]; +extern const char _nl_C_LC_CTYPE_class_alpha[]; +extern const char _nl_C_LC_CTYPE_class_digit[]; +extern const char _nl_C_LC_CTYPE_class_xdigit[]; +extern const char _nl_C_LC_CTYPE_class_space[]; +extern const char _nl_C_LC_CTYPE_class_print[]; +extern const char _nl_C_LC_CTYPE_class_graph[]; +extern const char _nl_C_LC_CTYPE_class_blank[]; +extern const char _nl_C_LC_CTYPE_class_cntrl[]; +extern const char _nl_C_LC_CTYPE_class_punct[]; +extern const char _nl_C_LC_CTYPE_class_alnum[]; +extern const char _nl_C_LC_CTYPE_map_toupper[]; +extern const char _nl_C_LC_CTYPE_map_tolower[]; +extern const char _nl_C_LC_CTYPE_width[]; #define b(t,x,o) (((const t *) _nl_C_LC_CTYPE_##x) + o) @@ -54,12 +48,24 @@ const __int32_t *__ctype_tolower = b (__int32_t, tolower, 128); const __int32_t *__ctype_toupper = b (__int32_t, toupper, 128); const __uint32_t *__ctype32_tolower = b (__uint32_t, tolower, 128); const __uint32_t *__ctype32_toupper = b (__uint32_t, toupper, 128); - -compat_symbol (libc, __ctype_b, __ctype_b, GLIBC_2_0); -compat_symbol (libc, __ctype_tolower, __ctype_tolower, GLIBC_2_0); -compat_symbol (libc, __ctype_toupper, __ctype_toupper, GLIBC_2_0); -compat_symbol (libc, __ctype32_b, __ctype32_b, GLIBC_2_0); -compat_symbol (libc, __ctype32_tolower, __ctype32_tolower, GLIBC_2_2); -compat_symbol (libc, __ctype32_toupper, __ctype32_toupper, GLIBC_2_2); - -#endif +const char *__ctype32_wctype[12] = +{ + b(char, class_upper, 32), + b(char, class_lower, 32), + b(char, class_alpha, 32), + b(char, class_digit, 32), + b(char, class_xdigit, 32), + b(char, class_space, 32), + b(char, class_print, 32), + b(char, class_graph, 32), + b(char, class_blank, 32), + b(char, class_cntrl, 32), + b(char, class_punct, 32), + b(char, class_alnum, 32) +}; +const char *__ctype32_wctrans[2] = +{ + b(char, map_toupper, 0), + b(char, map_tolower, 0) +}; +const char *__ctype32_width = b (char, width, 0); diff --git a/src/kernel/libroot/posix/glibc/ctype/ctype.h b/src/kernel/libroot/posix/glibc/ctype/ctype.h index 6fa379a029..e73a06d64e 100644 --- a/src/kernel/libroot/posix/glibc/ctype/ctype.h +++ b/src/kernel/libroot/posix/glibc/ctype/ctype.h @@ -1,5 +1,4 @@ -/* Copyright (C) 1991,92,93,95,96,97,98,99,2001,02 - Free Software Foundation, Inc. +/* Copyright (C) 1991,92,93,95,96,97,98,99,2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -65,11 +64,6 @@ enum /* These are defined in ctype-info.c. The declarations here must match those in localeinfo.h. - In the thread-specific locale model (see `uselocale' in ) - we cannot use global variables for these as was done in the past. - Instead, the following accessor functions return the address of - each variable, which is local to the current thread if multithreaded. - These point into arrays of 384, so they can be indexed by any `unsigned char' value [0,255]; by EOF (-1); or by any `signed char' value [-128,-1). ISO C requires that the ctype functions work for `unsigned @@ -78,23 +72,18 @@ enum rather than `unsigned char's because tolower (EOF) must be EOF, which doesn't fit into an `unsigned char'. But today more important is that the arrays are also used for multi-byte character sets. */ -extern __const uint16_t **__ctype_b_loc (void) - __attribute__ ((__const)); -extern __const int32_t **__ctype_tolower_loc (void) - __attribute__ ((__const)); -extern __const int32_t **__ctype_toupper_loc (void) - __attribute__ ((__const)); +extern __const unsigned short int *__ctype_b; /* Characteristics. */ +extern __const __int32_t *__ctype_tolower; /* Case conversions. */ +extern __const __int32_t *__ctype_toupper; /* Case conversions. */ -#define __isctype(c, type) \ - ((*__ctype_b_loc ())[(int) (c)] & (unsigned short int) type) +#define __isctype(c, type) \ + (__ctype_b[(int) (c)] & (unsigned short int) type) #define __isascii(c) (((c) & ~0x7f) == 0) /* If C is a 7 bit value. */ #define __toascii(c) ((c) & 0x7f) /* Mask off high bits. */ #define __exctype(name) extern int name (int) __THROW -__BEGIN_NAMESPACE_STD - /* The following names are all functions: int isCHARACTERISTIC(int c); which return nonzero iff C has CHARACTERISTIC. @@ -111,6 +100,10 @@ __exctype (isspace); __exctype (isupper); __exctype (isxdigit); +#ifdef __USE_ISOC99 +__exctype (isblank); +#endif + /* Return the lowercase version of C. */ extern int tolower (int __c) __THROW; @@ -118,22 +111,6 @@ extern int tolower (int __c) __THROW; /* Return the uppercase version of C. */ extern int toupper (int __c) __THROW; -__END_NAMESPACE_STD - - -/* ISO C99 introduced one new function. */ -#ifdef __USE_ISOC99 -__BEGIN_NAMESPACE_C99 - -__exctype (isblank); - -__END_NAMESPACE_C99 -#endif - -#ifdef __USE_GNU -/* Test C for a set of character classes according to MASK. */ -extern int isctype (int __c, int __mask) __THROW; -#endif #if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN @@ -160,16 +137,16 @@ __exctype (_tolower); if (__builtin_constant_p (c)) \ { \ int __c = (c); \ - __res = __c < -128 || __c > 255 ? __c : (a)[__c]; \ + __res = __c < -128 || __c > 255 ? __c : a[__c]; \ } \ else \ __res = f args; \ } \ else \ - __res = (a)[(int) (c)]; \ + __res = a[(int) (c)]; \ __res; })) -#if !defined __NO_CTYPE && !defined __cplusplus +#ifndef __NO_CTYPE # define isalnum(c) __isctype((c), _ISalnum) # define isalpha(c) __isctype((c), _ISalpha) # define iscntrl(c) __isctype((c), _IScntrl) @@ -182,7 +159,7 @@ __exctype (_tolower); # define isupper(c) __isctype((c), _ISupper) # define isxdigit(c) __isctype((c), _ISxdigit) -# ifdef __USE_ISOC99 +# ifdef __USE_ISOC99 # define isblank(c) __isctype((c), _ISblank) # endif @@ -190,27 +167,27 @@ __exctype (_tolower); extern __inline int tolower (int __c) __THROW { - return __c >= -128 && __c < 256 ? (*__ctype_tolower_loc ())[__c] : __c; + return __c >= -128 && __c < 256 ? __ctype_tolower[__c] : __c; } extern __inline int toupper (int __c) __THROW { - return __c >= -128 && __c < 256 ? (*__ctype_toupper_loc ())[__c] : __c; + return __c >= -128 && __c < 256 ? __ctype_toupper[__c] : __c; } # endif # if __GNUC__ >= 2 && defined __OPTIMIZE__ && !defined __cplusplus -# define tolower(c) __tobody (c, tolower, *__ctype_tolower_loc (), (c)) -# define toupper(c) __tobody (c, toupper, *__ctype_toupper_loc (), (c)) -# endif /* Optimizing gcc */ +# define tolower(c) __tobody (c, tolower, __ctype_tolower, (c)) +# define toupper(c) __tobody (c, toupper, __ctype_toupper, (c)) +# endif /* Optimizing gcc */ # if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN # define isascii(c) __isascii (c) # define toascii(c) __toascii (c) -# define _tolower(c) ((int) (*__ctype_tolower_loc ())[(int) (c)]) -# define _toupper(c) ((int) (*__ctype_toupper_loc ())[(int) (c)]) +# define _tolower(c) ((int) __ctype_tolower[(int) (c)]) +# define _toupper(c) ((int) __ctype_toupper[(int) (c)]) # endif #endif /* Not __NO_CTYPE. */ @@ -237,43 +214,38 @@ toupper (int __c) __THROW # define __isctype_l(c, type, locale) \ ((locale)->__ctype_b[(int) (c)] & (unsigned short int) type) -# define __exctype_l(name) \ - extern int name (int, __locale_t) __THROW +# define __exctype_l(name) extern int name (int, __locale_t) __THROW /* The following names are all functions: int isCHARACTERISTIC(int c, locale_t *locale); which return nonzero iff C has CHARACTERISTIC. For the meaning of the characteristic names, see the `enum' above. */ -__exctype_l (isalnum_l); -__exctype_l (isalpha_l); -__exctype_l (iscntrl_l); -__exctype_l (isdigit_l); -__exctype_l (islower_l); -__exctype_l (isgraph_l); -__exctype_l (isprint_l); -__exctype_l (ispunct_l); -__exctype_l (isspace_l); -__exctype_l (isupper_l); -__exctype_l (isxdigit_l); +__exctype_l (__isalnum_l); +__exctype_l (__isalpha_l); +__exctype_l (__iscntrl_l); +__exctype_l (__isdigit_l); +__exctype_l (__islower_l); +__exctype_l (__isgraph_l); +__exctype_l (__isprint_l); +__exctype_l (__ispunct_l); +__exctype_l (__isspace_l); +__exctype_l (__isupper_l); +__exctype_l (__isxdigit_l); -__exctype_l (isblank_l); +__exctype_l (__isblank_l); /* Return the lowercase version of C in locale L. */ extern int __tolower_l (int __c, __locale_t __l) __THROW; -extern int tolower_l (int __c, __locale_t __l) __THROW; /* Return the uppercase version of C. */ extern int __toupper_l (int __c, __locale_t __l) __THROW; -extern int toupper_l (int __c, __locale_t __l) __THROW; # if __GNUC__ >= 2 && defined __OPTIMIZE__ && !defined __cplusplus # define __tolower_l(c, locale) \ __tobody (c, __tolower_l, (locale)->__ctype_tolower, (c, locale)) # define __toupper_l(c, locale) \ __tobody (c, __toupper_l, (locale)->__ctype_toupper, (c, locale)) -# define tolower_l(c, locale) __tolower_l ((c), (locale)) -# define toupper_l(c, locale) __toupper_l ((c), (locale)) # endif /* Optimizing gcc */ @@ -293,27 +265,8 @@ extern int toupper_l (int __c, __locale_t __l) __THROW; # define __isblank_l(c,l) __isctype_l((c), _ISblank, (l)) # if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN -# define __isascii_l(c,l) ((l), __isascii (c)) -# define __toascii_l(c,l) ((l), __toascii (c)) -# endif - -# define isalnum_l(c,l) __isalnum_l ((c), (l)) -# define isalpha_l(c,l) __isalpha_l ((c), (l)) -# define iscntrl_l(c,l) __iscntrl_l ((c), (l)) -# define isdigit_l(c,l) __isdigit_l ((c), (l)) -# define islower_l(c,l) __islower_l ((c), (l)) -# define isgraph_l(c,l) __isgraph_l ((c), (l)) -# define isprint_l(c,l) __isprint_l ((c), (l)) -# define ispunct_l(c,l) __ispunct_l ((c), (l)) -# define isspace_l(c,l) __isspace_l ((c), (l)) -# define isupper_l(c,l) __isupper_l ((c), (l)) -# define isxdigit_l(c,l) __isxdigit_l ((c), (l)) - -# define isblank_l(c,l) __isblank_l ((c), (l)) - -# if defined __USE_SVID || defined __USE_MISC || defined __USE_XOPEN -# define isascii_l(c,l) __isascii_l ((c), (l)) -# define toascii_l(c,l) __toascii_l ((c), (l)) +# define __isascii_l(c,l) __isascii(c) +# define __toascii_l(c,l) __toascii(c) # endif # endif /* Not __NO_CTYPE. */