summaryrefslogtreecommitdiff
path: root/ipl/packs/idol/unix.icn
diff options
context:
space:
mode:
Diffstat (limited to 'ipl/packs/idol/unix.icn')
-rw-r--r--ipl/packs/idol/unix.icn80
1 files changed, 80 insertions, 0 deletions
diff --git a/ipl/packs/idol/unix.icn b/ipl/packs/idol/unix.icn
new file mode 100644
index 0000000..3f2e4af
--- /dev/null
+++ b/ipl/packs/idol/unix.icn
@@ -0,0 +1,80 @@
+#
+# @(#)unix.icn 1.6 3/14/91
+# OS-specific code for UNIX Idol
+#
+global icontopt,env,sysok,comp
+
+procedure mysystem(s)
+ if \loud then write(s)
+ return system(s)
+end
+
+procedure filename(s,ext)
+ s[9:0] := ""
+ s ||:= \ext
+ return s
+end
+
+# if the filename s has extension ext then return the filename less the
+# extension, otherwise fail.
+procedure fileroot(s,ext)
+ if s[- *ext : 0] == ext then return s[1 : - *ext]
+end
+
+procedure writesublink(s)
+ writelink(env||"/"||s)
+end
+
+procedure envpath(filename)
+ return env||"/"||filename
+end
+
+#
+# Installation.
+# Uses hierarchical filesystem on some systems (see initialize)
+#
+procedure install(args)
+ if "-t" == !args then comp := -2
+ write("Installing idol environment in ",env)
+ if env ~== "" then mysystem("mkdir "||env)
+ fout := envopen("i_object.icn","w")
+ write(fout,"record idol_object(__state,__methods)")
+ close(fout)
+ fout := &null
+ cdicont(["i_object"])
+end
+procedure uninstall(args)
+ mysystem("rm -r "||env)
+end
+
+procedure makeexe(args,i)
+ exe := args[i]
+ if icont(exe) = \sysok then {
+ mysystem("rm "||exe||".icn")
+ if \exec then {
+ write("Executing:")
+ every i := exec+1 to *args do exe ||:= " "||args[i]
+ return mysystem(exe)
+ } else return
+ }
+end
+#
+# system-dependent compilation of idolfile.icn
+# (in the idol subdirectory, if there is one)
+#
+procedure cdicont(idolfiles)
+ if comp = -2 then return # -t --> don't translate at all
+ args := " -c"
+ rms := ""
+ every ifile := !idolfiles do args ||:= " " || ifile
+ every ifile := !idolfiles do rms ||:= " " || ifile || ".icn"
+
+ if (rv := icont(args,"cd "||env||"; ")) = \sysok
+ then mysystem("cd "||env||"; rm "||rms)
+ if \rv = 0 then return rv
+end
+procedure sysinitialize()
+ icontopt := " -s "
+ env := getenv("IDOLENV") | "idolcode.env"
+ sysok := 0
+end