[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Devel] new FT error scheme
From: |
Werner LEMBERG |
Subject: |
Re: [Devel] new FT error scheme |
Date: |
Wed, 18 Apr 2001 16:55:34 +0200 (CEST) |
> > The current code like
> >
> > #define TT_Err_xxx FT_Err_xxx
> >
> > isn't really meaningful.
> >
> > What do you think about the following:
> >
> > #define FT_Err_Ok 0x00
> > #define FT_Err_Foo 0x01 + FT_ERR_OFFSET
> > #define FT_Err_Bar 0x02 + FT_ERR_OFFSET
> > ...
> >
> > In freetype.h:
> > #undef FT_ERR_OFFSET
> > #define FT_ERR_OFFSET 0x000
> >
> > In module foo:
> >
> > #undef FT_ERR_OFFSET
> > #define FT_ERR_OFFSET 0x100
> >
> > This would give better error codes (the high byte gives the module,
> > the low byte the error code), and we could uniformly use FT_Err_*
> > everywhere.
> >
>
> Hummm.. I don't understand your scheme. It seems that the value of
> FT_Err_Foo would not be the same if you include "foo.h" or
> "freetype.h", which is hardly a good idea :-)
>
> Is that really what you meant?
Basically yes. Consider the error `glyph not found'. This is, say,
0x02. If this error occurs in module `xxx', you'll get e.g. 0x102.
If this occurs in module `yyy', the error value is e.g. 0x402. If you
AND the error code with 0xFF, you get the `real' error code (as
presented in freetype.h). If you AND with 0xFF00 you get the module
in which the error has happened. This is a useful additional
information IMHO.
Werner