| 1 |
# |
| 2 |
# @(#)mpw.icn 1.4 5/5/90 |
| 3 |
# OS-specific code for Macintosh MPW |
| 4 |
# Adapted from unix.icn by Charles Lakos |
| 5 |
# |
| 6 |
global icontopt,env,sysok |
| 7 |
|
| 8 |
procedure mysystem(s) |
| 9 |
if \loud then write(s) |
| 10 |
return system(s) |
| 11 |
end |
| 12 |
|
| 13 |
procedure filename(s,ext) |
| 14 |
s ||:= \ext |
| 15 |
return s |
| 16 |
end |
| 17 |
# if the filename s has extension ext then return the filename less the |
| 18 |
# extension, otherwise fail. |
| 19 |
procedure fileroot(s,ext) |
| 20 |
if s[- *ext : 0] == ext then return s[1 : - *ext] |
| 21 |
end |
| 22 |
procedure writesublink(s) |
| 23 |
writelink(env||"_"||s) |
| 24 |
end |
| 25 |
procedure envpath(filename) |
| 26 |
return env||"_"||filename |
| 27 |
end |
| 28 |
# |
| 29 |
# Installation. |
| 30 |
# Uses hierarchical filesystem on some systems (see initialize) |
| 31 |
# |
| 32 |
procedure install(args) |
| 33 |
write("Installing idol environment with prefix ",env) |
| 34 |
fout := envopen("i_object.icn","w") |
| 35 |
write(fout,"record idol_object(__state,__methods)") |
| 36 |
close(fout) |
| 37 |
fout := &null |
| 38 |
cdicont(["i_object"]) |
| 39 |
end |
| 40 |
procedure uninstall(args) |
| 41 |
# not implemented yet |
| 42 |
end |
| 43 |
|
| 44 |
procedure makeexe(args,i) |
| 45 |
exe := args[i] |
| 46 |
if icont(exe) = \sysok then { |
| 47 |
mysystem("delete "||exe||".icn") |
| 48 |
if \exec then { |
| 49 |
write("Executing:") |
| 50 |
every i := exec+1 to *args do exe ||:= " "||args[i] |
| 51 |
mysystem(exe) |
| 52 |
} |
| 53 |
} |
| 54 |
end |
| 55 |
# |
| 56 |
# system-dependent compilation of idolfile.icn |
| 57 |
# (in the idol subdirectory, if there is one) |
| 58 |
# |
| 59 |
procedure cdicont(idolfiles) |
| 60 |
args := " -c" |
| 61 |
rms := "" |
| 62 |
every ifile := !idolfiles do args ||:= " " || envpath(ifile) |
| 63 |
every ifile := !idolfiles do rms ||:= " " || envpath(ifile) || ".icn" |
| 64 |
|
| 65 |
if comp = -2 then return # -t --> don't translate at all |
| 66 |
if icont(args,"") = \sysok |
| 67 |
then mysystem("delete "||rms) |
| 68 |
return |
| 69 |
end |
| 70 |
procedure sysinitialize() |
| 71 |
icontopt := " -Sr500 -SF30 -Si1000 " |
| 72 |
env:= "C" |
| 73 |
sysok := 0 |
| 74 |
loud := &null |
| 75 |
write(&errout) |
| 76 |
write(&errout, "*** Select and run the following commands ***") |
| 77 |
write(&errout) |
| 78 |
end |
| 79 |
|
| 80 |
procedure system(s) |
| 81 |
write(&errout,s) |
| 82 |
return sysok |
| 83 |
end |