class definition
authorClaus Gittinger <cg@exept.de>
Tue, 31 Jan 2012 12:12:30 +0100
changeset 2803 de9ca0b32bd4
parent 2802 69bc7b3a0c8e
child 2804 f76727ee9e2d
class definition added: #defineFor_borlandC #useCompiler: #usedCompiler changed: #initialize #useBorlandC #useGnuC #useVisualC
ParserFlags.st
--- a/ParserFlags.st	Tue Jan 31 11:53:39 2012 +0100
+++ b/ParserFlags.st	Tue Jan 31 12:12:30 2012 +0100
@@ -87,7 +87,8 @@
 		AllowUnicodeStrings AllowUnicodeCharacters AllowCharacterEscapes
 		AllowStringEscapes AllowAssignmentToBlockArgument
 		AllowAssignmentToMethodArgument AllowAssignmentToPoolVariable
-		LibDirectory VCTop SDKTop BCCTop'
+		LibDirectory VCTop SDKTop BCCTop ForcedCompiler DefineForBorlandC
+		DefineForVisualC DefineForMSVER DefineForMSC DefineForGNUC'
 	poolDictionaries:''
 	category:'System-Compiler'
 !
@@ -414,32 +415,48 @@
 !
 
 useBorlandC
-    "no longer needed - now we can link visual-C dll 
-     with borland-generated VM and vice versa"
-
-"/    ^ true.
-    ^ OperatingSystem getCCDefine ='__BORLANDC__'
+    "true if borland compiler should be used"
+
+    ^ self usedCompiler = DefineForBorlandC
 
     "Created: / 15-03-2007 / 13:33:32 / cg"
 !
 
+useCompiler: aCompilerDefine
+    "enforce a particular compiler to be used (independent from
+     what the system was compiled with)"
+
+    ForcedCompiler := aCompilerDefine.
+
+    "Created: / 31-01-2012 / 12:01:08 / cg"
+!
+
 useGnuC
-    ^ OperatingSystem getCCDefine = '__GNUC__'
+    "true if gnu-c compiler should be used"
+
+    ^ self usedCompiler = DefineForGNUC
 
     "Created: / 15-03-2007 / 13:34:49 / cg"
 !
 
 useVisualC
-    "no longer needed - now we can link visual-C dll 
-     with borland-generated VM and vice versa"
-
-"/    ^ true.
-    ^ OperatingSystem getCCDefine = '__VISUALC__'
-    or:[ OperatingSystem getCCDefine = '__MSC__' ]
+    "true if visual-c compiler should be used"
+
+    |compiler|
+
+    ^ (compiler := self usedCompiler) = DefineForVisualC
+    or:[ compiler = DefineForMSC ]
 
     "Created: / 08-08-2011 / 22:50:25 / cg"
 !
 
+usedCompiler
+    ForcedCompiler notNil ifTrue:[^ ForcedCompiler].
+    ^ OperatingSystem getCCDefine
+
+    "Created: / 31-01-2012 / 12:05:30 / cg"
+!
+
 vcTop:aPath
     "windows only: define the visual-C top directory.
      must contain bin\cl.exe and include.
@@ -1341,6 +1358,11 @@
     STCKeepSTIntermediate := false.
     STCCompilation := #default.
 
+    DefineForBorlandC := '__BORLANDC__'.
+    DefineForVisualC := '__VISUALC__'.
+    DefineForMSC := '__MSC__'.
+    DefineForGNUC := '__GNUC__'.
+
     self initializeSTCFlagsForTopDirectory:'../..'.
 
     "
@@ -1348,7 +1370,7 @@
     "
 
     "Modified: / 09-08-2006 / 18:47:18 / fm"
-    "Modified: / 20-01-2012 / 15:32:17 / cg"
+    "Modified: / 31-01-2012 / 12:06:32 / cg"
 !
 
 initializeSTCFlagsForTopDirectory:topDirArg
@@ -2319,11 +2341,11 @@
 !ParserFlags class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/ParserFlags.st,v 1.82 2012-01-31 10:53:26 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/ParserFlags.st,v 1.83 2012-01-31 11:12:30 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libcomp/ParserFlags.st,v 1.82 2012-01-31 10:53:26 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/ParserFlags.st,v 1.83 2012-01-31 11:12:30 cg Exp $'
 ! !
 
 ParserFlags initialize!