LEX Question

Tom Stockfisch tps at chem.ucsd.edu
Fri Feb 24 11:35:48 AEST 1989


In article <1989Feb23.164129.8672 at utzoo.uucp> henry at utzoo.uucp (Henry Spencer) writes:
>In article <412 at chem.ucsd.EDU> tps at 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 at chem.ucsd.edu



More information about the Comp.lang.c mailing list