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