preliminary work on version 0.7.1 - WARNING, HIGHLY UNSTABLE !
authorxchaos <xchaos@4bb87942-c103-4e5a-b51c-0ebff58f8515>
Mon, 7 Jan 2008 01:38:42 +0000 (01:38 +0000)
committerxchaos <xchaos@4bb87942-c103-4e5a-b51c-0ebff58f8515>
Mon, 7 Jan 2008 01:38:42 +0000 (01:38 +0000)
git-svn-id: https://dev.arachne.cz/repos/cll1h/trunk@4 4bb87942-c103-4e5a-b51c-0ebff58f8515

16 files changed:
ABOUT
cll1.h
cll1.txt
demo.c [deleted file]
demos/arguments1.c
demos/hello.c [new file with mode: 0644]
demos/idmap.c
demos/lists.c
demos/repeat.c [new file with mode: 0644]
demos/strings.c [new file with mode: 0644]
fastcgi/cll1.h [new symlink]
fastcgi/fastcgi.c [new file with mode: 0644]
mysql/cll1.h [new symlink]
mysql/mysql.c [new file with mode: 0644]
tools/bake [new file with mode: 0755]
tools/bake.conf [new file with mode: 0644]

diff --git a/ABOUT b/ABOUT
index 013639eb61398e35e8eb20a52057730bde352de5..6aed118172d6e0e3791194cd1eada6b91df535a3 100644 (file)
--- a/ABOUT
+++ b/ABOUT
@@ -1,3 +1,6 @@
+THIS FILE IS UNFINISHED !!!!
+
+
 This file is called ABOUT, because it is, well... README, INSTALL, HOWTO,
 FAWQ, RTFM and maybe even manual, all in one file. So why not calling it
 ABOUT.
 This file is called ABOUT, because it is, well... README, INSTALL, HOWTO,
 FAWQ, RTFM and maybe even manual, all in one file. So why not calling it
 ABOUT.
diff --git a/cll1.h b/cll1.h
index 3e09887de7d725552e52a795d7e3f99ac3fc7454..597a76adcbb260f32fbe04ddf127ae84fb3904f4 100644 (file)
--- a/cll1.h
+++ b/cll1.h
@@ -1,8 +1,8 @@
-
-/* C<<1 header file v0.7 - style sheet for ANSI C  */
-/* Please pronounce as "cee-shift-left-by-one" :)  */
-
-/* Copyright (G) 2004-2007 Michael xChaos Polak, x(at)n.cz
+/* ------------------------------------------------------------------- */
+/* C<<1 header file v0.7.1 - style sheet for ANSI C                    */
+/* CERL - Cumbersome Extraction and Report Language                    */
+/* ------------------------------------------------------------------- */
+/* Copyright (c) 2004-2008 Michael xChaos Polak, x(at)n.cz
 
    The C<<1 header file is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
 
    The C<<1 header file is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
 
    You should have received a copy of the GNU Lesser General Public
    License along with the GNU C Library; if not, write to 
 
    You should have received a copy of the GNU Lesser General Public
    License along with the GNU C Library; if not, write to 
-   Michael Polak, Svojsikova 7, 169 00 Praha 6 Czech Republic */
-
-
+   Michael Polak, Svojsikova 7, 169 00 Praha 6 Czech Republic          */
+/* ------------------------------------------------------------------- */
 #ifndef __CLL1H__
 #define __CLL1H__
 
 #ifndef __CLL1H__
 #define __CLL1H__
 
-#include <stdio.h>
 #include <string.h>
 #include <string.h>
+#include <malloc.h>
 #include <time.h>
 #include <time.h>
-#include <malloc.h> 
-#include <stdlib.h> 
-
-/* Section For Dummies part 1, updated 2004-05-07 by xCh. */
-
+#include <stdlib.h>
+#include <unistd.h>
+#ifdef USE_LIBRARY_MYSQL
+#include <mysql/mysql.h>
+#endif
+#ifdef USE_LIBRARY_FASTCGI
+#include <fcgi_stdio.h>
+#else
+#include <stdio.h>
+#endif
+/* ------------------------------------------------------------------- */
+/* 1. C<<1 constants and optional keywords, updated 2008-01-07 by xCh. */
+/* ------------------------------------------------------------------- */
+#define then
 #define not !
 #define and &&
 #define or ||
 #define TRUE 1
 #define FALSE 0
 #define not !
 #define and &&
 #define or ||
 #define TRUE 1
 #define FALSE 0
