Richard Levitte - VMS Whacker wrote:
> 
> drh> Personally I'm against this. It'll just be extra baggage to
> drh> install (and get working cross platform) and extra dependencies
> drh> with IMHO minimal benefits.
> 
> The dependencies is something I don't view as a problem, but I think
> that avoiding to have .err files installed is a valid reason.
> 
> drh> An alternative is to dispense with the .err files completely and
> drh> use the relevant header file for the information.
> 
> Absolutely.  Does anyone know the reason for the .err files to exist
> at all?  Were they perchance automagically generated once upon a time?
> If so, are they still (no, I haven't looked too closely)?

I'll explain the situation in case anyone isn't too sure how this
works and in case someone can see a hole in my argument.

The error codes are all generated automagically when you do 'make
errors' at the top level.

If you examine crypto/Makefile you'll see it call the  err_code.pl
script:

errgen:
        $(PERL) ./err/err_code.pl -conf err/ssleay.ec *.c */*.c         
../ssl/*.c ../rsaref/*.c


What this does is scan all the C source files for error codes. It builds
up a list for each kind based on the list of types in the ssleay.ec
config file. It then checks the list against those already present in
the .err file: if there are no new codes it leaves the file alone,
otherwise it adds the new errors with appropriate codes (it used to
rebuild the .err file each time which meant the codes could change
whenever a new one was added: it doesn't any more).

Each individual Makefile then has something of the form:

$(ERRC).c: $(ERR).err
        $(PERL) $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h
        $(PERL) err/err_genc.pl -s $(ERR).h $(ERRC).c

err-ins.pl just takes the stuff in the .err file and inserts it into the
header file. 

The second script err_genc.pl is rather more interesting. It loads the
error codes from the header file and function names from the prototypes
in the header file. It then generates appropriate text messages by
conversion of the function codes into function names and the reason
codes into text strings. This is converted into C source code.

One problem with err_genc.pl is that it only checks the one header file
for the function names. As a result any function names not in the header
file, for example in a different header file or static functions in the
source code, don't get converted and stay capitalized.

Now my proposal would go something like this.

Do away with the .err files because the same information is contained in
the header file.

Change the method of error insertion and C code generation into a single
script that does the whole lot. Since it would access all header files
and C source files it would be able to properly translate the function
codes.

Anyway thats the idea. There are a few extra details to iron out but it
should work.

Steve.
-- 
Dr Stephen N. Henson.   http://www.drh-consultancy.demon.co.uk/
Personal Email: [EMAIL PROTECTED] 
Senior crypto engineer, Celo Communications: http://www.celocom.com/
Core developer of the   OpenSSL project: http://www.openssl.org/
Business Email: [EMAIL PROTECTED] PGP key: via homepage.


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to