 
#ifndef tlex_DEFINED
#define tlex_DEFINED 1
 
#ifndef class_DEFINED
#include <class.h>
#endif /* class_DEFINED */
/* 
 * This file was generated by the Andrew class system preprocessor.
 * Don't make changes to this file as it is created from tlex.ch and will be
 * overwritten.  Make changes to tlex.ch instead.
 */ 
 
#ifndef class_StaticInfoOnly
/* 
 * The following information was copied, as-is, from tlex.ch.
 */ 
 
/* tlex.ch - subclass of lexan for lex analysis from ATK text  */
/*
	Copyright Carnegie Mellon University 1992 - All rights reserved
	$Disclaimer: 
*Permission to use, copy, modify, and distribute this software and its 
*documentation for any purpose is hereby granted without fee, 
*provided that the above copyright notice appear in all copies and that 
*both that copyright notice, this permission notice, and the following 
*disclaimer appear in supporting documentation, and that the names of 
*IBM, Carnegie Mellon University, and other copyright holders, not be 
*used in advertising or publicity pertaining to distribution of the software 
*without specific, written prior permission.
*
*IBM, CARNEGIE MELLON UNIVERSITY, AND THE OTHER COPYRIGHT HOLDERS 
*DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 
*ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.  IN NO EVENT 
*SHALL IBM, CARNEGIE MELLON UNIVERSITY, OR ANY OTHER COPYRIGHT HOLDER 
*BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY 
*DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 
*WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS 
*ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
*OF THIS SOFTWARE.
* $
*/

/*
The routines in tlex.c are suited for recognizing

	identifier  (can include reserved words)
	number: float or double real, decimal, hex, or octal integer
	string
	comments
	whitespace
	special characters (includes thongs)

    tlex_tables values are generated by gentlex.

*/

#include <gentlex.h>

#define tlex_RECENTSIZE 10







/* 
 * End of information copied from tlex.ch.
 */ 
 
#endif /* class_StaticInfoOnly *//* 
 * Include the superclass information
 */ 
#define dontDefineRoutinesFor_lexan
#include "lexan.ih"
#undef dontDefineRoutinesFor_lexan

 
 
#ifndef class_StaticInfoOnly
/* 
 * Data structure for tlex 
 */ 
struct tlex { 
    union {
	struct basicobject_methods *tlex_methods;
	struct lexan lexan;
    } header;
	struct tlex_tables *lextab;

	void *rock;		/* available to action routines */

	struct text *text;	/* the text we are scanning */
	long startpos;		/* beginning bound of text */
	long currpos;		/* where currchar is from */
	long lastpos;		/* last position to use */

	char *charx;		/* pointer to currpos'th character in text */
	char *lastcharx;	/* last character fetchable via *charx++
				(either by reaching gap or by EOF) */

	int currchar;		/* cache copy of character at currpos
				   (may be EOF) */

	long tokpos;		/* first pos for text of current token */
	long tokend;		/* last pos of text for current token */

	int tokennumber;	/* token number to return from NextToken */
	void *tokenvalue;	/* value to assign to *pyylval */

	/* tokenbuffer and alttokenbuf are interchanged each time
		to cheaply implement PrevTokenText */
	char *tokenbuffer;	/* characters of token */
	char *tokbufx;		/* where to store next char in tokenbuffer */
	char *tokbuflastx;	/* where to store last char in tokenbuffer
				  tokenbuffer+(2 less than size of tokenbuffer) */
	char *alttokenbuf;	/* token buffer for previous token */
	char *altbuflastx;	/* end of alttokenbuffer */

	/* arrays to store text positions of recent tokens */
	long RecentPos[tlex_RECENTSIZE];
	long RecentLen[tlex_RECENTSIZE];
	int RecentIndex;

};

 
/* 
 * End of data structure for tlex.
 */ 
 

#endif /* class_StaticInfoOnly */

#ifndef class_StaticInfoOnly

#ifndef tlex_PROGRAMMERVERSION
#define tlex_PROGRAMMERVERSION 1
#endif /* tlex_PROGRAMMERVERSION */

#ifdef tlex_VERSION
#undef tlex_VERSION
#endif /* tlex_VERSION */
#define tlex_VERSION ((((tlex_PROGRAMMERVERSION << 16) ^ (8 << 8) ^ sizeof(struct tlex)) & 0x7ffff) + 0x80000 + (66 << 20))


#endif /* class_StaticInfoOnly */
#define tlex_StaticLoadOnlyThisClass()  \
{ extern struct classinfo *tlex__GetClassInfo(); \
 extern struct classheader *tlex_classheader_StaticExport; \
  (void) class_EnterInfo(NULL, tlex_classheader_StaticExport->name, tlex__GetClassInfo, NULL, tlex_classheader_StaticExport->namekey); } 
 
#define tlex_StaticLoad()  \
    { \
    lexan_StaticLoad(); \
    tlex_StaticLoadOnlyThisClass();  \
    } 
 
#define tlex_StaticEntry  {tlex_StaticLoad()} 
 
#ifndef class_StaticInfoOnly
static struct classheader tlex_classheader = {
    tlex_VERSION,
    "tlex",
    "tlex",
    (struct basicobject_methods *) &class_RoutineStruct,
};

#define tlex_CLASSPROCEDURES (tlex_classheader.classprocedures)
int tlex_classref_;
#endif /* class_StaticInfoOnly */

#endif /* tlex_DEFINED */

#if !defined(tlex_ROUTINESDEFINED) && !defined(dontDefineRoutinesFor_tlex) && !defined(class_StaticEntriesOnly)
#define tlex_ROUTINESDEFINED