-#define loop while(1)
-//#define iterate(VAR,FROM,TO) for(VAR=FROM; VAR <= TO; VAR++)
-//#define repeat(N) iterate(_i,1,N)
-#define repeat(N) _NEW_I for range(_I,1,N)
-
-/* Dynamic list macros & sequences, updated 2003-05-29 by xCh. */
-
-#define list(T) struct T *_next 
-#define create(A,T) (A=(struct T *)malloc(sizeof(struct T)),A->_next=NULL)
+/* ------------------------------------------------------------------- */
+/* 2. C<<1 data types - updated 2008-01-07 by xCh.                     */
+/* ------------------------------------------------------------------- */
+#define list(T) struct T *_next
+#define tree(T) struct T *_next;struct T *_seek
+#define create(A,T) (A=(struct T *)malloc(sizeof(struct T)),A->_next=NULL,A)
 #define push(A,B) ((A && A!=B)?A->_next=B:0,B=A)
 #define pop(A,B) (B?((A?free(A):0),A=B=B->_next):(A=NULL))
 #define push(A,B) ((A && A!=B)?A->_next=B:0,B=A)
 #define pop(A,B) (B?((A?free(A):0),A=B=B->_next):(A=NULL))
-#define append(A,B) if(B) { void *N=A; A->_next=NULL; search(A,B,!A->_next) {A->_next=N; break;}} else push(A,B);
-#define remove(A,B,C) { void **_D=NULL; for each(A,B) if(C) { if(_D)*_D=A->_next; else B=A->_next; free(A);} else _D=(void *)&(A->_next); }
+#define append(A,B) if(B) { void *N=A; A->_next=NULL; for_search(A,B,!A->_next) {A->_next=N; break;}} else push(A,B);
+#define remove(A,B,C) { void **_D=NULL; for_search(A,B,C) { if(_D)*_D=A->_next; else B=A->_next; free(A); A=NULL;} else _D=(void *)&(A->_next); }
 #define drop(A,B) for( A=B; A || (B=NULL); B=A, A=A->_next, free(B) )
 #define drop(A,B) for( A=B; A || (B=NULL); B=A, A=A->_next, free(B) )
-
-/* Dynamic list iterations and sequences, updated 2003-05-29 by xCh. */
-
-#define every(A,B) for( A=B; A; A=A->_next)
-#define search(A,B,C) every(A,B) if(C)
-#define find(A,B,C) search(A,B,C) break; if(A)
-
-/* Enlightened iterations usable in for() , updated 2007-12-11 by xCh. */
-
-#define range(VAR,FROM,TO) (VAR=FROM; VAR <= TO; VAR++)
-#define each(A,B) ( A=B; A; A=A->_next)
-#define lines(STR,F) ()
-
+/* ------------------------------------------------------------------- */
+/* 3. C<<1 iterators - updated 2008-01-07 by xCh.                      */
+/* ------------------------------------------------------------------- */
+#define loop while(TRUE)
+#define repeat(N) _NEW_I for_range(_I,1,N)
+#define for_range(VAR,FROM,TO) for(VAR=FROM; FROM<=TO?VAR<=TO:VAR>=TO; FROM<=TO?VAR++:VAR--)
+#define for_each(A,B) for(A=B; A; A=A->_next)
+#define for_search(A,B,C) for_each(A,B) if(C)
+/*to do: #define for_file_lines(STR,F) _NEW_F for() */
+#ifdef USE_LIBRARY_MYSQL
+#define for_mysql_query_results(ROW,QUERY) _NEW_(_Ratom,_Rstack,_RStack)for(_Ratom->R=(mysql_query(_Matom->M,QUERY)?NULL:mysql_use_result(_Matom->M)),ROW=(_Ratom->R?mysql_fetch_row(_Ratom->R):NULL);ROW;ROW=mysql_fetch_row(_Ratom->R))
+#endif
+#ifdef USE_LIBRARY_FASTCGI
+#define while_fastcgi_accept while(FCGI_Accept()>=0)
+#endif
+/*obsolete #define every(A,B) for( A=B; A; A=A->_next) */
+/*obsolete #define search(A,B,C) every(A,B) if(C) */
+/*obsolete #define find(A,B,C) search(A,B,C) break; if(A) */
+
+/* ------------------------------------------------------------------- */
+/* 4.C<<1 conditionals - updated 2008-01-07 by xCh.                    */ 
+/* ------------------------------------------------------------------- */
+#define if_exists(A,B,C) for_search(A,B,C) break; if(A)
+
+/* ------------------------------------------------------------------- */
+/* old - from version 0.6 */
+/* ------------------------------------------------------------------- */
 /* EXP macros for Dummysort sequences, updated 2003-05-29 by xCh. */
 
 #define order_by(K1,K2) (K1>K2)
 /* EXP macros for Dummysort sequences, updated 2003-05-29 by xCh. */
 
 #define order_by(K1,K2) (K1>K2)
