[squeak-dev] The Inbox: FFI-Tests-cbc.9.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Feb 7 04:19:17 UTC 2019


A new version of FFI-Tests was added to project The Inbox:
http://source.squeak.org/inbox/FFI-Tests-cbc.9.mcz

==================== Summary ====================

Name: FFI-Tests-cbc.9
Author: cbc
Time: 17 April 2017, 9:40:36.880187 am
UUID: 00985020-cc08-fc49-a7fd-7279da9180c0
Ancestors: FFI-Tests-EstebanLorenzano.8

Remove test on ExternalForm (since it was removed from FFI package - and it was wrong, now, too).  Currently in EToys tests.

==================== Snapshot ====================

SystemOrganization addCategory: #'FFI-Tests'!

ExternalStructure subclass: #FFISmallStruct1
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'FFI-Tests'!

----- Method: FFISmallStruct1 class>>fields (in category 'as yet unclassified') -----
fields
	"FFITestPoint2 defineFields"
	^#(
		(x	'byte')
		(y	'byte')
	)!

----- Method: FFISmallStruct1>>x (in category 'accessing') -----
x
	"This method was automatically generated"
	^handle unsignedByteAt: 1!

----- Method: FFISmallStruct1>>x: (in category 'accessing') -----
x: anObject
	"This method was automatically generated"
	handle unsignedByteAt: 1 put: anObject!

----- Method: FFISmallStruct1>>y (in category 'accessing') -----
y
	"This method was automatically generated"
	^handle unsignedByteAt: 2!

----- Method: FFISmallStruct1>>y: (in category 'accessing') -----
y: anObject
	"This method was automatically generated"
	handle unsignedByteAt: 2 put: anObject!

ExternalStructure subclass: #FFITestPoint2
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'FFI-Tests'!

!FFITestPoint2 commentStamp: 'ar 8/14/2006 23:06' prior: 0!
A class used for testing structures as arguments for the FFI.!

----- Method: FFITestPoint2 class>>fields (in category 'field definition') -----
fields
	"FFITestPoint2 defineFields"
	^#(
		(x	'long')
		(y	'long')
	)!

----- Method: FFITestPoint2>>x (in category 'accessing') -----
x
	"This method was automatically generated"
	^handle signedLongAt: 1!

----- Method: FFITestPoint2>>x: (in category 'accessing') -----
x: anObject
	"This method was automatically generated"
	handle signedLongAt: 1 put: anObject!

----- Method: FFITestPoint2>>y (in category 'accessing') -----
y
	"This method was automatically generated"
	^handle signedLongAt: 5!

----- Method: FFITestPoint2>>y: (in category 'accessing') -----
y: anObject
	"This method was automatically generated"
	handle signedLongAt: 5 put: anObject!

ExternalStructure subclass: #FFITestPoint4
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'FFI-Tests'!

!FFITestPoint4 commentStamp: 'ar 8/14/2006 23:06' prior: 0!
A class used for testing structures as arguments for the FFI.!

----- Method: FFITestPoint4 class>>fields (in category 'field definition') -----
fields
	"FFITestPoint4 defineFields"
	^#(
		(x	'long')
		(y	'long')
		(z	'long')
		(w	'long')
	)!

----- Method: FFITestPoint4>>w (in category 'accessing') -----
w
	"This method was automatically generated"
	^handle signedLongAt: 13!

----- Method: FFITestPoint4>>w: (in category 'accessing') -----
w: anObject
	"This method was automatically generated"
	handle signedLongAt: 13 put: anObject!

----- Method: FFITestPoint4>>x (in category 'accessing') -----
x
	"This method was automatically generated"
	^handle signedLongAt: 1!

----- Method: FFITestPoint4>>x: (in category 'accessing') -----
x: anObject
	"This method was automatically generated"
	handle signedLongAt: 1 put: anObject!

----- Method: FFITestPoint4>>y (in category 'accessing') -----
y
	"This method was automatically generated"
	^handle signedLongAt: 5!

----- Method: FFITestPoint4>>y: (in category 'accessing') -----
y: anObject
	"This method was automatically generated"
	handle signedLongAt: 5 put: anObject!

----- Method: FFITestPoint4>>z (in category 'accessing') -----
z
	"This method was automatically generated"
	^handle signedLongAt: 9!

