From: xchaos Date: Thu, 24 Jan 2008 15:05:41 +0000 (+0000) Subject: advanced hello world X-Git-Url: https://git.harvie.cz/?a=commitdiff_plain;h=21720b7b452dd15e967b7cc860c620f2175d0d2b;p=svn%2FCll1h%2F.git advanced hello world git-svn-id: https://dev.arachne.cz/repos/cll1h/trunk@37 4bb87942-c103-4e5a-b51c-0ebff58f8515 --- diff --git a/cll1.h b/cll1.h index 68053d6..4dc23e1 100644 --- a/cll1.h +++ b/cll1.h @@ -46,7 +46,8 @@ #define or || #define TRUE 1 #define FALSE 0 -#define MAYBE (int)(srandom(time(NULL)),random()%2) +#define MAYBE (int)((_srtime?0:(time(&_srtime),srandom(_srtime))),random()%2) +#define WHOKNOWS (int)(srandom(time(NULL)),random()%2) #define bool_str(I) (I?"TRUE":"FALSE") #define boolean int #define mem struct @@ -189,7 +190,7 @@ obsolete #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) @@ -261,9 +262,10 @@ obsolete /* ------------------------------------------------------------------- */ /* Voila - here we go ! */ /* ------------------------------------------------------------------- */ -#define define_cll1_globals _ISTACK _SSTACK _FSTACK _MSTACK _RSTACK //_QSTACK -#define implement_cll1_functions _ECHO /* _GET_STR _GET_MEM */ -#define implement_cll1_library define_cll1_globals implement_cll1_functions +#define define_cll1_globals _SRTIME _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 #define program implement_cll1_library int main(int argc, char **argv) /* ------------------------------------------------------------------- */ #endif diff --git a/demos/advanced-hello-world.c b/demos/advanced-hello-world.c index 1212211..0c16665 100644 --- a/demos/advanced-hello-world.c +++ b/demos/advanced-hello-world.c @@ -2,6 +2,8 @@ program { - echo("Hello ",NULL,"world"," ! "); - print("Hello","world",NULL,"!"); + echo("Hello ",NULL," ","world"," ! "); + print("Hello", "world",NULL,"!"); + + print(MAYBE ? "Hello" : "Hi", WHOKNOWS ? "world" : "friend", MAYBE ? "!" : "?"); }