]> pd.if.org Git - pdclib/commitdiff
Moved ctype info into struct lconv.
authorsolar <unknown>
Wed, 29 Dec 2010 13:19:53 +0000 (13:19 +0000)
committersolar <unknown>
Wed, 29 Dec 2010 13:19:53 +0000 (13:19 +0000)
18 files changed:
functions/_PDCLIB/Readme.txt [changed mode: 0755->0644]
functions/ctype/isalnum.c
functions/ctype/isalpha.c
functions/ctype/isblank.c
functions/ctype/iscntrl.c
functions/ctype/isdigit.c
functions/ctype/isgraph.c
functions/ctype/islower.c
functions/ctype/isprint.c
functions/ctype/ispunct.c
functions/ctype/isspace.c
functions/ctype/isupper.c
functions/ctype/isxdigit.c
functions/ctype/tolower.c
functions/ctype/toupper.c
includes/locale.h
internals/_PDCLIB_int.h
platform/example/functions/_PDCLIB/stdinit.c

old mode 100755 (executable)
new mode 100644 (file)
index d6e217b1a703cf7642000a1f832affcaebe216c2..f4969fa20a48446a6d3181f66e770bbee2ea8a5e 100644 (file)
 
 #ifndef REGTEST
 
+#include <locale.h>
+
 int isalnum( int c )
 {
-    return ( _PDCLIB_locale_info.ctype[c].flags & ( _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_DIGIT ) );
+    return ( _PDCLIB_lconv.ctype[c].flags & ( _PDCLIB_CTYPE_ALPHA | _PDCLIB_CTYPE_DIGIT ) );
 }
 
 #endif
index 2bde75570f7d4ab5255539f41c8a0a6838af0b15..9dad397ea44798a7788932a6ec1a73ee60e56b8a 100644 (file)
 
 #ifndef REGTEST
 
+#include <locale.h>
+
 int isalpha( int c )
 {
-    return ( _PDCLIB_locale_info.ctype[c].flags & _PDCLIB_CTYPE_ALPHA );
+    return ( _PDCLIB_lconv.ctype[c].flags & _PDCLIB_CTYPE_ALPHA );
 }
 
 #endif
index 0ad1ca1ab039bda704221e879dc61689be8b9295..cc29fa849048df2b19588b797efc92bc60e6b6bb 100644 (file)
 
 #ifndef REGTEST
 
+#include <locale.h>
+
 int isblank( int c )
 {
-    return ( _PDCLIB_locale_info.ctype[c].flags & _PDCLIB_CTYPE_BLANK );
+    return ( _PDCLIB_lconv.ctype[c].flags & _PDCLIB_CTYPE_BLANK );
 }
 
 #endif
index 583ccb39243122be8eecb207208dfaf0a9f4dbd6..8c0a4f3164ef6a536d86802b6fae841e9b567e62 100644 (file)
 
 #ifndef REGTEST
 
+#include <locale.h>
+
 int iscntrl( int c )
 {
-    return ( _PDCLIB_locale_info.ctype[c].flags & _PDCLIB_CTYPE_CNTRL );
+    return ( _PDCLIB_lconv.ctype[c].flags & _PDCLIB_CTYPE_CNTRL );
 }
 
 #endif
index eeeffb874993b3c86204d5e0567870cf3c281235..b122f7ec5362434c48f80f44dac763da93a2ed23 100644 (file)
 
 #ifndef REGTEST
 
+#include <locale.h>
+
 int isdigit( int c )
 {
-    return ( _PDCLIB_locale_info.ctype[c].flags & _PDCLIB_CTYPE_DIGIT );
+    return ( _PDCLIB_lconv.ctype[c].flags & _PDCLIB_CTYPE_DIGIT );
 }
 
 #endif
index b2cccc8d5eefcc63945e76b01b91f7ac1274b356..d623485f02f6ee34b2372b4bd634aff68fd04a12 100644 (file)
 
 #ifndef REGTEST
 
+#include <locale.h>
+
 int isgraph( int c )
 {
-    return ( _PDCLIB_locale_info.ctype[c].flags & _PDCLIB_CTYPE_GRAPH );
+    return ( _PDCLIB_lconv.ctype[c].flags & _PDCLIB_CTYPE_GRAPH );
 }
 
 #endif
index d98069a6e0c2c8c6c17c4fd26b92f0ae62e3d0d3..db0649d1f0f28b754c78278adab855c8c48fec1d 100644 (file)
 
 #ifndef REGTEST
 
