2 * $Id
: cmpdef.
cmd,v
1.2 1998/08/29 21:44:47 tom Exp $
4 * Author
: Juan Jose Garcia Ripoll
<worm@arrakis.es
>.
5 * Webpage
: http
://www.arrakis.es
/~worm
/
7 * cmpdef.
cmd - compares two .def
files, checking whether they have
8 * the same entries with the same export codes.
10 * returns
0 if there are no conflicts between the
files -- that is
,
11 * the newer one can
replace the older one.
13 * returns
1 when either of the
files is
not properly formatted and
14 * when there are conflicts
: two symbols having the same export code.
16 * the standard output shows a list with newly added symbols
, plus
17 * replaced symbols and conflicts.
19 parse arg def_file1 def_file2
21 def_file1
= translate
(def_file1
,'\','/')
22 def_file2 = translate(def_file2,'\','/')
27 * `cmp
' is zero when the last file is valid and upward compatible
28 * `numbers' is the stem where symbols are stored
35 * This sed expression cleans empty lines
, comments and special .DEF
36 * commands
, such as LIBRARY...
, EXPORTS...
, etc
38 tidy_up
= '"s/[ ][ ]*/ /g;s/;.*//g;/^[ ]*$/d;/^[a-zA-Z]/d;"'
41 * First we
find all public symbols from the original DLL. All this
42 * information is pushed into a REXX private list with the RXQUEUE
46 'type' def_file1
'| sed' tidy_up
'| sort | rxqueue'
50 * We retrieve the symbol name
(NAME
) and its number
(NUMBER
)
52 parse pull
'"' name
'"' '@'number rest
53 if number
= '' || name
= '' then
55 say 'Corrupted file' def_file1
56 say 'Symbol' name
'has no number'
67 * Now we
find all public symbols from the new DLL
, and compare.
69 'type' def_file2
'| sed' tidy_up
'| sort | rxqueue'
72 parse pull
'"' name
'"' '@'number rest
73 if name
= '' | number
= '' then
75 say 'Corrupted file' def_file2
76 say 'Symbol' name
'has no number'
79 if numbers.name
= 0 then
82 if names.number
= '' then
83 say 'New symbol' name
'with code @'number
85 say 'Conflict old =' names.number
', new =' name
'at @'number
87 else if numbers.name \
= number
then
90 say name
'Symbol' name
'changed from @'numbers.name
'to @'number
97 * Cleans the REXX queue by pulling and forgetting every line.
98 * This is needed
, at least
, when `cmpdef.
cmd' starts, because an aborted
99 * REXX program might have left some rubbish in.
101 CleanQueue: procedure
102 do while queued() > 0