Newsgroups: comp.editors Path: utzoo!utgpu!watserv1!watmath!mks.com!ant From: ant@mks.com (Anthony Howe) Subject: Re: REPOST: editor.101 Date: Wed, 12 Jun 91 14:39:30 GMT Message-ID: <1991Jun12.143930.14186@mks.com> Organization: Mortice Kern Systems, Waterloo, Ontario, CANADA References: <1991Jun4.155657.4357@mks.com> <1991Jun11.195732.25500@wpi.WPI.EDU> rcarter@wpi.WPI.EDU (Randolph Carter (nee. Joseph H. Allen)) writes: >Another buffer technique I recently found is the "pieces" method from the >pointing editor (I can't remember the author's name). As you edit, you break ^^^^^^^^^^^^^^^ What and where? Could you find a reference. This might make for another article -- Editor.202 maybe. >a contiguous buffer up into pieces and add or delete characters from the edges >of the pieces. Each piece is stored in a malloc-like structure in a virtual >memory file. You have to maintain a list of all the pieces and search through >this list when you move out of a piece. You also glue pieces together when >possible. This is a neat technique, but it's complicated. This sounds like a variation of the scratch file method described in "Software Tools" chapter 6. (I'm hoping to write an Editor.201 article based on this chapter later this summer.) >An important technique for this and other buffer methods is to have routines >which adjust pointer/size pairs as you move between pieces (or blocks or over >the gap). This way, high level routines (like screen update) only have to >keep track of the pointer and size and can simply call a function to update >these when the beginning or end of a block is reached. Why sizes? (I'm a bit slow this morning) >Another usefull technique is to try to keep buffer pointers in the form of a >byte offset from the beginning of the file in the buffer. There then needs to >be logical to physical translation functions but keeping the pointer this >simple will make implementing higher level functions much easier. This technique is fine for the Buffer Gap Scheme, but I don't see how this would apply in a Link List Scheme. Link List and Pieces would require that pointers become structures suitable for the scheme n'est pas? - ant -- ant@mks.com Anthony C Howe Mortice Kern Systems Inc. 35 King St. N., Waterloo, Ontario, Canada, N2J 6W9 "Fate favors fools, small children, and ships named Enterprise" - Riker