#define not !
#define and &&
#define or ||
+#define boolean int
+#define bool_str(VALUE) (VALUE?"TRUE":"FALSE")
#define TRUE 1
#define FALSE 0
-#define MAYBE (int)((_srtime?random():(_srtime=time(NULL),srandom(_srtime),random()))%2)
+#define MAYBE (int)((RANDOM_SEED?random():(RANDOM_SEED=time(NULL),srandom(RANDOM_SEED),random()))%2)
#define WHOKNOWS (int)(srandom(time(NULL)),random()%2)
-#define bool_str(I) (I?"TRUE":"FALSE")
-#define boolean int
+#define _GLOBALS time_t RANDOM_SEED=0; char *EOL="\n", *OFS=" ", *IFS=" \t\n", *NIL="NULL";
+#define coalesce(VALUE,NOTNULL) ((VALUE)?(VALUE):(NOTNULL))
#define mem struct
#define construct struct
/* ------------------------------------------------------------------- */
/* ------------------------------------------------------------------- */
/* 6. C<<1 va_list based library functions, updated 2008-01-22 by xCh. */
/* ------------------------------------------------------------------- */
-#define _ECHO void _cll1_print(int p,char *s, ... ) { int p2=0; va_list ap; for(va_start(ap,s);s!=(void *)&_cll1_print;s=va_arg(ap,char *)) { if(p) {if(p2) putchar(' '); else p2=1;} fputs(s?s:"",stdout); } va_end(ap); if(p) putchar('\n');}
+#define _ECHO void _cll1_print(int p,char *s, ... ) { int p2=0; va_list ap; for(va_start(ap,s);s!=(void *)&_cll1_print;s=va_arg(ap,char *)) { if(p) {if(p2) putchar(*OFS); else p2=1;} fputs(coalesce(s,NIL),stdout); } va_end(ap); if(p) putchar(*EOL);}
#define print(...) _cll1_print(1,__VA_ARGS__,(void *)&_cll1_print)
#define echo(...) _cll1_print(0,__VA_ARGS__,(void *)&_cll1_print)
/* ------------------------------------------------------------------- */
#define _ISTACK struct _IStack { int I; int _23; list(_IStack); } *_Iatom,*_Istack=NULL;
#define _SSTACK struct _SStack { char *S; int _23; list(_SSTACK); } *_Satom,*_Sstack=NULL;
#define _FSTACK struct _FStack { FILE *F; int _23; list(_FSTACK); } *_Fatom,*_Fstack=NULL;
-#define _SRTIME time_t _srtime=0;
+
#define _NEW_(ATOM,STACK,TYPE) (create(ATOM,TYPE),ATOM->_23=1,push(ATOM,STACK);ATOM->_23||pop(ATOM,STACK)&&0;ATOM->_23--)
#define _NEW_I for _NEW_(_Iatom,_Istack,_IStack)
/* ------------------------------------------------------------------- */
/* Voila - here we go ! */
/* ------------------------------------------------------------------- */
-#define define_cll1_globals _SRTIME _ISTACK _SSTACK _FSTACK _MSTACK _RSTACK //_QSTACK
+#define define_cll1_globals _GLOBALS _ISTACK _SSTACK _FSTACK _MSTACK _RSTACK //_QSTACK
#define implement_cll1_functions _ECHO // _GET_STR _GET_MEM
#define define_cll1_interfaces //_CAKE
#define implement_cll1_library define_cll1_globals implement_cll1_functions define_cll1_interfaces
program
{
- echo("Hello ",NULL," ","world"," ! ");
- print("Hello", "world",NULL,"!");
-
+ print("* echo()");
+ echo("Hello"," ","world"," !\n");
+ print("* print()");
+ print("Hello","world","!");
+ print("* MAYBE ?");
repeat(4) print((MAYBE ? "Hello" : "Hi"), (MAYBE ? "world" : "friend"), (MAYBE ? "!" : "?"));
+ print("* WHOKNOWS ?");
repeat(4) print((WHOKNOWS ? "Hello" : "Hi"), (WHOKNOWS ? "world" : "friend"), (WHOKNOWS ? "!" : "?"));
+ print("* NIL");
+ print("We can print",NULL,"safely.");
+ print("* coalesce():");
+ print("We can",coalesce("print","anything"),coalesce(NULL,"anything"),"safely.");
+ print("* OFS");
+ OFS=":";
+ print("We","can","customize","print");
}