home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / historic / v941.tgz / icon.v941src.tar / icon.v941src / ipl / packs / idol / idol.hqx / mpw.icn < prev    next >
Text File  |  1994-06-08  |  2KB  |  97 lines

  1. #
  2. # @(#)mpw.icn    1.5 10/28/93
  3. # @(#)mpw.icn    1.4 5/5/90
  4. # OS-specific code for Macintosh MPW
  5. # Adapted from unix.icn by Charles Lakos
  6. # Modified by Bob Alexander 10/28/93
  7. #
  8. global icontopt,env,sysok
  9.  
  10. procedure mysystem(s)
  11.   if \loud then write(s)
  12.   return system(s)
  13. end
  14.  
  15. procedure filename(s,ext)
  16.   s ||:= \ext
  17.   return s
  18. end
  19.  
  20. # if the filename s has extension ext then return the filename less the
  21. # extension, otherwise fail.
  22. procedure fileroot(s,ext)
  23.   if s[- *ext : 0] == ext then return s[1 : - *ext]
  24. end
  25.  
  26. procedure writesublink(s)
  27.   writelink(env||"_"||s)
  28. end
  29.  
  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 with prefix ",env)
  39.   fout := envopen("i_object.icn","w")
  40.   write(fout,"record idol_object(__state,__methods)")
  41.   close(fout)
  42.   fout := &null
  43.   cdicont(["i_object"])
  44. end
  45.  
  46. procedure uninstall(args)
  47.   # not implemented yet
  48. end
  49.  
  50. procedure makeexe(args,i)
  51.   exe := args[i]
  52.   if icont(exe) = \sysok then {
  53.       mysystem("delete "||exe||".icn")
  54.       if \exec then {
  55.     write("Executing:")
  56.     every i := exec+1 to *args do exe ||:= " "||args[i]
  57.     mysystem(exe)
  58.       }
  59.   }
  60.   return
  61. end
  62.  
  63. #
  64. # system-dependent compilation of idolfile.icn
  65. #   (in the idol subdirectory, if there is one)
  66. #
  67. procedure cdicont(idolfiles)
  68.   args := " -c"
  69.   rms  := ""
  70.   every ifile := !idolfiles do args ||:= " " || envpath(ifile)
  71.   every ifile := !idolfiles do rms  ||:= " " || envpath(ifile) || ".icn"
  72.  
  73.   if comp = -2 then return  # -t --> don't translate at all
  74.   if icont(args,"") = \sysok
  75.   then mysystem("delete "||rms)
  76.   return
  77. end
  78.  
  79. procedure sysinitialize()
  80.   icontopt := " "
  81.   env:= "C"
  82.   sysok := 0
  83.   loud := &null
  84. end
  85.  
  86. procedure system(s)
  87.   local fn
  88.   static f
  89.   initial {
  90.     fn := "idol.commands"
  91.     f := open(fn,"w") | stop("Can't open ",fn," for output")
  92.     write(f,"set echo 1")
  93.   }
  94.   write(f,s)
  95.   return sysok
  96. end
  97.