#ifndef COMPILER_CPREP_H #define COMPILER_CPREP_H #include "compiler/common.h" #include "compiler/tokens.h" #ifdef __MWERKS__ #pragma options align=mac68k #endif typedef struct Macro { struct Macro *next; HashNameNode *name; void *c; unsigned short xC; Boolean is_special; Boolean xF; void *e; } Macro; typedef struct TokenStack { char *pos; char *macrostart; Macro *macro; Boolean macrocheck; } TokenStack; extern CParams *cparamblkptr; extern short tk; extern CInt64 tkintconst; extern Float tkfloatconst; extern char *tkstring; extern HashNameNode *tkidentifier; extern SInt32 tksize; extern short ispascalstring; extern short nlflag; extern SInt32 lines; extern Boolean spaceskip; extern struct Macro **macrohashtable; extern Boolean cprep_nomem_exit; extern Boolean cprep_nostring; extern Boolean cprep_eoltokens; extern TokenStack tokenstack[128]; extern short tokenstacklevel; extern CPrepFileInfo *cprep_cursymfile; extern char *pos; extern char *macropos; extern char *nextcharpos; extern unsigned char CPrep_SkipNewCommentChar; extern Boolean preprocessing_only; extern Handle stringmem; extern SInt32 maxstringsize; extern char cprep_idarray[256]; extern Boolean was_escchar; extern Boolean macrocheck; extern Boolean widestring; extern Boolean at_linestart; extern char *prep_file_start; extern char *prep_file_end; extern char *macrostart; extern Boolean cprep_strconcat; extern CPrepFileInfo *prep_file; extern short filesp; extern SInt32 linenumber; extern struct GList pplist; extern TStreamElement *ts_current; extern SInt32 ts_preread_elements; extern void CPrep_InsertSpecialMacro(Macro *macro, char *name); extern void CPrep_InsertSpecialMacros(void); extern void CPrep_RemoveSpecialMacros(void); extern Boolean setupprep(void); extern void cleanupprep(void); extern void CPrep_TSBufferGrow(int amount); extern void CPrep_TokenStreamGetState(SInt32 *state); extern void CPrep_TokenStreamSetState(SInt32 *state); extern void CPrep_UnLex(void); extern void CPrep_TokenStreamSetCurState(SInt32 *state); typedef void (*CPrepStreamFuncPtr)(TStreamElement *); extern void CPrep_StreamGetBlock(TStream *stream, CPrepStreamFuncPtr func, int arg); extern void CPrep_StreamGetSemicolon(TStream *stream, CPrepStreamFuncPtr func); extern void CPrep_StreamGetTemplate(TStream *stream, CPrepStreamFuncPtr func); extern void CPrep_StreamInsert(TStream *stream, SInt32 *state); extern void CPrep_StreamRemove(TStream *stream, SInt32 *state); extern void CPrep_RemoveTokens(SInt32 amount); extern void CPrep_TokenStreamFlush(void); extern TStreamElement *CPrep_CurStreamElement(void); extern void CPrep_GetTokenContext(TStreamElement *token, CPrepFileInfo **tokenfile, SInt32 *selectionoffset, short *tokensize, SInt32 *linenumber, char *buf1, short *tokenoffset, short *tokenlength, char *buf2, short *lastarg); extern void CPrep_Error(short code); extern void CPrep_ErrorName(short code, const char *name); extern void CPrep_Warning(short code); extern void CPrep_WarningName(short code, const char *name); extern void CPrep_ErrorMessage(int errTable, char *str, Boolean flag1, Boolean flag2); extern void CPrep_ErrorMessageVA(int code, const char *format, va_list list, Boolean flag1, Boolean flag2); extern void popfile(void); extern void CPrep_SetSourceFile(FileOffsetInfo *foi); extern HashNameNode *CPrep_GetSourceFilePath(CPrepFileInfo *fileinfo); extern void CPrep_NewFileOffsetInfo(FileOffsetInfo *foi, TStreamElement *ts); extern SInt32 CPrep_GetFileOffsetInfo(FileOffsetInfo *foi); extern void CPrep_GetFileOffsetInfo2(FileOffsetInfo *foi, SInt32 *pLine, HashNameNode **pName); extern void CPrep_ResetFileInfo(FileOffsetInfo *foi); extern void CPrep_GetPrepPos(CPrepFileInfo **file, SInt32 *ppos); extern UInt8 C_Compiler(CParams *param); extern void poptokenseq(void); extern void foundnl(void); extern void newline(void); extern short notendofline(void); extern char *CPrep_GetFileName(char *buffer, Boolean flag1, Boolean flag2); extern Boolean macrotest(void); extern short CPrep_PragmaLex(Boolean no_err); extern void CPrep_PushOption(SInt32 id, char value); extern void CPrep_PopOption(SInt32 id); extern void preprocessor(void); extern SInt32 CPrep_BrowserTokenOffset(FileOffsetInfo *foi); extern SInt32 CPrep_BrowserFileOffset(void); extern void CPrep_BrowserFilePosition(CPrepFileInfo **fileinfo, SInt32 *offset); extern CPrepFileInfo *CPrep_BrowserCurrentFile(void); #ifdef __MWERKS__ #pragma options align=reset #endif #endif