ExternalLibraryFunction.st
changeset 12449 ca958524b42f
parent 12436 92a968c9ca92
child 12450 c6d60bdca435
equal deleted inserted replaced
12448:e6f77e779599 12449:ca958524b42f
   574     ^ nil
   574     ^ nil
   575 !
   575 !
   576 
   576 
   577 prepareInvoke
   577 prepareInvoke
   578     (moduleHandle isNil or:[self hasCode not]) ifTrue:[
   578     (moduleHandle isNil or:[self hasCode not]) ifTrue:[
   579 	self linkToModule.
   579         self linkToModule.
   580 	self adjustTypes.
   580         self adjustTypes.
   581     ].
   581     ].
   582 ! !
   582 ! !
   583 
   583 
   584 !ExternalLibraryFunction methodsFor:'private-accessing'!
   584 !ExternalLibraryFunction methodsFor:'private-accessing'!
   585 
   585 
   586 ffiTypeSymbolForType:aType
   586 ffiTypeSymbolForType:aType
   587     "map type to one of the ffi-supported ones:
   587     "map type to one of the ffi-supported ones:
   588 	sint8, sint16, sint32, sint64
   588         sint8, sint16, sint32, sint64
   589 	uint8, uint16, uint32, uint64
   589         uint8, uint16, uint32, uint64
   590 	bool void handle
   590         bool void handle
   591     "
   591     "
   592 
   592 
   593     aType == #sint8           ifTrue:[^ aType ].
   593     aType == #sint8           ifTrue:[^ aType ].
   594     aType == #sint16          ifTrue:[^ aType ].
   594     aType == #sint16          ifTrue:[^ aType ].
   595     aType == #sint32          ifTrue:[^ aType ].
   595     aType == #sint32          ifTrue:[^ aType ].
   609     aType == #int16           ifTrue:[^ #sint16 ].
   609     aType == #int16           ifTrue:[^ #sint16 ].
   610     aType == #int32           ifTrue:[^ #sint32 ].
   610     aType == #int32           ifTrue:[^ #sint32 ].
   611     aType == #int64           ifTrue:[^ #sint64 ].
   611     aType == #int64           ifTrue:[^ #sint64 ].
   612     aType == #voidPointer     ifTrue:[^ #pointer ].
   612     aType == #voidPointer     ifTrue:[^ #pointer ].
   613     aType == #uint8Pointer    ifTrue:[^ #pointer ].
   613     aType == #uint8Pointer    ifTrue:[^ #pointer ].
       
   614     aType == #voidPointerPointer  ifTrue:[^ #pointer ].
   614 
   615 
   615     aType == #short           ifTrue:[^ #sint16 ].
   616     aType == #short           ifTrue:[^ #sint16 ].
   616     aType == #long            ifTrue:[^ #long ].
   617     aType == #long            ifTrue:[^ #long ].
   617     aType == #int             ifTrue:[^ #int ].
   618     aType == #int             ifTrue:[^ #int ].
   618     aType == #uint            ifTrue:[^ #uint ].
   619     aType == #uint            ifTrue:[^ #uint ].
   637     aType == #structIn        ifTrue:[^ #pointer ].
   638     aType == #structIn        ifTrue:[^ #pointer ].
   638     aType == #structOut       ifTrue:[^ #pointer ].
   639     aType == #structOut       ifTrue:[^ #pointer ].
   639     aType == #unsigned        ifTrue:[^ #uint ].
   640     aType == #unsigned        ifTrue:[^ #uint ].
   640 
   641 
   641     (aType isString or:[aType isSymbol]) ifFalse:[
   642     (aType isString or:[aType isSymbol]) ifFalse:[
   642 	CType isNil ifTrue:[
   643         CType isNil ifTrue:[
   643 	    self error:'unknown type'.
   644             self error:'unknown type'.
   644 	].
   645         ].
   645 	^ aType typeSymbol.
   646         ^ aType typeSymbol.
   646     ].
   647     ].
   647 
   648 
       
   649     (aType endsWith:'Pointer') ifTrue:[
       
   650         ^ #pointer.
       
   651     ].
   648     ^ aType
   652     ^ aType
   649 
   653 
   650     "Modified: / 14-06-2007 / 17:21:42 / cg"
   654     "Modified: / 14-06-2007 / 17:21:42 / cg"
   651 !
   655 !
   652 
   656 
  1389 ! !
  1393 ! !
  1390 
  1394 
  1391 !ExternalLibraryFunction class methodsFor:'documentation'!
  1395 !ExternalLibraryFunction class methodsFor:'documentation'!
  1392 
  1396 
  1393 version
  1397 version
  1394     ^ '$Header: /cvs/stx/stx/libbasic/ExternalLibraryFunction.st,v 1.67 2009-11-04 16:10:06 cg Exp $'
  1398     ^ '$Header: /cvs/stx/stx/libbasic/ExternalLibraryFunction.st,v 1.68 2009-11-04 16:44:06 cg Exp $'
  1395 !
  1399 !
  1396 
  1400 
  1397 version_CVS
  1401 version_CVS
  1398     ^ '$Header: /cvs/stx/stx/libbasic/ExternalLibraryFunction.st,v 1.67 2009-11-04 16:10:06 cg Exp $'
  1402     ^ '$Header: /cvs/stx/stx/libbasic/ExternalLibraryFunction.st,v 1.68 2009-11-04 16:44:06 cg Exp $'
  1399 ! !
  1403 ! !
  1400 
  1404 
  1401 ExternalLibraryFunction initialize!
  1405 ExternalLibraryFunction initialize!