14 byval dtype
as integer, _
15 byval subtype
as FBSYMBOL
ptr _
18 if( typeGetDtAndPtrOnly( dtype ) = FB_DATATYPE_STRUCT )
then
20 errReport( FB_ERRMSG_OBJECTOFABSTRACTCLASS )
28 byref dtype
as integer, _
29 byref subtype
as FBSYMBOL
ptr, _
30 byref lgt
as longint _
34 if(
cSymbolType( dtype, subtype, lgt ) = FALSE )
then
37 dtype = FB_DATATYPE_INTEGER
39 lgt = typeGetSize( dtype )
43 if( dtype = FB_DATATYPE_VOID )
then
46 dtype = typeAddrOf( dtype )
48 lgt = typeGetSize( dtype )
54 if( parser.
scope > FB_MAINSCOPE )
then
55 if( fbIsModLevel( ) = FALSE )
then
58 errReport( FB_ERRMSG_ILLEGALINSIDEASCOPE )
72 dim as integer dopreserve =
any, tk =
any
74 #macro hCheckPrivPubAttrib( attrib )
75 if( (attrib
and (FB_SYMBATTRIB_PUBLIC
or FB_SYMBATTRIB_PRIVATE)) <> 0 )
then
76 errReport( FB_ERRMSG_PRIVORPUBTTRIBNOTALLOWED )
77 attrib
and=
not FB_SYMBATTRIB_PUBLIC
or FB_SYMBATTRIB_PRIVATE
85 select case as const tk
94 hCheckPrivPubAttrib( attrib )
97 attrib
or= FB_SYMBATTRIB_DYNAMIC
100 if(
hMatch( FB_TK_PRESERVE ) )
then
109 attrib = FB_SYMBATTRIB_STATIC
or FB_SYMBATTRIB_DYNAMIC
111 attrib
or= FB_SYMBATTRIB_COMMON
or _
112 FB_SYMBATTRIB_STATIC
or _
113 FB_SYMBATTRIB_DYNAMIC
116 hCheckPrivPubAttrib( attrib )
122 if( attrib = FB_SYMBATTRIB_NONE )
then
132 attrib = FB_SYMBATTRIB_STATIC
134 attrib
or= FB_SYMBATTRIB_EXTERN
or _
135 FB_SYMBATTRIB_SHARED
or _
139 hCheckPrivPubAttrib( attrib )
152 attrib
or= FB_SYMBATTRIB_STATIC
171 if( env.opt.
dynamic )
then
172 attrib
or= FB_SYMBATTRIB_DYNAMIC
175 if( (attrib
and FB_SYMBATTRIB_EXTERN) = 0 )
then
181 attrib
or= FB_SYMBATTRIB_STATIC
183 attrib
or= FB_SYMBATTRIB_SHARED
or _
194 select case env.clopt.target
195 case FB_COMPTARGET_WIN32, FB_COMPTARGET_CYGWIN
196 attrib
or= FB_SYMBATTRIB_IMPORT
201 if( symbGetProcStaticLocals( parser.currproc ) )
then
202 attrib
or= FB_SYMBATTRIB_STATIC
205 cVarDecl( attrib, dopreserve, tk, FALSE )
212 byval dimensions
as integer, _
213 exprTB()
as ASTNODE
ptr _
216 for i
as integer = 0
to dimensions-1
217 if( astIsCONST( exprTB(i, 0) ) = FALSE )
then
219 elseif( exprTB(i, 1) = NULL )
then
221 elseif( astIsCONST( exprTB(i, 1) ) = FALSE )
then
233 byval sym
as FBSYMBOL
ptr, _
234 byval attrib
as FB_SYMBATTRIB _
239 symbSetAttrib( sym, (symbGetAttrib( sym )
and (
not FB_SYMBATTRIB_EXTERN))
or _
240 FB_SYMBATTRIB_PUBLIC
or FB_SYMBATTRIB_SHARED )
243 if( symbGetArrayDimensions( sym ) <> 0 )
then
244 dim as FBSYMBOL
ptr desc = symbGetArrayDescriptor( sym )
246 attrib = (symbGetAttrib( desc )
and (
not FB_SYMBATTRIB_EXTERN))
or _
250 if( symbIsDynamic( sym ) = FALSE )
then
251 attrib
and=
not FB_SYMBATTRIB_PUBLIC
253 attrib
or= FB_SYMBATTRIB_PUBLIC
256 symbSetAttrib( desc, attrib )
268 byval sym
as FBSYMBOL
ptr, _
269 byval id
as zstring ptr, _
270 byval dimensions
as integer, _
271 dTB()
as FBARRAYDIM _
274 dim as FBVARDIM
ptr d =
any
275 dim as integer i =
any
278 if( symbGetArrayDimensions( sym ) = 0 )
then
283 if( dimensions <> symbGetArrayDimensions( sym ) )
then
289 d = symbGetArrayFirstDim( sym )
293 if( ((d->lower <> dTB(i).lower)
or _
294 (d->upper <> dTB(i).upper) )
and _
295 (dTB(i).upper <> FB_ARRAYDIM_UNKNOWN) )
then
296 errReportEx( FB_ERRMSG_BOUNDSDIFFERFROMEXTERN, *id )
308 byval sym
as FBSYMBOL
ptr, _
309 byval id
as zstring ptr, _
310 byval dtype
as integer, _
311 byval subtype
as FBSYMBOL
ptr, _
312 byval attrib
as integer, _
313 byval addsuffix
as integer, _
314 byval dimensions
as integer, _
315 dTB()
as FBARRAYDIM _
320 if( sym = NULL )
then
325 if( symbIsExtern( sym ) = FALSE )
then
330 if( (dtype <> symbGetFullType( sym ))
or _
331 (subtype <> symbGetSubType( sym )) )
then
335 dim as integer setattrib = TRUE
338 if( symbIsDynamic( sym ) )
then
339 if( (attrib
and FB_SYMBATTRIB_DYNAMIC) = 0 )
then
345 if( (attrib
and FB_SYMBATTRIB_DYNAMIC) <> 0 )
then
359 if( (attrib
and FB_SYMBATTRIB_EXTERN) <> 0 )
then
374 byval sym
as FBSYMBOL
ptr, _
375 byval id
as zstring ptr, _
376 byval idalias
as zstring ptr, _
377 byval dtype
as integer, _
378 byval subtype
as FBSYMBOL
ptr, _
379 byval lgt
as longint, _
380 byval addsuffix
as integer, _
381 byval attrib
as integer, _
382 byval dimensions
as integer, _
383 dTB()
as FBARRAYDIM _
387 dim as integer is_extern =
any
388 if( sym <> NULL )
then
389 is_extern = symbIsExtern( sym )
395 if( is_extern = FALSE )
then
396 dim as FB_SYMBOPT options = FB_SYMBOPT_NONE
399 attrib
or= FB_SYMBATTRIB_SUFFIXED
402 if( fbLangOptIsSet( FB_LANG_OPT_SCOPE ) = FALSE )
then
403 options
or= FB_SYMBOPT_UNSCOPE
406 sym =
symbAddVar( id, idalias, dtype, subtype, lgt, _
407 dimensions, dTB(), attrib, options )
412 addsuffix, dimensions, dTB() )
415 if( sym = NULL )
then
426 byval sym
as FBSYMBOL
ptr, _
427 byval id
as zstring ptr, _
428 byval idalias
as zstring ptr, _
429 byval dtype
as integer, _
430 byval subtype
as FBSYMBOL
ptr, _
431 byval is_typeless
as integer, _
432 byval lgt
as longint, _
433 byval addsuffix
as integer, _
434 byval attrib
as integer, _
435 byval dimensions
as integer, _
436 byval token
as integer _
439 static as FBARRAYDIM dTB(0
to FB_MAXARRAYDIMS-1)
443 if( dimensions <> -1 )
then
452 if( sym <> NULL )
then
454 if( symbIsField( sym ) )
then
460 if( is_typeless )
then
461 dtype = symbGetType( sym )
462 subtype = symbGetSubtype( sym )
463 lgt = symbGetLen( sym )
468 if( sym = NULL )
then
469 dim as FB_SYMBOPT options = FB_SYMBOPT_NONE
472 attrib
or= FB_SYMBATTRIB_SUFFIXED
475 if( fbLangOptIsSet( FB_LANG_OPT_SCOPE ) = FALSE )
then
476 options
or= FB_SYMBOPT_UNSCOPE
479 sym =
symbAddVar( id, idalias, dtype, subtype, lgt, _
480 dimensions, dTB(), attrib, options )
485 if( symbGetIsDynamic( sym ) = FALSE )
then
487 sym =
hDeclExternVar( sym, id, dtype, subtype, attrib, addsuffix, _
493 if( symbIsExtern( sym ) )
then
495 if( (attrib
and FB_SYMBATTRIB_EXTERN) <> 0 )
then
502 elseif( dimensions = -1 )
then
506 elseif( (token <> FB_TK_REDIM)
and (symbIsCommon( sym ) = FALSE) )
then
512 if( sym = NULL )
then
520 if( typeIsConst( symbGetFullType( sym ) ) )
then
521 errReport( FB_ERRMSG_DYNAMICARRAYSCANTBECONST )
524 attrib = symbGetAttrib( sym )
527 if( (attrib
and FB_SYMBATTRIB_EXTERN) <> 0 )
then
531 if( (dtype <> symbGetFullType( sym ))
or _
532 (subtype <> symbGetSubType( sym )) )
then
540 if( (attrib
and (FB_SYMBATTRIB_PARAMBYDESC
or FB_SYMBATTRIB_COMMON)) = 0 )
then
541 if( symbGetArrayDimensions( sym ) > 0 )
then
542 if( dimensions <> symbGetArrayDimensions( sym ) )
then
551 if( (attrib
and FB_SYMBATTRIB_COMMON) <> 0 )
then
552 if( dimensions > symbGetArrayDimensions( sym ) )
then
553 symbSetArrayDimensions( sym, dimensions )
556 elseif( symbGetArrayDimensions( sym ) = -1 )
then
557 symbSetArrayDimensions( sym, dimensions )
566 byval parent as FBSYMBOL
ptr, _
567 byval id
as zstring ptr, _
568 byref suffix
as integer, _
569 byval options
as FB_IDOPT _
572 dim as FBSYMCHAIN
ptr chain_ =
any
576 chain_ = lexGetSymChain( )
581 (options
and FB_IDOPT_ISDECL) = 0 )
586 case FB_TKCLASS_IDENTIFIER
587 if( fbLangOptIsSet( FB_LANG_OPT_PERIODS ) )
then
589 if( symbIsGlobalNamespc( ) = FALSE )
then
590 if( lexGetPeriodPos( ) > 0 )
then
591 errReport( FB_ERRMSG_CANTINCLUDEPERIODS )
597 suffix = lexGetType( )
599 case FB_TKCLASS_QUIRKWD
600 if( env.clopt.lang <> FB_LANG_QB )
then
602 if( (
parent = NULL)
or (parser.
scope > FB_MAINSCOPE) )
then
606 suffix = FB_DATATYPE_INVALID
609 suffix = lexGetType( )
615 suffix = lexGetType( )
618 case FB_TKCLASS_KEYWORD, FB_TKCLASS_OPERATOR
619 if( env.clopt.lang <> FB_LANG_QB )
then
623 suffix = FB_DATATYPE_INVALID
628 suffix = lexGetType( )
631 if( suffix = FB_DATATYPE_INVALID )
then
635 suffix = FB_DATATYPE_INVALID
640 errReport( FB_ERRMSG_EXPECTEDIDENTIFIER )
643 suffix = FB_DATATYPE_INVALID
646 hCheckSuffix( suffix )
656 byval chain_ as FBSYMCHAIN
ptr, _
657 byval dtype
as integer, _
658 byval is_typeless
as integer, _
659 byval has_suffix
as integer _
662 dim as FBSYMBOL
ptr sym =
any
668 if( is_typeless )
then
669 if( fbLangOptIsSet( FB_LANG_OPT_DEFTYPE ) )
then
674 elseif( has_suffix )
then
685 byval parent as FBSYMBOL
ptr, _
686 byval chain_ as FBSYMCHAIN
ptr, _
687 byval dtype
as integer, _
688 byval is_typeless
as integer, _
689 byval has_suffix
as integer, _
690 byval is_decl
as integer _
693 dim as FBSYMBOL
ptr sym =
any
705 if( ((symbIsExtern( sym ) = FALSE)
or _
706 (symbGetNamespace( sym ) <>
parent))
and _
712 errReport( FB_ERRMSG_DECLOUTSIDENAMESPC, TRUE )
722 if( (symbGetNamespace( sym ) <> symbGetCurrentNamespc( ))
and _
734 byval dimensions
as integer, _
735 exprTB()
as ASTNODE
ptr, _
736 dTB()
as FBARRAYDIM _
739 if( dimensions = -1 )
then
743 for i
as integer = 0
to dimensions-1
744 dim as ASTNODE
ptr expr =
any
751 if( expr = NULL )
then
755 dTB(i).upper = FB_ARRAYDIM_UNKNOWN
763 if( (dTB(i).upper < dTB(i).lower)
or (dTB(i).upper = FB_ARRAYDIM_UNKNOWN) )
then
773 byval sym
as FBSYMBOL
ptr, _
774 byval is_decl
as integer, _
775 byval has_defctor
as integer _
780 if( sym = NULL )
then
786 if( symbIsExtern( sym ) )
then
792 if( typeIsConst( symbGetFullType( sym ) ) )
then
793 errReport( FB_ERRMSG_AUTONEEDSINITIALIZER )
799 if( has_defctor )
then
801 if( (
not is_decl)
and ((symbGetAttrib( sym )
and (FB_SYMBATTRIB_DYNAMIC
or FB_SYMBATTRIB_COMMON)) = 0) )
then
804 errReport( FB_ERRMSG_NOACCESSTODEFAULTCTOR )
811 errReport( FB_ERRMSG_NODEFAULTCTORDEFINED )
819 byval sym
as FBSYMBOL
ptr _
824 if( sym <> NULL )
then
826 if sym->var_.array.has_ellipsis
then
837 byval sym
as FBSYMBOL
ptr, _
838 byval isdecl
as integer _
841 dim as integer attrib =
any, ignoreattribs =
any
842 dim as ASTNODE
ptr initree =
any
846 if( sym <> NULL )
then
847 attrib = symbGetAttrib( sym )
854 ((attrib
and (FB_SYMBATTRIB_EXTERN
or FB_SYMBATTRIB_COMMON)) <> 0) )
then
855 errReport( FB_ERRMSG_CANNOTINITEXTERNORCOMMON )
861 if( fbLangOptIsSet( FB_LANG_OPT_INITIALIZER ) = FALSE )
then
871 if( sym = NULL )
then
882 errReport( FB_ERRMSG_CANTUSEANYINITELLIPSIS )
887 if( symbGetType( sym ) = FB_DATATYPE_STRING )
then
890 symbSetDontInit( sym )
894 if( typeIsConst( symbGetFullType( sym ) ) )
then
895 errReport( FB_ERRMSG_AUTONEEDSINITIALIZER )
905 if( initree = NULL )
then
911 if( (symbGetAttrib( sym )
and (FB_SYMBATTRIB_STATIC
or FB_SYMBATTRIB_SHARED)) <> 0 )
then
951 symbGetStats( sym )
and=
not FB_SYMBSTATS_INITIALIZED
959 ignoreattribs = FB_SYMBATTRIB_TEMP
or FB_SYMBATTRIB_DESCRIPTOR
962 if( symbIsShared( sym ) = FALSE )
then
963 ignoreattribs
or= FB_SYMBATTRIB_STATIC
967 errReport( FB_ERRMSG_INVALIDREFERENCETOLOCAL )
970 symbGetStats( sym )
and=
not FB_SYMBSTATS_INITIALIZED
981 byval var_decl
as ASTNODE
ptr _
985 if( fbLangOptIsSet( FB_LANG_OPT_SCOPE ) )
then
998 dim as ASTNODE
ptr t =
any
999 dim as FBARRAYDIM dTB(0) =
any
1000 dim as FBSYMBOL
ptr flag =
any, label =
any
1004 0, dTB(), FB_SYMBATTRIB_STATIC )
1005 symbSetIsImplicit( flag )
1027 byval sym
as FBSYMBOL
ptr, _
1028 byval var_decl
as ASTNODE
ptr, _
1029 byval initree
as ASTNODE
ptr, _
1030 byval has_dtor
as integer _
1033 dim as ASTNODE
ptr t =
any, initcode =
any
1034 dim as FBSYMBOL
ptr proc =
any
1065 byval sym
as FBSYMBOL
ptr, _
1066 byval var_decl
as ASTNODE
ptr, _
1067 byval initree
as ASTNODE
ptr, _
1068 byval has_dtor
as integer _
1073 if( (initree = NULL)
and (has_dtor = FALSE) )
then
1080 assert( astDtorListIsEmpty( ) )
1091 byval sym
as FBSYMBOL
ptr, _
1092 byval var_decl
as ASTNODE
ptr, _
1093 byval initree
as ASTNODE
ptr, _
1094 byval has_dtor
as integer _
1106 if( initree = NULL )
then
1108 if( (symbGetAttrib( sym )
and (FB_SYMBATTRIB_STATIC
or _
1109 FB_SYMBATTRIB_SHARED
or _
1110 FB_SYMBATTRIB_COMMON)) <> 0 )
then
1114 if( symbIsLocal( sym ) )
then
1128 if( (symbGetAttrib( sym )
and (FB_SYMBATTRIB_STATIC
or _
1129 FB_SYMBATTRIB_SHARED
or _
1130 FB_SYMBATTRIB_COMMON)) = 0 )
then
1141 symbSetTypeIniTree( sym, initree )
1144 if( has_dtor = FALSE )
then
1152 symbGetStats( sym )
and=
not FB_SYMBSTATS_INITIALIZED
1156 if( symbIsLocal( sym ) )
then
1174 byval attrib
as integer, _
1175 byval dopreserve
as integer, _
1176 byval token
as integer, _
1177 byval is_fordecl
as integer _
1180 static as zstring * FB_MAXNAMELEN+1 id
1181 static as ASTNODE
ptr exprTB(0
to FB_MAXARRAYDIMS-1, 0
to 1)
1182 static as FBARRAYDIM dTB(0
to FB_MAXARRAYDIMS-1)
1183 dim as FBSYMBOL
ptr sym, subtype =
any
1184 dim as ASTNODE
ptr initree =
any, redimcall =
any
1185 dim as integer addsuffix =
any, is_multdecl =
any
1186 dim as integer is_typeless =
any, is_decl =
any, check_exprtb =
any
1187 dim as integer dtype =
any
1188 dim as longint lgt =
any
1189 dim as integer dimensions =
any, suffix =
any
1190 dim as zstring ptr palias =
any
1191 dim as ASTNODE
ptr assign_initree =
any
1192 dim as integer doassign =
any
1193 dim as integer has_ellipsis = FALSE
1194 dim as FB_IDOPT options =
any
1199 if( symbIsGlobalNamespc( ) = FALSE )
then
1200 if( fbIsModLevel( ) )
then
1202 attrib
or= FB_SYMBATTRIB_SHARED
or FB_SYMBATTRIB_STATIC
1221 options = FB_IDOPT_DEFAULT
or FB_IDOPT_ALLOWSTRUCT
or FB_IDOPT_ISVAR
1226 if( (token <> FB_TK_REDIM)
or ((attrib
and FB_SYMBATTRIB_SHARED) <> 0) )
then
1227 options
or= FB_IDOPT_ISDECL
1236 if( is_multdecl = FALSE )
then
1246 if( suffix <> FB_DATATYPE_INVALID )
then
1250 suffix = FB_DATATYPE_INVALID
1256 check_exprtb = FALSE
1257 if( (
lexGetToken( ) = CHAR_LPRNT)
and (is_fordecl = FALSE) )
then
1264 attrib
or= FB_SYMBATTRIB_DYNAMIC
1269 if( attrib
and FB_SYMBATTRIB_COMMON )
then
1280 for i
as integer = 0
to dimensions - 1
1281 if( exprTB(i,1) = NULL )
then
1298 if( token = FB_TK_REDIM )
then
1304 attrib
and=
not FB_SYMBATTRIB_DYNAMIC
1308 if( (attrib
and (FB_SYMBATTRIB_PUBLIC
or FB_SYMBATTRIB_EXTERN)) <> 0 )
then
1313 if( is_multdecl = FALSE )
then
1316 if( dtype <> FB_DATATYPE_INVALID )
then
1318 dtype = FB_DATATYPE_INVALID
1333 if( fbLangOptIsSet( FB_LANG_OPT_DEFTYPE ) = FALSE )
then
1335 if( (
chain_ = NULL)
or (token <> FB_TK_REDIM) )
then
1338 dtype = FB_DATATYPE_INTEGER
1342 if( dtype = FB_DATATYPE_INVALID )
then
1352 (suffix <> FB_DATATYPE_INVALID), _
1353 ((options
and FB_IDOPT_ISDECL) <> 0) )
1355 if( dimensions > 0 )
then
1358 if( token = FB_TK_DIM )
then
1359 if( (attrib
and FB_SYMBATTRIB_DYNAMIC) = 0 )
then
1360 if( sym <> NULL )
then
1361 if( symbIsCommon( sym ) )
then
1362 if( symbGetArrayDimensions( sym ) <> 0 )
then
1363 attrib
or= FB_SYMBATTRIB_DYNAMIC
1370 if( check_exprtb )
then
1372 if(
hIsConst( dimensions, exprTB() ) )
then
1374 if( (attrib
and FB_SYMBATTRIB_DYNAMIC) = 0 )
then
1379 attrib
or= FB_SYMBATTRIB_DYNAMIC
1384 if( (attrib
and FB_SYMBATTRIB_DYNAMIC) = 0 )
then
1386 ((attrib
and (FB_SYMBATTRIB_SHARED
or FB_SYMBATTRIB_STATIC)) = 0), _
1387 has_ellipsis ) = FALSE )
then
1395 elseif( dimensions = 0 )
then
1397 if( ((attrib
and (FB_SYMBATTRIB_SHARED
or FB_SYMBATTRIB_STATIC)) = 0)
and _
1398 (lgt > env.clopt.stacksize) )
then
1404 if( (attrib
and FB_SYMBATTRIB_COMMON) <> 0 )
then
1406 errReport( FB_ERRMSG_COMMONCANTBEOBJINST, TRUE )
1410 if( attrib
and FB_SYMBATTRIB_DYNAMIC )
then
1411 sym =
hDeclDynArray( sym, id, palias, dtype, subtype, is_typeless, _
1412 lgt, addsuffix, attrib, dimensions, token )
1416 lgt, addsuffix, attrib, _
1420 dim as integer has_defctor = FALSE, has_dtor = FALSE
1422 if( sym <> NULL )
then
1423 is_decl = symbGetIsDeclared( sym )
1426 if( has_ellipsis )
then
1427 sym->var_.array.has_ellipsis = TRUE
1434 if( is_fordecl = FALSE )
then
1438 assign_initree = NULL
1444 if( ( initree <> NULL )
and ( fbLangOptIsSet( FB_LANG_OPT_SCOPE ) = FALSE ) )
then
1446 if( (symbGetAttrib( sym )
and (FB_SYMBATTRIB_STATIC
or _
1447 FB_SYMBATTRIB_SHARED
or _
1448 FB_SYMBATTRIB_COMMON)) = 0 )
then
1467 assign_initree = initree
1474 errReport( FB_ERRMSG_MUSTHAVEINITWITHELLIPSIS )
1483 assign_initree = NULL
1488 if( sym <> NULL )
then
1490 dim as FBSYMBOL
ptr desc = NULL
1491 dim as ASTNODE
ptr var_decl = NULL
1494 if( is_decl = FALSE )
then
1498 ((initree = NULL)
and (
not is_fordecl)) )
1501 desc = symbGetArrayDescriptor( sym )
1502 if( desc <> NULL )
then
1510 if( token <> FB_TK_EXTERN )
then
1513 if( ((attrib
and FB_SYMBATTRIB_DYNAMIC) <> 0)
or (dimensions > 0) )
then
1515 if( is_decl = FALSE )
then
1517 if( (symbGetAttrib( sym )
and (FB_SYMBATTRIB_STATIC
or _
1518 FB_SYMBATTRIB_SHARED
or _
1519 FB_SYMBATTRIB_COMMON)) = 0 )
then
1526 if( desc <> NULL )
then
1528 symbSetTypeIniTree( desc, NULL )
1531 if( fbLangOptIsSet( FB_LANG_OPT_SCOPE ) )
then
1542 symbSetIsDeclared( sym )
1545 if( is_decl = FALSE )
then
1546 if( fbLangOptIsSet( FB_LANG_OPT_SCOPE ) )
then
1556 dim as ASTNODE
ptr assign_vardecl =
any
1563 assign_vardecl =
astNewDECL( sym, (assign_initree = NULL) )
1564 assign_vardecl =
hFlushDecl( assign_vardecl )
1570 AST_INIOPT_ISINI ) ) )
1576 if( ((attrib
and FB_SYMBATTRIB_DYNAMIC) <> 0)
and (dimensions > 0) )
then
1577 redimcall =
rtlArrayRedim( sym, symbGetLen( sym ), dimensions, exprTB(), _
1578 dopreserve, symbGetDontInit( sym ) = FALSE )
1583 if( symbIsStatic( sym )
and symbIsLocal( sym )
and _
1584 ((symbGetAttrib( sym )
and (FB_SYMBATTRIB_SHARED
or FB_SYMBATTRIB_COMMON)) = 0)
and _
1585 (
not is_decl) )
then
1596 if( is_fordecl )
then
1617 case CHAR_COMMA, CHAR_RPRNT, FB_TK_TO
1636 byref dimensions
as integer, _
1637 dTB()
as FBARRAYDIM, _
1638 byval checkprnts
as integer, _
1639 byval allow_ellipsis
as integer _
1642 dim as integer i =
any
1648 if( checkprnts )
then
1659 dim as integer dimension_has_ellipsis = FALSE
1663 dimension_has_ellipsis = TRUE
1667 dTB(i).lower = FB_ARRAYDIM_UNKNOWN
1677 if( dimension_has_ellipsis )
then
1678 errReport( FB_ERRMSG_CANTUSEELLIPSISASLOWERBOUND )
1684 dimension_has_ellipsis = TRUE
1685 dTB(i).upper = FB_ARRAYDIM_UNKNOWN
1692 dTB(i).upper = dTB(i).lower
1693 dTB(i).lower = env.opt.
base
1697 if( dimension_has_ellipsis = FALSE )
then
1700 if( (dTB(i).upper < dTB(i).lower)
or (dTB(i).upper = FB_ARRAYDIM_UNKNOWN) )
then
1715 if( i >= FB_MAXARRAYDIMS )
then
1716 errReport( FB_ERRMSG_TOOMANYDIMENSIONS )
1723 if( checkprnts )
then
1736 function hIntExpr(
byval defaultexpr
as ASTNODE
ptr )
as ASTNODE
ptr
1737 dim as ASTNODE
ptr expr =
any, intexpr =
any
1743 intexpr =
astNewCONV( FB_DATATYPE_INTEGER, NULL, expr )
1747 errReport( FB_ERRMSG_INVALIDDATATYPES, TRUE )
1752 errReport( FB_ERRMSG_EXPECTEDEXPRESSION )
1759 if( expr = NULL )
then
1760 if( defaultexpr )
then
1775 sub cArrayDecl(
byref dimensions
as integer, exprTB()
as ASTNODE
ptr )
1776 dim as integer i =
any
1782 dim as integer dimension_has_ellipsis = FALSE
1785 dimension_has_ellipsis = TRUE
1796 if( dimension_has_ellipsis )
then
1797 errReport( FB_ERRMSG_CANTUSEELLIPSISASLOWERBOUND )
1802 dimension_has_ellipsis = TRUE
1806 exprTB(i,1) =
hIntExpr( exprTB(i,0) )
1809 exprTB(i,1) = exprTB(i,0)
1823 if( i >= FB_MAXARRAYDIMS )
then
1824 errReport( FB_ERRMSG_TOOMANYDIMENSIONS )
1836 static as FBARRAYDIM dTB(0
to FB_MAXARRAYDIMS-1)
1837 static as zstring * FB_MAXNAMELEN+1 id
1838 dim as FBSYMBOL
ptr parent =
any, sym =
any
1841 if( fbLangOptIsSet( FB_LANG_OPT_AUTOVAR ) = FALSE )
then
1848 if(
cCompStmtIsAllowed( FB_CMPSTMT_MASK_DECL
or FB_CMPSTMT_MASK_CODE ) = FALSE )
then
1861 attrib
or= FB_SYMBATTRIB_STATIC
1863 attrib
or= FB_SYMBATTRIB_SHARED
or FB_SYMBATTRIB_STATIC
1869 if( symbGetProcStaticLocals( parser.currproc ) )
then
1870 attrib
or= FB_SYMBATTRIB_STATIC
1874 if( symbIsGlobalNamespc( ) = FALSE )
then
1875 if( fbIsModLevel( ) )
then
1877 attrib
or= FB_SYMBATTRIB_SHARED
or FB_SYMBATTRIB_STATIC
1884 FB_IDOPT_ALLOWSTRUCT
or FB_IDOPT_ISVAR )
1887 dim as integer suffix =
any
1890 if( suffix <> FB_DATATYPE_INVALID )
then
1911 if( expr = NULL )
then
1912 errReport( FB_ERRMSG_AUTONEEDSINITIALIZER )
1917 dim as integer dtype = astGetFullType( expr )
1918 dim as FBSYMBOL
ptr subtype = astGetSubType( expr )
1921 dim as integer has_ctor =
any, has_dtor =
any
1926 select case as const typeGetDtAndPtrOnly( dtype )
1928 case FB_DATATYPE_WCHAR
1929 errReport( FB_ERRMSG_INVALIDDATATYPES, TRUE )
1933 dtype = FB_DATATYPE_INTEGER
1937 case FB_DATATYPE_CHAR, FB_DATATYPE_FIXSTR
1938 dtype = FB_DATATYPE_STRING
1941 case typeAddrOf( FB_DATATYPE_FUNCTION )
1942 if( symbGetIsFuncPtr( subtype ) = FALSE )
then
1954 if( sym <> NULL )
then
1957 dim as ASTNODE
ptr initree =
any
1959 initree =
astTypeIniBegin( astGetFullType( expr ), subtype, symbIsLocal( sym ) )
1962 if( has_ctor = FALSE )
then
1967 dim as integer is_ctorcall =
any
1970 if( expr <> NULL )
then
1971 if( is_ctorcall )
then
1980 if( (symbGetAttrib( sym )
and (FB_SYMBATTRIB_STATIC
or _
1981 FB_SYMBATTRIB_SHARED)) <> 0 )
then
1983 if( has_ctor = FALSE )
then
1988 dtype = FB_DATATYPE_INTEGER
1998 symbSetIsInitialized( sym )
2001 dim as ASTNODE
ptr var_decl =
astNewDECL( sym, FALSE )
2004 symbSetIsDeclared( sym )