11 declare sub hTypeBody(
byval s
as FBSYMBOL
ptr )
15 byval parent as FBSYMBOL
ptr _
20 byval parent as FBSYMBOL
ptr _
24 if( symbGetIsUnique(
parent ) = FALSE )
then
46 byval parent as FBSYMBOL
ptr, _
47 byval attrib
as FB_SYMBATTRIB _
50 dim as integer is_nested =
any, tk =
any
53 if( symbGetUDTIsAnon(
parent ) )
then
61 if( fbLangOptIsSet( FB_LANG_OPT_CLASS ) = FALSE )
then
74 case FB_TK_CONSTRUCTOR
87 case FB_TK_SUB, FB_TK_FUNCTION, _
88 FB_TK_CONSTRUCTOR, FB_TK_DESTRUCTOR, _
89 FB_TK_OPERATOR, FB_TK_PROPERTY
93 FB_PROCOPT_ISPROTO
or FB_PROCOPT_HASPARENT, tk )
105 byval parent as FBSYMBOL
ptr, _
106 byval tk
as integer, _
107 byval attrib
as integer _
111 if( symbGetUDTIsAnon(
parent ) )
then
120 if( tk = FB_TK_CONST )
then
129 dim as FBSYMBOL
ptr defctor =
any, subtype =
any
137 if( symbGetType( sym ) = FB_DATATYPE_STRUCT )
then
138 subtype = symbGetSubtype( sym )
147 errReport( FB_ERRMSG_NOACCESSTODEFAULTCTOR )
151 errReport( FB_ERRMSG_NODEFAULTCTORDEFINED )
169 if( fbLangOptIsSet( FB_LANG_OPT_INITIALIZER ) = FALSE )
then
176 if( sym <>
NULL )
then
178 if( symbGetUDTIsUnionOrAnon(
parent ) )
then
188 if( sym =
NULL )
then
197 symbSetUDTHasInitedField(
parent )
202 if( symbGetType( sym ) = FB_DATATYPE_STRING )
then
205 symbSetDontInit( sym )
214 dim as ASTNODE
ptr initree =
cInitializer( sym, FB_INIOPT_ISINI )
218 errReport( FB_ERRMSG_INVALIDREFERENCETOLOCAL, TRUE )
226 assert( astDtorListIsEmpty( ) )
233 symbSetTypeIniTree( sym, initree )
243 byval parent as FBSYMBOL
ptr, _
244 byval attrib
as integer _
247 static as zstring * FB_MAXNAMELEN+1 id
248 static as FBARRAYDIM dTB(0
to FB_MAXARRAYDIMS-1)
249 dim as FBSYMBOL
ptr sym, subtype
250 dim as integer dims, dtype, bits
262 case FB_TKCLASS_IDENTIFIER, FB_TKCLASS_KEYWORD, FB_TKCLASS_QUIRKWD
264 if( lexGetPeriodPos( ) > 0 )
then
265 errReport( FB_ERRMSG_CANTINCLUDEPERIODS )
270 if( symbGetIsUnique(
parent ) )
then
271 errReport( FB_ERRMSG_KEYWORDFIELDSNOTALLOWEDINCLASSES )
273 symbSetUDTHasKwdField(
parent )
281 errReport( FB_ERRMSG_EXPECTEDIDENTIFIER )
298 errReport( FB_ERRMSG_INVALIDBITFIELD, TRUE )
319 if( typeGet( dtype ) = FB_DATATYPE_STRUCT )
then
320 if( subtype =
parent )
then
323 dtype = FB_DATATYPE_INTEGER
334 if( sym =
NULL )
then
337 symbGetAttrib( sym )
or= attrib
355 byval parent as FBSYMBOL
ptr, _
356 byval attrib
as integer _
359 static as zstring * FB_MAXNAMELEN+1 id
360 static as FBARRAYDIM dTB(0
to FB_MAXARRAYDIMS-1)
361 dim as FBSYMBOL
ptr sym, subtype
362 dim as integer dims, dtype, bits
367 case FB_TKCLASS_IDENTIFIER, FB_TKCLASS_KEYWORD, FB_TKCLASS_QUIRKWD
372 if( lexGetType( ) <> FB_DATATYPE_INVALID )
then
377 if( lexGetPeriodPos( ) > 0 )
then
378 errReport( FB_ERRMSG_CANTINCLUDEPERIODS )
383 if( symbGetIsUnique(
parent ) )
then
384 errReport( FB_ERRMSG_KEYWORDFIELDSNOTALLOWEDINCLASSES )
386 symbSetUDTHasKwdField(
parent )
393 errReport( FB_ERRMSG_EXPECTEDIDENTIFIER )
396 dtype = FB_DATATYPE_INVALID
447 errReport( FB_ERRMSG_INVALIDBITFIELD, TRUE )
454 if( dtype = FB_DATATYPE_STRUCT )
then
455 if( subtype =
parent )
then
458 dtype = FB_DATATYPE_INTEGER
470 if( sym =
NULL )
then
475 sym->attrib
or= attrib
483 byval parent as FBSYMBOL
ptr, _
484 byval attrib
as integer _
488 if( symbGetUDTIsAnon(
parent ) )
then
489 errReport( FB_ERRMSG_STATICVARINANONUDT )
498 symbSetUdtHasStaticVar(
parent )
510 attrib
or= FB_SYMBATTRIB_EXTERN
or _
511 FB_SYMBATTRIB_SHARED
or _
514 cVarDecl( attrib, FALSE, FB_TK_EXTERN, FALSE )
520 byval parent as FBSYMBOL
ptr, _
521 byval id
as zstring ptr, _
522 byval id_alias
as zstring ptr, _
523 byval isunion
as integer, _
524 byval align
as integer, _
525 byval baseSubtype
as FBSYMBOL
ptr =
NULL _
528 dim as FBSYMBOL
ptr s =
any
563 if(
lexGetToken( ) <>
iif( isunion, FB_TK_UNION, FB_TK_TYPE ) )
then
591 if( expr =
NULL )
then
592 errReport( FB_ERRMSG_EXPECTEDEXPRESSION )
597 if( astIsCONST( expr ) = FALSE )
then
608 elseif( align > env.pointersize )
then
610 elseif( align = 3 )
then
625 dim as integer isunion =
any
626 dim as FB_SYMBATTRIB attrib =
any
627 dim as FBSYMBOL
ptr inner =
any
629 attrib = FB_SYMBATTRIB_NONE
634 case FB_TK_PRIVATE, FB_TK_PUBLIC, FB_TK_PROTECTED
635 if( symbGetUDTIsUnion( s ) )
then
641 attrib = FB_SYMBATTRIB_NONE
643 attrib = FB_SYMBATTRIB_VIS_PRIVATE
645 attrib = FB_SYMBATTRIB_VIS_PROTECTED
658 case FB_TK_COMMENT, FB_TK_REM
674 case FB_TK_AS, CHAR_LPRNT, FB_TK_STMTSEP
684 case FB_TK_TYPE, FB_TK_UNION
687 case FB_TK_EOL, FB_TK_EOF, FB_TK_COMMENT, FB_TK_REM, _
692 if( symbGetUDTIsUnion( s ) = isunion )
then
695 isunion =
not isunion
703 align = symbGetUDTAlign( s )
710 symbSetUDTIsUnion( inner )
711 symbSetUDTHasAnonUnion( s )
716 dim as FBSYMBOL
ptr walkSymbols = symbGetUDTSymbTbHead( inner )
717 do while( walkSymbols <>
NULL )
718 symbGetAttrib( walkSymbols )
or= attrib
719 walkSymbols = symbGetNext( walkSymbols )
750 case FB_TK_ENUM, FB_TK_CONST
797 dim as FBSYMBOL
ptr member =
any
799 if( parser.
scope > FB_MAINSCOPE )
then
805 member = symbGetCompSymbTb( sym ).head
807 if( symbIsProc( member ) )
then
808 errReportEx( FB_ERRMSG_NOOOPINFUNCTIONS, symbGetName( member ) )
810 member = member->
next
820 static as zstring * FB_MAXNAMELEN+1 id
821 dim as integer isunion =
any, checkid =
any
822 dim as FBSYMBOL
ptr sym =
any
823 dim as FB_CMPSTMTSTK
ptr stk =
any
833 case FB_TKCLASS_IDENTIFIER
835 case FB_TKCLASS_KEYWORD
836 if( isunion = FALSE )
then
845 errReport( FB_ERRMSG_EXPECTEDIDENTIFIER )
849 case FB_TKCLASS_QUIRKWD
852 errReport( FB_ERRMSG_EXPECTEDIDENTIFIER )
861 if( fbLangOptIsSet( FB_LANG_OPT_PERIODS ) )
then
863 if( symbIsGlobalNamespc( ) = FALSE )
then
864 if( lexGetPeriodPos( ) > 0 )
then
865 errReport( FB_ERRMSG_CANTINCLUDEPERIODS )
895 dim as FBSYMBOL
ptr baseSubtype =
NULL
900 dim as integer baseDtype
904 if( baseDType <> FB_DATATYPE_STRUCT )
then
917 FB_CMPSTMT_MASK_ALL
and (
not FB_CMPSTMT_MASK_CODE) _
918 and (
not FB_CMPSTMT_MASK_DATA) )
923 dim as ASTNODE
ptr currproc = ast.proc.curr, currblock = ast.currblock
924 dim as FBSYMBOL
ptr currprocsym = parser.currproc, currblocksym = parser.currblock
925 dim as integer scope_depth = parser.
scope
927 sym =
hTypeAdd(
NULL, id, palias, isunion, align, baseSubtype )
930 ast.proc.curr = currproc
931 ast.currblock = currblock
933 parser.currproc = currprocsym
934 parser.currblock = currblocksym
935 parser.
scope = scope_depth
941 if( stk <>
NULL )
then
946 if( symbGetIsUnique( sym ) )
then
948 dim as FBSYMCHAIN
ptr chain_ =
symbLookupAt( symbGetCurrentNamespc( ), _
953 if( chain_ <>
NULL )
then
954 if( chain_->sym <> sym )
then
960 if( symbGetUDTHasKwdField( sym ) )
then
961 errReport( FB_ERRMSG_KEYWORDFIELDSNOTALLOWEDINCLASSES )
966 if( symbGetUdtHasRecByvalParam( sym ) )
then
973 if( symbGetUdtHasRecByvalRes( sym ) )
then
979 dim as FBSYMBOL
ptr sym =
any, param =
any
982 sym = symbGetUDTSymbtb(
parent ).head
984 if( symbIsProc( sym ) )
then
986 param = symbGetProcHeadParam( sym )
989 if( (symbGetType( param ) = FB_DATATYPE_STRUCT)
and _
990 (symbGetSubtype( param ) =
parent) )
then
991 if( symbGetParamMode( param ) = FB_PARAMMODE_BYVAL )
then
1008 byval parent as FBSYMBOL
ptr _
1011 dim as FBSYMBOL
ptr sym
1014 sym = symbGetUDTSymbtb(
parent ).head
1015 do while( sym <>
NULL )
1016 if( symbIsProc( sym ) )
then
1018 if( symbGetSubtype( sym ) =
parent )
then