print and echo can now skip NULL strings...
authorxchaos <xchaos@4bb87942-c103-4e5a-b51c-0ebff58f8515>
Tue, 22 Jan 2008 09:49:53 +0000 (09:49 +0000)
committerxchaos <xchaos@4bb87942-c103-4e5a-b51c-0ebff58f8515>
Tue, 22 Jan 2008 09:49:53 +0000 (09:49 +0000)
git-svn-id: https://dev.arachne.cz/repos/cll1h/trunk@21 4bb87942-c103-4e5a-b51c-0ebff58f8515

cll1.h
demos/hello.c
demos/performance/test-performance

diff --git a/cll1.h b/cll1.h
index 5305e3c125674c0085f2ec45b6235f1c7fc4ad07..a5c4c9d60dd8c00e77fb4270ed8bea2a5fda9779 100644 (file)
--- a/cll1.h
+++ b/cll1.h
 /* ------------------------------------------------------------------- */
 /* 6. C<<1 va_list based library functions, updated 2008-01-22 by xCh. */
 /* ------------------------------------------------------------------- */
-#define _ECHO void _echo(char *s, ... ) { va_list ap; for(va_start(ap,s);s;s=va_arg(ap,char *)) fputs(s,stdout); va_end(ap); }
-#define print(...) _echo(__VA_ARGS__,"\n",NULL)
-#define echo(...) _echo(__VA_ARGS__,NULL)
+#define _ECHO void _cll1_print(int nl,char *s, ... ) { va_list ap; for(va_start(ap,s);s!=(void *)&_cll1_print;s=va_arg(ap,char *)) fputs(s?s:"",stdout); va_end(ap); if(nl) putchar('\n');}
+#define print(...) _cll1_print(1,__VA_ARGS__,(void *)&_cll1_print)
+#define echo(...) _cll1_print(0,__VA_ARGS__,(void *)&_cll1_print)
 /* ------------------------------------------------------------------- */
 /* 8. C<<1 CGI and FASTCGI handling, updated 2008-01-16 by xCh.        */
 /* ------------------------------------------------------------------- */
index b59bc77fa347e398e0cfcfc5e616c3616bcfa750..17135333fca1d3108dfb2b8c3fb7908aef447f0b 100644 (file)
@@ -2,6 +2,6 @@
 
 program
 {
- echo("Hello ","world","! ");
- print("Hello ","world","!");
+ echo("Hello ","world",NULL,"! ");
+ print("Hello ",NULL,"world","!");
 }
index c752da474747aad5f054791cad8a53e25b3f848e..8a69facdeb3f0c0367206240c6c757bdcba5d511 100755 (executable)
@@ -6,19 +6,19 @@ make fputs
 clear
 cat print.py
 echo "Running..."
-time ./print.py &> /dev/null
+time ./print.py > /dev/null
 cat print.pl
 echo "Running..."
-time ./print.pl &> /dev/null
+time ./print.pl > /dev/null
 cat cll1-print.c
 echo "Running..."
-time ./cll1-print &> /dev/null
+time ./cll1-print > /dev/null
 cat printf.c
 echo "Running..."
-time ./printf &> /dev/null
+time ./printf > /dev/null
 cat puts.c
 echo "Running..."
-time ./puts &> /dev/null
+time ./puts > /dev/null
 cat fputs.c
 echo "Running..."
-time ./fputs &> /dev/null
+time ./fputs > /dev/null
This page took 0.138117 seconds and 4 git commands to generate.