/* Copyright (c) Xerox Corporation 1993. All rights reserved. */ /* tread.h -- Low-level Tioga reader routines. David Nichols December, 1990 */ struct tread←Stream { unsigned char *next; unsigned char *limit; }; struct tread←Procs { int (*startNode)(/* reader, format, comment */); int (*endNode)(/* reader */); int (*addLooks)(/* reader, looks, start, len */); int (*insertText)(/* reader, text, len */); int (*handleProp)(/* reader, propName, prop, len */); }; struct tread←Reader { struct tread←Procs *procs; char *data; /* private data for client */ /* Full buffer. */ char *buf; long totalLen; /* Start and end of each region. */ struct tread←Stream text; struct tread←Stream com; struct tread←Stream control; /* Generic piece of text */ int strLen; unsigned char *str; /* Formats */ int nFormats; /* number in use */ char *formats[tioga←NumFormats]; /* list of them */ /* Look combos */ int nLooks; /* number in use */ long looks[tioga←NumLooks]; /* list of them */ /* Property names */ int nProps; char *props[tioga←NumProps]; }; /* Initialize from buffer holding entire file. */ extern int tread←Init(/* struct tread←Reader *r, char *buf, long len, struct tread←Procs *procs, char *data */); /* Get next opcode from control stream. */ extern enum tioga←ControlOp tread←GetOp(/* struct tread←Reader *r */); /* Get a byte from the control stream. */ extern int tread←GetInt(/* struct tread←Reader *r */); /* Get an integer from the control stream. */ extern long tread←GetInt(/* struct tread←Reader *r */); /* Get text from control stream. */ extern tread←GetStr(/* struct tread←Reader *r */); /* Get text from a specific stream. */ extern tread←SGetRope(/* struct tread←Reader *r, struct tread←Stream *s, long len */); /* Add a new format, and return its index. */ extern int tread←AddFormat(/* struct ReaderState *r, char *format */); /* Add a new looks vector, return its index. */ extern int tread←AddLooks(/* struct ReaderState *r, long l */); /* Add a new property name, return its index. */ extern int tread←AddProp(/* struct ReaderState *r, char *propName */);