Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!rutgers!rochester!PT.CS.CMU.EDU!cadre!pitt!wvucsb!wvucswv!dymm From: dymm@wvucswv.UUCP Newsgroups: comp.unix.wizards,comp.lang.c,comp.unix.questions Subject: Lex Macros Message-ID: <48@wvucswv.UUCP> Date: Fri, 13-Nov-87 16:21:51 EST Article-I.D.: wvucswv.48 Posted: Fri Nov 13 16:21:51 1987 Date-Received: Mon, 16-Nov-87 06:30:37 EST Lines: 40 Keywords: Lex C Macros Xref: mnetor comp.unix.wizards:5476 comp.lang.c:5436 comp.unix.questions:4921 Dear Friends, I would like some help in interpreting some of the macros used in Lex. Below is the relevant portion of the C code produced by Lex. The macros are quite "slick", but also somewhat difficult to understand. Could someone please describe - in detail - how the macros "input()" and "unput()" operate????? Send mail to the address below or, if you think your answer is worthy of the attention of others, post it to the bb. Thanks for your help. David Dymm Software Engineer USMAIL: Bell Atlantic Knowledge Systems, 13 Beechurst Ave., Morgantown, WV 26505 PHONE: 304 291-2651 (8:30-4:30 EST) USENET: {allegra,bellcore, cadre,idis,psuvax1}!pitt!wvucsb!wvucswv!dymm *** C Code From Lex.c *** . . # define U(x) x # define YYLMAX 200 # define output(c) putc(c,yyout) # define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==10? (yylineno++,yytchar):yytchar)==EOF?0:yytchar) # define unput(c) {yytchar= (c);if(yytchar=='\n')yylineno--;*yysptr++=yytchar;} extern char *yysptr, yysbuf[]; int yytchar; FILE *yyin ={stdin}, *yyout ={stdout}; extern int yylineno;