2022-02-15 22:08:44 +01:00
|
|
|
|pkgn dest pkg fileReference fileName writer core hePackage ignoresClasses|
|
|
|
|
FFIMethodRegistry resetAll.
|
|
|
|
dest := Smalltalk arguments first.
|
|
|
|
pkgn := Smalltalk arguments at:2.
|
|
|
|
|
|
|
|
core := HEPackage new.
|
|
|
|
core classes: OrderedCollection new.
|
|
|
|
core traits: OrderedCollection new.
|
|
|
|
core extensionMethods: OrderedCollection new.
|
|
|
|
core packageName: pkgn.
|
|
|
|
|
|
|
|
packages := #(
|
|
|
|
'Kernel-Chronology-Extras'
|
|
|
|
'Jobs'
|
|
|
|
'Collections-Arithmetic'
|
|
|
|
'Ring-Deprecated-Core-Kernel'
|
|
|
|
'Math-Operations-Extensions'
|
|
|
|
'Collections-Atomic'
|
|
|
|
'Collections-DoubleLinkedList'
|
|
|
|
'DeprecatedFileStream'
|
|
|
|
'Zinc-Resource-Meta-Core'
|
|
|
|
'Zinc-Character-Encoding-Core'
|
|
|
|
'FileSystem-Core'
|
|
|
|
'FileSystem-Disk'
|
|
|
|
'FileSystem-Memory'
|
|
|
|
'Compression'
|
|
|
|
'FileSystem-Zip'
|
|
|
|
'Multilingual-Encodings'
|
|
|
|
'Multilingual-Languages'
|
|
|
|
'Multilingual-TextConversion'
|
|
|
|
'Text-Core'
|
|
|
|
'AST-Core'
|
|
|
|
'Debugging-Core'
|
|
|
|
'OpalCompiler-Core'
|
|
|
|
'Kernel-Traits'
|
|
|
|
'AST-Core-Traits'
|
|
|
|
'Collections-Abstract-Traits'
|
|
|
|
'Transcript-Core-Traits'
|
|
|
|
'TraitsV2-Compatibility'
|
|
|
|
'Alien-Core'
|
|
|
|
'System-Model'
|
|
|
|
'PragmaCollector'
|
|
|
|
'UnifiedFFI'
|
|
|
|
'UnifiedFFI-Legacy'
|
|
|
|
'Slot-Core'
|
|
|
|
'System-Localization'
|
|
|
|
'STON-Core'
|
2022-03-06 21:31:35 +01:00
|
|
|
'Colors'
|
2022-03-16 00:02:31 +01:00
|
|
|
'Graphics-Primitives'
|
2022-02-15 22:08:44 +01:00
|
|
|
'Graphics-Files'
|
2022-03-06 23:55:58 +01:00
|
|
|
'Diya'
|
2022-02-15 22:08:44 +01:00
|
|
|
).
|
|
|
|
|
|
|
|
ignoresClasses := {
|
|
|
|
RGCommentDefinition.
|
|
|
|
RGMethodDefinition.
|
|
|
|
ChangeRecord.
|
|
|
|
PluggableListMorph.
|
|
|
|
TextLine.
|
|
|
|
TransformMorph.
|
|
|
|
StringMorph.
|
|
|
|
AthensCairoSDLSurface.
|
|
|
|
SourceFileArray.
|
2022-03-06 23:55:58 +01:00
|
|
|
GlyphForm.
|
2022-03-16 00:02:31 +01:00
|
|
|
ManifestGraphicsPrimitives.
|
|
|
|
EllipseMidpointTracer.
|
|
|
|
GrafPort
|
2022-02-15 22:08:44 +01:00
|
|
|
}.
|
2022-03-06 23:55:58 +01:00
|
|
|
"remove some unused meothods"
|
|
|
|
Form class
|
|
|
|
removeSelector: #serviceOpenImageInWindow;
|
|
|
|
removeSelector: #openImageInWindow:;
|
|
|
|
removeSelector: #serviceImageAsBackground;
|
|
|
|
removeSelector: #setBackgroundFromImageFileNamed:;
|
|
|
|
removeSelector: #services.
|
|
|
|
Form
|
|
|
|
removeSelector: #setAsBackground;
|
|
|
|
removeSelector: #scaledByDisplayScaleFactor.
|
2022-02-15 22:08:44 +01:00
|
|
|
|
|
|
|
packages do:[:name | |pkg trait classes extensionMethods|
|
|
|
|
Transcript show: 'Processing package ',name;cr.
|
|
|
|
FFIMethodRegistry resetAll.
|
|
|
|
pkg := RPackageOrganizer default packageNamed: name asSymbol.
|
|
|
|
traits := (pkg definedClasses select: #isTrait) do: [ :e | core traits add:(HETrait for: e) ].
|
|
|
|
(pkg definedClasses reject: #isTrait) do: [ :e |
|
2022-03-16 00:02:31 +01:00
|
|
|
(ignoresClasses includes:e) ifFalse:[
|
2022-02-15 22:08:44 +01:00
|
|
|
core addClass: (HEClass for: e) ].
|
|
|
|
].
|
|
|
|
pkg extensionMethods do: [ :e |
|
|
|
|
(ignoresClasses includes:e classBinding value) ifFalse:[
|
|
|
|
core extensionMethods add:(HEMethod for: e)
|
|
|
|
]
|
|
|
|
].
|
|
|
|
].
|
|
|
|
|
|
|
|
"SDL binding class"
|
|
|
|
pkg := RPackageOrganizer default packageNamed: 'OSWindow-SDL2' asSymbol.
|
|
|
|
(pkg classNamesForClassTag: 'Bindings') do:[:e|
|
|
|
|
(ignoresClasses includes:e asClass) ifFalse:[
|
|
|
|
core addClass:(HEClass for:e asClass) ]].
|
|
|
|
|
|
|
|
"FreeType binding class"
|
|
|
|
pkg := RPackageOrganizer default packageNamed: 'FreeType' asSymbol.
|
|
|
|
(pkg classNamesForClassTag: 'Base') do:[:e|
|
|
|
|
(ignoresClasses includes:e asClass) ifFalse:[
|
|
|
|
core addClass:(HEClass for:e asClass) ]].
|
|
|
|
(pkg classNamesForClassTag: 'Bindings') do:[:e|
|
|
|
|
(ignoresClasses includes:e asClass) ifFalse:[
|
|
|
|
core addClass:(HEClass for:e asClass) ]].
|
2022-03-06 23:55:58 +01:00
|
|
|
|
2022-02-15 22:08:44 +01:00
|
|
|
"fixing some missing classes"
|
|
|
|
core addClass: (HEClass for:OSWindowPlatformSpecificHandle);
|
|
|
|
addClass: (HEClass for:ChunkWriteStream);
|
|
|
|
addClass: (HEClass for:ChunkReadStream);
|
2022-03-04 20:45:12 +01:00
|
|
|
addClass: (HEClass for:STCommandLineHandler);
|
2022-03-06 23:55:58 +01:00
|
|
|
addClass: (HEClass for:FreeTypeFace);
|
|
|
|
"form object support"
|
|
|
|
addClass: (HEClass for:DisplayObject);
|
|
|
|
addClass: (HEClass for:DisplayMedium);
|
|
|
|
addClass: (HEClass for:Form);
|
|
|
|
addClass: (HEClass for:ColorForm);
|
|
|
|
addClass: (HEClass for:ColorArray);
|
2022-03-16 00:02:31 +01:00
|
|
|
addClass: (HEClass for: AnimatedImageFrame)
|
2022-02-15 22:08:44 +01:00
|
|
|
.
|
|
|
|
|
|
|
|
fileReference := (dest,'/',(pkgn replaceAll: Character space with: $-),'.hermes') asFileReference.
|
|
|
|
fileName := fileReference fullName.
|
|
|
|
writer := HEBinaryReaderWriter new
|
|
|
|
stream: (File openForWriteFileNamed:fileName);
|
|
|
|
yourself.
|
|
|
|
core writeInto: writer.
|
|
|
|
|
|
|
|
writer stream flush.
|
|
|
|
Transcript show: 'File exported to ', dest, '/', pkgn, '.hermes'; cr.
|