X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fld65%2Fscanner.h;h=aeabbdca81e597e480424f36b689fb01c6850d03;hb=b03ae76b54d77f435088cacf12d3cfd9873f05ed;hp=e7a943257ea692c21b30ad1853139f391d636e31;hpb=d194bdd70217154260154bd8fbf07964735c6aea;p=cc65 diff --git a/src/ld65/scanner.h b/src/ld65/scanner.h index e7a943257..aeabbdca8 100644 --- a/src/ld65/scanner.h +++ b/src/ld65/scanner.h @@ -1,15 +1,15 @@ /*****************************************************************************/ /* */ -/* scanner.h */ +/* scanner.h */ /* */ -/* Configuration file scanner for the ld65 linker */ +/* Configuration file scanner for the ld65 linker */ /* */ /* */ /* */ -/* (C) 1998-2005 Ullrich von Bassewitz */ -/* Römerstrasse 52 */ -/* D-70794 Filderstadt */ -/* EMail: uz@cc65.org */ +/* (C) 1998-2013, Ullrich von Bassewitz */ +/* Roemerstrasse 52 */ +/* D-70794 Filderstadt */ +/* EMail: uz@cc65.org */ /* */ /* */ /* This software is provided 'as-is', without any expressed or implied */ @@ -38,8 +38,14 @@ +/* common */ +#include "filepos.h" +#include "strbuf.h" + + + /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -47,9 +53,15 @@ /* Config file tokens */ typedef enum { CFGTOK_NONE, - CFGTOK_INTCON, - CFGTOK_STRCON, - CFGTOK_IDENT, + CFGTOK_INTCON, /* Integer constant */ + CFGTOK_STRCON, /* String constant */ + CFGTOK_IDENT, /* Identifier */ + CFGTOK_PLUS, + CFGTOK_MINUS, + CFGTOK_MUL, + CFGTOK_DIV, + CFGTOK_LPAR, + CFGTOK_RPAR, CFGTOK_LCURLY, CFGTOK_RCURLY, CFGTOK_SEMI, @@ -72,6 +84,7 @@ typedef enum { CFGTOK_TYPE, CFGTOK_FILE, CFGTOK_DEFINE, + CFGTOK_BANK, CFGTOK_FILL, CFGTOK_FILLVAL, CFGTOK_EXPORT, @@ -80,6 +93,8 @@ typedef enum { CFGTOK_ID, CFGTOK_VERSION, CFGTOK_FORMAT, + CFGTOK_RUNAD, + CFGTOK_INITAD, CFGTOK_LOAD, CFGTOK_RUN, @@ -92,7 +107,9 @@ typedef enum { CFGTOK_RW, CFGTOK_BSS, CFGTOK_ZP, + CFGTOK_OVERWRITE, + CFGTOK_ATARIEXE, CFGTOK_O65, CFGTOK_BIN, @@ -110,6 +127,15 @@ typedef enum { CFGTOK_CONDES, CFGTOK_STARTADDRESS, + CFGTOK_ADDRSIZE, + CFGTOK_VALUE, + + CFGTOK_WEAK, + + CFGTOK_ABS, + CFGTOK_FAR, + CFGTOK_LONG, + CFGTOK_SEGMENT, CFGTOK_LABEL, CFGTOK_COUNT, @@ -131,36 +157,40 @@ typedef enum { /* Mapping table entry, special identifier --> token */ typedef struct IdentTok IdentTok; struct IdentTok { - const char* Ident; /* Identifier */ - cfgtok_t Tok; /* Token for identifier */ + const char* Ident; /* Identifier */ + cfgtok_t Tok; /* Token for identifier */ }; -#define ENTRY_COUNT(s) (sizeof (s) / sizeof (s [0])) +#define ENTRY_COUNT(s) (sizeof (s) / sizeof (s [0])) /* Current token and attributes */ -#define CFG_MAX_IDENT_LEN 255 -extern cfgtok_t CfgTok; -extern char CfgSVal [CFG_MAX_IDENT_LEN+1]; -extern unsigned long CfgIVal; +extern cfgtok_t CfgTok; +extern StrBuf CfgSVal; +extern unsigned long CfgIVal; -/* Error location */ -extern unsigned CfgErrorLine; -extern unsigned CfgErrorCol; +/* Error location. PLEASE NOTE: I'm abusing the FilePos structure to some +** degree. It is used mostly to hold a file position, where the Name member +** is an index into the source file table of an object file. As used in config +** file processing, the Name member is a string pool index instead. This is +** distinguished by the object file pointer being NULL or not in the structs +** where this is relevant. +*/ +extern FilePos CfgErrorPos; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ -void CfgWarning (const char* Format, ...) attribute((format(printf,1,2))); +void CfgWarning (const FilePos* Pos, const char* Format, ...) attribute((format(printf,2,3))); /* Print a warning message adding file name and line number of the config file */ -void CfgError (const char* Format, ...) attribute((format(printf,1,2))); -/* Print an error message adding file name and line number of the config file */ +void CfgError (const FilePos* Pos, const char* Format, ...) attribute((format(printf,2,3))); +/* Print an error message adding file name and line number of a given file */ void CfgNextTok (void); /* Read the next token from the input stream */ @@ -201,12 +231,6 @@ void CfgBoolToken (void); void CfgSetName (const char* Name); /* Set a name for a config file */ -const char* CfgGetName (void); -/* Get the name of the config file */ - -void CfgSetBuf (const char* Buf); -/* Set a memory buffer for the config */ - int CfgAvail (void); /* Return true if we have a configuration available */ @@ -219,8 +243,5 @@ void CfgCloseInput (void); /* End of scanner.h */ -#endif - - - +#endif