2 C<<1: The Programming Language
3 ==============================
5 Feedback: xchaos@arachne.cz
6 Homepage: http://gpl.arachne.cz
8 Copyright (G) 2004 Michael Polak, x@n.cz
9 C<<1 is available under terms of GNU Lesser Public License (LGPL)
10 This file is available under terms of GNU Free Documentation License
15 There are various extensions and definitions of classical C language,
16 for example object oriented "C++" and "Objective C", minimalistic C--,
17 proprietary C# used by .Net project, etc. Many other modern languages
19 C<<1 is designed to work as "stylesheet" for very classical ANSI C, and
20 it was specificaly tested to work fine with GNU C Compiler gcc. There is
21 no special C<<1 compiler or interpreter; instead, you are expected to
22 include special header file called cll1.h the same way you would include
23 let's say string or I/O library implemented in standard C library. Except
24 that you don't need to link your executable with any special library,
25 neither staticaly nor dynamicaly, and you don't have to configure your gcc
30 Or #include "cll1.h", if cll1.h is not installed in your /usr/include
31 directory. That'it. No linking, no initialization, allocation, or so.
33 C<<1 can be used for dummy, structured or object oriented programing,
34 whatever method you prefere. C<<1 focuses mainly on adding new complex
35 semantic structures into C, rather than inventing brand new syntax or class
36 hieararchy, or providing set of pre-defined library functions. To allow
37 that, most of C<<1 functions are implemented as macros for C preprocessor.
49 Of course, int main(int argc,void **argv) can be still used. In fact,
50 macro "program" doesn't do much more than that ! Following program prints
63 puts("Bleeeeh, no arguments supplied... :-(");
66 Well, don't be surprised with "else" after "arguments". This is not the
67 last time in C<<1, when you will see C keywords somewhere you don't expect
68 them. Of course, you would like to use it this way, I guess:
76 argument("-?") printf("This is just help!\n");
77 else argument("-f") { nextargument(ptr) printf("Forced argument: %s\n",ptr); }
78 else { thisargument(ptr); printf("Simple argument: %s \n",ptr); }
81 puts("Bleeeeh, no arguments supplied... :-(");
84 2. Where is my main() funciton ?!
85 ---------------------------------
87 If you want to use int main(int argc,void **argv) { } instead of
88 program { }, it's ok. Being fan of Basic and not Pascal, I don't
89 like the program keyword at all. In fact, by avoiding "program" construct
90 and using standard main() declaration, you would be still able to access
91 most of C<<1 functionality, but for example not the arguments() structure
97 This is some code to send e-mail using unix sendmail:
98 (ok, nothing special, same as "echo .... | sendmail ....")
102 paste("From: me@here\nSubject: Here we go...\n\nblah blah blah")
103 system("/usr/sbin/sendmail someone@somewhere");
106 This program prints exactly 6th column of /etc/passwd file
107 (ok, nothing special, same as "cut -f 6 -d : /etc/passwd")
120 But next program prints 1st and 6th column of /etc/passwd.
121 (What is equivalent in bash ?)
129 columns(ptr,_,':',i) switch(i)
131 case 1: printf("%s...",ptr); break;
139 4. Groups of C<<1 macros
140 ------------------------
142 ! - macro is available only when using "program" instead of "main()"
144 I. Unconditional iterations - without else
150 II. Conditional iterations - else can happen once
157 III. Conditional iterations - else can happen many times
163 IV. Weird iterations (with something special)
165 parse - [fail] - done
167 V. Standalone sequences - they look like function calls, but they are not.
180 VI. Well behaved seqences - can be used anywhere where functions can.
189 5. Forbidden namespace
190 ----------------------
192 Variables starting with _ (underscored) followed by one or more capital
193 characters (A-Z) are reserved as C<<1 private compile-time namespace.
195 6. Compile time errors
196 ----------------------
198 - parse error at end of input
200 You probably forgot to close some macro which must be obligatory
201 terminated by another macro - as "parse error" message suggests,
202 it is likely to be error in macro "parse() { } [ fail ] { } done; "
206 7. We apologize for inconvenience
207 ---------------------------------
209 This documentation file is unfortunately incomplete.
210 HTML online documentation is comming soon ... sooner ... or later...