Lines Matching +full:sigma +full:- +full:delta
222 { "delta", "*d" }, /* EQNSYM_delta */
237 { "sigma", "*s" }, /* EQNSYM_sigma */
243 { "DELTA", "*D" }, /* EQNSYM_DELTA */
250 { "SIGMA", "*S" }, /* EQNSYM_SIGMA */
271 { "<-", "<-" }, /* EQNSYM_larrow */
272 { "->", "->" }, /* EQNSYM_rarrow */
273 { "+-", "+-" }, /* EQNSYM_pm */
278 { "-", "mi" }, /* EQNSYM_minus */
311 ep->gsize = EQN_DEFSIZE; in eqn_alloc()
318 free(ep->data); in eqn_reset()
319 ep->data = ep->start = ep->end = NULL; in eqn_reset()
320 ep->sz = ep->toksz = 0; in eqn_reset()
328 if (ep->data == NULL) { in eqn_read()
329 ep->sz = strlen(p); in eqn_read()
330 ep->data = mandoc_strdup(p); in eqn_read()
332 ep->sz = mandoc_asprintf(&cp, "%s %s", ep->data, p); in eqn_read()
333 free(ep->data); in eqn_read()
334 ep->data = cp; in eqn_read()
336 ep->sz += 1; in eqn_read()
340 * Find the key "key" of the give size within our eqn-defined values.
347 for (i = 0; i < (int)ep->defsz; i++) in eqn_def_find()
348 if (ep->defs[i].keysz && STRNEQ(ep->defs[i].key, in eqn_def_find()
349 ep->defs[i].keysz, ep->start, ep->toksz)) in eqn_def_find()
350 return &ep->defs[i]; in eqn_def_find()
357 * MODE_QUOTED: Use *ep->start as the delimiter; the token ends
360 * MODE_QUOTED when *ep->start is '"'.
361 * MODE_NOSUB: If *ep->start is a curly brace, the token ends after it;
371 * a token match, *ep->start is set to an allocated string that the
389 if (ep->end - ep->data >= last_len) in eqn_next()
392 ep->start = ep->end; in eqn_next()
395 switch (*ep->start) { in eqn_next()
397 ep->toksz = 0; in eqn_next()
408 ep->start++; in eqn_next()
414 ep->end = strchr(ep->start + 1, *ep->start); in eqn_next()
415 ep->start++; /* Skip opening quote. */ in eqn_next()
416 if (ep->end == NULL) { in eqn_next()
418 ep->node->line, ep->node->pos, NULL); in eqn_next()
419 ep->end = strchr(ep->start, '\0'); in eqn_next()
422 ep->end = ep->start + 1; in eqn_next()
423 if (*ep->start != '{' && *ep->start != '}') in eqn_next()
424 ep->end += strcspn(ep->end, " ^~\"{}\t"); in eqn_next()
426 ep->toksz = ep->end - ep->start; in eqn_next()
427 if (quoted && *ep->end != '\0') in eqn_next()
428 ep->end++; /* Skip closing quote. */ in eqn_next()
429 while (*ep->end != '\0' && strchr(" \t^~", *ep->end) != NULL) in eqn_next()
430 ep->end++; in eqn_next()
439 ep->node->line, ep->node->pos, NULL); in eqn_next()
444 if ((diff = def->valsz - ep->toksz) > 0) { in eqn_next()
445 start = ep->start - ep->data; in eqn_next()
446 ep->sz += diff; in eqn_next()
447 ep->data = mandoc_realloc(ep->data, ep->sz + 1); in eqn_next()
448 ep->start = ep->data + start; in eqn_next()
451 memmove(ep->start + def->valsz, ep->start + ep->toksz, in eqn_next()
452 strlen(ep->start + ep->toksz) + 1); in eqn_next()
453 memcpy(ep->start, def->val, def->valsz); in eqn_next()
454 last_len = ep->start - ep->data + def->valsz; in eqn_next()
459 ep->start = mandoc_strndup(ep->start, ep->toksz); in eqn_next()
463 if (STRNEQ(ep->start, ep->toksz, in eqn_next()
468 if (STRNEQ(ep->start, ep->toksz, in eqn_next()
470 mandoc_asprintf(&ep->start, in eqn_next()
475 ep->start = mandoc_strndup(ep->start, ep->toksz); in eqn_next()
477 if (STRNEQ(ep->start, ep->toksz, in eqn_next()
489 if (bp->first) in eqn_box_free()
490 eqn_box_free(bp->first); in eqn_box_free()
491 if (bp->next) in eqn_box_free()
492 eqn_box_free(bp->next); in eqn_box_free()
494 free(bp->text); in eqn_box_free()
495 free(bp->left); in eqn_box_free()
496 free(bp->right); in eqn_box_free()
497 free(bp->top); in eqn_box_free()
498 free(bp->bottom); in eqn_box_free()
508 bp->expectargs = UINT_MAX; in eqn_box_new()
521 bp->parent = parent; in eqn_box_alloc()
522 bp->parent->args++; in eqn_box_alloc()
523 bp->font = bp->parent->font; in eqn_box_alloc()
524 bp->size = ep->gsize; in eqn_box_alloc()
526 if (NULL != parent->first) { in eqn_box_alloc()
527 parent->last->next = bp; in eqn_box_alloc()
528 bp->prev = parent->last; in eqn_box_alloc()
530 parent->first = bp; in eqn_box_alloc()
532 parent->last = bp; in eqn_box_alloc()
540 * The new EQN_SUBEXPR will have a two-child limit.
547 assert(NULL != parent->last); in eqn_box_makebinary()
548 b = parent->last; in eqn_box_makebinary()
549 if (parent->last == parent->first) in eqn_box_makebinary()
550 parent->first = NULL; in eqn_box_makebinary()
551 parent->args--; in eqn_box_makebinary()
552 parent->last = b->prev; in eqn_box_makebinary()
553 b->prev = NULL; in eqn_box_makebinary()
555 newb->type = EQN_SUBEXPR; in eqn_box_makebinary()
556 newb->expectargs = 2; in eqn_box_makebinary()
557 newb->args = 1; in eqn_box_makebinary()
558 newb->first = newb->last = b; in eqn_box_makebinary()
559 newb->first->next = NULL; in eqn_box_makebinary()
560 b->parent = newb; in eqn_box_makebinary()
570 if (ep->end[0] == '\0' || ep->end[1] == '\0') { in eqn_delim()
572 ep->node->line, ep->node->pos, "delim"); in eqn_delim()
573 if (ep->end[0] != '\0') in eqn_delim()
574 ep->end++; in eqn_delim()
575 } else if (strncmp(ep->end, "off", 3) == 0) { in eqn_delim()
576 ep->delim = 0; in eqn_delim()
577 ep->end += 3; in eqn_delim()
578 } else if (strncmp(ep->end, "on", 2) == 0) { in eqn_delim()
579 if (ep->odelim && ep->cdelim) in eqn_delim()
580 ep->delim = 1; in eqn_delim()
581 ep->end += 2; in eqn_delim()
583 ep->odelim = *ep->end++; in eqn_delim()
584 ep->cdelim = *ep->end++; in eqn_delim()
585 ep->delim = 1; in eqn_delim()
590 * Undefine a previously-defined string.
599 ep->node->line, ep->node->pos, "undef"); in eqn_undef()
604 free(def->key); in eqn_undef()
605 free(def->val); in eqn_undef()
606 def->key = def->val = NULL; in eqn_undef()
607 def->keysz = def->valsz = 0; in eqn_undef()
618 ep->node->line, ep->node->pos, "define"); in eqn_def()
628 for (i = 0; i < (int)ep->defsz; i++) in eqn_def()
629 if (0 == ep->defs[i].keysz) in eqn_def()
632 if (i == (int)ep->defsz) { in eqn_def()
633 ep->defsz++; in eqn_def()
634 ep->defs = mandoc_reallocarray(ep->defs, in eqn_def()
635 ep->defsz, sizeof(struct eqn_def)); in eqn_def()
636 ep->defs[i].key = ep->defs[i].val = NULL; in eqn_def()
639 def = ep->defs + i; in eqn_def()
640 free(def->key); in eqn_def()
641 def->key = mandoc_strndup(ep->start, ep->toksz); in eqn_def()
642 def->keysz = ep->toksz; in eqn_def()
647 ep->node->line, ep->node->pos, "define %s", def->key); in eqn_def()
648 free(def->key); in eqn_def()
649 free(def->val); in eqn_def()
650 def->key = def->val = NULL; in eqn_def()
651 def->keysz = def->valsz = 0; in eqn_def()
654 free(def->val); in eqn_def()
655 def->val = mandoc_strndup(ep->start, ep->toksz); in eqn_def()
656 def->valsz = ep->toksz; in eqn_def()
669 parent = ep->node->eqn; in eqn_parse()
674 * Do not add it to the high-level syntax tree. in eqn_parse()
677 if (ep->data == NULL) in eqn_parse()
680 ep->start = ep->end = ep->data; in eqn_parse()
696 ep->node->line, ep->node->pos, "tdefine"); in eqn_parse()
703 mandoc_msg(MANDOCERR_REQ_EMPTY, ep->node->line, in eqn_parse()
704 ep->node->pos, "%s", eqn_toks[tok]); in eqn_parse()
718 if (parent->last == NULL) { in eqn_parse()
719 mandoc_msg(MANDOCERR_EQN_NOBOX, ep->node->line, in eqn_parse()
720 ep->node->pos, "%s", eqn_toks[tok]); in eqn_parse()
722 cur->type = EQN_TEXT; in eqn_parse()
723 cur->text = mandoc_strdup(""); in eqn_parse()
726 parent->type = EQN_LIST; in eqn_parse()
727 parent->expectargs = 1; in eqn_parse()
728 parent->font = EQNFONT_ROMAN; in eqn_parse()
731 parent->top = mandoc_strdup("\\[ad]"); in eqn_parse()
734 parent->top = mandoc_strdup("\\[->]"); in eqn_parse()
737 parent->top = mandoc_strdup("\\[<>]"); in eqn_parse()
740 parent->top = mandoc_strdup("\\[a~]"); in eqn_parse()
743 parent->bottom = mandoc_strdup("\\[ul]"); in eqn_parse()
746 parent->top = mandoc_strdup("\\[rn]"); in eqn_parse()
749 parent->top = mandoc_strdup("\\[a.]"); in eqn_parse()
752 parent->top = mandoc_strdup("\\[ha]"); in eqn_parse()
757 parent = parent->parent; in eqn_parse()
764 mandoc_msg(MANDOCERR_REQ_EMPTY, ep->node->line, in eqn_parse()
765 ep->node->pos, "%s", eqn_toks[tok]); in eqn_parse()
771 while (parent->args == parent->expectargs) in eqn_parse()
772 parent = parent->parent; in eqn_parse()
779 parent->type = EQN_LIST; in eqn_parse()
780 parent->expectargs = 1; in eqn_parse()
783 parent->font = EQNFONT_FAT; in eqn_parse()
786 parent->font = EQNFONT_ROMAN; in eqn_parse()
789 parent->font = EQNFONT_ITALIC; in eqn_parse()
792 parent->font = EQNFONT_BOLD; in eqn_parse()
802 mandoc_msg(MANDOCERR_REQ_EMPTY, ep->node->line, in eqn_parse()
803 ep->node->pos, "%s", eqn_toks[tok]); in eqn_parse()
806 size = mandoc_strntoi(ep->start, ep->toksz, 10); in eqn_parse()
807 if (-1 == size) { in eqn_parse()
808 mandoc_msg(MANDOCERR_IT_NONUM, ep->node->line, in eqn_parse()
809 ep->node->pos, "%s", eqn_toks[tok]); in eqn_parse()
813 ep->gsize = size; in eqn_parse()
816 while (parent->args == parent->expectargs) in eqn_parse()
817 parent = parent->parent; in eqn_parse()
819 parent->type = EQN_LIST; in eqn_parse()
820 parent->expectargs = 1; in eqn_parse()
821 parent->size = size; in eqn_parse()
828 * We have a left-right-associative expression. in eqn_parse()
832 if (parent->last == NULL) { in eqn_parse()
833 mandoc_msg(MANDOCERR_EQN_NOBOX, ep->node->line, in eqn_parse()
834 ep->node->pos, "%s", eqn_toks[tok]); in eqn_parse()
836 cur->type = EQN_TEXT; in eqn_parse()
837 cur->text = mandoc_strdup(""); in eqn_parse()
839 while (parent->expectargs == 1 && parent->args == 1) in eqn_parse()
840 parent = parent->parent; in eqn_parse()
842 for (cur = parent; cur != NULL; cur = cur->parent) in eqn_parse()
843 if (cur->pos == EQNPOS_SUB || in eqn_parse()
844 cur->pos == EQNPOS_SUP || in eqn_parse()
845 cur->pos == EQNPOS_SUBSUP || in eqn_parse()
846 cur->pos == EQNPOS_SQRT || in eqn_parse()
847 cur->pos == EQNPOS_OVER) in eqn_parse()
850 parent = cur->parent; in eqn_parse()
852 if (tok == EQN_TOK_SUP && parent->pos == EQNPOS_SUB) { in eqn_parse()
853 parent->expectargs = 3; in eqn_parse()
854 parent->pos = EQNPOS_SUBSUP; in eqn_parse()
857 if (tok == EQN_TOK_TO && parent->pos == EQNPOS_FROM) { in eqn_parse()
858 parent->expectargs = 3; in eqn_parse()
859 parent->pos = EQNPOS_FROMTO; in eqn_parse()
865 parent->pos = EQNPOS_FROM; in eqn_parse()
868 parent->pos = EQNPOS_TO; in eqn_parse()
871 parent->pos = EQNPOS_SUP; in eqn_parse()
874 parent->pos = EQNPOS_SUB; in eqn_parse()
881 while (parent->args == parent->expectargs) in eqn_parse()
882 parent = parent->parent; in eqn_parse()
884 * Accept a left-right-associative set of arguments just in eqn_parse()
889 parent->type = EQN_SUBEXPR; in eqn_parse()
890 parent->pos = EQNPOS_SQRT; in eqn_parse()
891 parent->expectargs = 1; in eqn_parse()
895 * We have a right-left-associative fraction. in eqn_parse()
899 if (parent->last == NULL) { in eqn_parse()
900 mandoc_msg(MANDOCERR_EQN_NOBOX, ep->node->line, in eqn_parse()
901 ep->node->pos, "%s", eqn_toks[tok]); in eqn_parse()
903 cur->type = EQN_TEXT; in eqn_parse()
904 cur->text = mandoc_strdup(""); in eqn_parse()
906 while (parent->args == parent->expectargs) in eqn_parse()
907 parent = parent->parent; in eqn_parse()
908 while (EQN_SUBEXPR == parent->type) in eqn_parse()
909 parent = parent->parent; in eqn_parse()
911 parent->pos = EQNPOS_OVER; in eqn_parse()
920 for (cur = parent; cur != NULL; cur = cur->parent) in eqn_parse()
921 if (cur->type == EQN_LIST && in eqn_parse()
922 cur->expectargs > 1 && in eqn_parse()
924 cur->left != NULL)) in eqn_parse()
927 mandoc_msg(MANDOCERR_BLK_NOTOPEN, ep->node->line, in eqn_parse()
928 ep->node->pos, "%s", eqn_toks[tok]); in eqn_parse()
935 ep->node->line, ep->node->pos, in eqn_parse()
940 if (STRNEQ(ep->start, ep->toksz, "ceiling", 7)) in eqn_parse()
941 parent->right = mandoc_strdup("\\[rc]"); in eqn_parse()
942 else if (STRNEQ(ep->start, ep->toksz, "floor", 5)) in eqn_parse()
943 parent->right = mandoc_strdup("\\[rf]"); in eqn_parse()
945 parent->right = in eqn_parse()
946 mandoc_strndup(ep->start, ep->toksz); in eqn_parse()
948 parent = parent->parent; in eqn_parse()
950 (parent->type == EQN_PILE || in eqn_parse()
951 parent->type == EQN_MATRIX)) in eqn_parse()
952 parent = parent->parent; in eqn_parse()
954 while (parent->type == EQN_LIST && in eqn_parse()
955 parent->expectargs == 1 && in eqn_parse()
956 parent->args == 1) in eqn_parse()
957 parent = parent->parent; in eqn_parse()
966 while (parent->args == parent->expectargs) in eqn_parse()
967 parent = parent->parent; in eqn_parse()
970 mandoc_msg(MANDOCERR_REQ_EMPTY, ep->node->line, in eqn_parse()
971 ep->node->pos, "%s", eqn_toks[tok]); in eqn_parse()
975 parent->type = EQN_LIST; in eqn_parse()
977 if (STRNEQ(ep->start, ep->toksz, "ceiling", 7)) in eqn_parse()
978 parent->left = mandoc_strdup("\\[lc]"); in eqn_parse()
979 else if (STRNEQ(ep->start, ep->toksz, "floor", 5)) in eqn_parse()
980 parent->left = mandoc_strdup("\\[lf]"); in eqn_parse()
982 parent->left = in eqn_parse()
983 mandoc_strndup(ep->start, ep->toksz); in eqn_parse()
993 while (parent->args == parent->expectargs) in eqn_parse()
994 parent = parent->parent; in eqn_parse()
996 parent->type = EQN_PILE; in eqn_parse()
997 parent->expectargs = 1; in eqn_parse()
1000 for (cur = parent; cur != NULL; cur = cur->parent) in eqn_parse()
1001 if (cur->type == EQN_PILE) in eqn_parse()
1004 mandoc_msg(MANDOCERR_IT_STRAY, ep->node->line, in eqn_parse()
1005 ep->node->pos, "%s", eqn_toks[tok]); in eqn_parse()
1009 parent->type = EQN_LIST; in eqn_parse()
1012 while (parent->args == parent->expectargs) in eqn_parse()
1013 parent = parent->parent; in eqn_parse()
1015 parent->type = EQN_MATRIX; in eqn_parse()
1016 parent->expectargs = 1; in eqn_parse()
1024 p = ep->start; in eqn_parse()
1030 while (parent->args == parent->expectargs) in eqn_parse()
1031 parent = parent->parent; in eqn_parse()
1033 cur->type = EQN_TEXT; in eqn_parse()
1034 cur->text = p; in eqn_parse()
1037 cur->font = EQNFONT_ROMAN; in eqn_parse()
1040 if (cur->font == EQNFONT_NONE) in eqn_parse()
1041 cur->font = EQNFONT_ITALIC; in eqn_parse()
1046 if (cur->font != EQNFONT_NONE || *p == '\0') in eqn_parse()
1048 cpn = p - 1; in eqn_parse()
1063 cur->font = ccl == CCL_LET ? in eqn_parse()
1073 if (parent->args == parent->expectargs) { in eqn_parse()
1075 if (cur->prev == NULL) in eqn_parse()
1076 parent->first = cur->next; in eqn_parse()
1078 cur->prev->next = NULL; in eqn_parse()
1079 parent->last = cur->prev; in eqn_parse()
1080 parent->args--; in eqn_parse()
1083 split->type = EQN_LIST; in eqn_parse()
1085 split->first = split->last = cur; in eqn_parse()
1086 cur->parent = split; in eqn_parse()
1087 cur->prev = NULL; in eqn_parse()
1092 nbox->type = EQN_TEXT; in eqn_parse()
1093 nbox->text = mandoc_strdup(cpn); in eqn_parse()
1095 p = mandoc_strndup(cur->text, in eqn_parse()
1096 cpn - cur->text); in eqn_parse()
1097 free(cur->text); in eqn_parse()
1098 cur->text = p; in eqn_parse()
1101 p = nbox->text; in eqn_parse()
1102 cpn = p - 1; in eqn_parse()
1106 parent = split->parent; in eqn_parse()
1124 for (i = 0; i < (int)p->defsz; i++) { in eqn_free()
1125 free(p->defs[i].key); in eqn_free()
1126 free(p->defs[i].val); in eqn_free()
1129 free(p->data); in eqn_free()
1130 free(p->defs); in eqn_free()