----- Method: FFITestPoint4>>z: (in category 'accessing') -----
z: anObject
	"This method was automatically generated"
	handle signedLongAt: 9 put: anObject!

TestCase subclass: #FFIPluginTests
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'FFI-Tests'!

!FFIPluginTests commentStamp: '<historical>' prior: 0!
SUnitized tests for the FFI (mostly the plugin side)!

----- Method: FFIPluginTests>>testConstructedCharCall (in category 'simple tests') -----
testConstructedCharCall
	"Test using generic FFI spec"
	| result meth |
	meth := ExternalLibraryFunction
		name:'ffiTestChars' module: FFITestLibrary moduleName 
		callType: 0 returnType: ExternalType char
		argumentTypes: ((1 to: 4) collect:[:i| ExternalType char]).
	result := meth invokeWith: $A with: 65 with: 65.0 with: true.
	self assert: result isCharacter.
	self assert: result asciiValue = 130.!

----- Method: FFIPluginTests>>testConstructedDoubleCall (in category 'simple tests') -----
testConstructedDoubleCall
	"Test using generic FFI spec"
	| result meth |
	meth := ExternalLibraryFunction
		name:'ffiTestDoubles' module: FFITestLibrary moduleName 
		callType: 0 returnType: ExternalType double
		argumentTypes: ((1 to: 2) collect:[:i| ExternalType double]).
	result := meth invokeWithArguments: (Array with: 41 with: true).
	self assert: result = 42.0!

----- Method: FFIPluginTests>>testConstructedFloatCall (in category 'simple tests') -----
testConstructedFloatCall
	"Test using generic FFI spec"
	| result meth |
	meth := ExternalLibraryFunction
		name:'ffiTestFloats' module: FFITestLibrary moduleName 
		callType: 0 returnType: ExternalType float
		argumentTypes: ((1 to: 2) collect:[:i| ExternalType float]).
	result := meth invokeWith: $A with: 65.0.
	self assert: result = 130.0!

----- Method: FFIPluginTests>>testConstructedIntCall (in category 'simple tests') -----
testConstructedIntCall
	"Test using generic FFI spec"
	| result meth |
	meth := ExternalLibraryFunction
		name:'ffiTestInts' module: FFITestLibrary moduleName
		callType: 0 returnType: ExternalType long
		argumentTypes: ((1 to: 4) collect:[:i| ExternalType long]).
	result := meth invokeWith: $A with: 65 with: 65.0 with: true.
	self assert: result = 130.!

----- Method: FFIPluginTests>>testConstructedPrintString (in category 'simple tests') -----
testConstructedPrintString
	"Test using generic FFI spec"
	| result meth |
	meth := ExternalLibraryFunction
		name:'ffiPrintString' module: FFITestLibrary moduleName 
		callType: 0 returnType: ExternalType string
		argumentTypes: ((1 to: 1) collect:[:i| ExternalType string]).
	result := meth invokeWith:'Hello World!!'.
	self assert: result = 'Hello World!!'.!

----- Method: FFIPluginTests>>testConstructedShortCall (in category 'simple tests') -----
testConstructedShortCall
	"Test using generic FFI spec"
	| result meth |
	meth := ExternalLibraryFunction
		name:'ffiTestShorts' module: FFITestLibrary moduleName 
		callType: 0 returnType: ExternalType short
		argumentTypes: ((1 to: 4) collect:[:i| ExternalType short]).
	result := meth invokeWithArguments: (Array with: $A with: 65 with: 65.0 with: true).
	self assert: result = 130.!

----- Method: FFIPluginTests>>testGenericCharCall (in category 'simple tests') -----
testGenericCharCall
	"Test using generic FFI spec"
	| result |
	result := FFITestLibrary ffiTestChar: $A with: 65 with: 65.0 with: true.
	self assert: result isCharacter.
	self assert: result asciiValue = 130.!

----- Method: FFIPluginTests>>testGenericDoubleCall (in category 'simple tests') -----
testGenericDoubleCall
	"Test using generic FFI spec"
	| result |
	result := FFITestLibrary ffiTestDoubles: $A with: 65.0.
	self assert: result = 130.0!

