Commit 7351e5bb authored by Diederik van Arkel's avatar Diederik van Arkel
Browse files

Move 'running OS X' check to Platform module;

parent af9c85b5
......@@ -20,3 +20,5 @@ BitmapDir :: String
batchOptions :: !*World -> (!Bool,Bool,String,*File,!*World)
wAbort :: !String !*World -> *World
pAbort :: !(PSt .a) -> PSt .a
onOSX :: Bool
implementation module Platform
import StdInt, StdMisc, StdFile
import StdTuple,StdOverloaded,StdArray
import StdPSt
import StdIOCommon
import StdSystem
......@@ -25,6 +26,7 @@ openPlatformWindowMenu ps
= ps
// = openWindowMenu ps
// FIXME: should be IdePlatform
batchOptions :: !*World -> (!Bool,Bool,String,*File,!*World)
batchOptions world
# interact = True
......@@ -33,12 +35,14 @@ batchOptions world
logfile = undef
= (interact,force_update,prj_name,logfile,world)
// FIXME: should be IdePlatform
wAbort :: !String !*World -> *World
wAbort message world
# stderr = fwrites message stderr
# (_,world) = fclose stderr world
= world
// FIXME: should be IdePlatform
pAbort :: !(PSt .a) -> PSt .a
pAbort ps = ps
......@@ -116,3 +120,22 @@ where
}
:: OSStatus :== Int
onOSX :: Bool
onOSX =: fst (runningCarbonOSX OSNewToolbox)
runningCarbonOSX tb
# (err,res,tb) = Gestalt "sysv" tb
| err <> 0 = abort "Gestalt failed.\n"
= (res >= 0x01000, tb)
Gestalt :: !String !*Int -> (!Int,!Int,!*Int)
Gestalt sSel tb
| size sSel <> 4 = abort "Gestalt not called with four-char selector.\n"
# iSel = ((toInt sSel.[0]) << 24) bitor ((toInt sSel.[1]) << 16) bitor ((toInt sSel.[2]) << 8) bitor ((toInt sSel.[3]) << 0)
= Gestalt iSel tb
where
Gestalt :: !Int !*Int -> (!Int,!Int,!*Int)
Gestalt _ _ = code {
ccall Gestalt "PI:II:I"
}
......@@ -2,6 +2,7 @@ implementation module dodebug
import StdEnv,StdPictureDef
from quickdraw import QGetPort, :: GrafPtr
import Platform
assert :: {#.Char} !.(.a -> (.Bool,.b)) .a -> .b
assert txt test env
......@@ -203,21 +204,3 @@ trace_n` m a
DebugStr` :: !msg !.a -> .a | toString msg
DebugStr` msg a
= DebugStr (toString msg) a
onOSX =: fst (runningCarbonOSX OSNewToolbox)
runningCarbonOSX tb
# (err,res,tb) = Gestalt "sysv" tb
| err <> 0 = abort "Gestalt failed.\n"
= (res >= 0x01000, tb)
Gestalt :: !String !*Int -> (!Int,!Int,!*Int)
Gestalt sSel tb
| size sSel <> 4 = abort "Gestalt not called with four-char selector.\n"
# iSel = ((toInt sSel.[0]) << 24) bitor ((toInt sSel.[1]) << 16) bitor ((toInt sSel.[2]) << 8) bitor ((toInt sSel.[3]) << 0)
= Gestalt iSel tb
where
Gestalt :: !Int !*Int -> (!Int,!Int,!*Int)
Gestalt _ _ = code {
ccall Gestalt "PI:II: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