"Fossies" - the Fresh Open Source Software Archive

Member "FreeBASIC-1.07.1-source/src/compiler/symb.bi" (27 Sep 2019, 73872 Bytes) of package /linux/privat/FreeBASIC-1.07.1-source.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Visual Basic source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "symb.bi": 1.07.0_vs_1.07.1.

    1 ''
    2 '' symbol table protos
    3 ''
    4 
    5 #include once "list.bi"
    6 #include once "pool.bi"
    7 #include once "ast-op.bi"
    8 
    9 ''
   10 enum FB_DATACLASS
   11     FB_DATACLASS_INTEGER                        '' must be the first
   12     FB_DATACLASS_FPOINT
   13     FB_DATACLASS_STRING
   14     FB_DATACLASS_UDT
   15     FB_DATACLASS_PROC
   16     FB_DATACLASS_UNKNOWN
   17 end enum
   18 
   19 '' if FB_DATATYPE changes, take care to update:
   20 '' - ir-hlc.bas::dtypeName() array
   21 '' - edbg_stab.bas::remapTB() array
   22 '' - symb-mangling.bas::typecodeTB() array
   23 '' - symb-data.bas::symb_dtypeTB() array
   24 '' - emit_x86.bas::dtypeTB() array
   25 
   26 enum FB_DATATYPE
   27     FB_DATATYPE_VOID
   28     FB_DATATYPE_BOOLEAN
   29     FB_DATATYPE_BYTE
   30     FB_DATATYPE_UBYTE
   31     FB_DATATYPE_CHAR
   32     FB_DATATYPE_SHORT
   33     FB_DATATYPE_USHORT
   34     FB_DATATYPE_WCHAR
   35     FB_DATATYPE_INTEGER
   36     FB_DATATYPE_UINT
   37     FB_DATATYPE_ENUM
   38     FB_DATATYPE_LONG
   39     FB_DATATYPE_ULONG
   40     FB_DATATYPE_LONGINT
   41     FB_DATATYPE_ULONGINT
   42     FB_DATATYPE_SINGLE
   43     FB_DATATYPE_DOUBLE
   44     FB_DATATYPE_STRING
   45     FB_DATATYPE_FIXSTR
   46     FB_DATATYPE_VA_LIST
   47     FB_DATATYPE_STRUCT
   48     FB_DATATYPE_NAMESPC
   49     FB_DATATYPE_FUNCTION
   50     FB_DATATYPE_FWDREF
   51     FB_DATATYPE_POINTER
   52     FB_DATATYPE_XMMWORD
   53 end enum
   54 
   55 const FB_DATATYPES = (FB_DATATYPE_XMMWORD - FB_DATATYPE_VOID) + 1
   56 
   57 const FB_DT_TYPEMASK        = &b00000000000000000000000000011111 '' max 32 built-in dts
   58 const FB_DT_PTRMASK         = &b00000000000000000000000111100000 '' level of pointer indirection
   59 const FB_DT_CONSTMASK       = &b00000000000000111111111000000000 '' PTRLEVELS + 1 bit-masks
   60 const FB_DATATYPE_REFERENCE = &b00000000000010000000000000000000 '' used for mangling BYREF parameters
   61 const FB_DT_MANGLEMASK      = &b00000001111100000000000000000000 '' used to modify mangling for builtin types
   62 const FB_DATATYPE_INVALID   = &b10000000000000000000000000000000
   63 
   64 const FB_DT_PTRLEVELS       = 8                 '' max levels of pointer indirection
   65 
   66 const FB_DT_PTRPOS          = 5
   67 const FB_DT_CONSTPOS        = FB_DT_PTRPOS + 4
   68 
   69 const FB_DT_MANGLEPOS       = 20
   70 
   71 enum FB_OVLPROC_MATCH_SCORE
   72     FB_OVLPROC_NO_MATCH = 0
   73     FB_OVLPROC_LOWEST_MATCH = 1
   74     FB_OVLPROC_HALFMATCH = FB_DATATYPES
   75     FB_OVLPROC_TYPEMATCH = FB_DATATYPES * 2
   76     FB_OVLPROC_FULLMATCH = FB_DATATYPES * 3
   77 end enum
   78 
   79 enum
   80     FB_SIZETYPE_BOOLEAN = 0
   81     FB_SIZETYPE_INT8
   82     FB_SIZETYPE_UINT8
   83     FB_SIZETYPE_INT16
   84     FB_SIZETYPE_UINT16
   85     FB_SIZETYPE_INT32
   86     FB_SIZETYPE_UINT32
   87     FB_SIZETYPE_INT64
   88     FB_SIZETYPE_UINT64
   89     FB_SIZETYPE_FLOAT32
   90     FB_SIZETYPE_FLOAT64
   91 end enum
   92 
   93 '' symbol classes
   94 '' When changing, update symb.bas:classnames() and symb.bas:classnamesPretty()
   95 enum FB_SYMBCLASS
   96     FB_SYMBCLASS_VAR            = 1
   97     FB_SYMBCLASS_CONST
   98     FB_SYMBCLASS_PROC
   99     FB_SYMBCLASS_PARAM
  100     FB_SYMBCLASS_DEFINE
  101     FB_SYMBCLASS_KEYWORD
  102     FB_SYMBCLASS_LABEL
  103     FB_SYMBCLASS_NAMESPACE
  104     FB_SYMBCLASS_ENUM
  105     FB_SYMBCLASS_STRUCT
  106     FB_SYMBCLASS_CLASS
  107     FB_SYMBCLASS_FIELD
  108     FB_SYMBCLASS_TYPEDEF
  109     FB_SYMBCLASS_FWDREF                         '' forward definition
  110     FB_SYMBCLASS_SCOPE
  111     FB_SYMBCLASS_NSIMPORT                       '' namespace import (an USING)
  112 end enum
  113 
  114 '' symbol state mask
  115 enum FB_SYMBSTATS
  116                             ''= &h00000001
  117     FB_SYMBSTATS_ACCESSED     = &h00000002
  118     FB_SYMBSTATS_CTORINITED   = &h00000004  '' ctor method procs only
  119     FB_SYMBSTATS_DECLARED     = &h00000008
  120     FB_SYMBSTATS_IMPLICIT     = &h00000010 '' VARs only: implicitly generated by compiler (symbAddImplicitVar()), not explicitly defined in source code
  121     FB_SYMBSTATS_RTL          = &h00000020
  122     FB_SYMBSTATS_THROWABLE    = &h00000040
  123     FB_SYMBSTATS_PARSED       = &h00000080
  124     FB_SYMBSTATS_RTTITABLE    = &h00000100 '' VARs only: it's an rtti table (used for name mangling)
  125     FB_SYMBSTATS_HASALIAS     = &h00000200
  126     FB_SYMBSTATS_VTABLE       = &h00000400 '' VARs only: it's a vtable (used for name mangling)
  127     FB_SYMBSTATS_DONTINIT     = &h00000800
  128     FB_SYMBSTATS_MAINPROC     = &H00001000
  129     FB_SYMBSTATS_MODLEVELPROC = &h00002000
  130     FB_SYMBSTATS_FUNCPTR      = &h00004000    '' needed to demangle
  131     FB_SYMBSTATS_JUMPTB       = &h00008000    '' ASM backend's fake jumptb vars only
  132     FB_SYMBSTATS_GLOBALCTOR   = &h00010000
  133     FB_SYMBSTATS_GLOBALDTOR   = &h00020000
  134     FB_SYMBSTATS_CANTDUP      = &h00040000
  135     FB_SYMBSTATS_CANBECLONED  = &h00080000  '' procedures: It's safe to duplicate CALLs to procedures with this flag, no problems with side effects. Useful for RTL procedures where we can be sure about this.
  136     FB_SYMBSTATS_CANREDEFINE  = &h00100000  '' CONSTs: implicitly generated by compiler (symbKeywordConstsInit()), may be redefined
  137     FB_SYMBSTATS_FIXLENSTR    = &h00200000  '' TYPEDEFs: to differentiate between Zstring and Zstring * 1 (same for Wstring)
  138     FB_SYMBSTATS_HASRTTI      = &h00400000
  139     FB_SYMBSTATS_CANTUNDEF    = &h00800000
  140     FB_SYMBSTATS_UNIONFIELD   = &h01000000  '' fields only
  141     FB_SYMBSTATS_RTL_CONST    = &h02000000  '' params only
  142     FB_SYMBSTATS_EMITTED      = &h04000000      '' needed by high-level IRs, to avoid emitting structs etc twice
  143     FB_SYMBSTATS_BEINGEMITTED = &h08000000      '' ditto, for circular dependencies with structs
  144 
  145     '' reuse - take care
  146     FB_SYMBSTATS_PROCEMITTED    = FB_SYMBSTATS_UNIONFIELD  '' procs only
  147     FB_SYMBSTATS_EXCLPARENT     = FB_SYMBSTATS_DONTINIT    '' procs only
  148 
  149     '' A wchar ptr var that needs deallocating at scope breaks/end.
  150     '' (Cheap dynamic wstring used by the 'SELECT CASE wstring' temporary,
  151     '' there is no real FB_DATATYPE_WSTRING yet)
  152     FB_SYMBSTATS_WSTRING = FB_SYMBSTATS_UNIONFIELD '' vars only
  153 
  154     FB_SYMBSTATS_ARGV = FB_SYMBSTATS_CANBECLONED  '' params/paramvars only: is it main()'s argv? (helping the C backend to emit a clang-compatible main() signature)
  155 end enum
  156 
  157 '' symbol attributes mask
  158 enum FB_SYMBATTRIB
  159     FB_SYMBATTRIB_NONE          = &h00000000
  160 
  161     FB_SYMBATTRIB_SHARED        = &h00000001
  162     FB_SYMBATTRIB_STATIC        = &h00000002
  163     FB_SYMBATTRIB_DYNAMIC       = &h00000004
  164     FB_SYMBATTRIB_COMMON        = &h00000008
  165     FB_SYMBATTRIB_EXTERN        = &h00000010    '' extern's become public when DIM'ed
  166     FB_SYMBATTRIB_PUBLIC        = &h00000020
  167     FB_SYMBATTRIB_PRIVATE       = &h00000040
  168     FB_SYMBATTRIB_LOCAL         = &h00000080
  169     FB_SYMBATTRIB_EXPORT        = &h00000100
  170     FB_SYMBATTRIB_IMPORT        = &h00000200
  171     FB_SYMBATTRIB_OVERLOADED    = &h00000400
  172     FB_SYMBATTRIB_METHOD        = &h00000800  '' Non-STATIC UDT member procs, i.e. procs with implicit THIS ptr
  173     FB_SYMBATTRIB_CONSTRUCTOR   = &h00001000    '' methods only
  174     FB_SYMBATTRIB_DESTRUCTOR    = &h00002000    '' /
  175     FB_SYMBATTRIB_OPERATOR      = &h00004000
  176     FB_SYMBATTRIB_PROPERTY      = &h00008000    '' /
  177     FB_SYMBATTRIB_PARAMBYDESC   = &h00010000 '' VARs, TODO: Rename these and symbIsParam*() to clarify that they're about param vars (not params)
  178     FB_SYMBATTRIB_PARAMBYVAL    = &h00020000 '' VARs
  179     FB_SYMBATTRIB_PARAMBYREF    = &h00040000 '' VARs
  180     FB_SYMBATTRIB_LITERAL       = &h00080000
  181     FB_SYMBATTRIB_CONST         = &h00100000
  182     FB_SYMBATTRIB_STATICLOCALS      = &h00200000  '' procedures only
  183     FB_SYMBATTRIB_TEMP          = &h00400000
  184     FB_SYMBATTRIB_DESCRIPTOR    = &h00800000
  185     FB_SYMBATTRIB_FUNCRESULT    = &h01000000
  186     FB_SYMBATTRIB_REF               = &h02000000    '' VARs/FIELDs (if declared with BYREF), PROCs (functions/function pointers returning BYREF)
  187     FB_SYMBATTRIB_VIS_PRIVATE   = &h04000000    '' UDT members only
  188     FB_SYMBATTRIB_VIS_PROTECTED = &h08000000    '' ditto
  189     FB_SYMBATTRIB_NAKED         = &h10000000  '' procedures only
  190     FB_SYMBATTRIB_VIRTUAL       = &h20000000  '' methods only: all virtuals (normal and pure)
  191     FB_SYMBATTRIB_ABSTRACT      = &h40000000  '' methods only: pure virtuals (only)
  192     FB_SYMBATTRIB_NOTHISCONSTNESS = &h80000000 '' PROCs only
  193 
  194     '' reuse - take care
  195     FB_SYMBATTRIB_INSTANCEPARAM = FB_SYMBATTRIB_METHOD '' PARAMs
  196     FB_SYMBATTRIB_SUFFIXED      = FB_SYMBATTRIB_NAKED
  197 end enum
  198 
  199 '' parameter modes
  200 enum FB_PARAMMODE
  201     FB_PARAMMODE_BYVAL          = 1             '' must start at 1! used for mangling
  202     FB_PARAMMODE_BYREF
  203     FB_PARAMMODE_BYDESC
  204     FB_PARAMMODE_VARARG
  205 end enum
  206 
  207 '' call conventions
  208 enum FB_FUNCMODE
  209     FB_FUNCMODE_STDCALL         = 1             '' ditto
  210     FB_FUNCMODE_STDCALL_MS                      '' ms/vb-style: don't include the @n suffix
  211     FB_FUNCMODE_CDECL
  212     FB_FUNCMODE_PASCAL
  213 
  214     '' Symbolic constant to represent FBCALL, telling cProcCallingConv()
  215     '' and the RTL procedure definitions to use env.target.fbcall which
  216     '' will be the real FB_FUNCMODE_* implementing FBCALL depending on the
  217     '' compilation target.
  218     FB_FUNCMODE_FBCALL = -1
  219 end enum
  220 
  221 '' options when adding new symbols
  222 enum FB_SYMBOPT
  223     FB_SYMBOPT_NONE             = &h00000000
  224 
  225     FB_SYMBOPT_PRESERVECASE     = &h00000001
  226     FB_SYMBOPT_UNSCOPE          = &h00000002
  227     FB_SYMBOPT_DECLARING        = &h00000004
  228     FB_SYMBOPT_MOVETOGLOB       = &h00000008
  229     FB_SYMBOPT_RTL              = &h00000010
  230     FB_SYMBOPT_DOHASH           = &h00000020
  231     FB_SYMBOPT_CREATEALIAS      = &h00000040
  232     FB_SYMBOPT_NODUPCHECK       = &h00000080
  233 end enum
  234 
  235 '' options when looking up symbols
  236 enum FB_SYMBLOOKUPOPT
  237     FB_SYMBLOOKUPOPT_NONE    = &h00000000
  238 
  239     FB_SYMBLOOKUPOPT_PROPGET = &h00000001
  240     FB_SYMBLOOKUPOPT_BOP_OVL = &h00000002
  241 end enum
  242 
  243 ''
  244 enum FB_MANGLING
  245     FB_MANGLING_BASIC
  246     FB_MANGLING_CDECL
  247     FB_MANGLING_STDCALL
  248     FB_MANGLING_STDCALL_MS
  249     FB_MANGLING_CPP
  250     FB_MANGLING_PASCAL
  251     FB_MANGLING_RTLIB
  252 end enum
  253 
  254 ''
  255 enum FB_MANGLEOPT
  256     FB_MANGLEOPT_NONE         = 0  '' no special options
  257     FB_MANGLEOPT_KEEPTOPCONST = 1  '' keep the top-level const when mangling
  258     FB_MANGLEOPT_HASPTR       = 2  '' mangled type has is a pointer type
  259     FB_MANGLEOPT_HASREF       = 4  '' mangled type has is reference type
  260 end enum
  261 
  262 type FBSYMBOL_ as FBSYMBOL
  263 
  264 #ifndef ASTNODE_
  265 type ASTNODE_ as ASTNODE
  266 #endif
  267 
  268 #ifndef EMIT_NODE_
  269 type EMIT_NODE_ as EMIT_NODE
  270 #endif
  271 
  272 ''
  273 type FBSYMLIST
  274     head            as FBSYMBOL_ ptr
  275     tail            as FBSYMBOL_ ptr
  276 end type
  277 
  278 type FBARRAYDIM
  279     lower           as longint
  280     upper           as longint
  281 end type
  282 
  283 '' Special value to represent the case where '...' ellipsis was given as ubound
  284 const FB_ARRAYDIM_UNKNOWN = &h8000000000000000ll
  285 
  286 ''
  287 type FBSYMCHAIN
  288     sym             as FBSYMBOL_ ptr            '' first symbol
  289     next            as FBSYMCHAIN ptr
  290     isimport        as integer
  291 
  292     '' all fields below are only set when importing (with USING) a ns
  293     prev            as FBSYMCHAIN ptr
  294     item            as HASHITEM ptr
  295     imp_next        as FBSYMCHAIN ptr
  296 end type
  297 
  298 ''
  299 type FBHASHTB
  300     owner           as FBSYMBOL_ ptr            '' back link
  301     tb              as THASH
  302     prev            as FBHASHTB ptr             '' prev node in the current hash tbs lookup list
  303     next            as FBHASHTB ptr             '' next  //
  304 end type
  305 
  306 type FBSYMHASH
  307     tb              as FBHASHTB ptr             '' parent's hash tb
  308     item            as HASHITEM ptr             '' hash item, for fast deletion
  309     index           as uinteger                 '' ditto
  310     prev            as FBSYMBOL_ ptr            '' prev duplicated symbol
  311     next            as FBSYMBOL_ ptr            '' next //
  312 end type
  313 
  314 ''
  315 type FBSYMBOLTB
  316     owner           as FBSYMBOL_ ptr            '' back link
  317     head            as FBSYMBOL_ ptr            '' first node
  318     tail            as FBSYMBOL_ ptr            '' last node
  319 end type
  320 
  321 ''
  322 type FBNAMESPC_EXT
  323     implist         as FBSYMLIST                '' all namespaces imported by this ns
  324     explist         as FBSYMLIST                '' all namespaces importing this ns
  325     cnt             as integer                  '' times this ns was imported/nested
  326     impsym_head     as FBSYMCHAIN ptr           '' imported symbols by the last USING
  327     impsym_tail     as FBSYMCHAIN ptr           '' /
  328 end type
  329 
  330 type FBNAMESPC
  331     symtb           as FBSYMBOLTB
  332     hashtb          as FBHASHTB
  333     ext             as FBNAMESPC_EXT ptr
  334 end type
  335 
  336 union FBVALUE
  337     s           as FBSYMBOL_ ptr
  338     i           as longint
  339     f           as double
  340 end union
  341 
  342 '' keyword
  343 type FBS_KEYWORD
  344     id              as integer
  345     tkclass         as FB_TKCLASS
  346 end type
  347 
  348 '' define or macro
  349 type FB_DEFPARAM
  350     name            as zstring ptr
  351     num             as integer
  352     next            as FB_DEFPARAM ptr
  353 end type
  354 
  355 enum FB_DEFTOK_TYPE
  356     FB_DEFTOK_TYPE_PARAM
  357     FB_DEFTOK_TYPE_PARAMSTR
  358     FB_DEFTOK_TYPE_TEX
  359     FB_DEFTOK_TYPE_TEXW
  360 end enum
  361 
  362 type FB_DEFTOK
  363     type            as FB_DEFTOK_TYPE
  364 
  365     union
  366         text        as zstring ptr
  367         textw       as wstring ptr
  368         paramnum    as integer
  369     end union
  370 
  371     prev            as FB_DEFTOK ptr
  372     next            as FB_DEFTOK ptr
  373 end type
  374 
  375 enum FB_DEFINE_FLAGS
  376     FB_DEFINE_FLAGS_NONE        = &h00000000
  377     FB_DEFINE_FLAGS_STR     = &h00000001
  378     FB_DEFINE_FLAGS_NOGCC       = &h00000002
  379     FB_DEFINE_FLAGS_VARIADIC    = &h00000004
  380 end enum
  381 
  382 type FBS_DEFINE_PROC as function( ) as string
  383 
  384 type FBS_DEFINE
  385     params          as integer
  386     paramhead       as FB_DEFPARAM ptr
  387 
  388     union
  389         tokhead     as FB_DEFTOK ptr            '' only if args > 0
  390         text        as zstring ptr              '' //           = 0
  391         textw       as wstring ptr
  392     end union
  393 
  394     isargless       as integer
  395     flags           as FB_DEFINE_FLAGS          '' bit 0: 1=numeric, 0=string
  396     proc            as FBS_DEFINE_PROC
  397 end type
  398 
  399 '' forward definition
  400 type FBFWDREF
  401     ref             as FBSYMBOL_ ptr    '' The user that has to be backpatched
  402     prev            as FBFWDREF ptr
  403 end type
  404 
  405 type FBS_FWDREF
  406     tail            as FBFWDREF ptr     '' List of users of this fwdref
  407 end type
  408 
  409 '' label
  410 type FBS_LABEL
  411     parent          as FBSYMBOL_ ptr            '' parent block, not always a proc
  412     declared        as integer
  413     stmtnum         as integer                  '' can't use colnum as it's unreliable
  414 end type
  415 
  416 '' structure
  417 enum FB_UDTOPT
  418     FB_UDTOPT_ISUNION           = &h0001
  419     FB_UDTOPT_ISANON            = &h0002
  420     FB_UDTOPT_HASPTRFIELD       = &h0004
  421     FB_UDTOPT_HASCTORFIELD      = &h0008
  422     FB_UDTOPT_HASDTORFIELD      = &h0010
  423     FB_UDTOPT_HASRECBYVALPARAM  = &h0020
  424     FB_UDTOPT_HASRECBYVALRES    = &h0040
  425     FB_UDTOPT_HASGETPROPERTY    = &h0080
  426     FB_UDTOPT_HASSETPROPERTY    = &h0100
  427     FB_UDTOPT_HASIDXGETPROPERTY = &h0200
  428     FB_UDTOPT_HASIDXSETPROPERTY = &h0400
  429     FB_UDTOPT_HASKWDFIELD       = &h0800
  430     FB_UDTOPT_HASINITEDFIELD        = &h1000
  431     FB_UDTOPT_HASANONUNION          = &h2000
  432     FB_UDTOPT_HASSTATICVAR          = &h4000
  433     FB_UDTOPT_HASBITFIELD           = &h8000
  434     FB_UDTOPT_ISVALISTSTRUCT        = &h10000
  435     FB_UDTOPT_ISVALISTSTRUCTARRAY   = &h20000
  436     FB_UDTOPT_ISWSTRING             = &h40000
  437     FB_UDTOPT_ISZSTRING             = &h80000
  438 end enum
  439 
  440 type FB_STRUCT_DBG
  441     typenum         as integer
  442 end type
  443 
  444 type FB_STRUCTEXT
  445     ctorhead        as FBSYMBOL_ ptr            '' ctor head (first overload proc) or NULL
  446     defctor         as FBSYMBOL_ ptr            '' default ctor or NULL
  447     copyctor        as FBSYMBOL_ ptr            '' copy ctor or NULL
  448     copyctorconst       as FBSYMBOL_ ptr            '' copy ctor with CONST param or NULL
  449     dtor            as FBSYMBOL_ ptr            '' destructor or NULL
  450     copyletop       as FBSYMBOL_ ptr            '' copy LET overload proc or NULL
  451     copyletopconst      as FBSYMBOL_ ptr            '' copy LET overload proc with CONST param or NULL
  452     opovlTb(0 to AST_OP_SELFOPS-1) as FBSYMBOL_ ptr
  453     vtableelements      as integer              '' vtable elements counter
  454     vtable          as FBSYMBOL_ ptr            '' virtual-functions table struct
  455     rtti            as FBSYMBOL_ ptr            '' Run-Time Type Info struct
  456     abstractcount       as integer              '' ABSTRACT method counter (to determine abstract classes, which aren't allowed to be instantiated)
  457 end type
  458 
  459 type FBS_STRUCT
  460     '' extends FBNAMESCP
  461     ns              as FBNAMESPC
  462     
  463     base            as FBSYMBOL_ ptr            '' base class
  464     anonparent      as FBSYMBOL_ ptr
  465     natalign        as integer                  '' UDT's natural alignment based on largest natural field alignment
  466     unpadlgt        as longint                  '' unpadded len
  467     options         as long                     '' FB_UDTOPT
  468     bitpos          as ubyte
  469     align           as ubyte
  470 
  471     '' real type used to return this UDT from functions
  472     retdtype        as FB_DATATYPE
  473 
  474     dbg             as FB_STRUCT_DBG
  475     ext             as FB_STRUCTEXT ptr
  476 end type
  477 
  478 '' enumeration
  479 type FBS_ENUM
  480     '' extends FBNAMESPC
  481     ns              as FBNAMESPC
  482 
  483     elements        as integer
  484     dbg             as FB_STRUCT_DBG
  485 end type
  486 
  487 type FB_CALL_ARG                                '' used by overloaded function calls
  488     expr            as ASTNODE_ ptr
  489     mode            as FB_PARAMMODE
  490     next            as FB_CALL_ARG ptr
  491 end type
  492 
  493 type FB_CALL_ARG_LIST
  494     args            as integer
  495     head            as FB_CALL_ARG ptr
  496     tail            as FB_CALL_ARG ptr
  497 end type
  498 
  499 '' function param
  500 type FBS_PARAM
  501     mode            as FB_PARAMMODE
  502     var             as FBSYMBOL_ ptr            '' link to decl var in func bodies
  503     optexpr         as ASTNODE_ ptr             '' default value
  504     bydescdimensions    as integer
  505     bydescrealsubtype   as FBSYMBOL_ ptr  '' bydesc array descriptor type
  506 end type
  507 
  508 '' function
  509 type FBRTLCALLBACK as function( byval sym as FBSYMBOL_ ptr ) as integer
  510 
  511 type FB_PROCOVL
  512     minparams       as short
  513     maxparams       as short
  514     next            as FBSYMBOL_ ptr
  515 end type
  516 
  517 '' used by x86 ASM emitter only
  518 type FB_PROCSTK
  519     argofs          as integer
  520     localofs        as integer
  521     localmax        as integer
  522 end type
  523 
  524 type FB_PROCDBG
  525     iniline         as integer                  '' sub|function
  526     endline         as integer                  '' end sub|function
  527     incfile         as zstring ptr
  528 end type
  529 
  530 type FB_PROCERR
  531     lasthnd         as FBSYMBOL_ ptr            '' last error handler
  532     lastmod         as FBSYMBOL_ ptr            '' last module name
  533     lastfun         as FBSYMBOL_ ptr            '' last function name
  534 end type
  535 
  536 type FB_PROCOPOVL
  537     op              as AST_OP
  538 end type
  539 
  540 type FB_DTORWRAPPER
  541     proc            as FBSYMBOL_ ptr
  542     sym             as FBSYMBOL_ ptr            '' for symbol
  543 end type
  544 
  545 enum FB_PROCSTATS
  546     FB_PROCSTATS_RETURNUSED     = &h0001
  547     FB_PROCSTATS_ASSIGNUSED     = &h0002
  548     FB_PROCSTATS_GOSUBUSED      = &h0004
  549 end enum
  550 
  551 type FB_PROCGSB
  552     ctx             as FBSYMBOL_ ptr            '' local pointer for gosub stack
  553 end type
  554 
  555 type FB_PROCEXT
  556     res             as FBSYMBOL_ ptr            '' result, if any
  557     stk             as FB_PROCSTK               '' to keep track of the stack frame
  558     dbg             as FB_PROCDBG               '' debugging
  559     err             as FB_PROCERR
  560     opovl           as FB_PROCOPOVL
  561     statdtor        as TLIST ptr                '' list of static instances with dtors
  562     stats           as FB_PROCSTATS
  563     stmtnum         as integer
  564     priority        as integer
  565     gosub           as FB_PROCGSB
  566     base_initree        as ASTNODE_ ptr  '' base() ctorcall/initializer given in constructor bodies
  567 
  568     '' virtual methods:
  569     ''    vtable array index, location of the procptr in the vtbl
  570     '' methods that override a virtual method:
  571     ''    vtable index of the virtual method that's overridden by this one
  572     '' other methods:
  573     ''    0
  574     '' A valid index must be >= 2 since the first two vtable elements are
  575     '' the null pointer and the rtti pointer.
  576     vtableindex     as integer
  577 
  578     '' For methods that override a virtual method: the method that's
  579     '' overridden (if any); or else NULL.
  580     overridden      as FBSYMBOL_ ptr
  581 end type
  582 
  583 type FB_PROCRTL
  584     callback        as FBRTLCALLBACK
  585 end type
  586 
  587 enum FB_PROC_RETURN_METHOD
  588     FB_RETURN_FPU
  589     FB_RETURN_SSE
  590     FB_RETURN_DEFAULT           '' if none specified, take from the proto
  591 end enum
  592 
  593 
  594 type FBS_PROC
  595     symtb           as FBSYMBOLTB               '' local symbols table
  596     params          as short
  597     optparams       as short                    '' number of optional/default params
  598     paramtb         as FBSYMBOLTB               '' parameters symbol tb
  599     mode            as FB_FUNCMODE              '' calling convention
  600 
  601     '' result type remapped to what it will be emitted as, including CONSTs
  602     realdtype       as FB_DATATYPE
  603     realsubtype     as FBSYMBOL_ ptr
  604 
  605     returnMethod    as FB_PROC_RETURN_METHOD
  606     rtl             as FB_PROCRTL
  607     ovl             as FB_PROCOVL               '' overloading
  608     ext             as FB_PROCEXT ptr           '' extra fields, not used with prototypes
  609 end type
  610 
  611 '' scope
  612 type FB_SCOPEDBG
  613     iniline         as integer                  '' scope
  614     endline         as integer                  '' end scope
  615     inilabel        as FBSYMBOL_ ptr
  616     endlabel        as FBSYMBOL_ ptr
  617 end type
  618 
  619 '' used by x86 ASM emitter only
  620 type FB_SCOPEEMIT
  621     baseofs         as integer
  622 end type
  623 
  624 type FBS_SCOPE
  625     backnode        as ASTNODE_ ptr
  626     symtb           as FBSYMBOLTB
  627     dbg             as FB_SCOPEDBG
  628     emit            as FB_SCOPEEMIT
  629 end type
  630 
  631 '' variable
  632 type FBS_ARRAY
  633     '' 0 = none (not an array),
  634     '' -1 = () = not yet known (should be filled in ASAP),
  635     '' 1..n = known dimensions (fixed-size or dynamic arrays)
  636     dimensions      as integer
  637 
  638     '' Dynamically allocated array of dimension bounds (static arrays only)
  639     dimtb           as FBARRAYDIM ptr
  640 
  641     diff            as longint
  642     elements        as longint
  643     desc            as FBSYMBOL_ ptr
  644 
  645     '' Array descriptor type (useful especially for BYDESC param vars, which
  646     '' don't have a descriptor var associated, but still need to know the
  647     '' exact descriptor type sometimes)
  648     desctype        as FBSYMBOL_ ptr
  649 end type
  650 
  651 type FBVAR_DESC
  652     array           as FBSYMBOL_ ptr            '' back-link
  653 end type
  654 
  655 type FBVAR_DATA
  656     prev            as FBSYMBOL_ ptr
  657 end type
  658 
  659 type FBS_VAR
  660     union
  661         littext     as zstring ptr
  662         littextw    as wstring ptr
  663         initree     as ASTNODE_ ptr
  664     end union
  665     array           as FBS_ARRAY
  666     desc            as FBVAR_DESC
  667     stmtnum         as integer                  '' can't use colnum as it's unreliable
  668     align           as integer                  '' 0 = use default alignment
  669     data            as FBVAR_DATA               '' used with DATA stmts
  670     bitpos          as integer  '' bitfields only: bit offset in container field
  671     bits            as integer  '' bitfields only: size in bits
  672 end type
  673 
  674 '' namespace
  675 type FBS_NAMESPACE
  676     '' extends FBNAMESPC
  677     ns              as FBNAMESPC
  678 
  679     cnt             as integer                  '' times this ns was re-opened
  680     last_tail       as FBSYMBOL_ ptr            '' point to last tail
  681 end type
  682 
  683 '' namespace import (USING)
  684 type FBS_NSIMPORT
  685     '' imported ns (src)
  686     imp_ns          as FBSYMBOL_ ptr
  687     imp_prev        as FBSYMBOL_ ptr
  688     imp_next        as FBSYMBOL_ ptr
  689     '' exported ns (dst)
  690     exp_ns          as FBSYMBOL_ ptr
  691     exp_prev        as FBSYMBOL_ ptr
  692     exp_next        as FBSYMBOL_ ptr
  693 end type
  694 
  695 ''
  696 type FB_SYMBID
  697     name            as zstring ptr              '' upper-cased name, shared by hash tb
  698     alias           as zstring ptr              '' alias/preserved (if EXTERN was used) name
  699     mangled         as zstring ptr              '' mangled name
  700 end type
  701 
  702 ''
  703 type FBSYMBOL
  704     class           as FB_SYMBCLASS
  705     attrib          as FB_SYMBATTRIB
  706     stats           as FB_SYMBSTATS
  707 
  708     id              as FB_SYMBID
  709 
  710     typ             as FB_DATATYPE
  711     subtype         as FBSYMBOL ptr
  712 
  713     scope           as ushort
  714     mangling        as short                    '' FB_MANGLING
  715 
  716     lgt         as longint
  717     ofs         as longint                  '' for local vars, args, UDT's and fields
  718 
  719     union
  720         var_        as FBS_VAR
  721         val         as FBVALUE  '' constants
  722         udt         as FBS_STRUCT
  723         enum_       as FBS_ENUM
  724         proc        as FBS_PROC
  725         param       as FBS_PARAM
  726         lbl         as FBS_LABEL
  727         def         as FBS_DEFINE
  728         key         as FBS_KEYWORD
  729         fwd         as FBS_FWDREF
  730         scp         as FBS_SCOPE
  731         nspc        as FBS_NAMESPACE
  732         nsimp       as FBS_NSIMPORT
  733     end union
  734 
  735     hash            as FBSYMHASH                '' hash tb (namespace) it's part of
  736 
  737     symtb           as FBSYMBOLTB ptr           '' symbol tb it's part of
  738 
  739     parent          as FBSYMBOL Ptr
  740     
  741     prev            as FBSYMBOL ptr             '' next in symbol tb list
  742     next            as FBSYMBOL ptr             '' prev /
  743 end type
  744 
  745 type FBHASHTBLIST
  746     head            as FBHASHTB ptr
  747     tail            as FBHASHTB ptr
  748 end type
  749 
  750 type SYMB_DEF_PARAM
  751     item            as HASHITEM ptr
  752     index           as uinteger
  753 end type
  754 
  755 type SYMB_DEF_CTX
  756     paramlist       as TLIST                    '' define parameters
  757     toklist         as TLIST                    '' define tokens
  758 
  759     '' macros only..
  760     param           as integer                  '' param count
  761     paramhash       as THASH
  762     hash(0 to FB_MAXDEFINEARGS-1) as SYMB_DEF_PARAM
  763 end type
  764 
  765 type SYMB_OVLOP
  766     head            as FBSYMBOL ptr             '' head proc
  767 end type
  768 
  769 type FB_GLOBCTORLIST_ITEM
  770     sym             as FBSYMBOL ptr
  771     next            as FB_GLOBCTORLIST_ITEM ptr
  772 end type
  773 
  774 type FB_GLOBCTORLIST
  775     head            as FB_GLOBCTORLIST_ITEM ptr
  776     tail            as FB_GLOBCTORLIST_ITEM ptr
  777     list            as TLIST
  778 end type
  779 
  780 type FB_RTTICTX
  781     fb_rtti         as FBSYMBOL ptr
  782     fb_object       as FBSYMBOL ptr
  783 End Type
  784 
  785 const CHAINPOOL_SIZE = 1 shl 12
  786 
  787 type SYMBCTX
  788     inited          as integer
  789 
  790     symlist         as TLIST                    '' (of FBSYMBOL)
  791     hashlist        as FBHASHTBLIST
  792 
  793     '' FBSYMCHAIN's are allocated from this buffer
  794     chainpool(0 to (CHAINPOOL_SIZE - 1)) as FBSYMCHAIN
  795     chainpoolhead       as integer
  796 
  797     globnspc        as FBSYMBOL                 '' global namespace
  798 
  799     namespc         as FBSYMBOL ptr             '' current ns
  800     hashtb          as FBHASHTB ptr             '' current hash tb
  801     symtb           as FBSYMBOLTB ptr           '' current symbol tb
  802 
  803     neststk         as TSTACK                   '' nest stack (namespace/class nesting)
  804     imphashtb       as THASH                    '' imported symbol (USING) tb
  805     imphashlist     as TLIST                    '' (of FBSYMHASH)
  806 
  807     namepool        as TPOOL
  808 
  809     fwdlist         as TLIST                    '' forward typedef refs
  810 
  811     nsextlist       as TLIST                    '' of FBNAMESPC_EXT
  812 
  813     fwdrefcnt       as integer
  814 
  815     def             as SYMB_DEF_CTX             '' #define context
  816 
  817     lastlbl         as FBSYMBOL ptr
  818 
  819     globctorlist    as FB_GLOBCTORLIST          '' global ctors list
  820     globdtorlist    as FB_GLOBCTORLIST          '' global dtors list
  821 
  822     globOpOvlTb ( _
  823                     0 to AST_OPCODES-1 _
  824                 )   as SYMB_OVLOP               '' global operator overloading
  825 
  826     fbarray_data        as integer          '' offsetof( FBARRAY, data )
  827     fbarray_ptr     as integer          '' offsetof( FBARRAY, ptr )
  828     fbarray_size        as integer          '' offsetof( FBARRAY, size )
  829     fbarray_dimtb       as integer          '' offsetof( FBARRAY, dimTB )
  830     fbarraydim      as FBSYMBOL ptr         '' FBARRAYDIM (dimTB element structure)
  831     fbarraydim_lbound   as integer          '' offsetof( FBARRAYDIM, lbound )
  832     fbarraydim_ubound   as integer          '' offsetof( FBARRAYDIM, ubound )
  833 
  834     rtti            as FB_RTTICTX 
  835 end type
  836 
  837 type SYMB_DATATYPE
  838     class           as FB_DATACLASS             '' INTEGER, FPOINT
  839     size            as integer                  '' in bytes
  840     signed          as integer                  '' TRUE or FALSE
  841 
  842     '' For basic integer types only: ranking value, to establish a proper
  843     '' target-specific (32bit/64bit) order (the FB_DATATYPE enum order is
  844     '' not enough because it's not target-specific)
  845     intrank         as integer
  846 
  847     remaptype       as FB_DATATYPE              '' remapped type for ENUM, POINTER, etc
  848     sizetype        as integer      '' FB_SIZETYPE_*
  849     name            as const zstring ptr
  850 end type
  851 
  852 '' Data passed from symbUdtDeclareDefaultMembers() to symbUdtImplementDefaultMembers()
  853 type SYMBDEFAULTMEMBERS
  854     defctor     as FBSYMBOL ptr
  855     dtor        as FBSYMBOL ptr
  856     copyctor    as FBSYMBOL ptr
  857     copyctorconst   as FBSYMBOL ptr
  858     copyletopconst  as FBSYMBOL ptr
  859 end type
  860 
  861 #include once "ast.bi"
  862 
  863 declare sub symbInit _
  864     ( _
  865         byval ismain as integer _
  866     )
  867 
  868 declare sub symbEnd _
  869     ( _
  870         _
  871     )
  872 
  873 declare sub symbDataInit( )
  874 
  875 declare function symbLookup _
  876     ( _
  877         byval id as zstring ptr, _
  878         byref tk as FB_TOKEN, _
  879         byref tk_class as FB_TKCLASS _
  880     ) as FBSYMCHAIN ptr
  881 
  882 declare function symbLookupAt _
  883     ( _
  884         byval ns as FBSYMBOL ptr, _
  885         byval id as const zstring ptr, _
  886         byval preserve_case as integer = FALSE, _
  887         byval search_imports as integer = TRUE _
  888     ) as FBSYMCHAIN ptr
  889 
  890 declare function symbFindByClass _
  891     ( _
  892         byval chain as FBSYMCHAIN ptr, _
  893         byval class as integer _
  894     ) as FBSYMBOL ptr
  895 
  896 declare function symbFindVarBySuffix _
  897     ( _
  898         byval chain as FBSYMCHAIN ptr, _
  899         byval suffix as integer _
  900     ) as FBSYMBOL ptr
  901 
  902 declare function symbFindVarByDefType _
  903     ( _
  904         byval chain as FBSYMCHAIN ptr, _
  905         byval dtype as integer _
  906     ) as FBSYMBOL ptr
  907 
  908 declare function symbFindByClassAndType _
  909     ( _
  910         byval chain_ as FBSYMCHAIN ptr, _
  911         byval symclass as integer, _
  912         byval dtype as integer _
  913     ) as FBSYMBOL ptr
  914 
  915 declare function symbLookupByNameAndClass _
  916     ( _
  917         byval ns as FBSYMBOL ptr, _
  918         byval symbol as const zstring ptr, _
  919         byval class as integer, _
  920         byval preservecase as integer = FALSE, _
  921         byval search_imports as integer = TRUE _
  922     ) as FBSYMBOL ptr
  923 
  924 declare function symbFindOverloadProc _
  925     ( _
  926         byval parent as FBSYMBOL ptr, _
  927         byval proc as FBSYMBOL ptr, _
  928         byval options as FB_SYMBLOOKUPOPT = FB_SYMBLOOKUPOPT_NONE _
  929     ) as FBSYMBOL ptr
  930 
  931 declare function symbFindOpOvlProc _
  932     ( _
  933         byval op as AST_OP, _
  934         byval parent as FBSYMBOL ptr, _
  935         byval proc as FBSYMBOL ptr _
  936     ) as FBSYMBOL ptr
  937 
  938 declare function symbFindClosestOvlProc _
  939     ( _
  940         byval proc as FBSYMBOL ptr, _
  941         byval params as integer, _
  942         byval arg_head as FB_CALL_ARG ptr, _
  943         byval err_num as FB_ERRMSG ptr, _
  944         byval options as FB_SYMBLOOKUPOPT = FB_SYMBLOOKUPOPT_NONE _
  945     ) as FBSYMBOL ptr
  946 
  947 declare function symbFindBopOvlProc _
  948     ( _
  949         byval op as AST_OP, _
  950         byval l as ASTNODE ptr, _
  951         byval r as ASTNODE ptr, _
  952         byval err_num as FB_ERRMSG ptr _
  953     ) as FBSYMBOL ptr
  954 
  955 declare function symbFindSelfBopOvlProc _
  956     ( _
  957         byval op as AST_OP, _
  958         byval l as ASTNODE ptr, _
  959         byval r as ASTNODE ptr, _
  960         byval err_num as FB_ERRMSG ptr _
  961     ) as FBSYMBOL ptr
  962 
  963 declare function symbFindUopOvlProc _
  964     ( _
  965         byval op as AST_OP, _
  966         byval l as ASTNODE ptr, _
  967         byval err_num as FB_ERRMSG ptr _
  968     ) as FBSYMBOL ptr
  969 
  970 declare function symbFindSelfUopOvlProc _
  971     ( _
  972         byval op as AST_OP, _
  973         byval l as ASTNODE ptr, _
  974         byval err_num as FB_ERRMSG ptr _
  975     ) as FBSYMBOL ptr
  976 
  977 declare function symbFindCastOvlProc _
  978     ( _
  979         byval to_dtype as integer, _
  980         byval to_subtype as FBSYMBOL ptr, _
  981         byval expr as ASTNODE ptr, _
  982         byval err_num as FB_ERRMSG ptr, _
  983         byval is_explicit as integer = FALSE _
  984     ) as FBSYMBOL ptr
  985 
  986 declare function symbFindCtorOvlProc _
  987     ( _
  988         byval sym as FBSYMBOL ptr, _
  989         byval expr as ASTNODE ptr, _
  990         byval arg_mode as FB_PARAMMODE, _
  991         byval err_num as FB_ERRMSG ptr _
  992     ) as FBSYMBOL ptr
  993 
  994 declare function symbFindCtorProc _
  995     ( _
  996         byval head_proc as FBSYMBOL ptr, _
  997         byval proc as FBSYMBOL ptr _
  998     ) as FBSYMBOL ptr
  999 
 1000 declare function symbCalcProcMatch _
 1001     ( _
 1002         byval l as FBSYMBOL ptr, _
 1003         byval r as FBSYMBOL ptr, _
 1004         byref errmsg as integer _
 1005     ) as FB_OVLPROC_MATCH_SCORE
 1006 
 1007 declare sub symbProcCheckOverridden _
 1008     ( _
 1009         byval proc as FBSYMBOL ptr, _
 1010         byval is_implicit as integer _
 1011     )
 1012 declare sub symbProcSetVtableIndex( byval proc as FBSYMBOL ptr, byval i as integer )
 1013 declare function symbProcGetVtableIndex( byval proc as FBSYMBOL ptr ) as integer
 1014 declare function symbProcGetOverridden( byval proc as FBSYMBOL ptr ) as FBSYMBOL ptr
 1015 declare function symbGetProcResult( byval proc as FBSYMBOL ptr ) as FBSYMBOL ptr
 1016 declare function symbProcHasFwdRefInSignature( byval proc as FBSYMBOL ptr ) as integer
 1017 
 1018 declare function symbAreProcModesEqual _
 1019     ( _
 1020         byval proca as FBSYMBOL ptr, _
 1021         byval procb as FBSYMBOL ptr _
 1022     ) as integer
 1023 
 1024 declare function symbAddKeyword _
 1025     ( _
 1026         byval symbol as const zstring ptr, _
 1027         byval id as integer, _
 1028         byval class as integer, _
 1029         byval hashtb as FBHASHTB ptr = NULL, _
 1030         byval dtype as integer = FB_DATATYPE_INVALID, _
 1031         byval attrib as FB_SYMBATTRIB = FB_SYMBATTRIB_NONE _
 1032     ) as FBSYMBOL ptr
 1033 
 1034 declare function symbKeywordGetText( byval tk as integer ) as const zstring ptr
 1035 
 1036 declare function symbAddDefine _
 1037     ( _
 1038         byval symbol as const zstring ptr, _
 1039         byval text as zstring ptr, _
 1040         byval lgt as integer, _
 1041         byval isargless as integer = FALSE, _
 1042         byval proc as FBS_DEFINE_PROC = NULL, _
 1043         byval flags as FB_DEFINE_FLAGS = FB_DEFINE_FLAGS_NONE _
 1044     ) as FBSYMBOL ptr
 1045 
 1046 declare function symbAddDefineW _
 1047     ( _
 1048         byval symbol as zstring ptr, _
 1049         byval text as wstring ptr, _
 1050         byval lgt as integer, _
 1051         byval isargless as integer = FALSE, _
 1052         byval proc as FBS_DEFINE_PROC = NULL, _
 1053         byval flags as FB_DEFINE_FLAGS = FB_DEFINE_FLAGS_NONE _
 1054     ) as FBSYMBOL ptr
 1055 
 1056 declare function symbAddDefineMacro _
 1057     ( _
 1058         byval symbol as const zstring ptr, _
 1059         byval tokhead as FB_DEFTOK ptr, _
 1060         byval params as integer, _
 1061         byval paramhead as FB_DEFPARAM ptr, _
 1062         byval flags as FB_DEFINE_FLAGS = FB_DEFINE_FLAGS_NONE _
 1063     ) as FBSYMBOL ptr
 1064 
 1065 declare function symbAddDefineParam _
 1066     ( _
 1067         byval lastparam as FB_DEFPARAM ptr, _
 1068         byval symbol as const zstring ptr _
 1069     ) as FB_DEFPARAM ptr
 1070 
 1071 declare function symbAddDefineTok _
 1072     ( _
 1073         byval lasttok as FB_DEFTOK ptr, _
 1074         byval dtype as FB_DEFTOK_TYPE _
 1075     ) as FB_DEFTOK ptr
 1076 
 1077 declare function symbDelDefineTok _
 1078     ( _
 1079         byval tok as FB_DEFTOK ptr _
 1080     ) as FB_DEFTOK ptr
 1081 
 1082 declare function symbAddFwdRef _
 1083     ( _
 1084         byval id as zstring ptr _
 1085     ) as FBSYMBOL ptr
 1086 
 1087 declare function symbAddTypedef _
 1088     ( _
 1089         byval id as zstring ptr, _
 1090         byval dtype as integer, _
 1091         byval subtype as FBSYMBOL ptr, _
 1092         byval lgt as longint _
 1093     ) as FBSYMBOL ptr
 1094 
 1095 declare function symbAddLabel _
 1096     ( _
 1097         byval symbol as zstring ptr, _
 1098         byval options as FB_SYMBOPT = FB_SYMBOPT_DECLARING _
 1099     ) as FBSYMBOL ptr
 1100 
 1101 declare sub symbGetDescTypeArrayDtype _
 1102     ( _
 1103         byval desctype as FBSYMBOL ptr, _
 1104         byref arraydtype as integer, _
 1105         byref arraysubtype as FBSYMBOL ptr _
 1106     )
 1107 declare function symbGetDescTypeDimensions( byval desctype as FBSYMBOL ptr ) as integer
 1108 
 1109 declare function symbAddArrayDescriptorType _
 1110     ( _
 1111         byval dimensions as integer, _
 1112         byval arraydtype as integer, _
 1113         byval arraysubtype as FBSYMBOL ptr _
 1114     ) as FBSYMBOL ptr
 1115 
 1116 declare sub symbSetFixedSizeArrayDimensionElements _
 1117     ( _
 1118         byval sym as FBSYMBOL ptr, _
 1119         byval dimension as integer, _
 1120         byval elements as longint _
 1121     )
 1122 
 1123 declare sub symbCheckDynamicArrayDimensions _
 1124     ( _
 1125         byval sym as FBSYMBOL ptr, _
 1126         byval dimensions as integer _
 1127     )
 1128 
 1129 declare sub symbVarInitFields( byval sym as FBSYMBOL ptr )
 1130 
 1131 declare sub symbVarInitArrayDimensions _
 1132     ( _
 1133         byval sym as FBSYMBOL ptr, _
 1134         byval dimensions as integer, _
 1135         dTB() as FBARRAYDIM _
 1136     )
 1137 
 1138 declare function symbAddVar _
 1139     ( _
 1140         byval symbol as const zstring ptr, _
 1141         byval aliasname as const zstring ptr, _
 1142         byval dtype as integer, _
 1143         byval subtype as FBSYMBOL ptr, _
 1144         byval lgt as longint, _
 1145         byval dimensions as integer, _
 1146         dTB() as FBARRAYDIM, _
 1147         byval attrib as integer, _
 1148         byval options as FB_SYMBOPT = FB_SYMBOPT_NONE _
 1149     ) as FBSYMBOL ptr
 1150 
 1151 declare function symbAddTempVar _
 1152     ( _
 1153         byval dtype as integer, _
 1154         byval subtype as FBSYMBOL ptr = NULL _
 1155     ) as FBSYMBOL ptr
 1156 
 1157 declare function symbAddImplicitVar _
 1158     ( _
 1159         byval dtype as integer, _
 1160         byval subtype as FBSYMBOL ptr = NULL, _
 1161         byval options as integer = 0 _
 1162     ) as FBSYMBOL ptr
 1163 
 1164 declare function symbAddAndAllocateTempVar( byval dtype as integer ) as FBSYMBOL ptr
 1165 declare function symbAddArrayDesc( byval array as FBSYMBOL ptr ) as FBSYMBOL ptr
 1166 
 1167 declare function symbAddConst _
 1168     ( _
 1169         byval id as zstring ptr, _
 1170         byval dtype as integer, _
 1171         byval subtype as FBSYMBOL ptr, _
 1172         byval value as FBVALUE ptr, _
 1173         byval attrib as integer = FB_SYMBATTRIB_NONE _
 1174     ) as FBSYMBOL ptr
 1175 
 1176 declare function symbReuseOrAddConst _
 1177     ( _
 1178         byval id as zstring ptr, _
 1179         byval dtype as integer, _
 1180         byval subtype as FBSYMBOL ptr, _
 1181         byval value as FBVALUE ptr, _
 1182         byval attrib as integer _
 1183     ) as FBSYMBOL ptr
 1184 
 1185 declare function symbGetConstValueAsStr( byval s as FBSYMBOL ptr ) as string
 1186 
 1187 declare function symbStructBegin _
 1188     ( _
 1189         byval symtb as FBSYMBOLTB ptr, _
 1190         byval hashtb as FBHASHTB ptr, _
 1191         byval parent as FBSYMBOL ptr, _
 1192         byval id as const zstring ptr, _
 1193         byval id_alias as const zstring ptr, _
 1194         byval isunion as integer, _
 1195         byval align as integer, _
 1196         byval is_derived as integer, _
 1197         byval attrib as integer, _
 1198         byval options as integer _
 1199     ) as FBSYMBOL ptr
 1200 
 1201 declare sub symbStructAddBase( byval struct as FBSYMBOL ptr, byval base_ as FBSYMBOL ptr )
 1202 
 1203 declare function typeCalcNaturalAlign _
 1204     ( _
 1205         byval dtype as integer, _
 1206         byval subtype as FBSYMBOL ptr _
 1207     ) as integer
 1208 
 1209 declare function symbAddField _
 1210     ( _
 1211         byval parent as FBSYMBOL ptr, _
 1212         byval id as zstring ptr, _
 1213         byval dimensions as integer, _
 1214         dTB() as FBARRAYDIM, _
 1215         byval dtype as integer, _
 1216         byval subtype as FBSYMBOL ptr, _
 1217         byval lgt as longint, _
 1218         byval bits as integer, _
 1219         byval attrib as integer _
 1220     ) as FBSYMBOL ptr
 1221 
 1222 declare sub symbInsertInnerUDT _
 1223     ( _
 1224         byval parent as FBSYMBOL ptr, _
 1225         byval inner as FBSYMBOL ptr _
 1226     )
 1227 
 1228 declare sub symbStructEnd _
 1229     ( _
 1230         byval t as FBSYMBOL ptr, _
 1231         byval isnested as integer = FALSE _ 
 1232     )
 1233 
 1234 declare function symbAddEnum _
 1235     ( _
 1236         byval id as zstring ptr, _
 1237         byval id_alias as zstring ptr, _
 1238         byval attrib as integer, _
 1239         byval use_hashtb as integer _
 1240     ) as FBSYMBOL ptr
 1241 
 1242 declare function symbAddEnumElement _
 1243     ( _
 1244         byval parent as FBSYMBOL ptr, _
 1245         byval id as zstring ptr, _
 1246         byval value as longint, _
 1247         byval attrib as integer _
 1248     ) as FBSYMBOL ptr
 1249 
 1250 declare function symbAddProcParam _
 1251     ( _
 1252         byval proc as FBSYMBOL ptr, _
 1253         byval id as zstring ptr, _
 1254         byval dtype as integer, _
 1255         byval subtype as FBSYMBOL ptr, _
 1256         byval dimensions as integer, _
 1257         byval mode as integer, _
 1258         byval attrib as FB_SYMBATTRIB _
 1259     ) as FBSYMBOL ptr
 1260 
 1261 declare sub symbMakeParamOptional _
 1262     ( _
 1263         byval proc as FBSYMBOL ptr, _
 1264         byval param as FBSYMBOL ptr, _
 1265         byval optexpr as ASTNODE ptr _
 1266     )
 1267 
 1268 declare function symbAddProc _
 1269     ( _
 1270         byval proc as FBSYMBOL ptr, _
 1271         byval id as const zstring ptr, _
 1272         byval id_alias as const zstring ptr, _
 1273         byval dtype as integer, _
 1274         byval subtype as FBSYMBOL ptr, _
 1275         byval attrib as integer, _
 1276         byval mode as integer, _
 1277         byval options as FB_SYMBOPT _
 1278     ) as FBSYMBOL ptr
 1279 
 1280 declare function symbAddOperator _
 1281     ( _
 1282         byval proc as FBSYMBOL ptr, _
 1283         byval op as AST_OP, _
 1284         byval id_alias as zstring ptr, _
 1285         byval dtype as integer, _
 1286         byval subtype as FBSYMBOL ptr, _
 1287         byval attrib as integer, _
 1288         byval mode as integer, _
 1289         byval options as FB_SYMBOPT = FB_SYMBOPT_NONE _
 1290     ) as FBSYMBOL ptr
 1291 
 1292 declare function symbAddCtor _
 1293     ( _
 1294         byval proc as FBSYMBOL ptr, _
 1295         byval id_alias as zstring ptr, _
 1296         byval attrib as integer, _
 1297         byval mode as integer, _
 1298         byval options as FB_SYMBOPT = FB_SYMBOPT_NONE _
 1299     ) as FBSYMBOL ptr
 1300 
 1301 declare function symbLookupInternallyMangledSubtype _
 1302     ( _
 1303         byval id as zstring ptr, _
 1304         byref attrib as integer, _
 1305         byref parent as FBSYMBOL ptr, _
 1306         byref symtb as FBSYMBOLTB ptr, _
 1307         byref hashtb as FBHASHTB ptr _
 1308     ) as FBSYMBOL ptr
 1309 
 1310 declare function symbAddProcPtr _
 1311     ( _
 1312         byval proc as FBSYMBOL ptr, _
 1313         byval dtype as integer, _
 1314         byval subtype as FBSYMBOL ptr, _
 1315         byval attrib as integer, _
 1316         byval mode as integer _
 1317     ) as FBSYMBOL ptr
 1318 
 1319 declare function symbAddProcPtrFromFunction _
 1320     ( _
 1321         byval base_proc as FBSYMBOL ptr _
 1322     ) as FBSYMBOL ptr
 1323 
 1324 declare function symbPreAddProc _
 1325     ( _
 1326         byval symbol as zstring ptr _
 1327     ) as FBSYMBOL ptr
 1328 
 1329 declare sub symbGetRealParamDtype overload _
 1330     ( _
 1331         byval parammode as integer, _
 1332         byval bydescrealsubtype as FBSYMBOL ptr, _
 1333         byref dtype as integer, _
 1334         byref subtype as FBSYMBOL ptr _
 1335     )
 1336 
 1337 declare sub symbGetRealParamDtype overload _
 1338     ( _
 1339         byval param as FBSYMBOL ptr, _
 1340         byref dtype as integer, _
 1341         byref subtype as FBSYMBOL ptr _
 1342     )
 1343 
 1344 declare function symbAddVarForParam( byval param as FBSYMBOL ptr ) as FBSYMBOL ptr
 1345 declare function symbAddVarForProcResultParam( byval proc as FBSYMBOL ptr ) as FBSYMBOL ptr
 1346 declare function symbAddProcResultVar( byval f as FBSYMBOL ptr ) as FBSYMBOL ptr
 1347 
 1348 declare sub symbAddProcInstanceParam _
 1349     ( _
 1350         byval parent as FBSYMBOL ptr, _
 1351         byval proc as FBSYMBOL ptr _
 1352     )
 1353 
 1354 declare sub symbProcAllocExt( byval proc as FBSYMBOL ptr )
 1355 declare sub symbProcFreeExt( byval proc as FBSYMBOL ptr )
 1356 declare function symbProcReturnsOnStack( byval proc as FBSYMBOL ptr ) as integer
 1357 
 1358 declare function symbCalcArgLen _
 1359     ( _
 1360         byval dtype as integer, _
 1361         byval subtype as FBSYMBOL ptr, _
 1362         byval mode as integer _
 1363     ) as longint
 1364 
 1365 declare function symbCalcParamLen _
 1366     ( _
 1367         byval dtype as integer, _
 1368         byval subtype as FBSYMBOL ptr, _
 1369         byval mode as FB_PARAMMODE _
 1370     ) as longint
 1371 
 1372 declare function symbProcCalcStdcallSuffixN( byval proc as FBSYMBOL ptr ) as longint
 1373 declare function symbProcCalcBytesToPop( byval proc as FBSYMBOL ptr ) as longint
 1374 
 1375 declare function symbAddScope _
 1376     ( _
 1377         byval backnode as ASTNODE ptr _
 1378     ) as FBSYMBOL ptr
 1379 
 1380 declare sub symbScopeTurnTempsIntoImplicits( byval scopesym as FBSYMBOL ptr )
 1381 
 1382 declare function symbAddNamespace _
 1383     ( _
 1384         byval id as zstring ptr, _
 1385         byval id_alias as zstring ptr _
 1386     ) as FBSYMBOL ptr
 1387 
 1388 declare sub symbAddToFwdRef _
 1389     ( _
 1390         byval f as FBSYMBOL ptr, _
 1391         byval ref as FBSYMBOL ptr _
 1392     )
 1393 
 1394 declare sub symbRemoveFromFwdRef _
 1395     ( _
 1396         byval f as FBSYMBOL ptr, _
 1397         byval ref as FBSYMBOL ptr _
 1398     )
 1399 
 1400 declare function symbArrayHasUnknownBounds( byval sym as FBSYMBOL ptr ) as integer
 1401 
 1402 declare sub symbSetArrayDimTb _
 1403     ( _
 1404         byval s as FBSYMBOL ptr, _
 1405         byval dimensions as integer, _
 1406         dTB() as FBARRAYDIM _
 1407     )
 1408 
 1409 declare sub symbMaybeAddArrayDesc( byval sym as FBSYMBOL ptr )
 1410 
 1411 declare sub symbDelSymbolTb _
 1412     ( _
 1413         byval tb as FBSYMBOLTB ptr, _
 1414         byval hashonly as integer _
 1415     )
 1416 
 1417 declare sub symbDelScopeTb _
 1418     ( _
 1419         byval scp as FBSYMBOL ptr _
 1420     )
 1421 
 1422 declare sub symbDelSymbol _
 1423     ( _
 1424         byval s as FBSYMBOL ptr, _
 1425         byval is_tbdel as integer = FALSE _
 1426     )
 1427 
 1428 declare function symbDelDefine _
 1429     ( _
 1430         byval s as FBSYMBOL ptr _
 1431     ) as integer
 1432 
 1433 declare sub symbDelLabel _
 1434     ( _
 1435         byval s as FBSYMBOL ptr _
 1436     )
 1437 
 1438 declare sub symbDelVar( byval s as FBSYMBOL ptr, byval is_tbdel as integer )
 1439 declare sub symbDelPrototype( byval s as FBSYMBOL ptr )
 1440 declare sub symbDelEnum( byval s as FBSYMBOL ptr )
 1441 declare sub symbDelStruct( byval s as FBSYMBOL ptr )
 1442 
 1443 declare sub symbDelConst _
 1444     ( _
 1445         byval s as FBSYMBOL ptr _
 1446     )
 1447 
 1448 declare sub symbDelScope _
 1449     ( _
 1450         byval scp as FBSYMBOL ptr _
 1451     )
 1452 
 1453 declare sub symbDelNamespaceMembers _
 1454     ( _
 1455         byval ns as FBSYMBOL ptr, _
 1456         byval delete_hashtb as integer _
 1457     )
 1458 
 1459 declare sub symbDelNamespace( byval ns as FBSYMBOL ptr )
 1460 
 1461 declare function symbNewSymbol _
 1462     ( _
 1463         byval options as FB_SYMBOPT, _
 1464         byval s as FBSYMBOL ptr, _
 1465         byval symtb as FBSYMBOLTB ptr, _
 1466         byval hashtb as FBHASHTB ptr, _
 1467         byval class as FB_SYMBCLASS, _
 1468         byval id as const zstring ptr, _
 1469         byval id_alias as const zstring ptr, _
 1470         byval dtype as integer, _
 1471         byval subtype as FBSYMBOL ptr, _
 1472         byval attrib as FB_SYMBATTRIB = FB_SYMBATTRIB_NONE _
 1473     ) as FBSYMBOL ptr
 1474 
 1475 declare sub symbFreeSymbol _
 1476     ( _
 1477         byval s as FBSYMBOL ptr _
 1478     )
 1479 
 1480 declare sub symbFreeSymbol_RemOnly _
 1481     ( _
 1482         byval s as FBSYMBOL ptr _
 1483     )
 1484 
 1485 declare sub symbFreeSymbol_UnlinkOnly _
 1486     ( _
 1487         byval s as FBSYMBOL ptr _
 1488     )
 1489 
 1490 declare sub symbDelFromHash _
 1491     ( _
 1492         byval s as FBSYMBOL ptr _
 1493     )
 1494 
 1495 declare sub symbDelFromChainList _
 1496     ( _
 1497         byval s as FBSYMBOL ptr _
 1498     )
 1499 
 1500 declare sub symbRecalcLen( byval sym as FBSYMBOL ptr )
 1501 declare sub symbSetType _
 1502     ( _
 1503         byval sym as FBSYMBOL ptr, _
 1504         byval dtype as integer, _
 1505         byval subtype as FBSYMBOL ptr _
 1506     )
 1507 
 1508 declare function symbCalcLen _
 1509     ( _
 1510         byval dtype as integer, _
 1511         byval subtype as FBSYMBOL ptr _
 1512     ) as longint
 1513 
 1514 declare function symbCalcDerefLen _
 1515     ( _
 1516         byval dtype as integer, _
 1517         byval subtype as FBSYMBOL ptr  _
 1518     ) as longint
 1519 
 1520 declare function symbAllocFloatConst _
 1521     ( _
 1522         byval value as double, _
 1523         byval dtype as integer _
 1524     ) as FBSYMBOL ptr
 1525 
 1526 declare function symbAllocIntConst _
 1527     ( _
 1528         byval value as longint, _
 1529         byval dtype as integer _
 1530     ) as FBSYMBOL ptr
 1531 
 1532 declare function symbAllocStrConst _
 1533     ( _
 1534         byval sname as zstring ptr, _
 1535         byval lgt as integer _
 1536     ) as FBSYMBOL ptr
 1537 
 1538 declare function symbAllocWstrConst _
 1539     ( _
 1540         byval sname as wstring ptr, _
 1541         byval lgt as integer _
 1542     ) as FBSYMBOL ptr
 1543 
 1544 declare function symbGetRealSize( byval sym as FBSYMBOL ptr ) as longint
 1545 declare sub symbGetRealType( byval sym as FBSYMBOL ptr, byref dtype as integer, byref subtype as FBSYMBOL ptr )
 1546 
 1547 declare function symbCalcArrayElements _
 1548     ( _
 1549         byval sym as FBSYMBOL ptr, _
 1550         byval first as integer _
 1551     ) as longint
 1552 
 1553 declare function symbCheckArraySize _
 1554     ( _
 1555         byval dimensions as integer, _
 1556         byval dimtb as FBARRAYDIM ptr, _
 1557         byval lgt as longint, _
 1558         byval is_on_stack as integer _
 1559     ) as integer
 1560 
 1561 declare function symbCheckLabels _
 1562     ( _
 1563         byval symtbhead as FBSYMBOL ptr _
 1564     ) as integer
 1565 
 1566 declare function symbCheckBitField _
 1567     ( _
 1568         byval udt as FBSYMBOL ptr, _
 1569         byval dtype as integer, _
 1570         byval lgt as longint, _
 1571         byval bits as integer _
 1572     ) as integer
 1573 
 1574 declare sub symbCheckFwdRef _
 1575     ( _
 1576         byval s as FBSYMBOL ptr _
 1577     )
 1578 
 1579 declare function symbIsEqual _
 1580     ( _
 1581         byval sym1 as FBSYMBOL ptr, _
 1582         byval sym2 as FBSYMBOL ptr _
 1583     ) as integer
 1584 
 1585 declare function symbIsProcOverloadOf _
 1586     ( _
 1587         byval proc as FBSYMBOL ptr, _
 1588         byval parent as FBSYMBOL ptr _
 1589     ) as integer
 1590 
 1591 declare sub symbCheckChainForTypesAndOthers _
 1592     ( _
 1593         byval chain_ as FBSYMCHAIN ptr, _
 1594         byref typ as FBSYMBOL ptr, _
 1595         byref nontype as FBSYMBOL ptr _
 1596     )
 1597 
 1598 declare function symbHasCtor( byval sym as FBSYMBOL ptr ) as integer
 1599 declare function symbHasDefCtor( byval sym as FBSYMBOL ptr ) as integer
 1600 declare function symbHasDtor( byval sym as FBSYMBOL ptr ) as integer
 1601 declare function symbIsDataDesc( byval sym as FBSYMBOL ptr ) as integer
 1602 
 1603 declare function symbIsArray _
 1604     ( _
 1605         byval sym as FBSYMBOL ptr _
 1606     ) as integer
 1607 
 1608 declare function symbIsString _
 1609     ( _
 1610         byval dtype as integer _
 1611     ) as integer
 1612 
 1613 declare function symbGetValistType( byval dtype as integer, byval subtype as FBSYMBOL ptr ) as FB_CVA_LIST_TYPEDEF
 1614 #define symbIsValistStructArray( dtype, subtype ) (symbGetValistType( dtype, subtype ) = FB_CVA_LIST_BUILTIN_C_STD)
 1615 #define symbIsBuiltinVaListType( dtype, subtype ) (symbGetValistType( dtype, subtype ) > FB_CVA_LIST_POINTER)
 1616 
 1617 declare function symbGetVarHasCtor _
 1618     ( _
 1619         byval s as FBSYMBOL ptr _
 1620     ) as integer
 1621 
 1622 declare function symbGetVarHasDtor _
 1623     ( _
 1624         byval s as FBSYMBOL ptr _
 1625     ) as integer
 1626 
 1627 declare sub typeMax _
 1628     ( _
 1629         byval ldtype as integer, _
 1630         byval lsubtype as FBSYMBOL ptr, _
 1631         byval rdtype as integer, _
 1632         byval rsubtype as FBSYMBOL ptr, _
 1633         byref dtype as integer, _
 1634         byref subtype as FBSYMBOL ptr _
 1635     )
 1636 
 1637 declare function typeToSigned _
 1638     ( _
 1639         byval dtype as integer _
 1640     ) as integer
 1641 
 1642 declare function typeToUnsigned _
 1643     ( _
 1644         byval dtype as integer _
 1645     ) as integer
 1646 
 1647 declare function typeHasCtor _
 1648     ( _
 1649         byval dtype as integer, _
 1650         byval subtype as FBSYMBOL ptr _
 1651     ) as integer
 1652 
 1653 declare function typeHasDefCtor _
 1654     ( _
 1655         byval dtype as integer, _
 1656         byval subtype as FBSYMBOL ptr _
 1657     ) as integer
 1658 
 1659 declare function typeHasDtor _
 1660     ( _
 1661         byval dtype as integer, _
 1662         byval subtype as FBSYMBOL ptr _
 1663     ) as integer
 1664 
 1665 declare function typeNeedsDtorCall _
 1666     ( _
 1667         byval dtype as integer, _
 1668         byval subtype as FBSYMBOL ptr _
 1669     ) as integer
 1670 
 1671 declare function typeIsTrivial _
 1672     ( _
 1673         byval dtype as integer, _
 1674         byval subtype as FBSYMBOL ptr _
 1675     ) as integer
 1676 
 1677 declare function typeHasFwdRefInSignature _
 1678     ( _
 1679         byval dtype as integer, _
 1680         byval subtype as FBSYMBOL ptr _
 1681     ) as integer
 1682 
 1683 declare function typeMerge _
 1684     ( _
 1685         byval dtype1 as integer, _
 1686         byval dtype2 as integer _
 1687     ) as integer
 1688 
 1689 declare function typeCalcMatch _
 1690     ( _
 1691         byval ldtype as integer, _
 1692         byval lsubtype as FBSYMBOL ptr, _
 1693         byval lparammode as integer, _
 1694         byval rdtype as integer, _
 1695         byval rsubtype as FBSYMBOL ptr _
 1696     ) as FB_OVLPROC_MATCH_SCORE
 1697 
 1698 declare sub symbHashListAdd _
 1699     ( _
 1700         byval hashtb as FBHASHTB ptr _
 1701     )
 1702 
 1703 declare sub symbHashListAddBefore _
 1704     ( _
 1705         byval lasttb as FBHASHTB ptr, _
 1706         byval hashtb as FBHASHTB ptr _
 1707     )
 1708 
 1709 declare sub symbHashListDel _
 1710     ( _
 1711         byval hashtb as FBHASHTB ptr _
 1712     )
 1713 
 1714 declare function symbNamespaceImport _
 1715     ( _
 1716         byval ns as FBSYMBOL ptr _
 1717     ) as integer
 1718 
 1719 declare function symbNamespaceImportEx _
 1720     ( _
 1721         byval ns as FBSYMBOL ptr, _
 1722         byval to_ns as FBSYMBOL ptr _
 1723     ) as integer
 1724 
 1725 declare sub symbNamespaceRemove _
 1726     ( _
 1727         byval sym as FBSYMBOL ptr, _
 1728         byval hashonly as integer _
 1729     )
 1730 
 1731 declare sub symbNamespaceReImport _
 1732     ( _
 1733         byval ns as FBSYMBOL ptr _
 1734     )
 1735 
 1736 declare sub symbNestBegin _
 1737     ( _
 1738         byval sym as FBSYMBOL ptr, _
 1739         byval insert_chain as integer = FALSE _
 1740     )
 1741 
 1742 declare sub symbNestEnd _
 1743     ( _
 1744         byval remove_chain as integer = FALSE _
 1745     )
 1746 
 1747 declare function symbCanDuplicate _
 1748     ( _
 1749         byval head_sym as FBSYMBOL ptr, _
 1750         byval s as FBSYMBOL ptr _
 1751     ) as integer
 1752 
 1753 declare function symbUniqueId( ) as zstring ptr
 1754 declare function symbUniqueLabel( ) as zstring ptr
 1755 declare function symbMakeProfileLabelName( ) as zstring ptr
 1756 declare function symbGetMangledName( byval sym as FBSYMBOL ptr ) as zstring ptr
 1757 declare function symbGetDBGName( byval sym as FBSYMBOL ptr ) as zstring ptr
 1758 declare sub symbSetName( byval s as FBSYMBOL ptr, byval name_ as zstring ptr )
 1759 declare sub symbMangleResetAbbrev( )
 1760 declare function hMangleBuiltInType _
 1761     ( _
 1762         byval dtype as integer, _
 1763         byref add_abbrev as integer = FALSE _
 1764     ) as zstring ptr
 1765 declare sub symbMangleType _
 1766     ( _
 1767         byref mangled as string, _
 1768         byval dtype as integer, _
 1769         byval subtype as FBSYMBOL ptr, _
 1770         byval options as FB_MANGLEOPT = FB_MANGLEOPT_NONE _
 1771     )
 1772 declare sub symbMangleParam( byref mangled as string, byval param as FBSYMBOL ptr )
 1773 
 1774 declare function hDumpDynamicArrayDimensions( byval dimensions as integer ) as string
 1775 declare function symbProcPtrToStr( byval proc as FBSYMBOL ptr ) as string
 1776 declare function symbMethodToStr( byval proc as FBSYMBOL ptr ) as string
 1777 
 1778 declare function symbTypeToStr _
 1779     ( _
 1780         byval dtype as integer, _
 1781         byval subtype as FBSYMBOL ptr, _
 1782         byval length as longint = 0, _
 1783         byval is_fixlenstr as integer = FALSE _
 1784     ) as string
 1785 
 1786 declare function symbGetDefType _
 1787     ( _
 1788         byval symbol as const zstring ptr _
 1789     ) as integer
 1790 
 1791 declare sub symbSetDefType _
 1792     ( _
 1793         byval ichar as integer, _
 1794         byval echar as integer, _
 1795         byval typ as integer _
 1796     )
 1797 
 1798 declare sub symbUdtAllocExt( byval udt as FBSYMBOL ptr )
 1799 
 1800 declare sub symbUdtDeclareDefaultMembers _
 1801     ( _
 1802         byref default as SYMBDEFAULTMEMBERS, _
 1803         byval udt as FBSYMBOL ptr _
 1804     )
 1805 
 1806 declare sub symbUdtImplementDefaultMembers _
 1807     ( _
 1808         byref default as SYMBDEFAULTMEMBERS, _
 1809         byval udt as FBSYMBOL ptr _
 1810     )
 1811 
 1812 declare function symbCompIsTrivial( byval sym as FBSYMBOL ptr ) as integer
 1813 declare sub symbSetCompCtorHead( byval sym as FBSYMBOL ptr, byval proc as FBSYMBOL ptr )
 1814 declare sub symbCheckCompCtor( byval sym as FBSYMBOL ptr, byval proc as FBSYMBOL ptr )
 1815 declare sub symbSetCompDtor( byval sym as FBSYMBOL ptr, byval proc as FBSYMBOL ptr )
 1816 declare function symbGetCompCtorHead( byval sym as FBSYMBOL ptr ) as FBSYMBOL ptr
 1817 declare function symbGetCompDefCtor( byval sym as FBSYMBOL ptr ) as FBSYMBOL ptr
 1818 declare function symbGetCompDtor( byval sym as FBSYMBOL ptr ) as FBSYMBOL ptr
 1819 declare sub symbCheckCompLetOp( byval sym as FBSYMBOL ptr, byval proc as FBSYMBOL ptr )
 1820 declare function symbCompHasCopyLetOps( byval udt as FBSYMBOL ptr ) as integer
 1821 
 1822 declare function symbGetCompOpOvlHead _
 1823     ( _
 1824         byval sym as FBSYMBOL ptr, _
 1825         byval op as AST_OP _
 1826     ) as FBSYMBOL ptr
 1827 
 1828 declare sub symbSetCompOpOvlHead _
 1829     ( _
 1830         byval sym as FBSYMBOL ptr, _
 1831         byval proc as FBSYMBOL ptr _
 1832     )
 1833 
 1834 declare function symbCompAddVirtual( byval udt as FBSYMBOL ptr ) as integer
 1835 declare function symbCompGetAbstractCount( byval udt as FBSYMBOL ptr ) as integer
 1836 declare function symbAddGlobalCtor( byval proc as FBSYMBOL ptr ) as FB_GLOBCTORLIST_ITEM ptr
 1837 declare function symbAddGlobalDtor( byval proc as FBSYMBOL ptr ) as FB_GLOBCTORLIST_ITEM ptr
 1838 
 1839 declare function symbCloneSymbol _
 1840     ( _
 1841         byval s as FBSYMBOL ptr _
 1842     ) as FBSYMBOL ptr
 1843 
 1844 declare function symbCloneConst( byval sym as FBSYMBOL ptr ) as FBSYMBOL ptr
 1845 declare function symbCloneVar( byval sym as FBSYMBOL ptr ) as FBSYMBOL ptr
 1846 
 1847 declare function symbCloneLabel _
 1848     ( _
 1849         byval sym as FBSYMBOL ptr _
 1850     ) as FBSYMBOL ptr
 1851 
 1852 declare function symbCheckAccess( byval sym as FBSYMBOL ptr ) as integer
 1853 
 1854 declare function symbGetFullProcName _
 1855     ( _
 1856         byval proc as FBSYMBOL ptr _
 1857     ) as zstring ptr
 1858 
 1859 declare function symbUdtGetFirstField( byval parent as FBSYMBOL ptr ) as FBSYMBOL ptr
 1860 declare function symbUdtGetNextField( byval sym as FBSYMBOL ptr ) as FBSYMBOL ptr
 1861 declare function symbUdtGetNextInitableField( byval sym as FBSYMBOL ptr ) as FBSYMBOL ptr
 1862 
 1863 declare function symbGetEnumFirstElm _
 1864     ( _
 1865         byval parent as FBSYMBOL ptr _
 1866     ) as FBSYMBOL ptr
 1867 
 1868 declare function symbGetEnumNextElm _
 1869     ( _
 1870         byval sym as FBSYMBOL ptr _
 1871     ) as FBSYMBOL ptr
 1872 
 1873 declare sub symbCompDelImportList _
 1874     ( _
 1875         byval sym as FBSYMBOL ptr _
 1876     )
 1877 
 1878 declare sub symbHashListInsertNamespace _
 1879     ( _
 1880         byval ns as FBSYMBOL ptr, _
 1881         byval src_head as FBSYMBOL ptr _
 1882     )
 1883 
 1884 declare sub symbHashListRemoveNamespace _
 1885     ( _
 1886         byval ns as FBSYMBOL ptr _
 1887     )
 1888 
 1889 declare function symbGetDefaultParamMode _
 1890     ( _
 1891         byval dtype as integer, _
 1892         byval subtype as FBSYMBOL ptr _
 1893     ) as integer
 1894 
 1895 declare function symbVarCheckAccess( byval sym as FBSYMBOL ptr ) as integer
 1896 
 1897 declare function symbCheckConstAssignTopLevel _
 1898     ( _
 1899         byval ldtype as FB_DATATYPE, _
 1900         byval rdtype as FB_DATATYPE, _
 1901         byval lsubtype as FBSYMBOL ptr, _
 1902         byval rsubtype as FBSYMBOL ptr, _
 1903         byval mode as FB_PARAMMODE = 0, _
 1904         byref matches as integer = 0 _
 1905     ) as integer
 1906 
 1907 declare function symbCheckConstAssign _
 1908     ( _
 1909         byval ldtype as FB_DATATYPE, _
 1910         byval rdtype as FB_DATATYPE, _
 1911         byval lsubtype as FBSYMBOL ptr, _
 1912         byval rsubtype as FBSYMBOL ptr, _
 1913         byval mode as FB_PARAMMODE = 0, _
 1914         byref matches as integer = 0, _
 1915         byref wrnmsg as FB_WARNINGMSG = 0 _
 1916     ) as integer
 1917 
 1918 declare function symbAllocOvlCallArg _
 1919     ( _
 1920         byval list as TLIST ptr, _
 1921         byval arg_list as FB_CALL_ARG_LIST ptr, _
 1922         byval to_head as integer = FALSE _
 1923     ) as FB_CALL_ARG ptr
 1924 
 1925 #define symbFreeOvlCallArg( list, arg ) listDelNode( list, arg )
 1926 
 1927 declare sub symbFreeOvlCallArgs _
 1928     ( _
 1929         byval list as TLIST ptr, _
 1930         byval arg_list as FB_CALL_ARG_LIST ptr _
 1931     )
 1932 
 1933 declare function symbGetUDTBaseLevel _
 1934     ( _
 1935         byval s as FBSYMBOL ptr, _
 1936         byval baseSym as FBSYMBOL ptr _
 1937     ) as integer
 1938 
 1939 declare function symbCloneSimpleStruct( byval sym as FBSYMBOL ptr ) as FBSYMBOL ptr
 1940 
 1941 ''
 1942 '' macros
 1943 ''
 1944 
 1945 #macro symbHashTbInit( _hashtb, _owner, _nodes )
 1946     _hashtb.owner = _owner
 1947     _hashtb.prev = NULL
 1948     _hashtb.next = NULL
 1949     if( (_nodes) <> 0 ) then
 1950         hashInit( @_hashtb.tb, _nodes )
 1951     else
 1952         clear( _hashtb.tb, 0, sizeof( _hashtb.tb ) )
 1953     end if
 1954 #endmacro
 1955 
 1956 #macro symbSymbTbInit( _symtb, _owner )
 1957     _symtb.owner = _owner
 1958     _symtb.head = NULL
 1959     _symtb.tail = NULL
 1960 #endmacro
 1961 
 1962 #macro symbHashListMove( hashtb )
 1963     symbHashListDel( hashtb )
 1964     symbHashListAdd( hashtb )
 1965 #endmacro
 1966 
 1967 #macro symbHashListMoveBefore( lasttb, hashtb )
 1968     symbHashListDel( hashtb )
 1969     symbHashListAddBefore( lasttb, hashtb )
 1970 #endmacro
 1971 
 1972 #define symbGetGlobalNamespc( ) symb.globnspc
 1973 
 1974 #define symbIsGlobalNamespc( ) (symb.namespc = @symbGetGlobalNamespc( ))
 1975 
 1976 #define symbGetGlobalTb( ) symbGetGlobalNamespc( ).nspc.ns.symtb
 1977 
 1978 #define symbGetGlobalTbHead( ) symbGetGlobalTb( ).head
 1979 
 1980 #define symbGetGlobalHashTb( ) symbGetGlobalNamespc( ).nspc.ns.hashtb
 1981 
 1982 #define symbGetCurrentNamespc( ) symb.namespc
 1983 #define symbSetCurrentNamespc(ns) symb.namespc = ns
 1984 
 1985 #define symbGetCurrentSymTb( ) symb.symtb
 1986 #define symbSetCurrentSymTb(tb) symb.symtb = tb
 1987 
 1988 #define symbGetCurrentHashTb( ) symb.hashtb
 1989 #define symbSetCurrentHashTb(tb) symb.hashtb = tb
 1990 
 1991 #define symbGetGlobCtorListHead( ) symb.globctorlist.head
 1992 
 1993 #define symbGetGlobDtorListHead( ) symb.globdtorlist.head
 1994 
 1995 #define symbGetIsAccessed(s) ((s->stats and FB_SYMBSTATS_ACCESSED) <> 0)
 1996 #define symbSetIsAccessed(s) s->stats or= FB_SYMBSTATS_ACCESSED
 1997 
 1998 #define symbGetIsDeclared(s) ((s->stats and FB_SYMBSTATS_DECLARED) <> 0)
 1999 #define symbSetIsDeclared(s) s->stats or= FB_SYMBSTATS_DECLARED
 2000 
 2001 #define symbGetIsImplicit( s ) (((s)->stats and FB_SYMBSTATS_IMPLICIT) <> 0)
 2002 #define symbSetIsImplicit( s ) (s)->stats or= FB_SYMBSTATS_IMPLICIT
 2003 
 2004 #define symbGetIsRTL(s) ((s->stats and FB_SYMBSTATS_RTL) <> 0)
 2005 
 2006 #define symbGetIsThrowable(s) ((s->stats and FB_SYMBSTATS_THROWABLE) <> 0)
 2007 #define symbSetIsThrowable(s) s->stats or= FB_SYMBSTATS_THROWABLE
 2008 
 2009 #define symbGetIsParsed(s) ((s->stats and FB_SYMBSTATS_PARSED) <> 0)
 2010 #define symbSetIsParsed(s) s->stats or= FB_SYMBSTATS_PARSED
 2011 
 2012 #define symbSetDontInit(s) s->stats or= FB_SYMBSTATS_DONTINIT
 2013 #define symbGetDontInit(s) ((s->stats and FB_SYMBSTATS_DONTINIT) <> 0)
 2014 
 2015 #define symbGetIsMainProc(s) ((s->stats and FB_SYMBSTATS_MAINPROC) <> 0)
 2016 #define symbSetIsMainProc(s) s->stats or= FB_SYMBSTATS_MAINPROC
 2017 
 2018 #define symbGetIsModLevelProc(s) ((s->stats and FB_SYMBSTATS_MODLEVELPROC) <> 0)
 2019 #define symbSetIsModLevelProc(s) s->stats or= FB_SYMBSTATS_MODLEVELPROC
 2020 
 2021 #define symbGetIsFuncPtr(s) ((s->stats and FB_SYMBSTATS_FUNCPTR) <> 0)
 2022 #define symbSetIsFuncPtr(s) s->stats or= FB_SYMBSTATS_FUNCPTR
 2023 
 2024 #define symbGetIsJumpTb(s) ((s->stats and FB_SYMBSTATS_JUMPTB) <> 0)
 2025 #define symbSetIsJumpTb(s) s->stats or= FB_SYMBSTATS_JUMPTB
 2026 
 2027 #define symbGetIsUnique(s) ((s->stats and FB_SYMBSTATS_CANTDUP) <> 0)
 2028 #define symbSetIsUnique(s) s->stats or= FB_SYMBSTATS_CANTDUP
 2029 
 2030 #define symbGetHasRTTI(s) ((s->stats and FB_SYMBSTATS_HASRTTI) <> 0)
 2031 #define symbSetHasRTTI(s) s->stats or= FB_SYMBSTATS_HASRTTI
 2032 
 2033 #define symbGetIsGlobalCtor(s) ((s->stats and FB_SYMBSTATS_GLOBALCTOR) <> 0)
 2034 #define symbSetIsGlobalCtor( s ) s->stats or= FB_SYMBSTATS_GLOBALCTOR or FB_SYMBSTATS_ACCESSED
 2035 
 2036 #define symbGetIsGlobalDtor(s) ((s->stats and FB_SYMBSTATS_GLOBALDTOR) <> 0)
 2037 #define symbSetIsGlobalDtor( s ) s->stats or= FB_SYMBSTATS_GLOBALDTOR or FB_SYMBSTATS_ACCESSED
 2038 
 2039 #define symbGetIsCtorInited(s) ((s->stats and FB_SYMBSTATS_CTORINITED) <> 0)
 2040 #define symbSetIsCtorInited(s) s->stats or= FB_SYMBSTATS_CTORINITED
 2041 
 2042 #define symbGetCantUndef(s) ((s->stats and FB_SYMBSTATS_CANTUNDEF) <> 0)
 2043 #define symbSetCantUndef(s) s->stats or= FB_SYMBSTATS_CANTUNDEF
 2044 
 2045 #define symbGetCanRedef(s) ((s->stats and FB_SYMBSTATS_CANREDEFINE) <> 0)
 2046 #define symbSetCanRedef(s) s->stats or= FB_SYMBSTATS_CANREDEFINE
 2047 
 2048 #define symbGetIsFixLenStr(s) ((s->stats and FB_SYMBSTATS_FIXLENSTR) <> 0)
 2049 #define symbSetIsFixLenStr(s) (s)->stats or= FB_SYMBSTATS_FIXLENSTR
 2050 
 2051 #define symbGetIsUnionField(s) ((s->stats and FB_SYMBSTATS_UNIONFIELD) <> 0)
 2052 #define symbSetIsUnionField(s) s->stats or= FB_SYMBSTATS_UNIONFIELD
 2053 
 2054 #define symbGetIsEmitted(s) ((s->stats and FB_SYMBSTATS_EMITTED) <> 0)
 2055 #define symbSetIsEmitted(s) s->stats or= FB_SYMBSTATS_EMITTED
 2056 
 2057 #define symbGetIsBeingEmitted(s) ((s->stats and FB_SYMBSTATS_BEINGEMITTED) <> 0)
 2058 #define symbSetIsBeingEmitted(s) s->stats or= FB_SYMBSTATS_BEINGEMITTED
 2059 #define symbResetIsBeingEmitted(s) s->stats and= not FB_SYMBSTATS_BEINGEMITTED
 2060 
 2061 #define symbGetProcIsEmitted(s) ((s->stats and FB_SYMBSTATS_PROCEMITTED) <> 0)
 2062 #define symbSetProcIsEmitted(s) s->stats or= FB_SYMBSTATS_PROCEMITTED
 2063 
 2064 #define symbGetIsWstring(s) (((s)->stats and FB_SYMBSTATS_WSTRING) <> 0)
 2065 #define symbSetIsWstring(s) (s)->stats or= FB_SYMBSTATS_WSTRING
 2066 
 2067 #define symbGetStats(s) s->stats
 2068 
 2069 #define symbGetLen( s ) (s)->lgt
 2070 
 2071 #define symbGetStrLen(s) symbGetLen(s)
 2072 
 2073 #define symbGetWstrLen(s) ((s)->lgt \ typeGetSize( FB_DATATYPE_WCHAR ))
 2074 
 2075 #define symbGetFullType(s) s->typ
 2076 #define symbGetType(s) typeGetDtAndPtrOnly( symbGetFullType( s ) )
 2077 
 2078 #define symbGetSubType(s) s->subtype
 2079 
 2080 #define symbGetPtrCnt(s) typeGetPtrCnt( symbGetType( s ) )
 2081 
 2082 #define symbGetClass(s) s->class
 2083 
 2084 #define symbGetSymbtb(s) s->symtb
 2085 
 2086 #define symbGetHashtb(s) s->hash.tb
 2087 
 2088 #define symbGetParent(s) symbGetSymbtb(s)->owner
 2089 
 2090 #define symbGetNamespace(s) symbGetHashtb(s)->owner
 2091 
 2092 #define symbGetMangling(s) s->mangling
 2093 
 2094 #define symbGetName(s) s->id.name
 2095 
 2096 #define symbGetOfs(s) s->ofs
 2097 
 2098 #define symbGetAttrib(s) s->attrib
 2099 #define symbSetAttrib(s,t) s->attrib = t
 2100 
 2101 #define symbGetPrev(s) s->prev
 2102 
 2103 #define symbGetNext(s) s->next
 2104 
 2105 #define symbChainGetNext(c) c->next
 2106 
 2107 #define symbIsVar(s) (s->class = FB_SYMBCLASS_VAR)
 2108 
 2109 #define symbIsConst(s) (s->class = FB_SYMBCLASS_CONST)
 2110 
 2111 #define symbIsProc(s) (s->class = FB_SYMBCLASS_PROC)
 2112 
 2113 #define symbIsDefine(s) (s->class = FB_SYMBCLASS_DEFINE)
 2114 
 2115 #define symbIsKeyword(s) (s->class = FB_SYMBCLASS_KEYWORD)
 2116 
 2117 #define symbIsLabel(s) (s->class = FB_SYMBCLASS_LABEL)
 2118 
 2119 #define symbIsEnum(s) (s->class = FB_SYMBCLASS_ENUM)
 2120 
 2121 #define symbIsStruct(s) (s->class = FB_SYMBCLASS_STRUCT)
 2122 
 2123 #define symbIsField(s) (s->class = FB_SYMBCLASS_FIELD)
 2124 
 2125 #define symbIsTypedef(s) (s->class = FB_SYMBCLASS_TYPEDEF)
 2126 
 2127 #define symbIsFwdRef(s) (s->class = FB_SYMBCLASS_FWDREF)
 2128 
 2129 #define symbIsScope(s) (s->class = FB_SYMBCLASS_SCOPE)
 2130 
 2131 #define symbIsNameSpace(s) (s->class = FB_SYMBCLASS_NAMESPACE)
 2132 
 2133 #define symbGetConstVal( sym )   (@((sym)->val))
 2134 #define symbGetConstStr( sym )   ((sym)->val.s)
 2135 #define symbGetConstInt( sym )   ((sym)->val.i)
 2136 #define symbGetConstFloat( sym ) ((sym)->val.f)
 2137 
 2138 #define symbGetDefineText(d) d->def.text
 2139 
 2140 #define symbGetDefineTextW(d) d->def.textw
 2141 
 2142 #define symbGetDefineHeadToken(d) d->def.tokhead
 2143 
 2144 #define symbGetDefTokPrev(t) t->prev
 2145 
 2146 #define symbGetDefTokNext(t) t->next
 2147 
 2148 #define symbGetDefTokType(t) t->type
 2149 #define symbSetDefTokType(t,_typ) t->type = _typ
 2150 
 2151 #define symbGetDefTokText(t) t->text
 2152 
 2153 #define symbGetDefTokTextW(t) t->textw
 2154 
 2155 #define symbGetDefTokParamNum(t) t->paramnum
 2156 #define symbSetDefTokParamNum(t,n) t->paramnum = n
 2157 
 2158 #define symbGetDefineParams(d) d->def.params
 2159 
 2160 #define symbGetDefineHeadParam(d) d->def.paramhead
 2161 
 2162 #define symbGetDefParamNext(a) a->next
 2163 
 2164 #define symbGetDefParamName(a) a->name
 2165 
 2166 #define symbGetDefParamNum(a) a->num
 2167 
 2168 #define symbGetDefineCallback(d) d->def.proc
 2169 
 2170 #define symbGetDefineIsArgless(d) d->def.isargless
 2171 
 2172 #define symbGetDefineFlags(d) d->def.flags
 2173 
 2174 #define symbGetVarLitText(s) s->var_.littext
 2175 
 2176 #define symbGetVarLitTextW(s) s->var_.littextw
 2177 
 2178 #define symbGetVarStmt(s) s->var_.stmtnum
 2179 
 2180 #define symbSetTypeIniTree(s, t) s->var_.initree = t
 2181 #define symbGetTypeIniTree(s) s->var_.initree
 2182 
 2183 #define symbGetArrayDimensions( s )  ((s)->var_.array.dimensions)
 2184 #define symbGetArrayDim( s, i )      ((s)->var_.array.dimtb[i])
 2185 #define symbArrayLbound( s, i )      ((s)->var_.array.dimtb[i].lower)
 2186 #define symbArrayUbound( s, i )      ((s)->var_.array.dimtb[i].upper)
 2187 #define symbGetArrayDiff( s )        ((s)->var_.array.diff)
 2188 #define symbGetArrayElements( s )    ((s)->var_.array.elements)
 2189 #define symbGetArrayDescriptor( s )  ((s)->var_.array.desc)
 2190 
 2191 #define symbFieldIsBitfield( s )     ((s)->var_.bits > 0)
 2192 #define symbIsBitfield( s ) _
 2193     iif( symbIsField( s ), symbFieldIsBitfield( s ), FALSE )
 2194 #define symbGetFieldBitOffset( fld ) _
 2195     ((fld)->ofs * 8 + iif( (fld)->var_.bits > 0, (fld)->var_.bitpos, 0 ))
 2196 #define symbGetFieldBitLength( fld ) _
 2197     iif( (fld)->var_.bits > 0, _
 2198         clngint( (fld)->var_.bits ), _ '' clngint needed for older versions of fbc
 2199         symbGetRealSize( fld ) * 8 )
 2200 
 2201 #define symbGetUDTSymbTbHead(s) s->udt.ns.symtb.head
 2202 
 2203 #define symbSetUDTIsUnion(s) (s)->udt.options or= FB_UDTOPT_ISUNION
 2204 #define symbGetUDTIsUnion(s) ((s->udt.options and FB_UDTOPT_ISUNION) <> 0)
 2205 
 2206 #define symbSetUDTHasPtrField(s) s->udt.options or= FB_UDTOPT_HASPTRFIELD
 2207 #define symbGetUDTHasPtrField(s) ((s->udt.options and FB_UDTOPT_HASPTRFIELD) <> 0)
 2208 
 2209 #define symbSetUDTHasCtorField(s) s->udt.options or= FB_UDTOPT_HASCTORFIELD
 2210 #define symbGetUDTHasCtorField(s) ((s->udt.options and FB_UDTOPT_HASCTORFIELD) <> 0)
 2211 
 2212 #define symbSetUDTHasDtorField(s) s->udt.options or= FB_UDTOPT_HASDTORFIELD
 2213 #define symbGetUDTHasDtorField(s) ((s->udt.options and FB_UDTOPT_HASDTORFIELD) <> 0)
 2214 
 2215 #define symbSetUDTIsAnon(s) (s)->udt.options or= FB_UDTOPT_ISANON
 2216 #define symbGetUDTIsAnon(s) ((s->udt.options and FB_UDTOPT_ISANON) <> 0)
 2217 
 2218 #define symbGetUDTHasRecByvalParam(s) ((s->udt.options and FB_UDTOPT_HASRECBYVALPARAM) <> 0)
 2219 #define symbSetUDTHasRecByvalParam(s) s->udt.options or= FB_UDTOPT_HASRECBYVALPARAM
 2220 
 2221 #define symbGetUDTHasRecByvalRes(s) ((s->udt.options and FB_UDTOPT_HASRECBYVALRES) <> 0)
 2222 #define symbSetUDTHasRecByvalRes(s) s->udt.options or= FB_UDTOPT_HASRECBYVALRES
 2223 
 2224 #define symbGetUDTHasGetProp(s) ((s->udt.options and FB_UDTOPT_HASGETPROPERTY) <> 0)
 2225 #define symbSetUDTHasGetProp(s) s->udt.options or= FB_UDTOPT_HASGETPROPERTY
 2226 
 2227 #define symbGetUDTHasSetProp(s) ((s->udt.options and FB_UDTOPT_HASSETPROPERTY) <> 0)
 2228 #define symbSetUDTHasSetProp(s) s->udt.options or= FB_UDTOPT_HASSETPROPERTY
 2229 
 2230 #define symbGetUDTHasIdxGetProp(s) ((s->udt.options and FB_UDTOPT_HASIDXGETPROPERTY) <> 0)
 2231 #define symbSetUDTHasIdxGetProp(s) s->udt.options or= FB_UDTOPT_HASIDXGETPROPERTY
 2232 
 2233 #define symbGetUDTHasIdxSetProp(s) ((s->udt.options and FB_UDTOPT_HASIDXSETPROPERTY) <> 0)
 2234 #define symbSetUDTHasIdxSetProp(s) s->udt.options or= FB_UDTOPT_HASIDXSETPROPERTY
 2235 
 2236 #define symbGetUDTHasKwdField(s) ((s->udt.options and FB_UDTOPT_HASKWDFIELD) <> 0)
 2237 #define symbSetUDTHasKwdField(s) s->udt.options or= FB_UDTOPT_HASKWDFIELD
 2238 
 2239 #define symbSetUDTHasInitedField( s ) (s)->udt.options or= FB_UDTOPT_HASINITEDFIELD
 2240 #define symbGetUDTHasInitedField( s ) (((s)->udt.options and FB_UDTOPT_HASINITEDFIELD) <> 0)
 2241 
 2242 #define symbSetUDTHasAnonUnion( s ) (s)->udt.options or= FB_UDTOPT_HASANONUNION
 2243 #define symbGetUDTHasAnonUnion( s ) ((s->udt.options and FB_UDTOPT_HASANONUNION) <> 0)
 2244 
 2245 #define symbSetUdtHasStaticVar( s )   (s)->udt.options or= FB_UDTOPT_HASSTATICVAR
 2246 #define symbGetUdtHasStaticVar( s ) (((s)->udt.options and FB_UDTOPT_HASSTATICVAR) <> 0)
 2247 
 2248 #define symbSetUdtHasBitfield( s )   (s)->udt.options or= FB_UDTOPT_HASBITFIELD
 2249 #define symbGetUdtHasBitfield( s ) (((s)->udt.options and FB_UDTOPT_HASBITFIELD) <> 0)
 2250 
 2251 #define symbSetUdtIsValistStruct( s )   (s)->udt.options or= FB_UDTOPT_ISVALISTSTRUCT
 2252 #define symbGetUdtIsValistStruct( s ) (((s)->udt.options and FB_UDTOPT_ISVALISTSTRUCT) <> 0)
 2253 
 2254 #define symbSetUdtIsValistStructArray( s )   (s)->udt.options or= FB_UDTOPT_ISVALISTSTRUCTARRAY
 2255 #define symbGetUdtIsValistStructArray( s ) (((s)->udt.options and FB_UDTOPT_ISVALISTSTRUCTARRAY) <> 0)
 2256 
 2257 #define symbSetUdtIsZstring( s )   (s)->udt.options or= FB_UDTOPT_ISZSTRING
 2258 #define symbGetUdtIsZstring( s ) (((s)->udt.options and FB_UDTOPT_ISZSTRING) <> 0 )
 2259 
 2260 #define symbSetUdtIsWstring( s )   (s)->udt.options or= FB_UDTOPT_ISWSTRING
 2261 #define symbGetUdtIsWstring( s ) (((s)->udt.options and FB_UDTOPT_ISWSTRING) <> 0 )
 2262 
 2263 #define symbGetUDTIsUnionOrAnon(s) (((s)->udt.options and (FB_UDTOPT_ISUNION or FB_UDTOPT_ISANON)) <> 0)
 2264 
 2265 #define symbGetUDTAlign(s) s->udt.align
 2266 
 2267 #define symbGetUDTUnpadLen(s) s->udt.unpadlgt
 2268 
 2269 #define symbGetUDTSymbTb(s) s->udt.ns.symtb
 2270 
 2271 #define symbGetUDTHashTb(s) s->udt.ns.hashtb
 2272 
 2273 #define symbGetUDTAnonParent(s) s->udt.anonparent
 2274 
 2275 #define symbGetUDTRetType(s) s->udt.retdtype
 2276 
 2277 #define symbGetUDTOpOvlTb(s) s->udt.ext->opovlTb
 2278 
 2279 #define symbGetEnumSymbTbHead(s) s->enum_.ns.symtb.head
 2280 #define symbGetEnumElements(s) s->enum_.elements
 2281 #define symbEnumHasHashTb( s ) ((s)->enum_.ns.hashtb.tb.nodes <> 0)
 2282 
 2283 #define symbGetScope(s) s->scope
 2284 
 2285 #define symbGetScopeSymbTb(s) s->scp.symtb
 2286 
 2287 #define symbGetScopeSymbTbHead(s) s->scp.symtb.head
 2288 
 2289 #define symbGetNamespaceSymbTb(s) s->nspc.ns.symtb
 2290 
 2291 #define symbGetNamespaceTbHead(s) s->nspc.ns.symtb.head
 2292 
 2293 #define symbGetNamespaceTbTail(s) s->nspc.ns.symtb.tail
 2294 
 2295 #define symbGetNamespaceHashTb(s) s->nspc.ns.hashtb
 2296 
 2297 #define symbGetNamespaceCnt(s) s->nspc.cnt
 2298 
 2299 #define symbGetNamespaceLastTail(s) s->nspc.last_tail
 2300 
 2301 #define symbGetLabelIsDeclared(l) l->lbl.declared
 2302 #define symbSetLabelIsDeclared(l) l->lbl.declared = TRUE
 2303 
 2304 #define symbGetLabelParent(l) l->lbl.parent
 2305 
 2306 #define symbGetLabelStmt(s) s->lbl.stmtnum
 2307 
 2308 #define symbGetProcParams(f) f->proc.params
 2309 
 2310 #define symbGetProcOptParams(f) f->proc.optparams
 2311 
 2312 #define symbGetProcMode(f) f->proc.mode
 2313 
 2314 #define symbGetProcLastParam(f) iif( f->proc.mode = FB_FUNCMODE_PASCAL, f->proc.paramtb.tail, f->proc.paramtb.head )
 2315 #define symbGetProcPrevParam(f,a) iif( f->proc.mode = FB_FUNCMODE_PASCAL, a->prev, a->next )
 2316 
 2317 #define symbGetProcHeadParam(f) f->proc.paramtb.head
 2318 #define symbGetProcTailParam(f) f->proc.paramtb.tail
 2319 
 2320 #define symbGetProcCallback(f) f->proc.rtl.callback
 2321 #define symbSetProcCallback(f,cb) f->proc.rtl.callback = cb
 2322 
 2323 #define symbGetProcIsOverloaded(f) ((f->attrib and FB_SYMBATTRIB_OVERLOADED) > 0)
 2324 
 2325 #define symGetProcOvlMinParams(f) f->proc.ovl.minparams
 2326 
 2327 #define symGetProcOvlMaxParams(f) f->proc.ovl.maxparams
 2328 
 2329 #define symbGetProcIncFile(f) f->proc.ext->dbg.incfile
 2330 
 2331 #define symbGetProcRealType( sym )    (sym)->proc.realdtype
 2332 #define symbGetProcRealSubtype( sym ) (sym)->proc.realsubtype
 2333 declare sub symbProcRecalcRealType( byval proc as FBSYMBOL ptr )
 2334 
 2335 #define symbGetProcSymbTb(f) f->proc.symtb
 2336 
 2337 #define symbGetProcSymbTbHead(f) f->proc.symtb.head
 2338 
 2339 #define symbGetProcOvlNext(f) f->proc.ovl.next
 2340 
 2341 #define symbGetProcStatReturnUsed(f) ((f->proc.ext->stats and FB_PROCSTATS_RETURNUSED) <> 0)
 2342 #define symbSetProcStatReturnUsed(f) f->proc.ext->stats or= FB_PROCSTATS_RETURNUSED
 2343 
 2344 #define symbGetProcStatAssignUsed(f) ((f->proc.ext->stats and FB_PROCSTATS_ASSIGNUSED) <> 0)
 2345 #define symbSetProcStatAssignUsed(f) f->proc.ext->stats or= FB_PROCSTATS_ASSIGNUSED
 2346 
 2347 #define symbGetProcPriority(f) f->proc.ext->priority
 2348 
 2349 #macro symbSetProcPriority(f,p)
 2350     symbProcAllocExt( f )
 2351     f->proc.ext->priority = p
 2352 #endmacro
 2353 
 2354 #define symbGetProcStatGosub(f) ((f->proc.ext->stats and FB_PROCSTATS_GOSUBUSED) <> 0)
 2355 #define symbSetProcStatGosub(f) f->proc.ext->stats or= FB_PROCSTATS_GOSUBUSED
 2356 
 2357 #define symbGetProcGosubSym(f) f->proc.ext->gosub.ctx
 2358 #define symbSetProcGosubSym(f,p) f->proc.ext->gosub.ctx = p
 2359 
 2360 #define symbGetProcLocalOfs(p) p->proc.ext->stk.localofs
 2361 #define symbSetProcLocalOfs(p,ofs) p->proc.ext->stk.localofs = ofs
 2362 
 2363 #define symbGetProcOpOvl(f) f->proc.ext->opovl.op
 2364 
 2365 #macro symbSetProcOpOvl(f, op_)
 2366     symbProcAllocExt( f )
 2367     f->proc.ext->opovl.op = op_
 2368 #endmacro
 2369 
 2370 #define symbGetParamMode(a) a->param.mode
 2371 
 2372 #define symbGetParamVar(a) a->param.var
 2373 
 2374 #define symbGetParamOptExpr(a) a->param.optexpr
 2375 
 2376 #define symbGetParamPrev(a) a->prev
 2377 
 2378 #define symbGetParamNext(a) a->next
 2379 
 2380 #define symbParamIsOptional( param_ ) ((param_)->param.optexpr <> NULL)
 2381 
 2382 #define symbGetImportNamespc(s) s->nsimp.imp_ns
 2383 
 2384 #define symbGetImportNext(s) s->nsimp.imp_next
 2385 
 2386 #define symbGetExportNamespc(s) s->nsimp.exp_ns
 2387 
 2388 #define symbGetExportNext(s) s->nsimp.exp_next
 2389 
 2390 #define symbGetIsDynamic(s) ((s->attrib and (FB_SYMBATTRIB_DYNAMIC or FB_SYMBATTRIB_PARAMBYDESC)) <> 0 )
 2391 
 2392 #define symbIsShared(s) ((s->attrib and FB_SYMBATTRIB_SHARED) <> 0)
 2393 
 2394 #define symbIsStatic(s) ((s->attrib and FB_SYMBATTRIB_STATIC) <> 0)
 2395 
 2396 #define symbIsDynamic(s) ((s->attrib and FB_SYMBATTRIB_DYNAMIC) <> 0)
 2397 
 2398 #define symbIsCommon(s) ((s->attrib and FB_SYMBATTRIB_COMMON) <> 0)
 2399 
 2400 #define symbIsTemp(s) ((s->attrib and FB_SYMBATTRIB_TEMP) <> 0)
 2401 
 2402 #define symbIsParamByDesc(s) ((s->attrib and FB_SYMBATTRIB_PARAMBYDESC) <> 0)
 2403 
 2404 #define symbIsParamByVal(s) ((s->attrib and FB_SYMBATTRIB_PARAMBYVAL) <> 0)
 2405 
 2406 #define symbIsParamByRef(s) ((s->attrib and FB_SYMBATTRIB_PARAMBYREF) <> 0)
 2407 
 2408 #define symbIsInstanceParam(s) ((s->attrib and FB_SYMBATTRIB_INSTANCEPARAM) <> 0)
 2409 
 2410 #define symbIsParam(s) ((s->attrib and (FB_SYMBATTRIB_PARAMBYREF or FB_SYMBATTRIB_PARAMBYVAL or FB_SYMBATTRIB_PARAMBYDESC)) <> 0)
 2411 
 2412 #define symbIsParamBydescOrByref(s) (((s)->attrib and (FB_SYMBATTRIB_PARAMBYDESC or FB_SYMBATTRIB_PARAMBYREF)) <> 0)
 2413 
 2414 #define symbIsLocal(s) ((s->attrib and FB_SYMBATTRIB_LOCAL) <> 0)
 2415 
 2416 #define symbIsPublic(s) ((s->attrib and FB_SYMBATTRIB_PUBLIC) <> 0)
 2417 
 2418 #define symbIsPrivate(s) ((s->attrib and FB_SYMBATTRIB_PRIVATE) <> 0)
 2419 
 2420 #define symbIsExtern(s) ((s->attrib and FB_SYMBATTRIB_EXTERN) <> 0)
 2421 
 2422 #define symbIsExport(s) ((s->attrib and FB_SYMBATTRIB_EXPORT) <> 0)
 2423 
 2424 #define symbIsImport(s) ((s->attrib and FB_SYMBATTRIB_IMPORT) <> 0)
 2425 
 2426 #define symbIsOverloaded(s) ((s->attrib and FB_SYMBATTRIB_OVERLOADED) <> 0)
 2427 
 2428 #define symbIsConstructor(s) ((s->attrib and FB_SYMBATTRIB_CONSTRUCTOR) <> 0)
 2429 
 2430 #define symbIsDestructor(s) ((s->attrib and FB_SYMBATTRIB_DESTRUCTOR) <> 0)
 2431 
 2432 #define symbIsOperator(s) ((s->attrib and FB_SYMBATTRIB_OPERATOR) <> 0)
 2433 
 2434 #define symbIsProperty(s) ((s->attrib and FB_SYMBATTRIB_PROPERTY) <> 0)
 2435 
 2436 #define symbIsMethod(s) ((s->attrib and FB_SYMBATTRIB_METHOD) <> 0)
 2437 
 2438 #define symbIsDescriptor(s) ((s->attrib and FB_SYMBATTRIB_DESCRIPTOR) <> 0)
 2439 
 2440 #define symbIsConstant(s) ((s->attrib and FB_SYMBATTRIB_CONST) <> 0)
 2441 
 2442 #define symbGetIsLiteral(s) ((s->attrib and FB_SYMBATTRIB_LITERAL) <> 0)
 2443 
 2444 #define symbIsRef(s) ((s->attrib and FB_SYMBATTRIB_REF) <> 0)
 2445 
 2446 #define symbIsNaked( s ) (((s)->attrib and FB_SYMBATTRIB_NAKED) <> 0)
 2447 
 2448 #define symbIsAbstract(s) ((s->attrib and FB_SYMBATTRIB_ABSTRACT) <> 0)
 2449 
 2450 #define symbIsVirtual(s) ((s->attrib and FB_SYMBATTRIB_VIRTUAL) <> 0)
 2451 
 2452 #define symbGetProcStaticLocals(s) ((s->attrib and FB_SYMBATTRIB_STATICLOCALS) <> 0)
 2453 
 2454 #define symbIsSuffixed(s) ((s->attrib and FB_SYMBATTRIB_SUFFIXED) <> 0)
 2455 
 2456 #define symbGetCurrentProcName( ) symbGetName( parser.currproc )
 2457 
 2458 #define symbGetLastLabel( ) symb.lastlbl
 2459 #define symbSetLastLabel( l ) symb.lastlbl = l
 2460 
 2461 '' assuming all UDT's extend FBS_NAMESPACE
 2462 #define symbCompAllocExt( ) listNewNode( @symb.nsextlist )
 2463 
 2464 #define symbCompFreeExt( n ) listDelNode( @symb.nsextlist, n )
 2465 
 2466 #define symbGetCompSymbTb( s ) symbGetNamespaceSymbTb( s )
 2467 
 2468 #define symbGetCompHashTb( s ) symbGetNamespaceHashTb( s )
 2469 
 2470 #define symbGetCompExt( s ) s->nspc.ns.ext
 2471 
 2472 #define symbGetCompImportHead( s ) s->nspc.ns.ext->implist.head
 2473 
 2474 #define symbGetCompExportHead( s ) s->nspc.ns.ext->explist.head
 2475 
 2476 #define symbLookupCompField( parent, id ) symbLookupAt( parent, id, FALSE, TRUE )
 2477 
 2478 '' datatype accessors
 2479 
 2480 #define typeGetClass( dt ) symb_dtypeTB(typeGet( dt )).class
 2481 #define typeGetSize( dt ) symb_dtypeTB(typeGet( dt )).size
 2482 #define typeGetBits( dt ) (typeGetSize( dt ) * 8)
 2483 #define typeIsSigned( dt ) symb_dtypeTB(typeGet( dt )).signed
 2484 #define typeGetIntRank( dt ) symb_dtypeTB(typeGet( dt )).intrank
 2485 #define typeGetRemapType( dt ) symb_dtypeTB(typeGet( dt )).remaptype
 2486 #define typeGetSizeType( dt ) symb_dtypeTB(typeGet( dt )).sizetype
 2487 
 2488 #define typeRemap( dtype ) typeJoin( dtype, symb_dtypeTB(dtype).remaptype )
 2489 
 2490 #define typeGet( dt ) iif( dt and FB_DT_PTRMASK, FB_DATATYPE_POINTER, dt and FB_DT_TYPEMASK )
 2491 #define typeGetDtOnly( dt ) (dt and FB_DT_TYPEMASK)
 2492 #define typeGetDtAndPtrOnly( dt ) (dt and (FB_DT_TYPEMASK or FB_DT_PTRMASK))
 2493 #define typeGetDtPtrAndMangleDtOnly( dt ) (dt and (FB_DT_TYPEMASK or FB_DT_PTRMASK or FB_DT_MANGLEMASK))
 2494 #define typeJoin( dt, ndt ) ((dt and (not (FB_DT_TYPEMASK or FB_DT_PTRMASK))) or (ndt and (FB_DT_TYPEMASK or FB_DT_PTRMASK)))
 2495 #define typeJoinDtOnly( dt, ndt ) ((dt and (not FB_DT_TYPEMASK)) or (ndt and FB_DT_TYPEMASK))
 2496 
 2497 #define typeAddrOf( dt ) _
 2498     ((dt and FB_DT_TYPEMASK) or _
 2499      ((dt and FB_DT_PTRMASK) + (1 shl FB_DT_PTRPOS)) or _
 2500      ((dt and FB_DT_CONSTMASK) shl 1) or _
 2501      (dt and FB_DT_MANGLEMASK))
 2502 
 2503 #define typeMultAddrOf( dt, cnt ) _
 2504     ((dt and FB_DT_TYPEMASK) or _
 2505      ((dt and FB_DT_PTRMASK) + (cnt shl FB_DT_PTRPOS)) or _
 2506      ((dt and FB_DT_CONSTMASK) shl cnt) or _
 2507      (dt and FB_DT_MANGLEMASK))
 2508 
 2509 #define typeDeref( dt ) _
 2510     ((dt and FB_DT_TYPEMASK) or _
 2511      ((dt and FB_DT_PTRMASK) - (1 shl FB_DT_PTRPOS)) or _
 2512      (((dt and FB_DT_CONSTMASK) shr 1) and FB_DT_CONSTMASK) or _
 2513      (dt and FB_DT_MANGLEMASK))
 2514 
 2515 #define typeMultDeref( dt, cnt ) _
 2516     ((dt and FB_DT_TYPEMASK) or _
 2517      ((dt and FB_DT_PTRMASK) - (cnt shl FB_DT_PTRPOS)) or _
 2518      (((dt and FB_DT_CONSTMASK) shr cnt) and FB_DT_CONSTMASK) or _
 2519      (dt and FB_DT_MANGLEMASK))
 2520 
 2521 #define typeIsPtr( dt ) (((dt and FB_DT_PTRMASK) <> 0))
 2522 #define typeGetPtrCnt( dt ) ((dt and FB_DT_PTRMASK) shr FB_DT_PTRPOS)
 2523 
 2524 #define typeIsConstAt( dt, at ) ((dt and (1 shl (FB_DT_CONSTPOS + at))) <> 0)
 2525 #define typeIsConst( dt ) typeIsConstAt(dt, 0)
 2526 #define typeSetIsConst( dt ) (dt or (1 shl FB_DT_CONSTPOS))
 2527 #define typeUnsetIsConst( dt ) (dt and not (1 shl FB_DT_CONSTPOS))
 2528 #define typeGetConstMask( dt ) (dt and FB_DT_CONSTMASK)
 2529 #define typeGetPtrConstMask( dt ) _
 2530     (typeGetConstMask( dt ) and not (1 shl FB_DT_CONSTPOS))
 2531 
 2532 #define typeIsRef( dt ) ((dt and FB_DATATYPE_REFERENCE) <> 0)
 2533 #define typeSetIsRef( dt ) (dt or FB_DATATYPE_REFERENCE)
 2534 #define typeUnsetIsRef( dt ) (dt and not FB_DATATYPE_REFERENCE)
 2535 
 2536 #define typeHasMangleDt( dt ) (((dt and FB_DT_MANGLEMASK) <> 0))
 2537 #define typeGetMangleDt( dt ) ((dt and FB_DT_MANGLEMASK) shr FB_DT_MANGLEPOS)
 2538 #define typeSetMangleDt( dt, mangle_dt ) ((dt and not FB_DT_MANGLEMASK) or ((mangle_dt shl FB_DT_MANGLEPOS) and FB_DT_MANGLEMASK ))
 2539 
 2540 declare sub symbForEachGlobal _
 2541     ( _
 2542         byval symclass as integer, _
 2543         byval callback as sub( byval as FBSYMBOL ptr ) _
 2544     )
 2545 
 2546 #if __FB_DEBUG__
 2547 declare function typeDumpToStr _
 2548     ( _
 2549         byval dtype as integer, _
 2550         byval subtype as FBSYMBOL ptr _
 2551     ) as string
 2552 '' For debugging, e.g. use like this:
 2553 ''  symbTrace(a), "(replacing this)"
 2554 ''  symbTrace(b), "(with this)"
 2555 #define symbTrace( s ) print __FUNCTION__ + "(" & __LINE__ & "): "; symbDumpToStr( s )
 2556 declare function symbDumpToStr( byval s as FBSYMBOL ptr ) as string
 2557 declare sub symbDump( byval s as FBSYMBOL ptr )
 2558 declare sub symbDumpNamespace( byval ns as FBSYMBOL ptr )
 2559 declare sub symbDumpChain( byval chain_ as FBSYMCHAIN ptr )
 2560 
 2561 '' FBARRAY: 5 pointer/integer fields + the dimTB with 3 integer fields per dimension
 2562 #define symbDescriptorHasRoomFor( sym, dimensions ) (symbGetLen( sym ) = env.pointersize * (((dimensions) * 3) + 5))
 2563 #endif
 2564 
 2565 declare function symbDumpPrettyToStr( byval sym as FBSYMBOL ptr ) as string
 2566 
 2567 ''
 2568 '' inter-module globals
 2569 ''
 2570 extern symb as SYMBCTX
 2571 
 2572 extern symb_dtypeTB( 0 to FB_DATATYPES-1 ) as SYMB_DATATYPE
 2573 
 2574 extern symb_dtypeMatchTB(FB_DATATYPE_BOOLEAN to FB_DATATYPE_DOUBLE, FB_DATATYPE_BOOLEAN to FB_DATATYPE_DOUBLE) as integer