?login_element?

Subversion Repositories NedoOS

Rev

Rev 625 | Blame | Compare with Previous | Last modification | View Log | Download

  1. /*
  2.  
  3.   SjASMPlus Z80 Cross Compiler
  4.  
  5.   This is modified sources of SjASM by Aprisobal - aprisobal@tut.by
  6.  
  7.   Copyright (c) 2006 Sjoerd Mastijn
  8.  
  9.   This software is provided 'as-is', without any express or implied warranty.
  10.   In no event will the authors be held liable for any damages arising from the
  11.   use of this software.
  12.  
  13.   Permission is granted to anyone to use this software for any purpose,
  14.   including commercial applications, and to alter it and redistribute it freely,
  15.   subject to the following restrictions:
  16.  
  17.   1. The origin of this software must not be misrepresented; you must not claim
  18.          that you wrote the original software. If you use this software in a product,
  19.          an acknowledgment in the product documentation would be appreciated but is
  20.          not required.
  21.  
  22.   2. Altered source versions must be plainly marked as such, and must not be
  23.          misrepresented as being the original software.
  24.  
  25.   3. This notice may not be removed or altered from any source distribution.
  26.  
  27. */
  28.  
  29. #ifndef __SJASM
  30. #define __SJASM
  31.  
  32. enum EOutputVerbosity { OV_ALL = 0, OV_WARNING, OV_ERROR, OV_NONE, OV_LST };
  33.  
  34. namespace Options {
  35.  
  36.         // which lines should made it into listing: all, active (not skipped by IF false), only-if-has-machine-code
  37.         enum ELstType { LST_T_ALL, LST_T_ACTIVE, LST_T_MC_ONLY };
  38.  
  39.         typedef struct STerminalColorSequences {
  40.                 const char * end, * display, * warning, * error, * bold;
  41.         } STerminalColorSequences;
  42.  
  43.         // structure to group all options affecting parsing syntax
  44.         typedef struct SSyntax {
  45.                 bool            IsPseudoOpBOF;
  46.                 bool            IsReversePOP;
  47.                 bool            FakeEnabled;
  48.                 bool            FakeWarning;    // accessed also by io_err.cpp implementation for W_FAKE warning state
  49.                 bool            IsListingSuspended;
  50.                 ELstType        ListingType;
  51.                 bool            CaseInsensitiveInstructions;
  52.                 bool            WarningsAsErrors;
  53.                 bool            Is_M_Memory;
  54.                 bool            IsSubwordSubstitution;
  55.                 int                     MemoryBrackets; // 0 = [] enabled (default), 1 = [] disabled, 2 = [] required
  56.                 int                     IsNextEnabled;  // 0 = OFF, 1 = ordinary NEXT, 2 = CSpect emulator extensions
  57.                 bool            (*MultiArg)(char*&);    // function checking if multi-arg delimiter is next
  58.  
  59.                 SSyntax() : IsPseudoOpBOF(false), IsReversePOP(false), FakeEnabled(true), FakeWarning(false),
  60.                                         IsListingSuspended(false), ListingType(LST_T_ALL),
  61.                                         CaseInsensitiveInstructions(false), WarningsAsErrors(false),
  62.                                         Is_M_Memory(false), IsSubwordSubstitution(true),
  63.                                         MemoryBrackets(0), IsNextEnabled(0), MultiArg(&comma) {}
  64.                 bool isMultiArgPlainComma() const { return &comma == MultiArg; }
  65.  
  66.         // preservation utils, the push will also reset current syntax to defaults
  67.                 static void resetCurrentSyntax();       // resets current syntax to defaults
  68.                 static void pushCurrentSyntax();        // pushes current syntax
  69.                 static bool popSyntax();                        // restores the syntax from previous push
  70.                 static void restoreSystemSyntax();      // restores the syntax (ahead of pass), and empties the syntax stack
  71.         private:
  72.                 static std::stack<SSyntax> syxStack;    // previous syntax
  73.         } SSyntax;
  74.  
  75.         extern const STerminalColorSequences* tcols;
  76.         extern char OutPrefix[LINEMAX];
  77.         extern char SymbolListFName[LINEMAX];
  78.         extern char ListingFName[LINEMAX];
  79.         extern char ExportFName[LINEMAX];
  80.         extern char DestinationFName[LINEMAX];
  81.         extern char RAWFName[LINEMAX];
  82.         extern char UnrealLabelListFName[LINEMAX];
  83.         extern char CSpectMapFName[LINEMAX];
  84.         extern int CSpectMapPageSize;
  85.         extern char SourceLevelDebugFName[LINEMAX];
  86.         extern bool IsDefaultSldName;
  87.  
  88.         extern EOutputVerbosity OutputVerbosity;
  89.         extern bool IsLabelTableInListing;
  90.         extern bool IsDefaultListingName;
  91.         extern bool IsShowFullPath;
  92.         extern bool AddLabelListing;
  93.         extern bool NoDestinationFile;
  94.         extern SSyntax syx;
  95.         extern bool IsI8080;                    // "i8080" CPU mode (must be set at CLI, blocks others)
  96.         extern bool IsLR35902;                  // "Sharp LR35902" CPU mode (must be set at CLI, blocks others)
  97.         extern bool IsLongPtr;
  98.         extern bool SortSymbols;
  99.         extern bool IsBigEndian;                // true when hosting platform is big-endian
  100.  
  101.         // emit virtual labels in LABELSLIST, that have only 64ki address and no page
  102.         // format is then `:ADDR label`, starting from colon, then 16bit address, then label.
  103.         extern bool EmitVirtualLabels;
  104.  
  105.         extern CStringsList* IncludeDirsList;
  106.         extern CDefineTable CmdDefineTable;
  107.  
  108.         void SetTerminalColors(bool enabled);
  109.  
  110.         // returns true if fakes are completely disabled, false when they are enabled
  111.         // showMessage=true: will also display error/warning (use when fake ins. is emitted)
  112.         // showMessage=false: can be used to silently check if fake instructions are even possible
  113.         bool noFakes(bool showMessage = true);
  114.  
  115.         int parseSyntaxOptions(int n, char** options);  // returns index of failed option or "n"==OK
  116.                 //options[n] must contain nullptr (and it must be valid index)
  117. } // eof namespace Options
  118.  
  119. extern std::vector<CDeviceDef*> DefDevices;
  120. extern CDevice *Devices;
  121. extern CDevice *Device;
  122. extern CDevicePage *Page;
  123. extern char* DeviceID;
  124. extern TextFilePos globalDeviceSourcePos;
  125. extern aint deviceDirectivesCount;
  126.  
  127. //*current* full file name (used as full for CurSourcePos when `--fullpath`)
  128. //content at this pointer is immutable and valid till assembler exits, so you can archive/reuse it
  129. //for example SLD tracing remembers original file where macro was defined by using pointer into this
  130. extern const char* fileNameFull;
  131.  
  132. // extend
  133. extern char* lp, line[LINEMAX], temp[LINEMAX], * bp;
  134. extern char sline[LINEMAX2], sline2[LINEMAX2], * substitutedLine, * eolComment, ModuleName[LINEMAX];
  135. // the "substitutedLine" may be overriden to point back to un-substituted line, it's only "decorative" for Listing purposes
  136.  
  137. typedef struct SSource {
  138.         char fname[MAX_PATH];
  139.         stdin_log_t* stdin_log; // buffer for STDIN option, to replay input in 2nd+ pass
  140.  
  141. //      SSource();
  142.         SSource() = delete;
  143.         SSource(SSource && src);
  144.         SSource(const char* fname);
  145.         SSource(int);           // constructor for "stdin" type of source ("int" just to distinct it)
  146.         ~SSource();
  147. } SSource;
  148.  
  149. extern std::vector<SSource> sourceFiles;
  150.  
  151. enum EDispMode { DISP_NONE = 0, DISP_ACTIVE = 1, DISP_INSIDE_RELOCATE = 2 };
  152. extern EDispMode PseudoORG;
  153.  
  154. extern bool IsLabelNotFound, IsSubstituting;
  155. extern int ConvertEncoding;
  156. extern int pass, ErrorCount, WarningCount, IncludeLevel, IsRunning, donotlist, listmacro;
  157. extern int adrdisp, dispPageNum, StartAddress;
  158. extern byte* MemoryPointer;
  159. extern int macronummer, lijst, reglenwidth;
  160. extern source_positions_t sourcePosStack;
  161. extern source_positions_t smartSmcLines;
  162. extern source_positions_t::size_type smartSmcIndex;
  163. extern uint32_t maxlin;
  164. extern aint CurAddress, CompiledCurrentLine, LastParsedLabelLine, PredefinedCounter;
  165. extern aint destlen, size, comlin;
  166.  
  167. extern char* vorlabp, * macrolabp, * LastParsedLabel;
  168.  
  169. enum EEncoding { ENCDOS, ENCWIN };
  170. extern const char* CurrentDirectory;
  171.  
  172. void ExitASM(int p);
  173. extern CStringsList* lijstp;
  174. extern std::stack<SRepeatStack> RepeatStack;
  175.  
  176. extern CLabelTable LabelTable;
  177. extern CTemporaryLabelTable TemporaryLabelTable;
  178. extern CDefineTable DefineTable;
  179. extern CMacroDefineTable MacroDefineTable;
  180. extern CMacroTable MacroTable;
  181. extern CStructureTable StructureTable;
  182.  
  183. #endif
  184. //eof sjasm.h
  185.