13 dim as ASTNODE
ptr expr =
any
14 dim as integer check_array =
any
16 check_array = fbGetCheckArray( )
17 fbSetCheckArray( TRUE )
19 fbSetCheckArray( check_array )
20 if( expr = NULL )
then
31 select case( typeGet( astGetDataType( expr ) ) )
32 case FB_DATATYPE_INTEGER
34 case FB_DATATYPE_POINTER
37 errReport( FB_ERRMSG_INVALIDARRAYINDEX, TRUE )
42 expr =
astNewCONV( FB_DATATYPE_INTEGER, NULL, expr )
43 if( expr = NULL )
then
44 errReport( FB_ERRMSG_INVALIDARRAYINDEX, TRUE )
55 byval dimexpr
as ASTNODE
ptr, _
56 byval d
as FBVARDIM
ptr _
60 if( dimexpr = NULL )
then
74 byval sym
as FBSYMBOL
ptr, _
75 byval idxexpr
as ASTNODE
ptr _
78 dim as integer maxdims =
any, dims =
any
79 dim as longint diff =
any
80 dim as ASTNODE
ptr expr =
any, dimexpr =
any
81 dim as FBVARDIM
ptr d =
any
86 maxdims = symbGetArrayDimensions( sym )
88 d = symbGetArrayFirstDim( sym )
92 if( dims > maxdims )
then
102 if( env.clopt.extraerrchk )
then
107 if( expr = NULL )
then
110 expr =
astNewBOP( AST_OP_ADD, expr, dimexpr )
131 if( dims < maxdims )
then
139 diff = symbGetArrayDiff( sym )
145 if( idxexpr <> NULL )
then
146 function =
astNewBOP( AST_OP_ADD, idxexpr, expr )
156 byval fld
as FBSYMBOL
ptr, _
157 byval checkarray
as integer _
160 dim as ASTNODE
ptr expr =
any
168 if( symbGetArrayDimensions( fld ) = 0 )
then
180 if( expr = NULL )
then
195 if( symbGetArrayDimensions( fld ) <> 0 )
then
196 if( checkarray )
then
204 if( expr = NULL )
then
221 dim as FBSYMBOL
ptr res =
any
231 case FB_TKCLASS_IDENTIFIER, FB_TKCLASS_KEYWORD, FB_TKCLASS_QUIRKWD
234 errReport( FB_ERRMSG_EXPECTEDIDENTIFIER )
242 case FB_TK_CONSTRUCTOR
244 case FB_TK_DESTRUCTOR
263 dim as FBSYMBOL
ptr sym =
chain_->sym
265 if( symbGetScope( sym ) = symbGetScope(
parent ) )
then
266 select case as const symbGetClass( sym )
268 case FB_SYMBCLASS_FIELD, FB_SYMBCLASS_VAR, _
269 FB_SYMBCLASS_CONST, FB_SYMBCLASS_ENUM
272 errReport( FB_ERRMSG_ILLEGALMEMBERACCESS )
276 case FB_SYMBCLASS_PROC
287 loop while( sym <> NULL )
290 loop while(
chain_ <> NULL )
306 byval dtype
as integer, _
307 byval subtype
as FBSYMBOL
ptr, _
308 byval varexpr
as ASTNODE
ptr, _
309 byval check_array
as integer, _
310 byval options
as FB_PARSEROPT _
314 dim as integer is_ptr = TRUE, mask = typeGetConstMask( dtype )
317 dim as FBSYMBOL
ptr fld =
hMemberId( subtype )
318 if( fld = NULL )
then
322 select case as const symbGetClass( fld )
324 case FB_SYMBCLASS_CONST
327 astDeltree( varexpr )
331 case FB_SYMBCLASS_ENUM
334 astDeltree( varexpr )
343 case FB_SYMBCLASS_FIELD
347 dtype = symbGetFullType( fld )
or mask
348 subtype = symbGetSubType( fld )
351 if( fldexpr = NULL )
then
356 dim as integer is_nidxarray = FALSE
357 if( astIsNIDXARRAY( fldexpr ) )
then
358 dim as ASTNODE
ptr tmpexpr = astGetLeft( fldexpr )
365 if( is_ptr = FALSE )
then
369 varexpr =
astNewBOP( AST_OP_ADD, varexpr, fldexpr )
375 if( is_nidxarray )
then
379 select case typeGet( dtype )
380 case FB_DATATYPE_STRUCT
393 case FB_SYMBCLASS_VAR
398 dtype = symbGetFullType( fld )
or mask
399 subtype = symbGetSubType( fld )
401 select case typeGet( dtype )
402 case FB_DATATYPE_STRUCT
414 case FB_SYMBCLASS_PROC
436 byval dtype
as integer, _
437 byval subtype
as FBSYMBOL
ptr, _
438 byval expr
as ASTNODE
ptr _
442 if( astIsCALL( expr ) )
then
454 byval dtype
as integer, _
455 byval varexpr
as ASTNODE
ptr, _
456 byval idxexpr
as ASTNODE
ptr _
463 if( astIsCALL( varexpr ) )
then
468 if( typeGet( dtype ) = FB_DATATYPE_STRING )
then
477 if( typeGet( dtype ) = FB_DATATYPE_WCHAR )
then
479 idxexpr =
astNewBOP( AST_OP_MUL, idxexpr, _
484 if( env.clopt.extraerrchk )
then
488 varexpr =
astNewBOP( AST_OP_ADD, varexpr, idxexpr )
491 if( typeGet( dtype ) = FB_DATATYPE_WCHAR )
then
492 dtype = typeJoin( dtype, env.target.wchar )
494 dtype = typeJoin( dtype, FB_DATATYPE_UBYTE )
507 byval dtype
as integer, _
508 byval subtype
as FBSYMBOL
ptr, _
509 byval varexpr
as ASTNODE
ptr, _
510 byval check_array
as integer _
513 dim as integer derefcnt =
any, is_field =
any
514 dim as longint lgt =
any
515 dim as ASTNODE
ptr idxexpr =
any
525 case FB_TK_FIELDDEREF
528 dim as integer is_ovl = FALSE
529 if( typeIsPtr( dtype ) = FALSE )
then
531 if( symb.globOpOvlTb(AST_OP_FLDDEREF).head = NULL )
then
532 errReport( FB_ERRMSG_EXPECTEDPOINTER, TRUE )
536 dim as FBSYMBOL
ptr proc =
any
537 dim as FB_ERRMSG err_num =
any
540 if( proc <> NULL )
then
543 if( varexpr = NULL )
then
550 astGetSubType( varexpr ), _
552 if( varexpr = NULL )
then
556 dtype = astGetFullType( varexpr )
557 subtype = astGetSubType( varexpr )
561 errReport( FB_ERRMSG_EXPECTEDPOINTER, TRUE )
567 dtype = typeDeref( dtype )
598 select case( typeGetDtAndPtrOnly( dtype ) )
599 case FB_DATATYPE_STRING, FB_DATATYPE_FIXSTR, _
600 FB_DATATYPE_CHAR, FB_DATATYPE_WCHAR
605 case FB_DATATYPE_STRUCT
607 dim as FB_ERRMSG err_num =
any
612 if( err_num = FB_ERRMSG_OK )
then
613 errReport( FB_ERRMSG_EXPECTEDPOINTER, TRUE )
620 if( typeIsPtr( dtype ) = FALSE )
then
621 errReport( FB_ERRMSG_EXPECTEDPOINTER, TRUE )
633 errReport( FB_ERRMSG_INCOMPLETETYPE, TRUE )
635 dtype = typeAddrOf( FB_DATATYPE_BYTE )
641 dtype = typeDeref( dtype )
655 select case as const typeGet( dtype )
657 case FB_DATATYPE_VOID, FB_DATATYPE_FWDREF
658 errReport( FB_ERRMSG_INCOMPLETETYPE, TRUE )
660 dtype = typeAddrOf( FB_DATATYPE_BYTE )
663 case FB_DATATYPE_STRUCT
667 errReport( FB_ERRMSG_INVALIDDATATYPES, TRUE )
674 if( env.clopt.extraerrchk )
then
679 if( idxexpr <> NULL )
then
680 varexpr =
astNewBOP( AST_OP_ADD, varexpr, idxexpr )
684 varexpr =
cUdtMember( dtype, subtype, varexpr, check_array )
685 if( varexpr = NULL )
then
690 if( astIsNIDXARRAY( varexpr ) )
then
691 if( derefcnt > 0 )
then
692 errReport( FB_ERRMSG_EXPECTEDPOINTER, TRUE )
698 dtype = astGetFullType( varexpr )
699 subtype = astGetSubType( varexpr )
706 if( derefcnt > 0 )
then
708 if( varexpr = NULL )
then
712 dtype = astGetFullType( varexpr )
713 subtype = astGetSubType( varexpr )
727 byval dtype
as integer, _
728 byval subtype
as FBSYMBOL
ptr, _
729 byval expr
as ASTNODE
ptr, _
730 byval isfuncptr
as integer, _
731 byval checkarray
as integer _
737 if( isfuncptr = FALSE )
then
740 if( expr = NULL )
then
744 dtype = astGetDataType( expr )
745 subtype = astGetSubType( expr )
749 if( dtype = typeAddrOf( FB_DATATYPE_FUNCTION ) )
then
756 if( isfuncptr = FALSE )
then
761 if( env.clopt.extraerrchk )
then
766 if( symbGetType( subtype ) <> FB_DATATYPE_VOID )
then
768 if( expr = NULL )
then
774 if( fbGetIsExpression( ) = FALSE )
then
789 byval expr
as ASTNODE
ptr, _
790 byval desc
as FBSYMBOL
ptr, _
791 byval idx as integer _
794 dim as longint dimoffset =
any
796 dimoffset = symb.fbarray_dimtb + (
idx * symbGetLen( symb.fbarraydim ))
799 astNewVAR( desc, dimoffset + symb.fbarraydim_lbound, FB_DATATYPE_INTEGER ), _
800 astNewVAR( desc, dimoffset + symb.fbarraydim_ubound, FB_DATATYPE_INTEGER ) )
808 dim as integer i =
any, dims =
any, maxdims =
any
809 dim as ASTNODE
ptr expr =
any, dimexpr =
any
810 dim as FBSYMBOL
ptr desc =
any
812 desc = symbGetArrayDescriptor( sym )
815 if( symbIsCommon( sym ) = FALSE )
then
816 maxdims = symbGetArrayDimensions( sym )
828 if( maxdims <> -1 )
then
829 if( dims > maxdims )
then
839 if( env.clopt.extraerrchk )
then
841 if( dimexpr = NULL )
then
846 if( expr = NULL )
then
849 expr =
astNewBOP( AST_OP_ADD, expr, dimexpr )
863 astNewVAR( desc, symb.fbarray_dimtb + (i * symbGetLen( symb.fbarraydim )), _
864 FB_DATATYPE_INTEGER ) )
871 if( maxdims <> -1 )
then
872 if( dims < maxdims )
then
878 function =
astNewBOP( AST_OP_ADD, expr, _
879 astNewVAR( desc, symb.fbarray_data, FB_DATATYPE_INTEGER ) )
884 byval expr
as ASTNODE
ptr, _
885 byval desc
as FBSYMBOL
ptr, _
886 byval idx as integer _
889 dim as longint dimoffset =
any
891 dimoffset = symb.fbarray_dimtb + (
idx * symbGetLen( symb.fbarraydim ))
895 FB_DATATYPE_INTEGER, NULL, _
896 dimoffset + symb.fbarraydim_lbound ), _
898 FB_DATATYPE_INTEGER, NULL, _
899 dimoffset + symb.fbarraydim_ubound ) )
908 dim as ASTNODE
ptr expr =
any, dimexpr =
any
909 dim as integer i =
any
919 if( env.clopt.extraerrchk )
then
921 if( dimexpr = NULL )
then
926 if( expr = NULL )
then
929 expr =
astNewBOP( AST_OP_ADD, expr, dimexpr )
946 FB_DATATYPE_INTEGER, NULL, _
947 symb.fbarray_dimtb + (i * symbGetLen( symb.fbarraydim )) ) )
954 function =
astNewBOP( AST_OP_ADD, expr, _
956 FB_DATATYPE_INTEGER, NULL, symb.fbarray_data ) )
962 function cArrayIdx(
byval sym
as FBSYMBOL
ptr )
as ASTNODE
ptr
963 dim as FBVARDIM
ptr d =
any
964 dim as integer dtype =
any, dims =
any, maxdims =
any
965 dim as ASTNODE
ptr expr =
any, dimexpr =
any, varexpr =
any
968 if( symbIsParamByDesc( sym ) )
then
972 elseif( symbGetIsDynamic( sym ) )
then
977 maxdims = symbGetArrayDimensions( sym )
981 d = symbGetArrayFirstDim( sym )
985 if( dims > maxdims )
then
994 if( env.clopt.extraerrchk )
then
999 if( expr = NULL )
then
1002 expr =
astNewBOP( AST_OP_ADD, expr, dimexpr )
1023 if( dims < maxdims )
then
1035 byval id
as zstring ptr, _
1036 byval dtype
as integer _
1039 dim as FBSYMBOL
ptr s =
any
1040 dim as FBARRAYDIM dTB(0) =
any
1041 dim as integer attrib =
any, options =
any
1042 dim as ASTNODE
ptr var_ =
any
1046 if( symbGetProcStaticLocals( parser.currproc ) )
then
1047 attrib = FB_SYMBATTRIB_STATIC
1052 if( symbIsGlobalNamespc( ) = FALSE )
then
1053 if( fbIsModLevel( ) )
then
1054 if( (attrib
and (FB_SYMBATTRIB_SHARED
or _
1055 FB_SYMBATTRIB_COMMON
or _
1056 FB_SYMBATTRIB_PUBLIC
or _
1057 FB_SYMBATTRIB_EXTERN)) = 0 )
then
1059 attrib
or= FB_SYMBATTRIB_STATIC
1067 if( dtype = FB_DATATYPE_INVALID )
then
1070 attrib
or= FB_SYMBATTRIB_SUFFIXED
1076 if( fbLangOptIsSet( FB_LANG_OPT_SCOPE ) )
then
1078 if( fbGetIsScope( ) = FALSE )
then
1079 options
or= FB_SYMBOPT_UNSCOPE
1084 options
or= FB_SYMBOPT_UNSCOPE
1087 s =
symbAddVar( id, NULL, dtype, NULL, 0, 0, dTB(), attrib, options )
1096 if( (options
and FB_SYMBOPT_UNSCOPE) <> 0 )
then
1109 if( symbIsParamByDesc( sym ) )
then
1112 FB_DATATYPE_INTEGER, NULL, symb.fbarray_data )
1116 if( symbGetIsDynamic( sym ) )
then
1118 return astNewVAR( symbGetArrayDescriptor( sym ), _
1119 symb.fbarray_data, FB_DATATYPE_INTEGER )
1123 function =
astNewCONSTi( symbGetArrayFirstDim( sym )->lower )
1131 byval sym
as FBSYMBOL
ptr, _
1132 byval check_array
as integer _
1135 dim as integer dtype =
any
1136 dim as FBSYMBOL
ptr subtype =
any
1137 dim as ASTNODE
ptr varexpr =
any, idxexpr =
any
1138 dim as integer is_byref =
any, is_funcptr =
any, is_array =
any
1144 errReport( FB_ERRMSG_ILLEGALMEMBERACCESS )
1150 dtype = symbGetFullType( sym )
1151 subtype = symbGetSubtype( sym )
1153 is_byref = symbIsParamByRef( sym )
or symbIsImport( sym )
1160 dim as integer check_fields = TRUE, is_nidxarray = FALSE
1174 if(
hMatch( CHAR_RPRNT ) = FALSE )
then
1181 is_funcptr = (typeGetDtAndPtrOnly( dtype ) = typeAddrOf( FB_DATATYPE_FUNCTION ))
1184 if( (is_array = FALSE)
and (is_funcptr = FALSE) )
then
1185 errReport( FB_ERRMSG_ARRAYNOTALLOCATED, TRUE )
1194 check_fields = FALSE
1201 if( check_array )
then
1202 errReport( FB_ERRMSG_EXPECTEDINDEX, TRUE )
1206 check_fields = FALSE
1215 varexpr =
astNewVAR( sym, 0, typeAddrOf( dtype ), subtype )
1217 varexpr =
astNewVAR( sym, 0, dtype, subtype )
1221 if( idxexpr <> NULL )
then
1224 varexpr =
astNewBOP( AST_OP_ADD, varexpr, idxexpr )
1226 varexpr =
astNewIDX( varexpr, idxexpr, dtype, subtype )
1236 if( is_funcptr = FALSE )
then
1237 if( check_fields )
then
1241 select case typeGet( dtype )
1242 case FB_DATATYPE_STRUCT
1245 errReport( FB_ERRMSG_EXPECTEDUDT, TRUE )
1256 if( varexpr = NULL )
then
1261 if( astIsNIDXARRAY( varexpr ) )
then
1265 dtype = astGetDataType( varexpr )
1266 subtype = astGetSubType( varexpr )
1270 is_funcptr = (dtype = typeAddrOf( FB_DATATYPE_FUNCTION ))
1277 if( check_fields )
then
1286 if( is_nidxarray )
then
1300 byval chain_ as FBSYMCHAIN
ptr, _
1301 byval check_array
as integer _
1304 dim as zstring ptr id =
any
1305 dim as integer suffix =
any
1306 dim as FBSYMBOL
ptr sym =
any
1309 suffix = lexGetType( )
1311 if( env.clopt.lang = FB_LANG_QB )
then
1314 if( suffix = FB_DATATYPE_INVALID )
then
1320 if( fbLangOptIsSet( FB_LANG_OPT_SUFFIX ) )
then
1323 if( suffix = FB_DATATYPE_INVALID )
then
1330 if( suffix <> FB_DATATYPE_INVALID )
then
1337 if( sym = NULL )
then
1338 if( env.opt.
explicit )
then
1343 if(
chain_ <> NULL )
then
1344 if( fbLangOptIsSet( FB_LANG_OPT_SUFFIX ) )
then
1347 if( sym <> NULL )
then
1349 if( symbGetNamespace( sym ) <> symbGetCurrentNamespc( ) )
then
1350 errReport( FB_ERRMSG_DECLOUTSIDENAMESPC )
1358 if( sym = NULL )
then
1363 if( fbGetIsExpression( ) )
then
1364 if( fbLangOptIsSet( FB_LANG_OPT_SCOPE ) )
then
1365 if( env.opt.
explicit = FALSE )
then
1379 byval this_
as FBSYMBOL
ptr, _
1380 byval dtype
as integer, _
1381 byval subtype
as FBSYMBOL
ptr, _
1382 byval check_array
as integer, _
1383 byval is_ptr
as integer, _
1384 byval options
as FB_PARSEROPT _
1387 dim as ASTNODE
ptr varexpr =
any
1390 varexpr =
astNewVAR( this_, , typeAddrOf( dtype ), subtype )
1395 varexpr =
cUdtMember( dtype, subtype, varexpr, check_array, options )
1397 if( varexpr = NULL )
then
1402 if( astIsNIDXARRAY( varexpr ) )
then
1406 dtype = astGetFullType( varexpr )
1407 subtype = astGetSubType( varexpr )
1410 dim as integer is_funcptr = FALSE
1412 is_funcptr = (typeGetDtAndPtrOnly( dtype ) = typeAddrOf( FB_DATATYPE_FUNCTION ))
1425 dim as FBSYMBOL
ptr sym =
any
1426 dim as integer dtype =
any
1431 sym = parser.stmt.
with.sym
1432 dtype = symbGetFullType( sym )
1433 if( parser.stmt.
with.is_ptr )
then
1434 dtype = typeDeref( dtype )
1437 function =
hImpField( sym, dtype, symbGetSubtype( sym ), check_array, _
1438 parser.stmt.
with.is_ptr, 0 )
1446 byval chain_ as FBSYMCHAIN
ptr, _
1447 byval check_array
as integer _
1452 case FB_TKCLASS_IDENTIFIER, FB_TKCLASS_QUIRKWD
1456 if( parser.stmt.
with.sym = NULL )
then
1476 byval chain_ as FBSYMCHAIN
ptr, _
1477 byval check_array
as integer, _
1478 byval options
as FB_PARSEROPT _
1481 dim as FBSYMBOL
ptr this_ = NULL
1483 dim as FBSYMBOL
ptr param = symbGetProcHeadParam( parser.currproc )
1484 if( symbIsMethod( parser.currproc )
and (param <> NULL) )
then
1485 this_ = symbGetParamVar( param )
1488 if( this_ = NULL )
then
1489 errReport( FB_ERRMSG_STATICMEMBERHASNOINSTANCEPTR )
1498 check_array, TRUE, options )
1505 byval options
as FB_VAREXPROPT _
1508 dim as integer last_isexpr =
any, check_array =
any
1510 if( options
and FB_VAREXPROPT_ISEXPR )
then
1511 last_isexpr = fbGetIsExpression( )
1512 fbSetIsExpression( TRUE )
1514 check_array = fbGetCheckArray( )
1515 fbSetCheckArray( ((options
and FB_VAREXPROPT_NOARRAYCHECK) = 0) )
1519 fbSetCheckArray( check_array )
1520 if( options
and FB_VAREXPROPT_ISEXPR )
then
1521 fbSetIsExpression( last_isexpr )
1524 if( expr <> NULL )
then
1526 dim as ASTNODE
ptr t = expr
1527 if( astIsCAST( expr ) )
then
1528 if( astGetCASTDoConv( expr ) = FALSE )
then
1529 t = astGetLeft( expr )
1533 dim as integer complain = TRUE
1535 select case as const astGetClass( t )
1536 case AST_NODECLASS_VAR, AST_NODECLASS_IDX, _
1537 AST_NODECLASS_FIELD, AST_NODECLASS_DEREF
1540 case AST_NODECLASS_CALL, AST_NODECLASS_NIDXARRAY
1541 complain = ((options
and FB_VAREXPROPT_ISASSIGN) <> 0)
1543 case AST_NODECLASS_ADDROF, AST_NODECLASS_OFFSET
1544 complain = ((options
and FB_VAREXPROPT_ALLOWADDROF) = 0)
1546 case AST_NODECLASS_BOP
1548 if( options
and FB_VAREXPROPT_ALLOWADDROF )
then
1550 complain =
not typeIsPtr( astGetDataType( expr ) )