diff options
| author | Simon Tatham <anakin@pobox.com> | 1999-07-31 18:44:53 +0000 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 1999-07-31 18:44:53 +0000 |
| commit | 0d14833a9c76c51cc7417d8fd60bec9d92714b8e (patch) | |
| tree | c0716d398e83bc746baad088d5dfc215d5fea483 /buttress.h | |
| parent | 4c8c2b256ed01563a98b4cd820dc8ffef30d7fc1 (diff) | |
| download | halibut-0d14833a9c76c51cc7417d8fd60bec9d92714b8e.zip halibut-0d14833a9c76c51cc7417d8fd60bec9d92714b8e.tar.gz halibut-0d14833a9c76c51cc7417d8fd60bec9d92714b8e.tar.bz2 halibut-0d14833a9c76c51cc7417d8fd60bec9d92714b8e.tar.xz | |
Further development work. Parser nearly finished
[originally from svn r187]
Diffstat (limited to 'buttress.h')
| -rw-r--r-- | buttress.h | 79 |
1 files changed, 68 insertions, 11 deletions
@@ -1,6 +1,9 @@ #ifndef BUTTRESS_BUTTRESS_H #define BUTTRESS_BUTTRESS_H +#include <stdio.h> +#include <wchar.h> + #ifdef __GNUC__ #define NORETURN __attribute__((__noreturn__)) #endif @@ -16,10 +19,20 @@ * Structure tags */ typedef struct input_Tag input; +typedef struct filepos_Tag filepos; typedef struct paragraph_Tag paragraph; typedef struct word_Tag word; /* + * Data structure to hold a file name and index, a line and a + * column number, for reporting errors + */ +struct filepos_Tag { + char *filename; + int line, col; +}; + +/* * Data structure to hold all the file names etc for input */ #define INPUT_PUSHBACK_MAX 16 @@ -28,8 +41,9 @@ struct input_Tag { int nfiles; /* how many in the list */ FILE *currfp; /* the currently open one */ int currindex; /* which one is that in the list */ - char pushback[INPUT_PUSHBACK_MAX]; /* pushed-back input characters */ + int pushback[INPUT_PUSHBACK_MAX]; /* pushed-back input characters */ int npushback; + filepos pos; }; /* @@ -39,19 +53,27 @@ struct input_Tag { struct paragraph_Tag { paragraph *next; int type; - char *keyword; /* for IR, IA, and heading paras */ + wchar_t *keyword; /* for most special paragraphs */ word *words; /* list of words in paragraph */ -} paragraph; +}; enum { - para_IA, /* index alias */ - para_IR, /* index rewrite */ + para_IM, /* index merge */ + para_BR, /* bibliography rewrite */ para_Chapter, para_Appendix, + para_UnnumberedChapter, para_Heading, para_Subsect, para_Normal, + para_Biblio, para_Bullet, - para_Code + para_NumberedList, + para_Code, + para_Copyright, + para_Preamble, + para_NoCite, + para_Title, + para_VersionID }; /* @@ -60,14 +82,18 @@ enum { struct word_Tag { word *next; int type; - char *text; -} + wchar_t *text; +}; enum { word_Normal, word_Emph, - word_Code, - word_IndexRef /* always invisible */ -} + word_Code, /* monospaced; `quoted' in text */ + word_WeakCode, /* monospaced, normal in text */ + word_UpperXref, /* \K */ + word_LowerXref, /* \k */ + word_IndexRef, /* (always an invisible one) */ + word_WhiteSpace /* text is NULL or ignorable */ +}; /* * error.c @@ -79,6 +105,20 @@ enum { err_optnoarg, /* option `-%s' requires an argument */ err_nosuchopt, /* unrecognised option `-%s' */ err_noinput, /* no input files */ + err_cantopen, /* unable to open input file `%s' */ + err_nodata, /* no data in input files */ + err_brokencodepara, /* line in codepara didn't begin `\c' */ + err_kwunclosed, /* expected `}' after keyword */ + err_kwillegal, /* paragraph type expects no keyword */ + err_kwexpected, /* paragraph type expects a keyword */ + err_kwtoomany, /* paragraph type expects only 1 */ + err_bodyillegal, /* paragraph type expects only kws! */ + err_badmidcmd, /* invalid command in mid-para */ + err_unexbrace, /* unexpected brace */ + err_explbr, /* expected `{' after command */ + err_kwexprbr, /* expected `}' after cross-ref */ + err_missingrbrace, /* unclosed braces at end of para */ + err_nestedstyles /* unable to nest text styles */ }; /* @@ -89,6 +129,14 @@ void *srealloc(void *p, int size); void sfree(void *p); /* + * ustring.c + */ +wchar_t *ustrdup(wchar_t *s); +char *ustrtoa(wchar_t *s, char *outbuf, int size); +int ustrlen(wchar_t *s); +wchar_t *ustrcpy(wchar_t *dest, wchar_t *source); + +/* * help.c */ void help(void); @@ -106,6 +154,15 @@ void licence(void); const char *const version; /* + * misc.c + */ +typedef struct stackTag *stack; +stack stk_new(void); +void stk_free(stack); +void stk_push(stack, void *); +void *stk_pop(stack); + +/* * input.c */ paragraph *read_input(input *in); |