ParserFlags.st
changeset 3519 03679c227ade
parent 3506 e8b4502d405f
child 3546 a242fdde05dd
--- a/ParserFlags.st	Tue Oct 28 13:50:59 2014 +0100
+++ b/ParserFlags.st	Thu Nov 13 12:48:44 2014 +0100
@@ -91,10 +91,10 @@
 		AllowStringEscapes AllowAssignmentToBlockArgument
 		AllowAssignmentToMethodArgument AllowAssignmentToPoolVariable
 		LineNumberInfo LibDirectory VCTop SDKTop BCCTop ForcedCompiler
-		DefineForBorlandC DefineForVisualC DefineForMSVER DefineForMSC
+		DefineForBorlandC DefineForVisualC DefineForMSC
 		DefineForGNUC PerMethodFlags AllowSTXDelimiterComments
 		DefineForMINGW32 DefineForMINGW64 DefineForMINGW
-		ByteArraysAreImmutable WarnAssignmentToBlockArgument
+		WarnAssignmentToBlockArgument
 		WarnAssignmentToPoolVariable WarnAssignmentToMethodArgument'
 	poolDictionaries:''
 	category:'System-Compiler'
@@ -964,9 +964,9 @@
 allowSTXDelimiterComments
     "token delimited comments;
      these are multiline comments of the form:
-        ''>>TOKEN
-           ... anything, including double quotes
-        TOKEN>>''
+	''>>TOKEN
+	   ... anything, including double quotes
+	TOKEN>>''
      (the '' being a double quote in the above)
      Such comments are especially useful to comment pieces of sample code, which may
      contain another comment in it, but you don't want to make them all EOL comments
@@ -980,9 +980,9 @@
 allowSTXDelimiterComments:aBoolean
     "enable token delimited comments;
      these are multiline comments of the form:
-        ''>>TOKEN
-           ... anything, including double quotes
-        TOKEN>>''
+	''>>TOKEN
+	   ... anything, including double quotes
+	TOKEN>>''
      (the '' being a double quote in the above)
      Such comments are especially useful to comment pieces of sample code, which may
      contain another comment in it, but you don't want to make them all EOL comments
@@ -1573,19 +1573,19 @@
     DefineForMINGW64 := '__MINGW64__'.
 
     (executablePath := OperatingSystem pathOfSTXExecutable) notNil ifTrue:[
-        executablePath := executablePath asFilename directory.
-        (((executablePath / 'include') exists and:[(executablePath / 'stc') exists])
-          or:[
-            executablePath := executablePath directory.
-            ((executablePath / 'include') exists and:[(executablePath / 'stc') exists])
-              or:[
-                executablePath := executablePath directory.
-                ((executablePath / 'include') exists and:[(executablePath / 'stc') exists])
-              ]
-           ]
-        ) ifTrue:[
-            self initializeSTCFlagsForTopDirectory: executablePath.
-        ]
+	executablePath := executablePath asFilename directory.
+	(((executablePath / 'include') exists and:[(executablePath / 'stc') exists])
+	  or:[
+	    executablePath := executablePath directory.
+	    ((executablePath / 'include') exists and:[(executablePath / 'stc') exists])
+	      or:[
+		executablePath := executablePath directory.
+		((executablePath / 'include') exists and:[(executablePath / 'stc') exists])
+	      ]
+	   ]
+	) ifTrue:[
+	    self initializeSTCFlagsForTopDirectory: executablePath.
+	]
     ].
 
     "
@@ -1601,121 +1601,131 @@
      notice: for now, can only initialize for borland+windows or linux;
      visualC setup still fails."
 
