VM Maker: VMMaker.oscog-eem.2767.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

VM Maker: VMMaker.oscog-eem.2767.mcz

commits-2
 
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.2767.mcz

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

Name: VMMaker.oscog-eem.2767
Author: eem
Time: 2 July 2020, 3:16:42.814429 pm
UUID: cc785150-6e35-4dc6-9517-baa9c6b38577
Ancestors: VMMaker.oscog-eem.2762

Slang: Allow the CogCompilers/Cogit files to specify preampleCCode.

=============== Diff against VMMaker.oscog-eem.2762 ===============

Item was changed:
  ----- Method: CCodeGenerator>>emitCHeaderOn: (in category 'C code generator') -----
  emitCHeaderOn: aStream
  "Emit the initial part of a source file on aStream, comprising the version stamp,
  the global struct usage flags, the header files and preamble code."
 
  | headerClass |
  headerClass := [vmClass coreInterpreterClass]
  on: MessageNotUnderstood
  do: [:ex| vmClass].
  aStream nextPutAll: (self fileHeaderVersionStampForSourceClass: headerClass); cr; cr.
  self emitGlobalStructFlagOn: aStream.
 
  self addHeaderFileFirst: '"sq.h"'.
  "Additional header files; include C library ones first."
  self emitHeaderFiles: (headerFiles select: [:hdr| hdr includes: $<]) on: aStream.
  "Additional header files; include squeak VM ones last"
  self emitHeaderFiles: (headerFiles reject: [:hdr| hdr includes: $<]) on: aStream.
 
+ self maybePutPreambleFor: vmClass on: aStream.
- vmClass isInterpreterClass ifTrue:
- [self maybePutPreambleFor: vmClass on: aStream].
 
  aStream cr!

Item was changed:
  ----- Method: CCodeGenerator>>maybePutPreambleFor:on: (in category 'C code generator') -----
  maybePutPreambleFor: aClass on: aStream
+ (aClass class whichClassIncludesSelector: #preambleCCode) ifNotNil:
+ [:actualMetaclass |
- aClass preambleCCode ifNotNil:
- [:preamble| | actualClass |
- actualClass := aClass class whichClassIncludesSelector: #preambleCCode.
  aStream
  ensureCr; cr;
+ nextPutAll: '/* '; print: actualMetaclass; nextPutAll: '>>preambleCCode */'; cr;
+ nextPutAll: actualMetaclass soleInstance preambleCCode; cr;
+ nextPutAll: '/* end '; print: actualMetaclass; nextPutAll: '>>preambleCCode */'; cr]!
- nextPutAll: '/* '; print: actualClass; nextPutAll: '>>preambleCCode */'; cr;
- nextPutAll: preamble; cr;
- nextPutAll: '/* end '; print: actualClass; nextPutAll: '>>preambleCCode */'; cr]!