STCCompilerInterface.st
author Claus Gittinger <cg@exept.de>
Thu, 13 Oct 2016 11:40:33 +0200
changeset 4023 03113f2bc542
parent 4021 28085e55bd26
child 4028 8e7af453d137
child 4058 1e87dfa2ea9e
permissions -rw-r--r--
#REFACTORING by cg class: STCCompilerInterface added: #getCCDefine #getCPUDefine #getOSDefine changed: #setupCompilationCommandArguments ask STCCompilerInterface for compilation flags; not the OS
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1669
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 1989 by Claus Gittinger
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
 COPYRIGHT (c) 2006 by eXept Software AG
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
              All Rights Reserved
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 This software is furnished under a license and may be used
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 only in accordance with the terms of that license and with the
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 inclusion of the above copyright notice.   This software may not
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 be provided or otherwise made available to, or used by, any
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 other person.  No title to or ownership of the software is
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
 hereby transferred.
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
"
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
"{ Package: 'stx:libcomp' }"
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
3659
7570b2de4934 class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3437
diff changeset
    15
"{ NameSpace: Smalltalk }"
7570b2de4934 class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3437
diff changeset
    16
1669
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
Object subclass:#STCCompilerInterface
3240
60e8fa24bbc6 Use #isWritableDirectory
Stefan Vogel <sv@exept.de>
parents: 3173
diff changeset
    18
	instanceVariableNames:'originator parserFlags initName theNonMetaclassToCompileFor
60e8fa24bbc6 Use #isWritableDirectory
Stefan Vogel <sv@exept.de>
parents: 3173
diff changeset
    19
		classToCompileFor stFileName cFileName oFileName stcFlags cFlags
60e8fa24bbc6 Use #isWritableDirectory
Stefan Vogel <sv@exept.de>
parents: 3173
diff changeset
    20
		stcPath ccPath requestor methodCategory executionStatus package'
60e8fa24bbc6 Use #isWritableDirectory
Stefan Vogel <sv@exept.de>
parents: 3173
diff changeset
    21
	classVariableNames:'SequenceNumber Verbose KeepIntermediateFiles'
60e8fa24bbc6 Use #isWritableDirectory
Stefan Vogel <sv@exept.de>
parents: 3173
diff changeset
    22
	poolDictionaries:''
60e8fa24bbc6 Use #isWritableDirectory
Stefan Vogel <sv@exept.de>
parents: 3173
diff changeset
    23
	category:'System-Compiler'
1669
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
!
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
!STCCompilerInterface class methodsFor:'documentation'!
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
copyright
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
"
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
 COPYRIGHT (c) 1989 by Claus Gittinger
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 COPYRIGHT (c) 2006 by eXept Software AG
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
              All Rights Reserved
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
 This software is furnished under a license and may be used
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
 only in accordance with the terms of that license and with the
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
 inclusion of the above copyright notice.   This software may not
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
 be provided or otherwise made available to, or used by, any
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
 other person.  No title to or ownership of the software is
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
 hereby transferred.
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
"
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
!
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
documentation
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
"
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
    a refactored complex method - originally found in ByteCodeCompiler.
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
"
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
! !
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
!STCCompilerInterface class methodsFor:'accessing'!
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
4023
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    51
getCCDefine
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    52
    "return a string which was used to identify the C-Compiler used
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    53
     when STX was compiled, and which should be passed down when compiling methods.
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    54
     For example, when compiled with GNUC, this is '__GNUC__';
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    55
     on windows, this is either '__VISUAL__', '__BORLANDC__' or '__MINGW64__'"
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    56
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    57
%{  /* NOCONTEXT */
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    58
#ifndef CC_DEFINE
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    59
# ifdef __win32__
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    60
#  if defined( __BORLANDC__ )
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    61
#   define CC_DEFINE    "__BORLANDC__"
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    62
#  else
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    63
#   if defined( __VISUALC__ )
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    64
#    define CC_DEFINE     "__VISUALC__"
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    65
#   else
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    66
#    if defined( __MINGW64__ )
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    67
#     define CC_DEFINE     "__MINGW64__"
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    68
#    else
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    69
#     if defined( __MINGW32__ )
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    70
#      define CC_DEFINE     "__MINGW32__"
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    71
#     else
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    72
#      define CC_DEFINE     "__CC__"
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    73
#     endif
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    74
#    endif
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    75
#   endif
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    76
#  endif
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    77
# else /* not __win32__ */
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    78
#  if defined(__CLANG__) || defined( __clang__ )
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    79
#   define CC_DEFINE     "__CLANG__"
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    80
#  else
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    81
#   ifdef __GNUC__
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    82
#    define CC_DEFINE     "__GNUC__"
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    83
#   else
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    84
#    define CC_DEFINE     "__CC__"
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    85
#   endif
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    86
#  endif
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    87
# endif
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    88
#endif
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    89
    RETURN ( __MKSTRING(CC_DEFINE));
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    90
%}
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    91
    "
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    92
     STCCompilerInterface getCCDefine
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    93
    "
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    94
!
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    95
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    96
getCPUDefine
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    97
    "return a string which was used to identify this CPU type when STX was
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    98
     compiled, and which should be passed down when compiling methods.
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
    99
     For example, on a 386 (and successors), this may be '-D__x86__'; 
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   100
     on a vax, this would be '-D__vax__'.
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   101
     This is normally not of interest to 'normal' users; however, it is passed
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   102
     down to the c-compiler when methods are incrementally compiled to machine code.
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   103
     Do not use this for CPU determination; only to pass on to stc for compilation.
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   104
     (see OperatingSystem getCPUType for this)"
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   105
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   106
%{  /* NOCONTEXT */
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   107
#   ifndef CPU_DEFINE
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   108
#       define CPU_DEFINE "-DunknownCPU"
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   109
#   endif
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   110
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   111
    RETURN ( __MKSTRING(CPU_DEFINE));
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   112
%}
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   113
    "
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   114
     STCCompilerInterface getCPUDefine
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   115
    "
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   116
!
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   117
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   118
getOSDefine
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   119
    "return a string which was used to identify this machine when stx was
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   120
     compiled, and which should be passed down when compiling methods.
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   121
     For example, on linux, this is '-D__linux__'; on osx, it is '-D__osx__'.
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   122
     Do not use this for OS determination; only to pass on to stc for compilation.
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   123
     (see OperatingSystem getOSType for this)"
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   124
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   125
%{  /* NOCONTEXT */
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   126
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   127
#ifndef OS_DEFINE
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   128
# ifdef __win32__
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   129
#  define OS_DEFINE "-D__win32__"
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   130
# endif
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   131
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   132
# ifndef OS_DEFINE
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   133
#  define OS_DEFINE "-DunknownOS"
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   134
# endif
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   135
#endif
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   136
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   137
    RETURN ( __MKSTRING(OS_DEFINE));
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   138
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   139
#undef OS_DEFINE
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   140
%}
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   141
    "
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   142
     STCCompilerInterface getOSDefine
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   143
    "
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   144
!
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
   145
1669
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
stcPathOf:command 
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
    "return the path to an stc command, or nil if not found."
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
    |f d reqdSuffix cmd|
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   151
    "/
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
    "/ care for executable suffix
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
    "/
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
    cmd := command.
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
    OperatingSystem isMSDOSlike ifTrue:[
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
        reqdSuffix := 'exe'
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
    ] ifFalse:[
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   158
        OperatingSystem isVMSlike ifTrue:[
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
            reqdSuffix := 'EXE'
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
        ].
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
    ].
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   162
    reqdSuffix notNil ifTrue:[
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
        (f := cmd asFilename) suffix isEmpty ifTrue:[
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
            cmd := (f withSuffix:reqdSuffix) name
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
        ]
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
    ].
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
    "/
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
    "/ for our convenience, also check in current
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
    "/ and parent directories; even if PATH does not
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
    "/ include them ...
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
    "/
3720
1d89765dce7f #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3664
diff changeset
   172
    #('.' '../stc' '../../stc') do:[:relPath |
1d89765dce7f #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3664
diff changeset
   173
        d := Filename currentDirectory construct:relPath.
1d89765dce7f #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3664
diff changeset
   174
        (f := d construct:cmd) isExecutable ifTrue:[
1d89765dce7f #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3664
diff changeset
   175
            ^ f pathName
1d89765dce7f #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 3664
diff changeset
   176
        ].
1669
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
    ].
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   178
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
    "/
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
    "/ ok, stc must be installed in some directory along the PATH
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
    "/
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   182
    ^ OperatingSystem pathOfCommand:command
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   183
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
    "
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
     STCCompilerInterface stcPathOf:'stc'     
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   186
    "
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
    "Created: 13.9.1995 / 14:37:16 / claus"
