home *** CD-ROM | disk | FTP | other *** search
/ Amiga Elysian Archive / AmigaElysianArchive.iso / prog / c / sas2ced5.lha / compile.s2c < prev    next >
Text File  |  1992-03-21  |  2KB  |  90 lines

  1. /**
  2.  ** $VER: compile.s2c 2.0 (19.12.91)
  3.  **
  4.  ** for sas2ced v2.2
  5.  **
  6.  ** Written by Doug Keller
  7.  **/
  8.  
  9. address 'rexx_ced'
  10.  
  11. options results
  12.  
  13. /* If you are not using wshell using this line, and comment the next line
  14.  
  15. UserShell = 'Newshell "con:100/217/500/255/AmigaShell/alt100,18,500,454/close"'
  16. */
  17.  
  18. UserShell = 'NewWsh "con:100/217/500/255/WShell/alt100,18,500,454/close"'
  19.  
  20. 'status 18'
  21. if result ~= 0 then do
  22.     'status 21'
  23.     isfn=result
  24.     'save'
  25.     if result = 0 then do
  26.         if isfn > 0 then do
  27.             okay1 "Save Error- File not saved"
  28.             exit
  29.             end
  30.         end
  31.     end
  32.  
  33. command= '18'X || 'lmk' || '0d'X
  34.  
  35. 'status 19'
  36. filename=result
  37.  
  38. if open('infile', filename, 'r') = 0 then exit
  39.  
  40. do for 10
  41.     line=readln('infile')
  42.     lpos=pos('compile:', line)
  43.     if lpos ~= 0 then do
  44.         command= '18'X || strip(substr(line, lpos+8),'l', ' ') || '0d'X
  45.  
  46.         lpos=pos('$*', command)
  47.         if lpos ~= 0 then do
  48.             command= delstr(command, lpos, 2)
  49.             'status 21'
  50.             command= insert(result,command,lpos-1)
  51.             end
  52.         leave
  53.         end
  54.     end
  55. close('infile')
  56.  
  57.  
  58. if command == ('18'X || 'lmk' || '0d'X) then do
  59.     'status 20'
  60.     path=result
  61.     if( 0=(exists(path || '/lmkfile') | exists(path || '/makefile') | exists(path || 'makefile') | exists(path || 'lmkfile'))) then do
  62.         'status 21'
  63.         command = '18'X || 'lc -L ' || result || '0d'X
  64.         end
  65.     end
  66.  
  67. if command == ('18'X || '0d'X) then command= '18'X || 'lmk' || '0d'X
  68.  
  69. 'status 20'
  70. path=result
  71.  
  72. address 'SAS2CED'
  73. 'compile' '"'path'"' command    /* Make sure path is QUOTED */
  74.  
  75. if RC = 5 then do
  76.     if open('s2ctemp', 't:s2c_temp', 'w') then do
  77.         d=writeln('s2ctemp', "execute s:wshell-startup")
  78.         tpath= 'cd ' || path
  79.         d=writeln('s2ctemp', tpath)
  80.         d=close('s2ctemp')
  81.         address command UserShell || 'from t:s2c_temp'
  82.  
  83.         'compile' '"'path'"' command    /* Make sure path is QUOTED */
  84.         do for 5 until RC ~= 5
  85.             address command 'wait'
  86.             'compile' '"'path'"' command    /* Make sure path is QUOTED */
  87.             end
  88.         end
  89.     end
  90.