----- Method: FFIPluginTests>>testGenericDoubleCall2 (in category 'simple tests') -----
testGenericDoubleCall2
	"Test using generic FFI spec"
	| result |
	result := FFITestLibrary ffiTestDoubles9: 1.0 d: 2.0 d: 3.0 d: 4.0 d: 5.0 d: 6.0 d: 7.0 d: 8.0 d: 9.0.
	self assert: result = 45.0!

----- Method: FFIPluginTests>>testGenericFloatCall (in category 'simple tests') -----
testGenericFloatCall
	"Test using generic FFI spec"
	| result |
	result := FFITestLibrary ffiTestFloats: $A with: 65.0.
	self assert: result = 130.0!

----- Method: FFIPluginTests>>testGenericIntCall (in category 'simple tests') -----
testGenericIntCall
	"Test using generic FFI spec"
	| result |
	result := FFITestLibrary ffiTestInt: $A with: 65 with: 65.0 with: true.
	self assert: result = 130.!

----- Method: FFIPluginTests>>testGenericMixedDoublesIntAndStruct (in category 'simple tests') -----
testGenericMixedDoublesIntAndStruct
	"Test using generic FFI spec"
	| result i struct |
	i := 42.
	struct := FFITestPoint4 new.
	struct x: 1. struct y: 2. struct z: 3. struct w: 4.
	result := FFITestLibrary ffiTestMixedDoublesIntAndStruct: 1.0 d: 2.0 d: 3.0 d: 4.0 d: 5.0 d: 6.0 d: 7.0 d: 8.0 d: 9.0 i: 42 s: struct.
	self assert: (result closeTo: 45.0 + 42 + 10) !

----- Method: FFIPluginTests>>testGenericMixedFloatsAndDouble (in category 'simple tests') -----
testGenericMixedFloatsAndDouble
	"Test using generic FFI spec"
	| result |
	result := FFITestLibrary ffiTestMixedFloatsAndDouble: 1.2 with: 3.4 with: 5.6 with: 7.8.
	self assert: (result closeTo: 1.2 + 3.4 + 5.6 + 7.8) !

----- Method: FFIPluginTests>>testGenericPrintString (in category 'simple tests') -----
testGenericPrintString
	"Test using generic FFI spec"
	| result |
	result := FFITestLibrary ffiPrintString:'Hello World!!'.
	self assert: result = 'Hello World!!'.!

----- Method: FFIPluginTests>>testGenericShortCall (in category 'simple tests') -----
testGenericShortCall
	"Test using generic FFI spec"
	| result |
	result := FFITestLibrary ffiTestShort: $A with: 65 with: 65.0 with: true.
	self assert: result = 130.!

----- Method: FFIPluginTests>>testLibraryCharCall (in category 'simple tests') -----
testLibraryCharCall
	"Test using call from ExternalLibrary"
	| result |
	result := FFITestLibrary new ffiTestChar: $A with: 65 with: 65.0 with: true.
	self assert: result isCharacter.
	self assert: result asciiValue = 130.!

----- Method: FFIPluginTests>>testLibraryDoubleCall (in category 'simple tests') -----
testLibraryDoubleCall
	"Test using call from ExternalLibrary"
	| result |
	result := FFITestLibrary new ffiTestDoubles: $A with: 65.0.
	self assert: result = 130.0!

----- Method: FFIPluginTests>>testLibraryFloatCall (in category 'simple tests') -----
testLibraryFloatCall
	"Test using call from ExternalLibrary"
	| result |
	result := FFITestLibrary new ffiTestFloats: $A with: 65.0.
	self assert: result = 130.0!

----- Method: FFIPluginTests>>testLibraryIntCall (in category 'simple tests') -----
testLibraryIntCall
	"Test using call from ExternalLibrary"
	| result |
	result := FFITestLibrary new ffiTestInt: $A with: 65 with: 65.0 with: true.
	self assert: result = 130.!

----- Method: FFIPluginTests>>testLibraryPrintString (in category 'simple tests') -----
testLibraryPrintString
	"Test using call from ExternalLibrary"
	| result |
	result := FFITestLibrary new ffiPrintString:'Hello World!!'.
	self assert: result = 'Hello World!!'.!

