Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!decvax!microsoft!uw-beaver!ubc-visi!alberta!stephen From: stephen@alberta Newsgroups: net.lang.c Subject: RE: our friend "{" Message-ID: <401@alberta.UUCP> Date: Wed, 3-Aug-83 11:58:59 EDT Article-I.D.: alberta.401 Posted: Wed Aug 3 11:58:59 1983 Date-Received: Fri, 5-Aug-83 15:25:51 EDT Lines: 60 The original reason for the following definitions was that my first ever C program was written on an IBM machine where the squirley braces were quite the pain to use and where the C compiler refuses to work. Since I wasn't all to sure where the problem was, I wrote the program using ALGOL/68 constructs and put in the #defines with what I thought were the corret formats and passed the program to a friend on the VAX (which I didn't have access to at the time). Once I got onto UNIX, I found that the constructs served to minimize syntax errors and make my programs easier to read. The main problem with the constructs is that they are not understood by "emacs", "cb" etc.. ------------------------------------------------------------- #define begin { #define end } #define IF if( #define THEN ){ #define ELSE } else { #define ELIF } else IF #define FI } #define FOR for( #define WHILE while( #define DO ){ #define OD } #define LOOP do{ #define UNTIL } while( #define DONE ); #define SWITCH switch( #define IN ){ #define CASE ;break ;case #define DEFAULT ;break ; default #define OUT } #define FOREACH(PARC,PARV,COUNT)\ for(COUNT = (PARC > 1 ? 0 : --PARV, -1) ; ++COUNT == 0 | (++PARV, --PARC > 0 ; )\ #ifndef DO #define DO ){ #define OD } #endif #define PARNUM(NUM,PARV,COUNT) (PARV+NUM-COUNT) #define FORNEXT(PARC,PARV,COUNT) (++COUNT, ++PARV, --PARC) /* PARNUM returns the NUM'th par. FORNEXT moves to the next par */ ----------------------------------------------------------------- FOREACH was defined to help handle shell pars with a minimum of fuss. PARC and PARV are (copies of) the values passed by the shell and COUNT is used to indicate which par is presently "active" (COUNT==0 indicates no pars). Stephen Samuel(alberta!stephen)