|
|
1.1 root 1: .TH XSTR 8
2: .CT 1 prog_c
3: .SH NAME
4: xstr \- preprocessor for sharing strings in C programs
5: .SH SYNOPSIS
6: .B xstr
7: [
8: .B -c
9: ]
10: [
11: .B -
12: ]
13: [
14: .I file
15: ]
16: .SH DESCRIPTION
17: .I Xstr
18: maintains a file
19: .F strings
20: into which strings in component parts of a large program are hashed.
21: These strings are replaced with references to this common area.
22: This serves to implement shared constant strings, most useful if they
23: are also read-only.
24: .PP
25: The command
26: .IP
27: .L
28: xstr -c name.c
29: .PP
30: will extract the strings from the named C source, replacing
31: string references by expressions of the form
32: .BI (&xstr[ number ])
33: for some
34: .I number.
35: An appropriate declaration of
36: .I xstr
37: is prepended to the file.
38: The resulting C text is placed in the file
39: .BR x.c .
40: The strings from this file are placed in the
41: .F strings
42: data base if they are not there already.
43: Repeated strings and strings which are suffixes of existing strings
44: do not cause changes to the data base.
45: .PP
46: After all components of a large program have been compiled a file
47: .B xs.c
48: declaring the common
49: .I xstr
50: space can be created by running
51: .B xstr
52: with no arguments.
53: This
54: .B xs.c
55: file should then be compiled and loaded with the rest
56: of the program.
57: If possible, the array can be made read-only (shared) saving
58: space and swap overhead.
59: .PP
60: Without option
61: .BR -c ,
62: creates files
63: .I x.c
64: and
65: .I xs.c
66: as before, but does not use or affect any
67: .F strings
68: file in the same directory.
69: .PP
70: It may be useful to run
71: .I xstr
72: after the C preprocessor if any macro definitions yield strings
73: or if there is conditional code which contains strings
74: which may not, in fact, be needed.
75: .I Xstr
76: reads from its standard input when the argument
77: .L -
78: is given.
79: An appropriate command sequence for running
80: .I xstr
81: after the C preprocessor is:
82: .IP
83: .EX
84: cc -E name.c | xstr -c -
85: cc -c x.c
86: mv x.o name.o
87: .EE
88: .SH FILES
89: .TF /tmp/xs*
90: .TP
91: .F strings
92: Data base of strings
93: .TP
94: .F x.c
95: Massaged C source
96: .TP
97: .F xs.c
98: C source for definition of array
99: .L xstr
100: .TP
101: .F /tmp/xs*
102: Temp file
103: .SH BUGS
104: If a string is a suffix of another string in the data base,
105: but the shorter string is seen first by
106: .I xstr
107: both strings will be placed in the data base, when just
108: 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.