From c58af358c9d4c576beab0bc63d54f1d6c787d1c6 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Mon, 9 Oct 2006 14:37:42 +0000 Subject: [PATCH] *** empty log message *** --- ase/awk/extio.c | 6 +++--- ase/awk/misc.c | 40 ++++++++++++++++++++++++++------------- ase/test/awk/awk.c | 8 ++++++-- ase/test/awk/comp.awk | 16 ++++++++++++++++ ase/test/awk/makefile.tcc | 3 +-- 5 files changed, 53 insertions(+), 20 deletions(-) diff --git a/ase/awk/extio.c b/ase/awk/extio.c index 2b3d80d8..d50f40d7 100644 --- a/ase/awk/extio.c +++ b/ase/awk/extio.c @@ -1,5 +1,5 @@ /* - * $Id: extio.c,v 1.49 2006-09-29 11:18:13 bacon Exp $ + * $Id: extio.c,v 1.50 2006-10-09 14:37:14 bacon Exp $ */ #include @@ -104,7 +104,7 @@ int xp_awk_readextio ( while (p != XP_NULL) { if (p->type == (extio_type | extio_mask) && - xp_awk_strcmp(p->name,name) == 0) break; + xp_awk_strcmp (p->name,name) == 0) break; p = p->next; } @@ -582,7 +582,7 @@ int xp_awk_nextextio_read ( while (p != XP_NULL) { if (p->type == (extio_type | extio_mask) && - xp_awk_strcmp(p->name,name) == 0) break; + xp_awk_strcmp (p->name,name) == 0) break; p = p->next; } diff --git a/ase/awk/misc.c b/ase/awk/misc.c index bed33422..7a94be8d 100644 --- a/ase/awk/misc.c +++ b/ase/awk/misc.c @@ -1,5 +1,5 @@ /* - * $Id: misc.c,v 1.25 2006-10-06 14:34:37 bacon Exp $ + * $Id: misc.c,v 1.26 2006-10-09 14:37:14 bacon Exp $ */ #include @@ -677,13 +677,24 @@ int xp_awk_strxncmp ( const xp_char_t* s1, xp_size_t len1, const xp_char_t* s2, xp_size_t len2) { + xp_char_t c1, c2; const xp_char_t* end1 = s1 + len1; const xp_char_t* end2 = s2 + len2; - while (s1 < end1 && s2 < end2 && *s1 == *s2) s1++, s2++; - if (s1 == end1 && s2 == end2) return 0; - if (*s1 == *s2) return (s1 < end1)? 1: -1; - return (*s1 > *s2)? 1: -1; + while (s1 < end1) + { + c1 = *s1; + if (s2 < end2) + { + c2 = *s2; + if (c1 > c2) return 1; + if (c1 < c2) return -1; + } + else return 1; + s1++; s2++; + } + + return (s2 < end2)? -1: 0; } int xp_awk_strxncasecmp ( @@ -695,17 +706,20 @@ int xp_awk_strxncasecmp ( const xp_char_t* end1 = s1 + len1; const xp_char_t* end2 = s2 + len2; - c1 = XP_AWK_TOUPPER (awk, *s1); - c2 = XP_AWK_TOUPPER (awk, *s2); - while (s1 < end1 && s2 < end2 && c1 == c2) + while (s1 < end1) { - s1++, s2++; c1 = XP_AWK_TOUPPER (awk, *s1); - c2 = XP_AWK_TOUPPER (awk, *s2); + if (s2 < end2) + { + c2 = XP_AWK_TOUPPER (awk, *s2); + if (c1 > c2) return 1; + if (c1 < c2) return -1; + } + else return 1; + s1++; s2++; } - if (s1 == end1 && s2 == end2) return 0; - if (c1 == c2) return (s1 < end1)? 1: -1; - return (c1 > c2)? 1: -1; + + return (s2 < end2)? -1: 0; } xp_char_t* xp_awk_strxnstr ( diff --git a/ase/test/awk/awk.c b/ase/test/awk/awk.c index 813e071b..fe3e4ffc 100644 --- a/ase/test/awk/awk.c +++ b/ase/test/awk/awk.c @@ -1,9 +1,8 @@ /* - * $Id: awk.c,v 1.91 2006-09-25 06:17:19 bacon Exp $ + * $Id: awk.c,v 1.92 2006-10-09 14:37:41 bacon Exp $ */ #include -#include #include #include #include @@ -15,6 +14,7 @@ #ifndef __STAND_ALONE #include + #include #include #include #include @@ -27,6 +27,10 @@ #else #define XP_PATH_MAX PATH_MAX #endif + + #ifdef _WIN32 + #define xp_sprintf _sntprintf + #endif #endif #ifdef _WIN32 diff --git a/ase/test/awk/comp.awk b/ase/test/awk/comp.awk index c535b2f4..a229299f 100644 --- a/ase/test/awk/comp.awk +++ b/ase/test/awk/comp.awk @@ -90,6 +90,22 @@ BEGIN { print "10.0 > \"10\"", (10.0 > "10"); print "10.0 < \"10\"", (10.0 < "10"); + print "--------------------------"; + print "\"10\" == 10.0", ("10" == 10.0); + print "\"10\" != 10.0", ("10" != 10.0); + print "\"10\" >= 10.0", ("10" >= 10.0); + print "\"10\" <= 10.0", ("10" <= 10.0); + print "\"10\" > 10.0", ("10" > 10.0); + print "\"10\" < 10.0", ("10" < 10.0); + + print "--------------------------"; + print "\"10\" == 10.1", ("10" == 10.1); + print "\"10\" != 10.1", ("10" != 10.1); + print "\"10\" >= 10.1", ("10" >= 10.1); + print "\"10\" <= 10.1", ("10" <= 10.1); + print "\"10\" > 10.1", ("10" > 10.1); + print "\"10\" < 10.1", ("10" < 10.1); + #a[10] = 2; #print a == 1; diff --git a/ase/test/awk/makefile.tcc b/ase/test/awk/makefile.tcc index 823045e6..6dfc120a 100644 --- a/ase/test/awk/makefile.tcc +++ b/ase/test/awk/makefile.tcc @@ -6,12 +6,11 @@ LIBS = xpawk.lib all: awk awk: awk.obj - tcc $(LDFLAGS) -mh -eawk.exe awk.obj $(LIBS) + $(CC) $(LDFLAGS) -mh -eawk.exe awk.obj $(LIBS) clean: del $(OBJS) *.obj $(OUT) -.SUFFIXES: .c .obj .c.obj: $(CC) $(CFLAGS) -c $<