diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-17 21:41:51 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-17 21:41:51 +0000 |
commit | 487ca4806cc046076293cf6cc5fbba0db282bac7 (patch) | |
tree | 847b412ab5158dd7bdd7ed7e5a4cc3fbca94be32 /Build/source/texk/seetexk/sdecode.h | |
parent | a3d3111bfe26b8e5f5bc6049dfb2a4ca2edc7881 (diff) |
texk 1
git-svn-id: svn://tug.org/texlive/trunk@1485 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/seetexk/sdecode.h')
-rw-r--r-- | Build/source/texk/seetexk/sdecode.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/Build/source/texk/seetexk/sdecode.h b/Build/source/texk/seetexk/sdecode.h new file mode 100644 index 00000000000..b0ef12ef8e9 --- /dev/null +++ b/Build/source/texk/seetexk/sdecode.h @@ -0,0 +1,54 @@ +/* + * Copyright (c) 1989 University of Maryland + * Department of Computer Science. All rights reserved. + * Permission to copy for any purpose is hereby granted + * so long as this copyright notice remains intact. + */ + +/* + * Specials consist of keyword/value groupings, with the simple syntax + * suggested by the BNF + * + * list ::= kv | list ',' kv + * kv ::= word opt_eq words + * opt_eq ::= '=' | <empty> + * words ::= word | words ' ' word + * + * `Words' include any character that is not a space, comma, or quote, + * and can include these by using quoting. Inside and outside quotes, + * `\"' produces `"'; `\\' produces `\'; and `\,' produces `,'. + * + * No single word can exceed WDMAX characters (after quotes are interpreted). + * WDMAX is defined in sdecode.c, and is typically large (>= 1024). + * + * Each special is typed according to its arguments, which are collected + * and decoded, and passed to the special function as ordinary parameters. + * All possible argument-types must be known to the special decoder. + * The function also receives its own name (from the table) as its + * first argument. + */ + +/* value argument types */ +enum sd_args { + sda_none, /* no arguments, just a flag */ + sda_s, /* one string argument (`foo abc') */ + sda_d, /* one decimal (i32) argument (`foo 2') */ + sda_f, /* one floating (double) argument (`foo 3.14') */ + sda_dd, /* two decimal arguments (`foo 3 4') */ + sda_ff, /* two floating arguments (`foo .3 .4') */ + sda_ddddff, /* four decimal args, then 2 floating args */ + sda_nd, /* array n of decimal arguments */ + sda_nx, /* array n of hex arguments (`x 1a00 d02f ...') */ + sda_rest /* fn(len1, ptr, len2); uses up rest of input */ +}; + +struct sdecode { + char *sd_name; /* keyword to match */ + enum sd_args sd_args; /* arguments to collect */ + void (*sd_fn)(); /* actual arguments depend on sd_args */ +}; + +void SDecode(/* FILE *, i32, struct sdecode *, size_t */); +void SDsetclass(/* char *spaces, char *semis */); + +#define SDsize(tab) ((int)(sizeof(tab) / sizeof(*tab))) |