1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-01-01 06:32:07 +00:00

Text formatting clean-up

This commit is contained in:
David Schmenk 2017-12-17 13:55:29 -08:00
parent 6c0147819c
commit 5fe534f6b1
3 changed files with 147 additions and 151 deletions

View File

@ -79,7 +79,7 @@ word strlinbuf = $1000
word strpoolmap = $1F00 word strpoolmap = $1F00
word strpoolmsz = 224 // $E0 = 28K is memory@16 bytes per bit map, 128 bytes per 8 bit map, 1K bytes per 8 byte map word strpoolmsz = 224 // $E0 = 28K is memory@16 bytes per bit map, 128 bytes per 8 bit map, 1K bytes per 8 byte map
word strpool = $4800 word strpool = $4800
word strpoolsz = $7000 word strpoolsz = $7000
byte flags = 0 byte flags = 0
byte flash = 0 byte flash = 0
word numlines = 0 word numlines = 0
@ -96,7 +96,7 @@ predef cmdmode
// Defines for ASM routines // Defines for ASM routines
// //
asm equates asm equates
!SOURCE "vmsrc/plvmzp.inc" !SOURCE "vmsrc/plvmzp.inc"
end end
//def toupper(c) //def toupper(c)
// if c >= 'a' // if c >= 'a'
@ -217,7 +217,7 @@ def newstr(strptr)
strlen = ^strptr strlen = ^strptr
while (strptr).[strlen] == $8D or (strptr).[strlen] == $A0 while (strptr).[strlen] == $8D or (strptr).[strlen] == $A0
strlen = strlen - 1 strlen--
loop loop
if strlen == 0 if strlen == 0
return @nullstr return @nullstr
@ -238,7 +238,6 @@ def inittxtbuf#0
strpoolmsz = 224 // $E0 = 28K is memory@16 bytes per bit map, 128 bytes per 8 bit map, 1K bytes per 8 byte map strpoolmsz = 224 // $E0 = 28K is memory@16 bytes per bit map, 128 bytes per 8 bit map, 1K bytes per 8 byte map
strpool = $4800 strpool = $4800
strpoolsz = $7000 strpoolsz = $7000
memset(strpoolmap, strheapmsz, 0) memset(strpoolmap, strheapmsz, 0)
memset(strlinbuf, maxfill * 2, @nullstr) memset(strlinbuf, maxfill * 2, @nullstr)
numlines = 1 numlines = 1
@ -297,14 +296,6 @@ def txtlower#0
strlower(strlinbuf:[i]) strlower(strlinbuf:[i])
next next
end end
def prbyte(h)#0
cout('$')
call($FDDA, h, 0, 0, 0)
end
def prword(h)#0
cout('$')
call($F941, h >> 8, h, 0, 0)
end
def print(i)#0 def print(i)#0
byte numstr[7] byte numstr[7]
byte place, sign byte place, sign
@ -319,13 +310,13 @@ def print(i)#0
while i >= 10 while i >= 10
numstr[place] = i % 10 + '0' numstr[place] = i % 10 + '0'
i = i / 10 i = i / 10
place = place - 1 place--
loop loop
numstr[place] = i + '0' numstr[place] = i + '0'
place = place - 1 place--
if sign if sign
numstr[place] = '-' numstr[place] = '-'
place = place - 1 place--
fin fin
numstr[place] = 6 - place numstr[place] = 6 - place
puts(@numstr[place]) puts(@numstr[place])
@ -340,27 +331,27 @@ end
def readtxt(filename)#0 def readtxt(filename)#0
byte txtbuf[81], refnum, i, j byte txtbuf[81], refnum, i, j
refnum = open(filename, sysbuf) refnum = fileio:open(filename)
if refnum if refnum
newline(refnum, $7F, $0D) newline(refnum, $7F, $0D)
repeat repeat
txtbuf = read(refnum, @txtbuf + 1, maxlnlen) txtbuf = fileio:read(refnum, @txtbuf + 1, maxlnlen)
if txtbuf if txtbuf
sethibit(@txtbuf) sethibit(@txtbuf)
if flags & uppercase; strupper(@txtbuf); fin if flags & uppercase; strupper(@txtbuf); fin
strlinbuf:[numlines] = newstr(@txtbuf) strlinbuf:[numlines] = newstr(@txtbuf)
numlines = numlines + 1 numlines++
fin fin
if !(numlines & $0F); cout('.'); fin if !(numlines & $0F); cout('.'); fin
until txtbuf == 0 or numlines == maxlines until txtbuf == 0 or numlines == maxlines
close(refnum) fileio:close(refnum)
// //
// Make sure there is a blank line at the end of the buffer // Make sure there is a blank line at the end of the buffer
// //
if numlines < maxlines and strlinbuf:[numlines - 1] <> @nullstr if numlines < maxlines and strlinbuf:[numlines - 1] <> @nullstr
strlinbuf:[numlines] = @nullstr strlinbuf:[numlines] = @nullstr
numlines = numlines + 1 numlines++
fin fin
fin fin
end end
def writetxt(filename)#0 def writetxt(filename)#0
@ -368,9 +359,9 @@ def writetxt(filename)#0
byte j, chr byte j, chr
word i, strptr word i, strptr
destroy(filename) fileio:destroy(filename)
create(filename, $C3, $04, $00) // full access, TXT file fileio:create(filename, $04, $00) // full access, TXT file
refnum = open(filename, sysbuf) refnum = fileio:open(filename)
if refnum == 0 if refnum == 0
return return
fin fin
@ -385,15 +376,15 @@ def writetxt(filename)#0
cpyln(strlinbuf:[i], @txtbuf) cpyln(strlinbuf:[i], @txtbuf)
txtbuf = txtbuf + 1 txtbuf = txtbuf + 1
txtbuf[txtbuf] = $0D txtbuf[txtbuf] = $0D
write(refnum, @txtbuf + 1, txtbuf) fileio:write(refnum, @txtbuf + 1, txtbuf)
if !(i & $0F); cout('.'); fin if !(i & $0F); cout('.'); fin
next next
close(refnum) fileio:close(refnum)
end end
// //
// Screen routines // Screen routines
// //
def clrscrn@0 def clrscrn#0
call($FC58, 0, 0, 0, 0) call($FC58, 0, 0, 0, 0)
end end
def drawrow(row, ofst, strptr)#0 def drawrow(row, ofst, strptr)#0
@ -420,30 +411,30 @@ def drawscrn(toprow, ofst)#0
if ofst if ofst
for row = 0 to 23 for row = 0 to 23
strptr = strlinbuf:[toprow + row] strptr = strlinbuf:[toprow + row]
scrnptr = txtscrn[row] scrnptr = txtscrn[row]
if ofst >= ^strptr if ofst >= ^strptr
numchars = 0 numchars = 0
else else
numchars = ^strptr - ofst numchars = ^strptr - ofst
fin fin
if numchars >= 40 if numchars >= 40
numchars = 40 numchars = 40
else else
memset(scrnptr + numchars, 40 - numchars, $A0A0) memset(scrnptr + numchars, 40 - numchars, $A0A0)
fin fin
memcpy(scrnptr, strptr + ofst + 1, numchars) memcpy(scrnptr, strptr + ofst + 1, numchars)
next next
else else
for row = 0 to 23 for row = 0 to 23
strptr = strlinbuf:[toprow + row] strptr = strlinbuf:[toprow + row]
scrnptr = txtscrn[row] scrnptr = txtscrn[row]
numchars = ^strptr numchars = ^strptr
if numchars >= 40 if numchars >= 40
numchars = 40 numchars = 40
else else
memset(scrnptr + numchars, 40 - numchars, $A0A0) memset(scrnptr + numchars, 40 - numchars, $A0A0)
fin fin
memcpy(scrnptr, strptr + 1, numchars) memcpy(scrnptr, strptr + 1, numchars)
next next
fin fin
end end
@ -507,9 +498,9 @@ end
def cursup#0 def cursup#0
if cursrow > 0 if cursrow > 0
cursoff cursoff
cursrow = cursrow - 1 cursrow--
if cursy > 0 if cursy > 0
cursy = cursy - 1 cursy--
else else
scrntop = cursrow scrntop = cursrow
drawscrn(scrntop, scrnleft) drawscrn(scrntop, scrnleft)
@ -527,9 +518,9 @@ end
def cursdown#0 def cursdown#0
if cursrow < numlines - 1 if cursrow < numlines - 1
cursoff cursoff
cursrow = cursrow + 1 cursrow++
if cursy < 23 if cursy < 23
cursy = cursy + 1 cursy++
else else
scrntop = cursrow - 23 scrntop = cursrow - 23
drawscrn(scrntop, scrnleft) drawscrn(scrntop, scrnleft)
@ -547,9 +538,9 @@ end
def cursleft#0 def cursleft#0
if curscol > 0 if curscol > 0
cursoff cursoff
curscol = curscol - 1 curscol--
if cursx > 0 if cursx > 0
cursx = cursx - 1 cursx--
else else
scrnleft = curscol scrnleft = curscol
drawscrn(scrntop, scrnleft) drawscrn(scrntop, scrnleft)
@ -567,9 +558,9 @@ end
def cursright#0 def cursright#0
if curscol < 80 if curscol < 80
cursoff cursoff
curscol = curscol + 1 curscol++
if cursx < 39 if cursx < 39
cursx = cursx + 1 cursx++
else else
scrnleft = curscol - 39 scrnleft = curscol - 39
drawscrn(scrntop, scrnleft) drawscrn(scrntop, scrnleft)
@ -651,7 +642,7 @@ def openline(row)
if numlines < maxlines if numlines < maxlines
memcpy(@strlinbuf:[row + 1], @strlinbuf:[row], (numlines - row) * 2) memcpy(@strlinbuf:[row + 1], @strlinbuf:[row], (numlines - row) * 2)
strlinbuf:[row] = @nullstr strlinbuf:[row] = @nullstr
numlines = numlines + 1 numlines++
flags = flags | changed flags = flags | changed
return TRUE return TRUE
fin fin
@ -663,7 +654,7 @@ def cutline#0
cutbuf = strlinbuf:[cursrow] cutbuf = strlinbuf:[cursrow]
memcpy(@strlinbuf:[cursrow], @strlinbuf:[cursrow + 1], (numlines - cursrow) * 2) memcpy(@strlinbuf:[cursrow], @strlinbuf:[cursrow + 1], (numlines - cursrow) * 2)
if numlines > 1 if numlines > 1
numlines = numlines - 1 numlines--
fin fin
flags = flags | changed flags = flags | changed
if cursrow == numlines if cursrow == numlines
@ -675,7 +666,7 @@ def pasteline#0
if cutbuf and numlines < maxlines if cutbuf and numlines < maxlines
memcpy(@strlinbuf:[cursrow + 1], @strlinbuf:[cursrow], (numlines - cursrow) * 2) memcpy(@strlinbuf:[cursrow + 1], @strlinbuf:[cursrow], (numlines - cursrow) * 2)
strlinbuf:[cursrow] = newstr(cutbuf) strlinbuf:[cursrow] = newstr(cutbuf)
numlines = numlines + 1 numlines++
flags = flags | changed flags = flags | changed
redraw redraw
else else
@ -694,7 +685,7 @@ def joinline#0
freestr(strlinbuf:[cursrow]) freestr(strlinbuf:[cursrow])
strlinbuf:[cursrow] = newstr(@joinstr) strlinbuf:[cursrow] = newstr(@joinstr)
freestr(strlinbuf:[cursrow + 1]) freestr(strlinbuf:[cursrow + 1])
numlines = numlines - 1 numlines--
memcpy(@strlinbuf:[cursrow + 1], @strlinbuf:[cursrow + 2], (numlines - cursrow) * 2) memcpy(@strlinbuf:[cursrow + 1], @strlinbuf:[cursrow + 2], (numlines - cursrow) * 2)
flags = flags | changed flags = flags | changed
redraw redraw
@ -757,34 +748,34 @@ def editline(key)
if curscol > 0 if curscol > 0
if curscol <= editstr if curscol <= editstr
memcpy(@editstr[curscol], @editstr[curscol + 1], editstr - curscol) memcpy(@editstr[curscol], @editstr[curscol + 1], editstr - curscol)
editstr = editstr - 1 editstr--
fin fin
curscol = curscol - 1 curscol--
cursoff cursoff
if cursx > 0 if cursx > 0
cursx = cursx - 1 cursx--
drawrow(cursy, scrnleft, @editstr) drawrow(cursy, scrnleft, @editstr)
else else
scrnleft = scrnleft - 1 scrnleft--
drawscrn(scrntop, scrnleft) drawscrn(scrntop, scrnleft)
fin fin
curson curson
fin fin
elsif curscol < maxlnlen elsif curscol < maxlnlen
curscol = curscol + 1 curscol++
cursx = cursx + 1 cursx++
if flags & insmode if flags & insmode
if editstr < maxlnlen or editstr.maxlnlen == $A0 if editstr < maxlnlen or editstr.maxlnlen == $A0
editstr = editstr + 1 editstr++
if curscol >= editstr if curscol >= editstr
editstr = curscol editstr = curscol
else else
memcpy(@editstr[curscol + 1], @editstr[curscol], editstr - curscol) memcpy(@editstr[curscol + 1], @editstr[curscol], editstr - curscol)
fin fin
else else
curscol = curscol - 1 curscol--
cursx = cursx - 1 cursx--
key = editstr[curscol] key = editstr[curscol]
bell bell
fin fin
else else
@ -797,8 +788,8 @@ def editline(key)
if cursx <= 39 if cursx <= 39
drawrow(cursy, scrnleft, @editstr) drawrow(cursy, scrnleft, @editstr)
else else
scrnleft = scrnleft + 1 scrnleft++
cursx = 39 cursx = 39
drawscrn(scrntop, scrnleft) drawscrn(scrntop, scrnleft)
fin fin
curson curson
@ -809,7 +800,7 @@ def editline(key)
if curscol < editstr if curscol < editstr
strcpy(undoline, @editstr) strcpy(undoline, @editstr)
memcpy(@editstr[curscol + 1], @editstr[curscol + 2], editstr - curscol) memcpy(@editstr[curscol + 1], @editstr[curscol + 2], editstr - curscol)
editstr = editstr - 1 editstr--
cursoff cursoff
drawrow(cursy, scrnleft, @editstr) drawrow(cursy, scrnleft, @editstr)
curson curson
@ -859,15 +850,15 @@ def editmode#0
is keyctrlv is keyctrlv
pasteline; break pasteline; break
is keyctrlf is keyctrlf
if numlines < maxlines and cursrow == numlines - 1 if numlines < maxlines and cursrow == numlines - 1
strlinbuf:[numlines] = @nullstr strlinbuf:[numlines] = @nullstr
numlines = numlines + 1 numlines++
fin fin
cursdown cursdown
is keyctrlo is keyctrlo
openline(cursrow) openline(cursrow)
redraw redraw
break break
is keyenter is keyenter
if flags & insmode if flags & insmode
splitline splitline
@ -876,7 +867,7 @@ def editmode#0
cursdown cursdown
redraw redraw
fin fin
break break
is keyctrlt is keyctrlt
joinline; break joinline; break
is keyctrli is keyctrli
@ -887,7 +878,7 @@ def editmode#0
flags = flags | insmode flags = flags | insmode
curschr = '+' curschr = '+'
fin fin
break break
is keyctrlc is keyctrlc
if flags & uppercase if flags & uppercase
txtlower txtlower
@ -895,12 +886,12 @@ def editmode#0
txtupper txtupper
fin fin
redraw redraw
break break
is keyescape is keyescape
cursoff cursoff
cmdmode cmdmode
redraw redraw
break break
wend wend
until false until false
end end
@ -944,12 +935,12 @@ def prfiles(optpath)
puts(entry) puts(entry)
if type & $F0 == $D0 // Is it a directory? if type & $F0 == $D0 // Is it a directory?
cout('/') cout('/')
len = len + 1 len++
fin fin
for len = 20 - len downto 1 for len = 20 - len downto 1
cout(' ') cout(' ')
next next
filecnt = filecnt - 1 filecnt--
fin fin
entry = entry + entrylen entry = entry + entrylen
next next
@ -965,7 +956,7 @@ end
def striplead(strptr, chr)#0 def striplead(strptr, chr)#0
while ^strptr and ^(strptr + 1) == chr while ^strptr and ^(strptr + 1) == chr
memcpy(strptr + 1, strptr + 2, ^strptr) memcpy(strptr + 1, strptr + 2, ^strptr)
^strptr = ^strptr - 1 ^strptr--
loop loop
end end
def parsecmd(strptr) def parsecmd(strptr)
@ -976,7 +967,7 @@ def parsecmd(strptr)
if ^strptr if ^strptr
cmd = ^(strptr + 1) cmd = ^(strptr + 1)
memcpy(strptr + 1, strptr + 2, ^strptr) memcpy(strptr + 1, strptr + 2, ^strptr)
^strptr = ^strptr - 1 ^strptr--
fin fin
if ^strptr if ^strptr
striplead(strptr, ' ') striplead(strptr, ' ')
@ -999,7 +990,7 @@ def quit#0
exit exit
fin fin
end end
def cmdmode def cmdmode#0
byte slot byte slot
word cmdptr word cmdptr
@ -1013,17 +1004,17 @@ def cmdmode
is 'A' is 'A'
readtxt(cmdptr) readtxt(cmdptr)
flags = flags | changed flags = flags | changed
break break
is 'R' is 'R'
if chkchng if chkchng
inittxtbuf inittxtbuf
numlines = 0 numlines = 0
strcpy(@txtfile, cmdptr) strcpy(@txtfile, cmdptr)
readtxt(@txtfile) readtxt(@txtfile)
if numlines == 0; numlines = 1; fin if numlines == 0; numlines = 1; fin
flags = flags & ~changed flags = flags & ~changed
fin fin
break break
is 'W' is 'W'
if ^cmdptr if ^cmdptr
strcpy(@txtfile, cmdptr) strcpy(@txtfile, cmdptr)
@ -1031,7 +1022,7 @@ def cmdmode
writetxt(@txtfile) writetxt(@txtfile)
//if flags & changed; fin //if flags & changed; fin
flags = flags & ~changed flags = flags & ~changed
break break
is 'C' is 'C'
prfiles(cmdptr); break prfiles(cmdptr); break
is 'P' is 'P'
@ -1043,7 +1034,7 @@ def cmdmode
slot = 1 slot = 1
fin fin
printtxt(slot) printtxt(slot)
break break
is 'Q' is 'Q'
quit quit
is 'E' is 'E'
@ -1054,7 +1045,7 @@ def cmdmode
inittxtbuf inittxtbuf
strcpy(@txtfile, "UNTITLED") strcpy(@txtfile, "UNTITLED")
fin fin
break break
otherwise otherwise
bell bell
cout('?') cout('?')

