1 |
721 |
jeremybenn |
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 |
|
|
Please send bug reports to Hans-J. Boehm (Hans_Boehm@hp.com or
|
13 |
|
|
boehm@acm.org).
|
14 |
|
|
|
15 |
|
|
This is a string packages that uses a tree-based representation.
|
16 |
|
|
See cord.h for a description of the functions provided. Ec.h describes
|
17 |
|
|
"extensible cords", which are essentially output streams that write
|
18 |
|
|
to a cord. These allow for efficient construction of cords without
|
19 |
|
|
requiring a bound on the size of a cord.
|
20 |
|
|
|
21 |
|
|
More details on the data structure can be found in
|
22 |
|
|
|
23 |
|
|
Boehm, Atkinson, and Plass, "Ropes: An Alternative to Strings",
|
24 |
|
|
Software Practice and Experience 25, 12, December 1995, pp. 1315-1330.
|
25 |
|
|
|
26 |
|
|
A fundamentally similar "rope" data structure is also part of SGI's standard
|
27 |
|
|
template library implementation, and its descendents, which include the
|
28 |
|
|
GNU C++ library. That uses reference counting by default.
|
29 |
|
|
There is a short description of that data structure at
|
30 |
|
|
http://reality.sgi.com/boehm/ropeimpl.html . (The more official location
|
31 |
|
|
http://www.sgi.com/tech/stl/ropeimpl.html is missing a figure.)
|
32 |
|
|
|
33 |
|
|
All of these are descendents of the "ropes" in Xerox Cedar.
|
34 |
|
|
|
35 |
|
|
de.c is a very dumb text editor that illustrates the use of cords.
|
36 |
|
|
It maintains a list of file versions. Each version is simply a
|
37 |
|
|
cord representing the file contents. Nonetheless, standard
|
38 |
|
|
editing operations are efficient, even on very large files.
|
39 |
|
|
(Its 3 line "user manual" can be obtained by invoking it without
|
40 |
|
|
arguments. Note that ^R^N and ^R^P move the cursor by
|
41 |
|
|
almost a screen. It does not understand tabs, which will show
|
42 |
|
|
up as highlighred "I"s. Use the UNIX "expand" program first.)
|
43 |
|
|
To build the editor, type "make cord/de" in the gc directory.
|
44 |
|
|
|
45 |
|
|
This package assumes an ANSI C compiler such as gcc. It will
|
46 |
|
|
not compile with an old-style K&R compiler.
|
47 |
|
|
|
48 |
|
|
Note that CORD_printf iand friends use C functions with variable numbers
|
49 |
|
|
of arguments in non-standard-conforming ways. This code is known to
|
50 |
|
|
break on some platforms, notably PowerPC. It should be possible to
|
51 |
|
|
build the remainder of the library (everything but cordprnt.c) on
|
52 |
|
|
any platform that supports the collector.
|
53 |
|
|
|