Category : Printer + Display Graphics
Archive   : RAYSH386.ZIP
Filename : LEX.L

 
Output of file : LEX.L contained in archive : RAYSH386.ZIP
/* lex.l */
/* Copyright (C) 1989, 1991, Craig E. Kolb */
/* All rights reserved. */
/* */
/* This software may be freely copied, modified, and redistributed, */
/* provided that this copyright notice is preserved on all copies. */
/* */
/* You may not distribute this software, in whole or in part, as part of */
/* any commercial product without the express consent of the authors. */
/* */
/* There is no warranty or other guarantee of fitness of this software */
/* for any purpose. It is provided solely "as is". */
/* $Id: lex.l,v 4.0.1.1 91/11/26 21:12:29 cek Exp Locker: cek $ */
%{
#include "config.h"
#include
#ifdef I_STRING
#include
#else
#include
#endif
#include "common.h"
#include "yacc_tab.h"
%}
alpha [a-zA-Z]
special [\.\_-]
digit [0-9]
exp [Ee][-+]?{digit}+
string ({alpha}|"/")({alpha}|{digit}|{special}|"/")*
%p 3000
%%
[\t] {WriteVerbatim(yytext);};
"\n" {};
" " {};
^# {return handlehash();}
"/*" {skipcomments();}
adaptive {return(tADAPTIVE);}
aperture {return(tAPERTURE);}
background {return(tBACKGROUND);}
blotch {return(tBLOTCH);}
box {return(tBOX);}
bump {return(tBUMP);}
checker {return(tCHECKER);}
cone {return(tCONE);}
contrast {return(tCONTRAST);}
cutoff {return(tCUTOFF);}
cylinder {return(tCYL);}
defend {return(tENDDEF);}
define {return(tSTARTDEF);}
directional {return(tDIRECTIONAL);}
endfile {return(tENDFILE);}
extended {return(tEXTENDED);}
eyep {return(tEYEP);}
fbm {return(tFBM);}
fbmbump {return(tFBMBUMP);}
focaldist {return(tFOCALDIST);}
fog {return(tFOG);}
fov {return(tFOV);}
gloss {return(tGLOSS);}
grid {return(tGRID);}
heightfield {return(tHEIGHTFIELD);}
jittered {return(tJITTERED);}
light {return(tLIGHT);}
list {return(tLIST);}
lookp {return(tLOOKP);}
marble {return(tMARBLE);}
maxdepth {return(tMAXDEPTH);}
mist {return(tMIST);}
object {return(tOBJECT);}
outfile {return(tOUTFILE);}
plane {return(tPLANE);}
point {return(tPOINT);}
poly {return(tPOLY);}
resolution {return(tRESOLUTION);}
rotate {return(tROTATE);}
samples {return(tSAMPLES);}
scale {return(tSCALE);}
screen {return(tSCREEN);}
sphere {return(tSPHERE);}
superq {return(tSUPERQ);}
surface {return(tSURFACE);}
texture {return(tTEXTURE);}
transform {return(tTRANSFORM);}
translate {return(tTRANSLATE);}
triangle {return(tTRIANGLE);}
up {return(tUP);}
wood {return(tWOOD);}
{string} {yylval.c = strsave(yytext);
return(tSTRING);}
[+-]?{digit}+ {yylval.i = atoi(yytext);
return(tINT);}

[+-]?{digit}+"."{digit}*({exp})? |
[+-]?{digit}*"."{digit}+({exp})? |
[+-]?{digit}+{exp} {yylval.d = atof(yytext); return(tFLOAT);}

. {return yytext[0];}

%%
yywrap() {return(1);}
/*
* Skip over comments.
*/
skipcomments()
{
char c;

WriteVerbatim("/*");
while (1) {
while ((c = input()) != '*')
WriteChar(c);
WriteChar(c);
if ((c = input()) == '/') {
WriteChar(c);
WriteNewline();
return;
}
unput(c);
}
}
/*
* Deal with ccp-produced lines of the form:
* # n "filename"
* and
* # n
* Where filename is the name of the file being processed, and n is
* the current line number in that file.
*/
handlehash()
{
char buf[BUFSIZ];
int i, linenumber;
extern int yylineno;
extern char yyfilename[];

/*
* Read the entire line into buf.
*/
for (i = 0; (buf[i] = input()) != '\n'; i++)
;
unput(buf[i]); /* To make sure consecutive # lines work. */
buf[i] = (char)NULL; /* Replace newline with NULL. */

yylval.c = strsave(buf);

/*
* Set file/line if the line was of the form #n "filename"
*/
if ((i = sscanf(buf, "%d \"%[^\"]s\"", &linenumber, buf)) != 0) {
yylineno = linenumber;
#ifdef SYSV
if (strchr(buf, '"') != (char *)0) {
#else
if (index(buf, '"') != (char *)0) {
#endif
/*
* Filename was "", which means stdin.
*/
strcpy(yyfilename, "stdin");
} else
strcpy(yyfilename, buf);
}
return tHASHTHING;
}


  3 Responses to “Category : Printer + Display Graphics
Archive   : RAYSH386.ZIP
Filename : LEX.L

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/