1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154
|
#ifndef XTRACE_PARSE_H
#define XTRACE_PARSE_H
struct constant {
unsigned long value;
const char *name;
};
struct event;
typedef bool request_func(struct connection*,bool,bool,struct expectedreply *);
typedef void reply_func(struct connection*,bool*,bool*,int,void*);
typedef void event_func(struct connection *, const unsigned char *, const struct event *);
struct request {
const char *name;
const struct parameter *parameters;
const struct parameter *answers;
request_func *request_func;
reply_func *reply_func;
};
struct event {
const char *name;
const struct parameter *parameters;
enum event_type { event_normal = 0, event_xge = 1} type;
#define event_COUNT 2
};
struct extension {
const char *name;
size_t namelen;
const struct request *subrequests;
unsigned char numsubrequests;
const struct event *events;
unsigned char numevents;
const char * const *errors;
unsigned char numerrors;
unsigned short numxgevents;
const struct event *xgevents;
};
struct parameter {
/* The offset within the event, request, reply or Struct this
* applies to. If OFS_LATER it is after the last list item
* in this parameter-list. */
size_t offse;
const char *name;
enum fieldtype {
/* signed endian specific: */
ft_INT8, ft_INT16, ft_INT32,
/* unsigned decimal endian specific: */
ft_UINT8, ft_UINT16, ft_UINT32,
/* unsigned hex endian specific: */
ft_CARD8, ft_CARD16, ft_CARD32,
/* enums (not in constant list is error): */
ft_ENUM8, ft_ENUM16, ft_ENUM32,
/* counts for following strings, lists, ...
* value-mask for LISTofFormat */
ft_STORE8, ft_STORE16, ft_STORE32,
/* to be ft_GET later into the store register */
ft_PUSH8, ft_PUSH16, ft_PUSH32,
/* bitfields: multiple values are possible */
ft_BITMASK8, ft_BITMASK16, ft_BITMASK32,
/* Different forms of lists: */
/* - boring ones */
ft_STRING8, ft_LISTofCARD32, ft_LISTofATOM,
ft_LISTofCARD8, ft_LISTofCARD16,
ft_LISTofUINT8, ft_LISTofUINT16,
ft_LISTofUINT32,
ft_LISTofINT8, ft_LISTofINT16,
ft_LISTofINT32,
/* - one of the above depening on last FORMAT */
ft_LISTofFormat,
/* - iterate of list description in constants field */
ft_LISTofStruct,
/* - same but length is mininum length and
* actual length is taken from end of last list
* or LASTMARKER */
ft_LISTofVarStruct,
/* - like ENUM for last STORE, but constants
* are of type (struct value*) interpreteted at this
* offset */
ft_LISTofVALUE,
/* an LISTofStruct with count = 1 */
ft_Struct,
/* specify bits per item for LISTofFormat */
ft_FORMAT8,
/* an event
* (would have also been possible with Struct and many IF)*/
ft_EVENT,
/* jump to other parameter list if matches */
ft_IF8,
ft_IF16,
ft_IF32,
/* jump to other parameter list if matches atom name */
ft_IFATOM,
/* set end of last list manually, (for LISTofVarStruct) */
ft_LASTMARKER,
/* a ft_CARD32 looking into the ATOM list */
ft_ATOM,
/* always big endian */
ft_BE32,
/* get the #ofs value from the stack. (0 is the last pushed) */
ft_GET,
/* a fixed-point number 16+16 bit */
ft_FIXED,
/* a list of those */
ft_LISTofFIXED,
/* a fixed-point number 32+32 bit */
ft_FIXED3232,
/* a list of those */
ft_LISTofFIXED3232,
/* a 32 bit floating pointer number */
ft_FLOAT32,
/* a list of those */
ft_LISTofFLOAT32,
/* fraction with nominator and denominator 16 bit */
ft_FRACTION16_16,
/* dito 32 bit */
ft_FRACTION32_32,
/* set stored value to specific value */
ft_DECREMENT_STORED,
ft_SET
} type;
const struct constant *constants;
};
struct value {
unsigned long flag;
/* NULL means EndOfValues */
const char *name;
/* only elementary type (<= ft_BITMASK32 are allowed ), */
enum fieldtype type;
const struct constant *constants;
};
extern const struct request *requests;
extern size_t num_requests;
extern const struct event *events;
extern size_t num_events;
extern const const char * const *errors;
extern size_t num_errors;
extern const struct extension *extensions;
extern size_t num_extensions;
extern const struct parameter *unexpected_reply;
extern const struct parameter *setup_parameters;
/* special handlers, for the SPECIAL requests/events */
extern request_func requestQueryExtension;
extern request_func requestInternAtom;
extern reply_func replyListFontsWithInfo;
extern reply_func replyQueryExtension;
extern reply_func replyInternAtom;
#endif
|