ExternalFunctionCallback.st
changeset 20123 0b0dd12ddb6d
parent 14754 f2511581c8a1
child 20131 4118d61ddba0
child 20291 869e75a7f66a
equal deleted inserted replaced
20122:fa7bde6ba891 20123:0b0dd12ddb6d
     8  be provided or otherwise made available to, or used by, any
     8  be provided or otherwise made available to, or used by, any
     9  other person.  No title to or ownership of the software is
     9  other person.  No title to or ownership of the software is
    10  hereby transferred.
    10  hereby transferred.
    11 "
    11 "
    12 "{ Package: 'stx:libbasic' }"
    12 "{ Package: 'stx:libbasic' }"
       
    13 
       
    14 "{ NameSpace: Smalltalk }"
    13 
    15 
    14 ExternalFunction subclass:#ExternalFunctionCallback
    16 ExternalFunction subclass:#ExternalFunctionCallback
    15 	instanceVariableNames:'returnType argumentTypes flags action'
    17 	instanceVariableNames:'returnType argumentTypes flags action'
    16 	classVariableNames:'CallBackRegistry'
    18 	classVariableNames:'CallBackRegistry'
    17 	poolDictionaries:''
    19 	poolDictionaries:''
   270     and the returnValue (from ST to the C-caller) are specified with:
   272     and the returnValue (from ST to the C-caller) are specified with:
   271        cb returnType:#bool argumentTypes:#(uint).
   273        cb returnType:#bool argumentTypes:#(uint).
   272     Then, the code is generated with:
   274     Then, the code is generated with:
   273        cb generateClosure.
   275        cb generateClosure.
   274 
   276 
   275     After that, the callBack-functions address can be aquired with:
   277     After that, the callBack-functions address can be acquired with:
   276        cb address.  'can be passed to C'.
   278        cb address.  'can be passed to C'.
   277     and handed out to C. (you can also hand out the callBack directly - as it is a subclass of
   279     and handed out to C. (you can also hand out the callBack directly - as it is a subclass of
   278     ExternalBytes.
   280     ExternalBytes.
   279     The actual action of the callback can be changed (at any time later) with:
   281     The actual action of the callback can be changed (at any time later) with:
   280 	cb action:[:args | Transcript showCR:args. true].
   282         cb action:[:args | Transcript showCR:args. true].
   281 
   283 
   282     Eventually, the callback MUST be released:
   284     Eventually, the callback MUST be released:
   283 	cb release.
   285         cb release.
   284 
   286 
   285     [author:]
   287     [author:]
   286 	Claus Gittinger
   288         Claus Gittinger
   287 "
   289 "
   288 !
   290 !
   289 
   291 
   290 examples
   292 examples
   291 "
   293 "
   844 ! !
   846 ! !
   845 
   847 
   846 !ExternalFunctionCallback class methodsFor:'documentation'!
   848 !ExternalFunctionCallback class methodsFor:'documentation'!
   847 
   849 
   848 version
   850 version
   849     ^ '$Header: /cvs/stx/stx/libbasic/ExternalFunctionCallback.st,v 1.22 2013-02-05 16:00:13 stefan Exp $'
   851     ^ '$Header$'
   850 !
   852 !
   851 
   853 
   852 version_CVS
   854 version_CVS
   853     ^ '$Header: /cvs/stx/stx/libbasic/ExternalFunctionCallback.st,v 1.22 2013-02-05 16:00:13 stefan Exp $'
   855     ^ '$Header$'
   854 ! !
   856 ! !
   855 
   857