[uClibc-cvs] uClibc/libc/misc/ctype Makefile, 1.13, 1.14 ctype.c, 1.16, 1.17
Manuel Novoa III
mjn3 at uclibc.org
Mon Sep 8 20:33:36 UTC 2003
Update of /var/cvs/uClibc/libc/misc/ctype
In directory winder:/tmp/cvs-serv11607/libc/misc/ctype
Modified Files:
Makefile ctype.c
Log Message:
Add back in table-less ctype funcs for those interested in minimizing
static build sizes and not needing wchar support.
Add in a SUSv3 getopt as an option for those not needing gnu getopt.
Again, mainly for the static linking crowd.
Index: ctype.c
===================================================================
RCS file: /var/cvs/uClibc/libc/misc/ctype/ctype.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- ctype.c 28 Aug 2003 17:16:52 -0000 1.16
+++ ctype.c 8 Sep 2003 20:33:10 -0000 1.17
@@ -42,6 +42,7 @@
#endif /* __UCLIBC_HAS_XLOCALE__ */
/**********************************************************************/
+#ifdef __UCLIBC_HAS_CTYPE_TABLES__
#ifdef __UCLIBC_HAS_CTYPE_SIGNED__
@@ -65,6 +66,7 @@
#endif /* __UCLIBC_HAS_CTYPE_SIGNED__ */
+#endif /* __UCLIBC_HAS_CTYPE_TABLES__ */
/**********************************************************************/
#ifdef __UCLIBC_MJN3_ONLY__
#ifdef L_isspace
@@ -74,6 +76,11 @@
#warning TODO: Optimize the isx*() funcs.
#endif
#endif /* __UCLIBC_MJN3_ONLY__ */
+/**********************************************************************/
+#undef PASTE2
+#define PASTE2(X,Y) X ## Y
+
+#ifdef __UCLIBC_HAS_CTYPE_TABLES__
#undef CTYPE_NAME
#undef ISCTYPE
@@ -87,8 +94,6 @@
#define ISCTYPE(C,F) __isctype( C, F )
#define CTYPE_ALIAS(NAME)
#endif
-#undef PASTE2
-#define PASTE2(X,Y) X ## Y
#undef CTYPE_BODY
@@ -135,6 +140,18 @@
CTYPE_ALIAS(NAME)
+#else /* __UCLIBC_HAS_CTYPE_TABLES__ */
+
+#define C_MACRO(X) PASTE2(__C_is,X)(c)
+#define CTYPE_NAME(X) is ## X
+
+#define IS_FUNC_BODY(NAME) \
+int CTYPE_NAME(NAME) (int c) \
+{ \
+ return C_MACRO(NAME); \
+}
+
+#endif /* __UCLIBC_HAS_CTYPE_TABLES__ */
/**********************************************************************/
#ifdef L___ctype_assert
#ifdef __UCLIBC_HAS_CTYPE_ENFORCED__
@@ -176,6 +193,8 @@
/**********************************************************************/
#if defined(L_isdigit) || defined(L_isdigit_l)
+#ifdef __UCLIBC_HAS_CTYPE_TABLES__
+
/* The standards require EOF < 0. */
#if EOF >= CHAR_MIN
#define __isdigit_char_or_EOF(C) __isdigit_char((C))
@@ -197,6 +216,12 @@
CTYPE_ALIAS(digit)
+#else /* __UCLIBC_HAS_CTYPE_TABLES__ */
+
+IS_FUNC_BODY(digit);
+
+#endif /* __UCLIBC_HAS_CTYPE_TABLES__ */
+
#endif
/**********************************************************************/
#if defined(L_isgraph) || defined(L_isgraph_l)
@@ -243,6 +268,8 @@
/**********************************************************************/
#ifdef L_tolower
+#ifdef __UCLIBC_HAS_CTYPE_TABLES__
+
int tolower(int c)
{
#if defined(__UCLIBC_HAS_CTYPE_ENFORCED__)
@@ -251,6 +278,15 @@
return __UCLIBC_CTYPE_IN_TO_DOMAIN(c) ? (__UCLIBC_CTYPE_TOLOWER)[c] : c;
}
+#else /* __UCLIBC_HAS_CTYPE_TABLES__ */
+
+int tolower(int c)
+{
+ return __C_tolower(c);
+}
+
+#endif /* __UCLIBC_HAS_CTYPE_TABLES__ */
+
#endif
/**********************************************************************/
#ifdef L_tolower_l
@@ -272,6 +308,8 @@
/**********************************************************************/
#ifdef L_toupper
+#ifdef __UCLIBC_HAS_CTYPE_TABLES__
+
int toupper(int c)
{
#if defined(__UCLIBC_HAS_CTYPE_ENFORCED__)
@@ -280,6 +318,15 @@
return __UCLIBC_CTYPE_IN_TO_DOMAIN(c) ? (__UCLIBC_CTYPE_TOUPPER)[c] : c;
}
+#else /* __UCLIBC_HAS_CTYPE_TABLES__ */
+
+int toupper(int c)
+{
+ return __C_toupper(c);
+}
+
+#endif /* __UCLIBC_HAS_CTYPE_TABLES__ */
+
#endif
/**********************************************************************/
#ifdef L_toupper_l
@@ -301,6 +348,8 @@
/**********************************************************************/
#if defined(L_isascii) || defined(L_isascii_l)
+#ifdef __UCLIBC_HAS_CTYPE_TABLES__
+
int __XL(isascii)(int c)
{
return __isascii(c); /* locale-independent */
@@ -308,10 +357,21 @@
__XL_ALIAS(isascii)
+#else /* __UCLIBC_HAS_CTYPE_TABLES__ */
+
+int isascii(int c)
+{
+ return __isascii(c); /* locale-independent */
+}
+
+#endif /* __UCLIBC_HAS_CTYPE_TABLES__ */
+
#endif
/**********************************************************************/
#if defined(L_toascii) || defined(L_toascii_l)
+#ifdef __UCLIBC_HAS_CTYPE_TABLES__
+
int __XL(toascii)(int c)
{
return __toascii(c); /* locale-independent */
@@ -319,12 +379,23 @@
__XL_ALIAS(toascii)
+#else /* __UCLIBC_HAS_CTYPE_TABLES__ */
+
+int toascii(int c)
+{
+ return __toascii(c); /* locale-independent */
+}
+
+#endif /* __UCLIBC_HAS_CTYPE_TABLES__ */
+
#endif
/**********************************************************************/
/* old uClibc extensions */
/**********************************************************************/
#ifdef L_isxlower
+#ifdef __UCLIBC_HAS_CTYPE_TABLES__
+
int isxlower(int C)
{
#if defined(__UCLIBC_HAS_CTYPE_ENFORCED__)
@@ -341,10 +412,18 @@
#endif
}
+#else /* __UCLIBC_HAS_CTYPE_TABLES__ */
+
+IS_FUNC_BODY(xlower);
+
+#endif /* __UCLIBC_HAS_CTYPE_TABLES__ */
+
#endif
/**********************************************************************/
#ifdef L_isxupper
+#ifdef __UCLIBC_HAS_CTYPE_TABLES__
+
int isxupper(int C)
{
#if defined(__UCLIBC_HAS_CTYPE_ENFORCED__)
@@ -361,6 +440,12 @@
#endif
}
+#else /* __UCLIBC_HAS_CTYPE_TABLES__ */
+
+IS_FUNC_BODY(xupper);
+
+#endif /* __UCLIBC_HAS_CTYPE_TABLES__ */
+
#endif
/**********************************************************************/
/* glibc extensions */
Index: Makefile
===================================================================
RCS file: /var/cvs/uClibc/libc/misc/ctype/Makefile,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- Makefile 1 Aug 2003 20:08:46 -0000 1.13
+++ Makefile 8 Sep 2003 20:33:10 -0000 1.14
@@ -28,10 +28,13 @@
MOBJ= isalnum.o isalpha.o isascii.o iscntrl.o isdigit.o \
isgraph.o islower.o isprint.o ispunct.o isspace.o \
isupper.o isxdigit.o toascii.o tolower.o toupper.o \
- isblank.o isctype.o isxlower.o isxupper.o \
- __C_ctype_b.o __C_ctype_tolower.o __C_ctype_toupper.o \
+ isblank.o isxlower.o isxupper.o
+
+ifeq ($(UCLIBC_HAS_CTYPE_TABLES),y)
+MOBJ += __C_ctype_b.o __C_ctype_tolower.o __C_ctype_toupper.o \
__ctype_b_loc.o __ctype_tolower_loc.o __ctype_toupper_loc.o \
- __ctype_assert.o
+ __ctype_assert.o isctype.o
+endif
MOBJx= isalnum_l.o isalpha_l.o isascii_l.o iscntrl_l.o isdigit_l.o \
isgraph_l.o islower_l.o isprint_l.o ispunct_l.o isspace_l.o \
More information about the uClibc-cvs
mailing list