----- Method: FFIPluginTests>>testLoadSymbolFromModule (in category 'other tests') -----
testLoadSymbolFromModule
	| address |
	
	"Ok"
	address := ExternalAddress loadSymbol: 'ffiTestFloats' module: FFITestLibrary moduleName.
	self deny: address isNil.
	self deny: address isNull.
	"Symbol does not exists"
	self 
		should: [ ExternalAddress loadSymbol: 'ffi_does_not_exist' module: FFITestLibrary moduleName ]
		raise: Error.
	"Module does not exists"
	self 
		should: [ ExternalAddress loadSymbol: 'ffiTestFloats' module: 'NonExistingModule' ]
		raise: Error.		!

----- Method: FFIPluginTests>>testLongLongA1 (in category 'simple tests') -----
testLongLongA1
	"Test passing a char and two longlongs."
	| byte long1 long2 long3 |
	byte := 42.
	long1 := 16r123456789012.
	long2 := (-1 << 31).
	long3 := FFITestLibrary ffiTestLongLongA1: byte with: long1 with: long2.
	self assert: long3 = (byte + long1 + long2)!

----- Method: FFIPluginTests>>testLongLongA3 (in category 'simple tests') -----
testLongLongA3
	"Test passing a char, a longlong, and another char."
	| byte1 long1 byte2 long2 |
	byte1 := 3.
	long1 := 16r123456789012.
	byte2 := 4.
	long2 := FFITestLibrary ffiTestLongLongA3: byte1 with: long1 with: byte2.
	self assert: long2 = (byte1 + long1 + byte2)!

----- Method: FFIPluginTests>>testLongLongs (in category 'simple tests') -----
testLongLongs
	"Test passing and returning longlongs"
	| long1 long2 long3 |
	long1 := 16r123456789012.
	long2 := (-1 << 31).
	long3 := FFITestLibrary ffiTestLongLong: long1 with: long2.
	self assert: long3 = (long1 + long2)!

----- Method: FFIPluginTests>>testMixedIntAndStruct (in category 'structure tests') -----
testMixedIntAndStruct
	"Test passing an integer and two structures."
	| i1 pt1 pt2 result |
	i1 := 42.
	pt1 := FFITestPoint2 new.
	pt1 x: 3. pt1 y: 4.
	pt2 := FFITestPoint2 new.
	pt2 x: 5. pt2 y: 6.
	result := FFITestLibrary ffiTestMixedIntAndStruct: i1 with: pt1 with: pt2.
	self assert: result = 60.!

----- Method: FFIPluginTests>>testMixedIntAndStruct2 (in category 'structure tests') -----
testMixedIntAndStruct2
	"Test passing an integer and two structures."
	| i1 pt1 result |
	i1 := 42.
	pt1 := FFITestPoint4 new.
	pt1 x: 3. pt1 y: 4. pt1 z: 5. pt1 w: 6.
	result := FFITestLibrary ffiTestMixedIntAndStruct2: i1 with: pt1.
	self assert: result = 60.!

----- Method: FFIPluginTests>>testMixedIntAndStruct3 (in category 'structure tests') -----
testMixedIntAndStruct3
	"Test passing an integer and a small structure."
	| i1 pt1 result |
	i1 := 42.
	pt1 := FFISmallStruct1 new.
	pt1 x: 3. pt1 y: 4.
	result := FFITestLibrary ffiTestMixedIntAndStruct3: i1 with: pt1.
	self assert: result = 49!

----- Method: FFIPluginTests>>testPoint2 (in category 'structure tests') -----
testPoint2
	"Test passing and returning up of structures >32bit and <= 64 bit"
	| pt1 pt2 pt3 |
	pt1 := FFITestPoint2 new.
	pt1 x: 1. pt1 y: 2.
	pt2 := FFITestPoint2 new.
	pt2 x: 3. pt2 y: 4.
	pt3 := FFITestLibrary ffiTestPoint2: pt1 with: pt2.
	self assert: pt3 x = 4.
	self assert: pt3 y = 6.!

----- Method: FFIPluginTests>>testPoint4 (in category 'structure tests') -----
testPoint4
	"Test passing and returning up of structures > 64 bit"
	| pt1 pt2 pt3 |
	pt1 := FFITestPoint4 new.
	pt1 x: 1. pt1 y: 2. pt1 z: 3. pt1 w: 4.
	pt2 := FFITestPoint4 new.
	pt2 x: 5. pt2 y: 6. pt2 z: 7. pt2 w: 8.
	pt3 := FFITestLibrary ffiTestPoint4: pt1 with: pt2.
	self assert: pt3 x = 6.
	self assert: pt3 y = 8.
	self assert: pt3 z = 10.
	self assert: pt3 w = 12.!

