X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fcc65%2Fsegments.h;h=81496ed1fbed664fd936a44e61579545fa4998dd;hb=923ae328a53d95390815c73b390165e85c06af01;hp=de66af9d7eba55a9cd1f185dec13bb6598a68c74;hpb=e6484f85c7f440aa8b12bbf956bed0b87e4ddeed;p=cc65 diff --git a/src/cc65/segments.h b/src/cc65/segments.h index de66af9d7..81496ed1f 100644 --- a/src/cc65/segments.h +++ b/src/cc65/segments.h @@ -6,7 +6,7 @@ /* */ /* */ /* */ -/* (C) 2000-2001 Ullrich von Bassewitz */ +/* (C) 2000-2002 Ullrich von Bassewitz */ /* Wacholderweg 14 */ /* D-70597 Stuttgart */ /* EMail: uz@cc65.org */ @@ -43,22 +43,27 @@ /* common */ #include "attrib.h" +/* cc65 */ +#include "opcodes.h" /*****************************************************************************/ -/* Forwards */ +/* Forwards */ /*****************************************************************************/ +struct CodeEntry; +struct CodeLabel; struct CodeSeg; struct DataSeg; +struct TextSeg; struct SymEntry; /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -75,6 +80,7 @@ typedef enum segment_t { /* A list of all segments used when generating code */ typedef struct Segments Segments; struct Segments { + struct TextSeg* Text; /* Text segment */ struct CodeSeg* Code; /* Code segment */ struct DataSeg* Data; /* Data segment */ struct DataSeg* ROData; /* Readonly data segment */ @@ -85,6 +91,9 @@ struct Segments { /* Pointer to the current segment list. Output goes here. */ extern Segments* CS; +/* Pointer to the global segment list */ +extern Segments* GS; + /*****************************************************************************/ @@ -99,9 +108,6 @@ void InitSegNames (void); void NewSegName (segment_t Seg, const char* Name); /* Set a new name for a segment */ -int ValidSegName (const char* Name); -/* Return true if the given segment name is valid, return false otherwise */ - Segments* PushSegments (struct SymEntry* Func); /* Make the new segment list current but remember the old one */ @@ -114,12 +120,24 @@ void UseDataSeg (segment_t DSeg); struct DataSeg* GetDataSeg (void); /* Return the current data segment */ +void AddTextLine (const char* Format, ...) attribute ((format (printf, 1, 2))); +/* Add a line to the current text segment */ + void AddCodeLine (const char* Format, ...) attribute ((format (printf, 1, 2))); /* Add a line of code to the current code segment */ +void AddCode (opc_t OPC, am_t AM, const char* Arg, struct CodeLabel* JumpTo); +/* Add a code entry to the current code segment */ + void AddDataLine (const char* Format, ...) attribute ((format (printf, 1, 2))); /* Add a line of data to the current data segment */ +int HaveGlobalCode (void); +/* Return true if the global code segment contains entries (which is an error) */ + +void RemoveGlobalCode (void); +/* Remove all code from the global code segment. Used for error recovery. */ + void OutputSegments (const Segments* S, FILE* F); /* Output the given segments to the file */