diff options
Diffstat (limited to 'static/unix-v10/man8/xstr.8')
| -rw-r--r-- | static/unix-v10/man8/xstr.8 | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/static/unix-v10/man8/xstr.8 b/static/unix-v10/man8/xstr.8 new file mode 100644 index 00000000..681f2e2f --- /dev/null +++ b/static/unix-v10/man8/xstr.8 @@ -0,0 +1,108 @@ +.TH XSTR 8 +.CT 1 prog_c +.SH NAME +xstr \- preprocessor for sharing strings in C programs +.SH SYNOPSIS +.B xstr +[ +.B -c +] +[ +.B - +] +[ +.I file +] +.SH DESCRIPTION +.I Xstr +maintains a file +.F strings +into which strings in component parts of a large program are hashed. +These strings are replaced with references to this common area. +This serves to implement shared constant strings, most useful if they +are also read-only. +.PP +The command +.IP +.L +xstr -c name.c +.PP +will extract the strings from the named C source, replacing +string references by expressions of the form +.BI (&xstr[ number ]) +for some +.I number. +An appropriate declaration of +.I xstr +is prepended to the file. +The resulting C text is placed in the file +.BR x.c . +The strings from this file are placed in the +.F strings +data base if they are not there already. +Repeated strings and strings which are suffixes of existing strings +do not cause changes to the data base. +.PP +After all components of a large program have been compiled a file +.B xs.c +declaring the common +.I xstr +space can be created by running +.B xstr +with no arguments. +This +.B xs.c +file should then be compiled and loaded with the rest +of the program. +If possible, the array can be made read-only (shared) saving +space and swap overhead. +.PP +Without option +.BR -c , +creates files +.I x.c +and +.I xs.c +as before, but does not use or affect any +.F strings +file in the same directory. +.PP +It may be useful to run +.I xstr +after the C preprocessor if any macro definitions yield strings +or if there is conditional code which contains strings +which may not, in fact, be needed. +.I Xstr +reads from its standard input when the argument +.L - +is given. +An appropriate command sequence for running +.I xstr +after the C preprocessor is: +.IP +.EX +cc -E name.c | xstr -c - +cc -c x.c +mv x.o name.o +.EE +.SH FILES +.TF /tmp/xs* +.TP +.F strings +Data base of strings +.TP +.F x.c +Massaged C source +.TP +.F xs.c +C source for definition of array +.L xstr +.TP +.F /tmp/xs* +Temp file +.SH BUGS +If a string is a suffix of another string in the data base, +but the shorter string is seen first by +.I xstr +both strings will be placed in the data base, when just +placing the longer one there will do. |
