From 44b8df437027da30600159577c3ca7c183815bdd Mon Sep 17 00:00:00 2001 From: Darin Adler Date: Mon, 17 Sep 2001 15:27:04 +0000 Subject: [PATCH] Change so that it works on platforms where isalpha is a macro only, * tests/strfunc-test.c: (main): Change so that it works on platforms where isalpha is a macro only, without the corresponding function that the C standard requires. Also eliminate the multiple lists of ctype functions. * tests/.cvsignore: Ignore the new test. --- ChangeLog | 9 ++++ ChangeLog.pre-2-0 | 9 ++++ ChangeLog.pre-2-10 | 9 ++++ ChangeLog.pre-2-12 | 9 ++++ ChangeLog.pre-2-2 | 9 ++++ ChangeLog.pre-2-4 | 9 ++++ ChangeLog.pre-2-6 | 9 ++++ ChangeLog.pre-2-8 | 9 ++++ tests/.cvsignore | 1 + tests/strfunc-test.c | 104 ++++++++++++------------------------------- 10 files changed, 101 insertions(+), 76 deletions(-) diff --git a/ChangeLog b/ChangeLog index 766bb991e..517ae6f3a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2001-09-17 Darin Adler + + * tests/strfunc-test.c: (main): Change so that it works + on platforms where isalpha is a macro only, without the + corresponding function that the C standard requires. + Also eliminate the multiple lists of ctype functions. + + * tests/.cvsignore: Ignore the new test. + 2001-09-17 Tor Lillqvist * configure.in: Add variable for LT_CURRENT minus LT_AGE (the diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 766bb991e..517ae6f3a 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,12 @@ +2001-09-17 Darin Adler + + * tests/strfunc-test.c: (main): Change so that it works + on platforms where isalpha is a macro only, without the + corresponding function that the C standard requires. + Also eliminate the multiple lists of ctype functions. + + * tests/.cvsignore: Ignore the new test. + 2001-09-17 Tor Lillqvist * configure.in: Add variable for LT_CURRENT minus LT_AGE (the diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 766bb991e..517ae6f3a 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,12 @@ +2001-09-17 Darin Adler + + * tests/strfunc-test.c: (main): Change so that it works + on platforms where isalpha is a macro only, without the + corresponding function that the C standard requires. + Also eliminate the multiple lists of ctype functions. + + * tests/.cvsignore: Ignore the new test. + 2001-09-17 Tor Lillqvist * configure.in: Add variable for LT_CURRENT minus LT_AGE (the diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 766bb991e..517ae6f3a 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,12 @@ +2001-09-17 Darin Adler + + * tests/strfunc-test.c: (main): Change so that it works + on platforms where isalpha is a macro only, without the + corresponding function that the C standard requires. + Also eliminate the multiple lists of ctype functions. + + * tests/.cvsignore: Ignore the new test. + 2001-09-17 Tor Lillqvist * configure.in: Add variable for LT_CURRENT minus LT_AGE (the diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 766bb991e..517ae6f3a 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,12 @@ +2001-09-17 Darin Adler + + * tests/strfunc-test.c: (main): Change so that it works + on platforms where isalpha is a macro only, without the + corresponding function that the C standard requires. + Also eliminate the multiple lists of ctype functions. + + * tests/.cvsignore: Ignore the new test. + 2001-09-17 Tor Lillqvist * configure.in: Add variable for LT_CURRENT minus LT_AGE (the diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 766bb991e..517ae6f3a 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,12 @@ +2001-09-17 Darin Adler + + * tests/strfunc-test.c: (main): Change so that it works + on platforms where isalpha is a macro only, without the + corresponding function that the C standard requires. + Also eliminate the multiple lists of ctype functions. + + * tests/.cvsignore: Ignore the new test. + 2001-09-17 Tor Lillqvist * configure.in: Add variable for LT_CURRENT minus LT_AGE (the diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 766bb991e..517ae6f3a 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,12 @@ +2001-09-17 Darin Adler + + * tests/strfunc-test.c: (main): Change so that it works + on platforms where isalpha is a macro only, without the + corresponding function that the C standard requires. + Also eliminate the multiple lists of ctype functions. + + * tests/.cvsignore: Ignore the new test. + 2001-09-17 Tor Lillqvist * configure.in: Add variable for LT_CURRENT minus LT_AGE (the diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 766bb991e..517ae6f3a 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,12 @@ +2001-09-17 Darin Adler + + * tests/strfunc-test.c: (main): Change so that it works + on platforms where isalpha is a macro only, without the + corresponding function that the C standard requires. + Also eliminate the multiple lists of ctype functions. + + * tests/.cvsignore: Ignore the new test. + 2001-09-17 Tor Lillqvist * configure.in: Add variable for LT_CURRENT minus LT_AGE (the diff --git a/tests/.cvsignore b/tests/.cvsignore index 41b92ac35..220aedc45 100644 --- a/tests/.cvsignore +++ b/tests/.cvsignore @@ -37,6 +37,7 @@ strfunc-test string-test thread-test threadpool-test +timeloop-closure tree-test type-test unicode-encoding diff --git a/tests/strfunc-test.c b/tests/strfunc-test.c index fa3089a02..5e361b9f3 100644 --- a/tests/strfunc-test.c +++ b/tests/strfunc-test.c @@ -91,73 +91,35 @@ str_check (gchar *str, return ok; } -static gboolean -test_isalnum (gchar c) -{ - return g_ascii_isalnum (c); -} +#define FOR_ALL_CTYPE(macro) \ + macro(isalnum) \ + macro(isalpha) \ + macro(iscntrl) \ + macro(isdigit) \ + macro(isgraph) \ + macro(islower) \ + macro(isprint) \ + macro(ispunct) \ + macro(isspace) \ + macro(isupper) \ + macro(isxdigit) -static gboolean -test_isalpha (gchar c) -{ - return g_ascii_isalpha (c); -} - -static gboolean -test_iscntrl (gchar c) -{ - return g_ascii_iscntrl (c); -} - -static gboolean -test_isdigit (gchar c) -{ - return g_ascii_isdigit (c); -} - -static gboolean -test_isgraph (gchar c) -{ - return g_ascii_isgraph (c); -} - -static gboolean -test_islower (gchar c) -{ - return g_ascii_islower (c); -} - -static gboolean -test_isprint (gchar c) -{ - return g_ascii_isprint (c); -} - -static gboolean -test_ispunct (gchar c) -{ - return g_ascii_ispunct (c); -} - -static gboolean -test_isspace (gchar c) -{ - return g_ascii_isspace (c); -} - -static gboolean -test_isupper (gchar c) -{ - return g_ascii_isupper (c); -} - -static gboolean -test_isxdigit (gchar c) -{ - return g_ascii_isxdigit (c); -} +#define DEFINE_CALL_CTYPE(function) \ + static int \ + call_##function (int c) \ + { \ + return function (c); \ + } +#define DEFINE_CALL_G_ASCII_CTYPE(function) \ + static gboolean \ + call_g_ascii_##function (gchar c) \ + { \ + return g_ascii_##function (c); \ + } +FOR_ALL_CTYPE (DEFINE_CALL_CTYPE) +FOR_ALL_CTYPE (DEFINE_CALL_G_ASCII_CTYPE) static void test_is_function (const char *name, @@ -335,19 +297,9 @@ main (int argc, TEST (NULL, strv_check (g_strsplit (",,x,,y,,z,,", ",", 2), "", ",x,,y,,z,,", NULL)); TEST (NULL, strv_check (g_strsplit (",,x,,y,,z,,", ",,", 2), "", "x,,y,,z,,", NULL)); - #define TEST_IS(name) test_is_function (#name, test_##name, name, g_unichar_##name) + #define TEST_IS(name) test_is_function (#name, call_g_ascii_##name, call_##name, g_unichar_##name); - TEST_IS (isalnum); - TEST_IS (isalpha); - TEST_IS (iscntrl); - TEST_IS (isdigit); - TEST_IS (isgraph); - TEST_IS (islower); - TEST_IS (isprint); - TEST_IS (ispunct); - TEST_IS (isspace); - TEST_IS (isupper); - TEST_IS (isxdigit); + FOR_ALL_CTYPE(TEST_IS) #undef TEST_IS