3173
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   189
!
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   190
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   191
verbose
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   192
    "if on, trace command execution on the Transcript"
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   193
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   194
    ^ Verbose
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   195
!
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   196
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   197
verbose:aBoolean 
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   198
    "if on, trace command execution on the Transcript"
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   199
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   200
    Verbose := aBoolean
1669
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   201
! !
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   203
!STCCompilerInterface class methodsFor:'class initialization'!
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   204
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   205
initialize
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   206
    Verbose := false.
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   207
! !
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   209
!STCCompilerInterface methodsFor:'accessing'!
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   210
2335
70a690b780f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
   211
cFileName:something
70a690b780f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
   212
    cFileName := something.
70a690b780f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
   213
!
70a690b780f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
   214
1669
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   215
incrementalStcPath 
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   216
    "return the path to the stc command for incremental method compilation, 
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   217
     or nil if not found."
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   218
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   219
    |f cmd|
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   221
    (cmd := parserFlags stcPath) isEmptyOrNil ifTrue:[
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
        (f := self class stcPathOf:'stc') notNil ifTrue:[
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   223
            cmd := f
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
        ] ifFalse:[
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   225
            cmd := self class stcPathOf:'demostc'
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
        ]
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   227
    ].
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   228
    (cmd notNil and:[cmd includes:Character space]) ifTrue:[
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   229
        cmd := '"' , cmd , '"'.
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   230
    ].
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   231
    ^ cmd
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   232
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   233
    "Created: 13.9.1995 / 14:36:36 / claus"
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   234
    "Modified: 13.9.1995 / 15:15:04 / claus"
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   235
!
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   236
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   237
originator:something
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   238
    originator := something.
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   239
!
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   240
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   241
parserFlags:something
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   242
    parserFlags := something.
2335
70a690b780f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
   243
!
70a690b780f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
   244
70a690b780f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
   245
stFileName:something
70a690b780f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
   246
    stFileName := something.
1669
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   247
! !
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   248
3411
9e5e218273ee class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3361
diff changeset
   249
!STCCompilerInterface methodsFor:'error raising'!
9e5e218273ee class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3361
diff changeset
   250
9e5e218273ee class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3361
diff changeset
   251
parseError:messageText position:position
9e5e218273ee class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3361
diff changeset
   252
    originator parseError:messageText position:position.
9e5e218273ee class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3361
diff changeset
   253
    "not normally reached"
9e5e218273ee class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3361
diff changeset
   254
    ParseError raiseErrorString:messageText.
9e5e218273ee class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3361
diff changeset
   255
! !
9e5e218273ee class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3361
diff changeset
   256
1669
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   257
!STCCompilerInterface methodsFor:'machine code generation'!
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   258
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   259
compileToMachineCode:aString forClass:aClass selector:selector inCategory:categoryArg 
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   260
                             notifying:requestorArg install:install skipIfSame:skipIfSame silent:silent
1669
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
    "this is called to compile primitive code.
3357
7dabc8614714 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3348
diff changeset
   262
     It saves the code to a tmporary, calls stc to create C-code, compiles it, links
7dabc8614714 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3348
diff changeset
   263
     it to a tiny little dll and loads it.
7dabc8614714 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3348
diff changeset
   264
     As you already see, this takes some time and is therefore ONLY done for code containing prims;
7dabc8614714 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3348
diff changeset
   265
     all pure smalltalk code is compiled to bytecode and jitted by the VM."
1669
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   266
3042
ca88c2527ba5 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3013
diff changeset
   267
    |handle oldMethod newMethod ok dllFileName|
1669
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   268
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   269
    install ifFalse:[
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   270
        "/ cannot do it uninstalled. reason:
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   271
        "/ if it is loaded twice, the first version could be unloaded by
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   272
        "/ finalization, which would also unload the second version
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   273
        "/ (because the first unload would unload the second version too)
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   274
        ^ #CannotLoad
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   275
    ].
2704
19bedf5ff15e changed: #compileToMachineCode:forClass:selector:inCategory:notifying:install:skipIfSame:silent:
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   276
    parserFlags isNil ifTrue:[
19bedf5ff15e changed: #compileToMachineCode:forClass:selector:inCategory:notifying:install:skipIfSame:silent:
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   277
        parserFlags := ParserFlags new
19bedf5ff15e changed: #compileToMachineCode:forClass:selector:inCategory:notifying:install:skipIfSame:silent:
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   278
    ].
1669
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   279
    parserFlags stcCompilation == #never ifTrue:[^ #CannotLoad].
1670
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   280
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   281
    classToCompileFor := aClass.
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   282
    requestor := requestorArg.
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   283
    methodCategory := categoryArg.
1669
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   284
3411
9e5e218273ee class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3361
diff changeset
   285
    self ensureExternalToolsArePresent.
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   286
    self ensureModuleDirectoryExists.
1669
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   287
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   288
    theNonMetaclassToCompileFor := classToCompileFor theNonMetaclass.
