mirror of
https://github.com/lxsang/Diya-API.git
synced 2024-12-26 03:18:22 +01:00
initial comit
This commit is contained in:
parent
241a93ab6a
commit
3da6871a3d
3
.properties
Normal file
3
.properties
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
#format : #tonel
|
||||
}
|
5
Diya/DiyaBaseObject.class.st
Normal file
5
Diya/DiyaBaseObject.class.st
Normal file
@ -0,0 +1,5 @@
|
||||
Class {
|
||||
#name : #DiyaBaseObject,
|
||||
#superclass : #Object,
|
||||
#category : #'Diya-Core'
|
||||
}
|
34
Diya/DiyaBoot.class.st
Normal file
34
Diya/DiyaBoot.class.st
Normal file
@ -0,0 +1,34 @@
|
||||
Class {
|
||||
#name : #DiyaBoot,
|
||||
#superclass : #DiyaBaseObject,
|
||||
#category : #'Diya-Runtime'
|
||||
}
|
||||
|
||||
{ #category : #'system startup' }
|
||||
DiyaBoot class >> getLoadedClasses [
|
||||
^ SessionManager default startupList
|
||||
collect: [ :c |
|
||||
(c respondsTo: #registeredClass)
|
||||
ifTrue: [ c registeredClass ]
|
||||
ifFalse: [ c ] ]
|
||||
]
|
||||
|
||||
{ #category : #'class initialization' }
|
||||
DiyaBoot class >> initialize [
|
||||
Smalltalk addToStartUpList: DiyaBoot
|
||||
]
|
||||
|
||||
{ #category : #'system startup' }
|
||||
DiyaBoot class >> startUp: status [
|
||||
self getLoadedClasses
|
||||
do: [ :c |
|
||||
Transcript
|
||||
show: c className;
|
||||
cr ].
|
||||
Transcript show: self tickSinceStart; cr.
|
||||
]
|
||||
|
||||
{ #category : #'system startup' }
|
||||
DiyaBoot class >> tickSinceStart [
|
||||
^ self ffiCall: #( uint clock() ) module: 'libc.so.6'.
|
||||
]
|
95
Diya/ImageInitializer.class.st
Normal file
95
Diya/ImageInitializer.class.st
Normal file
@ -0,0 +1,95 @@
|
||||
Class {
|
||||
#name : #ImageInitializer,
|
||||
#superclass : #CommandLineHandler,
|
||||
#category : #'Diya-Runtime'
|
||||
}
|
||||
|
||||
{ #category : #accessing }
|
||||
ImageInitializer class >> commandName [
|
||||
^'init'
|
||||
]
|
||||
|
||||
{ #category : #activation }
|
||||
ImageInitializer >> activate [
|
||||
self initializeImage.
|
||||
(self hasOption: 'save')
|
||||
ifTrue: [
|
||||
self snap
|
||||
].
|
||||
^ self exitSuccess
|
||||
]
|
||||
|
||||
{ #category : #'init-image' }
|
||||
ImageInitializer >> getInitListExclude: loaded [
|
||||
^ Smalltalk allClasses
|
||||
select: [ :c |
|
||||
(loaded includes: c) not
|
||||
and: (c class selectors indexOf: #initialize ifAbsent: [ ]) isNotNil ]
|
||||
]
|
||||
|
||||
{ #category : #'init-image' }
|
||||
ImageInitializer >> getLoadedClasses [
|
||||
| list |
|
||||
list := (SessionManager default startupList
|
||||
collect: [ :c |
|
||||
(c respondsTo: #registeredClass)
|
||||
ifTrue: [ c registeredClass ]
|
||||
ifFalse: [ c ] ]) asSet.
|
||||
list add: SourceFileArray.
|
||||
list add: FFICompilerPlugin.
|
||||
^ list
|
||||
]
|
||||
|
||||
{ #category : #'init-image' }
|
||||
ImageInitializer >> initializeImage [
|
||||
| initializeList retryList loaded |
|
||||
retryList := Set new.
|
||||
loaded := self getLoadedClasses.
|
||||
self preloadSystem: loaded.
|
||||
initializeList := self getInitListExclude: loaded.
|
||||
initializeList
|
||||
do: [ :c |
|
||||
[ c initialize ]
|
||||
on: Error
|
||||
do: [ c = Cursor
|
||||
ifFalse: [ retryList add: c ] ] ].
|
||||
retryList
|
||||
do: [ :c |
|
||||
Transcript
|
||||
show: 'CLASS: ' , c asString , ' is not initialized';
|
||||
cr.
|
||||
c initialize ].
|
||||
FFIMethodRegistry resetAll.
|
||||
Smalltalk garbageCollect.
|
||||
SourceFiles := SourceFileArray new.
|
||||
Transcript show: 'Image initialized'; cr.
|
||||
]
|
||||
|
||||
{ #category : #'init-image' }
|
||||
ImageInitializer >> preloadSystem: loaded [
|
||||
"load unicode"
|
||||
|udata ucase base|
|
||||
base := Smalltalk imageDirectory pathString.
|
||||
udata := base,'/UnicodeData.txt'.
|
||||
ucase := base,'/CaseFolding-8.0.0.txt'.
|
||||
loaded add: (TextConstants initialize; yourself ).
|
||||
loaded add: (InflateStream initialize; yourself ).
|
||||
loaded add: (FastInflateStream initialize; yourself ).
|
||||
EncodedCharSet initialize.
|
||||
Unicode initializeTagConstants.
|
||||
Unicode
|
||||
parseUnicodeDataFrom: (ZnCharacterReadStream on: (File named: udata ) readStream encoding: 'utf8');
|
||||
parseCaseMappingFrom: (ZnCharacterReadStream on: (File named: ucase ) readStream encoding: 'utf8').
|
||||
Character characterSet: Unicode.
|
||||
ByteTextConverter initialize.
|
||||
CombinedChar parseCompositionMappingFrom: (ZnCharacterReadStream on: (File named: udata ) readStream encoding: 'utf8').
|
||||
]
|
||||
|
||||
{ #category : #activation }
|
||||
ImageInitializer >> snap [
|
||||
|pkg|
|
||||
self class removeFromSystem.
|
||||
Smalltalk garbageCollect.
|
||||
Smalltalk snapshot: true andQuit: false.
|
||||
|
||||
]
|
1
Diya/package.st
Normal file
1
Diya/package.st
Normal file
@ -0,0 +1 @@
|
||||
Package { #name : #Diya }
|
Loading…
Reference in New Issue
Block a user