version 1.29, 2011/07/22 14:55:07 |
version 1.31, 2011/07/23 09:47:25 |
|
|
EQN_DEFINE = 0, |
EQN_DEFINE = 0, |
EQN_SET, |
EQN_SET, |
EQN_UNDEF, |
EQN_UNDEF, |
|
EQN_GFONT, |
EQN_GSIZE, |
EQN_GSIZE, |
EQN__MAX |
EQN__MAX |
}; |
}; |
Line 136 static struct eqn_box *eqn_box_alloc(struct eqn_node * |
|
Line 137 static struct eqn_box *eqn_box_alloc(struct eqn_node * |
|
static void eqn_box_free(struct eqn_box *); |
static void eqn_box_free(struct eqn_box *); |
static struct eqn_def *eqn_def_find(struct eqn_node *, |
static struct eqn_def *eqn_def_find(struct eqn_node *, |
const char *, size_t); |
const char *, size_t); |
|
static int eqn_do_gfont(struct eqn_node *); |
static int eqn_do_gsize(struct eqn_node *); |
static int eqn_do_gsize(struct eqn_node *); |
static int eqn_do_define(struct eqn_node *); |
static int eqn_do_define(struct eqn_node *); |
static int eqn_do_set(struct eqn_node *); |
static int eqn_do_set(struct eqn_node *); |
Line 152 static const struct eqnpart eqnparts[EQN__MAX] = { |
|
Line 154 static const struct eqnpart eqnparts[EQN__MAX] = { |
|
{ { "define", 6 }, eqn_do_define }, /* EQN_DEFINE */ |
{ { "define", 6 }, eqn_do_define }, /* EQN_DEFINE */ |
{ { "set", 3 }, eqn_do_set }, /* EQN_SET */ |
{ { "set", 3 }, eqn_do_set }, /* EQN_SET */ |
{ { "undef", 5 }, eqn_do_undef }, /* EQN_UNDEF */ |
{ { "undef", 5 }, eqn_do_undef }, /* EQN_UNDEF */ |
{ { "gsize", 5 }, eqn_do_gsize }, /* EQN_UNDEF */ |
{ { "gfont", 5 }, eqn_do_gfont }, /* EQN_GFONT */ |
|
{ { "gsize", 5 }, eqn_do_gsize }, /* EQN_GSIZE */ |
}; |
}; |
|
|
static const struct eqnstr eqnmarks[EQNMARK__MAX] = { |
static const struct eqnstr eqnmarks[EQNMARK__MAX] = { |
|
|
if ('{' == *start || '}' == *start) |
if ('{' == *start || '}' == *start) |
ssz = 1; |
ssz = 1; |
else |
else |
ssz = strcspn(start + 1, " ~\"{}\t") + 1; |
ssz = strcspn(start + 1, " ^~\"{}\t") + 1; |
next = start + (int)ssz; |
next = start + (int)ssz; |
if ('\0' == *next) |
if ('\0' == *next) |
next = NULL; |
next = NULL; |
|
|
ep->cur++; |
ep->cur++; |
while (' ' == ep->data[(int)ep->cur] || |
while (' ' == ep->data[(int)ep->cur] || |
'\t' == ep->data[(int)ep->cur] || |
'\t' == ep->data[(int)ep->cur] || |
|
'^' == ep->data[(int)ep->cur] || |
'~' == ep->data[(int)ep->cur]) |
'~' == ep->data[(int)ep->cur]) |
ep->cur++; |
ep->cur++; |
} else { |
} else { |
Line 761 eqn_do_define(struct eqn_node *ep) |
|
Line 765 eqn_do_define(struct eqn_node *ep) |
|
def->val = mandoc_realloc(def->val, sz + 1); |
def->val = mandoc_realloc(def->val, sz + 1); |
memcpy(def->val, start, sz); |
memcpy(def->val, start, sz); |
def->val[(int)sz] = '\0'; |
def->val[(int)sz] = '\0'; |
|
return(1); |
|
} |
|
|
|
static int |
|
eqn_do_gfont(struct eqn_node *ep) |
|
{ |
|
const char *start; |
|
|
|
if (NULL == (start = eqn_nextrawtok(ep, NULL))) { |
|
EQN_MSG(MANDOCERR_EQNEOF, ep); |
|
return(0); |
|
} |
return(1); |
return(1); |
} |
} |
|
|