|
|
1.1 root 1: .TH XSTR 1 "24 February 1979"
2: .UC
3: .SH NAME
4: xstr \- extract strings from C programs to implement shared strings
5: .SH SYNOPSIS
6: .B xstr
7: [
8: .B \-c
9: ] [
10: .B \-
11: ] [
12: file
13: ]
14: .SH DESCRIPTION
15: .I Xstr
16: maintains a file
17: .I strings
18: into which strings in component parts of a large program are hashed.
19: These strings are replaced with references to this common area.
20: This serves to implement shared constant strings, most useful if they
21: are also read-only.
22: .PP
23: The command
24: .PP
25: .DT
26: \fBxstr \-c\fR name
27: .PP
28: will extract the strings from the C source in name, replacing
29: string references by expressions of the form (&xstr[number])
30: for some number.
31: An appropriate declaration of
32: .I xstr
33: is prepended to the file.
34: The resulting C text is placed in the file
35: .I x.c,
36: to then be compiled.
37: The strings from this file are placed in the
38: .I strings
39: data base if they are not there already.
40: Repeated strings and strings which are suffices of existing strings
41: do not cause changes to the data base.
42: .PP
43: After all components of a large program have been compiled a file
44: .I xs.c
45: declaring the common
46: .I xstr
47: space can be created by a command of the form
48: .PP
49: .DT
50: \fBxstr\fR
51: .PP
52: This
53: .I xs.c
54: file should then be compiled and loaded with the rest
55: of the program.
56: If possible, the array can be made read-only (shared) saving
57: space and swap overhead.
58: .PP
59: .I Xstr
60: can also be used on a single file.
61: A command
62: .PP
63: .DT
64: \fBxstr\fR name
65: .PP
66: creates files
67: .I x.c
68: and
69: .I xs.c
70: as before, without using or affecting any
71: .I strings
72: file in the same directory.
73: .PP
74: It may be useful to run
75: .I xstr
76: after the C preprocessor if any macro definitions yield strings
77: or if there is conditional code which contains strings
78: which may not, in fact, be needed.
79: .I Xstr
80: reads from its standard input when the argument `\-' is given.
81: An appropriate command sequence for running
82: .I xstr
83: after the C preprocessor is:
84: .PP
85: .nf
86: .DT
87: \fBcc \-E\fR name.c | \fBxstr \-c\fR \-
88: \fBcc \-c\fR x.c
89: \fBmv\fR x.o name.o
90: .fi
91: .PP
92: .I Xstr
93: does not touch the file
94: .I strings
95: unless new items are added, thus
96: .I make
97: can avoid remaking
98: .I xs.o
99: unless truly necessary.
100: .SH FILES
101: .DT
102: strings Data base of strings
103: .br
104: x.c Massaged C source
105: .br
106: xs.c C source for definition of array `xstr'
107: .br
108: /tmp/xs* Temp file when `xstr name' doesn't touch
109: .I strings
110: .SH "SEE ALSO"
111: mkstr(1)
112: .SH AUTHOR
113: William Joy
114: .SH BUGS
115: If a string is a suffix of another string in the data base,
116: but the shorter string is seen first by
117: .I xstr
118: both strings will be placed in the data base, when just
119: placing the longer one there will do.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.