| 1 |
Copyright (c) 1993-1994 by Xerox Corporation. All rights reserved. |
| 2 |
|
| 3 |
THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED |
| 4 |
OR IMPLIED. ANY USE IS AT YOUR OWN RISK. |
| 5 |
|
| 6 |
Permission is hereby granted to use or copy this program |
| 7 |
for any purpose, provided the above notices are retained on all copies. |
| 8 |
Permission to modify the code and to distribute modified code is granted, |
| 9 |
provided the above notices are retained, and a notice that the code was |
| 10 |
modified is included with the above copyright notice. |
| 11 |
|
| 12 |
This is a string packages that uses a tree-based representation. |
| 13 |
See cord.h for a description of the functions provided. Ec.h describes |
| 14 |
"extensible cords", which are essentially output streams that write |
| 15 |
to a cord. These allow for efficient construction of cords without |
| 16 |
requiring a bound on the size of a cord. |
| 17 |
|
| 18 |
More details on the data structure can be found in |
| 19 |
|
| 20 |
Boehm, Atkinson, and Plass, "Ropes: An Alternative to Strings", |
| 21 |
Software Practice and Experience 25, 12, December 1995, pp. 1315-1330. |
| 22 |
|
| 23 |
A fundamentally similar "rope" data structure is also part of SGI's standard |
| 24 |
template library implementation, and its descendants, which include the |
| 25 |
GNU C++ library. That uses reference counting by default. |
| 26 |
There is a short description of that data structure at |
| 27 |
http://www.sgi.com/tech/stl/ropeimpl.html . |
| 28 |
|
| 29 |
All of these are descendants of the "ropes" in Xerox Cedar. |
| 30 |
|
| 31 |
cord/tests/de.c is a very dumb text editor that illustrates the use of cords. |
| 32 |
It maintains a list of file versions. Each version is simply a |
| 33 |
cord representing the file contents. Nonetheless, standard |
| 34 |
editing operations are efficient, even on very large files. |
| 35 |
(Its 3 line "user manual" can be obtained by invoking it without |
| 36 |
arguments. Note that ^R^N and ^R^P move the cursor by |
| 37 |
almost a screen. It does not understand tabs, which will show |
| 38 |
up as highlighted "I"s. Use the UNIX "expand" program first.) |
| 39 |
To build the editor, type "make de" in the gc directory. |
| 40 |
|
| 41 |
Note that CORD_printf and friends use C functions with variable numbers |
| 42 |
of arguments in non-standard-conforming ways. This code is known to |
| 43 |
break on some platforms, notably PowerPC. It should be possible to |
| 44 |
build the remainder of the library (everything but cordprnt.c) on |
| 45 |
any platform that supports the collector. |