13 assert( astIsCONST( n ) )
14 if( typeGetClass( n->dtype ) = FB_DATACLASS_FPOINT )
then
15 function = (n->
val.f = 0.0)
17 function = (n->
val.i = 0)
23 assert( astIsCONST( n ) )
24 if( typeGetClass( n->dtype ) = FB_DATACLASS_FPOINT )
then
25 function = (n->
val.f >= 0.0)
27 function = (n->
val.i >= 0)
32 dim as FBSYMBOL
ptr tc =
any
44 dim as FBSYMBOL
ptr tc =
any
47 tc = symbAllocWstrConst( v, -1 )
57 byval value
as longint, _
58 byval dtype
as integer, _
59 byval subtype
as FBSYMBOL
ptr _
62 dim as ASTNODE
ptr n =
any
64 n =
astNewNode( AST_NODECLASS_CONST, FB_DATATYPE_LONGINT, NULL )
67 n =
astNewCONV( dtype, subtype, n, AST_CONVOPT_DONTCHKPTR )
69 assert( n->
class = AST_NODECLASS_CONST )
76 byval value
as double, _
77 byval dtype
as integer _
80 dim as ASTNODE
ptr n =
any
82 n =
astNewNode( AST_NODECLASS_CONST, FB_DATATYPE_DOUBLE )
90 byval v
as FBVALUE
ptr, _
91 byval dtype
as integer, _
92 byval subtype
as FBSYMBOL
ptr _
95 if( typeGetClass( dtype ) = FB_DATACLASS_FPOINT )
then
105 byval dtype
as integer, _
106 byval subtype
as FBSYMBOL
ptr _
109 dim as ASTNODE
ptr tree =
any
110 dim as FBSYMBOL
ptr fld =
any
112 select case as const( typeGetDtAndPtrOnly( dtype ) )
113 case FB_DATATYPE_VOID
119 case FB_DATATYPE_STRING, FB_DATATYPE_FIXSTR, FB_DATATYPE_CHAR
122 case FB_DATATYPE_WCHAR
125 case FB_DATATYPE_STRUCT
144 if( dtype = FB_DATATYPE_INVALID )
then
145 dtype = FB_DATATYPE_INTEGER
148 if( typeGetClass( dtype ) = FB_DATACLASS_FPOINT )
then
158 dim as integer dtype =
any
160 if( ast.doemit )
then
161 dtype = astGetDataType( n )
162 if( typeGetClass( dtype ) = FB_DATACLASS_FPOINT )
then
163 function = irAllocVrImmF( dtype, n->subtype, n->
val.f )
165 function = irAllocVrImm( dtype, n->subtype, n->
val.i )
171 n =
astNewCONV( FB_DATATYPE_INTEGER, NULL, n )
173 assert( astIsCONST( n ) )
180 assert( astIsCONST( n ) )
182 if( typeGetClass( n->dtype ) = FB_DATACLASS_FPOINT )
then
183 if( typeGetDtAndPtrOnly( n->dtype ) = FB_DATATYPE_DOUBLE )
then
184 function =
str( n->
val.f )
186 function =
str(
csng( n->
val.f ) )
188 elseif( typeIsSigned( n->dtype ) )
then
189 function =
str( n->
val.i )
191 function =
str( cunsg( n->
val.i ) )
198 static as wstring * 64+1 w
200 assert( astIsCONST( n ) )
202 if( typeGetClass( n->dtype ) = FB_DATACLASS_FPOINT )
then
203 if( typeGetDtAndPtrOnly( n->dtype ) = FB_DATATYPE_DOUBLE )
then
206 w =
wstr(
csng( n->
val.f ) )
208 elseif( typeIsSigned( n->dtype ) )
then
211 w =
wstr( cunsg( n->
val.i ) )
219 assert( astIsCONST( n ) )
221 if( typeGetClass( n->dtype ) = FB_DATACLASS_FPOINT )
then
222 function =
clngint( n->
val.f )
223 elseif( typeIsSigned( n->dtype ) )
then
226 function = cunsg( n->
val.i )
231 assert( astIsCONST( n ) )
233 if( typeGetClass( n->dtype ) = FB_DATACLASS_FPOINT )
then
235 elseif( typeIsSigned( n->dtype ) )
then
236 function =
cdbl( n->
val.i )
238 function =
cdbl( cunsg( n->
val.i ) )
243 dim as integer dtype =
any
244 dim as FBSYMBOL
ptr subtype =
any
246 assert( symbIsConst( sym ) )
247 dtype = symbGetFullType( sym )
248 subtype = symbGetSubType( sym )
250 select case( typeGetDtAndPtrOnly( dtype ) )
251 case FB_DATATYPE_CHAR, FB_DATATYPE_WCHAR
252 function =
astNewVAR( symbGetConstStr( sym ) )
254 function =
astNewCONST( symbGetConstVal( sym ), dtype, subtype )
260 byval dtype
as integer, _
261 byval subtype
as FBSYMBOL
ptr, _
262 byval l as ASTNODE
ptr _
265 assert( typeGetClass(
l->dtype ) = FB_DATACLASS_INTEGER )
282 l->dtype =
iif( typeIsSigned(
l->dtype ), _
283 FB_DATATYPE_LONGINT, FB_DATATYPE_ULONGINT )
286 var old_warn_convoverflow = ast.warn_convoverflow
287 ast.warn_convoverflow = FALSE
289 l =
astNewCONV( dtype, subtype,
l, AST_CONVOPT_DONTCHKPTR )
291 ast.warn_convoverflow = old_warn_convoverflow