forked from pharo-project/pharo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separating old ValueArgument from ConstantArgument.
New parse=>resolve works similarly to parse+resolve
- Loading branch information
Showing
11 changed files
with
345 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
Class { | ||
#name : #FFIAbstractTest, | ||
#superclass : #TestCase, | ||
#instVars : [ | ||
'intType', | ||
'int32Type', | ||
'voidType', | ||
'charType' | ||
], | ||
#category : #'UnifiedFFI-Tests-Tests' | ||
} | ||
|
||
{ #category : #private } | ||
FFIAbstractTest >> externalTypeAlias: aTypeName [ | ||
|
||
"Prefix the type so we have control over it. | ||
If it is already prefixed, do not prefix it (otherwise this loops)." | ||
(aTypeName beginsWith: '_test_type_') | ||
ifTrue: [ ^ aTypeName ]. | ||
^ '_test_type_', aTypeName | ||
] | ||
|
||
{ #category : #private } | ||
FFIAbstractTest >> ffiBindingOf: aString [ | ||
|
||
aString = '_test_type_int' | ||
ifTrue: [ ^ aString -> intType ]. | ||
aString = '_test_type_bool' | ||
ifTrue: [ ^ aString -> int32Type ]. | ||
aString = '_test_type_uint32' | ||
ifTrue: [ ^ aString -> int32Type ]. | ||
aString = '_test_type_int32' | ||
ifTrue: [ ^ aString -> int32Type ]. | ||
aString = '_test_type_void' | ||
ifTrue: [ ^ aString -> voidType ]. | ||
aString = '_test_type_char' | ||
ifTrue: [ ^ aString -> charType ]. | ||
self error: 'Type not recognized: ', aString | ||
] | ||
|
||
{ #category : #running } | ||
FFIAbstractTest >> setUp [ | ||
|
||
super setUp. | ||
intType := FFIInt32. | ||
int32Type := FFIInt32. | ||
voidType := FFIVoid. | ||
charType := FFICharacterType. | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Class { | ||
#name : #FFITestObject, | ||
#superclass : #Object, | ||
#instVars : [ | ||
'a', | ||
'c' | ||
], | ||
#category : #'UnifiedFFI-Tests-Tests' | ||
} | ||
|
||
{ #category : #'as yet unclassified' } | ||
FFITestObject >> b: _b d: d_ [ | ||
|
||
"some method to bind an ffi callout" | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,32 @@ | ||
Class { | ||
#name : #FFITestType, | ||
#superclass : #FFIExternalType, | ||
#instVars : [ | ||
'type' | ||
], | ||
#category : #'UnifiedFFI-Tests-Tests' | ||
} | ||
|
||
{ #category : #'instance creation' } | ||
FFITestType class >> of: aType [ | ||
|
||
^ self new type: aType; yourself | ||
] | ||
|
||
{ #category : #converting } | ||
FFITestType >> asExternalTypeOn: aTypeResolver [ | ||
|
||
"FFI sends this to us expecting us to be a class most of the times, but for testing purposes, we use an instance." | ||
^ self | ||
^ self copy | ||
] | ||
|
||
{ #category : #accessing } | ||
FFITestType >> externalType [ | ||
|
||
^ type externalType | ||
] | ||
|
||
{ #category : #accessing } | ||
FFITestType >> type: anObject [ | ||
type := anObject | ||
] |
Oops, something went wrong.