[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: questions regarding patch-src



frank@kuesterei.ch (Frank Küster) wrote:

> I'll simply try it out - if it causes problems while compiling for the
> Debian package I'll find out.

Yes. Ideally, you should log the stdout and stderr output of both
compilations and compare them because for instance, a missing function
prototype can generate only a warning (but can affect execution if the
function is called with wrong types/number of arguments...).

>> /tmp/tetex-bin-2.0.2 % grep "typedef.*boolean" **/*.h           sid flo@florent
>> libs/type1/util.h:typedef int boolean;
>> texk/dvipdfm/pdfobj.h:typedef struct pdf_boolean pdf_boolean;
>> texk/dvipsk/dvips.h:typedef char boolean;
>> texk/kpathsea/types.h:typedef int boolean;
>> texk/ps2pkm/util.h:typedef int boolean;
>> texk/web2c/cwebdir/common.h:typedef short boolean;
>
> I don't understand this (I never learned to program in C). This defines
> the type boolean as the same as the first argument to typedef, right?

Yes.

> But there is a type boolean in standard C, isn't it? So why the

No! 'int's are generally used for this purpose when one does not define
one's own boolean type.

> redefinition? And what effect does the redefinition have? 

Therefore, it is not a redefinition.

Also, you should note that the "typedef struct pdf_boolean pdf_boolean"
was a false positive in my grep output since we were looking for the
boolean type and not pdf_boolean. Consequently, without going through
the various headers included in writet1.c, one could reasonably assume
that boolean in writet1.c really is either int, char or short, each of
which is perfectly OK for the return value 1 of the function.

In fact, things are a bit weird.

/tmp/tetex-bin-2.0.2 % grep 't1_subset[^_]' **/*.c
texk/dvipsk/writet1.c:boolean t1_subset(char *fontfile, char *encfile, unsigned char *g)
texk/web2c/pdftexdir/writet1.c:boolean t1_subset(char *fontfile, char *encfile, unsigned char *g)
/tmp/tetex-bin-2.0.2 % grep 't1_subset[^_]' **/*.h
texk/web2c/pdftexdir/ptexlib.h:extern boolean t1_subset(char *, char *, unsigned char *);


Surely, this function is not much used in tetex-bin. So, in dvipsk, the
function is defined as returning a boolean. Good. In
texk/web2c/pdftexdir/ptexlib.h, it is declared (for modules other than
writet1.c that would want to use this function) as returning a boolean.
Good. But if you look closely at writet1.c, you will note that ptexlib.h
is #included if pdfTeX is defined (at the top), OK, and that the
t1_subset function is *not* even defined in this case (it should
probably still have the boolean return value type since that is how it
is defined in texk/dvipsk/writet1.c...). It seems the function is used
nowhere in tetex-bin.

> (and there is only the dvips.h that your grep command found). So does
> this mean anything - should the declaration of t1_subset be dependent on
> whether we compile for pdfTeX or for dvips? On the other hand, this

Perhaps it was the initial intent.

> writet1.c seems to be used only for pdftex, since it is in
> texk/web2c/pdftexdir/, and dvips has it's own in /texk/dvips/

Yeah, this is a bit messy.

-- 
Florent



Reply to: