| 1 |
# |
| 2 |
# @(#)mvs.icn 1.3 5/5/90 |
| 3 |
# OS-specific code for MVS Idol |
| 4 |
# Adapted from os2.icn by Alan Beale (4/29/90) |
| 5 |
# Modified by cjeffery (9/27/90) |
| 6 |
# |
| 7 |
global icontopt,cd,md,env,sysok,sysopen |
| 8 |
|
| 9 |
procedure mysystem(s) |
| 10 |
if \loud then write(s) |
| 11 |
return system(s) |
| 12 |
end |
| 13 |
|
| 14 |
procedure filename(s,ext) |
| 15 |
s $<9:0$> := "" |
| 16 |
if \ext then return qualify(map(s, "_", "#"),ext) |
| 17 |
else return map(s, "_", "#") |
| 18 |
end |
| 19 |
procedure writesublink(s) |
| 20 |
writelink(qualify(map(s, "_", "#"),".u1")) |
| 21 |
end |
| 22 |
procedure envpath(filename) |
| 23 |
return filename |
| 24 |
end |
| 25 |
# |
| 26 |
# Installation. |
| 27 |
# Uses hierarchical filesystem on some systems (see initialize) |
| 28 |
# |
| 29 |
procedure install(args) |
| 30 |
fout := envopen("i#object.icn","w") |
| 31 |
write(fout,"record idol_object(__state,__methods)") |
| 32 |
close(fout) |
| 33 |
fout := &null |
| 34 |
cdicont($<"i#object"$>) |
| 35 |
end |
| 36 |
procedure uninstall(args) |
| 37 |
# not implemented yet |
| 38 |
end |
| 39 |
|
| 40 |
procedure makeexe(args,i) |
| 41 |
exe := args$<i$> |
| 42 |
if icont(exe) = \sysok then { |
| 43 |
mysystem("delete "||qualify(exe, ".icn")) |
| 44 |
if \exec then { |
| 45 |
write("Executing:") |
| 46 |
exe := "iconx "||exe |
| 47 |
every i := exec+1 to *args do exe ||:= " "||args$<i$> |
| 48 |
mysystem(exe) |
| 49 |
} |
| 50 |
} |
| 51 |
end |
| 52 |
# |
| 53 |
# system-dependent compilation of idolfile.icn |
| 54 |
# (in the idol subdirectory, if there is one) |
| 55 |
# |
| 56 |
procedure cdicont(idolfiles) |
| 57 |
|
| 58 |
if comp = -2 then return # -t --> don't call icont at all |
| 59 |
args := " -c" |
| 60 |
every ifile := !idolfiles do args ||:= " " || ifile |
| 61 |
mysystem("icont " || args) |
| 62 |
return |
| 63 |
end |
| 64 |
# |
| 65 |
# force .icn files to receive large line size, hoping to avoid |
| 66 |
# output line splitting |
| 67 |
# |
| 68 |
procedure myopen(file, mode) |
| 69 |
if not(f := open(file,mode,if mode ~== "r" then |
| 70 |
"recfm=v,reclen=4000" else &null)) then |
| 71 |
halt("Couldn't open file ", file, " for mode ", mode) |
| 72 |
return f |
| 73 |
end |
| 74 |
# |
| 75 |
# generate a file name from a root and a qualifier. This procedure |
| 76 |
# is required in MVS due to the file.icn(member) syntax! |
| 77 |
# |
| 78 |
procedure qualify(root, qual) |
| 79 |
if (i := upto('(', root)) then |
| 80 |
return root$<1:i$> || qual || root$<i:0$> |
| 81 |
else return root || qual |
| 82 |
end |
| 83 |
# |
| 84 |
# remove a qualifier from a file name (but leave any member name |
| 85 |
# intact). Fail if qualifier not found. |
| 86 |
# |
| 87 |
procedure fileroot(name, qual) |
| 88 |
if not (i := find(qual, name)) then fail |
| 89 |
if name$<i+*qual$> ~== "(" then fail |
| 90 |
name$<i+:*qual$> := "" |
| 91 |
return name |
| 92 |
end |
| 93 |
|
| 94 |
procedure sysinitialize() |
| 95 |
icontopt := " -Sr500 -SF30 -Si1000 " |
| 96 |
sysok := 0 |
| 97 |
sysopen := myopen |
| 98 |
end |
| 99 |
|