#define tlex_NextToken(self,pyylval) \
    ((* ((int (*)())((self)->header.tlex_methods->routines[0]))) (self,pyylval))
#define tlex_SetTranslator(self,p) \
	((&(self)->header.lexan)->translator = (p))
#define tlex_TranslateTokenNumber(self,t) \
 		parse_TranslateTokenNumber((&(self)->header.lexan)->translator, t)
#define tlex_SetText(self,text,pos,len) \
    ((* ((void (*)())((self)->header.tlex_methods->routines[1]))) (self,text,pos,len))
#define tlex_RecentPosition(self,index,len) \
    ((* ((long (*)())((self)->header.tlex_methods->routines[2]))) (self,index,len))
#define tlex_RecentIndent(self,index) \
    ((* ((long (*)())((self)->header.tlex_methods->routines[3]))) (self,index))
#define tlex_Repeat(self,index) \
    ((* ((void (*)())((self)->header.tlex_methods->routines[4]))) (self,index))
#define tlex_Error(self,msg) \
    ((* ((void (*)())((self)->header.tlex_methods->routines[5]))) (self,msg))
#define tlex_FetchChar(self) \
    ((* ((int (*)())((self)->header.tlex_methods->routines[6]))) (self))
#define tlex_PutTokChar(self,c) \
    ((* ((int (*)())((self)->header.tlex_methods->routines[7]))) (self,c))
#define tlex_GetRock(self) \
		((self)->rock)
#define tlex_SetRock(self,r) \
	((self)->rock = (r))
#define tlex_Global(self) \
		((self)->lextab->global)
#define tlex_SetTokenNumber(self,n) \
	((self)->tokennumber = (n))
#define tlex_GetTokenNumber(self) \
	((self)->tokennumber)
#define tlex_SetTokenValue(self,v) \
	((self)->tokenvalue = (v))
#define tlex_GetTokenValue(self) \
 	((self)->tokenvalue)
#define tlex_CurrPos(self) \
		((self)->currpos)
#define tlex_CurrChar(self) \
		((self)->currchar)
#define tlex_NextChar(self) \
		((self)->currpos++, 			(((self)->charx++ < (self)->lastcharx) 			   ? ((self)->currchar 				= (int)(*((unsigned char *)((self)->charx)))) 			   : tlex_FetchChar((self))))
#define tlex_BackUp(self,n) \
		((self)->currpos -= (n), tlex_FetchChar((self)))
#define tlex_GetTokPos(self) \
		((self)->tokpos)
#define tlex_GetTokEnd(self) \
		((self)->tokend)
#define tlex_StartToken(self) \
		((self)->tokbufx = (self)->tokenbuffer, 					(self)->tokpos = (self)->currpos)
#define tlex_EndToken(self) \
		((self)->tokend = (self)->currpos-1,  					*((self)->tokbufx) = '\0')
#define tlex_GetTokenText(self) \
		((self)->tokenbuffer)
#define tlex_PrevTokenText(self) \
		((self)->alttokenbuf)
#define tlex_ClearTokenText(self) \
	((self)->tokbufx = (self)->tokenbuffer)
#define tlex_AppendToTokenText(self,c) \
  (((self)->tokbufx <= (self)->tokbuflastx) 					? (int)(*(self)->tokbufx++ = (c)) 					: (int)tlex_PutTokChar((self), (c)))
#define tlex_TruncateTokenText(self,n) \
 (((n) >= 0 			&& (n) <= (self)->tokbufx - (self)->tokenbuffer) 				? (self)->tokbufx -= n 				: tlex_ClearTokenText((self)))
#define tlex_Advance(self) \
	((tlex_AppendToTokenText((self), (self)->currchar)), 					tlex_NextChar((self)))

#define tlex_NewFromObject(self) \
    ((* ((struct tlex * (*)())((self)->header.tlex_methods->info->procs->routines[0]))) (&tlex_classheader, (self)->header.tlex_methods->info->versionnumber))
#define tlex_New() \
    (*((struct tlex * (*)()) (tlex_CLASSPROCEDURES->routines[0])))(&tlex_classheader,tlex_VERSION)
#define tlex_Initialize(self) \
    (*((void (*)()) (tlex_CLASSPROCEDURES->routines[2])))(&tlex_classheader,self, tlex_VERSION)

#define tlex_Destroy(self) \
    ((* ((void (*)()) ((self)->header.tlex_methods->info->procs->routines[1]))) (&tlex_classheader, self))
#define tlex_Finalize(self) \
    (*((void (*)()) (tlex_CLASSPROCEDURES->routines[3])))(&tlex_classheader,self)

#define tlex_InitializeClass() \
    (*((boolean (*)()) (tlex_CLASSPROCEDURES->routines[5])))(&tlex_classheader)
#define tlex_InitializeObject(self) \
    (*((boolean (*)()) (tlex_CLASSPROCEDURES->routines[6])))(&tlex_classheader,self)
#define tlex_FinalizeObject(self) \
    (*((void (*)()) (tlex_CLASSPROCEDURES->routines[7])))(&tlex_classheader,self)
#define tlex_Create(description,rock,text,pos,len) \
    (*((struct tlex * (*)()) (tlex_CLASSPROCEDURES->routines[8])))(&tlex_classheader,description,rock,text,pos,len)


#endif /* !defined(tlex_ROUTINESDEFINED) && !defined(dontDefineRoutinesFor_tlex ) && !defined(class_StaticEntriesOnly)*/