----- Method: FFIPluginTests>>testPointers (in category 'structure tests') -----
testPointers
	"Test passing and returning of pointers to structs"
	| pt1 pt2 pt3 |
	pt1 := FFITestPoint4 new.
	pt1 x: 1. pt1 y: 2. pt1 z: 3. pt1 w: 4.
	pt2 := FFITestPoint4 new.
	pt2 x: 5. pt2 y: 6. pt2 z: 7. pt2 w: 8.
	pt3 := FFITestLibrary ffiTestPointers: pt1 with: pt2.
	self assert: pt3 x = 6.
	self assert: pt3 y = 8.
	self assert: pt3 z = 10.
	self assert: pt3 w = 12.!

----- Method: FFIPluginTests>>testSmallStructureReturn (in category 'structure tests') -----
testSmallStructureReturn
	"Test returning small structures (<4 bytes) which are returned in a register on some platforms."
	| pt1 |

	pt1 := FFITestLibrary ffiTestSmallStructReturn.
	self assert: pt1 x = 3.
	self assert: pt1 y = 4.!

----- Method: FFIPluginTests>>testUlongRange (in category 'simple tests') -----
testUlongRange
	"Simple test for making sure the FFI can call certain numbers in the ulong range"
	| result |
	self shouldnt:[result := FFITestLibrary ffiTestUlong: 3103854339 with: 3103854339 with: 3103854339 with: 3103854339] raise: Error.
	self should: result =  1912741382.!

ExternalLibrary subclass: #FFITestLibrary
	instanceVariableNames: ''
	classVariableNames: ''
	poolDictionaries: ''
	category: 'FFI-Tests'!

!FFITestLibrary commentStamp: 'ar 8/14/2006 23:06' prior: 0!
ExternalLibrarty used in FFI tests!

----- Method: FFITestLibrary class>>ffiPrintString: (in category 'primitives') -----
ffiPrintString: aString
	"FFITestLibrary ffiPrintString: 'Hello'"
	<cdecl: char* 'ffiPrintString' (char *) module:'SqueakFFIPrims'>
	^self externalCallFailed!

----- Method: FFITestLibrary class>>ffiTestChar:with:with:with: (in category 'primitives') -----
ffiTestChar: c1 with: c2 with: c3 with: c4
	"FFITestLibrary ffiTestChar: $A with: 65 with: 65.0 with: true"
	<cdecl: char 'ffiTestChars' (char char char char) module:'SqueakFFIPrims'>
	^self externalCallFailed!

----- Method: FFITestLibrary class>>ffiTestDoubles9:d:d:d:d:d:d:d:d: (in category 'primitives') -----
ffiTestDoubles9: f1 d: f2 d: f3 d: f4 d: f5 d: f6 d: f7 d: f8 d: f9
	"FFITestLibrary ffiTestDoubles9: 1.0 d: 2.0 d: 3.0 d: 4.0 d: 5.0 d: 6.0 d: 7.0 d: 8.0 d: 9.0"
	<cdecl: double 'ffiTestDoubles9' (double double double double double double double double double) module:'SqueakFFIPrims'>
	^self externalCallFailed!

----- Method: FFITestLibrary class>>ffiTestDoubles:with: (in category 'primitives') -----
ffiTestDoubles: f1 with: f2
	"FFITestLibrary ffiTestDoubles: $A with: 65.0"
	<cdecl: double 'ffiTestDoubles' (double double) module:'SqueakFFIPrims'>
	^self externalCallFailed!

----- Method: FFITestLibrary class>>ffiTestFloats:with: (in category 'primitives') -----
ffiTestFloats: f1 with: f2
	"FFITestLibrary ffiTestFloats: $A with: 65.0"
	<cdecl: float 'ffiTestFloats' (float float) module:'SqueakFFIPrims'>
	^self externalCallFailed!

----- Method: FFITestLibrary class>>ffiTestInt:with:with:with: (in category 'primitives') -----
ffiTestInt: c1 with: c2 with: c3 with: c4
	"FFITestLibrary ffiTestInt: $A with: 65 with: 65.0 with: true"
	<cdecl: long 'ffiTestInts' (long long long long) module:'SqueakFFIPrims'>
	^self externalCallFailed!

