annotate lisp/hyperbole/smart-clib-sym @ 110:fe104dbd9147 r20-1b7

Import from CVS: tag r20-1b7
author cvs
date Mon, 13 Aug 2007 09:19:45 +0200
parents 376386a54a3c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 #!/bin/csh -f
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 #
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 # SUMMARY: Test whether symbol appears within a set of C libraries.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 # USAGE: <script-name> <symbol-string>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 #
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 # AUTHOR: Bob Weiner
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 # ORG: Brown U.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 #
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 # ORIG-DATE: 5-Oct-91 at 03:29:05
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 # LAST-MOD: 25-Aug-95 at 02:23:17 by Bob Weiner
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 #
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 # This file is part of Hyperbole.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 # Available for use and distribution under the same terms as GNU Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 #
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 # Copyright (C) 1991-1995, Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 # Developed with support from Motorola Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 #
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 # DESCRIPTION:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 #
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 # Create the file given by the variable 'clib_list' below, and place in that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 # file the full path for each C, C++ or Objective-C library that you want
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 # scanned for symbol names. One filename per line. Do not quote the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 # filenames.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 #
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 # Handles exact name matches only. Echos and exits with same output value.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 # Either 1 if symbol is found or 0 if not.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 #
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 # DESCRIP-END.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 # Perl script used to tell whether one file is newer than another.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 #
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 set fn = "file-newer"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 # Create this file and place in the file the full path for each C, C++ or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 # Objective-C library that you want scanned for symbol names. One filename
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 # per line. Do not quote the filenames.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 #
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 set clib_list = "~/.CLIBS-LIST"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 # This file will automatically be created to cache the symbol names.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 # Remove it if you ever want to rebuild the symbol table.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 #
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 set clib_symbols = "~/.clibs-symbols"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 # Try to locate 'perl' and 'file-newer' script for use.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 which perl >& /dev/null
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 if ($status) unset fn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 set st = 0 rebuild = 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 if (-e $clib_list) then
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 if (! -e $clib_symbols || -z $clib_symbols) set rebuild = 1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 if (! $rebuild && $?fn) @ rebuild = `perl $fn $clib_list $clib_symbols`
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 if ($rebuild) then
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 nm -g `cat $clib_list` | grep '^[0-9 ].* _[A-Za-z]' | sed -e 's/^[^_][^_]*_//g' | sort | uniq > $clib_symbols
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 fgrep -sx $1 $clib_symbols >& /dev/null
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 @ st = ! $status
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 echo $st
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 exit $st