home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
cpm
/
screngen
/
sfgr.lbr
/
EDITERR.SQL
/
EDITERR.SPL
Wrap
Text File
|
1986-07-26
|
4KB
|
203 lines
* EDITERR.SPL - Edit Error Message (.ERR file-extension)
* - 64 byte records, zero hex fill at end.
* - (c) Copyright 1986 - Harris Landsberg.
* - All rights reserved for commercial use.
* file and variable declarations
file(1,r)
word(rec)
byte(chr,err,i,j,pos,col,len)
byte(line[65],efile[15],comd[128])
* constants definitions
#def(last_pos,63)
#def(rec_size,64)
* obtain filename from command line
argl(comd)
slen(comd,len)
asgn(0,i,j)
whil(comd[i],eq,' ')
inrb(i)
endl()
whil(comd[i],ne,' ')
cond(comd[i],eq,'.') extl()
asgn(comd[i],efile[j])
cond(i,eq,len) extl()
inrb(i,j)
endl()
asgn(0,efile[j])
slen(efile,len)
cond(len,eq,0)
jump(filerr)
cond(len,gt,10)
jump(filerr)
* Open error file and declare size
scat('.ERR',efile)
open(1,efile,'r')
ferr(err)
cond(err,gt,0)
begn()
pstr('file open error')
retn()
endb()
size(1,@rec_size)
$start * Prompt for record to edit
vcls()
pstr('EDITERR - Edit Error Message File (',efile,')')
load(7,1)
pstr('Enter 9999 to Exit Program')
load(4,1)
pstr('Enter Record #: ')
$getnum gnum(rec)
comp(rec,eq,0)
begn()
load(4,17)
loop(5)
pchr(' ')
enlp()
load(4,17)
jump(getnum)
endb()
comp(rec,eq,9999)
jump(wrapup)
* "rec" contains record # to edit
read(1,rec,line)
ferr(err)
cond(err,gt,0)
begn()
forb(i,0,@last_pos)
asgn(' ',line[i])
next()
endb()
* make control codes to blanks
forb(i,0,@last_pos)
cond(line[i],lt,' ')
asgn(' ',line[i])
next()
* print out line for editing using SEU type format
vcls()
load(4,1) pstr('Record #: ') pwrd(rec)
load(9,15) asgn('1',chr)
loop(6)
pchr(chr)
loop(9)
pchr(' ')
enlp()
inrb(chr)
enlp()
load(10,6) asgn('1',chr)
loop(@rec_size)
pchr(chr)
cond(chr,ne,'9')
inrb(chr)
else()
asgn('0',chr)
enlp()
* print the line to be edited
load(11,6)
forb(i,0,@last_pos)
pchr(line[i])
next()
* print options
load(18,16) pstr('Ctrl D - Delete Character')
load(19,16) pstr('Ctrl V - Insert Space')
load(20,16) pstr('Ctrl X - Delete to End')
load(21,16) pstr('Ctrl Z - Abort Changes')
* prompt for each character starting at position 1
asgn(0,pos)
$gchr addb(pos,6,col)
load(11,col)
ikey(chr)
case(chr)
when(4) * ctrl d (delete)
asgn(pos,i)
whil(i,ne,@last_pos)
addb(i,1,j)
asgn(line[j],line[i])
inrb(i)
endl()
asgn(' ',line[@last_pos])
call(pnext)
when(22) * ctrl v (insert)
cond(line[@last_pos],eq,' ')
begn()
asgn(@last_pos,i)
whil(i,ne,pos)
subb(i,1,j)
asgn(line[j],line[i])
dcrb(i)
endl()
asgn(' ',line[pos])
call(pnext)
endb()
when(24) * ctrl x (delete-to-end)
forb(i,pos,@last_pos)
asgn(' ',line[i])
next()
call(pnext)
when(26) * ctrl z (abort changes)
jump(start)
when(8) * back arrow
cond(pos,ne,0)
dcrb(pos)
else()
asgn(@last_pos,pos)
jump(gchr)
when(12) * forward arrow
asgn(line[pos],chr)
jump(letter)
when(13) * ENTER
jump(write)
dflt()
$letter cond(chr,lt,' ')
jump(gchr)
pchr(chr)
asgn(chr,line[pos])
cond(pos,ne,@last_pos)
inrb(pos)
else()
asgn(0,pos)
endc()
jump(gchr)
$pnext * print next of line routine
forb(i,pos,@last_pos)
pchr(line[i])
next()
retn()
$write * write changes record to file
asgn(@last_pos,i)
whil(line[i],eq,' ')
asgn(0,line[i])
cond(i,eq,0) extl()
dcrb(i)
endl()
writ(1,rec,line)
ferr(err)
cond(err,eq,0)
jump(start)
load(22,1)
pstr('file write error')
$wrapup * close file and return to CP/M
load(23,1)
clos(1)
retn()
$filerr * invalid or no filename specified
pstr('invalid filename')
retn()
re