1941
941810becd2c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
   289
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   290
    self ensureSuperClassesAreLoadedOf:theNonMetaclassToCompileFor.
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   291
    theNonMetaclassToCompileFor privateClassesSorted do:[:aPrivateClass |
1670
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   292
        self ensureSuperClassesAreLoadedOf:aPrivateClass.
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   293
    ].
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   294
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   295
    (classToCompileFor isNil 
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   296
    or:[parserFlags allowExtensionsToPrivateClasses 
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   297
    or:[classToCompileFor owningClass isNil]]) ifTrue:[
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   298
        (requestor respondsTo:#packageToInstall) ifFalse:[
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   299
            package := Class packageQuerySignal query.
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   300
        ] ifTrue:[
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   301
            package := requestor packageToInstall
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   302
        ].
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   303
    ] ifFalse:[
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   304
        package := classToCompileFor owningClass package
1669
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   305
    ].
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   306
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   307
    [
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   308
        self generateSTSource:aString.
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   309
        self setupCompilationCommandArguments.
4018
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   310
        ok := self 
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   311
                compileToC_onError:[:errorFile |
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   312
                    self reportCompilationErrorFor:stcPath fromFile:errorFile
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   313
                ].
1669
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   314
4018
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   315
        parserFlags stcKeepSIntermediate ifTrue:[ 
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   316
            self compileToS_onError:[:errorFile | ]
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   317
        ].
3042
ca88c2527ba5 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3013
diff changeset
   318
        "/ now compile to machine code
4018
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   319
        ok := self 
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   320
                compileToObj_onError:[:errorFile |
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   321
                    self reportCompilationErrorFor:ccPath fromFile:errorFile.
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   322
                ].
1669
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   323
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   324
        originator activityNotification:''.
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   325
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   326
        "
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   327
         if required, make a shared or otherwise loadable object file for it
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   328
        "
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   329
        originator activityNotification:'linking'.
2656
d3f4404f3e23 changed:
Stefan Vogel <sv@exept.de>
parents: 2649
diff changeset
   330
        dllFileName := ObjectFileLoader createLoadableObjectFor:(oFileName asFilename withoutSuffix name).
d3f4404f3e23 changed:
Stefan Vogel <sv@exept.de>
parents: 2649
diff changeset
   331
        dllFileName isNil ifTrue:[
1669
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   332
            "/ something went wrong
3411
9e5e218273ee class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3361
diff changeset
   333
            self parseError:('link error: ' , ObjectFileLoader lastError) position:1.
1669
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   334
        ].
2656
d3f4404f3e23 changed:
Stefan Vogel <sv@exept.de>
parents: 2649
diff changeset
   335
        dllFileName asFilename exists ifFalse:[
3411
9e5e218273ee class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3361
diff changeset
   336
            self parseError:'link failed - cannot create machine code' position:1.
1669
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   337
        ].
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   338
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   339
        oldMethod := classToCompileFor compiledMethodAt:selector.
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   340
        oldMethod notNil ifTrue:[package := oldMethod package].
3159
697fcd52060b class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3069
diff changeset
   341
        install ifTrue:[
697fcd52060b class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3069
diff changeset
   342
            (Smalltalk
697fcd52060b class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3069
diff changeset
   343
                    changeRequest:#methodInClass
697fcd52060b class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3069
diff changeset
   344
                    with:(Array with:classToCompileFor with:selector with:oldMethod)) ifFalse:[
697fcd52060b class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3069
diff changeset
   345
                ^ #CannotLoad
697fcd52060b class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3069
diff changeset
   346
            ].
697fcd52060b class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3069
diff changeset
   347
        ].
1669
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   348
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   349
        "
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   350
         load the method objectfile
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   351
        "
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   352
        originator activityNotification:'loading'.
3361
dfa4c3b41d1e class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3359
diff changeset
   353
        handle := ObjectFileLoader loadMethodObjectFile:dllFileName.
dfa4c3b41d1e class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3359
diff changeset
   354
        originator activityNotification:''.
1669
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   355
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   356
        handle isNil ifTrue:[
3173
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   357
            KeepIntermediateFiles ~~ true ifTrue:[ OperatingSystem removeFile:dllFileName ].
2185
cb311d08a486 changed #compileToMachineCode:forClass:selector:inCategory:notifying:install:skipIfSame:silent:
Stefan Vogel <sv@exept.de>
parents: 2068
diff changeset
   358
            "catch, so that #CannotLoad processing is done"
3069
230e5da2ff5d class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3042
diff changeset
   359
            ParseError catch:[
2185
cb311d08a486 changed #compileToMachineCode:forClass:selector:inCategory:notifying:install:skipIfSame:silent:
Stefan Vogel <sv@exept.de>
parents: 2068
diff changeset
   360
                originator parseError:'dynamic load of machine code failed' position:1.
cb311d08a486 changed #compileToMachineCode:forClass:selector:inCategory:notifying:install:skipIfSame:silent:
Stefan Vogel <sv@exept.de>
parents: 2068
diff changeset
   361
            ].
1669
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   362
            ^ #CannotLoad
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   363
        ].
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   364
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   365
        "
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   366
         did it work ?
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   367
        "
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   368
        newMethod := classToCompileFor compiledMethodAt:selector.
1669
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   369
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   370
        "/ if install is false, we have to undo the install (which is always done, when loading machine code)
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   371
        install ifFalse:[
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   372
            oldMethod isNil ifTrue:[
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   373
                classToCompileFor removeSelector:selector
1669
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   374
            ] ifFalse:[
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   375
                newMethod setPackage:oldMethod package.
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   376
                classToCompileFor addSelector:selector withMethod:oldMethod.
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   377
                oldMethod setPackage:package.
1669
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   378
            ]
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   379
        ].
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   380
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   381
        newMethod notNil ifTrue:[
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   382
            handle method ~~ newMethod ifTrue:[
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   383
                'Compiler [warning]: loaded method installed itself in another class' errorPrintCR.
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   384
            ].
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   385
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   386
            newMethod source:aString string.
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   387
            newMethod setPackage:package.
1669
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   388
"/            Project notNil ifTrue:[
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   389
"/                newMethod package:(Project currentPackageName)
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   390
"/            ].
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   391
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   392
    "/        classToCompileFor updateRevisionString.
1669
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   393
            install ifTrue:[
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   394
                classToCompileFor addChangeRecordForMethod:newMethod fromOld:oldMethod.
1669
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   395
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   396
                "/ kludge-sigh: must send change messages manually here (stc-loaded code does not do it)
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   397
                "/ see addMethod:... in ClassDescription
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   398
                classToCompileFor changed:#methodDictionary with:(Array with:selector with:oldMethod).
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   399
                Smalltalk changed:#methodInClass with:(Array with:classToCompileFor with:selector with:oldMethod).
2350
16caba266df4 changed: #compileToMachineCode:forClass:selector:inCategory:notifying:install:skipIfSame:silent:
Stefan Vogel <sv@exept.de>
parents: 2336
diff changeset
   400
            ] ifFalse:[
16caba266df4 changed: #compileToMachineCode:forClass:selector:inCategory:notifying:install:skipIfSame:silent:
Stefan Vogel <sv@exept.de>
parents: 2336
diff changeset
   401
                oldMethod := nil.
1669
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   402
            ].
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   403
1986
57913c678602 comment
Stefan Vogel <sv@exept.de>
parents: 1941
diff changeset
   404
            silent ifFalse:[
1941
941810becd2c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
   405
                Transcript showCR:('    compiled: ', aClass name,' ',selector,' - machine code')
1669
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   406
            ].
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   407
            ObjectMemory flushCaches.
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   408
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   409
            handle method:newMethod.
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   410
2350
16caba266df4 changed: #compileToMachineCode:forClass:selector:inCategory:notifying:install:skipIfSame:silent:
Stefan Vogel <sv@exept.de>
parents: 2336
diff changeset
   411
            "/ check for obsolete compiled method code and unload the
16caba266df4 changed: #compileToMachineCode:forClass:selector:inCategory:notifying:install:skipIfSame:silent:
Stefan Vogel <sv@exept.de>
parents: 2336
diff changeset
   412
            "/ corresponding ObjectFileHandle.
16caba266df4 changed: #compileToMachineCode:forClass:selector:inCategory:notifying:install:skipIfSame:silent:
Stefan Vogel <sv@exept.de>
parents: 2336
diff changeset
   413
            "/ The old method with its source code is usually kept in the method history.
16caba266df4 changed: #compileToMachineCode:forClass:selector:inCategory:notifying:install:skipIfSame:silent:
Stefan Vogel <sv@exept.de>
parents: 2336
diff changeset
   414
            "/ and will be recompiled on an undo
1669
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   415
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   416
            ObjectFileLoader loadedObjectHandlesDo:[:anotherHandle |
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   417
                anotherHandle isMethodHandle ifTrue:[
2350
16caba266df4 changed: #compileToMachineCode:forClass:selector:inCategory:notifying:install:skipIfSame:silent:
Stefan Vogel <sv@exept.de>
parents: 2336
diff changeset
   418
                    anotherHandle method == oldMethod ifTrue:[
16caba266df4 changed: #compileToMachineCode:forClass:selector:inCategory:notifying:install:skipIfSame:silent:
Stefan Vogel <sv@exept.de>
parents: 2336
diff changeset
   419
                        "break association betwen old method, code and handle"
16caba266df4 changed: #compileToMachineCode:forClass:selector:inCategory:notifying:install:skipIfSame:silent:
Stefan Vogel <sv@exept.de>
parents: 2336
diff changeset
   420
                        anotherHandle removeConnectedObjects.
16caba266df4 changed: #compileToMachineCode:forClass:selector:inCategory:notifying:install:skipIfSame:silent:
Stefan Vogel <sv@exept.de>
parents: 2336
diff changeset
   421
                    ].
16caba266df4 changed: #compileToMachineCode:forClass:selector:inCategory:notifying:install:skipIfSame:silent:
Stefan Vogel <sv@exept.de>
parents: 2336
diff changeset
   422
                    anotherHandle isObsolete ifTrue:[
16caba266df4 changed: #compileToMachineCode:forClass:selector:inCategory:notifying:install:skipIfSame:silent:
Stefan Vogel <sv@exept.de>
parents: 2336
diff changeset
   423
                        anotherHandle unload.
16caba266df4 changed: #compileToMachineCode:forClass:selector:inCategory:notifying:install:skipIfSame:silent:
Stefan Vogel <sv@exept.de>
parents: 2336
diff changeset
   424
                        anotherHandle removeUnusedObjectFile.
16caba266df4 changed: #compileToMachineCode:forClass:selector:inCategory:notifying:install:skipIfSame:silent:
Stefan Vogel <sv@exept.de>
parents: 2336
diff changeset
   425
                    ].
16caba266df4 changed: #compileToMachineCode:forClass:selector:inCategory:notifying:install:skipIfSame:silent:
Stefan Vogel <sv@exept.de>
parents: 2336
diff changeset
   426
                ].
1669
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   427
            ].
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   428
            ^ newMethod.
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   429
        ].
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   430
3013
8f6ee079e44d class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3012
diff changeset
   431
        "/ OperatingSystem removeFile:moduleFileName.
3411
9e5e218273ee class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3361
diff changeset
   432
        self parseError:'dynamic load failed' position:1.
1669
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   433
    ] ensure:[
3173
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   434
        KeepIntermediateFiles == true ifTrue:[ 
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   435
            Transcript showCR:'keeping files'
2703
2e966ec31082 changed: #compileToMachineCode:forClass:selector:inCategory:notifying:install:skipIfSame:silent:
Claus Gittinger <cg@exept.de>
parents: 2658
diff changeset
   436
        ] ifFalse:[
3173
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   437
            parserFlags stcKeepSTIntermediate ifTrue:[
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   438
                Transcript showCR:'keeping st file: ', stFileName asFilename pathName
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   439
            ] ifFalse:[
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   440
                OperatingSystem removeFile:stFileName.
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   441
            ].
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   442
            cFileName notNil ifTrue:[
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   443
                parserFlags stcKeepCIntermediate == true ifTrue:[
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   444
                    Transcript showCR:'keeping c file: ', cFileName asFilename pathName
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   445
                ] ifFalse:[
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   446
                    OperatingSystem removeFile:cFileName.
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   447
                ]
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   448
            ].
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   449
            oFileName notNil ifTrue:[
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   450
                parserFlags stcKeepOIntermediate == true ifTrue:[
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   451
                    Transcript showCR:'keeping o file: ', oFileName asFilename pathName
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   452
                ] ifFalse:[
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   453
                    OperatingSystem removeFile:oFileName.
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   454
                ].
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   455
            ].
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   456
"/            OperatingSystem isMSDOSlike ifTrue:[
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   457
"/                mapFileName notNil ifTrue:[
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   458
"/                   OperatingSystem removeFile:mapFileName.
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   459
"/                ].
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   460
"/                libFileName notNil ifTrue:[
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   461
"/                   OperatingSystem removeFile:libFileName.
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   462
"/                ].
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   463
"/            ].
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   464
        ]
1669
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   465
    ].
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   466
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   467
    "
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   468
     |m|
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   469
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   470
     Object subclass:#Test
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   471
            instanceVariableNames:''
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   472
            classVariableNames:''
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   473
            poolDictionaries:''
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   474
            category:'tests'.
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   475
     m := ByteCodeCompiler
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   476
            compile:'foo ^ ''hello'''
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   477
            forClass:Test
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   478
            inCategory:'tests'
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   479
            notifying:nil
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   480
            install:false
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   481
            skipIfSame:false.
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   482
     m inspect
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   483
    "
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   484
    "
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   485
     |m|
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   486
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   487
     Object subclass:#Test
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   488
            instanceVariableNames:''
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   489
            classVariableNames:''
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   490
            poolDictionaries:''
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   491
            category:'tests'.
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   492
     m := ByteCodeCompiler
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   493
            compileToMachineCode:'foo %{ RETURN (_MKSMALLINT(1)); %}'
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   494
            forClass:Test
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   495
            inCategory:'tests'
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   496
            notifying:nil
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   497
            install:false
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   498
            skipIfSame:false
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   499
            silent:false.
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   500
     m inspect
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   501
    "
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   502
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   503
    "Modified: / 14-09-1995 / 22:33:04 / claus"
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   504
    "Modified: / 19-03-1999 / 08:31:42 / stefan"