@@ -73,7 +92,7 @@
 
 /* Dummysort sequences, updated 2003-05-29 by xCh. */
 
 
 /* Dummysort sequences, updated 2003-05-29 by xCh. */
 
-#define insert(A,B,EXP,K) { if(B) { void **_L=NULL, *H=B; search(B,H,EXP(B->K,A->K)) { if(_L) {*_L=A; A->_next=B; } else push(A,H); break; } else _L=(void *)&(B->_next); if(!B)*_L=A; B=H; } else push(A,B); }
+#define insert(A,B,EXP,K) { if(B) { void **_L=NULL, *H=B; for_search(B,H,EXP(B->K,A->K)) { if(_L) {*_L=A; A->_next=B; } else push(A,H); break; } else _L=(void *)&(B->_next); if(!B)*_L=A; B=H; } else push(A,B); }
 #define sort(A,B,EXP,K) { void *_C; A=B; B=NULL; do { _C=A->_next; A->_next=NULL; insert(A,B,EXP,K); A=_C; } while(_C); }
 
 /* String macros & sequences, updated 2004-04-19 by xCh. */
 #define sort(A,B,EXP,K) { void *_C; A=B; B=NULL; do { _C=A->_next; A->_next=NULL; insert(A,B,EXP,K); A=_C; } while(_C); }
 
 /* String macros & sequences, updated 2004-04-19 by xCh. */
 #define stroption(STR) if(eq(STR,_K))
 #define match(KEY,VAL) {char *_K=KEY, *_V=VAL; FILE *_F=NULL; {{ 
 #define assign(STR,SETVAR) stroption(STR) SETVAR=_V
 #define stroption(STR) if(eq(STR,_K))
 #define match(KEY,VAL) {char *_K=KEY, *_V=VAL; FILE *_F=NULL; {{ 
 #define assign(STR,SETVAR) stroption(STR) SETVAR=_V
-
-/* Section For Dummies part 2, updated 2004-05-07 by xCh. */
-
-#define program int _I; int main(int argc, char **argv)
+/* ------------------------------------------------------------------- */
+/* Infrastructure, updated 2008-01-08 by xCh.                          */
+/* ------------------------------------------------------------------- */
+/* old #define program int _I; int main(int argc, char **argv) */
 #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 _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 program2 _ISTACK _SSTACK _FSTACK int main(int argc, char **argv)
-#define _NEW_I for(create(_Iatom,_IStack),_Iatom->_23=1,push(_Iatom,_Istack);_Iatom->_23||pop(_Iatom,_Istack)&&0;_Iatom->_23--)
+#ifdef USE_LIBRARY_MYSQL
+#define _MSTACK struct _MStack { MYSQL *M; int _23; list(_MStack); } *_Matom,*_Mstack=NULL;
+#define _RSTACK struct _RStack { MYSQL_RES *R; int _23; list(_RStack); } *_Ratom,*_Rstack=NULL;
+#else
+#define _MSTACK
+#define _RSTACK
+#endif
+#define program _ISTACK _SSTACK _FSTACK _MSTACK _RSTACK int main(int argc, char **argv)
+
+#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)
+//#define _NEW_I for(create(_Iatom,_IStack),_Iatom->_23=1,push(_Iatom,_Istack);_Iatom->_23||pop(_Iatom,_Istack)&&0;_Iatom->_23--)
 #define _NEW_S for(create(_Satom,_SStack),_Satom->_23=1,push(_Satom,_Sstack);_Satom->_23||pop(_Satom,_Sstack)&&0;_Satom->_23--)
 #define _I _Iatom->I
 #define _S _Satom->I
 #define _NEW_S for(create(_Satom,_SStack),_Satom->_23=1,push(_Satom,_Sstack);_Satom->_23||pop(_Satom,_Sstack)&&0;_Satom->_23--)
 #define _I _Iatom->I
 #define _S _Satom->I
