Re: [pcre-dev] Proposal for a new API for PCRE

Top Pagina
Delete this message
Auteur: Tom Bishop, Wenlin Institute
Datum:  
Aan: pcre-dev
Onderwerp: Re: [pcre-dev] Proposal for a new API for PCRE

On Aug 30, 2013, at 5:09 AM, ph10@??? wrote:

>  switch (character)
>    { 
>    case CHAR_LEFT_SQUARE_BRACKET:

>
> The CHAR_xxx macros have different numerical values in an EBCDIC build
> compared with an ASCII/Unicode build. Therefore, it is not possible to
> have a single PCRE library that can handle both EBCDIC and ASCII/Unicode
> input.


How about something like this:

#if PCRE_LIBRAY_SUPPORTS_BOTH_EBCIDC_AND_UNICODE
#define CHAR_LEFT_SQUARE_BRACKET (context->usingEbcdic ? EBCDIC_LEFT_SQUARE_BRACKET : '[')
#elif PCRE_LIBRAY_SUPPORTS_ONLY_EBCDIC
#define CHAR_LEFT_SQUARE_BRACKET (EBCDIC_LEFT_SQUARE_BRACKET)
#else
#define CHAR_LEFT_SQUARE_BRACKET '['
#endif

I don't have any use for EBCDIC myself, but evidently some people do, and it's probably worthwhile in the long run to support a layer of abstraction rather than hard-code the characters at a low level.

Tom

文林 Wenlin Institute, Inc.        Software for Learning Chinese
E-mail: wenlin@???     Web: http://www.wenlin.com
Telephone: 1-877-4-WENLIN (1-877-493-6546)
☯