+#include <locale.h>
+
 int islower( int c )
 {
-    return ( _PDCLIB_locale_info.ctype[c].flags & _PDCLIB_CTYPE_LOWER );
+    return ( _PDCLIB_lconv.ctype[c].flags & _PDCLIB_CTYPE_LOWER );
 }
 
 #endif
index f057e002e4d53ae41706949ae259c214002358d4..50b0ad85192d34530056a4d17ff81626e7c296ff 100644 (file)
 
 #ifndef REGTEST
 
+#include <locale.h>
+
 int isprint( int c )
 {
-    return ( _PDCLIB_locale_info.ctype[c].flags & _PDCLIB_CTYPE_GRAPH ) || ( c == ' ' );
+    return ( _PDCLIB_lconv.ctype[c].flags & _PDCLIB_CTYPE_GRAPH ) || ( c == ' ' );
 }
 
 #endif
index 2859efc32478cc35574d41eebb58ad564ff4e427..4dfd52a7c749191d8fe339453829f0e1cab0d921 100644 (file)
 
 #ifndef REGTEST
 
+#include <locale.h>
+
 int ispunct( int c )
 {
-    return ( _PDCLIB_locale_info.ctype[c].flags & _PDCLIB_CTYPE_PUNCT );
+    return ( _PDCLIB_lconv.ctype[c].flags & _PDCLIB_CTYPE_PUNCT );
 }
 
 #endif
index 90b6dc57ad28f45c29a4dbd60f3b1a9bebce9ccd..b443f6fc4acb7ff355982e3743454b042166941a 100644 (file)
 
 #ifndef REGTEST
 
+#include <locale.h>
+
 int isspace( int c )
 {
-    return ( _PDCLIB_locale_info.ctype[c].flags & _PDCLIB_CTYPE_SPACE );
+    return ( _PDCLIB_lconv.ctype[c].flags & _PDCLIB_CTYPE_SPACE );
 }
 
 #endif
index 76c1ff19463d539db2a7989e1af2e9ac18b1ad67..59539469d7c90601639c2d294fcd891b32ab892c 100644 (file)
 
 #ifndef REGTEST
 
+#include <locale.h>
+
 int isupper( int c )
 {
-    return ( _PDCLIB_locale_info.ctype[c].flags & _PDCLIB_CTYPE_UPPER );
+    return ( _PDCLIB_lconv.ctype[c].flags & _PDCLIB_CTYPE_UPPER );
 }
 
 #endif
index 55818dff272952fe41596fa301c16d7fa109e787..7f5dfec4d97e4c05a90f99f52138ee471613bd21 100644 (file)
 
 #ifndef REGTEST
 
+#include <locale.h>
+
 int isxdigit( int c )
 {
-    return ( _PDCLIB_locale_info.ctype[c].flags & _PDCLIB_CTYPE_XDIGT );
+    return ( _PDCLIB_lconv.ctype[c].flags & _PDCLIB_CTYPE_XDIGT );
 }
 
 #endif
index 530abf2a9e6bfcf7a94e69b3b3f8f243d53ebe1a..d051ba5c67e7ce257c3409f58ede8785b1d77644 100644 (file)
 
 #ifndef REGTEST
 
+#include <locale.h>
+
 int tolower( int c )
 {
-    return _PDCLIB_locale_info.ctype[c].lower;
+    return _PDCLIB_lconv.ctype[c].lower;
 }
 
 #endif
index 00cb203500b5b362a241cff15ece78a4834886cf..801c8ef55b18321cc5773b2d42bda2ff2561a2f2 100644 (file)
 
 #ifndef REGTEST
 
+#include <locale.h>
+
 int toupper( int c )
 {
-    return _PDCLIB_locale_info.ctype[c].upper;
+    return _PDCLIB_lconv.ctype[c].upper;
 }
 
 #endif
index fd014db44469b13fe8ae4f77f98c44534617bcfe..0277016212ca6f57d090665d4e2749ffaa5dc4fe 100644 (file)
@@ -9,6 +9,16 @@
 #ifndef _PDCLIB_LOCALE_H
 #define _PDCLIB_LOCALE_H _PDCLIB_LOCALE_H
 
