DELETEコマンドは、指定された行を削除するわけだが、 実際には行と行のつなぎ情報を操作するだけである。
RATFOR版。
# delcmd.r4 -- delete lines from though to integer function delcmd(from,to,status) integer from,to,status integer getind,nextln,prevln integer k1,k2 include clines.ri if (from <= 0) status = ERR else { k1 = getind(prevln(from)) k2 = getind(nextln(to)) lastln = lastln - (to - from + 1) curln = prevln(from) call relink(k1,k2,k1,k2) status = OK } delcmd = status return end
WATCOM Fortran77版。
c delcmd.f -- delete lines from though to integer function delcmd(from,to,status) integer from,to,status integer getind,nextln,prevln integer k1,k2 include clines.fi if (from .le. 0) then status = -3 ! ERR(-3) else k1 = getind(prevln(from)) k2 = getind(nextln(to)) lastln = lastln - (to - from + 1) curln = prevln(from) call relink(k1,k2,k1,k2) status = -2 ! OK(-2) end if delcmd = status return end
※コメントの受付件数を超えているため、この記事にコメントすることができません。