33 dim as ASTNODE
ptr expr
34 dim as FBSYMBOL
ptr sym, el, cl
35 dim as FB_CMPSTMTSTK
ptr stk
36 dim as integer options =
any
41 if( outerscopenode = NULL )
then
47 if( expr = NULL )
then
53 if( astGetDataClass( expr ) <> FB_DATACLASS_INTEGER )
then
59 select case astGetDataType( expr )
60 case FB_DATATYPE_CHAR, FB_DATATYPE_WCHAR
62 if( astIsDEREF( expr ) = FALSE )
then
69 if( expr = NULL )
then
75 if( astGetDataType( expr ) <> FB_DATATYPE_UINT )
then
76 if( typeGetSize( astGetDataType( expr ) ) <= typeGetSize( FB_DATATYPE_UINT ) )
then
77 expr =
astNewCONV( FB_DATATYPE_UINT, NULL, expr )
79 expr =
astNewCONV( FB_DATATYPE_ULONGINT, NULL, expr )
88 if( fbLangOptIsSet( FB_LANG_OPT_SCOPE ) = FALSE )
then
89 options
or= FB_SYMBOPT_UNSCOPE
98 symbSetDontInit( sym )
100 if( options
and FB_SYMBOPT_UNSCOPE )
then
113 FB_CMPSTMT_MASK_NOTHING )
114 stk->
select.isconst = TRUE
115 stk->
select.sym = sym
116 stk->
select.casecnt = 0
118 stk->
select.const_.deflabel = NULL
119 stk->
select.const_.minval = &hFFFFFFFFu
120 stk->
select.const_.maxval = 0
121 stk->
select.cmplabel = cl
122 stk->
select.endlabel = el
123 stk->
select.outerscopenode = outerscopenode
128 byval swtbase
as integer, _
129 byval value
as ulongint, _
130 byval label
as FBSYMBOL
ptr _
133 dim as integer probe, high, low, i
145 do while( high - low > 1 )
146 probe = cunsg(high + low) \ 2
150 elseif( v > value )
then
158 for i =
ctx.
base+1
to swtbase+high+1
step -1
173 dim as ulongint value, tovalue, maxval, minval
174 dim as FBSYMBOL
ptr label
175 dim as integer swtbase
181 if( stk->scopenode <> NULL )
then
185 if( stk->
select.casecnt > 0 )
then
200 stk->
select.casecnt = -1
206 swtbase = stk->
select.const_.
base
215 minval = stk->
select.const_.minval
216 maxval = stk->
select.const_.maxval
224 for value = value
to tovalue
225 if( value < minval )
then
228 if( value > maxval )
then
233 if( (minval > maxval)
or _
235 (
culngint(minval) * typeGetSize( FB_DATATYPE_INTEGER ) > 4294967292ULL) )
then
239 minval = stk->
select.const_.minval
240 maxval = stk->
select.const_.maxval
249 if( value < minval )
then
252 if( value > maxval )
then
257 if( (minval > maxval)
or _
259 (
culngint(minval) * typeGetSize( FB_DATATYPE_INTEGER ) > 4294967292ULL) )
then
263 minval = stk->
select.const_.minval
264 maxval = stk->
select.const_.maxval
273 stk->
select.const_.minval = minval
274 stk->
select.const_.maxval = maxval
275 loop while(
hMatch( CHAR_COMMA ) )
283 stk->
select.casecnt += 1
288 dim as FBSYMBOL
ptr deflabel =
any
294 deflabel = stk->
select.const_.deflabel
295 if( deflabel = NULL )
then
296 deflabel = stk->
select.endlabel
300 if( stk->scopenode <> NULL )
then
315 stk->
select.const_.minval, _
316 stk->
select.const_.maxval ) )
324 if( stk->
select.outerscopenode <> NULL )
then