+
+/* Section For Dummies part 2, updated 2004-05-07 by xCh. */
+
 #define arguments if(argc>1) for(_I=1;_I<argc;_I++) 
 #define argument(A) if(eq(argv[_I],A))
 #define thisargument(S) (S=argv[_I])
 #define arguments if(argc>1) for(_I=1;_I<argc;_I++) 
 #define argument(A) if(eq(argv[_I],A))
 #define thisargument(S) (S=argv[_I])
 
 /* Dynamic list advanced I/O, updated 2003-05-30 by xCh. */
 
 
 /* Dynamic list advanced I/O, updated 2003-05-30 by xCh. */
 
-#define load(A,B,F,T,K) {char *_S; parses(_S,F) { create(A,T); A->K=_S; A->_eoln=TRUE; append(A,B);} done; A->_eoln=FALSE;}
-#define save(A,B,F,K) {FILE *_F=fopen(F,"w"); if(_F) { every(A,B) {fputs(A->K,_F); if(A->_eoln) fputc('\n',_F);} fclose(_F);}}
+/* obsolete #define load(A,B,F,T,K) {char *_S; parses(_S,F) { create(A,T); A->K=_S; A->_eoln=TRUE; append(A,B);} done; A->_eoln=FALSE;} */
+/* obsolete #define save(A,B,F,K) {FILE *_F=fopen(F,"w"); if(_F) { for_each(A,B) {fputs(A->K,_F); if(A->_eoln) fputc('\n',_F);} fclose(_F);}} */
      
 /* I/O sequences, updated 2003-05-29 by xCh. */
 
      
 /* I/O sequences, updated 2003-05-29 by xCh. */
 
 #define textfile(TYPE,LINE) struct TYPE { char *LINE; char _eoln; list(TYPE); }
 #define date(S) { time_t _T; _T=time(NULL); duplicate(ctime(&_T),S); }
 
 #define textfile(TYPE,LINE) struct TYPE { char *LINE; char _eoln; list(TYPE); }
 #define date(S) { time_t _T; _T=time(NULL); duplicate(ctime(&_T),S); }
 
+#ifdef USE_LIBRARY_MYSQL
+/* ------------------------------------------------------------------- */
+/* MySQL Infrastructure and basic macros -  updated 2007-12-19 by xCh. */
+/* ------------------------------------------------------------------- */
+#define mysql_connect(S,U,P,D) (create(_Matom,_MStack) && push(_Matom,_Mstack) && (_Matom->M=mysql_init(NULL)),(_Matom->M && mysql_real_connect(_Matom->M,S,U,P,D,0,NULL,0)?_Matom->M:NULL))
+#endif
+
 #endif
 #endif
index cc1610cc38df3aa45d3842037671c3f6328171f9..5a37cc1fda8a0e37d2f68f60827c27420cf2dd02 100644 (file)
--- a/cll1.txt
+++ b/cll1.txt
@@ -1,3 +1,7 @@
+THIS FILE IS OBSOLETE !!!
+
+
+
 
 C<<1: The Programming Language
 ==============================
 
 C<<1: The Programming Language
 ==============================
