home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / ECO30603.ZIP / ECO30603.LZH / ECOLIBCS / aa next >
Encoding:
Text File  |  1993-04-12  |  2.3 KB  |  67 lines

  1. { XXXXXXXXXXXX TEXT FUNCTIONS XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX }
  2.  
  3. type
  4.   strptr = ^string;
  5.   textnodeptr = ^textnode;
  6.   textnode = record
  7.     next,prev :textnodeptr; {line may not be made longer}
  8.     line :strptr;   {allocation is length+1}
  9.   end;
  10.   textbuffer = record
  11.     first,last :textnodeptr;
  12.   end;
  13.  
  14.   {-
  15.     Note: Don't mess around inside the data structures defined above.
  16.     Use the procedures to access them instead.  This unit should be
  17.     written object orientated.  Some procedures don't use all their
  18.     parameters at the moment.  This is intentional and will be useful
  19.     if the structures are enhanced.
  20.   -}
  21.  
  22.   {- initialise an empty buffer -}
  23.   procedure newbuffer(var t :textbuffer);
  24.  
  25.   {- return true if the buffer is empty -}
  26.   function emptybuffer(var t :textbuffer) :boolean;
  27.  
  28.   {- return a pointer to the first line of a buffer -}
  29.   function firstline(var t :textbuffer) :textnodeptr;
  30.  
  31.   {- return a pointer to the last line of a buffer -}
  32.   function lastline(var t :textbuffer) :textnodeptr;
  33.  
  34.   {- return the next line in a buffer -}
  35.   function nextline(var t :textbuffer;  pos :textnodeptr) :textnodeptr;
  36.  
  37.   {- return the previous line in a buffer -}
  38.   function prevline(var t :textbuffer;  pos :textnodeptr) :textnodeptr;
  39.  
  40.   {- add a line to the end of a buffer -}
  41.   procedure addtoend(var t :textbuffer;  line :string);
  42.  
  43.   {- insert a line before another line -}
  44.   procedure addinsert(var t :textbuffer;  pos :textnodeptr;  line :string);
  45.  
  46.   {- delete a line and return the next line or nil if it was the last line -}
  47.   function deleteline(var t :textbuffer;  var pos :textnodeptr) :textnodeptr;
  48.  
  49.   {- delete a buffer -}
  50.   procedure deletebuffer(var t :textbuffer);
  51.  
  52.   {- retrieve the text value from a line -}
  53.   function gettextline(var t: textbuffer;  pos :textnodeptr) :string;
  54.  
  55.   {- assign a new string to a line of text -}
  56.   procedure modifytextline(var t: textbuffer;  pos :textnodeptr;  line :string);
  57.  
  58.   {- word wrap the buffer -}
  59.   procedure wrapbuffer(var t :textbuffer;  margin :byte);
  60.  
  61.   {- create a new buffer with maximum length (255) lines -}
  62.   procedure unwrapbuffer(var t,w :textbuffer);
  63.  
  64.   {- count the number of lines in a buffer -}
  65.   function bufferlength(var t :textbuffer) :word;
  66.  
  67.