author | Claus Gittinger <cg@exept.de> |
Thu, 10 Mar 2016 13:39:19 +0100 | |
changeset 19314 | 698cf296ef6d |
parent 19313 | 4e56f471a6c3 |
child 19332 | 9686fae7951b |
child 19334 | 0488e4bae939 |
permissions | -rw-r--r-- |
19311 | 1 |
"{ Encoding: utf8 }" |
2 |
||
8728 | 3 |
" |
4 |
COPYRIGHT (c) 2004 by eXept Software AG |
|
9464 | 5 |
All Rights Reserved |
8728 | 6 |
|
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
8533 | 14 |
"{ Package: 'stx:libbasic' }" |
15 |
||
19311 | 16 |
"{ NameSpace: Smalltalk }" |
17 |
||
8533 | 18 |
ExternalFunction subclass:#ExternalLibraryFunction |
9465 | 19 |
instanceVariableNames:'flags moduleName returnType argumentTypes owningClass' |
14659
410089913ca1
allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents:
14632
diff
changeset
|
20 |
classVariableNames:'DLLPATH FLAG_VIRTUAL FLAG_NONVIRTUAL FLAG_OBJECTIVEC FLAG_ASYNC |
10270 | 21 |
FLAG_UNLIMITEDSTACK FLAG_RETVAL_IS_CONST CALLTYPE_MASK |
22 |
CALLTYPE_API CALLTYPE_C CALLTYPE_OLE CALLTYPE_V8 CALLTYPE_V9 |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
23 |
CALLTYPE_UNIX64 DllMapping Verbose' |
9464 | 24 |
poolDictionaries:'' |
25 |
category:'System-Support' |
|
8533 | 26 |
! |
27 |
||
9322 | 28 |
!ExternalLibraryFunction primitiveDefinitions! |
29 |
%{ |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
30 |
#define VERBOSE |
9322 | 31 |
|
9337 | 32 |
#ifdef HAVE_FFI |
33 |
# include <ffi.h> |
|
9322 | 34 |
# define MAX_ARGS 128 |
9365 | 35 |
|
14659
410089913ca1
allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents:
14632
diff
changeset
|
36 |
# ifdef USE_STANDARD_FFI |
410089913ca1
allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents:
14632
diff
changeset
|
37 |
# define __get_ffi_type_sint() &ffi_type_sint |
410089913ca1
allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents:
14632
diff
changeset
|
38 |
# define __get_ffi_type_sint8() &ffi_type_sint8 |
410089913ca1
allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents:
14632
diff
changeset
|
39 |
# define __get_ffi_type_sint16() &ffi_type_sint16 |
410089913ca1
allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents:
14632
diff
changeset
|
40 |
# define __get_ffi_type_sint32() &ffi_type_sint32 |
410089913ca1
allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents:
14632
diff
changeset
|
41 |
# define __get_ffi_type_sint64() &ffi_type_sint64 |
410089913ca1
allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents:
14632
diff
changeset
|
42 |
# define __get_ffi_type_uint() &ffi_type_uint |
410089913ca1
allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents:
14632
diff
changeset
|
43 |
# define __get_ffi_type_uint8() &ffi_type_uint8 |
410089913ca1
allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents:
14632
diff
changeset
|
44 |
# define __get_ffi_type_uint16() &ffi_type_uint16 |
410089913ca1
allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents:
14632
diff
changeset
|
45 |
# define __get_ffi_type_uint32() &ffi_type_uint32 |
410089913ca1
allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents:
14632
diff
changeset
|
46 |
# define __get_ffi_type_uint64() &ffi_type_uint64 |
410089913ca1
allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents:
14632
diff
changeset
|
47 |
# define __get_ffi_type_float() &ffi_type_float |
410089913ca1
allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents:
14632
diff
changeset
|
48 |
# define __get_ffi_type_double() &ffi_type_double |
410089913ca1
allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents:
14632
diff
changeset
|
49 |
# define __get_ffi_type_void() &ffi_type_void |
410089913ca1
allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents:
14632
diff
changeset
|
50 |
# define __get_ffi_type_pointer() &ffi_type_pointer |
410089913ca1
allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents:
14632
diff
changeset
|
51 |
# else |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
52 |
extern ffi_type *__get_ffi_type_sint(); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
53 |
extern ffi_type *__get_ffi_type_sint8(); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
54 |
extern ffi_type *__get_ffi_type_sint16(); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
55 |
extern ffi_type *__get_ffi_type_sint32(); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
56 |
extern ffi_type *__get_ffi_type_sint64(); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
57 |
extern ffi_type *__get_ffi_type_uint(); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
58 |
extern ffi_type *__get_ffi_type_uint8(); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
59 |
extern ffi_type *__get_ffi_type_uint16(); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
60 |
extern ffi_type *__get_ffi_type_uint32(); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
61 |
extern ffi_type *__get_ffi_type_uint64(); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
62 |
extern ffi_type *__get_ffi_type_float(); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
63 |
extern ffi_type *__get_ffi_type_double(); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
64 |
extern ffi_type *__get_ffi_type_void(); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
65 |
extern ffi_type *__get_ffi_type_pointer(); |
14659
410089913ca1
allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents:
14632
diff
changeset
|
66 |
# endif |
9365 | 67 |
|
9337 | 68 |
#endif |
9322 | 69 |
|
70 |
%} |
|
71 |
! ! |
|
72 |
||
8728 | 73 |
!ExternalLibraryFunction class methodsFor:'documentation'! |
74 |
||
75 |
copyright |
|
76 |
" |
|
77 |
COPYRIGHT (c) 2004 by eXept Software AG |
|
9464 | 78 |
All Rights Reserved |
8728 | 79 |
|
80 |
This software is furnished under a license and may be used |
|
81 |
only in accordance with the terms of that license and with the |
|
82 |
inclusion of the above copyright notice. This software may not |
|
83 |
be provided or otherwise made available to, or used by, any |
|
84 |
other person. No title to or ownership of the software is |
|
85 |
hereby transferred. |
|
86 |
" |
|
9322 | 87 |
! |
88 |
||
9331 | 89 |
documentation |
90 |
" |
|
91 |
instances of me are used to interface to external library functions (as found in a dll/shared object). |
|
92 |
||
12680 | 93 |
Inside a method, when a special external-call pragma such as: |
14625 | 94 |
<api: bool MessageBeep(uint)> |
12680 | 95 |
|
96 |
is encountered by the parser, the compiler generates a call via |
|
14625 | 97 |
<correspondingExternalLibraryFunctionObject> invokeWithArguments: argumentArray. |
9331 | 98 |
|
99 |
In the invoke method, the library is checked to be loaded (and loaded if not already), |
|
9336 | 100 |
the arguments are converted to C and pushed onto the C-stack, the function is called, |
9331 | 101 |
and finally, the return value is converted back from C to a smalltalk object. |
12680 | 102 |
|
103 |
The parser supports the call-syntax of various other smalltalk dialects: |
|
14625 | 104 |
Squeak / ST-X: |
105 |
<cdecl: [async] [virtual|nonVirtual][const] returnType functionNameStringOrIndex ( argType1..argTypeN ) module: moduleName > |
|
106 |
<apicall: [async] [virtual|nonVirtual][const] returnType functionNameStringOrIndex ( argType1..argTypeN ) module: moduleName > |
|
12680 | 107 |
|
14625 | 108 |
Dolphin: |
109 |
<stdcall: [virtual|nonVirtual][const] returnType functionNameStringOrIndex argType1..argTypeN> |
|
110 |
<cdecl: [virtual|nonVirtual][const] returnType functionNameStringOrIndex argType1..argTypeN> |
|
12680 | 111 |
|
14625 | 112 |
ST/V: |
113 |
<api: functionName argType1 .. argTypeN returnType> |
|
114 |
<ccall: functionName argType1 .. argTypeN returnType> |
|
115 |
<ole: vFunctionIndex argType1 .. argTypeN returnType> |
|
12680 | 116 |
|
14625 | 117 |
VisualWorks: |
118 |
<c: ...> |
|
119 |
<c: #define NAME value> |
|
9331 | 120 |
" |
121 |
! |
|
122 |
||
9322 | 123 |
example |
124 |
" |
|
14625 | 125 |
[exBegin] |
126 |
|f| |
|
14037 | 127 |
|
14625 | 128 |
f := ExternalLibraryFunction new. |
129 |
f beCallTypeWINAPI. |
|
14037 | 130 |
|
14625 | 131 |
f name:'MessageBeep' |
132 |
module:'user32.dll' |
|
133 |
returnType:#boolean |
|
134 |
argumentTypes:#(uint). |
|
14037 | 135 |
|
14625 | 136 |
f invokeWith:1. |
137 |
[exEnd] |
|
14037 | 138 |
|
139 |
Synchronous vs. Asynchronous calls: |
|
140 |
||
14516
359e4d2234af
class: ExternalLibraryFunction
Stefan Vogel <sv@exept.de>
parents:
14506
diff
changeset
|
141 |
by default, foreign function calls are synchronous, effectively blocking the whole ST/X system |
19311 | 142 |
(that is by purpose,´because most C-code is not prepared for being interrupted, and also, normal |
14037 | 143 |
code is not prepared for a garbage collector to move objects around, while another C thread might |
144 |
access the data...). |
|
14625 | 145 |
Therefore, the following will block all ST/X activity for 10 seconds |
14037 | 146 |
(try interacting with the launcher while the Sleep is performing): |
147 |
||
14625 | 148 |
[exBegin] |
149 |
|f| |
|
9322 | 150 |
|
14625 | 151 |
f := ExternalLibraryFunction new. |
152 |
f beCallTypeWINAPI. |
|
14037 | 153 |
|
14625 | 154 |
f name:'Sleep' |
155 |
module:'kernel32.dll' |
|
156 |
returnType:#void |
|
157 |
argumentTypes:#(uint). |
|
14037 | 158 |
|
14625 | 159 |
f invokeWith:10000. |
160 |
[exEnd] |
|
9322 | 161 |
|
14037 | 162 |
if you know what you do and you do not pass any possibly moving objects (such as strings) as argument, |
163 |
the call can be made asynchronous. In that case, ONLY the calling thread will be blocked; all other smalltalk |
|
164 |
threads wil continue to execute. |
|
165 |
(try interacting now with the launcher while the Sleep is performing): |
|
14625 | 166 |
[exBegin] |
167 |
|f| |
|
14037 | 168 |
|
14625 | 169 |
f := ExternalLibraryFunction new. |
170 |
f beCallTypeWINAPI. |
|
171 |
f beAsync. |
|
14037 | 172 |
|
14625 | 173 |
f name:'Sleep' |
174 |
module:'kernel32.dll' |
|
175 |
returnType:#void |
|
176 |
argumentTypes:#(uint). |
|
14037 | 177 |
|
14625 | 178 |
f invokeWith:10000. |
179 |
[exEnd] |
|
14037 | 180 |
|
9322 | 181 |
" |
8728 | 182 |
! ! |
8533 | 183 |
|
8550 | 184 |
!ExternalLibraryFunction class methodsFor:'instance creation'! |
185 |
||
9465 | 186 |
name:functionName module:moduleName returnType:returnType argumentTypes:argTypes |
8550 | 187 |
^ self new |
10025
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
188 |
name:functionName module:moduleName |
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
189 |
returnType:returnType argumentTypes:argTypes |
9465 | 190 |
|
191 |
"Created: / 01-08-2006 / 15:19:08 / cg" |
|
9463 | 192 |
! ! |
193 |
||
194 |
!ExternalLibraryFunction class methodsFor:'class initialization'! |
|
195 |
||
11050 | 196 |
addToDllPath:aDirectoryPathName |
197 |
"can be used during initialization, to add more places for dll-loading" |
|
198 |
||
11053 | 199 |
|oldPath| |
200 |
||
201 |
oldPath := self dllPath. |
|
202 |
(oldPath includes:aDirectoryPathName) ifFalse:[ |
|
11586 | 203 |
self dllPath:(oldPath asOrderedCollection copyWith:aDirectoryPathName) |
11053 | 204 |
] |
11050 | 205 |
! |
206 |
||
14103 | 207 |
dllMapping |
208 |
"allows for dll's to be replaced, |
|
209 |
for example, if you want to use the mozilla sqlite dll |
|
14625 | 210 |
C:\Program Files\Mozilla Firefox\mozsqlite3.dll |
14103 | 211 |
for the sqlite3, execute: |
14625 | 212 |
ExternalLibraryFunction |
213 |
dllMapping at:'sqlite3' |
|
214 |
put: 'C:\Program Files\Mozilla Firefox\mozsqlite3.dll' |
|
14103 | 215 |
" |
216 |
||
217 |
DllMapping isNil ifTrue:[ |
|
14625 | 218 |
DllMapping := Dictionary new. |
14103 | 219 |
]. |
220 |
^ DllMapping |
|
221 |
||
222 |
"Created: / 10-04-2012 / 12:21:45 / cg" |
|
223 |
! |
|
224 |
||
10270 | 225 |
dllPath |
13337 | 226 |
^ DLLPATH |
10270 | 227 |
! |
228 |
||
229 |
dllPath:aCollectionOfDirectoryPathNames |
|
230 |
DLLPATH := aCollectionOfDirectoryPathNames |
|
231 |
! |
|
232 |
||
9463 | 233 |
initialize |
10025
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
234 |
"using inline access to corresponding c--defines to avoid duplicate places of knowledge" |
13337 | 235 |
|
236 |
DLLPATH isNil ifTrue:[ |
|
14625 | 237 |
DLLPATH := #('.'). |
18228 | 238 |
%{ |
18240
28af09029a8b
ifdef for SCHTEAM engine changed (not relevant for ST/X)
Claus Gittinger <cg@exept.de>
parents:
18228
diff
changeset
|
239 |
#ifndef __SCHTEAM__ |
18228 | 240 |
@global(FLAG_VIRTUAL) = __MKSMALLINT(__EXTL_FLAG_VIRTUAL); // a virtual c++ call |
241 |
@global(FLAG_NONVIRTUAL) = __MKSMALLINT(__EXTL_FLAG_NONVIRTUAL); // a non-virtual c++ call |
|
242 |
@global(FLAG_OBJECTIVEC) = __MKSMALLINT(__EXTL_FLAG_OBJECTIVEC); // an objectiveC message send |
|
243 |
@global(FLAG_UNLIMITEDSTACK) = __MKSMALLINT(__EXTL_FLAG_UNLIMITEDSTACK); // unlimitedstack under unix |
|
244 |
@global(FLAG_ASYNC) = __MKSMALLINT(__EXTL_FLAG_ASYNC); // async under win32 |
|
245 |
@global(FLAG_RETVAL_IS_CONST) = __MKSMALLINT(__EXTL_FLAG_RETVAL_IS_CONST); // return value is not to be registered for finalization |
|
9463 | 246 |
|
18228 | 247 |
@global(CALLTYPE_API) = __MKSMALLINT(__EXTL_CALLTYPE_API); // WINAPI-call (win32 only) |
248 |
@global(CALLTYPE_C) = __MKSMALLINT(__EXTL_CALLTYPE_C); // regular C-call (the default) |
|
249 |
@global(CALLTYPE_V8) = __MKSMALLINT(__EXTL_CALLTYPE_V8); // v8 call (sparc only) |
|
250 |
@global(CALLTYPE_V9) = __MKSMALLINT(__EXTL_CALLTYPE_V9); // v9 call (sparc only) |
|
251 |
@global(CALLTYPE_UNIX64) = __MKSMALLINT(__EXTL_CALLTYPE_UNIX64); // unix64 call (alpha only) |
|
9463 | 252 |
|
18228 | 253 |
@global(CALLTYPE_MASK) = __MKSMALLINT(__EXTL_CALLTYPE_MASK); |
254 |
#endif |
|
255 |
%} |
|
13337 | 256 |
]. |
9465 | 257 |
|
10025
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
258 |
" |
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
259 |
self initialize |
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
260 |
" |
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
261 |
|
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
262 |
"Modified: / 03-10-2006 / 21:27:47 / cg" |
11053 | 263 |
! |
264 |
||
265 |
removeFromDllPath:aDirectoryPathName |
|
266 |
"remove added places from dll-loading" |
|
267 |
||
268 |
|oldPath| |
|
269 |
||
270 |
oldPath := self dllPath. |
|
271 |
self dllPath:(oldPath asOrderedCollection copyWithout:aDirectoryPathName) |
|
272 |
||
273 |
" |
|
274 |
self dllPath. |
|
11586 | 275 |
self addToDllPath:'C:\aaa\bbb'. |
11053 | 276 |
self dllPath. |
277 |
self removeFromDllPath:'C:\aaa\bbb'. |
|
278 |
self dllPath. |
|
279 |
" |
|
8550 | 280 |
! ! |
281 |
||
9321 | 282 |
!ExternalLibraryFunction class methodsFor:'constants'! |
283 |
||
284 |
callTypeAPI |
|
9463 | 285 |
^ CALLTYPE_API |
9321 | 286 |
|
9463 | 287 |
"Modified: / 01-08-2006 / 13:44:41 / cg" |
9435 | 288 |
! |
289 |
||
9321 | 290 |
callTypeC |
9463 | 291 |
^ CALLTYPE_C |
9321 | 292 |
|
9463 | 293 |
"Modified: / 01-08-2006 / 13:44:49 / cg" |
9435 | 294 |
! |
295 |
||
9321 | 296 |
callTypeCDecl |
9463 | 297 |
^ CALLTYPE_C |
9321 | 298 |
|
9463 | 299 |
"Modified: / 01-08-2006 / 13:44:52 / cg" |
9435 | 300 |
! |
301 |
||
10619 | 302 |
callTypeMASK |
303 |
^ CALLTYPE_MASK |
|
304 |
||
305 |
"Modified: / 01-08-2006 / 13:44:57 / cg" |
|
306 |
! |
|
307 |
||
9321 | 308 |
callTypeOLE |
9463 | 309 |
^ CALLTYPE_OLE |
9435 | 310 |
|
9463 | 311 |
"Modified: / 01-08-2006 / 13:44:57 / cg" |
9321 | 312 |
! ! |
313 |
||
314 |
!ExternalLibraryFunction methodsFor:'accessing'! |
|
315 |
||
316 |
argumentTypes |
|
317 |
^ argumentTypes |
|
9463 | 318 |
! |
319 |
||
11426 | 320 |
argumentTypesString |
11586 | 321 |
^ String |
322 |
streamContents:[:s | |
|
323 |
argumentTypes do:[:eachArgType | |
|
324 |
eachArgType printOn:s. |
|
325 |
] separatedBy:[ |
|
326 |
s nextPutAll:','. |
|
327 |
]. |
|
328 |
]. |
|
11426 | 329 |
! |
330 |
||
9463 | 331 |
beAsync |
332 |
"let this execute in a separate thread, in par with the other execution thread(s). |
|
333 |
Ignored under unix/linux (until those support multiple threads too)." |
|
334 |
||
335 |
flags := (flags ? 0) bitOr: FLAG_ASYNC. |
|
336 |
||
337 |
"Created: / 01-08-2006 / 13:42:38 / cg" |
|
338 |
! |
|
339 |
||
9465 | 340 |
beCallTypeAPI |
341 |
flags := (flags ? 0) bitOr: CALLTYPE_API. |
|
342 |
||
343 |
"Created: / 01-08-2006 / 15:12:40 / cg" |
|
344 |
! |
|
345 |
||
346 |
beCallTypeC |
|
347 |
flags := (flags ? 0) bitOr: CALLTYPE_C. |
|
348 |
||
349 |
"Created: / 01-08-2006 / 15:12:40 / cg" |
|
350 |
! |
|
351 |
||
10481 | 352 |
beCallTypeOLE |
353 |
flags := (flags ? 0) bitOr: FLAG_VIRTUAL. |
|
354 |
||
355 |
"Created: / 01-08-2006 / 15:12:40 / cg" |
|
356 |
! |
|
357 |
||
9465 | 358 |
beCallTypeUNIX64 |
359 |
flags := (flags ? 0) bitOr: CALLTYPE_UNIX64. |
|
360 |
||
361 |
"Created: / 01-08-2006 / 15:13:38 / cg" |
|
362 |
! |
|
363 |
||
364 |
beCallTypeV8 |
|
365 |
flags := (flags ? 0) bitOr: CALLTYPE_V8. |
|
366 |
||
367 |
"Created: / 01-08-2006 / 15:13:28 / cg" |
|
368 |
! |
|
369 |
||
370 |
beCallTypeV9 |
|
371 |
flags := (flags ? 0) bitOr: CALLTYPE_V9. |
|
372 |
||
373 |
"Created: / 01-08-2006 / 15:13:31 / cg" |
|
374 |
! |
|
375 |
||
376 |
beCallTypeWINAPI |
|
377 |
self beCallTypeAPI |
|
378 |
||
379 |
"Modified: / 01-08-2006 / 15:14:02 / cg" |
|
380 |
! |
|
381 |
||
9525 | 382 |
beConstReturnValue |
10025
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
383 |
"specify that a pointer return value is not to be finalized |
9525 | 384 |
(i.e. points to static data or data which is freed by c)" |
385 |
||
386 |
flags := (flags ? 0) bitOr: FLAG_RETVAL_IS_CONST. |
|
387 |
||
388 |
"Created: / 01-08-2006 / 13:56:48 / cg" |
|
389 |
! |
|
390 |
||
9463 | 391 |
beNonVirtualCPP |
392 |
"specify this as a non-virtual c++-function" |
|
393 |
||
394 |
flags := (flags ? 0) bitOr: FLAG_NONVIRTUAL. |
|
395 |
||
396 |
"Created: / 01-08-2006 / 13:56:44 / cg" |
|
397 |
! |
|
398 |
||
19311 | 399 |
beObjectiveC |
400 |
"specify this as an objective-c message send" |
|
401 |
||
402 |
flags := (flags ? 0) bitOr: FLAG_OBJECTIVEC. |
|
403 |
||
404 |
"Created: / 01-08-2006 / 13:56:48 / cg" |
|
405 |
! |
|
406 |
||
9463 | 407 |
beUnlimitedStack |
408 |
"let this execute on the c-stack (as opposed to the thread-stack) |
|
409 |
for unlimited auto-sized-stack under unix/linux. |
|
410 |
Ignored under windows." |
|
411 |
||
412 |
flags := (flags ? 0) bitOr: FLAG_UNLIMITEDSTACK. |
|
413 |
||
414 |
"Created: / 01-08-2006 / 13:41:54 / cg" |
|
415 |
! |
|
416 |
||
417 |
beVirtualCPP |
|
418 |
"specify this as a virtual c++-function" |
|
419 |
||
420 |
flags := (flags ? 0) bitOr: FLAG_VIRTUAL. |
|
421 |
||
422 |
"Created: / 01-08-2006 / 13:56:48 / cg" |
|
423 |
! |
|
424 |
||
9465 | 425 |
callTypeNumber |
426 |
^ (flags ? 0) bitAnd: CALLTYPE_MASK. |
|
427 |
||
428 |
"Created: / 01-08-2006 / 15:12:10 / cg" |
|
429 |
! |
|
430 |
||
9463 | 431 |
isAsync |
432 |
"is this executed in a separate thread, in par with the other execution thread(s) ?" |
|
433 |
||
434 |
^ (flags ? 0) bitTest: FLAG_ASYNC. |
|
435 |
||
436 |
"Created: / 01-08-2006 / 13:46:53 / cg" |
|
437 |
! |
|
438 |
||
9519 | 439 |
isCPPFunction |
440 |
"is this a virtual or non-virtual c++-function ?" |
|
441 |
||
442 |
^ (flags ? 0) bitTest: (FLAG_VIRTUAL bitOr: FLAG_NONVIRTUAL). |
|
443 |
||
444 |
"Created: / 01-08-2006 / 13:56:54 / cg" |
|
445 |
! |
|
446 |
||
9465 | 447 |
isCallTypeAPI |
448 |
^ ((flags ? 0) bitAnd: CALLTYPE_MASK) == CALLTYPE_API. |
|
449 |
||
450 |
"Created: / 01-08-2006 / 15:21:16 / cg" |
|
451 |
! |
|
452 |
||
453 |
isCallTypeC |
|
454 |
^ ((flags ? 0) bitAnd: CALLTYPE_MASK) == CALLTYPE_C. |
|
455 |
||
456 |
"Created: / 01-08-2006 / 15:21:23 / cg" |
|
457 |
! |
|
458 |
||
10483 | 459 |
isCallTypeOLE |
460 |
^ ((flags ? 0) bitTest: FLAG_VIRTUAL). |
|
461 |
||
462 |
"Created: / 01-08-2006 / 15:21:23 / cg" |
|
463 |
! |
|
464 |
||
9525 | 465 |
isConstReturnValue |
10025
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
466 |
"is the pointer return value not to be finalized |
9525 | 467 |
(i.e. points to static data or data which is freed by c)" |
468 |
||
469 |
^ (flags ? 0) bitTest: FLAG_RETVAL_IS_CONST. |
|
470 |
||
471 |
"Created: / 01-08-2006 / 13:56:48 / cg" |
|
472 |
! |
|
473 |
||
9463 | 474 |
isNonVirtualCPP |
475 |
"is this a non-virtual c++-function ?" |
|
476 |
||
477 |
^ (flags ? 0) bitTest: FLAG_NONVIRTUAL. |
|
478 |
||
479 |
"Created: / 01-08-2006 / 13:56:51 / cg" |
|
480 |
! |
|
481 |
||
19311 | 482 |
isObjectiveC |
483 |
"is this an objective-C message?" |
|
484 |
||
485 |
^ (flags ? 0) bitTest: FLAG_OBJECTIVEC. |
|
486 |
! |
|
487 |
||
9463 | 488 |
isUnlimitedStack |
489 |
"will this execute on the c-stack (as opposed to the thread-stack) |
|
490 |
for unlimited auto-sized-stack under unix/linux. |
|
491 |
Ignored under windows." |
|
492 |
||
493 |
^ (flags ? 0) bitTest: FLAG_UNLIMITEDSTACK. |
|
494 |
||
495 |
"Created: / 01-08-2006 / 14:17:07 / cg" |
|
496 |
! |
|
497 |
||
498 |
isVirtualCPP |
|
499 |
"is this a virtual c++-function ?" |
|
500 |
||
501 |
^ (flags ? 0) bitTest: FLAG_VIRTUAL. |
|
502 |
||
503 |
"Created: / 01-08-2006 / 13:56:54 / cg" |
|
10483 | 504 |
! |
505 |
||
11426 | 506 |
moduleName |
507 |
^ moduleName |
|
508 |
! |
|
509 |
||
10484 | 510 |
returnType |
511 |
^ returnType |
|
512 |
! |
|
513 |
||
10483 | 514 |
vtableIndex |
515 |
name isNumber ifFalse:[^ nil]. |
|
516 |
^ name. |
|
9321 | 517 |
! ! |
518 |
||
8891
c30a030ff5ec
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
8728
diff
changeset
|
519 |
!ExternalLibraryFunction methodsFor:'invoking'! |
c30a030ff5ec
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
8728
diff
changeset
|
520 |
|
c30a030ff5ec
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
8728
diff
changeset
|
521 |
invoke |
9321 | 522 |
self hasCode ifFalse:[ |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
523 |
self prepareInvoke. |
8891
c30a030ff5ec
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
8728
diff
changeset
|
524 |
]. |
19311 | 525 |
^ self invokeFFIwithArguments:nil forCPPInstance:nil |
8891
c30a030ff5ec
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
8728
diff
changeset
|
526 |
! |
c30a030ff5ec
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
8728
diff
changeset
|
527 |
|
9347 | 528 |
invokeCPPVirtualOn:anInstance |
9341 | 529 |
self hasCode ifFalse:[ |
11586 | 530 |
self prepareInvoke. |
9341 | 531 |
]. |
10440 | 532 |
^ self invokeCPPVirtualFFIOn:anInstance withArguments:nil |
9341 | 533 |
! |
534 |
||
9347 | 535 |
invokeCPPVirtualOn:instance with:arg |
9341 | 536 |
self hasCode ifFalse:[ |
10025
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
537 |
self prepareInvoke. |
9341 | 538 |
]. |
9347 | 539 |
^ self invokeCPPVirtualFFIOn:instance withArguments:(Array with:arg) |
9341 | 540 |
! |
541 |
||
9347 | 542 |
invokeCPPVirtualOn:instance with:arg1 with:arg2 |
9341 | 543 |
self hasCode ifFalse:[ |
10025
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
544 |
self prepareInvoke. |
9341 | 545 |
]. |
9347 | 546 |
^ self invokeCPPVirtualFFIOn:instance withArguments:(Array with:arg1 with:arg2) |
9341 | 547 |
! |
548 |
||
9347 | 549 |
invokeCPPVirtualOn:instance with:arg1 with:arg2 with:arg3 |
9341 | 550 |
self hasCode ifFalse:[ |
10025
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
551 |
self prepareInvoke. |
9341 | 552 |
]. |
9347 | 553 |
^ self invokeCPPVirtualFFIOn:instance withArguments:(Array with:arg1 with:arg2 with:arg3) |
9341 | 554 |
! |
555 |
||
9347 | 556 |
invokeCPPVirtualOn:instance with:arg1 with:arg2 with:arg3 with:arg4 |
9341 | 557 |
self hasCode ifFalse:[ |
10025
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
558 |
self prepareInvoke. |
9341 | 559 |
]. |
9347 | 560 |
^ self invokeCPPVirtualFFIOn:instance withArguments:(Array with:arg1 with:arg2 with:arg3 with:arg4) |
9341 | 561 |
! |
562 |
||
10481 | 563 |
invokeCPPVirtualOn:instance withArguments:args |
564 |
self hasCode ifFalse:[ |
|
11586 | 565 |
self prepareInvoke. |
10481 | 566 |
]. |
567 |
^ self invokeCPPVirtualFFIOn:instance withArguments:args |
|
568 |
! |
|
569 |
||
8891
c30a030ff5ec
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
8728
diff
changeset
|
570 |
invokeWith:arg |
9321 | 571 |
self hasCode ifFalse:[ |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
572 |
self prepareInvoke. |
9321 | 573 |
]. |
19311 | 574 |
^ self invokeFFIwithArguments:(Array with:arg) forCPPInstance:nil |
9321 | 575 |
! |
8891
c30a030ff5ec
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
8728
diff
changeset
|
576 |
|
9321 | 577 |
invokeWith:arg1 with:arg2 |
578 |
self hasCode ifFalse:[ |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
579 |
self prepareInvoke. |
8891
c30a030ff5ec
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
8728
diff
changeset
|
580 |
]. |
19311 | 581 |
^ self invokeFFIwithArguments:(Array with:arg1 with:arg2) forCPPInstance:nil |
9321 | 582 |
! |
583 |
||
584 |
invokeWith:arg1 with:arg2 with:arg3 |
|
585 |
self hasCode ifFalse:[ |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
586 |
self prepareInvoke. |
9321 | 587 |
]. |
19311 | 588 |
^ self invokeFFIwithArguments:(Array with:arg1 with:arg2 with:arg3) forCPPInstance:nil |
9321 | 589 |
! |
8891
c30a030ff5ec
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
8728
diff
changeset
|
590 |
|
9321 | 591 |
invokeWith:arg1 with:arg2 with:arg3 with:arg4 |
592 |
self hasCode ifFalse:[ |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
593 |
self prepareInvoke. |
9321 | 594 |
]. |
19311 | 595 |
^ self invokeFFIwithArguments:(Array with:arg1 with:arg2 with:arg3 with:arg4) forCPPInstance:nil |
9321 | 596 |
! |
8891
c30a030ff5ec
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
8728
diff
changeset
|
597 |
|
9321 | 598 |
invokeWithArguments:argArray |
599 |
self hasCode ifFalse:[ |
|
10025
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
600 |
self prepareInvoke. |
9321 | 601 |
]. |
9465 | 602 |
^ self invokeFFIwithArguments:argArray forCPPInstance:nil |
603 |
||
604 |
"Modified: / 01-08-2006 / 16:04:08 / cg" |
|
9321 | 605 |
! ! |
606 |
||
607 |
!ExternalLibraryFunction methodsFor:'printing'! |
|
608 |
||
609 |
printOn:aStream |
|
610 |
aStream nextPutAll:'<'. |
|
9465 | 611 |
self isCallTypeAPI ifTrue:[ |
14625 | 612 |
'API:' printOn:aStream. |
9465 | 613 |
] ifFalse:[ |
14625 | 614 |
self isCallTypeOLE ifTrue:[ |
615 |
'OLE:' printOn:aStream. |
|
616 |
] ifFalse:[ |
|
617 |
self isCallTypeC ifTrue:[ |
|
618 |
'C:' printOn:aStream. |
|
619 |
] ifFalse:[ |
|
620 |
self error. |
|
621 |
]. |
|
622 |
]. |
|
9465 | 623 |
]. |
9321 | 624 |
aStream nextPutAll:' '. |
625 |
name printOn:aStream. |
|
9465 | 626 |
moduleName notNil ifTrue:[ |
14625 | 627 |
aStream nextPutAll:' module:'. |
628 |
moduleName printOn:aStream. |
|
9465 | 629 |
]. |
9321 | 630 |
aStream nextPutAll:'>'. |
9465 | 631 |
|
14356 | 632 |
"Modified: / 25-09-2012 / 12:06:14 / cg" |
8891
c30a030ff5ec
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
8728
diff
changeset
|
633 |
! ! |
c30a030ff5ec
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
8728
diff
changeset
|
634 |
|
c30a030ff5ec
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
8728
diff
changeset
|
635 |
!ExternalLibraryFunction methodsFor:'private'! |
c30a030ff5ec
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
8728
diff
changeset
|
636 |
|
10213 | 637 |
adjustTypes |
19313 | 638 |
argumentTypes notEmptyOrNil ifTrue:[ |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
639 |
argumentTypes := argumentTypes collect:[:argType | self ffiTypeSymbolForType:argType]. |
10213 | 640 |
]. |
641 |
returnType := self ffiTypeSymbolForType:returnType. |
|
642 |
! |
|
643 |
||
8891
c30a030ff5ec
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
8728
diff
changeset
|
644 |
linkToModule |
c30a030ff5ec
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
8728
diff
changeset
|
645 |
"link this function to the external module. |
c30a030ff5ec
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
8728
diff
changeset
|
646 |
I.e. retrieve the module handle and the code pointer." |
c30a030ff5ec
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
8728
diff
changeset
|
647 |
|
9465 | 648 |
|handle moduleNameUsed functionName| |
8891
c30a030ff5ec
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
8728
diff
changeset
|
649 |
|
10481 | 650 |
name isNumber ifTrue:[ |
14625 | 651 |
self isCPPFunction ifTrue:[ |
652 |
"/ no need to load a dll. |
|
653 |
^ self |
|
654 |
] |
|
10481 | 655 |
]. |
656 |
||
13782
1994fe87f21e
comment/format in: #linkToModule
Claus Gittinger <cg@exept.de>
parents:
13412
diff
changeset
|
657 |
"/ in some other smalltalks, there is no moduleName in the ffi-spec; |
1994fe87f21e
comment/format in: #linkToModule
Claus Gittinger <cg@exept.de>
parents:
13412
diff
changeset
|
658 |
"/ instead, the class provides the libraryName... |
9465 | 659 |
(moduleNameUsed := moduleName) isNil ifTrue:[ |
14625 | 660 |
owningClass isNil ifTrue:[ |
661 |
self error:'Missing moduleName'. |
|
662 |
]. |
|
663 |
moduleNameUsed := owningClass theNonMetaclass libraryName asSymbol. |
|
9321 | 664 |
]. |
11586 | 665 |
moduleHandle isNil ifTrue:[ |
14625 | 666 |
handle := self loadLibrary:moduleNameUsed. |
667 |
handle isNil ifTrue:[ |
|
668 |
self error:('Cannot find or load dll/module: "%1"' bindWith: moduleNameUsed). |
|
669 |
]. |
|
670 |
moduleHandle := handle. |
|
8891
c30a030ff5ec
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
8728
diff
changeset
|
671 |
]. |
9341 | 672 |
name isNumber ifFalse:[ |
14625 | 673 |
functionName := name. |
674 |
(moduleHandle getFunctionAddress:functionName into:self) isNil ifTrue:[ |
|
675 |
functionName := ('_', functionName) asSymbol. |
|
9418
df5d2576402d
resolve function - if function with name not exists add an underscore in front and retry
ca
parents:
9399
diff
changeset
|
676 |
|
14625 | 677 |
(moduleHandle getFunctionAddress:functionName into:self) isNil ifTrue:[ |
678 |
moduleHandle := nil. |
|
679 |
self error:'Missing function: ', name, ' in module: ', moduleNameUsed. |
|
680 |
]. |
|
681 |
]. |
|
9321 | 682 |
]. |
9392 | 683 |
|
14103 | 684 |
"Modified: / 10-04-2012 / 12:12:44 / cg" |
9321 | 685 |
! |
686 |
||
10270 | 687 |
loadLibrary:dllName |
12436 | 688 |
|handle nameString filename| |
10279
60c42983fdd4
first test whether the dllName is the complete filename
ca
parents:
10270
diff
changeset
|
689 |
|
14103 | 690 |
filename := dllName. |
691 |
DllMapping notNil ifTrue:[ |
|
14625 | 692 |
filename := DllMapping at:filename ifAbsent:[ filename ] |
14103 | 693 |
]. |
694 |
||
695 |
filename := filename asFilename. |
|
12436 | 696 |
nameString := filename name. |
10279
60c42983fdd4
first test whether the dllName is the complete filename
ca
parents:
10270
diff
changeset
|
697 |
|
12937 | 698 |
"try to load, maybe the system knows where to find the dll" |
699 |
handle := ObjectFileLoader loadDynamicObject:filename. |
|
700 |
handle notNil ifTrue:[^ handle ]. |
|
701 |
||
12436 | 702 |
filename isAbsolute ifFalse:[ |
14625 | 703 |
"First ask the class defining the ExternalFunction for the location of the dlls ..." |
704 |
owningClass notNil ifTrue:[ |
|
705 |
owningClass dllPath do:[:eachDirectory | |
|
706 |
handle := ObjectFileLoader |
|
707 |
loadDynamicObject:(eachDirectory asFilename construct:nameString) pathName. |
|
708 |
handle notNil ifTrue:[^ handle ]. |
|
709 |
]. |
|
710 |
]. |
|
711 |
".. then ask the system" |
|
712 |
self class dllPath do:[:eachDirectory | |
|
713 |
handle := ObjectFileLoader |
|
714 |
loadDynamicObject:(eachDirectory asFilename construct:nameString) pathName. |
|
715 |
handle notNil ifTrue:[^ handle ]. |
|
716 |
]. |
|
10279
60c42983fdd4
first test whether the dllName is the complete filename
ca
parents:
10270
diff
changeset
|
717 |
]. |
10270 | 718 |
|
12436 | 719 |
filename suffix isEmpty ifTrue:[ |
14625 | 720 |
"/ try again with the OS-specific dll-extension |
721 |
^ self loadLibrary:(filename withSuffix:ObjectFileLoader sharedLibrarySuffix) |
|
10270 | 722 |
]. |
12436 | 723 |
|
10270 | 724 |
^ nil |
14103 | 725 |
|
726 |
"Modified: / 10-04-2012 / 12:21:06 / cg" |
|
10270 | 727 |
! |
728 |
||
9321 | 729 |
prepareInvoke |
10270 | 730 |
(moduleHandle isNil or:[self hasCode not]) ifTrue:[ |
12450 | 731 |
self linkToModule. |
732 |
self adjustTypes. |
|
8891
c30a030ff5ec
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
8728
diff
changeset
|
733 |
]. |
c30a030ff5ec
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
8728
diff
changeset
|
734 |
! ! |
c30a030ff5ec
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
8728
diff
changeset
|
735 |
|
8550 | 736 |
!ExternalLibraryFunction methodsFor:'private-accessing'! |
737 |
||
9327 | 738 |
ffiTypeSymbolForType:aType |
10025
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
739 |
"map type to one of the ffi-supported ones: |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
740 |
sint8, sint16, sint32, sint64 |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
741 |
uint8, uint16, uint32, uint64 |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
742 |
bool void pointer handle |
10025
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
743 |
" |
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
744 |
|
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
745 |
aType == #sint8 ifTrue:[^ aType ]. |
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
746 |
aType == #sint16 ifTrue:[^ aType ]. |
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
747 |
aType == #sint32 ifTrue:[^ aType ]. |
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
748 |
aType == #sint64 ifTrue:[^ aType ]. |
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
749 |
aType == #uint8 ifTrue:[^ aType ]. |
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
750 |
aType == #uint16 ifTrue:[^ aType ]. |
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
751 |
aType == #uint32 ifTrue:[^ aType ]. |
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
752 |
aType == #uint64 ifTrue:[^ aType ]. |
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
753 |
aType == #double ifTrue:[^ aType ]. |
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
754 |
aType == #float ifTrue:[^ aType ]. |
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
755 |
aType == #char ifTrue:[^ aType ]. |
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
756 |
aType == #void ifTrue:[^ aType ]. |
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
757 |
aType == #bool ifTrue:[^ aType ]. |
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
758 |
aType == #pointer ifTrue:[^ aType ]. |
12657
7da296a8eeb6
changed: #ffiTypeSymbolForType:
Claus Gittinger <cg@exept.de>
parents:
12656
diff
changeset
|
759 |
aType == #charPointer ifTrue:[^ aType ]. |
7da296a8eeb6
changed: #ffiTypeSymbolForType:
Claus Gittinger <cg@exept.de>
parents:
12656
diff
changeset
|
760 |
aType == #wcharPointer ifTrue:[^ aType ]. |
10025
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
761 |
|
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
762 |
aType == #int8 ifTrue:[^ #sint8 ]. |
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
763 |
aType == #int16 ifTrue:[^ #sint16 ]. |
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
764 |
aType == #int32 ifTrue:[^ #sint32 ]. |
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
765 |
aType == #int64 ifTrue:[^ #sint64 ]. |
12450 | 766 |
|
767 |
aType == #voidPointer ifTrue:[^ #pointer ]. |
|
768 |
aType == #uint8Pointer ifTrue:[^ #pointer ]. |
|
12449
ca958524b42f
comment/format in: #prepareInvoke
Claus Gittinger <cg@exept.de>
parents:
12436
diff
changeset
|
769 |
aType == #voidPointerPointer ifTrue:[^ #pointer ]. |
10025
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
770 |
|
10213 | 771 |
aType == #short ifTrue:[^ #sint16 ]. |
11586 | 772 |
aType == #long ifTrue:[^ #long ]. |
773 |
aType == #int ifTrue:[^ #int ]. |
|
774 |
aType == #uint ifTrue:[^ #uint ]. |
|
10025
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
775 |
aType == #ushort ifTrue:[^ #uint16 ]. |
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
776 |
aType == #unsignedShort ifTrue:[^ #uint16 ]. |
11586 | 777 |
aType == #ulong ifTrue:[^ #ulong ]. |
778 |
aType == #unsignedLong ifTrue:[^ #ulong ]. |
|
10025
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
779 |
aType == #uchar ifTrue:[^ #uint8 ]. |
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
780 |
aType == #unsignedChar ifTrue:[^ #uint8 ]. |
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
781 |
aType == #byte ifTrue:[^ #uint8 ]. |
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
782 |
aType == #dword ifTrue:[^ #uint32 ]. |
10213 | 783 |
aType == #sdword ifTrue:[^ #sint32 ]. |
10025
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
784 |
aType == #word ifTrue:[^ #uint16 ]. |
10213 | 785 |
aType == #sword ifTrue:[^ #sint16 ]. |
12503
cb1a875c3d63
changed: #ffiTypeSymbolForType:
Claus Gittinger <cg@exept.de>
parents:
12474
diff
changeset
|
786 |
aType == #longlong ifTrue:[^ #sint64 ]. |
12450 | 787 |
aType == #longLong ifTrue:[^ #sint64 ]. |
12503
cb1a875c3d63
changed: #ffiTypeSymbolForType:
Claus Gittinger <cg@exept.de>
parents:
12474
diff
changeset
|
788 |
aType == #ulonglong ifTrue:[^ #uint64 ]. |
12450 | 789 |
aType == #ulongLong ifTrue:[^ #uint64 ]. |
10025
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
790 |
aType == #handle ifTrue:[^ #pointer ]. |
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
791 |
aType == #lpstr ifTrue:[^ #charPointer ]. |
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
792 |
aType == #hresult ifTrue:[^ #uint32 ]. |
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
793 |
aType == #boolean ifTrue:[^ #bool ]. |
19311 | 794 |
"/ care for 64bit machines |
795 |
ExternalAddress pointerSize == 8 ifTrue:[ |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
796 |
aType == #ulongReturn ifTrue:[^ #uint64 ]. |
19311 | 797 |
] ifFalse:[ |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
798 |
aType == #ulongReturn ifTrue:[^ #uint32 ]. |
19311 | 799 |
]. |
10025
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
800 |
aType == #none ifTrue:[^ #void ]. |
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
801 |
aType == #struct ifTrue:[^ #pointer ]. |
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
802 |
aType == #structIn ifTrue:[^ #pointer ]. |
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
803 |
aType == #structOut ifTrue:[^ #pointer ]. |
10981 | 804 |
aType == #unsigned ifTrue:[^ #uint ]. |
10025
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
805 |
|
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
806 |
(aType isString or:[aType isSymbol]) ifFalse:[ |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
807 |
CType isNil ifTrue:[ |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
808 |
self error:'unknown type'. |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
809 |
]. |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
810 |
^ aType typeSymbol. |
9483 | 811 |
]. |
812 |
||
12579
516bba5b3e57
changed: #ffiTypeSymbolForType:
Claus Gittinger <cg@exept.de>
parents:
12504
diff
changeset
|
813 |
(aType endsWith:'*') ifTrue:[ |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
814 |
^ #pointer. |
12579
516bba5b3e57
changed: #ffiTypeSymbolForType:
Claus Gittinger <cg@exept.de>
parents:
12504
diff
changeset
|
815 |
]. |
12449
ca958524b42f
comment/format in: #prepareInvoke
Claus Gittinger <cg@exept.de>
parents:
12436
diff
changeset
|
816 |
(aType endsWith:'Pointer') ifTrue:[ |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
817 |
^ #pointer. |
12449
ca958524b42f
comment/format in: #prepareInvoke
Claus Gittinger <cg@exept.de>
parents:
12436
diff
changeset
|
818 |
]. |
10025
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
819 |
^ aType |
10625 | 820 |
|
821 |
"Modified: / 14-06-2007 / 17:21:42 / cg" |
|
9322 | 822 |
! |
823 |
||
9466 | 824 |
name:functionNameOrVirtualIndex module:aModuleName returnType:aReturnType argumentTypes:argTypes |
825 |
name := functionNameOrVirtualIndex. |
|
826 |
functionNameOrVirtualIndex isNumber ifTrue:[ |
|
10025
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
827 |
self beVirtualCPP. |
9466 | 828 |
]. |
8891
c30a030ff5ec
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
8728
diff
changeset
|
829 |
moduleName := aModuleName. |
c30a030ff5ec
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
8728
diff
changeset
|
830 |
returnType := aReturnType. |
c30a030ff5ec
more FFI (foreign function interface) support - still incomplete
Stefan Vogel <sv@exept.de>
parents:
8728
diff
changeset
|
831 |
argumentTypes := argTypes. |
9465 | 832 |
|
833 |
"Created: / 01-08-2006 / 15:19:52 / cg" |
|
9466 | 834 |
"Modified: / 02-08-2006 / 17:20:13 / cg" |
9465 | 835 |
! |
836 |
||
11426 | 837 |
owningClass |
838 |
^ owningClass |
|
839 |
! |
|
840 |
||
9465 | 841 |
owningClass:aClass |
842 |
owningClass := aClass. |
|
843 |
||
844 |
"Created: / 01-08-2006 / 15:22:50 / cg" |
|
10603 | 845 |
! |
846 |
||
11586 | 847 |
setModuleName:aModuleName |
10603 | 848 |
aModuleName ~= moduleName ifTrue:[ |
11586 | 849 |
self code:nil. |
850 |
moduleHandle := nil. |
|
851 |
moduleName := aModuleName. |
|
10603 | 852 |
]. |
853 |
||
854 |
"Created: / 07-06-2007 / 10:20:17 / cg" |
|
8550 | 855 |
! ! |
856 |
||
9342 | 857 |
!ExternalLibraryFunction methodsFor:'private-invoking'! |
858 |
||
9347 | 859 |
invokeCPPVirtualFFIOn:instance withArguments:arguments |
9463 | 860 |
^ self invokeFFIwithArguments:arguments forCPPInstance:instance |
861 |
||
862 |
"Modified: / 01-08-2006 / 13:55:30 / cg" |
|
9342 | 863 |
! |
864 |
||
9347 | 865 |
invokeFFIWithArguments:arguments |
9463 | 866 |
^ self invokeFFIwithArguments:arguments forCPPInstance:nil |
867 |
||
868 |
"Modified: / 01-08-2006 / 13:55:35 / cg" |
|
9347 | 869 |
! |
870 |
||
14659
410089913ca1
allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents:
14632
diff
changeset
|
871 |
invokeFFIwithArguments:argumentsOrNil forCPPInstance:aReceiverOrNil |
410089913ca1
allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents:
14632
diff
changeset
|
872 |
"basic invoke mechanism. Calls the function represented by the receiver with argumentsOrNil. |
410089913ca1
allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents:
14632
diff
changeset
|
873 |
For cplusplus, aReceiverOrNil is required to be an externalStructure like object; |
410089913ca1
allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents:
14632
diff
changeset
|
874 |
for objectiveC, it must be an ObjectiveC object" |
410089913ca1
allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents:
14632
diff
changeset
|
875 |
|
10025
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
876 |
|argTypeSymbols returnTypeSymbol failureCode failureInfo returnValue stClass vtOffset |
14659
410089913ca1
allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents:
14632
diff
changeset
|
877 |
virtual objectiveC async unlimitedStack callTypeNumber returnValueClass argValueClass |
410089913ca1
allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents:
14632
diff
changeset
|
878 |
oldReturnType oldArgumentTypes| |
9342 | 879 |
|
10025
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
880 |
argTypeSymbols := argumentTypes. |
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
881 |
returnTypeSymbol := returnType. |
9346 | 882 |
|
10025
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
883 |
virtual := self isVirtualCPP. |
14659
410089913ca1
allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents:
14632
diff
changeset
|
884 |
objectiveC := self isObjectiveC. |
9524 | 885 |
(virtual "or:[self isNonVirtualCPP]") ifTrue:[ |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
886 |
aReceiverOrNil isNil ifTrue:[ |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
887 |
"/ must have a c++ object instance |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
888 |
self primitiveFailed. |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
889 |
]. |
9463 | 890 |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
891 |
"/ and it must be a kind of ExternalStructure !! |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
892 |
(aReceiverOrNil isKindOf:ExternalStructure) ifFalse:[ |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
893 |
self primitiveFailed. |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
894 |
]. |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
895 |
virtual ifTrue:[ |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
896 |
vtOffset := name. |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
897 |
(vtOffset between:0 and:10000) ifFalse:[ |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
898 |
self primitiveFailed. |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
899 |
] |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
900 |
]. |
9463 | 901 |
] ifFalse:[ |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
902 |
objectiveC ifTrue:[ |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
903 |
aReceiverOrNil isNil ifTrue:[ |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
904 |
"/ must have an objective-c object instance |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
905 |
self primitiveFailed. |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
906 |
]. |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
907 |
(aReceiverOrNil isObjectiveCObject) ifFalse:[ |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
908 |
self primitiveFailed |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
909 |
] |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
910 |
] ifFalse:[ |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
911 |
aReceiverOrNil notNil ifTrue:[ |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
912 |
"/ must NOT have a c++/objectiveC object instance |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
913 |
self primitiveFailed. |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
914 |
] |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
915 |
]. |
9342 | 916 |
]. |
9463 | 917 |
async := self isAsync. |
918 |
unlimitedStack := self isUnlimitedStack. |
|
9465 | 919 |
callTypeNumber := self callTypeNumber. |
10512 | 920 |
"/ Transcript show:name; show:' async:'; showCR:async. |
9342 | 921 |
|
9459
6cd520c582b3
change from unlimited to big stack, to allow for interrupts to be handled
ca
parents:
9436
diff
changeset
|
922 |
%{ /* STACK: 100000 */ |
14659
410089913ca1
allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents:
14632
diff
changeset
|
923 |
|
10025
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
924 |
#ifdef HAVE_FFI |
12504
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
925 |
# ifdef __GNUC__ |
14659
410089913ca1
allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents:
14632
diff
changeset
|
926 |
# ifndef HAS_LONGLONG |
410089913ca1
allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents:
14632
diff
changeset
|
927 |
# define HAS_LONGLONG |
410089913ca1
allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents:
14632
diff
changeset
|
928 |
# endif |
12504
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
929 |
# endif |
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
930 |
# if defined(__BORLANDC__) || defined(__VISUALC__) |
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
931 |
# define HAS_INT64 |
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
932 |
# endif |
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
933 |
|
9342 | 934 |
ffi_cif __cif; |
935 |
ffi_type *__argTypesIncludingThis[MAX_ARGS+1]; |
|
936 |
ffi_type **__argTypes = __argTypesIncludingThis; |
|
937 |
ffi_type *__returnType = NULL; |
|
12504
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
938 |
|
9342 | 939 |
union u { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
940 |
INT iVal; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
941 |
float fVal; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
942 |
double dVal; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
943 |
void *pointerVal; |
12504
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
944 |
# if defined(HAS_LONGLONG) |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
945 |
long long longLongVal; |
12504
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
946 |
# else |
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
947 |
# ifdef HAS_INT64 |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
948 |
__int64__ longLongVal; |
12504
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
949 |
# else |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
950 |
struct ll { long low; long hi; } longLongVal; |
12504
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
951 |
# endif |
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
952 |
# endif |
9342 | 953 |
}; |
954 |
union u __argValuesIncludingThis[MAX_ARGS+1]; |
|
955 |
union u *__argValues = __argValuesIncludingThis; |
|
956 |
union u __returnValue; |
|
957 |
void *__argValuePointersIncludingThis[MAX_ARGS+1]; |
|
958 |
void **__argValuePointers = __argValuePointersIncludingThis; |
|
959 |
void *__returnValuePointer; |
|
960 |
int __numArgs, __numArgsIncludingThis; |
|
19311 | 961 |
static INT null = 0; |
9342 | 962 |
int i; |
963 |
ffi_abi __callType = FFI_DEFAULT_ABI; |
|
964 |
VOIDFUNC codeAddress = (VOIDFUNC)__INST(code_); |
|
10440 | 965 |
int __numArgsWanted; |
12579
516bba5b3e57
changed: #ffiTypeSymbolForType:
Claus Gittinger <cg@exept.de>
parents:
12504
diff
changeset
|
966 |
|
12504
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
967 |
# define __FAIL__(fcode) \ |
10603 | 968 |
{ \ |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
969 |
failureCode = fcode; goto getOutOfHere; \ |
10603 | 970 |
} |
9342 | 971 |
|
10440 | 972 |
if (argumentsOrNil == nil) { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
973 |
__numArgs = 0; |
10440 | 974 |
} else if (__isArray(argumentsOrNil)) { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
975 |
__numArgs = __arraySize(argumentsOrNil); |
9342 | 976 |
} else { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
977 |
__FAIL__(@symbol(BadArgumentVector)) |
10440 | 978 |
} |
979 |
if (argTypeSymbols == nil) { |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
980 |
__numArgsWanted = 0; |
10440 | 981 |
} else if (__isArray(argTypeSymbols)) { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
982 |
__numArgsWanted = __arraySize(argTypeSymbols); |
10440 | 983 |
} else { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
984 |
__FAIL__(@symbol(BadArgumentTypeVector)) |
10440 | 985 |
} |
986 |
||
987 |
if (__numArgs != __numArgsWanted) { |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
988 |
__FAIL__(@symbol(ArgumentCountMismatch)) |
9342 | 989 |
} |
990 |
if (__numArgs > MAX_ARGS) { |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
991 |
__FAIL__(@symbol(TooManyArguments)) |
9342 | 992 |
} |
993 |
||
994 |
/* |
|
995 |
* validate the return type |
|
996 |
*/ |
|
997 |
__returnValuePointer = &__returnValue; |
|
9479 | 998 |
|
9483 | 999 |
if (returnTypeSymbol == @symbol(voidPointer)) { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1000 |
returnTypeSymbol = @symbol(handle); |
9483 | 1001 |
} |
9479 | 1002 |
|
9342 | 1003 |
if (returnTypeSymbol == @symbol(int)) { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1004 |
__returnType = __get_ffi_type_sint(); |
9342 | 1005 |
} else if (returnTypeSymbol == @symbol(uint)) { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1006 |
__returnType = __get_ffi_type_uint(); |
9479 | 1007 |
} else if (returnTypeSymbol == @symbol(uint8)) { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1008 |
__returnType = __get_ffi_type_uint8(); |
9479 | 1009 |
} else if (returnTypeSymbol == @symbol(uint16)) { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1010 |
__returnType = __get_ffi_type_uint16(); |
9479 | 1011 |
} else if (returnTypeSymbol == @symbol(uint32)) { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1012 |
__returnType = __get_ffi_type_uint32(); |
9479 | 1013 |
} else if (returnTypeSymbol == @symbol(uint64)) { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1014 |
__returnType = __get_ffi_type_uint64(); |
9479 | 1015 |
|
1016 |
} else if (returnTypeSymbol == @symbol(sint)) { |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1017 |
__returnType = __get_ffi_type_sint(); |
9479 | 1018 |
} else if (returnTypeSymbol == @symbol(sint8)) { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1019 |
__returnType = __get_ffi_type_sint8(); |
9479 | 1020 |
} else if (returnTypeSymbol == @symbol(sint16)) { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1021 |
__returnType = __get_ffi_type_sint16(); |
9479 | 1022 |
} else if (returnTypeSymbol == @symbol(sint32)) { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1023 |
__returnType = __get_ffi_type_sint32(); |
9479 | 1024 |
} else if (returnTypeSymbol == @symbol(sint64)) { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1025 |
__returnType = __get_ffi_type_sint64(); |
9479 | 1026 |
|
9342 | 1027 |
} else if (returnTypeSymbol == @symbol(long)) { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1028 |
if (sizeof(long) == 4) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1029 |
returnTypeSymbol = @symbol(sint32); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1030 |
__returnType = __get_ffi_type_sint32(); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1031 |
} else if (sizeof(long) == 8) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1032 |
returnTypeSymbol = @symbol(sint64); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1033 |
__returnType = __get_ffi_type_sint64(); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1034 |
} else { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1035 |
__FAIL__(@symbol(UnknownReturnType)) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1036 |
} |
9479 | 1037 |
|
9342 | 1038 |
} else if (returnTypeSymbol == @symbol(ulong)) { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1039 |
if (sizeof(long) == 4) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1040 |
returnTypeSymbol = @symbol(uint32); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1041 |
__returnType = __get_ffi_type_uint32(); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1042 |
}else if (sizeof(long) == 8) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1043 |
returnTypeSymbol = @symbol(uint64); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1044 |
__returnType = __get_ffi_type_uint64(); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1045 |
} else { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1046 |
__FAIL__(@symbol(UnknownReturnType)) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1047 |
} |
9479 | 1048 |
|
10025
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
1049 |
} else if (returnTypeSymbol == @symbol(bool)) { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1050 |
__returnType = __get_ffi_type_uint(); |
9479 | 1051 |
|
9342 | 1052 |
} else if (returnTypeSymbol == @symbol(float)) { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1053 |
__returnType = __get_ffi_type_float(); |
9342 | 1054 |
} else if (returnTypeSymbol == @symbol(double)) { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1055 |
__returnType = __get_ffi_type_double(); |
9479 | 1056 |
|
9342 | 1057 |
} else if (returnTypeSymbol == @symbol(void)) { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1058 |
__returnType = __get_ffi_type_void(); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1059 |
__returnValuePointer = NULL; |
11586 | 1060 |
} else if ((returnTypeSymbol == @symbol(pointer)) |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1061 |
|| (returnTypeSymbol == @symbol(handle)) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1062 |
|| (returnTypeSymbol == @symbol(charPointer)) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1063 |
|| (returnTypeSymbol == @symbol(bytePointer)) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1064 |
|| (returnTypeSymbol == @symbol(floatPointer)) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1065 |
|| (returnTypeSymbol == @symbol(doublePointer)) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1066 |
|| (returnTypeSymbol == @symbol(intPointer)) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1067 |
|| (returnTypeSymbol == @symbol(shortPointer)) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1068 |
|| (returnTypeSymbol == @symbol(wcharPointer))) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1069 |
__returnType = __get_ffi_type_pointer(); |
9342 | 1070 |
} else { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1071 |
if (__isSymbol(returnTypeSymbol) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1072 |
&& ((returnValueClass = __GLOBAL_GET(returnTypeSymbol)) != nil)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1073 |
if (! __isBehaviorLike(returnValueClass)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1074 |
__FAIL__(@symbol(NonBehaviorReturnType)) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1075 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1076 |
if (! __qIsSubclassOfExternalAddress(returnValueClass)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1077 |
__FAIL__(@symbol(NonExternalAddressReturnType)) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1078 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1079 |
__returnType = __get_ffi_type_pointer(); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1080 |
returnTypeSymbol = @symbol(pointer); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1081 |
} else { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1082 |
__FAIL__(@symbol(UnknownReturnType)) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1083 |
} |
9342 | 1084 |
} |
1085 |
||
1086 |
/* |
|
1087 |
* validate the c++ object |
|
1088 |
*/ |
|
14659
410089913ca1
allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents:
14632
diff
changeset
|
1089 |
if (aReceiverOrNil != nil) { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1090 |
struct cPlusPlusInstance { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1091 |
void **vTable; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1092 |
}; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1093 |
struct cPlusPlusInstance *inst; |
9342 | 1094 |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1095 |
if (__isExternalAddressLike(aReceiverOrNil)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1096 |
inst = (void *)(__externalAddressVal(aReceiverOrNil)); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1097 |
} else if (__isExternalBytesLike(aReceiverOrNil)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1098 |
inst = (void *)(__externalBytesVal(aReceiverOrNil)); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1099 |
} else { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1100 |
__FAIL__(@symbol(InvalidInstance)) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1101 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1102 |
__argValues[0].pointerVal = inst; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1103 |
__argValuePointersIncludingThis[0] = &(__argValues[0]); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1104 |
__argTypes[0] = __get_ffi_type_pointer(); |
9342 | 1105 |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1106 |
__argValuePointers = &__argValuePointersIncludingThis[1]; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1107 |
__argTypes = &__argTypesIncludingThis[1]; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1108 |
__argValues = &__argValuesIncludingThis[1]; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1109 |
__numArgsIncludingThis = __numArgs + 1; |
9347 | 1110 |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1111 |
if (virtual == true) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1112 |
if (! __isSmallInteger(vtOffset)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1113 |
__FAIL__(@symbol(InvalidVTableIndex)) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1114 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1115 |
codeAddress = inst->vTable[__intVal(vtOffset)]; |
12504
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
1116 |
# ifdef VERBOSE |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1117 |
if (@global(Verbose) == true) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1118 |
printf("virtual codeAddress: %"_lx_"\n", (INT)codeAddress); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1119 |
} |
12504
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
1120 |
# endif |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1121 |
} |
9342 | 1122 |
} else { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1123 |
__numArgsIncludingThis = __numArgs; |
12504
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
1124 |
# ifdef VERBOSE |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1125 |
if (@global(Verbose) == true) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1126 |
printf("codeAddress: %"_lx_"\n", (INT)codeAddress); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1127 |
} |
12504
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
1128 |
# endif |
9342 | 1129 |
} |
1130 |
||
1131 |
/* |
|
1132 |
* validate all arg types and setup arg-buffers |
|
1133 |
*/ |
|
1134 |
for (i=0; i<__numArgs; i++) { |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1135 |
ffi_type *thisType; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1136 |
void *argValuePtr; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1137 |
OBJ typeSymbol; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1138 |
OBJ arg; |
9342 | 1139 |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1140 |
failureInfo = __mkSmallInteger(i+1); /* in case there is one */ |
9465 | 1141 |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1142 |
typeSymbol = __ArrayInstPtr(argTypeSymbols)->a_element[i]; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1143 |
arg = __ArrayInstPtr(argumentsOrNil)->a_element[i]; |
9342 | 1144 |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1145 |
if (typeSymbol == @symbol(handle)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1146 |
typeSymbol = @symbol(pointer); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1147 |
} else if (typeSymbol == @symbol(voidPointer)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1148 |
typeSymbol = @symbol(pointer); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1149 |
} |
9479 | 1150 |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1151 |
if (typeSymbol == @symbol(long)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1152 |
if (sizeof(long) == sizeof(int)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1153 |
typeSymbol = @symbol(sint); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1154 |
} else { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1155 |
if (sizeof(long) == 4) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1156 |
typeSymbol = @symbol(sint32); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1157 |
} else if (sizeof(long) == 8) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1158 |
typeSymbol = @symbol(sint64); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1159 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1160 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1161 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1162 |
if (typeSymbol == @symbol(ulong)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1163 |
if (sizeof(unsigned long) == sizeof(unsigned int)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1164 |
typeSymbol = @symbol(uint); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1165 |
} else { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1166 |
if (sizeof(long) == 4) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1167 |
typeSymbol = @symbol(uint32); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1168 |
} else if (sizeof(long) == 8) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1169 |
typeSymbol = @symbol(uint64); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1170 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1171 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1172 |
} |
9342 | 1173 |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1174 |
if (typeSymbol == @symbol(int) || typeSymbol == @symbol(sint)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1175 |
thisType = __get_ffi_type_sint(); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1176 |
if (__isSmallInteger(arg)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1177 |
__argValues[i].iVal = __intVal(arg); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1178 |
} else { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1179 |
__argValues[i].iVal = __signedLongIntVal(arg); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1180 |
if (__argValues[i].iVal == 0) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1181 |
__FAIL__(@symbol(InvalidArgument)) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1182 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1183 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1184 |
argValuePtr = &(__argValues[i].iVal); |
9479 | 1185 |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1186 |
} else if (typeSymbol == @symbol(uint)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1187 |
thisType = __get_ffi_type_uint(); |
9342 | 1188 |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1189 |
if (__isSmallInteger(arg)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1190 |
__argValues[i].iVal = __intVal(arg); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1191 |
} else { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1192 |
__argValues[i].iVal = __unsignedLongIntVal(arg); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1193 |
if (__argValues[i].iVal == 0) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1194 |
__FAIL__(@symbol(InvalidArgument)) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1195 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1196 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1197 |
argValuePtr = &(__argValues[i].iVal); |
9479 | 1198 |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1199 |
} else if (typeSymbol == @symbol(uint8)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1200 |
thisType = __get_ffi_type_uint8(); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1201 |
if (! __isSmallInteger(arg)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1202 |
__FAIL__(@symbol(InvalidArgument)) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1203 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1204 |
__argValues[i].iVal = __intVal(arg); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1205 |
if (((unsigned)(__argValues[i].iVal)) > 0xFF) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1206 |
__FAIL__(@symbol(InvalidArgument)) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1207 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1208 |
argValuePtr = &(__argValues[i].iVal); |
9479 | 1209 |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1210 |
} else if (typeSymbol == @symbol(sint8)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1211 |
thisType = __get_ffi_type_sint8(); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1212 |
if (! __isSmallInteger(arg)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1213 |
__FAIL__(@symbol(InvalidArgument)) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1214 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1215 |
__argValues[i].iVal = __intVal(arg); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1216 |
if (((__argValues[i].iVal) < -0x80) || ((__argValues[i].iVal) > 0x7F)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1217 |
__FAIL__(@symbol(InvalidArgument)) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1218 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1219 |
argValuePtr = &(__argValues[i].iVal); |
9479 | 1220 |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1221 |
} else if (typeSymbol == @symbol(uint16)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1222 |
thisType = __get_ffi_type_uint16(); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1223 |
if (! __isSmallInteger(arg)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1224 |
__FAIL__(@symbol(InvalidArgument)) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1225 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1226 |
__argValues[i].iVal = __intVal(arg); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1227 |
if (((unsigned)(__argValues[i].iVal)) > 0xFFFF) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1228 |
__FAIL__(@symbol(InvalidArgument)) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1229 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1230 |
argValuePtr = &(__argValues[i].iVal); |
9479 | 1231 |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1232 |
} else if (typeSymbol == @symbol(sint16)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1233 |
thisType = __get_ffi_type_sint16(); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1234 |
if (! __isSmallInteger(arg)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1235 |
__FAIL__(@symbol(InvalidArgument)) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1236 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1237 |
__argValues[i].iVal = __intVal(arg); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1238 |
if (((__argValues[i].iVal) < -0x8000) || ((__argValues[i].iVal) > 0x7FFF)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1239 |
__FAIL__(@symbol(InvalidArgument)) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1240 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1241 |
argValuePtr = &(__argValues[i].iVal); |
9479 | 1242 |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1243 |
} else if ((typeSymbol == @symbol(uint32)) || (typeSymbol == @symbol(sint32))) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1244 |
thisType = __get_ffi_type_uint32(); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1245 |
if (__isSmallInteger(arg)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1246 |
__argValues[i].iVal = __intVal(arg); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1247 |
} else { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1248 |
__argValues[i].iVal = __unsignedLongIntVal(arg); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1249 |
if (__argValues[i].iVal == 0) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1250 |
__FAIL__(@symbol(InvalidArgument)) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1251 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1252 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1253 |
argValuePtr = &(__argValues[i].iVal); |
9479 | 1254 |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1255 |
} else if (typeSymbol == @symbol(float)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1256 |
thisType = __get_ffi_type_float(); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1257 |
if (__isSmallInteger(arg)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1258 |
__argValues[i].fVal = (float)(__intVal(arg)); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1259 |
} else if (__isFloat(arg)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1260 |
__argValues[i].fVal = (float)(__floatVal(arg)); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1261 |
} else if (__isShortFloat(arg)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1262 |
__argValues[i].fVal = (float)(__shortFloatVal(arg)); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1263 |
} else { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1264 |
__FAIL__(@symbol(InvalidArgument)) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1265 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1266 |
argValuePtr = &(__argValues[i].fVal); |
9479 | 1267 |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1268 |
} else if (typeSymbol == @symbol(double)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1269 |
thisType = __get_ffi_type_double(); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1270 |
if (__isSmallInteger(arg)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1271 |
__argValues[i].dVal = (double)(__intVal(arg)); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1272 |
} else if (__isFloat(arg)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1273 |
__argValues[i].dVal = (double)(__floatVal(arg)); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1274 |
} else if (__isShortFloat(arg)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1275 |
__argValues[i].dVal = (double)(__shortFloatVal(arg)); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1276 |
} else { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1277 |
__FAIL__(@symbol(InvalidArgument)) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1278 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1279 |
argValuePtr = &(__argValues[i].dVal); |
9479 | 1280 |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1281 |
} else if (typeSymbol == @symbol(void)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1282 |
thisType = __get_ffi_type_void(); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1283 |
argValuePtr = &null; |
9479 | 1284 |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1285 |
} else if (typeSymbol == @symbol(charPointer)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1286 |
thisType = __get_ffi_type_pointer(); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1287 |
if (__isStringLike(arg)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1288 |
if (async == true) goto badArgForAsyncCall; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1289 |
__argValues[i].pointerVal = (void *)(__stringVal(arg)); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1290 |
} else if (__isBytes(arg)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1291 |
if (async == true) goto badArgForAsyncCall; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1292 |
__argValues[i].pointerVal = (void *)(__byteArrayVal(arg)); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1293 |
} else if (__isExternalAddressLike(arg)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1294 |
__argValues[i].pointerVal = (void *)(__externalAddressVal(arg)); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1295 |
} else if (__isExternalBytesLike(arg)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1296 |
__argValues[i].pointerVal = (void *)(__externalBytesVal(arg)); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1297 |
} else { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1298 |
if (arg == nil) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1299 |
__argValues[i].pointerVal = (void *)0; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1300 |
} else { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1301 |
__FAIL__(@symbol(InvalidArgument)) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1302 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1303 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1304 |
argValuePtr = &(__argValues[i].pointerVal);; |
10603 | 1305 |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1306 |
} else if (typeSymbol == @symbol(wcharPointer)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1307 |
thisType = __get_ffi_type_pointer(); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1308 |
if (__isUnicode16String(arg)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1309 |
if (async == true) goto badArgForAsyncCall; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1310 |
__argValues[i].pointerVal = (void *)(__unicode16StringVal(arg)); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1311 |
} else if (__isBytes(arg)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1312 |
if (async == true) goto badArgForAsyncCall; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1313 |
__argValues[i].pointerVal = (void *)(__byteArrayVal(arg)); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1314 |
} else if (__isExternalAddressLike(arg)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1315 |
__argValues[i].pointerVal = (void *)(__externalAddressVal(arg)); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1316 |
} else if (__isExternalBytesLike(arg)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1317 |
__argValues[i].pointerVal = (void *)(__externalBytesVal(arg)); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1318 |
} else { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1319 |
if (arg == nil) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1320 |
__argValues[i].pointerVal = (void *)0; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1321 |
} else { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1322 |
__FAIL__(@symbol(InvalidArgument)) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1323 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1324 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1325 |
argValuePtr = &(__argValues[i].pointerVal);; |
12656 | 1326 |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1327 |
} else if (typeSymbol == @symbol(floatPointer)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1328 |
thisType = __get_ffi_type_pointer(); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1329 |
if (__isBytes(arg)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1330 |
if (async == true) goto badArgForAsyncCall; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1331 |
__argValues[i].pointerVal = (void *)(__byteArrayVal(arg)); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1332 |
} else if (__isExternalAddressLike(arg)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1333 |
__argValues[i].pointerVal = (void *)(__externalAddressVal(arg)); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1334 |
} else if (__isExternalBytesLike(arg)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1335 |
__argValues[i].pointerVal = (void *)(__externalBytesVal(arg)); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1336 |
} else if (__isFloats(arg)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1337 |
char *p = (char *)(__FloatArrayInstPtr(arg)->f_element); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1338 |
int nInstBytes; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1339 |
OBJ cls; |
10603 | 1340 |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1341 |
if (async == true) goto badArgForAsyncCall; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1342 |
cls = __qClass(arg); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1343 |
nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1344 |
p = p + nInstBytes; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1345 |
__argValues[i].pointerVal = p; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1346 |
} else { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1347 |
if (arg == nil) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1348 |
__argValues[i].pointerVal = (void *)0; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1349 |
} else { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1350 |
__FAIL__(@symbol(InvalidArgument)) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1351 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1352 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1353 |
argValuePtr = &(__argValues[i].pointerVal);; |
10603 | 1354 |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1355 |
} else if (typeSymbol == @symbol(doublePointer)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1356 |
thisType = __get_ffi_type_pointer(); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1357 |
if (__isBytes(arg)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1358 |
if (async == true) goto badArgForAsyncCall; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1359 |
__argValues[i].pointerVal = (void *)(__byteArrayVal(arg)); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1360 |
} else if (__isExternalAddressLike(arg)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1361 |
__argValues[i].pointerVal = (void *)(__externalAddressVal(arg)); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1362 |
} else if (__isExternalBytesLike(arg)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1363 |
__argValues[i].pointerVal = (void *)(__externalBytesVal(arg)); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1364 |
} else if (__isDoubles(arg)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1365 |
char *p = (char *)(__DoubleArrayInstPtr(arg)->d_element); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1366 |
int nInstBytes; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1367 |
OBJ cls; |
10603 | 1368 |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1369 |
if (async == true) goto badArgForAsyncCall; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1370 |
cls = __qClass(arg); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1371 |
nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1372 |
p = p + nInstBytes; |
12504
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
1373 |
# ifdef __NEED_DOUBLE_ALIGN |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1374 |
if ((INT)(__DoubleArrayInstPtr(arg)->d_element) & (__DOUBLE_ALIGN-1)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1375 |
int delta = __DOUBLE_ALIGN - ((INT)p & (__DOUBLE_ALIGN-1)); |
10603 | 1376 |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1377 |
p += delta; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1378 |
} |
12504
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
1379 |
# endif |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1380 |
__argValues[i].pointerVal = p; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1381 |
} else { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1382 |
if (arg == nil) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1383 |
__argValues[i].pointerVal = (void *)0; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1384 |
} else { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1385 |
__FAIL__(@symbol(InvalidArgument)) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1386 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1387 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1388 |
argValuePtr = &(__argValues[i].pointerVal);; |
9479 | 1389 |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1390 |
} else if (typeSymbol == @symbol(pointer)) { |
9524 | 1391 |
commonPointerTypeArg: ; |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1392 |
thisType = __get_ffi_type_pointer(); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1393 |
if (arg == nil) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1394 |
__argValues[i].pointerVal = NULL; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1395 |
} else if (__isExternalAddressLike(arg)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1396 |
__argValues[i].pointerVal = (void *)(__externalAddressVal(arg)); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1397 |
} else if (__isExternalBytesLike(arg)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1398 |
__argValues[i].pointerVal = (void *)(__externalBytesVal(arg)); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1399 |
} else if (__isByteArrayLike(arg)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1400 |
if (async == true) goto badArgForAsyncCall; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1401 |
__argValues[i].pointerVal = (void *)(__byteArrayVal(arg)); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1402 |
} else if (__isWordArray(arg) || __isSignedWordArray(arg) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1403 |
|| __isIntegerArray(arg) || __isSignedIntegerArray(arg)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1404 |
if (async == true) goto badArgForAsyncCall; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1405 |
__argValues[i].pointerVal = (void *)(__integerArrayVal(arg)); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1406 |
} else if (__isFloatArray(arg)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1407 |
if (async == true) goto badArgForAsyncCall; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1408 |
__argValues[i].pointerVal = (void *)(__FloatArrayInstPtr(arg)->f_element); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1409 |
} else if (__isDoubleArray(arg)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1410 |
if (async == true) goto badArgForAsyncCall; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1411 |
__argValues[i].pointerVal = (void *)(__DoubleArrayInstPtr(arg)->d_element); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1412 |
} else if (__isStringLike(arg)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1413 |
if (async == true) { |
9435 | 1414 |
badArgForAsyncCall: ; |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1415 |
__FAIL__(@symbol(BadArgForAsyncCall)) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1416 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1417 |
__argValues[i].pointerVal = (void *)(__stringVal(arg)); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1418 |
} else if (__isBytes(arg) || __isWords(arg) || __isLongs(arg)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1419 |
char *p = (char *)(__byteArrayVal(arg)); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1420 |
int nInstBytes; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1421 |
OBJ cls; |
9483 | 1422 |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1423 |
if (async == true) goto badArgForAsyncCall; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1424 |
cls = __qClass(arg); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1425 |
nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1426 |
__argValues[i].pointerVal = p + nInstBytes; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1427 |
} else { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1428 |
__FAIL__(@symbol(InvalidArgument)) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1429 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1430 |
argValuePtr = &(__argValues[i].pointerVal);; |
9479 | 1431 |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1432 |
} else if (typeSymbol == @symbol(bool)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1433 |
thisType = __get_ffi_type_uint(); |
9342 | 1434 |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1435 |
if (arg == true) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1436 |
__argValues[i].iVal = 1; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1437 |
} else if (arg == false) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1438 |
__argValues[i].iVal = 0; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1439 |
} else if (__isSmallInteger(arg)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1440 |
__argValues[i].iVal = __intVal(arg); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1441 |
} else { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1442 |
__argValues[i].iVal = __unsignedLongIntVal(arg); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1443 |
if (__argValues[i].iVal == 0) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1444 |
__FAIL__(@symbol(InvalidArgument)) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1445 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1446 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1447 |
argValuePtr = &(__argValues[i].iVal); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1448 |
} else { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1449 |
if (__isSymbol(typeSymbol) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1450 |
&& ((argValueClass = __GLOBAL_GET(typeSymbol)) != nil)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1451 |
if (! __isBehaviorLike(argValueClass)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1452 |
__FAIL__(@symbol(NonBehaviorArgumentType)) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1453 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1454 |
if (! __qIsSubclassOfExternalAddress(argValueClass)) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1455 |
__FAIL__(@symbol(NonExternalAddressArgumentType)) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1456 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1457 |
goto commonPointerTypeArg; /* sorry */ |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1458 |
} else { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1459 |
__FAIL__(@symbol(UnknownArgumentType)) |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1460 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1461 |
} |
9342 | 1462 |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1463 |
__argTypes[i] = thisType; |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1464 |
__argValuePointers[i] = argValuePtr; |
9483 | 1465 |
|
12504
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
1466 |
# ifdef VERBOSE |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1467 |
if (@global(Verbose) == true) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1468 |
printf("arg%d: %"_lx_"\n", i, (INT)(__argValues[i].iVal)); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1469 |
} |
12504
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
1470 |
# endif |
9342 | 1471 |
} |
9465 | 1472 |
failureInfo = nil; |
9342 | 1473 |
|
1474 |
__callType = FFI_DEFAULT_ABI; |
|
1475 |
||
12504
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
1476 |
# ifdef CALLTYPE_FFI_STDCALL |
9465 | 1477 |
if (callTypeNumber == @global(CALLTYPE_API)) { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1478 |
__callType = CALLTYPE_FFI_STDCALL; |
9342 | 1479 |
} |
12504
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
1480 |
# endif |
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
1481 |
# ifdef CALLTYPE_FFI_V8 |
9465 | 1482 |
if (callTypeNumber == @global(CALLTYPE_V8)) { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1483 |
__callType = CALLTYPE_FFI_V8; |
9342 | 1484 |
} |
12504
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
1485 |
# endif |
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
1486 |
# ifdef CALLTYPE_FFI_V9 |
9465 | 1487 |
if (callTypeNumber == @global(CALLTYPE_V9)) { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1488 |
__callType = CALLTYPE_FFI_V9; |
9342 | 1489 |
} |
12504
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
1490 |
# endif |
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
1491 |
# ifdef CALLTYPE_FFI_UNIX64 |
9465 | 1492 |
if (callTypeNumber == @global(CALLTYPE_UNIX64)) { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1493 |
__callType = CALLTYPE_FFI_UNIX64; |
9342 | 1494 |
} |
12504
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
1495 |
# endif |
9342 | 1496 |
|
1497 |
if (ffi_prep_cif(&__cif, __callType, __numArgsIncludingThis, __returnType, __argTypesIncludingThis) != FFI_OK) { |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1498 |
__FAIL__(@symbol(FFIPrepareFailed)) |
9342 | 1499 |
} |
9463 | 1500 |
if (async == true) { |
12504
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
1501 |
# ifdef VERBOSE |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1502 |
if (@global(Verbose) == true) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1503 |
printf("async call 0x%"_lx_"\n", (INT)codeAddress); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1504 |
} |
12504
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
1505 |
# endif |
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
1506 |
# ifdef WIN32 |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1507 |
__STX_C_CALL4( "ffi_call", ffi_call, &__cif, codeAddress, __returnValuePointer, __argValuePointersIncludingThis); |
12504
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
1508 |
# else |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1509 |
__BEGIN_INTERRUPTABLE__ |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1510 |
ffi_call(&__cif, codeAddress, __returnValuePointer, __argValuePointersIncludingThis); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1511 |
__END_INTERRUPTABLE__ |
12504
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
1512 |
# endif |
9435 | 1513 |
} else { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1514 |
if (unlimitedStack == true) { |
12504
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
1515 |
# ifdef VERBOSE |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1516 |
if (@global(Verbose) == true) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1517 |
printf("UNLIMITEDSTACKCALL call 0x%"_lx_"\n", (INT)codeAddress); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1518 |
} |
12504
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
1519 |
# endif |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1520 |
__UNLIMITEDSTACKCALL4__(ffi_call, &__cif, codeAddress, __returnValuePointer, __argValuePointersIncludingThis); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1521 |
} else { |
12504
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
1522 |
# ifdef VERBOSE |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1523 |
if (@global(Verbose) == true) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1524 |
printf("call 0x%"_lx_"\n", (INT)codeAddress); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1525 |
} |
12504
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
1526 |
# endif |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1527 |
ffi_call(&__cif, codeAddress, __returnValuePointer, __argValuePointersIncludingThis); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1528 |
} |
9435 | 1529 |
} |
12504
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
1530 |
# ifdef VERBOSE |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1531 |
if (@global(Verbose) == true) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1532 |
printf("retval is %"_ld_" (0x%"_lx_")\n", (INT)(__returnValue.iVal), (INT)(__returnValue.iVal)); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1533 |
} |
12504
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
1534 |
# endif |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1535 |
|
11586 | 1536 |
if ((returnTypeSymbol == @symbol(int)) |
1537 |
|| (returnTypeSymbol == @symbol(sint)) |
|
9479 | 1538 |
|| (returnTypeSymbol == @symbol(sint8)) |
1539 |
|| (returnTypeSymbol == @symbol(sint16)) |
|
1540 |
|| (returnTypeSymbol == @symbol(sint32))) { |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1541 |
# ifdef VERBOSE |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1542 |
if (@global(Verbose) == true) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1543 |
printf("return int: %x\n", __returnValue.iVal); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1544 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1545 |
# endif |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1546 |
RETURN ( __MKINT(__returnValue.iVal) ); |
9342 | 1547 |
} |
1548 |
if ((returnTypeSymbol == @symbol(uint)) |
|
1549 |
|| (returnTypeSymbol == @symbol(uint8)) |
|
1550 |
|| (returnTypeSymbol == @symbol(uint16)) |
|
1551 |
|| (returnTypeSymbol == @symbol(uint32))) { |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1552 |
# ifdef VERBOSE |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1553 |
if (@global(Verbose) == true) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1554 |
printf("return uint: %x\n", __returnValue.iVal); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1555 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1556 |
# endif |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1557 |
RETURN ( __MKUINT(__returnValue.iVal) ); |
9342 | 1558 |
} |
10025
053904a63549
stc-compiled ExternalLibraryFunctions
Claus Gittinger <cg@exept.de>
parents:
9981
diff
changeset
|
1559 |
if (returnTypeSymbol == @symbol(bool)) { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1560 |
RETURN ( __returnValue.iVal ? true : false ); |
9342 | 1561 |
} |
1562 |
if (returnTypeSymbol == @symbol(float)) { |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1563 |
RETURN ( __MKFLOAT(__returnValue.fVal )); |
9342 | 1564 |
} |
1565 |
if (returnTypeSymbol == @symbol(double)) { |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1566 |
RETURN ( __MKFLOAT(__returnValue.dVal )); |
9342 | 1567 |
} |
1568 |
if (returnTypeSymbol == @symbol(void)) { |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1569 |
RETURN ( nil ); |
9342 | 1570 |
} |
9463 | 1571 |
if (returnTypeSymbol == @symbol(char)) { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1572 |
RETURN ( __MKCHARACTER(__returnValue.iVal & 0xFF) ); |
9463 | 1573 |
} |
1574 |
if (returnTypeSymbol == @symbol(wchar)) { |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1575 |
RETURN ( __MKUCHARACTER(__returnValue.iVal & 0xFFFF) ); |
12504
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
1576 |
} |
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
1577 |
if (returnTypeSymbol == @symbol(sint64)) { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1578 |
# ifdef VERBOSE |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1579 |
if (@global(Verbose) == true) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1580 |
printf("return sint64: %"_lx_"\n", (INT)(__returnValue.longLongVal)); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1581 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1582 |
# endif |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1583 |
# if __POINTER_SIZE__ == 8 |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1584 |
RETURN ( __MKINT(__returnValue.longLongVal) ); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1585 |
# else |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1586 |
RETURN ( __MKINT64(&__returnValue.longLongVal) ); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1587 |
# endif |
12504
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
1588 |
} |
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
1589 |
if (returnTypeSymbol == @symbol(uint64)) { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1590 |
# ifdef VERBOSE |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1591 |
if (@global(Verbose) == true) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1592 |
printf("return uint64: %"_lx_"\n", (unsigned INT)(__returnValue.longLongVal)); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1593 |
} |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1594 |
# endif |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1595 |
# if __POINTER_SIZE__ == 8 |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1596 |
RETURN ( __MKUINT(__returnValue.longLongVal) ); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1597 |
# else |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1598 |
RETURN ( __MKUINT64(&__returnValue.longLongVal) ); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1599 |
# endif |
9463 | 1600 |
} |
11586 | 1601 |
|
12504
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
1602 |
# ifdef VERBOSE |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1603 |
if (@global(Verbose) == true) { |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1604 |
printf("return pointer: %"_lx_"\n", (INT)(__returnValue.pointerVal)); |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1605 |
} |
12504
c9987bb76eb6
untested long long return value
Claus Gittinger <cg@exept.de>
parents:
12503
diff
changeset
|
1606 |
# endif |
9346 | 1607 |
if (returnTypeSymbol == @symbol(handle)) { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1608 |
returnValue = __MKEXTERNALADDRESS(__returnValue.pointerVal); |
9346 | 1609 |
} else if (returnTypeSymbol == @symbol(pointer)) { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1610 |
returnValue = __MKEXTERNALBYTES(__returnValue.pointerVal); |
10603 | 1611 |
} else if (returnTypeSymbol == @symbol(bytePointer)) { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1612 |
returnValue = __MKEXTERNALBYTES(__returnValue.pointerVal); |
9463 | 1613 |
} else if (returnTypeSymbol == @symbol(charPointer)) { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1614 |
returnValue = __MKSTRING(__returnValue.pointerVal); |
9463 | 1615 |
} else if (returnTypeSymbol == @symbol(wcharPointer)) { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1616 |
returnValue = __MKU16STRING(__returnValue.pointerVal); |
9342 | 1617 |
} else { |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1618 |
__FAIL__(@symbol(UnknownReturnType2)) |
9342 | 1619 |
} |
10603 | 1620 |
#else /* no FFI support */ |
10618
343d0bf4646a
Now can compile even #ifndef HAVE_FFI
Stefan Vogel <sv@exept.de>
parents:
10614
diff
changeset
|
1621 |
failureCode = @symbol(FFINotSupported); |
10603 | 1622 |
#endif /* HAVE_FFI */ |
9342 | 1623 |
getOutOfHere: ; |
1624 |
%}. |
|
1625 |
failureCode notNil ifTrue:[ |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1626 |
(failureCode == #UnknownReturnType or:[ failureCode == #UnknownArgumentType ]) ifTrue:[ |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1627 |
oldReturnType := returnType. |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1628 |
oldArgumentTypes := argumentTypes. |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1629 |
self adjustTypes. |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1630 |
((oldReturnType ~= returnType) or:[oldArgumentTypes ~= argumentTypes]) ifTrue:[ |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1631 |
thisContext restart |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1632 |
]. |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1633 |
]. |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1634 |
(failureCode == #BadArgForAsyncCall) ifTrue:[ |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1635 |
^ self tryAgainWithAsyncSafeArguments:argumentsOrNil forCPPInstance:aReceiverOrNil |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1636 |
]. |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1637 |
(failureCode == #FFINotSupported) ifTrue:[ |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1638 |
self primitiveFailed:'FFI support missing in this build'. |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1639 |
]. |
12579
516bba5b3e57
changed: #ffiTypeSymbolForType:
Claus Gittinger <cg@exept.de>
parents:
12504
diff
changeset
|
1640 |
|
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1641 |
self primitiveFailed. "see failureCode and failureInfo for details" |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1642 |
^ nil |
9342 | 1643 |
]. |
1644 |
||
9483 | 1645 |
returnType isSymbol ifTrue:[ |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1646 |
returnValueClass notNil ifTrue:[ |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1647 |
self isConstReturnValue ifTrue:[ |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1648 |
returnValue changeClassTo:returnValueClass. |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1649 |
^ returnValue |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1650 |
]. |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1651 |
^ returnValueClass fromExternalAddress:returnValue. |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1652 |
]. |
9483 | 1653 |
] ifFalse:[ |
19314
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1654 |
returnType isCPointer ifTrue:[ |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1655 |
returnType baseType isCStruct ifTrue:[ |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1656 |
stClass := Smalltalk classNamed:returnType baseType name. |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1657 |
stClass notNil ifTrue:[ |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1658 |
self isConstReturnValue ifTrue:[ |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1659 |
returnValue changeClassTo:returnValueClass. |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1660 |
^ returnValue |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1661 |
]. |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1662 |
^ stClass fromExternalAddress:returnValue. |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1663 |
]. |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1664 |
]. |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1665 |
returnType baseType isCChar ifTrue:[ |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1666 |
^ returnValue stringAt:1 |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1667 |
]. |
698cf296ef6d
mingw64 and debugging stuff
Claus Gittinger <cg@exept.de>
parents:
19313
diff
changeset
|
1668 |
]. |
9342 | 1669 |
]. |
1670 |
||
1671 |
^ returnValue |
|
9463 | 1672 |
|
1673 |
"Created: / 01-08-2006 / 13:56:23 / cg" |
|
10603 | 1674 |
"Modified: / 11-06-2007 / 01:50:36 / cg" |
14037 | 1675 |
! |
1676 |
||
14659
410089913ca1
allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents:
14632
diff
changeset
|
1677 |
tryAgainWithAsyncSafeArguments:argumentsOrNil forCPPInstance:aReceiverOrNil |
14037 | 1678 |
"invoked by the call primitive, iff GC-unsave arguments where passed to the call. |
1679 |
Here, allocate non-movable blocks of memory and copy the arguments into them, |
|
1680 |
then try the call again, copy changed values back, and release the memeory." |
|
1681 |
||
1682 |
|saveArguments anyBadArg result originalToSaveArgMapping| |
|
1683 |
||
1684 |
argumentsOrNil isNil ifTrue:[ |
|
14625 | 1685 |
^ self primitiveFailed |
14037 | 1686 |
]. |
14506
e53548cdc24d
changed: #tryAgainWithAsyncSafeArguments:forCPPInstance:
anwild
parents:
14412
diff
changeset
|
1687 |
thisContext isRecursive ifTrue: [^self primitiveFailed]. |
14037 | 1688 |
|
1689 |
anyBadArg := false. |
|
1690 |
originalToSaveArgMapping := IdentityDictionary new. |
|
1691 |
||
14625 | 1692 |
saveArguments := argumentsOrNil |
1693 |
collect:[:eachArg | |
|
1694 |
|saveArg| |
|
14037 | 1695 |
|
14625 | 1696 |
(originalToSaveArgMapping includesKey:eachArg) ifTrue:[ |
1697 |
saveArg := originalToSaveArgMapping at:eachArg |
|
1698 |
] ifFalse:[ |
|
1699 |
eachArg isString ifTrue:[ |
|
1700 |
saveArg := (ExternalBytes fromString:eachArg) register. |
|
1701 |
anyBadArg := true. |
|
1702 |
originalToSaveArgMapping at:eachArg put:saveArg. |
|
1703 |
] ifFalse:[ |
|
1704 |
eachArg isByteCollection ifTrue:[ |
|
1705 |
saveArg := (ExternalBytes from:eachArg) register. |
|
1706 |
originalToSaveArgMapping at:eachArg put:saveArg. |
|
1707 |
anyBadArg := true. |
|
1708 |
] ifFalse:[ |
|
1709 |
saveArg := eachArg |
|
1710 |
] |
|
1711 |
]. |
|
1712 |
]. |
|
1713 |
saveArg |
|
1714 |
]. |
|
14037 | 1715 |
|
1716 |
anyBadArg ifFalse:[ |
|
14625 | 1717 |
"avoid recursion..." |
1718 |
^ self primitiveFailed |
|
14037 | 1719 |
]. |
1720 |
||
14659
410089913ca1
allow use of the standard (system) ffi
Claus Gittinger <cg@exept.de>
parents:
14632
diff
changeset
|
1721 |
result := self invokeFFIwithArguments:saveArguments forCPPInstance:aReceiverOrNil. |
14037 | 1722 |
|
1723 |
"/ copy back !! |
|
1724 |
originalToSaveArgMapping keysAndValuesDo:[:arg :saveArg | |
|
14625 | 1725 |
arg isSymbol ifFalse:[ |
1726 |
arg replaceFrom:1 to:(arg size) with:saveArg startingAt:1. |
|
1727 |
]. |
|
1728 |
saveArg free. |
|
14037 | 1729 |
]. |
1730 |
^ result. |
|
14506
e53548cdc24d
changed: #tryAgainWithAsyncSafeArguments:forCPPInstance:
anwild
parents:
14412
diff
changeset
|
1731 |
|
e53548cdc24d
changed: #tryAgainWithAsyncSafeArguments:forCPPInstance:
anwild
parents:
14412
diff
changeset
|
1732 |
"Modified (format): / 06-11-2012 / 10:52:41 / anwild" |
9342 | 1733 |
! ! |
1734 |
||
10481 | 1735 |
!ExternalLibraryFunction methodsFor:'testing'! |
1736 |
||
10603 | 1737 |
isExternalLibraryFunction |
1738 |
"return true, if the receiver is some kind of externalLibrary function; |
|
1739 |
true is returned here" |
|
1740 |
||
1741 |
^true |
|
1742 |
||
1743 |
"Created: / 07-06-2007 / 10:36:40 / cg" |
|
10481 | 1744 |
! ! |
1745 |
||
8533 | 1746 |
!ExternalLibraryFunction class methodsFor:'documentation'! |
1747 |
||
13412 | 1748 |
version_CVS |
19311 | 1749 |
^ '$Header$' |
12436 | 1750 |
! |
1751 |
||
13412 | 1752 |
version_SVN |
19311 | 1753 |
^ '$ Id: ExternalLibraryFunction.st 10643 2011-06-08 21:53:07Z vranyj1 $' |
8533 | 1754 |
! ! |
9463 | 1755 |
|
19311 | 1756 |
|
9463 | 1757 |
ExternalLibraryFunction initialize! |