2704
19bedf5ff15e changed: #compileToMachineCode:forClass:selector:inCategory:notifying:install:skipIfSame:silent:
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   505
    "Modified: / 17-09-2011 / 10:39:25 / cg"
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   506
! !
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   507
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   508
!STCCompilerInterface methodsFor:'machine code generation-helpers'!
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   509
4019
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   510
compileToC_onError:aBlock
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   511
    "compile st to C using stc.
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   512
     If any error happens, call aBlock passing it the fileName containing diagnostics"
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   513
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   514
    |command ok errorOutputFile|
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   515
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   516
    command := (self possiblyQuotedPath:stcPath) , ' ' , stcFlags 
4021
28085e55bd26 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   517
                , ' -E:',(self possiblyQuotedPath:(Filename tempDirectory / 'lastIncrStcErrorOutput') pathName)
4019
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   518
                , ' -defdir=', (self possiblyQuotedPath:cFileName asFilename directory pathName).
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   519
    cFileName asFilename suffix ~= 'c' ifTrue:[
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   520
        command := command , ' -cSuffix=',cFileName asFilename suffix.
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   521
    ].
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   522
    command := command , ' -C ' , (self possiblyQuotedPath:stFileName asFilename pathName).
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   523
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   524
    Verbose == true ifTrue:[
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   525
        Transcript show:'executing: '; showCR:command.
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   526
    ].
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   527
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   528
    originator activityNotification:'compiling (stc)'.
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   529
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   530
    errorOutputFile := Filename tempDirectory / 'stcErrorOutput'. 
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   531
    errorOutputFile writingFileDo:[:errorStream |
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   532
        ok := OperatingSystem 
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   533
                    executeCommand:command 
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   534
                    inputFrom:nil
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   535
                    outputTo:errorStream
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   536
                    errorTo:errorStream
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   537
                    showWindow:false
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   538
                    onError:[:stat| 
4021
28085e55bd26 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 4019
diff changeset
   539
                                self breakPoint:#cg.
4019
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   540
                                executionStatus := stat.
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   541
                                false
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   542
                            ].
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   543
    ].
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   544
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   545
    cFileName asFilename exists ifTrue:[
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   546
        ok ifFalse:[
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   547
            'Compiler [info]: oops - system says stc failed - but c-file is there ...' infoPrintCR.
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   548
            ok := true
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   549
        ]
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   550
    ] ifFalse:[
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   551
        ok ifTrue:[
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   552
            'Compiler [info]: oops - system says stc ok - but no c-file is there ...' infoPrintCR
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   553
        ].
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   554
        ok := false
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   555
    ].
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   556
    
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   557
    [
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   558
        ok ifFalse:[
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   559
            aBlock value:errorOutputFile
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   560
        ].
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   561
    ] ensure:[
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   562
        errorOutputFile remove.
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   563
    ].
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   564
    ^ ok
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   565
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   566
    "Created: / 07-11-2006 / 12:11:24 / cg"
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   567
    "Modified: / 08-08-2011 / 22:12:01 / cg"
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   568
!
ca410e6cca3f #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
   569
4018
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   570
compileToExe_onError:aBlock 
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   571
    "compile C to exe, using cc.
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   572
     If any error happens, call aBlock passing it the fileName containing diagnostics"
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   573
4018
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   574
    |command errorOutputFile ok|
2336
adaeb8836c48 added: #compileToExe
Claus Gittinger <cg@exept.de>
parents: 2335
diff changeset
   575
2658
92f1a346dbeb added: #possiblyQuotedPath:
Claus Gittinger <cg@exept.de>
parents: 2656
diff changeset
   576
    command := (self possiblyQuotedPath:ccPath) , ' ' , cFlags , ' -D__INCREMENTAL_COMPILE__ ' , (self possiblyQuotedPath:cFileName).
2336
adaeb8836c48 added: #compileToExe
Claus Gittinger <cg@exept.de>
parents: 2335
diff changeset
   577
adaeb8836c48 added: #compileToExe
Claus Gittinger <cg@exept.de>
parents: 2335
diff changeset
   578
    Verbose == true ifTrue:[
3957
28c8f6bdb08d #BUGFIX by sr
sr
parents: 3793
diff changeset
   579
        Transcript show:'executing: ' showCR:command.
2336
adaeb8836c48 added: #compileToExe
Claus Gittinger <cg@exept.de>
parents: 2335
diff changeset
   580
    ].
adaeb8836c48 added: #compileToExe
Claus Gittinger <cg@exept.de>
parents: 2335
diff changeset
   581
    originator activityNotification:'compiling (' , ccPath , ')'.
adaeb8836c48 added: #compileToExe
Claus Gittinger <cg@exept.de>
parents: 2335
diff changeset
   582
4018
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   583
    errorOutputFile := Filename tempDirectory / 'stcErrorOutput'. 
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   584
    errorOutputFile writingFileDo:[:errorStream |
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   585
        ok := OperatingSystem 
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   586
                    executeCommand:command 
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   587
                    inputFrom:nil
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   588
                    outputTo:errorStream
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   589
                    errorTo:errorStream
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   590
                    showWindow:false
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   591
                    onError:[:stat| 
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   592
                                executionStatus := stat.
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   593
                                false
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   594
                    ].
2336
adaeb8836c48 added: #compileToExe
Claus Gittinger <cg@exept.de>
parents: 2335
diff changeset
   595
    ].
4018
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   596
    
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   597
    [
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   598
        ok ifFalse:[
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   599
            aBlock value:errorOutputFile
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   600
        ].
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   601
    ] ensure:[
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   602
        errorOutputFile remove.
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   603
    ].
2336
adaeb8836c48 added: #compileToExe
Claus Gittinger <cg@exept.de>
parents: 2335
diff changeset
   604
    ^ ok
adaeb8836c48 added: #compileToExe
Claus Gittinger <cg@exept.de>
parents: 2335
diff changeset
   605
!
adaeb8836c48 added: #compileToExe
Claus Gittinger <cg@exept.de>
parents: 2335
diff changeset
   606
4018
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   607
compileToObj_onError:aBlock
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   608
    "compile C to obj, using cc.
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   609
     If any error happens, call aBlock passing it the fileName containing diagnostics"
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   610
4018
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   611
    |errorOutputFile ok commandTemplate command ccDefine env|
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   612
4018
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   613
    "/ bcc does not like -D__BORLANDC__ (needs to be set to a version, such as 0x0505)
3170
fccd602cb081 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3159
diff changeset
   614
    "/ others do not need it (is already predefined in the compiler)
fccd602cb081 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3159
diff changeset
   615
    "/ ccDefine := ' -D',ParserFlags usedCompilerDefine.
3173
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   616
    "/ so, never redefine ccDefine
3170
fccd602cb081 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3159
diff changeset
   617
    ccDefine := ''.
fccd602cb081 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3159
diff changeset
   618
