home *** CD-ROM | disk | FTP | other *** search
- { XXXXXXXXXXXX TEXT FUNCTIONS XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX }
-
- type
- strptr = ^string;
- textnodeptr = ^textnode;
- textnode = record
- next,prev :textnodeptr; {line may not be made longer}
- line :strptr; {allocation is length+1}
- end;
- textbuffer = record
- first,last :textnodeptr;
- end;
-
- {-
- Note: Don't mess around inside the data structures defined above.
- Use the procedures to access them instead. This unit should be
- written object orientated. Some procedures don't use all their
- parameters at the moment. This is intentional and will be useful
- if the structures are enhanced.
- -}
-
- {- initialise an empty buffer -}
- procedure newbuffer(var t :textbuffer);
-
- {- return true if the buffer is empty -}
- function emptybuffer(var t :textbuffer) :boolean;
-
- {- return a pointer to the first line of a buffer -}
- function firstline(var t :textbuffer) :textnodeptr;
-
- {- return a pointer to the last line of a buffer -}
- function lastline(var t :textbuffer) :textnodeptr;
-
- {- return the next line in a buffer -}
- function nextline(var t :textbuffer; pos :textnodeptr) :textnodeptr;
-
- {- return the previous line in a buffer -}
- function prevline(var t :textbuffer; pos :textnodeptr) :textnodeptr;
-
- {- add a line to the end of a buffer -}
- procedure addtoend(var t :textbuffer; line :string);
-
- {- insert a line before another line -}
- procedure addinsert(var t :textbuffer; pos :textnodeptr; line :string);
-
- {- delete a line and return the next line or nil if it was the last line -}
- function deleteline(var t :textbuffer; var pos :textnodeptr) :textnodeptr;
-
- {- delete a buffer -}
- procedure deletebuffer(var t :textbuffer);
-
- {- retrieve the text value from a line -}
- function gettextline(var t: textbuffer; pos :textnodeptr) :string;
-
- {- assign a new string to a line of text -}
- procedure modifytextline(var t: textbuffer; pos :textnodeptr; line :string);
-
- {- word wrap the buffer -}
- procedure wrapbuffer(var t :textbuffer; margin :byte);
-
- {- create a new buffer with maximum length (255) lines -}
- procedure unwrapbuffer(var t,w :textbuffer);
-
- {- count the number of lines in a buffer -}
- function bufferlength(var t :textbuffer) :word;
-
-