We are planning to upgrade GitLab to the latest version this Friday morning. Expect some downtime!

Commit 546c3fe6 authored by Diederik van Arkel's avatar Diederik van Arkel

move processor setting from codegen opts to environment;

imporoved error messages so that crashes are recognised as errors;
put macintosh temp files in temp dir;
processor dependant object names;
parent f3bdef18
......@@ -169,6 +169,7 @@ getCurrentLink :: !*(PSt *General) -> (!String,!*PSt *General)
getCurrentDynl :: !*(PSt *General) -> (!String,!*PSt *General)
getCurrentVers :: !*(PSt *General) -> (!Int,!*PSt *General)
getCurrentRedc :: !*(PSt *General) -> (!Bool,!*PSt *General)
getCurrentProc :: !*(PSt *General) -> (!Processor,!*PSt *General)
getCurrentMeth :: !*(PSt *General) -> (!CompileMethod,!*PSt *General)
//-- error window stuff
......
......@@ -447,6 +447,11 @@ getCurrentRedc ps
# (ct,ps) = accPLoc (\p=:{pm_targets,pm_curtarg}->(pm_targets!!pm_curtarg,p)) ps
= (ct.target_redc,ps)
getCurrentProc :: !*(PSt *General) -> (!Processor,!*PSt *General)
getCurrentProc ps
# (ct,ps) = accPLoc (\p=:{pm_targets,pm_curtarg}->(pm_targets!!pm_curtarg,p)) ps
= (ct.target_proc,ps)
getCurrentMeth :: !*(PSt *General) -> (!CompileMethod,!*PSt *General)
getCurrentMeth ps
# (ct,ps) = accPLoc (\p=:{pm_targets,pm_curtarg}->(pm_targets!!pm_curtarg,p)) ps
......
......@@ -619,7 +619,12 @@ toolpane tg compId cgenId linkId dynlId versId methId
[ ControlId versId
, ControlActivate (noLS (appPIO (setEditControlSelection versId 1 0)))
]
:+: CheckControl [("Console in IDE",Nothing,toMark tg.target_redc,redcfun)] (Columns 1) [ControlPos (Left,zero)]
:+: PlatformDependant
( CheckControl [("Console in IDE",Nothing,toMark tg.target_redc,redcfun)] (Columns 1) [ControlPos (Left,zero)])
( TextControl "Processor: " [ControlPos (Left,zero), ControlWidth textWidth]
:+: PopUpControl
[(toString p,procfun p) \\ p <- PlatformProcessors]
(proc2idx tg.target_proc) [])
:+: RadioControl
[("Sync",Nothing,methfun 1)
,("Async",Nothing,methfun 2)
......@@ -651,6 +656,15 @@ where
# ls = {ls & tg.target_redc = not ls.tg.target_redc}
= (ls,ps)
procfun proc (ls,ps)
# ls = {ls & tg.target_proc = proc}
= (ls,ps)
proc2idx proc
= case [x \\ p <- PlatformProcessors & x <- [1..] | p == proc] of
[] -> proc2idx DefaultProcessor
[x:_] -> x
methfun 1 (ls,ps)
# ps = appPIO (disableControl methId) ps
# ls = {ls & tg.target_meth = CompileSync}
......
......@@ -70,6 +70,7 @@ CodeGen :: // Generates code for the given file:
!Pathname // full .abc pathname of module to be compiled
!Bool // timeprofiling option
!CodeGenOptions // code generator options
!Processor // target processor
!ApplicationOptions // application options
!Pathname // startup directory
!*(PSt .l) // state
......@@ -82,7 +83,23 @@ CodeGen :: // Generates code for the given file:
, !Bool // success status
)
StartCodeGenerator :: !String !(WindowFun *(PSt .l)) !CodeGenerateAsmOrCode !Pathname !Int !Bool !CodeGenOptions !ApplicationOptions !Pathname !*(PSt .l) -> (!Bool,!Pathname,!*(PSt .l))
StartCodeGenerator ::
!String
!(WindowFun *(PSt .l))
!CodeGenerateAsmOrCode
!Pathname
!Int
!Bool
!CodeGenOptions
!Processor
!ApplicationOptions
!Pathname
!*(PSt .l)
->
( !Bool
, !Pathname
, !*(PSt .l)
)
Link :: // Links the given file:
!String // linker exe name
......@@ -103,6 +120,7 @@ Link :: // Links the given file:
!Bool // generate dll?
!String // name of file containing symbols to be exported from dll
!Pathname // startup directory
!String // dynamic linker name
!Bool // add 'carb' 0 resource?
!*(PSt .l) // state
->
......
......@@ -64,6 +64,7 @@ standardObjectFiles stack_traces profiling processor
= ( MakeObjPathname processor "_startupTrace" :! rest)
| profiling
= ( MakeObjPathname processor "_startupProfile" :! rest)
// otherwise
= ( MakeObjPathname processor "_startup" :! rest)
where
rest
......@@ -73,6 +74,7 @@ where
:! MakeObjPathname processor "_system"
:! MakeObjPathname processor "_library"
:! Nil
// otherwise
= MakeObjPathname processor "_system"
:! MakeObjPathname processor "_library"
:! Nil
......@@ -150,11 +152,13 @@ where
out_file_path :: String Int -> String
out_file_path startupdir slot
= file_path startupdir "out" slot
// = file_path startupdir "out" slot
= file_path TempDir "out" slot
errors_file_path :: String Int -> String
errors_file_path startupdir slot
= file_path startupdir "errors" slot
// = file_path startupdir "errors" slot
= file_path TempDir "errors" slot
file_path :: String String Int -> String
file_path startupdir base_name slot
......@@ -179,7 +183,7 @@ Compile cocl` write_module_times errwin typewin compileOrCheckSyntax path paths
// # name = CleanCompilerName // XOXOXOX
# (error_code,error_n,ss) = send_command_to_clean_compiler_cc signature name command Wait
| error_code <> 0 =
( errwin ( [ "Unable to run compiler: "+++cocl
( errwin ( [ "Error: Unable to run compiler: "+++cocl
+++ "; "+++ toString error_code
+++ "; "+++ toString error_n
+++ "; "+++ ss
......@@ -372,9 +376,9 @@ SwitchDebugMachO tp symbolic_machO normal :== case toString tp of
// "PowerPC_MachO" -> symbolic_machO
_ -> normal
CodeGen :: !String !(WindowFun *(PSt .l)) !CodeGenerateAsmOrCode !Pathname !Bool !CodeGenOptions !ApplicationOptions !Pathname !*(PSt .l)
CodeGen :: !String !(WindowFun *(PSt .l)) !CodeGenerateAsmOrCode !Pathname !Bool !CodeGenOptions !Processor !ApplicationOptions !Pathname !*(PSt .l)
-> (!*(PSt .l), !Pathname, !Bool)
CodeGen cgen` wf genAsmOrCode path timeprofile cgo=:{tp} ao startupdir ps
CodeGen cgen` wf genAsmOrCode path timeprofile cgo tp ao startupdir ps
# genAsmOrCode` = SwitchDebugMachO tp AsmGeneration genAsmOrCode
# (cgen_ok,cgen,name,signature) = mangleGenerator cgen` startupdir
......@@ -384,14 +388,18 @@ CodeGen cgen` wf genAsmOrCode path timeprofile cgo=:{tp} ao startupdir ps
# objpath = MakeObjSystemPathname tp path
path_without_suffix = RemoveSuffix path
out_file_name
= out_file_path startupdir 0
errors_file_name
= errors_file_path startupdir 0
command = cgen +++ MakeCodeGenOptionsString genAsmOrCode` timeprofile cgo
+++ " " +++ (quoted_string path_without_suffix)
+++ " > out \xb3 errors"
errorsfilename = startupdir +++ toString dirseparator +++ "errors"
+++ " > " +++ quoted_string out_file_name
+++ " \xb3 " +++ quoted_string errors_file_name
# (error_code,error_n,output_string)
= send_command_to_clean_compiler_cg signature name command Wait
| error_code <> 0
= ( wf ( [ "Unable to run code generator: "+++toString error_code
= ( wf ( [ "Error: Unable to run code generator: "+++toString error_code
]) ps
, objpath
, False
......@@ -405,7 +413,7 @@ CodeGen cgen` wf genAsmOrCode path timeprofile cgo=:{tp} ao startupdir ps
)
| error_n <> 0
= ( wf ( [ "Code generator: "+++toString error_n
= ( wf ( [ "Error: Code generator: "+++toString error_n
]) ps
, objpath
, False
......@@ -429,28 +437,31 @@ CodeGen cgen` wf genAsmOrCode path timeprofile cgo=:{tp} ao startupdir ps
)
(ps,objpath,True)
StartCodeGenerator :: !String !(WindowFun *(PSt .l)) !CodeGenerateAsmOrCode !Pathname !Int !Bool !CodeGenOptions !ApplicationOptions !Pathname !*(PSt .l)
StartCodeGenerator :: !String !(WindowFun *(PSt .l)) !CodeGenerateAsmOrCode !Pathname !Int !Bool !CodeGenOptions !Processor !ApplicationOptions !Pathname !*(PSt .l)
-> (!Bool,!Pathname,!*(PSt .l))
StartCodeGenerator cgen` wf genAsmOrCode path slot timeprofile cgo=:{tp} ao startupdir ps
StartCodeGenerator cgen` wf genAsmOrCode path slot timeprofile cgo tp ao startupdir ps
# (cgen_ok,cgen,name,signature) = mangleGenerator cgen` startupdir
| not cgen_ok
# ps = wf [cgen] ps
= (False, "", ps)
// # (objpath,ps) = accFiles (MakeObjSystemPathname tp path) ps
# objpath = MakeObjSystemPathname tp path
path_without_suffix = RemoveSuffix path
// errorsfilename = errors_file_path startupdir slot
out_file_name
= out_file_path startupdir 0
errors_file_name
= errors_file_path startupdir 0
command = /*cgen*/ "cg"
+++" -id "+++toString slot
+++ MakeCodeGenOptionsString genAsmOrCode /*False*/timeprofile cgo
+++ " " +++ (quoted_string path_without_suffix)
+++ " > out \xb3 errors"
+++ " > " +++ quoted_string out_file_name
+++ " \xb3 " +++ quoted_string errors_file_name
name = CleanCompilerName
signature = clean_compiler_signature slot
(error_code,error_n,output_string) = send_command_to_clean_compiler signature name command NoWait
| error_code<>0
# ps = wf ["Unable to run code generator: "+++toString error_code] ps
# ps = wf ["Error: Unable to run code generator: "+++toString error_code] ps
= (False,objpath,ps)
| size output_string <> 0
# ps = wf [output_string] ps
......@@ -472,13 +483,13 @@ where
Link :: !String !(WindowFun *(PSt .l)) !Pathname !ApplicationOptions
!Pathname !(List Pathname) !(List Pathname) !(List Pathname) !Bool
!Bool !Bool !Bool !String !Bool !String !Pathname !Bool !*(PSt .l)
!Bool !Bool !Bool !String !Bool !String !Pathname !String !Bool !*(PSt .l)
-> (!*(PSt .l),!Bool)
Link linker` winfun path
applicationOptions=:{fs,fn,em,ss,hs,initial_heap_size,profiling,heap_size_multiple,o,memoryProfilingMinimumHeapSize=minheap}
optionspathname library_file_names object_file_names
static_libraries static gen_relocs gen_linkmap
link_resources resource_path gen_dll dll_names startupdir add_carb_resource ps
link_resources resource_path gen_dll dll_names startupdir dynlinker add_carb_resource ps
# (ok,linker) = mangleLinker linker` startupdir
| not ok
# ps = winfun [linker] ps
......@@ -980,7 +991,7 @@ CompileStartCommand cocl write_module_times errwin compileOrCheckSyntax path pat
# signature = clean_compiler_signature slot
# (error_code,error_n,ss) = trace_n command send_command_to_clean_compiler signature name command NoWait
| error_code <> 0
= ( False, errwin ( [ "Unable to run compiler: "+++cocl
= ( False, errwin ( [ "Error: Unable to run compiler: "+++cocl
+++ "; "+++ toString error_code
+++ "; "+++ toString error_n
+++ "; "+++ ss
......@@ -1088,7 +1099,7 @@ CompilePersistent ::
| FileEnv env
CompilePersistent cocl write_module_times errwin typewin compileOrCheckSyntax path paths projectHeapProfiling projectTimeProfiling
projectEagerOrDynamic compileroptions startupdir state env
= (state,(errwin ["Persistent not supported."] env,"",SyntaxError))
= (state,(errwin ["Error: Persistent not supported."] env,"",SyntaxError))
// ... JVG
//--
......@@ -1110,8 +1121,8 @@ mangleCompiler ccstring startupdir
# (name,rest) = sSplit ';' ccstring
# (sign,cocl) = sSplit ';' rest
# name = case name of
"" -> "Clean Compiler"//\0"
n -> n
"" -> startupdir +++ toString dirseparator +++ "Clean Compiler"//\0"
n -> startupdir +++ toString dirseparator +++ n
# sign = case sign of
"" -> "ClCo"//\0"
s -> s
......@@ -1133,8 +1144,8 @@ mangleGenerator cgstring startupdir
# (name,rest) = sSplit ';' cgstring
# (sign,cgen) = sSplit ';' rest
# name = case name of
"" -> "Clean Compiler"//\0"
n -> n
"" -> startupdir +++ toString dirseparator +++ "Clean Compiler"//\0"
n -> startupdir +++ toString dirseparator +++ n
# sign = case sign of
"" -> "ClCo"//\0"
s -> s
......
This diff is collapsed.
......@@ -2,6 +2,7 @@ definition module PmEnvironment
import StdFile,StdString,StdMaybe
import UtilStrictLists
from PmTypes import ::Processor
EnvsFileName :== "IDEEnvs"
......@@ -18,6 +19,7 @@ EnvsFileName :== "IDEEnvs"
, target_vers :: !Int // abc version
, target_redc :: !Bool // redirect console?
, target_meth :: !CompileMethod // compile strategy
, target_proc :: !Processor // object type
}
:: CompileMethod
......
......@@ -7,6 +7,7 @@ import UtilStrictLists
import PmPath
import StdMaybe
import Platform
import PmTypes
EnvsFileName :== "IDEEnvs"
......@@ -32,6 +33,7 @@ t_StdEnv
, target_vers :: !Int // abc version
, target_redc :: !Bool // redirect console?
, target_meth :: !CompileMethod // compile strategy
, target_proc :: !Processor // object type
}
:: CompileMethod
......@@ -130,6 +132,7 @@ emptyTarget =
, target_vers = 42
, target_redc = False
, target_meth = CompileSync
, target_proc = DefaultProcessor
}
WEO prefs
......@@ -158,6 +161,7 @@ TargetTable =
, SimpleOption "EnvironmentVersion" (\a->toString a.target_vers) (\v a->{a & target_vers=toInt v})
, SimpleOption "EnvironmentRedirect" (\a->b2s a.target_redc) (\v a->{a & target_redc=s2b v})
, SimpleOption "EnvironmentCompileMethod" (\a->m2s a.target_meth) (\v a->{a & target_meth=s2m v})
, SimpleOption "EnvironmentProcessor" (\a->toString a.target_proc) (\v a->{a & target_proc=fromString v})
}
where
b2s True = "True"
......@@ -202,6 +206,7 @@ t_StdEnv13 =
, target_vers = 918
, target_redc = False
, target_meth = CompileSync
, target_proc = DefaultProcessor
}
t_StdIO13 =
......@@ -228,6 +233,7 @@ t_StdIO13 =
, target_vers = 918
, target_redc = False
, target_meth = CompileSync
, target_proc = DefaultProcessor
}
t_StdEnv20 :: Target
......@@ -249,6 +255,7 @@ t_StdEnv20 =
, target_vers = 916
, target_redc = False
, target_meth = CompilePers
, target_proc = DefaultProcessor
}
t_StdIO20 =
......
......@@ -193,9 +193,9 @@ CodeGenOptionsTable :: OptionsTable CodeGenOptions
CodeGenOptionsTable =
{
SimpleOption "CheckStacks" (\a->a.cs) (\v a->{a & cs=v}),
SimpleOption "CheckIndexes" (\a->a.ci) (\v a->{a & ci=v}),
SimpleOption "CheckIndexes" (\a->a.ci) (\v a->{a & ci=v})
// SimpleOption "KeepABC" (\a->a.kaf) (\v a->{a & kaf=v}),
SimpleOption "TargetProcessor" (\a->a.tp) (\v a->{a & tp=v})
// SimpleOption "TargetProcessor" (\a->a.tp) (\v a->{a & tp=v})
}
instance fromString Int
......
......@@ -60,7 +60,7 @@ PR_SetApplicationOptions :: !ApplicationOptions !Project -> Project
PR_SetPaths :: !Bool !(List String) !(List String) !Project -> Project
PR_GetCodeGenOptions :: !Project -> CodeGenOptions
PR_GetProcessor :: !Project -> Processor
//PR_GetProcessor :: !Project -> Processor
PR_GetApplicationOptions :: !Project -> ApplicationOptions
PR_GetPaths :: !Project -> List String
PR_GetRootModuleName :: !Project -> String
......
......@@ -384,8 +384,8 @@ PR_SetPaths def defs new project=:{Project | built,inflist=infl=:((root=:{InfLis
PR_GetCodeGenOptions :: !Project -> CodeGenOptions;
PR_GetCodeGenOptions project=:{codegenopt} = codegenopt;
PR_GetProcessor :: !Project -> Processor;
PR_GetProcessor project=:{codegenopt={tp}} = tp;
//PR_GetProcessor :: !Project -> Processor;
//PR_GetProcessor project=:{codegenopt={tp}} = tp;
PR_GetApplicationOptions :: !Project -> ApplicationOptions;
PR_GetApplicationOptions project=:{applicationopt} = applicationopt;
......
......@@ -11,6 +11,8 @@ import UtilDate
:: Modulename :== String
:: Processor //= CurrentProcessor | MC68000 | MC68020 | MC68020_and_68881
DefaultProcessor :: Processor
PlatformProcessors :: [Processor]
ProcessorSuffix :: !Processor -> String
instance == Processor
......@@ -90,7 +92,7 @@ instance == EditOptions
{ cs :: !Bool // generate stack checks
, ci :: !Bool // generate index checks
// , kaf :: !Bool // keep abc-files
, tp :: !Processor
// , tp :: !Processor
}
instance == CodeGenOptions
......
......@@ -42,7 +42,13 @@ UnexpectedConstructor typeName string defaultValue
| PowerPC_MachO
| I386
DefaultProcessor :== PlatformDependant I386 PowerPC_Carbon
DefaultProcessor :: Processor
DefaultProcessor = PlatformDependant I386 PowerPC_Carbon
PlatformProcessors :: [Processor]
PlatformProcessors = PlatformDependant
[I386]
[PowerPC_Classic,PowerPC_Carbon,PowerPC_MachO]
ProcessorSuffix :: !Processor -> String
ProcessorSuffix CurrentProcessor = ProcessorSuffix DefaultProcessor
......@@ -262,7 +268,7 @@ where
{ cs :: !Bool
, ci :: !Bool
// , kaf :: !Bool
, tp :: !Processor
// , tp :: !Processor
}
instance == CodeGenOptions
......@@ -270,14 +276,12 @@ where
(==) :: !CodeGenOptions !CodeGenOptions -> Bool
(==) cg1 cg2
= cg1.cs == cg2.cs &&
cg1.ci == cg2.ci &&
cg1.tp == cg2.tp
cg1.ci == cg2.ci
DefCodeGenOptions :: CodeGenOptions;
DefCodeGenOptions =
{ cs = False
, ci = True
, tp = CurrentProcessor
}
// The Application Options: default settings for the application.
......
......@@ -156,7 +156,7 @@ Compile
(didit, exitcode, os4) = CallProcess command [] cocldir "" "" "" 99
diditall = if (os4 == 99) didit didit
| not diditall
# ps = errwin (["Unable to run compiler: "+++cocl +++ " :"+++toString exitcode]) ps
# ps = errwin (["Error: Unable to run compiler: "+++cocl +++ " :"+++toString exitcode]) ps
= (ps,"",SyntaxError)
= CompileHandleExitCode exitcode cocl tooltempdir dummy_slot errwin typewin path listTypes ps
where
......@@ -208,7 +208,7 @@ CompileStartCommand cocl` write_module_times errwin compileOrCheckSyntax path pa
(didit, os4) = AsyncCallProcess (command +++ "\0") slot 99
diditall = if (os4 == 99) didit didit
| not diditall
= (False, errwin ["Unable to run compiler: "+++cocl] ps)
= (False, errwin ["Error: Unable to run compiler: "+++cocl] ps)
// otherwise
= (True, ps)
where
......@@ -253,7 +253,7 @@ CompilePersistent
// # cocl = startupdir+++toString dirseparator +++"cocl.exe";
# (compile_ok,exitcode,(cstate,env)) = compile_with_cache cocl cocl_dir cocl_startup cocl_arguments (cstate,env);
| not compile_ok
# env = errwin ["Unable to run compiler: "+++cocl +++ " :"+++toString exitcode] env
# env = errwin ["Error: Unable to run compiler: "+++cocl +++ " :"+++toString exitcode] env
= (cstate,(env,"",SyntaxError))
# (env,path,mess) = CompileHandleExitCode exitcode cocl tooltempdir dummy_slot errwin typewin path listTypes env
= (cstate,(env,path,mess))
......@@ -289,7 +289,7 @@ CompileHandleExitCode exitcode cocl tooltempdir slot errwin typewin path
((errors,errors_and_messages_not_empty,errors_and_messages),ps)
= accFiles (ReadErrorsAndWarnings errors_file_name) ps
| exitcode <> 0 && not errors_and_messages_not_empty = // werkt dit ook voor persistent versie?
( errwin ( [ "Compiler crashed: "+++cocl
( errwin ( [ "Error: Compiler crashed: "+++cocl
: if (errors == CompilerOK) ["Unable to open Errors file"] []
]) ps
, ""
......@@ -485,7 +485,7 @@ CodeGen cgen` wf genAsmOrCode path timeprofile cgo=:{tp} ao startupdir ps
errorsfilename = tooltempdir +++ toString dirseparator +++ "errors"
(didit,exit_code,_) = trace_n errorsfilename CallProcess command [] cgendir "" "" errorsfilename 99
| not didit
= ( wf ( [ "Unable to run code generator: "+++cgen
= ( wf ( [ "Error: Unable to run code generator: "+++cgen
// , command
// , startupdir
]) ps
......@@ -496,7 +496,7 @@ CodeGen cgen` wf genAsmOrCode path timeprofile cgo=:{tp} ao startupdir ps
ps = (if errors_not_empty
(wf (StrictListToList error_text))
( if (exit_code <> 0)
(wf ["Code generator failed for '" +++ path +++ "' with exit code: "+++toString exit_code,(quoted_string path_without_suffix)])
(wf ["Error: Code generator failed for '" +++ path +++ "' with exit code: "+++toString exit_code,(quoted_string path_without_suffix)])
id
)
) ps
......@@ -580,7 +580,7 @@ Link linker` winfun path
# (didit,exit_code,ost) = CallProcess linker [] linkerdir "" "" "" 99
# diditall = if (ost == 99) didit didit
| not diditall
= (winfun ["Unable to run linker: "+++linker] ps, False)
= (winfun ["Error: Unable to run linker: "+++linker] ps, False)
# link_ok = (exit_code==0) && (ost == 99)
# ((err,link_errors),ps) = accFiles (ReadLinkErrors linkerrspath) ps
| isJust err
......@@ -652,7 +652,7 @@ Execute winfun path {o} ps
# (didit,_) = winLaunchApp (quoted_string path) (o<>NoConsole) 99
| didit
= (ps,True)
= (winfun ["Could not launch the application"] ps,False)
= (winfun ["Error: Could not launch the application"] ps,False)
Execute` :: !String !*env -> (!Bool,!Int,!*env)
Execute` command ps
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment