mirror of
https://github.com/dschmenk/PLASMA.git
synced 2025-02-09 04:30:37 +00:00
Trying to track down file write corruption
This commit is contained in:
parent
de29742841
commit
c743ace42b
Binary file not shown.
@ -247,7 +247,7 @@ def strpoolalloc(size)
|
|||||||
end
|
end
|
||||||
def striplead(strptr, chr)#0
|
def striplead(strptr, chr)#0
|
||||||
byte striplen
|
byte striplen
|
||||||
|
|
||||||
for striplen = 1 to ^strptr
|
for striplen = 1 to ^strptr
|
||||||
if ^(strptr + striplen) <> chr
|
if ^(strptr + striplen) <> chr
|
||||||
break
|
break
|
||||||
@ -391,7 +391,7 @@ end
|
|||||||
def strtonum(strptr)
|
def strtonum(strptr)
|
||||||
word num, i
|
word num, i
|
||||||
byte c
|
byte c
|
||||||
|
|
||||||
num = 0
|
num = 0
|
||||||
for i = 1 to ^strptr
|
for i = 1 to ^strptr
|
||||||
c = ^(strptr + i) & $7F
|
c = ^(strptr + i) & $7F
|
||||||
@ -438,9 +438,8 @@ def readtxt(filename, startline)#0
|
|||||||
putln
|
putln
|
||||||
end
|
end
|
||||||
def writetxt(filename)#0
|
def writetxt(filename)#0
|
||||||
word i, strptr
|
word i
|
||||||
byte refnum, j, chr
|
byte refnum, txtbuf[MAXLNLEN+2]
|
||||||
byte txtbuf[MAXLNLEN+2]
|
|
||||||
|
|
||||||
fileio:destroy(filename)
|
fileio:destroy(filename)
|
||||||
fileio:create(filename, $04, $00) // full access, TXT file
|
fileio:create(filename, $04, $00) // full access, TXT file
|
||||||
@ -558,7 +557,7 @@ end
|
|||||||
def drawscrn(toprow, ofst)#0
|
def drawscrn(toprow, ofst)#0
|
||||||
byte row, numchars, lofst
|
byte row, numchars, lofst
|
||||||
word strptr, scrnptr
|
word strptr, scrnptr
|
||||||
|
|
||||||
lofst = flags & gutter
|
lofst = flags & gutter
|
||||||
if lofst
|
if lofst
|
||||||
drawgutter(toprow, ofst)
|
drawgutter(toprow, ofst)
|
||||||
@ -598,7 +597,7 @@ def drawscrn(toprow, ofst)#0
|
|||||||
end
|
end
|
||||||
def cursoff#0
|
def cursoff#0
|
||||||
word scrnptr
|
word scrnptr
|
||||||
|
|
||||||
if flags & showcurs
|
if flags & showcurs
|
||||||
^cursptr = underchr
|
^cursptr = underchr
|
||||||
if flags & gutter
|
if flags & gutter
|
||||||
@ -607,13 +606,13 @@ def cursoff#0
|
|||||||
^(scrnptr+2) = ^(scrnptr+2) | $80
|
^(scrnptr+2) = ^(scrnptr+2) | $80
|
||||||
fin
|
fin
|
||||||
flags = flags & ~showcurs
|
flags = flags & ~showcurs
|
||||||
|
|
||||||
fin
|
fin
|
||||||
end
|
end
|
||||||
def curson#0
|
def curson#0
|
||||||
byte lofst
|
byte lofst
|
||||||
word scrnptr
|
word scrnptr
|
||||||
|
|
||||||
if !(flags & showcurs)
|
if !(flags & showcurs)
|
||||||
lofst = flags & gutter
|
lofst = flags & gutter
|
||||||
if lofst
|
if lofst
|
||||||
@ -644,7 +643,7 @@ def redraw#0
|
|||||||
end
|
end
|
||||||
def curshpos(hpos)#1
|
def curshpos(hpos)#1
|
||||||
byte needredraw
|
byte needredraw
|
||||||
|
|
||||||
needredraw = TRUE
|
needredraw = TRUE
|
||||||
if hpos < 0; hpos = 0; fin
|
if hpos < 0; hpos = 0; fin
|
||||||
if hpos > MAXLNLEN; hpos = MAXLNLEN; fin
|
if hpos > MAXLNLEN; hpos = MAXLNLEN; fin
|
||||||
@ -777,7 +776,7 @@ def cursleft#0
|
|||||||
end
|
end
|
||||||
def pgleft#0
|
def pgleft#0
|
||||||
word i, strptr
|
word i, strptr
|
||||||
|
|
||||||
strptr = txtlinbuf=>[cursrow]
|
strptr = txtlinbuf=>[cursrow]
|
||||||
if curscol > ^strptr
|
if curscol > ^strptr
|
||||||
i = ^strptr
|
i = ^strptr
|
||||||
@ -818,7 +817,7 @@ def cursright#0
|
|||||||
end
|
end
|
||||||
def pgright#0
|
def pgright#0
|
||||||
word i, strptr
|
word i, strptr
|
||||||
|
|
||||||
strptr = txtlinbuf=>[cursrow]
|
strptr = txtlinbuf=>[cursrow]
|
||||||
if curscol >= ^strptr
|
if curscol >= ^strptr
|
||||||
i = curscol + 8
|
i = curscol + 8
|
||||||
@ -849,7 +848,7 @@ end
|
|||||||
//
|
//
|
||||||
def findline(strptr, start)#1
|
def findline(strptr, start)#1
|
||||||
byte scan, i, upstr[MAXLNLEN+1]
|
byte scan, i, upstr[MAXLNLEN+1]
|
||||||
|
|
||||||
if ^strptr >= findstr
|
if ^strptr >= findstr
|
||||||
lnupcpy(@upstr, strptr)
|
lnupcpy(@upstr, strptr)
|
||||||
for scan = start to upstr - findstr + 1
|
for scan = start to upstr - findstr + 1
|
||||||
@ -1098,7 +1097,7 @@ def printtxt(slot)#0
|
|||||||
end
|
end
|
||||||
def freesel#0
|
def freesel#0
|
||||||
word i
|
word i
|
||||||
|
|
||||||
for i = 0 to numcliplines - 1
|
for i = 0 to numcliplines - 1
|
||||||
if cliplinbuf=>[i] <> @nullstr
|
if cliplinbuf=>[i] <> @nullstr
|
||||||
delstr(cliplinbuf=>[i])
|
delstr(cliplinbuf=>[i])
|
||||||
@ -1109,7 +1108,7 @@ def freesel#0
|
|||||||
end
|
end
|
||||||
def selrange#2
|
def selrange#2
|
||||||
word first, last
|
word first, last
|
||||||
|
|
||||||
if flags & selection
|
if flags & selection
|
||||||
if cursrow > selrow
|
if cursrow > selrow
|
||||||
first, last = selrow, cursrow
|
first, last = selrow, cursrow
|
||||||
@ -1129,7 +1128,7 @@ def beginsel#0
|
|||||||
end
|
end
|
||||||
def copysel#0
|
def copysel#0
|
||||||
word firstsel, lastsel
|
word firstsel, lastsel
|
||||||
|
|
||||||
freesel
|
freesel
|
||||||
firstsel, lastsel = selrange
|
firstsel, lastsel = selrange
|
||||||
for numcliplines = 0 to lastsel - firstsel
|
for numcliplines = 0 to lastsel - firstsel
|
||||||
@ -1140,7 +1139,7 @@ def copysel#0
|
|||||||
end
|
end
|
||||||
def cutsel#0
|
def cutsel#0
|
||||||
word firstsel, lastsel
|
word firstsel, lastsel
|
||||||
|
|
||||||
freesel
|
freesel
|
||||||
firstsel, lastsel = selrange
|
firstsel, lastsel = selrange
|
||||||
if lastsel - firstsel < MAXCLIPLINES
|
if lastsel - firstsel < MAXCLIPLINES
|
||||||
@ -1169,7 +1168,7 @@ def cutsel#0
|
|||||||
end
|
end
|
||||||
def pastesel#0
|
def pastesel#0
|
||||||
word p
|
word p
|
||||||
|
|
||||||
if numcliplines and numcliplines + numlines < MAXLINES
|
if numcliplines and numcliplines + numlines < MAXLINES
|
||||||
memcpy(@txtlinbuf=>[cursrow + numcliplines], @txtlinbuf=>[cursrow], (numlines - cursrow) * 2)
|
memcpy(@txtlinbuf=>[cursrow + numcliplines], @txtlinbuf=>[cursrow], (numlines - cursrow) * 2)
|
||||||
for p = 0 to numcliplines - 1
|
for p = 0 to numcliplines - 1
|
||||||
@ -1185,7 +1184,7 @@ end
|
|||||||
def indentsel#0
|
def indentsel#0
|
||||||
byte indentstr[MAXLNLEN+1], l
|
byte indentstr[MAXLNLEN+1], l
|
||||||
word firstsel, lastsel, i
|
word firstsel, lastsel, i
|
||||||
|
|
||||||
freesel
|
freesel
|
||||||
firstsel, lastsel = selrange
|
firstsel, lastsel = selrange
|
||||||
for i = firstsel to lastsel
|
for i = firstsel to lastsel
|
||||||
@ -1205,7 +1204,7 @@ end
|
|||||||
def undentsel#0
|
def undentsel#0
|
||||||
byte undentstr[MAXLNLEN+1], l
|
byte undentstr[MAXLNLEN+1], l
|
||||||
word firstsel, lastsel, i
|
word firstsel, lastsel, i
|
||||||
|
|
||||||
freesel
|
freesel
|
||||||
firstsel, lastsel = selrange
|
firstsel, lastsel = selrange
|
||||||
for i = firstsel to lastsel
|
for i = firstsel to lastsel
|
||||||
@ -1230,12 +1229,12 @@ def undentsel#0
|
|||||||
end
|
end
|
||||||
def autoindent(strptr)#0
|
def autoindent(strptr)#0
|
||||||
byte i
|
byte i
|
||||||
|
|
||||||
for i = 1 to ^strptr
|
for i = 1 to ^strptr
|
||||||
if ^(strptr + i) <> keyspace
|
if ^(strptr + i) <> keyspace
|
||||||
break
|
break
|
||||||
fin
|
fin
|
||||||
next
|
next
|
||||||
curshpos(i - 1)
|
curshpos(i - 1)
|
||||||
end
|
end
|
||||||
def openline(row)
|
def openline(row)
|
||||||
@ -1289,7 +1288,7 @@ def splitline#0
|
|||||||
memcpy(@splitstr + 2, @splitstr + 1, splitstr)
|
memcpy(@splitstr + 2, @splitstr + 1, splitstr)
|
||||||
splitstr[1] = keyspace
|
splitstr[1] = keyspace
|
||||||
splitstr++
|
splitstr++
|
||||||
next
|
next
|
||||||
txtlinbuf=>[cursrow + 1] = newstr(@splitstr)
|
txtlinbuf=>[cursrow + 1] = newstr(@splitstr)
|
||||||
splitstr = curscol
|
splitstr = curscol
|
||||||
memcpy(@splitstr + 1, txtlinbuf=>[cursrow] + 1, splitstr)
|
memcpy(@splitstr + 1, txtlinbuf=>[cursrow] + 1, splitstr)
|
||||||
@ -1303,7 +1302,7 @@ def splitline#0
|
|||||||
break
|
break
|
||||||
fin
|
fin
|
||||||
next
|
next
|
||||||
curshpos(curscol - 1)
|
curshpos(curscol - 1)
|
||||||
fin
|
fin
|
||||||
fin
|
fin
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user