home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / OL.LZH / IDOL.LZH / UNIX.ICN < prev    next >
Text File  |  1991-07-18  |  2KB  |  81 lines

  1. #
  2. # @(#)unix.icn    1.6 3/14/91
  3. # OS-specific code for UNIX Idol
  4. #
  5. global icontopt,env,sysok,comp
  6.  
  7. procedure mysystem(s)
  8.   if \loud then write(s)
  9.   return system(s)
  10. end
  11.  
  12. procedure filename(s,ext)
  13.   s[9:0] := ""
  14.   s ||:= \ext
  15.   return s
  16. end
  17.  
  18. # if the filename s has extension ext then return the filename less the
  19. # extension, otherwise fail.
  20. procedure fileroot(s,ext)
  21.   if s[- *ext : 0] == ext then return s[1 : - *ext]
  22. end
  23.  
  24. procedure writesublink(s)
  25.   writelink(env||"/"||s)
  26. end
  27.  
  28. procedure envpath(filename)
  29.   return env||"/"||filename
  30. end
  31.  
  32. #
  33. # Installation.
  34. # Uses hierarchical filesystem on some systems (see initialize)
  35. #
  36. procedure install(args)
  37.   if "-t" == !args then comp := -2
  38.   write("Installing idol environment in ",env)
  39.   if env ~== "" then mysystem("mkdir "||env)
  40.   fout := envopen("i_object.icn","w")
  41.   write(fout,"record idol_object(__state,__methods)")
  42.   close(fout)
  43.   fout := &null
  44.   cdicont(["i_object"])
  45. end
  46. procedure uninstall(args)
  47.   mysystem("rm -r "||env)
  48. end
  49.  
  50. procedure makeexe(args,i)
  51.   exe := args[i]
  52.   if icont(exe) = \sysok then {
  53.       mysystem("rm "||exe||".icn")
  54.       if \exec then {
  55.     write("Executing:")
  56.     every i := exec+1 to *args do exe ||:= " "||args[i]
  57.     return mysystem(exe)
  58.       } else return
  59.   }
  60. end
  61. #
  62. # system-dependent compilation of idolfile.icn
  63. #   (in the idol subdirectory, if there is one)
  64. #
  65. procedure cdicont(idolfiles)
  66.   if comp = -2 then return                     # -t --> don't translate at all
  67.   args := " -c"
  68.   rms  := ""
  69.   every ifile := !idolfiles do args ||:= " " || ifile
  70.   every ifile := !idolfiles do rms  ||:= " " || ifile || ".icn"
  71.  
  72.   if (rv := icont(args,"cd "||env||"; ")) = \sysok
  73.   then mysystem("cd "||env||"; rm "||rms)
  74.   if \rv = 0 then return rv
  75. end
  76. procedure sysinitialize()
  77.   icontopt := " -Sc500 -Sf600 -Sg600 -Si1200 -Sl400 -Sn2500 -Sr2000 -Ss30000 -St20000 -SC30000 -SF60 -SL1000 "
  78.   env := getenv("IDOLENV") | "idolcode.env"
  79.   sysok := 0
  80. end
  81.