DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
X Version 11 (Release 6.1)

XctData(X3xmu)


XctData -- compound text functions

Synopsis

cc . . . -lXmu

#include <X11/Xmu/Xct.h>

typedef unsigned char *XctString;

XctData XctCreate(string, length, flags) XctString string; int length; XctFlags flags;

void XctReset(data) XctData data;

XctResult XctNextItem(data) XctData data;

void XctFree(data) XctData data;

Arguments


string
Compound Text string.

length
Number of bytes in string.

flags
Parsing control flags.

data
Specifies the Compound Text structure.

Description

A Compound Text string is represented as indicated in the Synopsis section above.

The functions defined in this section are for parsing Compound Text strings and decomposing them into individual segments. Definitions needed to use these routines are in the include file <X11/Xmu/Xct.h>.

XctCreate returns an XctData structure that can be used for parsing a Compound Text string. string need not be null terminated. The following flags are defined to control parsing of the string:


XctSingleSetSegments
This means that returned segments should contain characters from only one set (C0, C1, GL, GR). When this is requested, XctSegment is never returned by XctNextItem, instead XctC0Segment, XctC1Segment, XctGlSegment, and XctGRSegment are returned. C0 and C1 segments are always returned as singleton characters.

XctProvideExtensions
This means that if the Compound Text string is from a higher version than this code is implemented to, then syntactically correct but unknown control sequences should be returned as XctExtension items by XctNextItem. If this flag is not set, and the Compound Text string version indicates that extensions cannot be ignored, then each unknown control sequence will be reported as an XctError.

XctAcceptC0Extensions
This means that if the Compound Text string is from a higher version than this code is implemented to, then unknown C0 characters should be treated as if they were legal, and returned as C0 characters (regardless of how XctProvideExtensions is set) by XctNextItem. If this flag is not set, then all unknown C0 characters are treated according to XctProvideExtensions.

XctAcceptC1Extensions
This means that if the Compound Text string is from a higher version than this code is implemented to, then unknown C1 characters should be treated as if they were legal, and returned as C1 characters (regardless of how XctProvideExtensions is set) by XctNextItem. If this flag is not set, then all unknown C1 characters are treated according to XctProvideExtensions.

XctHideDirection
This means that horizontal direction changes should be reported as XctHorizontal items by XctNextItem. If this flag is not set, then direction changes are not returned as items, but the current direction is still maintained and reported for other items. The current direction is given as an enumeration, with the values XctUnspecified, XctLeftToRight, and XctRightToLeft.

XctFreeString
This means that XctFree should free the Compound Text string that is passed to XctCreate. If this flag is not set, the string is not freed.

XctShiftMultiGRToGL
This means that XctNextItem should translate GR segments on-the-fly into GL segments for the GR sets: GB2312.1980-1, JISX0208.1983-1, and KSC5601.1987-1.

XctReset resets the XctData structure to reparse the Compound Text string from the beginning.

XctNextItem parses the next ``item'' from the Compound Text string. The return value indicates what kind of item is returned. The item itself, its length, and the current contextual state, are reported as components of the XctData structure. XctResult is an enumeration, with the following values:


XctSegment
The item contains some mixture of C0, GL, GR, and C1 characters.

XctC0Segment
The item contains only C0 characters.

XctGLSegment
The item contains only GL characters.

XctC1Segment
The item contains only C1 characters.

XctGRSegment
The item contains only GR characters.

XctExtendedSegment
The item contains an extended segment.

XctExtension
The item is an unknown extension control sequence.

XctHorizontal
The item indicates a change in horizontal direction or depth. The new direction and depth are recorded in the XctData structure.

XctEndOfText
The end of the Compound Text string has been reached.

XctError
The string contains a syntactic or semantic error; no further parsing should be performed.

XctFree
This frees all data associated with the XctData structure.

Structures

The following structure is defined for XctData :
   typedef struct _XctRec {
      XctString total_string;	/* as given to XctCreate */
      int total_length;		/* as given to XctCreate */
      XctFlags flags;		/* as given to XctCreate */
      int version;			/* indicates version of the CT spec
   				   the string was produced from */
      int can_ignore_exts;		/* non-zero if ignoring extensions
   				   is acceptable, else zero */
      XctString item;		/* the action item */
      int item_length;		/* the length of item in bytes */
      int char_size;		/* number of bytes per character in
   				   item, zero meaning variable */
      char *encoding;		/* the XLFD encoding name for item */
      XctHDirection horizontal;	/* the direction of item */
      int horz_depth;		/* current direction nesting depth */
      char *GL;			/* "{I} F" string for the current GL */
      char *GL_encoding;		/* XLFD encoding name for current GL */
      int GL_set_size;		/* 94 or 96 */
      int GL_char_size;		/* number of bytes per GL character */
      char *GR;			/* "{I} F" string for the current GR */
      char *GR_encoding;		/* XLFD encoding name for current GR */
      int GR_set_size;		/* 94 or 96 */
      int GR_char_size;		/* number of bytes per GR character */
      char *GLGR_encoding;		/* XLFD encoding name for the
   				   current GL+GR, if known */
      struct _XctPriv *priv;	/* private to parser */
   } *XctData;

The following is the return type defined for XctNextItem:

typedef enum {
   XctSegment,		/* used when XctSingleSetSegments not requested */
   XctC0Segment,	/* used when XctSingleSetSegments is requested */
   XctGLSegment,	/* used when XctSingleSetSegments is requested */
   XctC1Segment,	/* used when XctSingleSetSegments is requested */
   XctGRSegment,	/* used when XctSingleSetSegments is requested */
   XctExtendedSegment,	/* an extended segment */
   XctExtension,	/* used when XctProvideExtensions is requested */
   XctHorizontal,	/* horizontal direction or depth change */
   XctEndOfText,	/* end of text string */
   XctError		/* syntactic or semantic error */

} XctResult;

References

Xlib - C Language X Interface


© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004