diff --git a/demo.c b/demo.c
deleted file mode 100644 (file)
index bbb8e0d..0000000
--- a/demo.c
+++ /dev/null
@@ -1,28 +0,0 @@
-#include "cll1.h"
-
-program2
-{
- repeat(2)
- {
-  printf("Tohle cele delam 2x:\n");
-  repeat(3) printf("Tohle delam 3x...\n");
- }
-/*
- for(create(_Iatom,_IStack),_Iatom->_23=1,push(_Iatom,_Istack);_Iatom->_23||pop(_Iatom,_Istack)&&0;_Iatom->_23--)
- {
-  printf("_Iatom->_23=[%d] _Iatom->I=[%d]\n",_Iatom->_23,_Iatom->I);
- for range(_Iatom->I,1,2)
- {
-  printf("Tohle cele delam 2x:\n");
-  for(create(_Iatom,_IStack),_Iatom->_23=1,push(_Iatom,_Istack);_Iatom->_23||pop(_Iatom,_Istack)&&0;_Iatom->_23--)
-  {
-   printf("_Iatom->_23=[%d] _Iatom->I=[%d]\n",_Iatom->_23,_Iatom->I);
-  for range(_Iatom->I,1,3)
-  {
-   printf("Tohle delam 3x...\n");
-  }
-  }
- }
- }
-*/
-}
index accd50d89f2c7efdc6facad52ff21b646a7eeafc..6cd7bedb9c33136d31fe78218f05b2d76b9c5115 100644 (file)
@@ -10,7 +10,7 @@ program
  arguments
  {
   thisargument(ptr);
  arguments
  {
   thisargument(ptr);
-  if(*ptr=='-')
+  if(*ptr=='-') then
   {
    printf("Command line switch: -%c ",ptr[1]);
    nextargument(ptr);   
   {
    printf("Command line switch: -%c ",ptr[1]);
    nextargument(ptr);   
diff --git a/demos/hello.c b/demos/hello.c
new file mode 100644 (file)
index 0000000..50a595d
--- /dev/null
@@ -0,0 +1,6 @@
+#include "cll1.h"
+
+program
+{
+ print("Hello ","world"," !\n");
+}
index b9a8704ed0b90173363b5b0803ff14b6d7591149..ff963193705c83201e2ed08420ca0885d5180f21 100644 (file)
@@ -45,10 +45,10 @@ program
 
    if(*ptr)
    {
 
    if(*ptr)
    {
-    find(id,ids,eq(id->str,ptr))
+    if_exists(id,ids,eq(id->str,ptr))
     {
      id->count++;
     {
      id->count++;
-     find(line,id->lines,line->n==l);
+     if_exists(line,id->lines,line->n==l);
      else
      {
       create(line,Line);
      else
      {
       create(line,Line);
@@ -85,10 +85,10 @@ program
  if(c)
   sort(id,ids,desc_order_by,count);
   
  if(c)
   sort(id,ids,desc_order_by,count);
   
every(id,ids)
for_each(id,ids)
  { 
   printf("%3dx %s",id->count,id->str);
  { 
   printf("%3dx %s",id->count,id->str);
-  every(line,id->lines) printf(" [%d]",line->n);
+  for_each(line,id->lines) printf(" [%d]",line->n);
   printf("\n"); 
  }
 }
   printf("\n"); 
  }
 }
index 33230c93f76a6d2ee1295251b6915d888e73c2b0..008e13b7023b3f5b8e0b2fcf369b9b4a9f9b8b78 100644 (file)
@@ -8,56 +8,47 @@ struct Zaznam
  list(Zaznam);
 } *zaznam,*zaznamy=NULL;
 
  list(Zaznam);
 } *zaznam,*zaznamy=NULL;
 
-program2
+program
 { 
  puts("4x insert(zaznam,zaznamy,order_by,i);");
  create(zaznam, Zaznam);
  zaznam->i=1; 
  zaznam->j="ddd";
  insert(zaznam,zaznamy,order_by,i);
 { 
  puts("4x insert(zaznam,zaznamy,order_by,i);");
  create(zaznam, Zaznam);
  zaznam->i=1; 
  zaznam->j="ddd";
  insert(zaznam,zaznamy,order_by,i);
-
  create(zaznam, Zaznam);
  zaznam->i=3; 
  zaznam->j="bbbbb";
  insert(zaznam,zaznamy,order_by,i);
  create(zaznam, Zaznam);
  zaznam->i=3; 
  zaznam->j="bbbbb";
  insert(zaznam,zaznamy,order_by,i);
-
  create(zaznam, Zaznam);
  zaznam->i=0; 
  zaznam->j="e";
  insert(zaznam,zaznamy,order_by,i);
  create(zaznam, Zaznam);
  zaznam->i=0; 
  zaznam->j="e";
  insert(zaznam,zaznamy,order_by,i);
-
  create(zaznam, Zaznam);
  zaznam->i=2; 
  zaznam->j="cc";
  insert(zaznam,zaznamy,order_by,i);
  create(zaznam, Zaznam);
  zaznam->i=2; 
  zaznam->j="cc";
  insert(zaznam,zaznamy,order_by,i);
-
- for each(zaznam,zaznamy) printf("i=%d, j=%s\n",zaznam->i,zaznam->j);
+ for_each(zaznam,zaznamy)printf("i=%d, j=%s\n",zaznam->i,zaznam->j);
 
  puts("1x append(zaznam,zaznamy);");
  create(zaznam, Zaznam);
  zaznam->i=4; 
  zaznam->j="aaa";
  append(zaznam,zaznamy);
 
  puts("1x append(zaznam,zaznamy);");
  create(zaznam, Zaznam);
  zaznam->i=4; 
  zaznam->j="aaa";
  append(zaznam,zaznamy);
-
- for each(zaznam,zaznamy)printf("i=%d, j=%s\n",zaznam->i,zaznam->j);
+ for_each(zaznam,zaznamy)printf("i=%d, j=%s\n",zaznam->i,zaznam->j);
 
  puts("sort(zaznam,zaznamy,desc_order_by,i);");
  sort(zaznam,zaznamy,desc_order_by,i);
 
  puts("sort(zaznam,zaznamy,desc_order_by,i);");
  sort(zaznam,zaznamy,desc_order_by,i);
-
- for each(zaznam,zaznamy)printf("i=%d, j=%s\n",zaznam->i,zaznam->j);
+ for_each(zaznam,zaznamy)printf("i=%d, j=%s\n",zaznam->i,zaznam->j);
 
  puts("sort(zaznam,zaznamy,desc_sort_by,j);");
  sort(zaznam,zaznamy,desc_sort_by,j);
 
  puts("sort(zaznam,zaznamy,desc_sort_by,j);");
  sort(zaznam,zaznamy,desc_sort_by,j);
-
- for each(zaznam,zaznamy)printf("i=%d, j=%s\n",zaznam->i,zaznam->j);
+ for_each(zaznam,zaznamy)printf("i=%d, j=%s\n",zaznam->i,zaznam->j);
 
  puts("remove(zaznam,zaznamy,zaznam->i==1);");
  remove(zaznam,zaznamy,zaznam->i==1);
 
  puts("remove(zaznam,zaznamy,zaznam->i==1);");
  remove(zaznam,zaznamy,zaznam->i==1);
-
- for each(zaznam,zaznamy)printf("i=%d, j=%s\n",zaznam->i,zaznam->j);
+ for_each(zaznam,zaznamy)printf("i=%d, j=%s\n",zaznam->i,zaznam->j);
 
  puts("drop(zaznam,zaznamy);");
  drop(zaznam,zaznamy);
 
  puts("drop(zaznam,zaznamy);");
  drop(zaznam,zaznamy);
-
- for each(zaznam,zaznamy)printf("i=%d, j=%s\n",zaznam->i,zaznam->j);
+ for_each(zaznam,zaznamy)printf("i=%d, j=%s\n",zaznam->i,zaznam->j);
 }
 }
diff --git a/demos/repeat.c b/demos/repeat.c
new file mode 100644 (file)
index 0000000..7e8622e
--- /dev/null
@@ -0,0 +1,10 @@
+#include "cll1.h"
+
+program
+{
+ repeat(2)
+ {
+  printf("Tohle cele delam 2x:\n");
+  repeat(3) printf("Tohle delam 3x...\n");
+ }
+}
diff --git a/demos/strings.c b/demos/strings.c
new file mode 100644 (file)
index 0000000..e2a479a
--- /dev/null
@@ -0,0 +1,13 @@
+#include "cll1.h"
+
+program
+{
+ char *ptr;
+
+ asprintf(&ptr,"%ld",123456789);
+ printf("strlen(\"%s\")=%d\n",ptr,strlen(ptr));
+
+ ptr=catf("%ld",123456789);
+ printf("strlen(\"%s\")=%d\n",ptr,strlen(ptr));
+
+}
diff --git a/fastcgi/cll1.h b/fastcgi/cll1.h
new file mode 120000 (symlink)
index 0000000..a4cde1a
--- /dev/null
@@ -0,0 +1 @@
+../cll1.h
\ No newline at end of file
diff --git a/fastcgi/fastcgi.c b/fastcgi/fastcgi.c
new file mode 100644 (file)
index 0000000..2d141d8
--- /dev/null
@@ -0,0 +1,16 @@
+#define USE_LIBRARY_FASTCGI
+#include "cll1.h"
+        
+program
+{
+ int count = 0;
+ while_fastcgi_accept
+ {
+  printf("Content-type: text/html\r\n"
+         "\r\n"
+         "<title>FastCGI Hello!</title>"
+         "<h1>FastCGI Hello!</h1>"
+         "Request number %d running on host <i>%s</i>\n",
+          ++count, getenv("SERVER_NAME"));
+ }
+}
diff --git a/mysql/cll1.h b/mysql/cll1.h
new file mode 120000 (symlink)
index 0000000..a4cde1a
--- /dev/null
@@ -0,0 +1 @@
+../cll1.h
\ No newline at end of file
diff --git a/mysql/mysql.c b/mysql/mysql.c
new file mode 100644 (file)
index 0000000..b314bbf
--- /dev/null
@@ -0,0 +1,15 @@
+#define USE_LIBRARY_MYSQL
+#include "cll1.h"
+
+program
+{
+ MYSQL_ROW row;
+
+ if(mysql_connect("localhost","root","","pokus"))
+ {
+  for_mysql_query_results(row,"SELECT id,str FROM pokus")
+   printf("id=%s str=%s\n", row[0], row[1]);
+ }
+ else 
+  puts("Can't connect to database!");
+}
diff --git a/tools/bake b/tools/bake
new file mode 100755 (executable)
index 0000000..3b15bcd
--- /dev/null
@@ -0,0 +1,48 @@
+#!/bin/bash
+CONF=/etc/bake.conf
+CLL1CC=`which gcc`
+EXE=`basename $1 .c`
+DEBUG=n
+
+function debugecho
+{
+ if  [ $DEBUG == y ]
+ then
+  echo $1
+ fi
+}
+
+if [ "$1" == "" ] || [ "$EXE" == "$1" ]
+then
+ echo "Usage: bake filename.c"
+ exit
+else
+ debugecho "Filename: $1"
+fi
+
+LIBNAMES=`grep "^#define" $1|grep USE_LIBRARY_|cut -f 2 -d " "`
+if ! [ -z "$LIBNAMES" ]
+then
+ debugecho "Libraries: $LIBNAMES"
+ LIBS=""
+ for F in $LIBNAMES
+ do 
+  LIBS="$LIBS `grep $F $CONF|cut -f 2 -d \ `"
+ done
+fi
+
+PRENAMES=`grep "^#define" $1|grep USE_PREPROCESSOR_|cut -f 2 -d " "`
+if ! [ -z "$PRENAMES" ]
+then
+ debugecho "Precompilers: $PRENAMES"
+ for F in $PRENAMES
+ do 
+  CMD=`grep $F $CONF|cut -f 2 -d " "`
+  gecho "$CMD"
+  $CMD
+ done
+fi
+
+CMD="$CLL1CC $1 -o $EXE $LIBS"
+echo "$CMD"
+$CMD
diff --git a/tools/bake.conf b/tools/bake.conf
new file mode 100644 (file)
index 0000000..0dd65aa
--- /dev/null
@@ -0,0 +1,5 @@
+#/usr/bin/bake is simple and powerful replacement for make 
+USE_LIBRARY_MYSQL -lmysqlclient
+USE_LIBRARY_FASTCGI -lfcgi
+USE_PREPROCESSOR_CAKE /usr/bin/cake
+USE_POSTPROCESSOR_STRIP /usr/bin/strip
This page took 0.292925 seconds and 4 git commands to generate.