-    |topDir topDirName vcTop sdkTop bccTop useBorlandC useVisualC useMingw m32|
+    |topDir topDirName vcTop sdkTop bccTop borlandDir useBorlandC useVisualC useMingw m32 programFiles|
 
     topDir := topDirArg.
     OperatingSystem isMSWINDOWSlike ifTrue:[
-        topDirArg isString ifTrue:[
-            topDir := topDirArg copyReplaceAll:$/ with:$\ ifNone:topDirArg.
-        ]
+	topDirArg isString ifTrue:[
+	    topDir := topDirArg copyReplaceAll:$/ with:$\ ifNone:topDirArg.
+	]
     ].
     topDir := topDir asFilename.
     topDirName := topDir name.
 
     "/ if in the development directory, use ./modules
     Smalltalk isSmalltalkDevelopmentSystem ifTrue:[
-        STCModulePath := 'modules'.
+	STCModulePath := 'modules'.
     ] ifFalse:[
-        STCModulePath := Filename tempDirectory constructString:'modules'.
+	STCModulePath := Filename tempDirectory constructString:'modules'.
     ].
 
     (topDir construct:'stc') exists ifFalse:[
-        ('ParserFlags [warning]: stc not found in "',topDirName,'"') infoPrintCR.
-        'ParserFlags [warning]: stc-compiling (primitive code) will not work in the browser' infoPrintCR.
-        STCCompilation := #never.
+	('ParserFlags [warning]: stc not found in "',topDirName,'"') infoPrintCR.
+	'ParserFlags [warning]: stc-compiling (primitive code) will not work in the browser' infoPrintCR.
+	STCCompilation := #never.
     ].
 
     OperatingSystem isMSWINDOWSlike ifTrue:[
-        useBorlandC := useVisualC := useMingw := false.
-
-        STCCompilationIncludes := '-I',topDirName,'\include -I',topDirName,'\libopengl'.
-        (bccTop := BCCTop) isNil ifTrue:[
-            bccTop := #(
-                        'C:\Borland\bcc55'
-                       ) detect:[:path | path asFilename exists and:[(path asFilename construct:'include') exists]] ifNone:nil.
-        ].
-
-        (bccTop notNil and:[bccTop asFilename exists]) ifTrue:[
-            STCCompilationIncludes := STCCompilationIncludes,' -I',bccTop,'\Include'.
-            LibDirectory := topDirName,'\lib\bc'.
-            LinkArgs := '-L',topDirName,'\lib\bc'.
-            LinkArgs := LinkArgs,' -L',bccTop,'\Lib -r -c -ap -Tpd -Gi -w-dup'.
-            CCPath := 'bcc32'.
-            MakeCommand := 'bmake'.
-            LinkCommand := 'ilink32'.
-            CCCompilationOptions := '-w-'.
-            useBorlandC := true.
-        ] ifFalse:[
-            (vcTop := VCTop) isNil ifTrue:[
-                vcTop := #(
-                            'C:\Program Files\Microsoft Visual Studio 11.0\VC'
-                            'C:\Program Files\Microsoft Visual Studio 10.0\VC'
-                            'C:\Program Files\Microsoft Visual Studio 9.0\VC'
-                          ) detect:[:path | path asFilename exists and:[(path asFilename construct:'bin/cl.exe') exists]] ifNone:nil.
-            ].
-            (vcTop notNil and:[vcTop asFilename exists]) ifTrue:[
-                useVisualC := true.
-                STCCompilationIncludes := STCCompilationIncludes,' -I',vcTop,'include'.
-
-                (sdkTop := SDKTop) isNil ifTrue:[
-                    sdkTop := #(
-                                'C:\Program Files\Microsoft SDKs\Windows\v7.0A'
-                                'C:\Program Files\Microsoft SDKs\Windows\v6.0A'
-                              ) detect:[:path | path asFilename exists and:[(path asFilename construct:'include') exists]] ifNone:nil.
-                ].
-                (sdkTop notNil and:[sdkTop asFilename exists]) ifTrue:[
-                    STCCompilationIncludes := STCCompilationIncludes,' -I',sdkTop,'\include'.
-                ].
-                LibDirectory := topDirName,'\lib\vc'.
-                LinkArgs := '-L',topDirName,'\lib\vc'.
-                LinkArgs := LinkArgs,' -r -c -ap -Tpd -Gi -w-dup'.
-                CCPath := vcTop,'\bin\cl.exe'.
-                LinkCommand := 'ilink32'.
-                MakeCommand := 'vcmake'.
-                CCCompilationOptions := '/nologo /ZI  /w /GF /EHsc /FR.\objvc\'.
-            ] ifFalse:[
-                "/ add definitions for lcc, mingc etc.
-                STCCompilationIncludes := STCCompilationIncludes,' -IC:\xxxxx\Include'.
-                LibDirectory := topDirName,'\lib\vc'.
-                LinkArgs := '-L',topDirName,'\lib\vc'.
-                LinkArgs := LinkArgs,' -r -c -ap -Tpd -Gi -w-dup'.
-            ].
-        ].
-        STCCompilationDefines := '-DWIN32'.
-        STCCompilationOptions := '+optinline +inlineNew'.
-        (topDirName,'\stc\stc.exe') asFilename exists ifTrue:[
-            STCPath := (topDirName,'\stc\stc.exe').
-        ] ifFalse:[
-            STCPath := 'stc.exe'.
-        ].
-        LibPath := ''.
-        SearchedLibraries := #('import32.lib').
-        "/ SearchedLibraries := #('import32.lib' 'glu32.lib' 'opengl32.lib').
+	useBorlandC := useVisualC := useMingw := false.
+	programFiles := OperatingSystem getEnvironment:'ProgramFiles'.
+	programFiles isEmptyOrNil ifTrue:[ programFiles := 'C:\Program Files' ].
+
+	STCCompilationIncludes := '-I',topDirName,'\include -I',topDirName,'\libopengl'.
+	(bccTop := BCCTop) isNil ifTrue:[
+	    borlandDir := OperatingSystem getEnvironment:'BCCDIR'.
+	    borlandDir isEmptyOrNil ifTrue:[ borlandDir := 'C:\Borland\bcc55' ].
+	    bccTop := {
+			(borlandDir) .
+			(programFiles , '\Borland\bcc55') .
+			(programFiles , '\bcc55') .
+		      } detect:[:path | path asFilename exists and:[(path asFilename construct:'include') exists]]
+			 ifNone:nil.
+	].
+
+	(bccTop notNil and:[bccTop asFilename exists]) ifTrue:[
+	    STCCompilationIncludes := STCCompilationIncludes,' -I',bccTop,'\Include'.
+	    LibDirectory := topDirName,'\lib\bc'.
+	    LinkArgs := '-L',topDirName,'\lib\bc'.
+	    LinkArgs := LinkArgs,' -L',bccTop,'\Lib -r -c -ap -Tpd -Gi -w-dup'.
+	    CCPath := 'bcc32'.
+	    MakeCommand := 'bmake'.
+	    LinkCommand := 'ilink32'.
+	    CCCompilationOptions := '-w-'.
+	    useBorlandC := true.
+	] ifFalse:[
+	    (vcTop := VCTop) isNil ifTrue:[
+		vcTop := {
+			    (programFiles,'\Microsoft Visual Studio 12.0\VC') .
+			    (programFiles,'\Microsoft Visual Studio 11.0\VC') .
+			    (programFiles,'\Microsoft Visual Studio 10.0\VC') .
+			    (programFiles,'\Microsoft Visual Studio 9.0\VC' ) .
+			 } detect:[:path | path asFilename exists and:[(path asFilename construct:'bin/cl.exe') exists]]
+			   ifNone:nil.
+	    ].
+	    (vcTop notNil and:[vcTop asFilename exists]) ifTrue:[
+		useVisualC := true.
+		STCCompilationIncludes := STCCompilationIncludes,' -I',vcTop,'include'.
+
+		(sdkTop := SDKTop) isNil ifTrue:[
+		    sdkTop := {
+				(programFiles,'\Microsoft SDKs\Windows\v8.0A') .
+				(programFiles,'\Microsoft SDKs\Windows\v7.0A') .
+				(programFiles,'\Microsoft SDKs\Windows\v6.0A') .
+			     }  detect:[:path | path asFilename exists and:[(path asFilename construct:'include') exists]] ifNone:nil.
+		].
+		(sdkTop notNil and:[sdkTop asFilename exists]) ifTrue:[
+		    STCCompilationIncludes := STCCompilationIncludes,' -I',sdkTop,'\include'.
+		].
+		LibDirectory := topDirName,'\lib\vc'.
+		LinkArgs := '-L',topDirName,'\lib\vc'.
+		LinkArgs := LinkArgs,' -r -c -ap -Tpd -Gi -w-dup'.
+		CCPath := vcTop,'\bin\cl.exe'.
+		LinkCommand := 'ilink32'.
+		MakeCommand := 'vcmake'.
+		CCCompilationOptions := '/nologo /ZI  /w /GF /EHsc /FR.\objvc\'.
+	    ] ifFalse:[
+		"/ add definitions for lcc, mingc etc.
+		STCCompilationIncludes := STCCompilationIncludes,' -IC:\xxxxx\Include'.
+		LibDirectory := topDirName,'\lib\vc'.
+		LinkArgs := '-L',topDirName,'\lib\vc'.
+		LinkArgs := LinkArgs,' -r -c -ap -Tpd -Gi -w-dup'.
+	    ].
+	].
+	STCCompilationDefines := '-DWIN32'.
+	STCCompilationOptions := '+optinline +inlineNew'.
+	(topDirName,'\stc\stc.exe') asFilename exists ifTrue:[
+	    STCPath := (topDirName,'\stc\stc.exe').
+	] ifFalse:[
+	    STCPath := 'stc.exe'.
+	].
+	LibPath := ''.
+	SearchedLibraries := #('import32.lib').
+	"/ SearchedLibraries := #('import32.lib' 'glu32.lib' 'opengl32.lib').
     ] ifFalse:[
-        STCCompilationIncludes := '-I',topDirName,'/include'.
-        STCCompilationDefines := ''.
-        STCCompilationOptions := '+optinline +inlineNew'.
-        STCPath := topDirName,'/stc/stc'.
-
-        m32 := ''.
-        (ExternalAddress pointerSize == 4) ifTrue:[
-            m32 := ' -m32'
-        ].
-        CCCompilationOptions := OperatingSystem getCPUDefine,
-                                ' -D', self usedCompilerDefine,
-                                ' ', OperatingSystem getOSDefine,
-                                ' ', '-O', m32.
-        ParserFlags useGnuC ifTrue:[
-            CCPath := 'gcc'
-        ] ifFalse:[
-            CCPath := 'cc'
-        ].
-        LinkArgs := m32.
-        LinkSharedArgs := '-shared', m32.
-        LinkCommand := CCPath.
-        LibPath := ''.
-        SearchedLibraries := #().
-        MakeCommand := 'make'.
+	STCCompilationIncludes := '-I',topDirName,'/include'.
+	STCCompilationDefines := ''.
+	STCCompilationOptions := '+optinline +inlineNew'.
+	STCPath := topDirName,'/stc/stc'.
+
+	m32 := ''.
+	(ExternalAddress pointerSize == 4) ifTrue:[
+	    m32 := ' -m32'
+	].
+	CCCompilationOptions := OperatingSystem getCPUDefine,
+				' -D', self usedCompilerDefine,
+				' ', OperatingSystem getOSDefine,
+				' ', '-O', m32.
+	ParserFlags useGnuC ifTrue:[
+	    CCPath := 'gcc'
+	] ifFalse:[
+	    CCPath := 'cc'
+	].
+	LinkArgs := m32.
+	LinkSharedArgs := '-shared', m32.
+	LinkCommand := CCPath.
+	LibPath := ''.
+	SearchedLibraries := #().
+	MakeCommand := 'make'.
     ].
 
     "
@@ -2643,11 +2653,11 @@
 !ParserFlags class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/ParserFlags.st,v 1.119 2014-07-24 09:22:43 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/ParserFlags.st,v 1.120 2014-11-13 11:48:44 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libcomp/ParserFlags.st,v 1.119 2014-07-24 09:22:43 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/ParserFlags.st,v 1.120 2014-11-13 11:48:44 cg Exp $'
 ! !