mirror of
https://github.com/dschmenk/PLASMA.git
synced 2024-10-18 22:24:28 +00:00
Default output file
This commit is contained in:
parent
a8f7149bb7
commit
ad8c954ecb
@ -383,7 +383,7 @@ end
|
|||||||
//
|
//
|
||||||
// Emit lambda function
|
// Emit lambda function
|
||||||
//
|
//
|
||||||
def emit_lambdafunc(tag, namestr, cparms, lambda_seq)#0
|
def emit_lambdafunc(tag, cparms, lambda_seq)#0
|
||||||
emit_ctag(tag)
|
emit_ctag(tag)
|
||||||
framesize = cparms * 2
|
framesize = cparms * 2
|
||||||
emit_enter(cparms)
|
emit_enter(cparms)
|
||||||
@ -759,3 +759,19 @@ def gen_bop(tkn, seq)
|
|||||||
op->opgroup = STACK_GROUP
|
op->opgroup = STACK_GROUP
|
||||||
return seq
|
return seq
|
||||||
end
|
end
|
||||||
|
//
|
||||||
|
// Write REL file
|
||||||
|
//
|
||||||
|
def writemodule(refnum)#0
|
||||||
|
//
|
||||||
|
// Build module header
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// Write data/code buffer
|
||||||
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// Write relocation directory
|
||||||
|
//
|
||||||
|
end
|
||||||
|
@ -1179,7 +1179,7 @@ def parse_defs
|
|||||||
return TRUE
|
return TRUE
|
||||||
while lambda_cnt
|
while lambda_cnt
|
||||||
lambda_cnt--
|
lambda_cnt--
|
||||||
emit_lambdafunc(lambda_tag[lambda_cnt], @lambda_id[lambda_cnt * 8], lambda_cparms[lambda_cnt], lambda_seq[lambda_cnt])
|
emit_lambdafunc(lambda_tag[lambda_cnt], lambda_cparms[lambda_cnt], lambda_seq[lambda_cnt])
|
||||||
loop
|
loop
|
||||||
fin
|
fin
|
||||||
return token == EOL_TKN ?? TRUE :: FALSE
|
return token == EOL_TKN ?? TRUE :: FALSE
|
||||||
|
@ -262,11 +262,10 @@ word srcline // Saved source line number
|
|||||||
//
|
//
|
||||||
// Scanner variables
|
// Scanner variables
|
||||||
//
|
//
|
||||||
//const inbuff = $0200
|
const inbuff = $0200
|
||||||
//const instr = $01FF
|
const instr = $01FF
|
||||||
//word scanptr = inbuff
|
word scanptr = inbuff
|
||||||
byte token = EOL_TKN
|
byte token = EOL_TKN
|
||||||
word instr, inbuff, scanptr
|
|
||||||
byte scanchr, tknlen
|
byte scanchr, tknlen
|
||||||
word tknptr, parserrln
|
word tknptr, parserrln
|
||||||
word constval
|
word constval
|
||||||
@ -389,8 +388,6 @@ end
|
|||||||
// Include code to reduce size of this file
|
// Include code to reduce size of this file
|
||||||
//
|
//
|
||||||
include "toolsrc/codegen.pla"
|
include "toolsrc/codegen.pla"
|
||||||
//include "toolsrc/codeopt.pla"
|
|
||||||
//include "toolsrc/writerel.pla"
|
|
||||||
include "toolsrc/lex.pla"
|
include "toolsrc/lex.pla"
|
||||||
include "toolsrc/parse.pla"
|
include "toolsrc/parse.pla"
|
||||||
//
|
//
|
||||||
@ -429,8 +426,23 @@ fin
|
|||||||
if arg
|
if arg
|
||||||
strcpy(@srcfile, arg)
|
strcpy(@srcfile, arg)
|
||||||
arg = argNext(arg)
|
arg = argNext(arg)
|
||||||
if arg
|
if arg and ^arg
|
||||||
strcpy(@relfile, arg)
|
strcpy(@relfile, arg)
|
||||||
|
else
|
||||||
|
strcpy(@relfile, @srcfile)
|
||||||
|
//
|
||||||
|
// Strip trailing extension
|
||||||
|
//
|
||||||
|
while relfile and relfile[relfile] <> '.'
|
||||||
|
relfile--
|
||||||
|
loop
|
||||||
|
if relfile; relfile--; fin // Strip '.'
|
||||||
|
if not relfile
|
||||||
|
//
|
||||||
|
// Copy default name over
|
||||||
|
//
|
||||||
|
strcpy(@relfile, "A.OUT")
|
||||||
|
fin
|
||||||
fin
|
fin
|
||||||
fin
|
fin
|
||||||
if srcfile and relfile
|
if srcfile and relfile
|
||||||
@ -439,9 +451,7 @@ if srcfile and relfile
|
|||||||
fileio:newline(srcref, $7F, $0D)
|
fileio:newline(srcref, $7F, $0D)
|
||||||
refnum = srcref
|
refnum = srcref
|
||||||
parsefile = @srcfile
|
parsefile = @srcfile
|
||||||
instr = heapalloc(128)
|
|
||||||
*instr = 0
|
*instr = 0
|
||||||
inbuff = instr + 1
|
|
||||||
scanptr = inbuff
|
scanptr = inbuff
|
||||||
exit = heapalloc(t_longjmp)
|
exit = heapalloc(t_longjmp)
|
||||||
if not setjmp(exit)
|
if not setjmp(exit)
|
||||||
@ -458,7 +468,7 @@ if srcfile and relfile
|
|||||||
fileio:create(@relfile, $FE, $1000) // full access, REL file
|
fileio:create(@relfile, $FE, $1000) // full access, REL file
|
||||||
srcref = fileio:open(@relfile)
|
srcref = fileio:open(@relfile)
|
||||||
if srcref
|
if srcref
|
||||||
//writerel(srcref)
|
writemodule(srcref)
|
||||||
fileio:close(srcref)
|
fileio:close(srcref)
|
||||||
else
|
else
|
||||||
puts("\nError opening: "); puts(@relfile); putln
|
puts("\nError opening: "); puts(@relfile); putln
|
||||||
@ -468,6 +478,6 @@ if srcfile and relfile
|
|||||||
puts("\nError opening: "); puts(@srcfile); putln
|
puts("\nError opening: "); puts(@srcfile); putln
|
||||||
fin
|
fin
|
||||||
else
|
else
|
||||||
puts("Usage:+PLASM [-[W][O[2]][N]] <src> <rel>\n")
|
puts("Usage:+PLASM [-[W][O[2]][N]] <src> [out]\n")
|
||||||
fin
|
fin
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user