12 byval funcexpr
as ASTNODE
ptr, _
13 byval tctype
as integer, _
14 byval stype
as FBSYMBOL
ptr _
19 byval sym
as FBSYMBOL
ptr, _
20 byval udt
as integer =
FALSE _
25 dim as FB_DATATYPE dtype = symbGetType( sym )
26 dim as FBSYMBOL
ptr subtype = symbGetSubType( sym )
30 return iif( udt, -1, FB_THREADCALL_PTR )
33 if( typeIsPtr( dtype ) )
then
34 return FB_THREADCALL_PTR
38 case FB_DATATYPE_STRING
39 function =
iif( udt, -1, FB_THREADCALL_PTR )
40 case FB_DATATYPE_STRUCT
42 if( symbGetUDTIsUnion( subtype )
or symbGetUDTHasAnonUnion( subtype ) )
then
45 if symbGetUDTAlign( subtype ) <> 0
then
55 function = FB_THREADCALL_STRUCT
57 case FB_DATATYPE_BYTE, FB_DATATYPE_CHAR, FB_DATATYPE_UBYTE, _
58 FB_DATATYPE_SHORT, FB_DATATYPE_WCHAR, FB_DATATYPE_USHORT, _
59 FB_DATATYPE_INTEGER, FB_DATATYPE_ENUM, FB_DATATYPE_UINT, _
60 FB_DATATYPE_LONGINT, FB_DATATYPE_ULONGINT, _
61 FB_DATATYPE_SINGLE, FB_DATATYPE_DOUBLE
62 select case as const( typeGetSizeType( dtype ) )
63 case FB_SIZETYPE_INT8 :
function = FB_THREADCALL_INT8
64 case FB_SIZETYPE_UINT8 :
function = FB_THREADCALL_UINT8
65 case FB_SIZETYPE_INT16 :
function = FB_THREADCALL_INT16
66 case FB_SIZETYPE_UINT16 :
function = FB_THREADCALL_UINT16
67 case FB_SIZETYPE_INT32 :
function = FB_THREADCALL_INT32
68 case FB_SIZETYPE_UINT32 :
function = FB_THREADCALL_UINT32
69 case FB_SIZETYPE_INT64 :
function = FB_THREADCALL_INT64
70 case FB_SIZETYPE_UINT64 :
function = FB_THREADCALL_UINT64
71 case FB_SIZETYPE_FLOAT32 :
function = FB_THREADCALL_FLOAT32
72 case FB_SIZETYPE_FLOAT64 :
function = FB_THREADCALL_FLOAT64
73 case else :
assert(
FALSE )
83 byval funcexpr
as ASTNODE
ptr, _
84 byval struct
as FBSYMBOL
ptr _
87 dim as FBSYMBOL
ptr fld =
any
88 dim as integer count =
any
99 if( astNewArg( funcexpr,
astNewCONSTi( count ) ) = NULL )
then
108 symbGetSubType( fld ) ) =
FALSE )
then
120 byval funcexpr
as ASTNODE
ptr, _
121 byval tctype
as integer, _
122 byval stype
as FBSYMBOL
ptr _
128 if( tctype = -1 )
then
129 errReport( FB_ERRMSG_UNSUPPORTEDFUNCTION )
134 dim as ASTNODE
ptr typeexpr
136 if(
astNewARG( funcexpr, typeexpr ) = NULL )
then
141 if( tctype = FB_THREADCALL_STRUCT )
then
151 dim as FBSYMBOL
ptr tmpvar =
any, subtype =
any
152 dim as integer dtype =
any
154 if( astIsVAR( expr ) )
then
160 tmpvar =
symbAddTempVar( astGetDataType( expr ), astGetSubType( expr ) )
175 dim as FBSYMBOL
ptr proc, param
176 dim as ASTNODE
ptr procmodeexpr
177 dim as ASTNODE
ptr stacksizeexpr, argsexpr, ptrexpr
182 dim args
as integer = callexpr->
call.args
183 dim arg
as ASTNODE
ptr = callexpr->r
184 dim argupper
as integer =
iif( args=0, 1, args )
185 redim argexpr( 1
to argupper )
as ASTNODE
ptr
186 redim argmode( 1
to argupper )
as integer
187 for i
as integer = 1
to args
191 argexpr( args-i+1 ) = astCloneTREE( arg->l )
192 argmode( args-i+1 ) = arg->arg.mode
197 astDelTREE( callexpr )
200 dim as ASTNODE
ptr expr = astNewCall( PROCLOOKUP(
THREADCALL ) )
203 if(
astNewARG( expr, astBuildProcAddrOf( proc ) ) = NULL )
then
208 dim as integer procmode, procmode_fb
209 procmode_fb = symbGetProcMode( proc )
210 if procmode_fb = FB_FUNCMODE_FBCALL
then procmode_fb = env.target.fbcall
211 if( procmode_fb = FB_FUNCMODE_CDECL )
then
212 procmode = FB_THREADCALL_CDECL
213 elseif( ((procmode_fb = FB_FUNCMODE_STDCALL)
or _
214 (procmode_fb = FB_FUNCMODE_STDCALL_MS)) _
215 and env.clopt.target = FB_COMPTARGET_WIN32 )
then
216 procmode = FB_THREADCALL_STDCALL
218 errReport( FB_ERRMSG_UNSUPPORTEDFUNCTION )
224 if(
astNewARG( expr, procmodeexpr ) = NULL )
then
230 if(
astNewARG( expr, stacksizeexpr ) = NULL )
then
236 if(
astNewARG( expr, argsexpr ) = NULL )
then
241 param = symbGetProcLastParam( proc )
242 for i
as integer = 1
to args
245 dim as FB_PARAMMODE mode
246 dim as integer tctype = -1
247 mode = symbGetParamMode( param )
251 case FB_PARAMMODE_BYVAL
252 case FB_PARAMMODE_BYREF, FB_PARAMMODE_BYDESC
253 if( tctype <> -1 )
then
254 tctype = FB_THREADCALL_PTR
261 dim as FBSYMBOL
ptr stype = symbGetSubType( param )
270 dim isstring
as integer
271 isstring = typeGetDtOnly( astGetDataType( argexpr( i ) ) )
272 if( mode = FB_PARAMMODE_BYREF
and _
273 argmode( i ) <> FB_PARAMMODE_BYVAL
and _
274 isstring =
FALSE )
then
278 if( ptrexpr = NULL )
then
283 if(
astNewARG( expr, ptrexpr ) = NULL )
then
287 param = symbGetProcPrevParam( proc, param )