annotate src/src-headers @ 329:58bac07dfa74 r21-0-62

Import from CVS: tag r21-0-62
author cvs
date Mon, 13 Aug 2007 10:48:41 +0200
parents c5d627a313b1
children 74fd4e045ea6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
1 : #-*- Perl -*-
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
2 # Copyright (C) 1998 Free Software Foundation, Inc.
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
3
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
4 # This file is part of XEmacs.
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
5 #
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
6 # XEmacs is free software; you can redistribute it and/or modify it
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
7 # under the terms of the GNU General Public License as published by the
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
8 # Free Software Foundation; either version 2, or (at your option) any
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
9 # later version.
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
10 #
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
11 # XEmacs is distributed in the hope that it will be useful, but WITHOUT
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
14 # for more details.
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
15 #
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
16 # You should have received a copy of the GNU General Public License
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
17 # along with XEmacs; see the file COPYING. If not, write to
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
18 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
19 # Boston, MA 02111-1307, USA.
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
20
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
21 # Author: Martin Buchholz
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
22 eval 'exec perl -w -S $0 ${1+"$@"}'
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
23 if 0;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
24
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
25 use strict;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
26 my ($myName, $srcdir);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
27
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
28 ($myName = $0) =~ s@.*/@@; my $usage ="
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
29 Usage: $myName
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
30
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
31 Generates header file fragments from the Emacs sources.
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
32 ";
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
33
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
34 die $usage if @ARGV;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
35
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
36 ($srcdir = $0) =~ s@[^/]+$@@;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
37 chdir $srcdir or die "$srcdir: $!";
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
38
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
39 # Find include dependencies
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
40 my (%exists, %uses);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
41 opendir SRCDIR, "." or die "$srcdir: $!";
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
42 for (grep (/\.[ch]$/, readdir (SRCDIR))) { $exists{$_} = 1; }
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
43 closedir SRCDIR;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
44 {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
45 my %generated_header;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
46 for (qw (config.h puresize-adjust.h sheap-adjust.h paths.h Emacs.ad.h)) {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
47 $generated_header{$_} = 1;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
48 }
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
49
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
50 for my $file (keys %exists) {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
51 open (FILE, $file) or die "$file: $!";
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
52 undef $/; $_ = <FILE>;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
53 RemoveComments ($_);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
54 s/[ \t]+//g;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
55 for (/^\#include([^\n]+)/gmo) {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
56 if (m@^\"([A-Za-z0-9_-]+\.h)\"@) {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
57 $uses{$file}{$1} = 1 if exists $exists{$1};
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
58 } elsif (m@<([A-Za-z0-9_-]+\.h)>@) {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
59 $uses{$file}{$1} = 1 if exists $generated_header{$1};
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
60 } elsif (m@\"../lwlib/([A-Za-z0-9_-]+\.h)\"@) {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
61 $uses{$file}{"\$(LWLIB_SRCDIR)/lwlib.h"} = 1;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
62 }
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
63 }
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
64 }
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
65
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
66 # Make transitive closure of %uses
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
67 while (1) {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
68 my $changedP = 0;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
69 for my $x (keys %uses) {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
70 for my $y (keys %{$uses{$x}}) {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
71 for my $z (keys %{$uses{$y}}) {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
72 if (! exists $uses{$x}{$z}) {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
73 $uses{$x}{$z} = 1;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
74 $changedP = 1;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
75 }
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
76 }
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
77 }
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
78 }
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
79 last if !$changedP;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
80 }
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
81 } # End of finding include dependencies
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
82
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
83 my (%used, %maxargs);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
84 my $minargs = '(?:[0-8])';
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
85 my $maxargs = '(?:[0-8]|MANY|UNEVALLED)';
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
86 my $doc = "(?:0|STR)";
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
87 my $fun = '(?:\\bF[a-z0-9_]+X?\\b)';
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
88 my $defun = "^DEFUN\\s*\\(\\s+STR\\s+($fun)\\s+$minargs\\s+($maxargs)\\s+$doc\\s+\\(";
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
89 my $var = '(?:\\b(?:Q[KS]?[a-z0-9_]+D?|V(?:[a-z0-9_]+)|Q_TT[A-Z]+)\\b)';
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
90 my $pat = "(?:$var|$fun)";
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
91 my %automagic;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
92 my (%decl_file, %defn_file);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
93
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
94 for my $file (keys %exists) {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
95 open (FILE, $file) or die "$file: $!";
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
96 undef $/; $_ = <FILE>;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
97 RemoveComments($_);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
98 RemoveStrings ($_);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
99 s/,/ /gmo;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
100 s/^\s*EXFUN[^\n]+//gmo;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
101
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
102 # Now search for DECLARE_LRECORD to find types for predicates
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
103 for my $sym (/^DECLARE_LRECORD\s*\(\s*([a-z_]+)\s+struct /gmo) {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
104 $automagic{"Q${sym}p"} = 1;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
105 }
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
106
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
107 if ($file =~ /\.c$/) {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
108 my @match = (/$defun/gmo);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
109 while (my $fun = shift @match) {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
110 $defn_file{$fun} = $file;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
111 $maxargs{$fun} = shift @match;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
112 }
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
113
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
114 # Now do Lisp_Object variables
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
115 for my $defs (/^\s*Lisp_Object\s+((?:$var\s*)+)\s*;/gmo) {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
116 for my $var (split (' ',$defs)) {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
117 $defn_file{$var} = $file;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
118 }
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
119 }
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
120 }
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
121
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
122 # Remove declarations of Lisp_Objects
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
123 s/^extern\s+Lisp_Object\s+(?:$var\s*)+\s*;//gmo;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
124
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
125 # Remove declarations of functions
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
126 s/^Lisp_Object $fun//;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
127
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
128 # Find all uses of symbols
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
129 for (/($pat)/gmo) { $used{$_}{$file} = 1; }
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
130 }
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
131
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
132 my %candidates;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
133 for my $file (keys %exists) {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
134 @{$candidates{$file}} = ();
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
135 my $header1 = $file; $header1 =~ s/\.c$/.h/;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
136 my $header2 = $header1; $header2 =~ s/-\w+\././;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
137 push @{$candidates{$file}}, $header1 if exists $exists{$header1};
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
138 push @{$candidates{$file}}, $header2 if exists $exists{$header2} &&
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
139 $header1 ne $header2;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
140 }
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
141
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
142 SYM: for my $sym (keys %used) {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
143 next SYM unless my $defn_file = $defn_file{$sym};
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
144 my @users = keys %{$used{$sym}};
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
145 if (@users == 1) {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
146 die "$sym\n" unless $defn_file eq $users[0];
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
147 next SYM;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
148 }
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
149 for my $candidate (@{$candidates{$defn_file}}) {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
150 if (!grep (!exists $uses{$_}{$candidate}, @users)) {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
151 $decl_file{$sym} = $candidate;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
152 next SYM;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
153 }
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
154 }
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
155 $decl_file{$sym} = 'lisp.h';
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
156 }
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
157
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
158 # Print global Lisp_Objects
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
159 {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
160 my $line;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
161 sub flushvars {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
162 if (defined $line) {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
163 print "extern Lisp_Object $line;\n";
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
164 undef $line;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
165 }
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
166 }
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
167
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
168 sub printvar {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
169 my $var = shift;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
170 if (!defined $line) { $line = $var; return; }
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
171 if ($var =~ /^Vcharset_/) {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
172 flushvars ();
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
173 $line = $var;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
174 flushvars ();
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
175 return;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
176 }
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
177 if (length "$line, $var" > 59) {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
178 flushvars (); $line = $var; return;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
179 }
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
180 $line = "$line, $var";
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
181 }
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
182 END { flushvars (); }
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
183 }
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
184
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
185 delete @decl_file{ keys %automagic, qw(Qzero Qnull_pointer)};
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
186
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
187 # Print Lisp_Object var declarations
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
188 for my $file (keys %exists) {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
189
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
190 # Print EXFUNs
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
191 if (my @funs = grep ($decl_file{$_} eq $file && exists $maxargs{$_},
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
192 keys %decl_file)) {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
193 print "\n\n$file:\n\n";
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
194 for $fun (sort @funs) {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
195 print "EXFUN ($fun, $maxargs{$fun});\n";
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
196 }
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
197 print "\n";
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
198 }
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
199
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
200 if (my @vars = grep ($decl_file{$_} eq $file && /^[QV]/, keys %decl_file)) {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
201 print "\n\n$file:\n\n";
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
202 for $var (sort @vars) {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
203 printvar ($var);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
204 }
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
205 flushvars ();
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
206 print "\n\n";
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
207 }
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
208 }
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
209
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
210 #for my $var (sort grep (keys %{$used{$_}} > 1 , keys %defn_file)) {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
211 # printvar ($var);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
212 #}
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
213
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
214 sub RemoveComments {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
215 $_[0] =~
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
216 s{ (
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
217 [^\"\'/]+ |
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
218 (?:\"[^\"\\]*(?:\\.[^\"\\]*)*\" [^\"\'/]*)+ |
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
219 (?:\'[^\'\\]*(?:\\.[^\'\\]*)*\' [^\"\'/]*)+
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
220 )
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
221 | / (?:
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
222 \*[^*]*\*+(?:[^/*][^*]*\*+)*/
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
223 |
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
224 /[^\n]*
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
225 )
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
226 }{defined $1 ? $1 : ""}gsxeo;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
227 }
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
228
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
229 sub RemoveStrings {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
230 $_[0] =~
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
231 s{ (
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
232 (?:\"[^\"\\]*(?:\\.[^\"\\]*)*\") |
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
233 (?:\'[^\'\\]*(?:\\.[^\'\\]*)*\')
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
234 )
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
235 }{ STR }gxo;
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents:
diff changeset
236 }