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
: chkdef.
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 * chkdef.
cmd - checks that a .def file has no conflicts and is properly
38 * returns nonzero
if two symbols have the same code or a line has a wrong
43 * the standard output shows conflicts.
47 def_file
= translate
(def_file
,'\','/')
52 * `cmp' is zero
when the file is valid
53 * `codes
' associates a name to a code
54 * `names' associates a code to a name
61 * This sed expression cleans empty lines
, comments and special .DEF
62 * commands
, such as LIBRARY...
, EXPORTS...
, etc
64 tidy_up
= '"s/[ ][ ]*/ /g;s/;.*//g;/^[ ]*$/d;/^[a-zA-Z]/d;"'
67 * First we
find all public symbols from the original DLL. All this
68 * information is pushed into a REXX private list with the RXQUEUE
72 'type' def_file
'| sed' tidy_up
'| sort | rxqueue'
76 * We retrieve the symbol name
(NEW_NAME
) and its code
(NEW_CODE
)
78 parse pull
'"' new_name
'"' '@'new_code rest
80 when (new_code
= '') |
(new_name
= '') then
81 /* The input was
not properly formatted
*/
83 say 'Error: symbol "'new_name
'" has no export code or is empty'
86 when codes.new_name \
= 0 then
87 /* This symbol was already defined
*/
88 if codes.new_name \
= new_code
then
91 say 'Symbol "'new_name
'" multiply defined'
93 when names.new_code \
= '' then
94 /* This code was already assigned to a symbol
*/
95 if names.new_code \
= new_name
then
98 say 'Conflict with "'names.new_code
'" & "'new_name
'" being @'new_code
102 codes.new_name
= new_code
103 names.new_code
= new_name
110 CleanQueue
: procedure
111 do while queued
() > 0