1
0
mirror of https://github.com/lxsang/Diya-API.git synced 2024-12-27 03:48:21 +01:00

add bases classes

This commit is contained in:
Dany LE 2021-12-18 13:07:30 +01:00
parent 989b3c16fd
commit 12a79139d7
4 changed files with 49 additions and 1 deletions

View File

@ -20,6 +20,11 @@ DiyaBoot class >> initialize [
{ #category : #'system startup' }
DiyaBoot class >> startUp: status [
"
As is the entry point for Diya, it need to be disabled
when inside the SDK image.
"
((Smalltalk globals at:#codeName ifAbsent:[nil]) = 'diya') ifFalse: [^self].
self getLoadedClasses
do: [ :c |
Transcript

25
Diya/DiyaFFIBase.class.st Normal file
View File

@ -0,0 +1,25 @@
Class {
#name : #DiyaFFIBase,
#superclass : #DiyaBaseObject,
#category : #'Diya-Core'
}
{ #category : #accessing }
DiyaFFIBase class >> checkSymbol [
^self subclassResponsibility
]
{ #category : #accessing }
DiyaFFIBase class >> libNames [
^self subclassResponsibility
]
{ #category : #accessing }
DiyaFFIBase class >> moduleName [
self libNames do:[:aName|
(ExternalAddress loadSymbol: self checkSymbol from: aName) ifNotNil: [
^ aName
].
].
self error: 'Unable to find FFI library (', self checkSymbol, ')'.
]

View File

@ -0,0 +1,18 @@
Class {
#name : #DiyaSDLBinding,
#superclass : #DiyaFFIBase,
#category : #'Diya-Graphics-SDL'
}
{ #category : #accessing }
DiyaSDLBinding class >> checkSymbol [
^ 'SDL_Init'
]
{ #category : #accessing }
DiyaSDLBinding class >> libNames [
#(
'libSDL2-2.0.so.0' "Linux 1"
'libSDL2-2.0.so.0.2.1' "Linux 2"
)
]

View File

@ -87,7 +87,7 @@ ImageInitializer >> preloadSystem: loaded [
{ #category : #activation }
ImageInitializer >> snap [
|pkg|
Smalltalk globals at: #codeName put: 'diya'.
self class removeFromSystem.
Smalltalk garbageCollect.
Smalltalk snapshot: true andQuit: false.