comparison lisp/hyperbole/smart-clib-sym @ 0:376386a54a3c r19-14

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