+#ifndef _PDCLIB_INT_H
+#define _PDCLIB_INT_H _PDCLIB_INT_H
+#include <_PDCLIB_int.h>
+#endif
+
+#ifndef _PDCLIB_NULL_DEFINED
+#define _PDCLIB_NULL_DEFINED _PDCLIB_NULL_DEFINED
+#define NULL _PDCLIB_NULL
+#endif
+
 /* The structure returned by localeconv().
 
    The values for *_sep_by_space:
@@ -27,6 +37,7 @@
 */
 struct lconv
 {
+    struct _PDCLIB_ctype_t * ctype;  /* internal <ctype.h> information        */
     char * decimal_point;      /* decimal point character                     */
     char * thousands_sep;      /* character for seperating groups of digits   */
     char * grouping;           /* string indicating the size of digit groups  */
@@ -51,12 +62,10 @@ struct lconv
     char int_n_sep_by_space;   /* Same as above, for international format     */
     char int_p_sign_posn;      /* Same as above, for international format     */
     char int_n_sign_posn;      /* Same as above, for international format     */
-}
+};
 
-#ifndef _PDCLIB_NULL_DEFINED
-#define _PDCLIB_NULL_DEFINED _PDCLIB_NULL_DEFINED
-#define NULL _PDCLIB_NULL
-#endif
+/* This is strictly internal, and visible here for technical reasons only. */
+extern struct lconv _PDCLIB_lconv;
 
 /* LC_ALL
    - entire locale
index b5003af51557e7fea2adc6e16dd69513940cf9ef..2d99b911a5b1e3c78b0d59cf5570fb7eb7417c43 100644 (file)
@@ -450,10 +450,3 @@ struct _PDCLIB_ctype_t
     unsigned char collation;
 };
 
-struct _PDCLIB_locale_t
-{
-    struct _PDCLIB_ctype_t * ctype;
-};
-
-struct _PDCLIB_locale_t _PDCLIB_locale_info;
-
index a90d283b4744ef87affa1f28d3215b763426bc61..5550c4d7ce02acc324a87daeef7cc91181410b91 100644 (file)
@@ -12,6 +12,8 @@
 */
 
 #include <stdio.h>
+#include <locale.h>
+#include <limits.h>
 
 #ifndef REGTEST
 
@@ -42,7 +44,7 @@ struct _PDCLIB_file_t * _PDCLIB_filelist = &_PDCLIB_sin;
    1 kByte (+ 4 byte) of <ctype.h> data.
    Each line: flags, lowercase, uppercase, collation.
 */
-static struct _PDCLIB_ctype_t ctype_info[] = {
+static struct _PDCLIB_ctype_t _ctype[] = {
     { /* EOF */    0,    0,    0,    0 },
     { /* NUL */ _PDCLIB_CTYPE_CNTRL,                                             0x00, 0x00, 0x00 },
     { /* SOH */ _PDCLIB_CTYPE_CNTRL,                                             0x01, 0x01, 0x01 },
@@ -302,7 +304,33 @@ static struct _PDCLIB_ctype_t ctype_info[] = {
     { 0x00, 0xFF, 0xFF, 0xFF }
 };
 
-struct _PDCLIB_locale_t _PDCLIB_locale_info = { ctype_info + 1 };
+struct lconv _PDCLIB_lconv = { 
+    /* _PDCLIB_ctype      */ _ctype + 1,
+    /* decimal_point      */ (char *)".",
+    /* thousands_sep      */ (char *)"",
+    /* grouping           */ (char *)"",
+    /* mon_decimal_point  */ (char *)"",
+    /* mon_thousands_sep  */ (char *)"",
+    /* mon_grouping       */ (char *)"",
+    /* positive_sign      */ (char *)"",
+    /* negative_sign      */ (char *)"",
+    /* currency_symbol    */ (char *)"",
+    /* int_curr_symbol    */ (char *)"",
+    /* frac_digits        */ CHAR_MAX,
+    /* p_cs_precedes      */ CHAR_MAX,
+    /* n_cs_precedes      */ CHAR_MAX,
+    /* p_sep_by_space     */ CHAR_MAX,
+    /* n_sep_by_space     */ CHAR_MAX,
+    /* p_sign_posn        */ CHAR_MAX,
+    /* n_sign_posn        */ CHAR_MAX,
+    /* int_frac_digits    */ CHAR_MAX,
+    /* int_p_cs_precedes  */ CHAR_MAX,
+    /* int_n_cs_precedes  */ CHAR_MAX,
+    /* int_p_sep_by_space */ CHAR_MAX,
+    /* int_n_sep_by_space */ CHAR_MAX,
+    /* int_p_sign_posn    */ CHAR_MAX,
+    /* int_n_sign_posn    */ CHAR_MAX,
+};
 
 #endif