Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2024-11-15 09:59:42

0001 /*
0002 
0003 Copyright 1989, 1998  The Open Group
0004 
0005 Permission to use, copy, modify, distribute, and sell this software and its
0006 documentation for any purpose is hereby granted without fee, provided that
0007 the above copyright notice appear in all copies and that both that
0008 copyright notice and this permission notice appear in supporting
0009 documentation.
0010 
0011 The above copyright notice and this permission notice shall be included in
0012 all copies or substantial portions of the Software.
0013 
0014 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0015 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0016 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
0017 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
0018 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
0019 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0020 
0021 Except as contained in this notice, the name of The Open Group shall not be
0022 used in advertising or otherwise to promote the sale, use or other dealings
0023 in this Software without prior written authorization from The Open Group.
0024 
0025 */
0026 
0027 #ifndef _Xct_h
0028 #define _Xct_h
0029 
0030 #include <X11/Xfuncproto.h>
0031 
0032 #define XctVersion 1
0033 
0034 typedef unsigned char *XctString;
0035 
0036 typedef enum {
0037     XctUnspecified,
0038     XctLeftToRight,
0039     XctRightToLeft
0040 } XctHDirection;
0041 
0042 typedef unsigned long XctFlags;
0043 
0044 /* These are bits in XctFlags. */
0045 
0046 #define XctSingleSetSegments    0x0001
0047    /* This means that returned segments should contain characters from only
0048     * one set (C0, C1, GL, GR).  When this is requested, XctSegment is never
0049     * returned, instead XctC0Segment, XctC1Segment, XctGlSegment, and
0050     * XctGRSegment are returned.  C0 and C1 segments are always returned as
0051     * singleton characters.
0052     */
0053 
0054 #define XctProvideExtensions    0x0002
0055    /* This means that if the Compound Text string is from a higher version
0056     * than this code is implemented to, then syntactically correct but unknown
0057     * control sequences should be returned as XctExtension items.  If this
0058     * flag is not set, and the Compound Text string version indicates that
0059     * extensions cannot be ignored, then each unknown control sequence will be
0060     * reported as an XctError.
0061     */
0062 
0063 #define XctAcceptC0Extensions   0x0004
0064    /* This means that if the Compound Text string is from a higher version
0065     * than this code is implemented to, then unknown C0 characters should be
0066     * treated as if they were legal, and returned as C0 characters (regardless
0067     * of how XctProvideExtensions is set).  If this flag is not set, then all
0068     * unknown C0 characters are treated according to XctProvideExtensions.
0069     */
0070 
0071 #define XctAcceptC1Extensions   0x0008
0072    /* This means that if the Compound Text string is from a higher version
0073     * than this code is implemented to, then unknown C0 characters should be
0074     * treated as if they were legal, and returned as C0 characters (regardless
0075     * of how XctProvideExtensions is set).  If this flag is not set, then all
0076     * unknown C0 characters are treated according to XctProvideExtensions.
0077     */
0078 
0079 #define XctHideDirection    0x0010
0080    /* This means that horizontal direction changes should be reported as
0081     * XctHorizontal items.  If this flag is not set, then direction changes are
0082     * not returned as items, but the current direction is still maintained and
0083     * reported for other items.
0084     */
0085 
0086 #define XctFreeString       0x0020
0087    /* This means that XctFree should free the Compound Text string (that was
0088     * passed to XctCreate.  If this flag is not set, the string is not freed.
0089     */
0090 
0091 #define XctShiftMultiGRToGL 0x0040
0092    /* Translate GR segments on-the-fly into GL segments for the GR sets:
0093     * GB2312.1980-1, JISX0208.1983-1, and KSC5601.1987-1.
0094     */
0095 
0096 /* This is the return type for XctNextItem. */
0097 typedef enum {
0098     XctSegment,     /* used when XctSingleSetSegments is not requested */
0099     XctC0Segment,   /* used when XctSingleSetSegments is requested */
0100     XctGLSegment,   /* used when XctSingleSetSegments is requested */
0101     XctC1Segment,   /* used when XctSingleSetSegments is requested */
0102     XctGRSegment,   /* used when XctSingleSetSegments is requested */
0103     XctExtendedSegment, /* an extended segment */
0104     XctExtension,   /* used when XctProvideExtensions is requested */
0105     XctHorizontal,  /* horizontal direction or depth change */
0106     XctEndOfText,   /* end of text string */
0107     XctError        /* syntactic or semantic error */
0108 } XctResult;
0109 
0110 typedef struct _XctRec {
0111     XctString       total_string;   /* as given to XctCreate */
0112     int         total_length;   /* as given to XctCreate */
0113     XctFlags        flags;      /* as given to XctCreate */
0114     int         version;    /* indicates the version of the CT spec
0115                      * the string was produced from */
0116     int         can_ignore_exts;/* non-zero if ignoring extensions is
0117                      * acceptable, else zero */
0118     XctString       item;       /* item returned from XctNextItem */
0119     unsigned        item_length;    /* length of item in bytes */
0120     int         char_size;  /* number of bytes per character in
0121                      * item, with zero meaning variable */
0122     char        *encoding;  /* Encoding name for item */
0123     XctHDirection   horizontal; /* direction of item */
0124     unsigned        horz_depth; /* current direction nesting depth */
0125     char        *GL;        /* "{I} F" string for current GL */
0126     char        *GL_encoding;   /* Encoding name for current GL */
0127     int         GL_set_size;    /* 94 or 96 */
0128     int         GL_char_size;   /* number of bytes per GL character */
0129     char        *GR;        /* "{I} F" string for current GR */
0130     char        *GR_encoding;   /* Encoding name for current GR */
0131     int         GR_set_size;    /* 94 or 96 */
0132     int         GR_char_size;   /* number of bytes per GR character */
0133     char        *GLGR_encoding; /* Encoding name for current GL+GR,
0134                      * if known */
0135     struct _XctPriv *priv;      /* private to parser, don't peek */
0136 } *XctData;
0137 
0138 /* these are the external routines */
0139 _XFUNCPROTOBEGIN
0140 
0141 XctData XctCreate
0142 (
0143  _Xconst unsigned char  *string,
0144  int            length,
0145  XctFlags       flags
0146 );
0147 
0148 XctResult XctNextItem
0149 (
0150  XctData        data
0151 );
0152 
0153 void XctFree
0154 (
0155  XctData        data
0156  );
0157 
0158 void XctReset
0159 (
0160  XctData        data
0161  );
0162 
0163 _XFUNCPROTOEND
0164 
0165 #endif /* _Xct_h */