home *** CD-ROM | disk | FTP | other *** search
- /*
- * Run a compile, and put the output back into the buffer "*compilation*"
- * in the mg we started from.
- */
-
- options results
- options failat 2
- signal on failure
-
- /* Constant strings */
- clipname = "mg.compile-command"
- bufname = "*compilation*"
- tmpfile = 'ram:'address()
-
- /* I need the suppor library (later) */
- if ~show('Libraries', 'rexxsupport.library') then
- if ~addlib('rexxsupport.library', 0, -30, 0) then do
- 'rexx-display "Can''t open rexx support library!"'
- exit 2
- end
-
- /* Get the command to run, defaulting to any previous value */
- command = getclip(clipname)
- if command = "" then do
- call mgclip clipname
- command = "make -k"
- end
- 'rexx-request "Compile command ('command'): "'
- if rc = 0 then command = result
- call setclip clipname, command
- call mgclip clipname
-
- /* release the editor, and run the compile */
- if savesomebuffers() ~= 0 then signal failure
- 'rexx-display Compiling...'
- 'rexx-unlock'
- address value result
- options failat 20
- address command command '>'tmpfile
-
- /* Get my editor back, and load the buffer with the results */
- options failat 4 /* 4 -> no rexx left; anything less we ignore */
- 'rexx-lock'
- do while rc ~= 0
- call delay 50
- 'rexx-lock'
- end
- address value result
- lockadd = result
- options failat 2
- 'rexx-display "Compilation complete"'
- 'switch-to-buffer-other-window' bufname
- 'not-modified'
- 'kill-buffer' bufname
- 'switch-to-buffer' bufname
- 'insert-file' tmpfile
- 'other-window'
- 'rexx-unlock'
- address command 'delete' tmpfile
- exit 0
-
- failure:
- 'rexx-display "Compilation failed"'
- if exists(tmpfile) then address command 'delete' tmpfile
- if lockadd = address() then 'rexx-unlock'
- exit 2
-