3010
7970294627a3 flag settings for 64bit mingw
Claus Gittinger <cg@exept.de>
parents: 3005
diff changeset
   619
    ParserFlags useBorlandC ifTrue:[
7970294627a3 flag settings for 64bit mingw
Claus Gittinger <cg@exept.de>
parents: 3005
diff changeset
   620
        "Note: Windows/bcc32 does not understand a space between -o and filename"
7970294627a3 flag settings for 64bit mingw
Claus Gittinger <cg@exept.de>
parents: 3005
diff changeset
   621
        "/ cg: I guess, this does not work for visual-c
3423
c6e2dbd8446a class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3419
diff changeset
   622
        commandTemplate := '%1 %2%3 -D__INCREMENTAL_COMPILE__ -o%4 -c %5'.
3010
7970294627a3 flag settings for 64bit mingw
Claus Gittinger <cg@exept.de>
parents: 3005
diff changeset
   623
    ] ifFalse:[
3423
c6e2dbd8446a class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3419
diff changeset
   624
        commandTemplate := '%1 %2%3 -D__INCREMENTAL_COMPILE__ -o %4 -c %5'.
3010
7970294627a3 flag settings for 64bit mingw
Claus Gittinger <cg@exept.de>
parents: 3005
diff changeset
   625
    ].
3423
c6e2dbd8446a class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3419
diff changeset
   626
    command := commandTemplate
c6e2dbd8446a class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3419
diff changeset
   627
                    bindWith:(self possiblyQuotedPath:ccPath) 
c6e2dbd8446a class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3419
diff changeset
   628
                    with:cFlags
c6e2dbd8446a class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3419
diff changeset
   629
                    with:ccDefine
c6e2dbd8446a class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3419
diff changeset
   630
                    with:(self possiblyQuotedPath:oFileName)
c6e2dbd8446a class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3419
diff changeset
   631
                    with:(self possiblyQuotedPath:cFileName).
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   632
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   633
    Verbose == true ifTrue:[
3957
28c8f6bdb08d #BUGFIX by sr
sr
parents: 3793
diff changeset
   634
        Transcript show:'executing: '; showCR:command.
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   635
    ].
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   636
    originator activityNotification:'compiling (' , ccPath , ')'.
3423
c6e2dbd8446a class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3419
diff changeset
   637
c6e2dbd8446a class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3419
diff changeset
   638
    env := OperatingSystem isUNIXlike
c6e2dbd8446a class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3419
diff changeset
   639
                    ifTrue:[OperatingSystem getEnvironment copy]
c6e2dbd8446a class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3419
diff changeset
   640
                    ifFalse:[env := Dictionary new].
c6e2dbd8446a class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3419
diff changeset
   641
    env at:'LANG' put:'C'.
c6e2dbd8446a class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3419
diff changeset
   642
    env at:'LC_MESSAGES' put:'C'.
c6e2dbd8446a class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3419
diff changeset
   643
4018
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   644
    errorOutputFile := Filename tempDirectory / 'stcErrorOutput'. 
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   645
    errorOutputFile writingFileDo:[:errorStream |
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   646
        ok := OperatingSystem 
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   647
                    executeCommand:command 
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   648
                    inputFrom:nil
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   649
                    outputTo:errorStream
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   650
                    errorTo:errorStream
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   651
                    environment:env
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   652
                    showWindow:false
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   653
                    onError:
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   654
                        [:stat| 
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   655
                            executionStatus := stat.
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   656
                            false
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   657
                        ].
2195
2996fe27c2f8 Add primitive functions when compiling
Stefan Vogel <sv@exept.de>
parents: 2185
diff changeset
   658
    ].
4018
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   659
    
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   660
    oFileName asFilename exists ifTrue:[
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   661
        ok ifFalse:[
4018
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   662
            'Compiler [info]: system says compile failed - but o-file is there ...' infoPrintCR.
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   663
            ok := true
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   664
        ]
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   665
    ] ifFalse:[
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   666
        ok ifTrue:[
4018
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   667
            'Compiler [info]: system says compile ok - but no o-file is there ...' infoPrintCR.
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   668
        ].
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   669
        ok := false
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   670
    ].
4018
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   671
    [
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   672
        ok ifFalse:[
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   673
            aBlock value:errorOutputFile
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   674
        ].
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   675
    ] ensure:[
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   676
        errorOutputFile remove.
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   677
    ].
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   678
    ^ ok
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   679
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   680
    "Created: / 07-11-2006 / 12:14:51 / cg"
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   681
!
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   682
4018
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   683
compileToS_onError:aBlock
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   684
    "compile C to assembler, using cc.
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   685
     If any error happens, call aBlock passing it the fileName containing diagnostics"
2491
2d549088a8ea added: #compileToS
Michael Beyl <mb@exept.de>
parents: 2467
diff changeset
   686
4018
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   687
    |command errorOutputFile ok|
2491
2d549088a8ea added: #compileToS
Michael Beyl <mb@exept.de>
parents: 2467
diff changeset
   688
2658
92f1a346dbeb added: #possiblyQuotedPath:
Claus Gittinger <cg@exept.de>
parents: 2656
diff changeset
   689
    command := (self possiblyQuotedPath:ccPath) , ' ' , cFlags , ' -D__INCREMENTAL_COMPILE__ -S ' , (self possiblyQuotedPath:cFileName).
2491
2d549088a8ea added: #compileToS
Michael Beyl <mb@exept.de>
parents: 2467
diff changeset
   690
2d549088a8ea added: #compileToS
Michael Beyl <mb@exept.de>
parents: 2467
diff changeset
   691
    Verbose == true ifTrue:[
3957
28c8f6bdb08d #BUGFIX by sr
sr
parents: 3793
diff changeset
   692
        Transcript show:'executing: '; showCR:command.
2491
2d549088a8ea added: #compileToS
Michael Beyl <mb@exept.de>
parents: 2467
diff changeset
   693
    ].
2d549088a8ea added: #compileToS
Michael Beyl <mb@exept.de>
parents: 2467
diff changeset
   694
    originator activityNotification:'compiling (' , ccPath , ')'.
2d549088a8ea added: #compileToS
Michael Beyl <mb@exept.de>
parents: 2467
diff changeset
   695
4018
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   696
    errorOutputFile := Filename tempDirectory / 'stcErrorOutput'. 
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   697
    errorOutputFile writingFileDo:[:errorStream |
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   698
        ok := OperatingSystem 
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   699
                    executeCommand:command 
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   700
                    inputFrom:nil
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   701
                    outputTo:errorStream
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   702
                    errorTo:errorStream
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   703
                    showWindow:false
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   704
                    onError:[:stat| 
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   705
                                executionStatus := stat.
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   706
                                false
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   707
                    ].
2491
2d549088a8ea added: #compileToS
Michael Beyl <mb@exept.de>
parents: 2467
diff changeset
   708
    ].
4018
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   709
    [
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   710
        ok ifFalse:[
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   711
            aBlock value:errorOutputFile
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   712
        ].
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   713
    ] ensure:[
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   714
        errorOutputFile remove.
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   715
    ].
2491
2d549088a8ea added: #compileToS
Michael Beyl <mb@exept.de>
parents: 2467
diff changeset
   716
    ^ ok
2d549088a8ea added: #compileToS
Michael Beyl <mb@exept.de>
parents: 2467
diff changeset
   717
!
2d549088a8ea added: #compileToS
Michael Beyl <mb@exept.de>
parents: 2467
diff changeset
   718
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   719
ensureExternalToolsArePresent
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   720
    (stcPath := self incrementalStcPath) isNil ifTrue:[
3411
9e5e218273ee class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3361
diff changeset
   721
        self parseError:'no stc compiler available - cannot create machine code' position:1.
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   722
    ].
2649
0e257259566f changed:
Stefan Vogel <sv@exept.de>
parents: 2647
diff changeset
   723
0e257259566f changed:
Stefan Vogel <sv@exept.de>
parents: 2647
diff changeset
   724
    "make it absolute, so that we are immune to directory changes"
0e257259566f changed:
Stefan Vogel <sv@exept.de>
parents: 2647
diff changeset
   725
    stcPath := stcPath asFilename pathName.
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   726
    (ccPath := parserFlags ccPath) isNil ifTrue:[
3411
9e5e218273ee class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3361
diff changeset
   727
        self parseError:'no cc compiler available - cannot create machine code' position:1.
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   728
    ].
2649
0e257259566f changed:
Stefan Vogel <sv@exept.de>
parents: 2647
diff changeset
   729
    "make it absolute, so that we are immune to directory changes"
0e257259566f changed:
Stefan Vogel <sv@exept.de>
parents: 2647
diff changeset
   730
    ccPath := ccPath asFilename pathName.
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   731
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   732
    (ObjectFileLoader notNil and:[ObjectFileLoader canLoadObjectFiles]) ifFalse:[
3411
9e5e218273ee class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3361
diff changeset
   733
        self parseError:'no dynamic loader configured - cannot create machine code' position:1.
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   734
    ].
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   735
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   736
    "Created: / 07-11-2006 / 12:31:48 / cg"