----- Method: FFITestLibrary class>>ffiTestLongLong:with: (in category 'primitives') -----
ffiTestLongLong: long1 with: long2
	"FFITestLibrary ffiTestLongLong: 3 with: 4"
	<cdecl: longlong 'ffiTestLongLong' (longlong longlong) module:'SqueakFFIPrims'>
	^self externalCallFailed!

----- Method: FFITestLibrary class>>ffiTestLongLongA1:with:with: (in category 'primitives') -----
ffiTestLongLongA1: byte with: long1 with: long2
	"FFITestLibrary ffiTestLongLongA1: 3 with: 4 with: 5"
	<cdecl: longlong 'ffiTestLongLonga1' (char longlong longlong) module:'SqueakFFIPrims'>
	^self externalCallFailed!

----- Method: FFITestLibrary class>>ffiTestLongLongA3:with:with: (in category 'primitives') -----
ffiTestLongLongA3: byte1 with: long1 with: byte2
	"FFITestLibrary ffiTestLongLongA3: 3 with: 4 with: 5"
	<cdecl: longlong 'ffiTestLongLonga3' (char longlong char) module:'SqueakFFIPrims'>
	^self externalCallFailed!

----- Method: FFITestLibrary class>>ffiTestMixedDoublesIntAndStruct:d:d:d:d:d:d:d:d:i:s: (in category 'primitives') -----
ffiTestMixedDoublesIntAndStruct: f1 d: f2 d: f3 d: f4 d: f5 d: f6 d: f7 d: f8 d: f9 i: i1 s: s1
	"FFITestLibrary ffiTestMixedDoublesIntAndStruct: 1.0 d: 2.0 d: 3.0 d: 4.0 d: 5.0 d: 6.0 d: 7.0 d: 8.0 d: 9.0 i: 42
		s: (FFITestPoint4 new x: 3; y: 4; z: 5; w:6)"
	<cdecl: double 'ffiTestMixedDoublesIntAndStruct' (double double double double double double double double double long FFITestPoint4) module:'SqueakFFIPrims'>
	^self externalCallFailed!

----- Method: FFITestLibrary class>>ffiTestMixedFloatsAndDouble:with:with:with: (in category 'primitives') -----
ffiTestMixedFloatsAndDouble: f1 with: d1 with: f2 with: f3
	"FFITestLibrary ffiTestMixedFloatsAndDouble: 1.2 with: 3.4 with: 5.6 with: 7.8"
	<cdecl: double 'ffiTestMixedFloatsAndDouble' (float double float float) module:'SqueakFFIPrims'>
	^self externalCallFailed!

----- Method: FFITestLibrary class>>ffiTestMixedIntAndStruct2:with: (in category 'primitives') -----
ffiTestMixedIntAndStruct2: i with: pt4
	"FFITestLibrary ffiTestMixedIntAndStruct2: 2 with: (FFITestPoint4 new x: 3; y: 4; z: 5; w:6)"
	<cdecl: long 'ffiTestMixedIntAndStruct2' (long FFITestPoint4) module:'SqueakFFIPrims'>
	^self externalCallFailed!

----- Method: FFITestLibrary class>>ffiTestMixedIntAndStruct3:with: (in category 'primitives') -----
ffiTestMixedIntAndStruct3: i with: anFFISmallStruct1
	"FFITestLibrary ffiTestMixedIntAndStruct3: 2 with: (FFISmallStruct1 new x: 3; y: 4)"
	<cdecl: long 'ffiTestMixedIntAndStruct3' (long FFISmallStruct1) module:'SqueakFFIPrims'>
	^self externalCallFailed!

----- Method: FFITestLibrary class>>ffiTestMixedIntAndStruct:with:with: (in category 'primitives') -----
ffiTestMixedIntAndStruct: i with: pt1 with: pt2
	"FFITestLibrary ffiTestMixedIntAndStruct: 2 with: (FFITestPoint2 new x: 3; y: 4) with: (FFITestPoint2 new x: 5; y: 6)"
	<cdecl: long 'ffiTestMixedIntAndStruct' (long FFITestPoint2 FFITestPoint2) module:'SqueakFFIPrims'>
	^self externalCallFailed!

