/* This file contains functions which didn't seem happy anywhere else */
/* find a particular line & return a pointer to a copy of its text */
long line
; /* line number of the line to fetch */
REG
char *scan
; /* used to search for the line in a BLK */
long l
; /* line number counter */
static BLK buf
; /* holds ONLY the selected line (as string) */
REG
char *cpy
; /* used while copying the line */
static long nextline
; /* } These four variables are used */
static long chglevel
; /* } to implement a shortcut when */
static char *nextscan
; /* } consecutive lines are fetched */
static long nextlnum
; /* } */
/* can we do a shortcut? */
if (changes
== chglevel
&& line
== nextline
)
/* scan lnum[] to determine which block its in */
for (i
= 1; line
> lnum
[i
]; i
++)
/* fetch text of the block containing that line */
/* find the line in the block */
for (l
= lnum
[i
- 1]; ++l
< line
; )
/* copy it into a block by itself, with no newline */
for (cpy
= buf
.c
; *scan
!= '\n'; )
/* maybe speed up the next call to fetchline() ? */
/* Calls to fetchline() interfere with calls to pfetch(). Make sure
* that pfetch() resets itself on its next invocation.
/* Return a pointer to the line's text */
/* error message from the regexp code */
char *txt
; /* an error message */
msg("RE error: %s", txt
);
/* This function is equivelent to the pfetch() macro */
long l
; /* line number of line to fetch */
if(l
!= pline
|| changes
!= pchgs
)
ptext
= fetchline(pline
);