1670
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   737
!
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   738
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   739
ensureModuleDirectoryExists
3664
646ce5a13d24 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3659
diff changeset
   740
    |mP t msg|
1670
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   741
3411
9e5e218273ee class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3361
diff changeset
   742
    mP := parserFlags stcModulePath.
9e5e218273ee class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3361
diff changeset
   743
    mP isEmptyOrNil ifTrue:[
9e5e218273ee class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3361
diff changeset
   744
        self parseError:'No temporary module directory, check your settings!!' position:1.
9e5e218273ee class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3361
diff changeset
   745
    ].
9e5e218273ee class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3361
diff changeset
   746
    mP := mP asFilename.
9e5e218273ee class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3361
diff changeset
   747
    mP exists ifFalse:[
1670
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   748
        mP makeDirectory
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   749
    ].
3240
60e8fa24bbc6 Use #isWritableDirectory
Stefan Vogel <sv@exept.de>
parents: 3173
diff changeset
   750
    (mP isWritableDirectory and:[mP isReadable]) ifFalse:[
3664
646ce5a13d24 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3659
diff changeset
   751
        (mP exists and:[mP isDirectory]) ifTrue:[
646ce5a13d24 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3659
diff changeset
   752
            msg := 'No write permission in temporary module directory: '.
646ce5a13d24 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3659
diff changeset
   753
        ] ifFalse:[    
646ce5a13d24 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3659
diff changeset
   754
            msg := 'No access to temporary module directory: '.
646ce5a13d24 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3659
diff changeset
   755
        ].
646ce5a13d24 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3659
diff changeset
   756
        self parseError:(msg , mP pathName) position:1.
1670
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   757
    ].
3664
646ce5a13d24 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3659
diff changeset
   758
    
1670
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   759
    "/ create a small README there ...
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   760
    
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   761
    (t := mP construct:'README') exists ifFalse:[
3411
9e5e218273ee class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3361
diff changeset
   762
        t contents:'This temporary ST/X directory contains machine code for
1670
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   763
accepted methods with embedded C-code 
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   764
(i.e. dynamic compiled code for inline-C methods).
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   765
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   766
Files here are not automatically removed, since ST/X 
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   767
cannot determine if any (other) snapshot image still 
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   768
requires a file here.
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   769
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   770
Please be careful when removing files here - a snapshot
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   771
image which was saved with accepted embedded C-code
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   772
may not be able to restart correctly if you remove a
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   773
required file.
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   774
Also, when you export a snapshot image for execution
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   775
on another machine, make certain that the required
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   776
module-files are also present there.
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   777
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   778
You should periodically clean dead entries here.
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   779
i.e. remove files, when you are certain that none
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   780
of your snapshot images refers to any module here.
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   781
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   782
See the launchers File-Modules dialog for a list of
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   783
modules which are still required by your running image.
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   784
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   785
With kind regards - your ST/X.
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   786
'.
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   787
    ].
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   788
!
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   789
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   790
ensureSuperClassesAreLoadedOf:aClass
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   791
    |supers|
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   792
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   793
    supers := aClass allSuperclasses.
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   794
    supers reverseDo:[:cls|
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   795
        cls isLoaded ifFalse:[
3411
9e5e218273ee class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3361
diff changeset
   796
            self parseError:('Cannot stc-compile (superclass %1 is unloaded)' bindWith:cls) position:1.
1670
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   797
        ]
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   798
    ].
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   799
!
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   800
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   801
fileOutAllDefinitionsOf:aClass to:aStream rememberIn:definedClasses
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   802
    |defineAction|
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   803
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   804
    defineAction := 
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   805
        [:cls|
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   806
            (definedClasses includes:cls) ifFalse:[
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   807
                cls 
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   808
                    basicFileOutDefinitionOn:aStream 
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   809
                    withNameSpace:false withPackage:false
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   810
                    syntaxHilighting:false.
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   811
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   812
                aStream nextPut:(aStream class chunkSeparator); cr.
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   813
                definedClasses add:cls.
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   814
            ].
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   815
        ].
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   816
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   817
    aClass allSuperclasses reverseDo:defineAction.
08e3e0723a60 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
   818
    defineAction value:aClass.
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   819
!
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   820
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   821
generateSTSource:aString 
3359
f18089e05968 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3357
diff changeset
   822
    |stream definedClasses sep className modulesDir ns nsName|
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   823
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   824
    "/ generate a unique name, consisting of my processID and a sequence number
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   825
    "/ the processId is added to allow filein of modules from different
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   826
    "/ lifes
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   827
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   828
    SequenceNumber := (SequenceNumber ? 0) + 1.
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   829
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   830
    initName := 'm_' , OperatingSystem getProcessId printString, '_' , SequenceNumber printString.
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   831
2646
de9d7a6e6315 changed: #generateSTSource:
Claus Gittinger <cg@exept.de>
parents: 2644
diff changeset
   832
"/    Smalltalk isSmalltalkDevelopmentSystem ifTrue:[
de9d7a6e6315 changed: #generateSTSource:
Claus Gittinger <cg@exept.de>
parents: 2644
diff changeset
   833
"/        modulesParentDir := Filename currentDirectory. 
de9d7a6e6315 changed: #generateSTSource:
Claus Gittinger <cg@exept.de>
parents: 2644
diff changeset
   834
"/    ] ifFalse:[
de9d7a6e6315 changed: #generateSTSource:
Claus Gittinger <cg@exept.de>
parents: 2644
diff changeset
   835
"/        modulesParentDir := Filename tempDirectory. 
de9d7a6e6315 changed: #generateSTSource:
Claus Gittinger <cg@exept.de>
parents: 2644
diff changeset
   836
"/    ].
de9d7a6e6315 changed: #generateSTSource:
Claus Gittinger <cg@exept.de>
parents: 2644
diff changeset
   837
"/    modulesDir := modulesParentDir construct:'modules'. 
de9d7a6e6315 changed: #generateSTSource:
Claus Gittinger <cg@exept.de>
parents: 2644
diff changeset
   838
    modulesDir := ParserFlags stcModulePath.
2647
a47876ae33fd changed: #generateSTSource:
Stefan Vogel <sv@exept.de>
parents: 2646
diff changeset
   839
    stFileName := (modulesDir asFilename construct:(initName , '.st')) name. 
2646
de9d7a6e6315 changed: #generateSTSource:
Claus Gittinger <cg@exept.de>
parents: 2644
diff changeset
   840
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   841
    [
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   842
        stream := stFileName asFilename writeStream.
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   843
    ] on:FileStream openErrorSignal do:[:ex|
3411
9e5e218273ee class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3361
diff changeset
   844
        self parseError:'cannot create temporary sourcefile for compilation' position:1.
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   845
        ^ #CannotLoad
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   846
    ].
3419
24e01ffb296f class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3411
diff changeset
   847
    stream := EncodedStream stream:stream encoder:(CharacterEncoder encoderForUTF8).
24e01ffb296f class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3411
diff changeset
   848
    stream nextPutLine:'"{ Encoding: utf8 }" !!'.
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   849
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   850
    definedClasses := IdentitySet new.
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   851
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   852
    sep := stream class chunkSeparator.
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   853
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   854
    Class fileOutNameSpaceQuerySignal answer:true
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   855
    do:[
2467
a7ed431694a2 changed: #generateSTSource:
Claus Gittinger <cg@exept.de>
parents: 2461
diff changeset
   856
        theNonMetaclassToCompileFor realSharedPoolNames do:[:eachPoolname |
2067
6204fefb44a3 must also file-out the definition of sharedPools
Claus Gittinger <cg@exept.de>
parents: 2026
diff changeset
   857
            |pool|
6204fefb44a3 must also file-out the definition of sharedPools
Claus Gittinger <cg@exept.de>
parents: 2026
diff changeset
   858
6204fefb44a3 must also file-out the definition of sharedPools
Claus Gittinger <cg@exept.de>
parents: 2026
diff changeset
   859
            pool := Smalltalk at:eachPoolname.
6204fefb44a3 must also file-out the definition of sharedPools
Claus Gittinger <cg@exept.de>
parents: 2026
diff changeset
   860
            self 
6204fefb44a3 must also file-out the definition of sharedPools
Claus Gittinger <cg@exept.de>
parents: 2026
diff changeset
   861
                fileOutAllDefinitionsOf:pool 
6204fefb44a3 must also file-out the definition of sharedPools
Claus Gittinger <cg@exept.de>
parents: 2026
diff changeset
   862
                to:stream 
6204fefb44a3 must also file-out the definition of sharedPools
Claus Gittinger <cg@exept.de>
parents: 2026
diff changeset
   863
                rememberIn:definedClasses.
6204fefb44a3 must also file-out the definition of sharedPools
Claus Gittinger <cg@exept.de>
parents: 2026
diff changeset
   864
        ].
6204fefb44a3 must also file-out the definition of sharedPools
Claus Gittinger <cg@exept.de>
parents: 2026
diff changeset
   865
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   866
        self 
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   867
            fileOutAllDefinitionsOf:theNonMetaclassToCompileFor 
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   868
            to:stream 
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   869
            rememberIn:definedClasses.
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   870
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   871
        theNonMetaclassToCompileFor privateClassesSorted do:[:aPrivateClass |
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   872
            self 
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   873
                fileOutAllDefinitionsOf:aPrivateClass 
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   874
                to:stream 
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   875
                rememberIn:definedClasses.
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   876
        ].
2195
2996fe27c2f8 Add primitive functions when compiling
Stefan Vogel <sv@exept.de>
parents: 2185
diff changeset
   877
"/        theNonMetaclassToCompileFor fileOutPrimitiveDefinitionsOn:stream.
2026
652850012b15 remove dead code
Stefan Vogel <sv@exept.de>
parents: 1986
diff changeset
   878
"/ If a method uses a static primitive function... - but this doesn't work
2195
2996fe27c2f8 Add primitive functions when compiling
Stefan Vogel <sv@exept.de>
parents: 2185
diff changeset
   879
"/ Yes it does work, but primitive functions have to be strictly static!!
2996fe27c2f8 Add primitive functions when compiling
Stefan Vogel <sv@exept.de>
parents: 2185
diff changeset
   880
        theNonMetaclassToCompileFor fileOutPrimitiveSpecsOn:stream.
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   881
    ].
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   882
2026
652850012b15 remove dead code
Stefan Vogel <sv@exept.de>
parents: 1986
diff changeset
   883
