Xct.h

Go to the documentation of this file.
00001 /* $Xorg: Xct.h,v 1.4 2001/02/09 02:03:53 xorgcvs Exp $ */
00002 
00003 /*
00004 
00005 Copyright 1989, 1998  The Open Group
00006 
00007 Permission to use, copy, modify, distribute, and sell this software and its
00008 documentation for any purpose is hereby granted without fee, provided that
00009 the above copyright notice appear in all copies and that both that
00010 copyright notice and this permission notice appear in supporting
00011 documentation.
00012 
00013 The above copyright notice and this permission notice shall be included in
00014 all copies or substantial portions of the Software.
00015 
00016 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00017 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00018 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
00019 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
00020 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00021 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00022 
00023 Except as contained in this notice, the name of The Open Group shall not be
00024 used in advertising or otherwise to promote the sale, use or other dealings
00025 in this Software without prior written authorization from The Open Group.
00026 
00027 */
00028 /* $XFree86: xc/lib/Xmu/Xct.h,v 1.6 2001/01/17 19:42:58 dawes Exp $ */
00029 
00030 #ifndef _Xct_h
00031 #define _Xct_h
00032 
00033 #include <X11/Xfuncproto.h>
00034 
00035 #define XctVersion 1
00036 
00037 typedef unsigned char *XctString;
00038 
00039 typedef enum {
00040     XctUnspecified,
00041     XctLeftToRight,
00042     XctRightToLeft
00043 } XctHDirection;
00044 
00045 typedef unsigned long XctFlags;
00046 
00047 /* These are bits in XctFlags. */
00048 
00049 #define XctSingleSetSegments    0x0001
00050    /* This means that returned segments should contain characters from only
00051     * one set (C0, C1, GL, GR).  When this is requested, XctSegment is never
00052     * returned, instead XctC0Segment, XctC1Segment, XctGlSegment, and
00053     * XctGRSegment are returned.  C0 and C1 segments are always returned as
00054     * singleton characters.
00055     */
00056 
00057 #define XctProvideExtensions    0x0002
00058    /* This means that if the Compound Text string is from a higher version
00059     * than this code is implemented to, then syntactically correct but unknown
00060     * control sequences should be returned as XctExtension items.  If this
00061     * flag is not set, and the Compound Text string version indicates that
00062     * extensions cannot be ignored, then each unknown control sequence will be
00063     * reported as an XctError.
00064     */
00065 
00066 #define XctAcceptC0Extensions   0x0004
00067    /* This means that if the Compound Text string is from a higher version
00068     * than this code is implemented to, then unknown C0 characters should be
00069     * treated as if they were legal, and returned as C0 characters (regardless
00070     * of how XctProvideExtensions is set).  If this flag is not set, then all
00071     * unknown C0 characters are treated according to XctProvideExtensions.
00072     */
00073 
00074 #define XctAcceptC1Extensions   0x0008
00075    /* This means that if the Compound Text string is from a higher version
00076     * than this code is implemented to, then unknown C0 characters should be
00077     * treated as if they were legal, and returned as C0 characters (regardless
00078     * of how XctProvideExtensions is set).  If this flag is not set, then all
00079     * unknown C0 characters are treated according to XctProvideExtensions.
00080     */
00081 
00082 #define XctHideDirection        0x0010
00083    /* This means that horizontal direction changes should be reported as
00084     * XctHorizontal items.  If this flag is not set, then direction changes are
00085     * not returned as items, but the current direction is still maintained and
00086     * reported for other items.
00087     */
00088 
00089 #define XctFreeString           0x0020
00090    /* This means that XctFree should free the Compound Text string (that was
00091     * passed to XctCreate.  If this flag is not set, the string is not freed.
00092     */
00093 
00094 #define XctShiftMultiGRToGL     0x0040
00095    /* Translate GR segments on-the-fly into GL segments for the GR sets:
00096     * GB2312.1980-1, JISX0208.1983-1, and KSC5601.1987-1.
00097     */
00098 
00099 /* This is the return type for XctNextItem. */
00100 typedef enum {
00101     XctSegment,         /* used when XctSingleSetSegments is not requested */
00102     XctC0Segment,       /* used when XctSingleSetSegments is requested */
00103     XctGLSegment,       /* used when XctSingleSetSegments is requested */
00104     XctC1Segment,       /* used when XctSingleSetSegments is requested */
00105     XctGRSegment,       /* used when XctSingleSetSegments is requested */
00106     XctExtendedSegment, /* an extended segment */
00107     XctExtension,       /* used when XctProvideExtensions is requested */
00108     XctHorizontal,      /* horizontal direction or depth change */
00109     XctEndOfText,       /* end of text string */
00110     XctError            /* syntactic or semantic error */
00111 } XctResult;
00112 
00113 typedef struct _XctRec {
00114     XctString           total_string;   /* as given to XctCreate */
00115     int                 total_length;   /* as given to XctCreate */
00116     XctFlags            flags;          /* as given to XctCreate */
00117     int                 version;        /* indicates the version of the CT spec
00118                                          * the string was produced from */
00119     int                 can_ignore_exts;/* non-zero if ignoring extensions is
00120                                          * acceptable, else zero */
00121     XctString           item;           /* item returned from XctNextItem */
00122     unsigned            item_length;    /* length of item in bytes */
00123     int                 char_size;      /* number of bytes per character in
00124                                          * item, with zero meaning variable */
00125     char                *encoding;      /* Encoding name for item */
00126     XctHDirection       horizontal;     /* direction of item */
00127     unsigned            horz_depth;     /* current direction nesting depth */
00128     char                *GL;            /* "{I} F" string for current GL */
00129     char                *GL_encoding;   /* Encoding name for current GL */
00130     int                 GL_set_size;    /* 94 or 96 */
00131     int                 GL_char_size;   /* number of bytes per GL character */
00132     char                *GR;            /* "{I} F" string for current GR */
00133     char                *GR_encoding;   /* Encoding name for current GR */
00134     int                 GR_set_size;    /* 94 or 96 */
00135     int                 GR_char_size;   /* number of bytes per GR character */
00136     char                *GLGR_encoding; /* Encoding name for current GL+GR,
00137                                          * if known */
00138     struct _XctPriv     *priv;          /* private to parser, don't peek */
00139 } *XctData;
00140 
00141 /* these are the external routines */
00142 _XFUNCPROTOBEGIN
00143 
00144 XctData XctCreate
00145 (
00146  _Xconst unsigned char  *string,
00147  int                    length,
00148  XctFlags               flags
00149 );
00150 
00151 XctResult XctNextItem
00152 (
00153  XctData                data
00154 );
00155 
00156 void XctFree
00157 (
00158  XctData                data
00159  );
00160 
00161 void XctReset
00162 (
00163  XctData                data
00164  );
00165 
00166 _XFUNCPROTOEND
00167 
00168 #endif /* _Xct_h */

Generated on Sun Mar 4 15:03:56 2007 for Scilab [trunk] by  doxygen 1.5.1