aboutsummaryrefslogtreecommitdiff
path: root/main/Mac
diff options
context:
space:
mode:
authorronny2000-02-23 14:55:54 +0000
committerronny2000-02-23 14:55:54 +0000
commit763041adf7a1f87addcb5069f203396dc896b3f1 (patch)
tree78472565231b153eebf953f64a73b37be1fcec57 /main/Mac
parentAdded backend.dll (diff)
Initial import
git-svn-id: https://svn.cs.ru.nl/repos/clean-compiler/trunk@100 1f8540f1-abd5-4d5b-9d24-4c5ce8603e2d
Diffstat (limited to 'main/Mac')
-rw-r--r--main/Mac/CoclSystemDependent.dcl13
-rw-r--r--main/Mac/CoclSystemDependent.icl69
2 files changed, 82 insertions, 0 deletions
diff --git a/main/Mac/CoclSystemDependent.dcl b/main/Mac/CoclSystemDependent.dcl
new file mode 100644
index 0000000..319b75c
--- /dev/null
+++ b/main/Mac/CoclSystemDependent.dcl
@@ -0,0 +1,13 @@
+// this is for the PowerMac
+definition module CoclSystemDependent
+
+from deltaIOSystem import DeviceSystem
+from deltaEventIO import InitialIO, IOState
+
+PathSeparator
+ :== ','
+DirectorySeparator
+ :== ':'
+
+SystemDependentDevices :: [DeviceSystem .a (IOState .a)]
+SystemDependentInitialIO :: InitialIO *s
diff --git a/main/Mac/CoclSystemDependent.icl b/main/Mac/CoclSystemDependent.icl
new file mode 100644
index 0000000..971105c
--- /dev/null
+++ b/main/Mac/CoclSystemDependent.icl
@@ -0,0 +1,69 @@
+// this is for the PowerMac
+implementation module CoclSystemDependent
+
+import StdEnv
+import deltaIOSystem, deltaEventIO, deltaIOState
+import AppleEventDevice
+import compile
+import docommand
+import RWSDebug
+
+PathSeparator
+ :== ','
+DirectorySeparator
+ :== ':'
+
+SystemDependentDevices :: [DeviceSystem .a (IOState .a)]
+SystemDependentDevices
+ = [AppleEventSystem {openHandler = openDummy, quitHandler = Quit,
+ clipboardChangedHandler = clipboardDummy, scriptHandler = scriptHandler}];
+ where
+ openDummy filePath s io
+ = (s, io) <<- ("open", filePath)
+ clipboardDummy s io
+ = (s, io) <<- "clipboard"
+
+ /*
+ scriptHandler script s io
+ # (result, env) = DoCommandNullTerminated (script +++ "\0") 17
+ | result >= 0
+ = (s, io)
+ // otherwise
+ = (s, io) <<- ("error in docommand", result, script)
+ */
+ scriptHandler script s io
+ = (s, appFiles (compile (processArgs script)) io) <<- ("script", processArgs script)
+ where
+ processArgs s
+ = [replace arg \\ arg <- filter ((<>) "") (splitArgs s)]
+
+ replace s
+ | s == "\xb3" /* \xb3 == >= ligature */
+ = "-RE"
+ | s == ">"
+ = "-RO"
+ // otherwise
+ = s
+ splitArgs s
+ = split False 0 0 (size s) s
+ split quoted frm to n s
+ | to >= n
+ = [s % (frm, to)]
+ | s.[to] == '\\' && to < n-1
+ = split quoted frm (to+2) n s
+ | s.[to] == ' ' && not quoted
+ = [s % (frm, to-1) : split False (to+1) (to+1) n s]
+ | s.[to] == '\'' && quoted
+ = [s % (frm, to-1) : split False (to+1) (to+1) n s]
+ | s.[to] == '\''
+ = [s % (frm, to-1) : split True (to+1) (to+1) n s]
+ // otherwise
+ = split quoted frm (to+1) n s
+
+SystemDependentInitialIO :: InitialIO *s
+SystemDependentInitialIO
+ = []
+
+Quit :: *s (IOState *s) -> (*s, IOState *s)
+Quit s io
+ = (s, QuitIO io)