From 35f724b6c93bb7fdb83531a8c8713dffbc02489d Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Thu, 28 Sep 2006 13:48:25 +0000 Subject: [PATCH] *** empty log message *** --- ase/awk/run.c | 7 +++---- ase/test/awk/comp.awk | 40 ++++++++++++++++++++++++++++++++++------ 2 files changed, 37 insertions(+), 10 deletions(-) diff --git a/ase/awk/run.c b/ase/awk/run.c index c41e3f48..d0dd133b 100644 --- a/ase/awk/run.c +++ b/ase/awk/run.c @@ -1,5 +1,5 @@ /* - * $Id: run.c,v 1.210 2006-09-28 06:56:30 bacon Exp $ + * $Id: run.c,v 1.211 2006-09-28 13:47:58 bacon Exp $ */ #include @@ -2804,8 +2804,7 @@ static int __cmp_nil_real ( static int __cmp_nil_str ( xp_awk_run_t* run, xp_awk_val_t* left, xp_awk_val_t* right) { - /* TODO */ - return 0; + return (((xp_awk_val_str_t*)right)->len == 0)? 0: -1; } static int __cmp_int_nil ( @@ -2881,7 +2880,7 @@ static int __cmp_real_str ( static int __cmp_str_nil ( xp_awk_run_t* run, xp_awk_val_t* left, xp_awk_val_t* right) { - return __cmp_nil_str (run, right, left); + return (((xp_awk_val_str_t*)left)->len == 0)? 0: 1; } static int __cmp_str_int ( diff --git a/ase/test/awk/comp.awk b/ase/test/awk/comp.awk index 2b08d3b3..41b7c551 100644 --- a/ase/test/awk/comp.awk +++ b/ase/test/awk/comp.awk @@ -1,16 +1,44 @@ BEGIN { - print 1 == 1; - print 1 == 0; + print "1==1 : " (1 == 1); + print "1==0 : " (1 == 0); - print 1.0 == 1; - print 1.1 == 1; + print "1.0==1 : " (1.0 == 1); + print "1.1==1 : " (1.1 == 1); - print 1.0 != 1; - print 1.1 != 1; + print "1.0!=1 : " (1.0 != 1); + print "1.1!=1 : " (1.1 != 1); print "abc" == "abc"; print "abc" != "abc"; + print "------------------------"; + print "a == \"\" : " (a == ""); + print "a >= \"\" : " (a >= ""); + print "a <= \"\" : " (a <= ""); + print "a > \"\" : " (a > ""); + print "a < \"\" : " (a < ""); + + print "------------------------"; + print "a == \" \" : " (a == " "); + print "a >= \" \" : " (a >= " "); + print "a <= \" \" : " (a <= " "); + print "a > \" \" : " (a > " "); + print "a < \" \" : " (a < " "); + + print "------------------------"; + print "\"\" == a : " ("" == a); + print "\"\" >= a: " ("" >= a); + print "\"\" <= a: " ("" <= a); + print "\"\" > a: " ("" > a); + print "\"\" < a: " ("" < a); + + print "------------------------"; + print "\" \" == a : " (" " == a); + print "\" \" >= a: " (" " >= a); + print "\" \" <= a: " (" " <= a); + print "\" \" > a: " (" " > a); + print "\" \" < a: " (" " < a); + a[10] = 2; print a == 1; }