Debian Codegraph @

ipl/packs/idol/msdos.icn

raw
1 #
2 # @(#)msdos.icn 1.5 5/5/90
3 # OS-specific code for MS-DOS Idol
4 #
5 # For systems which cannot run icont from within an Icon program,
6 # the approach is for Idol to generate a script/batch file to do this.
7 #
8 global icontopt,cd,md,env,sysok,batfile
9
10 procedure mysystem(s)
11 if /batfile then batfile := open("idolt.bat","w")
12 if \loud then write(s)
13 write(batfile,s)
14 return sysok # system(s) # MS-DOS Icon is generally too big to use system()
15 end
16
17 procedure filename(s,ext)
18 s[9:0] := ""
19 s ||:= \ext
20 return s
21 end
22 # if the filename s has extension ext then return the filename less the
23 # extension, otherwise fail.
24 procedure fileroot(s,ext)
25 if s[- *ext : 0] == ext then return s[1 : - *ext]
26 end
27 procedure writesublink(s)
28 writelink(env||"\\\\"||s)
29 end
30 procedure envpath(filename)
31 return env||"\\"||filename
32 end
33 #
34 # Installation.
35 # Uses hierarchical filesystem on some systems (see initialize)
36 #
37 procedure install(args)
38 write("Installing idol environment in ",env)
39 if env ~== "" then mysystem(md||env)
40 if fout := envopen("i_object.icn","w") then {
41 write(fout,"record idol_object(__state,__methods)")
42 close(fout)
43 } else {
44 if not (fout := open("i_object.icn","w")) then stop("can't open i_object")
45 write(fout,"record idol_object(__state,__methods)")
46 close(fout)
47 mysystem("copy i_object.icn "||env)
48 mysystem("del i_object.icn")
49 }
50 fout := &null
51 cdicont(["i_object"])
52 end
53 procedure uninstall(args)
54 # not implemented yet
55 end
56
57 procedure makeexe(args,i)
58 exe := args[i]
59 if icont(exe) = \sysok then {
60 if \exec then {
61 write("Executing:")
62 exe := "iconx "||exe
63 every i := exec+1 to *args do exe ||:= " "||args[i]
64 mysystem(exe)
65 }
66 }
67 end
68 #
69 # system-dependent compilation of idolfile.icn
70 # (in the idol subdirectory, if there is one)
71 #
72 procedure cdicont(idolfiles)
73 if comp = -2 then return # -t --> don't call icont at all
74 args := " -c"
75 rms := ""
76 every ifile := !idolfiles do args ||:= " " || ifile
77 every ifile := !idolfiles do rms ||:= " " || ifile || ".icn"
78
79 mysystem("cd idolcode.env")
80 icont(args)
81 mysystem("cd ..")
82 return
83 end
84 procedure sysinitialize()
85 icontopt := " -Sr500 -SF30 -Si1000 "
86 cd := "cd "
87 md := "mkdir "
88 env := getenv("IDOLENV") | "idolcode.env"
89 sysok := 0
90 end