📄 cvars.h
字号:
/****************************************************************************
*
* Open Watcom Project
*
* Portions Copyright (c) 1983-2002 Sybase, Inc. All Rights Reserved.
*
* ========================================================================
*
* This file contains Original Code and/or Modifications of Original
* Code as defined in and that are subject to the Sybase Open Watcom
* Public License version 1.0 (the 'License'). You may not use this file
* except in compliance with the License. BY USING THIS FILE YOU AGREE TO
* ALL TERMS AND CONDITIONS OF THE LICENSE. A copy of the License is
* provided with the Original Code and Modifications, and is also
* available at www.sybase.com/developer/opensource.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND SYBASE AND ALL CONTRIBUTORS HEREBY DISCLAIM
* ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR
* NON-INFRINGEMENT. Please see the License for the specific language
* governing rights and limitations under the License.
*
* ========================================================================
*
* Description: C compiler global variables.
*
****************************************************************************/
#ifdef __WATCOMC__
#pragma off(check_stack);
#endif
#define BY_C_FRONT_END
#ifdef M_I86
#define __FAR far
#else
#define __FAR
#endif
#include <stdio.h>
#include <setjmp.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include "target.h"
#ifndef _HOST
#error _HOST macro not defined
#endif
#ifndef _OS
#error _OS macro not defined
#endif
#ifndef _CPU
#error _CPU macro not defined
#endif
#ifndef VERSION
#error VERSION macro not defined
#endif
#ifndef _MACHINE
#error _MACHINE macro not defined
#endif
#if _CPU != 8086
/* enable Structured Exception Handling for all 32-bit targets */
#define __SEH__
#endif
typedef char * MACADDR_T; /* contains actual pointer to block of memory */
typedef char * SEGADDR_T; /* contains actual pointer to block of memory */
typedef char * MPTR_T; /* first parm to MacroCopy */
typedef void *VOIDPTR;
#include "macro.h"
#include "dw.h"
#include "ctypes.h"
#include "cfcb.h"
#include "csegid.h"
#include "ctokens.h"
#include "cerrs.h"
#include "toggle.h"
#include "cmsg.h"
#ifndef local
#define local
#endif
#ifndef global
#define global extern
#endif
#define SYM_HASH_SIZE 241
#define ENUM_HASH_SIZE 241
#define MACRO_HASH_SIZE 4093
#define MAX_PARM_LIST_HASH_SIZE 5
global char *PCH_Start; // start of precompiled memory block
global char *PCH_End; // end of precompiled memory block
global char *PCH_Macros; // macros loaded from pre-compiled header
global char *PCH_FileName; // name to use for pre-compiled header
global INCFILE *IncFileList; // list of primary include files for PCH
global SYMPTR *PCH_SymArray; // array of symbol table pointers from PCH
global int PCH_MaxSymHandle;// number of symbols in PCH_SymArray
global char *ScanCharPtr; // used by character scanning routines
global int DebugFlag;
global enum TOKEN CurToken;
global int BadTokenInfo;
global int TokenLen;
global int MTokenLen; /* macro token length */
global int TokenLine;
global int SrcFileLineNum; /* duplicate of SrcFile->src_line */
global int TokenFno;
global int CurrChar;
global DATA_TYPE ConstType;
global unsigned long Constant;
global uint64 Const64;
global int CLitLength; /* length of string literal */
global FCB *MainSrcFile; /* primary source file being compiled */
global FCB *SrcFile;
global char *SrcFName; /* source file name without suffix */
global char *DefFName; /* .def file name (prototypes) */
global char *WholeFName; /* whole file name with suffix */
global char *ForceInclude;
global char *AuxName;
global struct fname_list *FNames; /* list of file names processed */
global struct rdir_list *RDirNames; /* list of read only directorys */
global char *ErrFName; /* file name to be used in error message */
global unsigned ErrLine; /* line number to be used in error msg */
global FILE *ErrFile; /* error file */
global FILE *DefFile; /* output for func prototypes */
global FILE *CppFile; /* output for preprocessor */
global FILE *DepFile; /* make style auto depend file */
global struct cpp_info *CppStack; /* #if structure control stack */
global char *HFileList; /* list of path names to try for H files */
global int SrcLineNum;
global int SrcFno;
global int SrcLineCount; /* # of lines in primary source file */
global int IncLineCount; /* # of lines in all included files */
global int ErrCount; /* total # of errors encountered */
global int WngCount; /* total # of warnings encountered */
global int WngLevel; /* warning severity level */
global int TypeCount; /* total # of type nodes allocated */
global int GblSymCount; /* total # of global symbols */
global int LclSymCount; /* total # of local and temporary symbols */
global int FuncCount; /* total # of functions defined in module */
global int MacroCount; /* total # of macros defined */
global int TagCount; /* total # of tag entries */
global int FieldCount; /* total # of struct field names */
global int EnumCount; /* total # of enumerated symbols */
global int ReclaimCount; /* total # of reclaimed leaves */
global int AllocCount; /* total # of allocs */
global int FreeCount; /* total # of frees */
global int SizeOfCount; /* # of nested sizeof() expressions */
global int NestLevel; /* pre-processing level of #if */
global int SkipLevel; /* pre-processing level of #if to skip to */
global int SymLevel; /* current lex level (# of nested {) */
global int HashValue; /* hash value for identifier */
global int KwHashValue; /* hash value for keyword */
global int MacHashValue; /* hash value for macro name */
global char *SavedId; /* saved id when doing look ahead */
global int SavedHash; /* hash value for saved id */
global int SavedTokenLine; /* value of TokenLine when id saved */
global int SavedTokenFno; /* value of TokenFno when id saved */
global int LAToken; /* look ahead token */
global LABELPTR LabelHead; /* list of all labels defined in function */
global TAGPTR TagHead; /* list of all struct, union, enum tags */
global TAGPTR DeadTags; /* list of all tags that are out of scope */
global TYPEPTR TypeHead; /* list of all type nodes allocated */
global TYPEPTR FuncTypeHead[ MAX_PARM_LIST_HASH_SIZE + 1 ];
global TYPEPTR VoidParmList[2];/* function with void parm */
global char *SymLoc; /* file name with defn of symbol */
global PARMPTR ParmList; /* list of parms for function */
global SYM_HANDLE GlobalSym; /* global symbol table list head */
#if _CPU == 386
global SYM_HANDLE SymSTOD; /* builtin symbol for 'rep stosd' */
global SYM_HANDLE SymSTOSB; /* builtin symbol for '__STOSB' */
global SYM_HANDLE SymSTOSD; /* builtin symbol for '__STOSD' */
#endif
#ifdef __SEH__
global SYM_HANDLE SymTryInit; /* builtin symbol for '__TryInit' */
global SYM_HANDLE SymTryFini; /* builtin symbol for '__TryFini' */
global SYM_HANDLE SymExcept; /* builtin symbol for '__Except' */
global SYM_HANDLE SymFinally; /* builtin symbol for '__Finally' */
global SYM_HANDLE SymTryUnwind;/* builtin symbol for '__TryUnwind' */
global SYM_HANDLE TrySymHandle;/* builtin symbol for local try block */
global int TryScope; /* current scope of _try blocks */
global int TryCount; /* current number of _try blocks */
#endif
global SYM_HANDLE SymSTOW; /* builtin symbol for 'rep stosw' */
global SYM_HANDLE SymSTOWB; /* builtin symbol for 'rep stosw, stosb' */
global SYM_HANDLE SymMIN; /* builtin symbol for 'min(a,b)' */
global SYM_HANDLE SymMAX; /* builtin symbol for 'max(a,b)' */
global SYM_HANDLE SymMEMCMP; /* builtin symbol for 'memcmp' func */
global SYM_HANDLE SymMEMCPY; /* builtin symbol for 'memcpy' func */
global SYM_HANDLE SpecialSyms; /* builtin symbols (thread linked) */
global SYM_HANDLE NextSymHandle;/* next handle for a symbol */
global SYM_HANDLE CharSymHandle;/* sym handle for "char" typedef */
global SYM_HANDLE Sym_CS; /* sym handle for __segname("_CODE") ie. CS */
global SYM_HANDLE Sym_SS; /* sym handle for __segname("_STACK")ie. SS */
global SYM_HANDLE SymCover; /* sym handle for '__COVERAGE' */
global SYM_HANDLE SymDFAbbr; /* sym handle for '__DFABBREV' */
global SYM_HANDLE SymChipBug; /* sym handle for '__chipbug' */
global FIELDPTR ErrSym;
#if _CPU == 386
global void *FunctionProfileBlock; /* handle for profiling data block */
global int FunctionProfileSegment; /* segment for profiling data block */
#endif
global int MacroDepth;
global byte *MacroPtr;
global MEPTR NextMacro;
global MEPTR UndefMacroList;
global MEPTR __FAR *MacHash; /* [ MACRO_HASH_SIZE ] */
global ENUMPTR EnumTable[ ENUM_HASH_SIZE ];
global SYM_HASHPTR __FAR *HashTab;
global TYPEPTR BaseTypes[TYPE_LAST_ENTRY];
global int CTypeCounts[TYPE_LAST_ENTRY];
#define BUF_SIZE 512
global size_t BufSize;
global char *Buffer;
global char *TokenBuf;
global unsigned long GenSwitches; /* target independant switches for code generator */
global unsigned long TargetSwitches; /* target specific code generator switches */
global unsigned ProcRevision; /* processor revision for c.g. */
global char *GenCodeGroup; /* pointer to code group name */
global int ProEpiDataSize; /* data to be alloc'd for pro/epi hook */
global int Toggles; /* global toggle flags */
global int ErrLimit;
global unsigned DataThreshold; /* sizeof(obj) > this ==> separate segment */
global unsigned Inline_Threshold; /* -oe=num for function inlining */
global int DataPtrSize;
global int CodePtrSize;
global int DeadCode; /* non-zero => next stmt is unreachable */
global int TmpSymCount;
global int LitCount;
global int LitPoolSize;
global unsigned MacroSize;
global struct comp_flags CompFlags;
global struct global_comp_flags GlobalCompFlags;
global int SegmentNum; /* next PRIVATE segment number to use */
global int FarStringSegment;
global void *Environment; /* var for Suicide() */
#define MAX_LEVEL 1024
/* The following 3 arrays are also used by CGEN for saving _try block info */
global TREEPTR ValueStack[ MAX_LEVEL ];
global char Token[ MAX_LEVEL ];
global char Class[ MAX_LEVEL ];
global int Level;
global struct segment_list *SegListHead;
global int SegImport; /* next segment # for import sym */
global int SegData; /* data segment # for -nd option */
global TREEPTR FirstStmt; /* root of expression tree */
global dbug_type ScopeStruct;
global dbug_type ScopeUnion;
global dbug_type ScopeEnum;
global dbug_type B_Int_1;
global dbug_type B_UInt_1;
global dbug_type B_Short;
global dbug_type B_UShort;
global dbug_type B_Int;
global dbug_type B_UInt;
global dbug_type B_Int32;
global dbug_type B_UInt32;
global dbug_type B_Int64;
global dbug_type B_UInt64;
global int OptSize; /* 100 => make pgm small as possible */
global char __Time[10]; /* "HH:MM:SS" for __TIME__ macro */
global char __Date[12]; /* "MMM DD YYYY" for __DATE__ macro */
global char *MsgFlags; /* Bit mask of disabled messages */
global struct macro_seg_list {
struct macro_seg_list *next;
MACADDR_T segment;
} *MacSegList; /* pointer to list of macro segments */
global MACADDR_T MacroSegment; /* segment for macro definitions */
global MACADDR_T MacroOffset; /* first free byte in MacroSegment */
global MACADDR_T MacroLimit; /* last free byte in MacroSegment */
global int SwitchChar; /* DOS switch character */
global int LoopDepth; /* current nesting of loop constructs */
global char CLIB_Name[10]; /* "1CLIBMT3x" */
global char MATHLIB_Name[10];/* "5MATHx" or "8MATH87x" */
global char *EmuLib_Name; /* "9emu87" for -fpi, "9noemu87" for -fpi */
#ifdef __PCODE__
global char *PcodeLib_Name; /* "2p16fpc" for -fpc, "2p16fpi" for -fpi */
#endif
//global struct scoreboard *ScoreBoard;
#define USER_LIB_PRIO '9'
global struct library_list {
struct library_list *next;
char prio;
char name[1];
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -