3 if test -f config.sh; then TOP=.;
4 elif test -f ../config.sh; then TOP=..;
5 elif test -f ../../config.sh; then TOP=../..;
6 elif test -f ../../../config.sh; then TOP=../../..;
7 elif test -f ../../../../config.sh; then TOP=../../../..;
9 echo "Can't find config.sh."; exit 1
15 */*) cd `expr X$0 : 'X\(.*\)/'` ;;
17 echo "Extracting mcon/makegloss (with variable substitutions)"
18 $spitshell >makegloss <<!GROK!THIS!
20 eval "exec perl -S \$0 \$*"
21 if \$running_under_some_shell;
24 $spitshell >>makegloss <<'!NO!SUBS!'
25 # $Id: makegloss.SH,v 3.0.1.3 1994/01/24 14:17:49 ram Exp $
27 # Copyright (c) 1991-1993, Raphael Manfredi
29 # You may redistribute only under the terms of the Artistic Licence,
30 # as specified in the README file that comes with the distribution.
31 # You may reuse parts of this distribution only within the terms of
32 # that same Artistic Licence; a copy of which may be found at the root
33 # of the source tree for dist 3.0.
35 # Original Author: Larry Wall <lwall@netlabs.com>
37 # $Log: makegloss.SH,v $
38 # Revision 3.0.1.3 1994/01/24 14:17:49 ram
39 # patch16: now understands internal-use only defined variables
41 # Revision 3.0.1.2 1993/10/16 13:50:39 ram
42 # patch12: updated to support new ?M: lines
44 # Revision 3.0.1.1 1993/08/19 06:42:21 ram
45 # patch1: leading config.sh searching was not aborting properly
47 # Revision 3.0 1993/08/18 12:10:12 ram
48 # Baseline for dist 3.0 netwide release.
51 open(G,">Glossary") || die "Can't create Glossary.\n";
53 '[This Glossary is automatically generated from the Unit files. Do not edit
54 this file or your changes will be lost. Edit the appropriate Unit instead.]
56 This file contains a listing of all the C preprocessor symbols and shell
57 variables whose value can be determined by a Configure script. For the
58 most part, any symbol in UPPERCASE is a C preprocessor symbol, and
59 will be defined in config.h. Symbols in lowercase are shell variables,
60 and are defined in config.sh.
62 If you write your shell scripts and C programs in terms of these symbols,
63 metaconfig can automatically build you a Configure script that will determine
64 the value of those symbols. See the README file for a description of how
67 In the following listing, the Unit: line indicates the name of the unit
68 where this symbol is defined, and the Wants: line indicates what other
69 symbols must be determined in order to figure out the value of this one.
70 If there is an "(Also defines ...)" entry, it indicates what other symbols
71 are defined by the Unit other than the one corresponding to the unit name.
73 Variable of the form d_* either have the value "define" or "/*define", and
74 control whether some C preprocessor symbol gets defined or not.
80 if (/^\?[\w\-]+:/) { # We may have found a control line
81 # Long lines may be escaped with a final backslash
82 $_ .= &complete_line if s/\\\s*$//;
85 ($also, $wants) = /^\?MAKE:\s*(.*):\s*(.*)/;
86 ($unit = $ARGV) =~ s|.*/(.*)\.U$|$1|;
87 @Also = split(/ /, $also);
100 @Wants = split(/ /, $wants);
114 $_ .= " (Also defines $also)" if $also;
115 $_ .= " (With private $internal)" if $internal;
116 $head .= do format($_);
118 $_ = "Wants: $wants";
119 $head .= do format($_);
122 $_ = "Optional: $option";
123 $head .= do format($_);
128 # Example of expression matched by the following pattern:
129 # ?C:symbol ~ alias (obsolete list):
130 # The main symbol (optionally aliased) can be followed by a list of
131 # obsolete symbols (the list is space separated).
133 if (/^\?[CS]:(\w+)(\s*~\s*\S+)?\s*(\(.*\))?:\s*$/) {
137 $header{$sym} .= $head;
138 if ($obsoleted =~ s/^\((.*)\)$/$1/) {
139 @obsoleted = split(' ', $obsoleted);
140 foreach $obs (@obsoleted) {
142 $header{$obs} = "\tObsoleted by $sym.\n\n";
146 elsif (s/^\?[CS]://) { # Must be inside definition
147 if (/^\.$/) { # Closing line
152 s/^(\t| ? ? ? ? ? ? ?)//;
153 $def{$sym} .= "\t" . $_;
156 elsif (/^\?M:(\w+):\s*([\w\s]*)\n$/) { # Magic mapping introduction
161 $cdep = ", needs: $cdep" if $cdep ne '';
162 $header{$sym} = "\tMagic symbol$cdep\n" . $head;
164 elsif (s/^\?M://) { # Must be a magic mapping definition
165 if (/^\.$/) { # Closing line
169 $def{$sym} .= "\t" . $_;
174 foreach $sym (sort @syms) {
176 print G $header{$sym};
181 # Format $_ to fit in 80 columns (70 + size of tabs)
182 # Long lines are split, and the all but the first are indented
183 # by two leading spaces. The whole thing is then indented by
188 local($_) = shift(@_);
189 while (length($_) > 70) {
190 $tmp = substr($_,0,70);
191 $tmp =~ s/^(.*) .*/$1/;
193 $_ = ' ' . substr($_,length($tmp),9999);
198 # The first line was escaped with a final \ character. Every following line
199 # is to be appended to it (until we found a real \n not escaped). Note that
200 # the leading spaces of the continuation line are removed, so any space should
201 # be added before the former \ if needed.
204 local($read) = ''; # Concatenation of all the continuation lines found
206 s/^\s+//; # Remove leading spaces
207 if (s/\\\s*$//) { # Still followed by a continuation line
209 } else { # We've reached the end of the continuation