#include "ded.h" #include "lines.h" /************************************************************************ * * * copyright Richard Bornat 1981 * * * ************************************************************************/ /* to allow for differing screen sizes, ded must * allocate its own store */ extern char *sbrk(); /* declaration to shut lint up */ char *my_alloc(size) int size; { register char *new; register int rsize = (size+sizeof(int)) & ~(sizeof(int)-1); if ( (new = sbrk(rsize)) == (char *) -1) editerror("no more room (my_alloc)"); curr_break = new+rsize; return(new); } char **newscreen() { register char **res, *map; register int row; int width; res = (char **) my_alloc(nrows*sizeof(char *)); width = (ncols+sizeof(int)) & ~(sizeof(int)-1); map = my_alloc(nrows*width); /* set pointers in map */ for (row=0; rowmaxl) inc_maxl(); } dec_topl() { topl--; adj_maxl(); } inc_maxl() { if (++maxl>NLINES) editerror("too many lines in file (inc_topl)"); else l_offset[maxl] = -1; } /* strip trailing blank lines from the file - * but not if there are any refs to the last line */ adj_maxl() { register int i; while (maxl>topl+LASTINROW && l_offset[maxl] == (unsigned) -1) { for (i=0; i0 && maxl