kolibrios-fun/programs/develop/c--/trunk/data.h--
Yogev Ezra 02b76505a6 Add sources of "C--"'like compiler written in C--.
git-svn-id: svn://kolibrios.org@1846 a494cfbc-eb01-0410-851d-a64ba20cac60
2011-02-05 16:39:49 +00:00

158 lines
6.0 KiB
Plaintext
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//===== ƒ«®¡ «ì­ë¥ ¯¥à¥¬¥­­ë¥
// ---- ˆ­ä®à¬ æ¨ï ¯® tokens
dword tok=0;
dword type=0;
dword src=0;
dword post=0;
dword number=0;
byte string[STRLEN]=0;
dword tok2=0;
dword type2=0;
dword src2=0;
dword post2=0;
dword number2=0;
dword modline=0;
byte string2[STRLEN]=0;
// ---- <20>ãä¥à  ã¯à ¢«ïî騥 ä« £¨
dword currmod=0; // <20>®¬¥à ⥪ã饣® ä ©« 
dword displaytokerrors=1;// ”« £ ¢ë¢®¤  á®®¡é¥­ © ®¡ ®è ¡ª¥
dword error=0; // ‘®¤¥à¦¨â ­®¬¥à ⥪ã饩 ®è¨¡ª
dword maxerrors = 16; // <20>।¥« ¯® ª®«¨ç¥áâ¢ã ®è¨¡®ª
dword makemapfile=0; // ”« £ £¥­¥à æ ¨ MAP-ä ©« 
dword dbg=0; // ”« £ £¥­¥à æ ¨ TDS-ä ©«  ¤«ï TD32
dword dbginfo=0; // “ª § â¥«ì ­  ¡ãä¥à dbg ¨­ä®à¬ æ¨¥© (á¬.®¯¨á ­¨¥ ¢ enum dbg_...)
dword dbgs=0; // ’¥ªã騩 㪠§ â¥«ì ¢ dbginfo
dword input=0; // “ª § â¥«ì ­  ­ ç «® ¤¨­ ¬¨ç¥áª®£® ¡ãä¥à  á ¢å®¤­ë¬ ä ©«®¬
dword inptr=0; // “ª § â¥«ì ­  ⥪ãé ᨬ¢®« ¢ ¡ãä¥à¥ input
dword inptr2=0; // Š®¯¨ï inptr
dword endoffile=0; // ”« £ ª®­æ  ä ©« 
dword totallines=1; // Ž¡é¥¥ ª®«¨ç¥á⢮ ®âª®¬¯¨«¨à®¢ ­­ëå áâப
dword linenumber=0; // <20>®¬¥à ⥪ã饩 áâப¨
dword linenum2=0; // <20>®¬¥à á«¥¤ãî饩 áâப¨
dword list=0; // ”« £ ¢ë¤ ç¨ «¨á⨭£ 
dword label=0; // ‘ª¢®§­®© ­®¬¥à ¤«ï «®ª «ì­ëå ¬¥â®ª
dword mapfile=0; // Handle ¤«ï MAP ä ©« 
dword module=0; // ‘ç¥â稪 ®âª®¬¯¨«¨à®¢ ­­ëå ¬®¤ã«¥©
dword outptr=0; // ˆ­¤¥ªá ¢ output
dword output=0; // “ª § â¥«ì ­  ¡ãä¥à á ª®¤®¬
dword localsize=0; // <20> §¬¥à á⥪  ¯®¤ «®ª «ì­ë¬¨ ¯¥à¥¬¥­­ë¬¨
dword posttype=0; // “ª § â¥«ì ­  ⨯ POST
dword postloc=0; // “ª § â¥«ì ­  ¯®«®¦¥­¨¥ ¢ output
dword postnum=0; // “ª § â¥«ì ­  §­ ç¥­¨¥ ¯® postloc
dword posts=0; // <20>®¬¥à ⥪ã饩 § ¯¨á¨ ¢ posttype, postloc ¨ postnum
dword postsize=0; // ‘㬬 à­ë© à §¬¥à ¢á¥å post-¯¥à¥¬¥­­ëå
dword poststrptr=MAXDATA-1; // ˆ­¤¥ªá ¤«ï ¢ë¢®¤  post-áâப
dword procedure_start=0;// €¤à¥á ­ ç «  ¯à®æ¥¤ãàë
dword runfilesize=0;
dword startptr=0; // “ª § â¥«ì ­  main()
dword treestart=0; // “ª § â¥«ì ­  ­ ç «® ᯨ᪠ ¨¤¥­â¨ä¨ª â®à®¢
dword treeptr=0; // “ª § â¥«ì ­  ⥪ãéã § ¯¨áì ¢ ᯨ᪥ ¨¤¥­â ª â®à®¢
dword locallist = NULL; // “ª § â¥«ì ­  ­ ç «® ᯨ᪠ «®ª «ì­ëå ¯¥à¥¬¥­­ëå
dword localptr=NULL; // “ª § â¥«ì ­  ⥪ãéãî § ¯¨áì ¢ ᯨ᪥ «®ª «ì­ëå
dword DLLcount=0; // ‘ç¥â稪 ¨¬¯®àâ¨à®¢ ­­ëå DLL
dword APIcount=0; // ‘ç¥â稪 ¨á¯®«ì§ã¥¬ëå API
dword importFlag=0; // ”« £ ¨¬¯®àâ  ¨§ DLL
dword DLLlist[MAXDLLS];
byte currentfilename[FILENAMESIZE] = 0;
byte inputfile[FILENAMESIZE]=0;
byte rawfilename[FILENAMESIZE]=0;
byte mapstr[120]=0;
// ---- DOS&PE headers
word exeheader[34]={
0x5A4D,0x40,1,0,2,0,0xFFFF,0,
0,0,0,0,0x40,0,0,0,
0xC88C,0xD88E,0x0FBA,0xB400,0xCD09,0xB821,0x4C00,0x21CD,
0x6957,0x336E,0x2032,0x6E6F,0x796C,0x2421,0x40,0,
0x4550,0};
// PE Header
//unsigned dword PEsign = 0x4550;
word PEmachine=0x14C; // target machine = Intel 386
word PEnSections=1; // XAC - only .text!!! number of sections in Sections table
word PEDate=0;
word PEtime=0;
dword PEpSymbolTable=0; // Offset within COFF file of the symbol table
dword PEnSymbols=0; // number of entries in the symbol table
word PEOptHeaderSize=0xE0; // Size of optional header
word PECharacteristics=0x30E; //0x30E 32-bit+...
// Optional header (only in EX image)
word OptMagic=0x10B; // normal executable
byte OptLmajor=2; // Linker major version number
byte OptLminor=0x37; // Linker minor version number
dword OptCodeSize=0; // Size of the code section
dword OptInitDataSize=0; // Size of the initialized data section
dword OptUninitDataSize=0;// Size of the uninitialized data section (BSS)
dword OptEntryPointRVA=0x1000;// Address of entry point, relative to image base
dword OptBaseOfCode=0x1000;// Address realtive to image base
dword OptBaseOfData=0;//Address realtive to image base
dword OptImageBase=0x00400000;// Preferred address of first byte of image
dword OptSectionAlignment=0x1000;
dword OptFileAlignment=0x200;
word OptOSmajor=1;
word OptOSminor=0;
dword OptUserVersion=0;
word OptSubSysMajor=4;
word OptSubSysMinor=0;
dword OptReserved=0;
dword OptImageSize=0x0; // Size of image, including all headers
dword OptHeaderSize=0x200; //DOSheader+PEheader+ObjectTable
dword OptFileChecksum=0; // Image file checksum
word OptSubSystem=3; // 2-GUI; 3-console
word OptDLLflag=0;
dword OptStackReserveSize=0x100000;
dword OptStackCommitSixe=0x1000;
dword OptHeapReserveSize=0x100000;
dword OptHeapCommitSize=0x1000;
dword OptLoaderSize=0;
dword OptNumOfDataDirectories=16;
// Optional header Data Directories
dword OptExportTableAdr=0;
dword OptExportTableSize=0;
dword OptImportTableAdr=0;
dword OptImportTableSize=0;
dword OptResourceTableAdr=0;
dword OptResourceTablesize=0;
dword OptExceptionTableAdr=0;
dword OptExceptionTableSize=0;
dword OptSecurityTableAdr=0;
dword OptSecurityTableSize=0;
dword OptBaseRelocationTableAdr=0;
dword OptBaseRelocationTableSize=0;
dword OptDebugAdr=0;
dword OptDebugSize=0;
dword OptCopyrightAdr=0;
dword OptCopyrightSize=0;
dword OptGlobalPtrAdr=0;
dword OptGlobalPtrSize=0;
dword OptTLStableAdr=0;
dword OptTLStablesize=0;
dword OptLoadConfigTableAdr=0;
dword OptLoadConfigTableSize=0;
dword OptReserved2[10]={0,0,0,0,0,0,0,0,0,0};
// Sections Table
// TEXT section header
byte TxtSectionName[8]=".text";
dword TxtVirtualSize=0;
dword TxtRVAoffset=0x1000;
dword TxtSizeOfRawData=0;
dword TxtPointerToRawData=0x200;
dword TxtPointerToRelocs=0;
dword TxtPointerToLinenumbers=0;
word TxtNumberOfRelocs=0;
word TxtNumberOfLinenumbers=0;
dword TxtSectionFlags=0xE00000E0; // can be executed + contain executable code
// ---- <20>¥¨­¨æ àã¥¬ë¥ ¤ ­­ë¥
dword stdout; // Handle to stdout
byte cha,cha2;
dword numberofids;
dword current_proc_type; // ’¨¯ ⥪ã饩 ¯à®æ¥¤ãàë (cpt_near, cpt_far)
dword returntype; // ’¨¯ ¢®§¢à é ¥¬®£® §­ ç¥­¨ï (void, byte, word, ...)
dword paramsize;
dword relation;
dword startlabel,endlabel;
byte modules[MAXMDL*FILENAMESIZE];
dword St_Mnemonics[26];
dword St_Registers[26];
dword St_Directives[26];
dword St_Sizes[26];
byte Buffer16[64]; // <20>ãä¥à ¤«ï á®àâ¨à®¢ª áâப