View File

@ -2024,7 +2024,7 @@ end
// //
def emit_byte(bval)#0 def emit_byte(bval)#0
^codeptr = bval ^codeptr = bval
codeptr = codeptr + 1 codeptr++
end end
def emit_word(wval)#0 def emit_word(wval)#0
*codeptr = wval *codeptr = wval
@ -2087,14 +2087,14 @@ def emit_data(vartype, consttype, constval, constsize)
size = constsize size = constsize
emit_fill(constsize) emit_fill(constsize)
elsif consttype == STR_TYPE elsif consttype == STR_TYPE
size = constsize size = constsize
chrptr = constval chrptr = constval
constsize = constsize - 1 constsize--
emit_byte(constsize) emit_byte(constsize)
while constsize > 0 while constsize > 0
emit_byte(^chrptr) emit_byte(^chrptr)
chrptr = chrptr + 1 chrptr++
constsize = constsize - 1 constsize--
loop loop
else else
if vartype & BYTE_TYPE if vartype & BYTE_TYPE
@ -2105,7 +2105,7 @@ def emit_data(vartype, consttype, constval, constsize)
if consttype == CONSTADDR_TYPE if consttype == CONSTADDR_TYPE
emit_addr(constval) emit_addr(constval)
else else
emit_word(constval) emit_word(constval)
fin fin
fin fin
fin fin
@ -2375,9 +2375,9 @@ def emit_drop#0
end end
def emit_leave#0 def emit_leave#0
if framesize if framesize
emit_op($5A) emit_op($5A)
else else
emit_op($5C) emit_op($5C)
fin fin
end end
def emit_enter(cparams)#0 def emit_enter(cparams)#0
@ -2408,7 +2408,7 @@ def idmatch(nameptr, len, idptr, idcnt)
fin fin
fin fin
idptr = idptr + idptr->idname + idrecsz idptr = idptr + idptr->idname + idrecsz
idcnt = idcnt - 1 idcnt--
loop loop
return 0 return 0
end end
@ -2431,7 +2431,7 @@ def dumpsym(idptr, idcnt)#0
fin fin
crout crout
idptr = idptr + idptr->idname + idrecsz idptr = idptr + idptr->idname + idrecsz
idcnt = idcnt - 1 idcnt--
loop loop
end end
def id_lookup(nameptr, len) def id_lookup(nameptr, len)
@ -2455,7 +2455,7 @@ def idlocal_add(namestr, len, type, size)
lastlocal=>idval = framesize lastlocal=>idval = framesize
lastlocal->idtype = type | LOCAL_TYPE lastlocal->idtype = type | LOCAL_TYPE
nametostr(namestr, len, lastlocal + idname) nametostr(namestr, len, lastlocal + idname)
locals = locals + 1 locals++
lastlocal = lastlocal + idrecsz + len lastlocal = lastlocal + idrecsz + len
if lastlocal > idlocal_tbl + idlocal_tblsz if lastlocal > idlocal_tbl + idlocal_tblsz
prstr(@local_sym_overflw) prstr(@local_sym_overflw)
@ -2463,8 +2463,7 @@ def idlocal_add(namestr, len, type, size)
fin fin
framesize = framesize + size framesize = framesize + size
if framesize > 255 if framesize > 255
prstr(@local_overflw) return parse_err(@local_overflw)
return FALSE
fin fin
return TRUE return TRUE
end end
@ -2474,7 +2473,7 @@ def iddata_add(namestr, len, type, size)
lastglobal->idtype = type lastglobal->idtype = type
nametostr(namestr, len, lastglobal + idname) nametostr(namestr, len, lastglobal + idname)
emit_iddata(datasize, size, lastglobal + idname) emit_iddata(datasize, size, lastglobal + idname)
globals = globals + 1 globals++
lastglobal = lastglobal + idrecsz + len lastglobal = lastglobal + idrecsz + len
if lastglobal > idglobal_tbl + idglobal_tblsz if lastglobal > idglobal_tbl + idglobal_tblsz
prstr(@global_sym_overflw) prstr(@global_sym_overflw)
@ -2496,7 +2495,7 @@ def idglobal_add(namestr, len, type, value)
lastglobal=>idval = value lastglobal=>idval = value
lastglobal->idtype = type lastglobal->idtype = type
nametostr(namestr, len, lastglobal + idname) nametostr(namestr, len, lastglobal + idname)
globals = globals + 1 globals++
lastglobal = lastglobal + idrecsz + len lastglobal = lastglobal + idrecsz + len
if lastglobal > idglobal_tbl + idglobal_tblsz if lastglobal > idglobal_tbl + idglobal_tblsz
prstr(@global_sym_overflw) prstr(@global_sym_overflw)
@ -2639,7 +2638,7 @@ def pop_val(valptr, sizeptr, typeptr)
^sizeptr = sizestack[valsp] ^sizeptr = sizestack[valsp]
^typeptr = typestack[valsp] ^typeptr = typestack[valsp]
valsp-- valsp--
return valsp + 1 return valsp + 1
end end
// //
// Lexical anaylzer // Lexical anaylzer
@ -2878,16 +2877,12 @@ def nextln
cpyln(strlinbuf:[lineno], instr) cpyln(strlinbuf:[lineno], instr)
lineno++ lineno++
if !(lineno & $0F); cout('.'); fin if !(lineno & $0F); cout('.'); fin
print(lineno);cout(':');print(numlines) //print(lineno);cout(':');print(numlines);cout('>');prstr(instr);crout
cout('>')
prstr(instr)
crout
scan scan
else else
cout('<') //cout('<');crout
crout *instr = 0
^instr = 0 //^inbuff = 0
^inbuff = 0
token = DONE_TKN token = DONE_TKN
fin fin
fin fin
@ -2973,7 +2968,7 @@ def parse_constval
when token when token
is SUB_TKN is SUB_TKN
mod = mod | 1; break mod = mod | 1; break
is ALT_COMP_TKN is ALT_COMP_TKN
is COMP_TKN is COMP_TKN
mod = mod | 2; break mod = mod | 2; break
is LOGIC_NOT_TKN is LOGIC_NOT_TKN
@ -3012,7 +3007,7 @@ def parse_constval
if !idptr; return parse_err(@bad_cnst); fin if !idptr; return parse_err(@bad_cnst); fin
type = idptr->idtype type = idptr->idtype
if type & ADDR_TYPE if type & ADDR_TYPE
if mod <> 8; return parse_err(@bad_cnst); fin if mod <> 8; return parse_err(@bad_cnst); fin
type = CONSTADDR_TYPE type = CONSTADDR_TYPE
fin fin
value = idptr=>idval value = idptr=>idval
@ -3139,20 +3134,20 @@ def parse_value(rvalue)
if deref if deref
push_op(token, 0) push_op(token, 0)
else else
deref = deref + 1 deref++
type = type | BPTR_TYPE type = type | BPTR_TYPE
fin fin
break break
is WPTR_TKN is WPTR_TKN
if deref if deref
push_op(token, 0) push_op(token, 0)
else else
deref = deref + 1 deref++
type = type | WPTR_TYPE type = type | WPTR_TYPE
fin fin
break break
is AT_TKN is AT_TKN
deref = deref - 1 deref--
break break
is SUB_TKN is SUB_TKN
is ALT_COMP_TKN is ALT_COMP_TKN
@ -3184,14 +3179,14 @@ def parse_value(rvalue)
// type = type | WORD_TYPE // type = type | WORD_TYPE
emit_val = TRUE emit_val = TRUE
break break
is STR_TKN is STR_TKN
// //
// Special case // Special case
// //
emit_constr(constval, tknlen - 1) emit_constr(constval, tknlen - 1)
scan scan
return WORD_TYPE return WORD_TYPE
break break
otherwise otherwise
return 0 return 0
wend wend
@ -3205,16 +3200,16 @@ def parse_value(rvalue)
is NEG_TKN is NEG_TKN
pop_op pop_op
value = -value value = -value
break break
is ALT_COMP_TKN is ALT_COMP_TKN
is COMP_TKN is COMP_TKN
pop_op pop_op
value = ~value value = ~value
break break
is LOGIC_NOT_TKN is LOGIC_NOT_TKN
pop_op pop_op
value = !value value = !value
break break
otherwise otherwise
cparams = FALSE cparams = FALSE
wend wend
@ -3238,7 +3233,8 @@ def parse_value(rvalue)
ref_offset = 0 ref_offset = 0
fin fin
if ref_type & BPTR_TYPE; emit_lb if ref_type & BPTR_TYPE; emit_lb
elsif ref_type & WPTR_TYPE; emit_lw; fin elsif ref_type & WPTR_TYPE; emit_lw
fin
if lookahead <> CLOSE_PAREN_TKN if lookahead <> CLOSE_PAREN_TKN
emit_push emit_push
fin fin
@ -3847,7 +3843,7 @@ def parse_var(type)
byte consttype, constsize, idlen byte consttype, constsize, idlen
word idptr, constval, arraysize, size word idptr, constval, arraysize, size
cout('T') //cout('T')
idlen = 0 idlen = 0
size = 1 size = 1
if scan == OPEN_BRACKET_TKN if scan == OPEN_BRACKET_TKN
@ -3903,7 +3899,7 @@ def parse_struc
byte type, idlen, struclen, constsize byte type, idlen, struclen, constsize
word size, offset, idstr word size, offset, idstr
cout('S') //cout('S')
struclen = 0 struclen = 0
if scan == ID_TKN if scan == ID_TKN
struclen = tknlen struclen = tknlen
@ -3959,7 +3955,7 @@ def parse_vars
byte idlen, type, size byte idlen, type, size
word value, idptr word value, idptr
cout('V') //cout('V')
when token when token
is CONST_TKN is CONST_TKN
if scan <> ID_TKN if scan <> ID_TKN
@ -4012,7 +4008,7 @@ def parse_defs
word func_tag, idptr word func_tag, idptr
if token == DEF_TKN if token == DEF_TKN
cout('D') //cout('D')
if scan <> ID_TKN; return parse_err(@bad_decl); fin if scan <> ID_TKN; return parse_err(@bad_decl); fin
cfnparms = 0 cfnparms = 0
infunc = TRUE infunc = TRUE
@ -4028,12 +4024,12 @@ def parse_defs
idlocal_init idlocal_init
if scan == OPEN_PAREN_TKN if scan == OPEN_PAREN_TKN
repeat repeat
if scan == ID_TKN if scan == ID_TKN
cfnparms = cfnparms + 1 cfnparms = cfnparms + 1
idlocal_add(tknptr, tknlen, WORD_TYPE, 2) idlocal_add(tknptr, tknlen, WORD_TYPE, 2)
scan scan
fin fin
until token <> COMMA_TKN until token <> COMMA_TKN
if token <> CLOSE_PAREN_TKN if token <> CLOSE_PAREN_TKN
return parse_err(@bad_decl) return parse_err(@bad_decl)
fin fin
@ -4070,7 +4066,7 @@ def parse_module
while parse_defs while parse_defs
nextln nextln
loop loop
cout('I') //cout('I')
framesize = 0 framesize = 0
entrypoint = codeptr entrypoint = codeptr
emit_enter(0) emit_enter(0)
@ -4080,7 +4076,7 @@ def parse_module
nextln nextln
loop loop
fin fin
cout('!') //cout('!')
if prevstmnt <> RETURN_TKN if prevstmnt <> RETURN_TKN
emit_const(0) emit_const(0)
emit_leave emit_leave

View File

@ -0,0 +1,9 @@
# Filetype extension configuration file for Geany
# Insert as many items as you want, separate them with a ";".
# See Geany's main documentation for details.
[Extensions]
PLASMA=*.pla;*.plh;
# Note: restarting is required after editing groups
[Groups]
Programming=PLASMA;