eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'STCCompilerInterface':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: STCCompilerInterface


Inheritance:

   Object
   |
   +--STCCompilerInterface

Package:
stx:libcomp
Category:
System-Compiler
Version:
rev: 1.68 date: 2019/08/16 16:40:48
user: cg
file: STCCompilerInterface.st directory: libcomp
module: stx stc-classLibrary: libcomp

Description:


a refactored complex method - originally found in ByteCodeCompiler.


Class protocol:

accessing
o  getCCDefine
return a string which was used to identify the C-Compiler used
when STX was compiled, and which should be passed down when compiling methods.
For example, when compiled with GNUC, this is '__GNUC__';
on windows, this is either '__VISUAL__', '__BORLANDC__' or '__MINGW64__'

usage example(s):

     STCCompilerInterface getCCDefine

o  getCPUDefine
return a string which was used to identify this CPU type when STX was
compiled, and which should be passed down when compiling methods.
For example, on a 386 (and successors), this may be '-D__x86__';
on a vax, this would be '-D__vax__'.
This is normally not of interest to 'normal' users; however, it is passed
down to the c-compiler when methods are incrementally compiled to machine code.
Do not use this for CPU determination; only to pass on to stc for compilation.
(see OperatingSystem getCPUType for this)

usage example(s):

     STCCompilerInterface getCPUDefine

o  getOSDefine
return a string which was used to identify this machine when stx was
compiled, and which should be passed down when compiling methods.
For example, on linux, this is '-D__linux__'; on osx, it is '-D__osx__'.
Do not use this for OS determination; only to pass on to stc for compilation.
(see OperatingSystem getOSType for this)

usage example(s):

     STCCompilerInterface getOSDefine

o  stcPathOf: command
return the path to an stc command, or nil if not found.

usage example(s):

     STCCompilerInterface stcPathOf:'stc'     

o  verbose
if on, trace command execution on the Transcript

o  verbose: aBoolean
if on, trace command execution on the Transcript

class initialization
o  initialize
(comment from inherited method)
called only once - initialize signals


Instance protocol:

accessing
o  cFileName: something

o  incrementalStcPath
return the path to the stc command for incremental method compilation,
or nil if not found.

o  originator: something

o  parserFlags: something

o  stFileName: something

error raising
o  parseError: messageText position: position
not normally reached

machine code generation
o  compileToMachineCode: aString forClass: aClass selector: selector inCategory: categoryArg notifying: requestorArg install: install skipIfSame: skipIfSame silent: silent
this is called to compile primitive code.
It saves the code to a tmporary, calls stc to create C-code, compiles it, links
it to a tiny little dll and loads it.
As you already see, this takes some time and is therefore ONLY done for code containing prims;
all pure smalltalk code is compiled to bytecode and jitted by the VM.

o  compileToMachineCode: aString forClass: aClass selector: selector inCategory: categoryArg notifying: requestorArg install: install skipIfSame: skipIfSame silent: silent generateCOnly: generateCOnly
this is called to compile primitive code.
It saves the code to a tmporary, calls stc to create C-code, compiles it, links
it to a tiny little dll and loads it.
As you already see, this takes some time and is therefore ONLY done for code containing prims;
all pure smalltalk code is compiled to bytecode and jitted by the VM.

machine code generation-helpers
o  compileToC_onError: aBlock
compile st to C using stc.
If any error happens, call aBlock passing it the fileName containing diagnostics

o  compileToExe_onError: aBlock
compile C to exe, using cc.
If any error happens, call aBlock passing it the fileName containing diagnostics

o  compileToObj_onError: aBlock
compile C to obj, using cc.
If any error happens, call aBlock passing it the fileName containing diagnostics

o  compileToS_onError: aBlock
compile C to assembler, using cc.
If any error happens, call aBlock passing it the fileName containing diagnostics

o  ensureExternalToolsArePresent
make it absolute, so that we are immune to directory changes

o  ensureModuleDirectoryExists
create a small README there ...

o  ensureSuperClassesAreLoadedOf: aClass

o  fileOutAllDefinitionsOf: aClass to: aStream rememberIn: definedClasses

o  generateSTSource: aString
generate a unique name, consisting of my processID and a sequence number

o  reportCompilationErrorFor: aCommand

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  reportCompilationErrorFor: aCommand fromFile: anErrorFilename
replace the filename string

o  setupCompilationCommandArguments
ParserFlags useBorlandC ifTrue:[



ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Fri, 29 Mar 2024 14:40:30 GMT