version 1.31, 2011/07/23 09:47:25 |
version 1.32, 2011/07/23 12:01:54 |
Line 144 static int eqn_do_set(struct eqn_node *); |
|
Line 144 static int eqn_do_set(struct eqn_node *); |
|
static int eqn_do_undef(struct eqn_node *); |
static int eqn_do_undef(struct eqn_node *); |
static enum eqn_rest eqn_eqn(struct eqn_node *, struct eqn_box *); |
static enum eqn_rest eqn_eqn(struct eqn_node *, struct eqn_box *); |
static enum eqn_rest eqn_list(struct eqn_node *, struct eqn_box *); |
static enum eqn_rest eqn_list(struct eqn_node *, struct eqn_box *); |
|
static enum eqn_rest eqn_matrix(struct eqn_node *, struct eqn_box *); |
static const char *eqn_nexttok(struct eqn_node *, size_t *); |
static const char *eqn_nexttok(struct eqn_node *, size_t *); |
static const char *eqn_nextrawtok(struct eqn_node *, size_t *); |
static const char *eqn_nextrawtok(struct eqn_node *, size_t *); |
static const char *eqn_next(struct eqn_node *, |
static const char *eqn_next(struct eqn_node *, |
Line 191 static const struct eqnstr eqnpiles[EQNPILE__MAX] = { |
|
Line 192 static const struct eqnstr eqnpiles[EQNPILE__MAX] = { |
|
{ "cpile", 5 }, /* EQNPILE_CPILE */ |
{ "cpile", 5 }, /* EQNPILE_CPILE */ |
{ "rpile", 5 }, /* EQNPILE_RPILE */ |
{ "rpile", 5 }, /* EQNPILE_RPILE */ |
{ "lpile", 5 }, /* EQNPILE_LPILE */ |
{ "lpile", 5 }, /* EQNPILE_LPILE */ |
|
{ "ccol", 4 }, /* EQNPILE_CCOL */ |
|
{ "rcol", 4 }, /* EQNPILE_RCOL */ |
|
{ "lcol", 4 }, /* EQNPILE_LCOL */ |
}; |
}; |
|
|
static const struct eqnsym eqnsyms[EQNSYM__MAX] = { |
static const struct eqnsym eqnsyms[EQNSYM__MAX] = { |
Line 348 eqn_eqn(struct eqn_node *ep, struct eqn_box *last) |
|
Line 352 eqn_eqn(struct eqn_node *ep, struct eqn_box *last) |
|
} |
} |
|
|
static enum eqn_rest |
static enum eqn_rest |
|
eqn_matrix(struct eqn_node *ep, struct eqn_box *last) |
|
{ |
|
struct eqn_box *bp; |
|
const char *start; |
|
size_t sz; |
|
enum eqn_rest c; |
|
|
|
bp = eqn_box_alloc(ep, last); |
|
bp->type = EQN_MATRIX; |
|
|
|
if (NULL == (start = eqn_nexttok(ep, &sz))) { |
|
EQN_MSG(MANDOCERR_EQNEOF, ep); |
|
return(EQN_ERR); |
|
} |
|
if ( ! STRNEQ(start, sz, "{", 1)) { |
|
EQN_MSG(MANDOCERR_EQNSYNT, ep); |
|
return(EQN_ERR); |
|
} |
|
|
|
while (EQN_OK == (c = eqn_box(ep, bp))) |
|
switch (bp->last->pile) { |
|
case (EQNPILE_LCOL): |
|
/* FALLTHROUGH */ |
|
case (EQNPILE_CCOL): |
|
/* FALLTHROUGH */ |
|
case (EQNPILE_RCOL): |
|
continue; |
|
default: |
|
EQN_MSG(MANDOCERR_EQNSYNT, ep); |
|
return(EQN_ERR); |
|
}; |
|
|
|
if (EQN_DESCOPE != c) { |
|
if (EQN_EOF == c) |
|
EQN_MSG(MANDOCERR_EQNEOF, ep); |
|
return(EQN_ERR); |
|
} |
|
|
|
eqn_rewind(ep); |
|
start = eqn_nexttok(ep, &sz); |
|
assert(start); |
|
if (STRNEQ(start, sz, "}", 1)) |
|
return(EQN_OK); |
|
|
|
EQN_MSG(MANDOCERR_EQNBADSCOPE, ep); |
|
return(EQN_ERR); |
|
} |
|
|
|
static enum eqn_rest |
eqn_list(struct eqn_node *ep, struct eqn_box *last) |
eqn_list(struct eqn_node *ep, struct eqn_box *last) |
{ |
{ |
struct eqn_box *bp; |
struct eqn_box *bp; |
Line 373 eqn_list(struct eqn_node *ep, struct eqn_box *last) |
|
Line 426 eqn_list(struct eqn_node *ep, struct eqn_box *last) |
|
assert(start); |
assert(start); |
if ( ! STRNEQ(start, sz, "above", 5)) |
if ( ! STRNEQ(start, sz, "above", 5)) |
break; |
break; |
bp->last->above = 1; |
|
} |
} |
|
|
if (EQN_DESCOPE != c) { |
if (EQN_DESCOPE != c) { |
Line 441 eqn_box(struct eqn_node *ep, struct eqn_box *last) |
|
Line 493 eqn_box(struct eqn_node *ep, struct eqn_box *last) |
|
last->last->pile = (enum eqn_pilet)i; |
last->last->pile = (enum eqn_pilet)i; |
return(c); |
return(c); |
} |
} |
|
|
|
if (STRNEQ(start, sz, "matrix", 6)) |
|
return(eqn_matrix(ep, last)); |
|
|
if (STRNEQ(start, sz, "left", 4)) { |
if (STRNEQ(start, sz, "left", 4)) { |
if (NULL == (start = eqn_nexttok(ep, &sz))) { |
if (NULL == (start = eqn_nexttok(ep, &sz))) { |