sourcepawn/compiler/scvars.c
author Ruben Gonzalez <drifter01620@gmail.com>
Thu May 22 09:49:27 2014 -0400 (2014-05-22)
changeset 4378 568f4497ef4a
parent 4184 5cd5d6f8bf9e
permissions -rw-r--r--
Update CS:GO team score gamedata.
     1 /*  Pawn compiler
     2  *
     3  *  Global (cross-module) variables.
     4  *
     5  *  Copyright (c) ITB CompuPhase, 1997-2006
     6  *
     7  *  This software is provided "as-is", without any express or implied warranty.
     8  *  In no event will the authors be held liable for any damages arising from
     9  *  the use of this software.
    10  *
    11  *  Permission is granted to anyone to use this software for any purpose,
    12  *  including commercial applications, and to alter it and redistribute it
    13  *  freely, subject to the following restrictions:
    14  *
    15  *  1.  The origin of this software must not be misrepresented; you must not
    16  *      claim that you wrote the original software. If you use this software in
    17  *      a product, an acknowledgment in the product documentation would be
    18  *      appreciated but is not required.
    19  *  2.  Altered source versions must be plainly marked as such, and must not be
    20  *      misrepresented as being the original software.
    21  *  3.  This notice may not be removed or altered from any source distribution.
    22  *
    23  *  Version: $Id$
    24  */
    25 #include <stdio.h>
    26 #include <stdlib.h>     /* for _MAX_PATH */
    27 #include "sc.h"
    28 #include "sp_symhash.h"
    29 
    30 /*  global variables
    31  *
    32  *  All global variables that are shared amongst the compiler files are
    33  *  declared here.
    34  */
    35 SC_VDEFINE symbol loctab;                   /* local symbol table */
    36 SC_VDEFINE symbol glbtab;                   /* global symbol table */
    37 SC_VDEFINE cell *litq;                      /* the literal queue */
    38 SC_VDEFINE unsigned char pline[sLINEMAX+1]; /* the line read from the input file */
    39 SC_VDEFINE const unsigned char *lptr;       /* points to the current position in "pline" */
    40 SC_VDEFINE constvalue tagname_tab = { NULL, "", 0, 0};  /* tagname table */
    41 SC_VDEFINE constvalue libname_tab = { NULL, "", 0, 0};  /* library table (#pragma library "..." syntax) */
    42 SC_VDEFINE constvalue *curlibrary = NULL;   /* current library */
    43 SC_VDEFINE int pc_addlibtable = TRUE;       /* is the library table added to the AMX file? */
    44 SC_VDEFINE symbol *curfunc;                 /* pointer to current function */
    45 SC_VDEFINE char *inpfname;                  /* pointer to name of the file currently read from */
    46 SC_VDEFINE char outfname[_MAX_PATH];        /* intermediate (assembler) file name */
    47 SC_VDEFINE char binfname[_MAX_PATH];        /* binary file name */
    48 SC_VDEFINE char errfname[_MAX_PATH];        /* error file name */
    49 SC_VDEFINE char sc_ctrlchar = CTRL_CHAR;    /* the control character (or escape character)*/
    50 SC_VDEFINE char sc_ctrlchar_org = CTRL_CHAR;/* the default control character */
    51 SC_VDEFINE int litidx    = 0;               /* index to literal table */
    52 SC_VDEFINE int litmax    = sDEF_LITMAX;     /* current size of the literal table */
    53 SC_VDEFINE int stgidx    = 0;      /* index to the staging buffer */
    54 SC_VDEFINE int sc_labnum = 0;      /* number of (internal) labels */
    55 SC_VDEFINE int staging   = 0;      /* true if staging output */
    56 SC_VDEFINE cell declared = 0;      /* number of local cells declared */
    57 SC_VDEFINE cell glb_declared=0;    /* number of global cells declared */
    58 SC_VDEFINE cell code_idx = 0;      /* number of bytes with generated code */
    59 SC_VDEFINE int ntv_funcid= 0;      /* incremental number of native function */
    60 SC_VDEFINE int errnum    = 0;      /* number of errors */
    61 SC_VDEFINE int warnnum   = 0;      /* number of warnings */
    62 SC_VDEFINE int sc_debug  = sCHKBOUNDS; /* by default: bounds checking+assertions */
    63 SC_VDEFINE int sc_packstr= FALSE;  /* strings are packed by default? */
    64 SC_VDEFINE int sc_asmfile= FALSE;  /* create .ASM file? */
    65 SC_VDEFINE int sc_listing= FALSE;  /* create .LST file? */
    66 SC_VDEFINE int sc_compress=TRUE;   /* compress bytecode? */
    67 SC_VDEFINE int sc_needsemicolon=TRUE;/* semicolon required to terminate expressions? */
    68 SC_VDEFINE int sc_dataalign=sizeof(cell);/* data alignment value */
    69 SC_VDEFINE int sc_alignnext=FALSE; /* must frame of the next function be aligned? */
    70 SC_VDEFINE int pc_docexpr=FALSE;   /* must expression be attached to documentation comment? */
    71 SC_VDEFINE int curseg    = 0;      /* 1 if currently parsing CODE, 2 if parsing DATA */
    72 SC_VDEFINE cell pc_stksize=sDEF_AMXSTACK;/* default stack size */
    73 SC_VDEFINE cell pc_amxlimit=0;     /* default abstract machine size limit = none */
    74 SC_VDEFINE cell pc_amxram=0;       /* default abstract machine data size limit = none */
    75 SC_VDEFINE int freading  = FALSE;  /* Is there an input file ready for reading? */
    76 SC_VDEFINE int fline     = 0;      /* the line number in the current file */
    77 SC_VDEFINE short fnumber = 0;      /* the file number in the file table (debugging) */
    78 SC_VDEFINE short fcurrent= 0;      /* current file being processed (debugging) */
    79 SC_VDEFINE short sc_intest=FALSE;  /* true if inside a test */
    80 SC_VDEFINE int sideeffect= 0;      /* true if an expression causes a side-effect */
    81 SC_VDEFINE int stmtindent= 0;      /* current indent of the statement */
    82 SC_VDEFINE int indent_nowarn=FALSE;/* skip warning "217 loose indentation" */
    83 SC_VDEFINE int sc_tabsize=8;       /* number of spaces that a TAB represents */
    84 SC_VDEFINE short sc_allowtags=TRUE;  /* allow/detect tagnames in lex() */
    85 SC_VDEFINE int sc_status;          /* read/write status */
    86 SC_VDEFINE int sc_rationaltag=0;   /* tag for rational numbers */
    87 SC_VDEFINE int rational_digits=0;  /* number of fractional digits */
    88 SC_VDEFINE int sc_allowproccall=0; /* allow/detect tagnames in lex() */
    89 SC_VDEFINE short sc_is_utf8=FALSE; /* is this source file in UTF-8 encoding */
    90 SC_VDEFINE char *pc_deprecate=NULL;/* if non-null, mark next declaration as deprecated */
    91 SC_VDEFINE int sc_curstates=0;     /* ID of the current state list */
    92 SC_VDEFINE int pc_optimize=sOPTIMIZE_NOMACRO; /* (peephole) optimization level */
    93 SC_VDEFINE int pc_memflags=0;      /* special flags for the stack/heap usage */
    94 SC_VDEFINE int sc_showincludes=0;  /* show include files */
    95 
    96 SC_VDEFINE constvalue sc_automaton_tab = { NULL, "", 0, 0}; /* automaton table */
    97 SC_VDEFINE constvalue sc_state_tab = { NULL, "", 0, 0};   /* state table */
    98 
    99 SC_VDEFINE FILE *inpf    = NULL;   /* file read from (source or include) */
   100 SC_VDEFINE FILE *inpf_org= NULL;   /* main source file */
   101 SC_VDEFINE FILE *outf    = NULL;   /* (intermediate) text file written to */
   102 
   103 SC_VDEFINE jmp_buf errbuf;
   104 
   105 SC_VDEFINE HashTable *sp_Globals = NULL;
   106 
   107 #if !defined SC_LIGHT
   108   SC_VDEFINE int sc_makereport=FALSE; /* generate a cross-reference report */
   109 #endif
   110 
   111 #if defined __WATCOMC__ && !defined NDEBUG
   112   /* Watcom's CVPACK dislikes .OBJ files without functions */
   113   static int dummyfunc(void)
   114   {
   115     return 0;
   116   }
   117 #endif