|
|
1.1 root 1: .\" Copyright (c) 1980 The Regents of the University of California.
2: .\" All rights reserved.
3: .\"
4: .\" Redistribution and use in source and binary forms are permitted provided
5: .\" that: (1) source distributions retain this entire copyright notice and
6: .\" comment, and (2) distributions including binaries display the following
7: .\" acknowledgement: ``This product includes software developed by the
8: .\" University of California, Berkeley and its contributors'' in the
9: .\" documentation or other materials provided with the distribution and in
10: .\" all advertising materials mentioning features or use of this software.
11: .\" Neither the name of the University nor the names of its contributors may
12: .\" be used to endorse or promote products derived from this software without
13: .\" specific prior written permission.
14: .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
15: .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
16: .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17: .\"
18: .\" @(#)xstr.1 6.3 (Berkeley) 6/6/90
19: .TH XSTR 1 "June 6, 1990"
20: .UC
21: .SH NAME
22: xstr \- extract strings from C programs to implement shared strings
23: .SH SYNOPSIS
24: .B xstr
25: [
26: .B \-c
27: ] [
28: .B \-
29: ] [
30: file
31: ]
32: .SH DESCRIPTION
33: .I Xstr
34: maintains a file
35: .I strings
36: into which strings in component parts of a large program are hashed.
37: These strings are replaced with references to this common area.
38: This serves to implement shared constant strings, most useful if they
39: are also read-only.
40: .PP
41: The command
42: .PP
43: .DT
44: \fBxstr \-c\fR name
45: .PP
46: will extract the strings from the C source in name, replacing
47: string references by expressions of the form (&xstr[number])
48: for some number.
49: An appropriate declaration of
50: .I xstr
51: is prepended to the file.
52: The resulting C text is placed in the file
53: .I x.c,
54: to then be compiled.
55: The strings from this file are placed in the
56: .I strings
57: data base if they are not there already.
58: Repeated strings and strings which are suffices of existing strings
59: do not cause changes to the data base.
60: .PP
61: After all components of a large program have been compiled a file
62: .I xs.c
63: declaring the common
64: .I xstr
65: space can be created by a command of the form
66: .PP
67: .DT
68: \fBxstr\fR
69: .PP
70: This
71: .I xs.c
72: file should then be compiled and loaded with the rest
73: of the program.
74: If possible, the array can be made read-only (shared) saving
75: space and swap overhead.
76: .PP
77: .I Xstr
78: can also be used on a single file.
79: A command
80: .PP
81: .DT
82: \fBxstr\fR name
83: .PP
84: creates files
85: .I x.c
86: and
87: .I xs.c
88: as before, without using or affecting any
89: .I strings
90: file in the same directory.
91: .PP
92: It may be useful to run
93: .I xstr
94: after the C preprocessor if any macro definitions yield strings
95: or if there is conditional code which contains strings
96: which may not, in fact, be needed.
97: .I Xstr
98: reads from its standard input when the argument `\-' is given.
99: An appropriate command sequence for running
100: .I xstr
101: after the C preprocessor is:
102: .PP
103: .nf
104: .DT
105: \fBcc \-E\fR name.c | \fBxstr \-c\fR \-
106: \fBcc \-c\fR x.c
107: \fBmv\fR x.o name.o
108: .fi
109: .PP
110: .I Xstr
111: does not touch the file
112: .I strings
113: unless new items are added, thus
114: .I make
115: can avoid remaking
116: .I xs.o
117: unless truly necessary.
118: .SH FILES
119: .DT
120: strings Data base of strings
121: .br
122: x.c Massaged C source
123: .br
124: xs.c C source for definition of array `xstr'
125: .br
126: /tmp/xs* Temp file when `xstr name' doesn't touch
127: .I strings
128: .SH "SEE ALSO"
129: mkstr(1)
130: .SH BUGS
131: If a string is a suffix of another string in the data base,
132: but the shorter string is seen first by
133: .I xstr
134: both strings will be placed in the data base, when just
135: 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.