ExternalLibraryFunction.st
changeset 12503 cb1a875c3d63
parent 12474 4dff55a1ab94
child 12504 c9987bb76eb6
equal deleted inserted replaced
12502:8639c2efa0df 12503:cb1a875c3d63
   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 pointer handle
   590         bool void pointer 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 ].
   627     aType == #byte            ifTrue:[^ #uint8 ].
   627     aType == #byte            ifTrue:[^ #uint8 ].
   628     aType == #dword           ifTrue:[^ #uint32 ].
   628     aType == #dword           ifTrue:[^ #uint32 ].
   629     aType == #sdword          ifTrue:[^ #sint32 ].
   629     aType == #sdword          ifTrue:[^ #sint32 ].
   630     aType == #word            ifTrue:[^ #uint16 ].
   630     aType == #word            ifTrue:[^ #uint16 ].
   631     aType == #sword           ifTrue:[^ #sint16 ].
   631     aType == #sword           ifTrue:[^ #sint16 ].
       
   632     aType == #longlong        ifTrue:[^ #sint64 ].
   632     aType == #longLong        ifTrue:[^ #sint64 ].
   633     aType == #longLong        ifTrue:[^ #sint64 ].
       
   634     aType == #ulonglong       ifTrue:[^ #uint64 ].
   633     aType == #ulongLong       ifTrue:[^ #uint64 ].
   635     aType == #ulongLong       ifTrue:[^ #uint64 ].
   634     aType == #handle          ifTrue:[^ #pointer ].
   636     aType == #handle          ifTrue:[^ #pointer ].
   635     aType == #lpstr           ifTrue:[^ #charPointer ].
   637     aType == #lpstr           ifTrue:[^ #charPointer ].
   636     aType == #hresult         ifTrue:[^ #uint32 ].
   638     aType == #hresult         ifTrue:[^ #uint32 ].
   637     aType == #boolean         ifTrue:[^ #bool ].
   639     aType == #boolean         ifTrue:[^ #bool ].
   641     aType == #structIn        ifTrue:[^ #pointer ].
   643     aType == #structIn        ifTrue:[^ #pointer ].
   642     aType == #structOut       ifTrue:[^ #pointer ].
   644     aType == #structOut       ifTrue:[^ #pointer ].
   643     aType == #unsigned        ifTrue:[^ #uint ].
   645     aType == #unsigned        ifTrue:[^ #uint ].
   644 
   646 
   645     (aType isString or:[aType isSymbol]) ifFalse:[
   647     (aType isString or:[aType isSymbol]) ifFalse:[
   646 	CType isNil ifTrue:[
   648         CType isNil ifTrue:[
   647 	    self error:'unknown type'.
   649             self error:'unknown type'.
   648 	].
   650         ].
   649 	^ aType typeSymbol.
   651         ^ aType typeSymbol.
   650     ].
   652     ].
   651 
   653 
   652     (aType endsWith:'Pointer') ifTrue:[
   654     (aType endsWith:'Pointer') ifTrue:[
   653 	^ #pointer.
   655         ^ #pointer.
   654     ].
   656     ].
   655     ^ aType
   657     ^ aType
   656 
   658 
   657     "Modified: / 14-06-2007 / 17:21:42 / cg"
   659     "Modified: / 14-06-2007 / 17:21:42 / cg"
   658 !
   660 !
  1396 ! !
  1398 ! !
  1397 
  1399 
  1398 !ExternalLibraryFunction class methodsFor:'documentation'!
  1400 !ExternalLibraryFunction class methodsFor:'documentation'!
  1399 
  1401 
  1400 version
  1402 version
  1401     ^ '$Header: /cvs/stx/stx/libbasic/ExternalLibraryFunction.st,v 1.71 2009-11-05 16:25:16 stefan Exp $'
  1403     ^ '$Header: /cvs/stx/stx/libbasic/ExternalLibraryFunction.st,v 1.72 2009-11-05 22:14:40 cg Exp $'
  1402 !
  1404 !
  1403 
  1405 
  1404 version_CVS
  1406 version_CVS
  1405     ^ '$Header: /cvs/stx/stx/libbasic/ExternalLibraryFunction.st,v 1.71 2009-11-05 16:25:16 stefan Exp $'
  1407     ^ '$Header: /cvs/stx/stx/libbasic/ExternalLibraryFunction.st,v 1.72 2009-11-05 22:14:40 cg Exp $'
  1406 ! !
  1408 ! !
  1407 
  1409 
  1408 ExternalLibraryFunction initialize!
  1410 ExternalLibraryFunction initialize!