/* OberonC - Compiliert Oberon Programme */

if ~show('L','rexxsupport.library') then
   call addlib('rexxsupport.library',0,-30)

'top first'
'find MODULE' ; 'wright'
'scanf %[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789]'
'chfilename $scanf.mod'
'setenv ModName $scanf'

open('file','env:modname','R')
filename = readln('file')
close('file')
'unsetenv modname'

opts = ''
open('file','env:OProject','R')
project = readln('file')
close('file')

IF open('file','env:'||project||'.OCopt','R') THEN DO
  copts = readln('file')
  close('file')
  END;

'if m (top first find Date wright remeol ('||date() time()||'))'
if project = '' then
  'if m (saveold saveas oberon:txt/$filename)'
else
  'if m (saveold saveas oberon:'||project||'/txt/$filename)'

call close 'STDERR'
call open 'STDERR','NIL:','W'
call close 'STDIN'
call close 'STDOUT'
call open 'STDOUT','CON:25/15/640/256/RexxCon','RW'
call pragma '*','STDOUT'

address command 'oberon >* <*' copts filename

delay(100)
close('STDOUT')
'ReadErrs'