"/    stream cr.
652850012b15 remove dead code
Stefan Vogel <sv@exept.de>
parents: 1986
diff changeset
   884
"/    stream nextPutLine:'"{ Package: ''' , package , ''' }"'.
652850012b15 remove dead code
Stefan Vogel <sv@exept.de>
parents: 1986
diff changeset
   885
"/    stream cr.
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   886
3357
7dabc8614714 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3348
diff changeset
   887
    className := theNonMetaclassToCompileFor name.
7dabc8614714 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3348
diff changeset
   888
    ns := theNonMetaclassToCompileFor topNameSpace.
3359
f18089e05968 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3357
diff changeset
   889
    (ns notNil and:[ns ~= Smalltalk and:[nsName := ns name. className startsWith:(nsName,'::')]]) ifTrue:[
f18089e05968 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3357
diff changeset
   890
        className := className copyFrom:nsName size+2+1.
f18089e05968 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3357
diff changeset
   891
        "/ split to avoid being regognized as a directive
f18089e05968 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3357
diff changeset
   892
        stream nextPutLine:('"','{ NameSpace: ',nsName,' }"').
3357
7dabc8614714 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3348
diff changeset
   893
    ].
7dabc8614714 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3348
diff changeset
   894
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   895
    stream nextPut:sep.
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   896
    stream nextPutAll:className.
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   897
    classToCompileFor isMeta ifTrue:[
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   898
        stream nextPutAll:' class'.
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   899
    ].
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   900
    stream nextPutAll:' methodsFor:'''; nextPutAll:methodCategory; nextPutAll:''''.
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   901
    stream nextPut:sep; cr.
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   902
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   903
    stream nextPutLine:'"{ Line: 0 }"'; 
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   904
           nextChunkPut:aString;
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   905
           space; nextPut:sep.
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   906
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   907
    stream close.
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   908
2646
de9d7a6e6315 changed: #generateSTSource:
Claus Gittinger <cg@exept.de>
parents: 2644
diff changeset
   909
    "Modified: / 08-08-2011 / 23:23:10 / cg"
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   910
!
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   911
2658
92f1a346dbeb added: #possiblyQuotedPath:
Claus Gittinger <cg@exept.de>
parents: 2656
diff changeset
   912
possiblyQuotedPath:aPath
3173
5b547821eb61 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3170
diff changeset
   913
    (aPath includes:Character space) ifTrue:[
3793
21a45c57e211 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3720
diff changeset
   914
        (aPath startsWith:$") ifFalse:[
2658
92f1a346dbeb added: #possiblyQuotedPath:
Claus Gittinger <cg@exept.de>
parents: 2656
diff changeset
   915
            ^ '"',aPath,'"'
92f1a346dbeb added: #possiblyQuotedPath:
Claus Gittinger <cg@exept.de>
parents: 2656
diff changeset
   916
        ]
92f1a346dbeb added: #possiblyQuotedPath:
Claus Gittinger <cg@exept.de>
parents: 2656
diff changeset
   917
    ].
92f1a346dbeb added: #possiblyQuotedPath:
Claus Gittinger <cg@exept.de>
parents: 2656
diff changeset
   918
    ^ aPath
92f1a346dbeb added: #possiblyQuotedPath:
Claus Gittinger <cg@exept.de>
parents: 2656
diff changeset
   919
!
92f1a346dbeb added: #possiblyQuotedPath:
Claus Gittinger <cg@exept.de>
parents: 2656
diff changeset
   920
3005
dc025b2bb54e class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
   921
reportCompilationErrorFor:aCommand
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   922
    |eMsg errorMessages lNr|
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   923
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   924
    (executionStatus notNil and:[executionStatus couldNotExecute]) ifTrue:[
3411
9e5e218273ee class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3361
diff changeset
   925
        eMsg := 'oops, no %1 - cannot create machine code' bindWith:aCommand.
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   926
    ] ifFalse:[
3437
98ddce5703d1 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
   927
        errorMessages := 'errorOutput' asFilename contents collect:[:l | OperatingSystem decodePathOrCommandOutput: l ].
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   928
        OperatingSystem removeFile:'errorOutput'.
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   929
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   930
        errorMessages notNil ifTrue:[
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   931
            errorMessages := errorMessages reject:[:line | line includesString:'Warning:'].
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   932
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   933
            errorMessages size > 20 ifTrue:[
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   934
                errorMessages := errorMessages select:[:line | line asLowercase startsWith:'error'].
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   935
                errorMessages size > 20 ifTrue:[
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   936
                    errorMessages := (errorMessages copyTo:20) copyWith:'... more messages skipped'
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   937
                ].
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   938
            ].
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   939
"/                    errorMessages := errorMessages collect:[:line |
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   940
"/                        (line startsWith:(stFileName , ':')) ifTrue:[
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   941
"/                            'Line: ' , (line copyFrom:(stFileName size + 2))
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   942
"/                        ] ifFalse:[
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   943
"/                            line
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   944
"/                        ]
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   945
"/                      ].
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   946
        ].
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   947
        errorMessages isNil ifTrue:[
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   948
            errorMessages := #('')
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   949
        ].
3005
dc025b2bb54e class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
   950
        errorMessages := (Array with:'Failed to execute: "', aCommand,'"') , errorMessages.
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   951
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   952
        "/ try to extract a line number"
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   953
        (errorMessages contains:[:line | line includesString:'Borland']) ifTrue:[
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   954
            |i i2 s|
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   955
            i := errorMessages findFirst:[:l | l startsWith:(cFileName,':')].
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   956
            i ~~ 0 ifTrue:[
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   957
                ((errorMessages at:i+1) startsWith:'Error') ifTrue:[
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   958
                    i2 := (errorMessages at:i+1) indexOfSubCollection:(stFileName).
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   959
                    i2 ~~ 0 ifTrue:[
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   960
                        s := (errorMessages at:i+1) copyFrom:(i2+stFileName size+1).
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   961
                        s := s readStream.
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   962
                        lNr := Integer readFrom:s.
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   963
                        s skipSeparators.
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   964
                    ].    
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   965
                ]
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   966
            ].
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   967
        ].
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   968
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   969
        errorMessages isEmpty ifTrue:[
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   970
            eMsg := 'Error during compilation:\\Unspecified error (no output)' withCRs
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   971
        ] ifFalse:[
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   972
            eMsg := 'Error during compilation:\\' withCRs ,
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   973
                    (errorMessages asStringCollection asString).
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   974
        ].
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   975
    ].
2461
89458faaeeb3 changed: #reportCompilationError
Stefan Vogel <sv@exept.de>
parents: 2350
diff changeset
   976
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   977
    originator activityNotification:''.
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   978
3069
230e5da2ff5d class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3042
diff changeset
   979
    ParseError new
2461
89458faaeeb3 changed: #reportCompilationError
Stefan Vogel <sv@exept.de>
parents: 2350
diff changeset
   980
        lineNumber:lNr;
89458faaeeb3 changed: #reportCompilationError
Stefan Vogel <sv@exept.de>
parents: 2350
diff changeset
   981
        errorMessage:eMsg;
89458faaeeb3 changed: #reportCompilationError
Stefan Vogel <sv@exept.de>
parents: 2350
diff changeset
   982
        raise.
89458faaeeb3 changed: #reportCompilationError
Stefan Vogel <sv@exept.de>
parents: 2350
diff changeset
   983
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   984
    "Created: / 07-11-2006 / 12:29:04 / cg"
3348
b59a15a24ab3 class: STCCompilerInterface
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3240
diff changeset
   985
    "Modified: / 21-12-2013 / 00:08:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   986
!
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
   987
4018
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   988
reportCompilationErrorFor:aCommand fromFile:anErrorFilename
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   989
    |eMsg errorMessages lNr|
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   990
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   991
    (executionStatus notNil and:[executionStatus couldNotExecute]) ifTrue:[
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   992
        eMsg := 'oops, no %1 - cannot create machine code' bindWith:aCommand.
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   993
    ] ifFalse:[
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   994
        errorMessages := anErrorFilename contents 
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   995
                            collect:[:l | OperatingSystem decodePathOrCommandOutput: l ].
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   996
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   997
        errorMessages notNil ifTrue:[
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   998
            errorMessages := errorMessages reject:[:line | line includesString:'Warning:'].
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
   999
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1000
            errorMessages size > 20 ifTrue:[
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1001
                errorMessages := errorMessages select:[:line | line asLowercase startsWith:'error'].
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1002
                errorMessages size > 20 ifTrue:[
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1003
                    errorMessages := (errorMessages copyTo:20) copyWith:'... more messages skipped'
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1004
                ].
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1005
            ].
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1006
"/                    errorMessages := errorMessages collect:[:line |
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1007
"/                        (line startsWith:(stFileName , ':')) ifTrue:[
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1008
"/                            'Line: ' , (line copyFrom:(stFileName size + 2))
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1009
"/                        ] ifFalse:[
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1010
"/                            line
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1011
"/                        ]
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1012
"/                      ].
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1013
        ].
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1014
        errorMessages isNil ifTrue:[
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1015
            errorMessages := #('')
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1016
        ].
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1017
        errorMessages := (Array with:'Failed to execute: "', aCommand,'"') , errorMessages.
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1018
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1019
        "/ try to extract a line number"
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1020
        (errorMessages contains:[:line | line includesString:'Borland']) ifTrue:[
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1021
            |i i2 s|
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1022
            i := errorMessages findFirst:[:l | l startsWith:(cFileName,':')].
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1023
            i ~~ 0 ifTrue:[
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1024
                ((errorMessages at:i+1) startsWith:'Error') ifTrue:[
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1025
                    i2 := (errorMessages at:i+1) indexOfSubCollection:(stFileName).
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1026
                    i2 ~~ 0 ifTrue:[
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1027
                        s := (errorMessages at:i+1) copyFrom:(i2+stFileName size+1).
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1028
                        s := s readStream.
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1029
                        lNr := Integer readFrom:s.
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1030
                        s skipSeparators.
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1031
                    ].    
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1032
                ]
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1033
            ].
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1034
        ].
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1035
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1036
        errorMessages isEmpty ifTrue:[
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1037
            eMsg := 'Error during compilation:\\Unspecified error (no output)' withCRs
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1038
        ] ifFalse:[
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1039
            eMsg := 'Error during compilation:\\' withCRs ,
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1040
                    (errorMessages asStringCollection asString).
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1041
        ].
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1042
    ].
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1043
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1044
    originator activityNotification:''.
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1045
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1046
    ParseError new
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1047
        lineNumber:lNr;
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1048
        errorMessage:eMsg;
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1049
        raise.
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1050
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1051
    "Created: / 07-11-2006 / 12:29:04 / cg"
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1052
    "Modified: / 21-12-2013 / 00:08:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1053
!
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1054
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  1055
setupCompilationCommandArguments
2335
70a690b780f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1056
    |stFn mapFileName libFileName def libDir incDir incDirArg defs incl opts|
70a690b780f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1057
70a690b780f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1058
    parserFlags isNil ifTrue:[ parserFlags := ParserFlags new].
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  1059
1941
941810becd2c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
  1060
    stFn := stFileName asFilename.
941810becd2c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
  1061
    oFileName := stFn nameWithoutSuffix , (ObjectFileLoader objectFileExtension).
941810becd2c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
  1062
    cFileName := (stFn withSuffix:'c') name. 
3170
fccd602cb081 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3159
diff changeset
  1063
"/    ParserFlags useBorlandC ifTrue:[
fccd602cb081 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3159
diff changeset
  1064
"/        cFileName := (stFn withSuffix:'sc') name. 
fccd602cb081 class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 3159
diff changeset
  1065
"/    ].
1941
941810becd2c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
  1066
    mapFileName := (stFn withSuffix:'map') name. 
941810becd2c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
  1067
    libFileName := (stFn withSuffix:'lib') name. 
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  1068
    oFileName asFilename delete.
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  1069
    cFileName asFilename delete.
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  1070
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  1071
    "/ stcFlags := '-commonSymbols +sharedLibCode +newIncremental -E:errorOutput -N' , initName .
4018
973908080769 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4004
diff changeset
  1072
    stcFlags := '+newIncremental'.
3659
7570b2de4934 class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3437
diff changeset
  1073
    initName notEmptyOrNil ifTrue:[
2335
70a690b780f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1074
        stcFlags := stcFlags,' -N' , initName .
70a690b780f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1075
    ].
4023
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
  1076
    cFlags := STCCompilerInterface getOSDefine.
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  1077
    cFlags isNil ifTrue:[
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  1078
        cFlags := ''
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  1079
    ].
4023
03113f2bc542 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4021
diff changeset
  1080
    (def := STCCompilerInterface getCPUDefine) notEmptyOrNil ifTrue:[
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  1081
        cFlags := cFlags , ' ' , def
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  1082
    ].
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  1083
3659
7570b2de4934 class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3437
diff changeset
  1084
    (defs := parserFlags stcCompilationDefines) notEmptyOrNil ifTrue:[
2335
70a690b780f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1085
        cFlags := cFlags , ' ' , defs
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  1086
    ].
3659
7570b2de4934 class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3437
diff changeset
  1087
    (incl := parserFlags stcCompilationIncludes) notEmptyOrNil ifTrue:[
2335
70a690b780f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1088
        stcFlags := incl , ' ' , stcFlags.
70a690b780f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1089
        cFlags := cFlags , ' ' , incl.
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  1090
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  1091
        "/ if STX_LIBDIR is defined, and not in passed argument,
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  1092
        "/ add it here.
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  1093
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  1094
        libDir := OperatingSystem getEnvironment:'STX_LIBDIR'.
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  1095
        (libDir notNil and:[libDir asFilename exists]) ifTrue:[
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  1096
            incDir := libDir asFilename construct:'include'.
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  1097
            incDir exists ifTrue:[
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  1098
                incDirArg := '-I' , incDir pathName.
2335
70a690b780f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1099
                (incl asCollectionOfWords includes:incDirArg) ifFalse:[
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  1100
                    stcFlags := stcFlags , ' ' , incDirArg.
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  1101
                    cFlags := cFlags , ' ' , incDirArg.
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  1102
                ]
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  1103
            ]
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  1104
        ].
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  1105
    ].
3659
7570b2de4934 class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3437
diff changeset
  1106
    (opts := parserFlags stcCompilationOptions) notEmptyOrNil ifTrue:[
2335
70a690b780f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1107
        stcFlags := opts , ' ' , stcFlags
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  1108
    ].
3659
7570b2de4934 class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3437
diff changeset
  1109
    (opts := parserFlags ccCompilationOptions) notEmptyOrNil ifTrue:[
2335
70a690b780f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1110
        cFlags := cFlags , ' ' , opts
1939
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  1111
    ].
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  1112
babab41fc8e8 code cleanup
Claus Gittinger <cg@exept.de>
parents: 1899
diff changeset
  1113
    "Created: / 07-11-2006 / 12:24:47 / cg"
1941
941810becd2c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1939
diff changeset
  1114
    "Modified: / 07-11-2006 / 13:58:54 / cg"
1669
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1115
! !
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1116
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1117
!STCCompilerInterface class methodsFor:'documentation'!
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1118
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1119
version
3659
7570b2de4934 class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3437
diff changeset
  1120
    ^ '$Header$'
2335
70a690b780f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1121
!
70a690b780f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1122
70a690b780f7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2195
diff changeset
  1123
version_CVS
3659
7570b2de4934 class: STCCompilerInterface
Stefan Vogel <sv@exept.de>
parents: 3437
diff changeset
  1124
    ^ '$Header$'
1669
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1125
! !
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1126
3005
dc025b2bb54e class: STCCompilerInterface
Claus Gittinger <cg@exept.de>
parents: 2704
diff changeset
  1127
1669
fc13f4636125 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1128
STCCompilerInterface initialize!