Commit 65cc2600 authored by John van Groningen's avatar John van Groningen

move functions that depend on ObjectIO to PlatformObjectIO

parent d00adb46
definition module Platform
import StdPSt, StdString
import StdIOCommon
import StdString
PlatformDependant win mac :== mac
initPlatformCommandLineArguments:: !*(PSt .l) -> (![String],!*PSt .l)
installPlatformEventHandlers :: !*(PSt .l) -> *(PSt .l)
openPlatformWindowMenu :: !*(PSt .l) -> *(PSt .l)
getWindowModified :: !Id !(IOSt .l) -> (!Maybe Bool,!IOSt .l)
setWindowModified :: !Id !String !Bool !(IOSt .l) -> IOSt .l
TempDir :: String
EnvsDir :: String
PrefsDir :: String
......@@ -19,6 +11,5 @@ BitmapDir :: String
batchOptions :: !*World -> (!Bool,Bool,String,*File,!*World)
wAbort :: !String !*World -> *World
pAbort :: !(PSt .a) -> PSt .a
onOSX :: Bool
......@@ -2,30 +2,11 @@ implementation module Platform
import StdInt, StdMisc, StdFile
import StdTuple,StdOverloaded,StdArray
import StdPSt
import StdIOCommon
import StdSystem
PlatformDependant win mac
:== mac
initPlatformCommandLineArguments :: !*(PSt .l) -> (![String],!*PSt .l)
initPlatformCommandLineArguments ps
= ([],ps)
installPlatformEventHandlers :: !*(PSt .l) -> *(PSt .l)
installPlatformEventHandlers ps
| install_apple_event_handlers == 0
// = trace_n "apple events installed" ps
= ps
// = trace_n "installing apple events failed :-(" ps
= ps
openPlatformWindowMenu :: !*(PSt .l) -> *(PSt .l)
openPlatformWindowMenu ps
= ps
// = openWindowMenu ps
// FIXME: should be IdePlatform
batchOptions :: !*World -> (!Bool,Bool,String,*File,!*World)
batchOptions world
......@@ -42,16 +23,6 @@ wAbort message world
# (_,world) = fclose stderr world
= world
// FIXME: should be IdePlatform
pAbort :: !(PSt .a) -> PSt .a
pAbort ps = ps
install_apple_event_handlers :: Int
install_apple_event_handlers
= code ()(r=D0) {
call .install_apple_event_handlers
}
TempDir :: String
TempDir = applicationpath "Temp"
......@@ -66,63 +37,10 @@ BitmapDir = applicationpath "Bitmaps"
//////////////
//import dodebug
trace_n` _ f :== f
import windowaccess, iostate, StdBool,menuwindowmenu
import code from library "winmod_library"
getWindowModified :: !Id !(IOSt .l) -> (!Maybe Bool,!IOSt .l)
getWindowModified id ioState
# (found,wDevice,ioState) = ioStGetDevice WindowDevice ioState
| not found
= (Nothing,ioState)
# windows = windowSystemStateGetWindowHandles wDevice
(found,wsH,windows) = getWindowHandlesWindow (toWID id) windows
| not found
= (Nothing,ioStSetDevice (WindowSystemState windows) ioState)
| otherwise
# (mod,wsH,ioState) = getWindowModified wsH ioState
= (Just mod,ioStSetDevice (WindowSystemState (setWindowHandlesWindow wsH windows)) ioState)
where
getWindowModified wsH=:{wshIds={wPtr}} ioState
# (mod,ioState) = accIOToolbox (IsWindowModified wPtr) ioState
= trace_n` ("getWindowModified",wPtr,mod) (mod<>0,wsH,ioState)
IsWindowModified :: !OSWindowPtr !*OSToolbox -> (!Int,!*OSToolbox)
IsWindowModified wPtr ioState = code {
ccall IsWindowModified "PI:I:I"
}
setWindowModified :: !Id !String !Bool !(IOSt .l) -> IOSt .l
setWindowModified id windowName mod ioState
# windowTitle = if mod (""+++windowName) windowName
# ioState = changeWindowInWindowMenu id windowTitle ioState
# (found,wDevice,ioState) = ioStGetDevice WindowDevice ioState
| not found
= ioState
# windows = windowSystemStateGetWindowHandles wDevice
(found,wsH,windows) = getWindowHandlesWindow (toWID id) windows
| not found
= ioStSetDevice (WindowSystemState windows) ioState
| otherwise
# (wsH,ioState) = setWindowModified wsH mod ioState
= ioStSetDevice (WindowSystemState (setWindowHandlesWindow wsH windows)) ioState
where
setWindowModified wsH=:{wshIds={wPtr}} mod ioState
# (err,ioState) = accIOToolbox (SetWindowModified wPtr (if mod (1 << 24) 0)) ioState
= trace_n` ("setWindowModified",wPtr,mod,err) (wsH,ioState)
SetWindowModified :: !OSWindowPtr !Int !*OSToolbox -> (!OSStatus,!*OSToolbox)
SetWindowModified wPtr mod ioState = code {
ccall SetWindowModified "PII:I:I"
}
:: OSStatus :== Int
onOSX :: Bool
onOSX =: fst (runningCarbonOSX OSNewToolbox)
onOSX =: fst (runningCarbonOSX 0/*OSNewToolbox*/)
runningCarbonOSX tb
# (err,res,tb) = Gestalt "sysv" tb
......
definition module PlatformObjectIO
import StdPSt, StdString
import StdIOCommon
initPlatformCommandLineArguments:: !*(PSt .l) -> (![String],!*PSt .l)
installPlatformEventHandlers :: !*(PSt .l) -> *(PSt .l)
openPlatformWindowMenu :: !*(PSt .l) -> *(PSt .l)
getWindowModified :: !Id !(IOSt .l) -> (!Maybe Bool,!IOSt .l)
setWindowModified :: !Id !String !Bool !(IOSt .l) -> IOSt .l
pAbort :: !(PSt .a) -> PSt .a
implementation module PlatformObjectIO
import StdInt, StdMisc, StdFile
import StdTuple,StdOverloaded,StdArray
import StdPSt
import StdIOCommon
import StdSystem
import windowaccess, iostate, StdBool,menuwindowmenu
import code from library "winmod_library"
initPlatformCommandLineArguments :: !*(PSt .l) -> (![String],!*PSt .l)
initPlatformCommandLineArguments ps
= ([],ps)
installPlatformEventHandlers :: !*(PSt .l) -> *(PSt .l)
installPlatformEventHandlers ps
| install_apple_event_handlers == 0
// = trace_n "apple events installed" ps
= ps
// = trace_n "installing apple events failed :-(" ps
= ps
openPlatformWindowMenu :: !*(PSt .l) -> *(PSt .l)
openPlatformWindowMenu ps
= ps
// = openWindowMenu ps
// FIXME: should be IdePlatform
pAbort :: !(PSt .a) -> PSt .a
pAbort ps = ps
install_apple_event_handlers :: Int
install_apple_event_handlers
= code ()(r=D0) {
call .install_apple_event_handlers
}
//////////////
getWindowModified :: !Id !(IOSt .l) -> (!Maybe Bool,!IOSt .l)
getWindowModified id ioState
# (found,wDevice,ioState) = ioStGetDevice WindowDevice ioState
| not found
= (Nothing,ioState)
# windows = windowSystemStateGetWindowHandles wDevice
(found,wsH,windows) = getWindowHandlesWindow (toWID id) windows
| not found
= (Nothing,ioStSetDevice (WindowSystemState windows) ioState)
| otherwise
# (mod,wsH,ioState) = getWindowModified wsH ioState
= (Just mod,ioStSetDevice (WindowSystemState (setWindowHandlesWindow wsH windows)) ioState)
where
getWindowModified wsH=:{wshIds={wPtr}} ioState
# (mod,ioState) = accIOToolbox (IsWindowModified wPtr) ioState
= (mod<>0,wsH,ioState)
IsWindowModified :: !OSWindowPtr !*OSToolbox -> (!Int,!*OSToolbox)
IsWindowModified wPtr ioState = code {
ccall IsWindowModified "PI:I:I"
}
:: OSStatus :== Int
setWindowModified :: !Id !String !Bool !(IOSt .l) -> IOSt .l
setWindowModified id windowName mod ioState
# windowTitle = if mod (""+++windowName) windowName
# ioState = changeWindowInWindowMenu id windowTitle ioState
# (found,wDevice,ioState) = ioStGetDevice WindowDevice ioState
| not found
= ioState
# windows = windowSystemStateGetWindowHandles wDevice
(found,wsH,windows) = getWindowHandlesWindow (toWID id) windows
| not found
= ioStSetDevice (WindowSystemState windows) ioState
| otherwise
# (wsH,ioState) = setWindowModified wsH mod ioState
= ioStSetDevice (WindowSystemState (setWindowHandlesWindow wsH windows)) ioState
where
setWindowModified wsH=:{wshIds={wPtr}} mod ioState
# (err,ioState) = accIOToolbox (SetWindowModified wPtr (if mod (1 << 24) 0)) ioState
= (wsH,ioState)
SetWindowModified :: !OSWindowPtr !Int !*OSToolbox -> (!OSStatus,!*OSToolbox)
SetWindowModified wPtr mod ioState = code {
ccall SetWindowModified "PII:I:I"
}
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