Path: utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!ucsd!chem.ucsd.edu!tps From: tps@chem.ucsd.edu (Tom Stockfisch) Newsgroups: comp.lang.c Subject: Re: LEX Question Message-ID: <416@chem.ucsd.EDU> Date: 24 Feb 89 01:35:48 GMT References: <32240@auc.UUCP> <9580001@hpcuhb.HP.COM> <1989Feb15.200741.15963@utzoo.uucp> <412@chem.ucsd.EDU> <1989Feb23.164129.8672@utzoo.uucp> Reply-To: tps@chem.ucsd.edu (Tom Stockfisch) Organization: Chemistry Dept, UC San Diego Lines: 24 In article <1989Feb23.164129.8672@utzoo.uucp> henry@utzoo.uucp (Henry Spencer) writes: >In article <412@chem.ucsd.EDU> tps@chem.ucsd.edu (Tom Stockfisch) writes: >>Have you run across a version of lex that does NOT have yyin/yyout? >>I've always thought changing yyin was much more portable than re-defining >>input(). >Re-defining "input" is in the documentation as the way to alter input; any >version of lex that follows the manual (and hence deserves to be called >"lex") will permit it and have it work as documented. "yyin" is not >documented at all -- it is an accident of the original implementation -- >and hence may change without warning between versions. I must be missing something. Looking at lex.yy.c on my machine shows that input() is defined as # define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==10? \ (yylineno++,yytchar):yytchar)==EOF?0:yytchar) so if I re-#define input(), don't I have to use yytchar,yysptr, and yysbuf? I would assume one of these would be more likely to change than yyin. -- || Tom Stockfisch, UCSD Chemistry tps@chem.ucsd.edu