Commit 2fbf9de1 authored by Diederik van Arkel's avatar Diederik van Arkel
Browse files

Move batch platform dependencies to os-layer

parent 34726234
...@@ -31,8 +31,6 @@ from PmCleanSystem import QuitCleanCompiler ...@@ -31,8 +31,6 @@ from PmCleanSystem import QuitCleanCompiler
import Platform, IdePlatform import Platform, IdePlatform
import PmDriver import PmDriver
import ArgEnv
import logfile, set_return_code, first_run
import StdSystem import StdSystem
trace_n _ f :== f trace_n _ f :== f
...@@ -189,21 +187,8 @@ where ...@@ -189,21 +187,8 @@ where
: _ : _
] ps ] ps
# ps = PlatformInteractiveInit ps // can modify Prefs!
# (prefs,ps) = getPrefs ps # (prefs,ps) = getPrefs ps
// <<< can move this into first_run module
// as function :: (reg_prefs,ps) -> (reg_prefs,ps)
# pcl_name = prefs.reg_prefs.tp_name
# pcl_path = prefs.reg_prefs.tp_path
# hcl_name = prefs.reg_prefs.hp_name
# hcl_path = prefs.reg_prefs.hp_path
# flags = prefs.reg_prefs.rp_flags
# (res,flag,ps) = first_run pcl_name pcl_path hcl_name hcl_path flags ps
# ps = case res of
True # flags = take 10 [flag:flags]
# prefs = {prefs & reg_prefs.rp_flags = flags}
-> setPrefs prefs ps
_ -> ps
// >>>
# (fhRecId,ps) = getFHI ps # (fhRecId,ps) = getFHI ps
# (phRecId,ps) = getPHI ps # (phRecId,ps) = getPHI ps
# (menuIds,ps) = getMenuIds ps # (menuIds,ps) = getMenuIds ps
...@@ -241,20 +226,6 @@ where ...@@ -241,20 +226,6 @@ where
# ps = SetProcessIcon CleanIcon ps # ps = SetProcessIcon CleanIcon ps
= installPlatformEventHandlers ps = installPlatformEventHandlers ps
ini _ _ _ _ _ _ _ _ _ _ _ _ _ _ ps = abort "IDE.icl: ini called with insufficient id's" ini _ _ _ _ _ _ _ _ _ _ _ _ _ _ ps = abort "IDE.icl: ini called with insufficient id's"
batchOptions world
= case [arg \\ arg <-: getCommandLine] of
[_, "--batch-build", prj]
-> batch False prj world
[_, "--batch-force-build", prj]
-> batch True prj world
_
-> (True, abort "force_update", abort "project file", abort "logfile", world)
where
batch force_update prj world
# (ok,logfile,world) = openLogfile prj world
| not ok
= (False, force_update, prj, logfile, wAbort ("--batch-build failed while opening logfile.\n") world)
= (False, force_update, prj, logfile, world)
fileMenu prefspath {mn_clo,mn_sva,mn_sav,mn_rev,mn_oth,mn_prt,mn_prs,mn_odm,mn_oim} fileMenu prefspath {mn_clo,mn_sva,mn_sav,mn_rev,mn_oth,mn_prt,mn_prs,mn_odm,mn_oim}
mPrNewId mFileId mFhMenId mPhMenId quitId fhRecId phRecId prefs mPrNewId mFileId mFhMenId mPhMenId quitId fhRecId phRecId prefs
...@@ -1097,10 +1068,3 @@ pinit force_update proj proj_path ps ...@@ -1097,10 +1068,3 @@ pinit force_update proj proj_path ps
where where
cleanup exepath bool1 bool2 ps cleanup exepath bool1 bool2 ps
= abortLog False "" ps = abortLog False "" ps
wAbort message world
# stderr = fwrites message stderr
// # (_,world) = fclose stderr world
# world = set_return_code_world (-1) world
= world
...@@ -4,6 +4,7 @@ import StdPSt, StdString ...@@ -4,6 +4,7 @@ import StdPSt, StdString
import StdIOCommon import StdIOCommon
from IdeState import :: General from IdeState import :: General
PlatformInteractiveInit :: !*(PSt General) -> *PSt General
PlatformProcessAttributes :: [ProcessAttribute *(PSt General)] PlatformProcessAttributes :: [ProcessAttribute *(PSt General)]
RunProgram :: !.String !*(PSt General) -> *PSt General RunProgram :: !.String !*(PSt General) -> *PSt General
......
...@@ -11,6 +11,7 @@ from iostate import appIOToolbox,accIOToolbox ...@@ -11,6 +11,7 @@ from iostate import appIOToolbox,accIOToolbox
from clCCall_12 import winLaunchApp,winMakeCString,:: CSTR,:: OSToolbox from clCCall_12 import winLaunchApp,winMakeCString,:: CSTR,:: OSToolbox
import clCrossCall_12, windowaccess, iostate import clCrossCall_12, windowaccess, iostate
import pictCCall_12, cast import pictCCall_12, cast
import first_run
import code from "Redirect.obj" import code from "Redirect.obj"
import code from "cCrossCallMaarten.obj" import code from "cCrossCallMaarten.obj"
...@@ -18,6 +19,25 @@ import code from "cCrossCallMaarten.obj" ...@@ -18,6 +19,25 @@ import code from "cCrossCallMaarten.obj"
import code from library "conkernel_library" import code from library "conkernel_library"
import code from library "bmpgdi_library" import code from library "bmpgdi_library"
PlatformInteractiveInit :: !*(PSt General) -> *PSt General
PlatformInteractiveInit ps
// <<< can move this into first_run module
// as function :: (reg_prefs,ps) -> (reg_prefs,ps)
# (prefs,ps) = getPrefs ps
# pcl_name = prefs.reg_prefs.tp_name
# pcl_path = prefs.reg_prefs.tp_path
# hcl_name = prefs.reg_prefs.hp_name
# hcl_path = prefs.reg_prefs.hp_path
# flags = prefs.reg_prefs.rp_flags
# (res,flag,ps) = first_run pcl_name pcl_path hcl_name hcl_path flags ps
# ps = case res of
True # flags = take 10 [flag:flags]
# prefs = {prefs & reg_prefs.rp_flags = flags}
-> setPrefs prefs ps
_ -> ps
// >>>
= ps
PlatformProcessAttributes :: [ProcessAttribute *(PSt General)] PlatformProcessAttributes :: [ProcessAttribute *(PSt General)]
PlatformProcessAttributes = PlatformProcessAttributes =
[ ProcessConsoleOpen id [ ProcessConsoleOpen id
......
...@@ -12,3 +12,6 @@ ToolsDir :: String ...@@ -12,3 +12,6 @@ ToolsDir :: String
TooltempDir :: String TooltempDir :: String
EnvsDir :: String EnvsDir :: String
PrefsDir :: String PrefsDir :: String
batchOptions :: !*World -> (!Bool,!Bool,!String,!*File,!*World)
wAbort :: !String !*World -> *World
...@@ -2,11 +2,12 @@ implementation module Platform ...@@ -2,11 +2,12 @@ implementation module Platform
import StdPSt import StdPSt
import ArgEnv import ArgEnv
import StdArray, StdEnum, StdList, StdClass, StdBool import StdArray, StdEnum, StdList, StdClass, StdBool, StdMisc
import UtilIO import UtilIO
from StdSystem import dirseparator from StdSystem import dirseparator
import code from library "platform_kernel_library" import code from library "platform_kernel_library"
import clCCall_12, ostoolbox import clCCall_12, ostoolbox
import logfile, set_return_code
PlatformDependant win mac :== win PlatformDependant win mac :== win
...@@ -53,6 +54,29 @@ initPlatformCommandLine ps ...@@ -53,6 +54,29 @@ initPlatformCommandLine ps
# files = map GetLongPathName files # files = map GetLongPathName files
= (files, ps) = (files, ps)
batchOptions :: !*World -> (!Bool,!Bool,!String,!*File,!*World)
batchOptions world
= case [arg \\ arg <-: getCommandLine] of
[_, "--batch-build", prj]
-> batch False prj world
[_, "--batch-force-build", prj]
-> batch True prj world
_
-> (True, abort "force_update", abort "project file", abort "logfile", world)
where
batch force_update prj world
# (ok,logfile,world) = openLogfile prj world
| not ok
= (False, force_update, prj, logfile, wAbort ("--batch-build failed while opening logfile.\n") world)
= (False, force_update, prj, logfile, world)
wAbort :: !String !*World -> *World
wAbort message world
# stderr = fwrites message stderr
// # (_,world) = fclose stderr world
# world = set_return_code_world (-1) world
= world
installPlatformEventHandlers :: !*(PSt .l) -> *(PSt .l) installPlatformEventHandlers :: !*(PSt .l) -> *(PSt .l)
installPlatformEventHandlers ps installPlatformEventHandlers ps
= ps = ps
......
Supports Markdown
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