1 /****************************************************************************
2 * Copyright
(c
) 1998,2006 Free Software Foundation
, Inc.
*
4 * Permission is hereby granted
, free of charge
, to any person obtaining a
*
5 * copy of this software and associated documentation
files (the
*
6 * "Software"), to deal in the Software without restriction
, including
*
7 * without limitation the rights to
use, copy, modify
, merge
, publish
, *
8 * distribute
, distribute with modifications
, sublicense
, and
/or sell
*
9 * copies of the Software
, and to permit persons to whom the Software is
*
10 * furnished to
do so
, subject to the following conditions
: *
12 * The above copyright notice and this permission notice shall be included
*
13 * in all copies or substantial portions of the Software.
*
15 * THE SOFTWARE IS PROVIDED
"AS IS", WITHOUT WARRANTY OF ANY KIND
, EXPRESS
*
16 * OR IMPLIED
, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF
*
17 * MERCHANTABILITY
, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
*
18 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM
, *
19 * DAMAGES OR OTHER LIABILITY
, WHETHER IN AN ACTION OF CONTRACT
, TORT OR
*
20 * OTHERWISE
, ARISING FROM
, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
*
21 * THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
*
23 * Except as contained in this notice
, the name
(s
) of the above copyright
*
24 * holders shall
not be used in advertising or otherwise to promote the
*
25 * sale
, use or other dealings in this Software without prior written
*
27 ****************************************************************************/
30 * $Id
: cmpdef.
cmd,v
1.3 2006/04/22 23:14:50 tom Exp $
32 * Author
: Juan Jose Garcia Ripoll
<worm@arrakis.es
>.
33 * Webpage
: http
://www.arrakis.es
/~worm
/
35 * cmpdef.
cmd - compares two .def
files, checking whether they have
36 * the same entries with the same export codes.
38 * returns
0 if there are no conflicts between the
files -- that is
,
39 * the newer one can
replace the older one.
41 * returns
1 when either of the
files is
not properly formatted and
42 * when there are conflicts
: two symbols having the same export code.
44 * the standard output shows a list with newly added symbols
, plus
45 * replaced symbols and conflicts.
47 parse arg def_file1 def_file2
49 def_file1
= translate
(def_file1
,'\','/')
50 def_file2 = translate(def_file2,'\','/')
55 * `cmp
' is zero when the last file is valid and upward compatible
56 * `numbers' is the stem where symbols are stored
63 * This sed expression cleans empty lines
, comments and special .DEF
64 * commands
, such as LIBRARY...
, EXPORTS...
, etc
66 tidy_up
= '"s/[ ][ ]*/ /g;s/;.*//g;/^[ ]*$/d;/^[a-zA-Z]/d;"'
69 * First we
find all public symbols from the original DLL. All this
70 * information is pushed into a REXX private list with the RXQUEUE
74 'type' def_file1
'| sed' tidy_up
'| sort | rxqueue'
78 * We retrieve the symbol name
(NAME
) and its number
(NUMBER
)
80 parse pull
'"' name
'"' '@'number rest
81 if number
= '' || name
= '' then
83 say 'Corrupted file' def_file1
84 say 'Symbol' name
'has no number'
95 * Now we
find all public symbols from the new DLL
, and compare.
97 'type' def_file2
'| sed' tidy_up
'| sort | rxqueue'
100 parse pull
'"' name
'"' '@'number rest
101 if name
= '' | number
= '' then
103 say 'Corrupted file' def_file2
104 say 'Symbol' name
'has no number'
107 if numbers.name
= 0 then
110 if names.number
= '' then
111 say 'New symbol' name
'with code @'number
113 say 'Conflict old =' names.number
', new =' name
'at @'number
115 else if numbers.name \
= number
then
118 say name
'Symbol' name
'changed from @'numbers.name
'to @'number
125 * Cleans the REXX queue by pulling and forgetting every line.
126 * This is needed
, at least
, when `cmpdef.
cmd' starts, because an aborted
127 * REXX program might have left some rubbish in.
129 CleanQueue: procedure
130 do while queued() > 0