----- Method: FFITestLibrary class>>ffiTestPoint2:with: (in category 'primitives') -----
ffiTestPoint2: pt1 with: pt2
	<cdecl: FFITestPoint2 'ffiTestStruct64' (FFITestPoint2 FFITestPoint2) module:'SqueakFFIPrims'>
	^self externalCallFailed!

----- Method: FFITestLibrary class>>ffiTestPoint4:with: (in category 'primitives') -----
ffiTestPoint4: pt1 with: pt2
	<cdecl: FFITestPoint4 'ffiTestStructBig' (FFITestPoint4 FFITestPoint4) module:'SqueakFFIPrims'>
	^self externalCallFailed!

----- Method: FFITestLibrary class>>ffiTestPointers:with: (in category 'primitives') -----
ffiTestPointers: pt1 with: pt2
	<cdecl: FFITestPoint4* 'ffiTestPointers' (FFITestPoint4* FFITestPoint4*) module:'SqueakFFIPrims'>
	^self externalCallFailed!

----- Method: FFITestLibrary class>>ffiTestShort:with:with:with: (in category 'primitives') -----
ffiTestShort: c1 with: c2 with: c3 with: c4
	"FFITestLibrary ffiTestShort: $A with: 65 with: 65.0 with:1"
	<cdecl: short 'ffiTestShorts' (short short short short) module:'SqueakFFIPrims'>
	^self externalCallFailed!

----- Method: FFITestLibrary class>>ffiTestSmallStructReturn (in category 'primitives') -----
ffiTestSmallStructReturn
	"FFITestLibrary ffiTestSmallStructReturn"
	<cdecl: FFISmallStruct1 'ffiTestSmallStructReturn' (void) module:'SqueakFFIPrims'>
	^self externalCallFailed!

----- Method: FFITestLibrary class>>ffiTestUlong:with:with:with: (in category 'primitives') -----
ffiTestUlong: c1 with: c2 with: c3 with: c4
	"FFITestLibrary ffiTestUlong: 3103854339 with: 3103854339 with: 3103854339 with: 3103854339"
	<cdecl: long 'ffiTestInts' (ulong ulong ulong ulong) module:'SqueakFFIPrims'>
	^self externalCallFailed!

----- Method: FFITestLibrary class>>moduleName (in category 'accessing') -----
moduleName
	"Use the fully qualified VM name so we ensure testing loading a library"
	^'SqueakFFIPrims'!

----- Method: FFITestLibrary>>ffiPrintString: (in category 'primitives') -----
ffiPrintString: aString
	"FFITestLibrary new ffiPrintString: 'Hello'"
	<cdecl: char* 'ffiPrintString' (char *)>
	^self externalCallFailed!

----- Method: FFITestLibrary>>ffiTestChar:with:with:with: (in category 'primitives') -----
ffiTestChar: c1 with: c2 with: c3 with: c4
	"FFITestLibrary new ffiTestChar: $A with: 65 with: 65.0 with: true"
	<cdecl: char 'ffiTestChars' (char char char char)>
	^self externalCallFailed!

----- Method: FFITestLibrary>>ffiTestDoubles:with: (in category 'primitives') -----
ffiTestDoubles: f1 with: f2
	"FFITestLibrary new ffiTestDoubles: $A with: 65.0"
	<cdecl: double 'ffiTestDoubles' (double double)>
	^self externalCallFailed!

----- Method: FFITestLibrary>>ffiTestFloats:with: (in category 'primitives') -----
ffiTestFloats: f1 with: f2
	"FFITestLibrary new ffiTestFloats: $A with: 65.0"
	<cdecl: float 'ffiTestFloats' (float float)>
	^self externalCallFailed!

----- Method: FFITestLibrary>>ffiTestInt:with:with:with: (in category 'primitives') -----
ffiTestInt: c1 with: c2 with: c3 with: c4
	"FFITestLibrary new ffiTestInt: $A with: 65 with: 65.0 with: $A"
	<cdecl: long 'ffiTestInts' (long long long long)>
	^self externalCallFailed!

----- Method: FFITestLibrary>>ffiTestShort:with:with:with: (in category 'primitives') -----
ffiTestShort: c1 with: c2 with: c3 with: c4
	"FFITestLibrary new ffiTestShort: $A with: 65 with: 65.0 with: $A"
	<cdecl: short 'ffiTestShorts' (short short short short)>
	^self externalCallFailed!



More information about the Squeak-dev mailing list