source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Add all rendered symbols used by eqn.
@ 2011-07-22 14:26 kristaps
  0 siblings, 0 replies; only message in thread
From: kristaps @ 2011-07-22 14:26 UTC (permalink / raw)
  To: source

Log Message:
-----------
Add all rendered symbols used by eqn.  I use the Second-Edition User's
Manual (1978) for this, so it should catch most of them.  They just map
into the mandoc_char escaped characters.

Modified Files:
--------------
    mdocml:
        eqn.7
        eqn.c

Revision Data
-------------
Index: eqn.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/eqn.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -Leqn.c -Leqn.c -u -p -r1.27 -r1.28
--- eqn.c
+++ eqn.c
@@ -75,6 +75,30 @@ enum	eqn_symt {
 	EQNSYM_THETA,
 	EQNSYM_UPSILON,
 	EQNSYM_XI,
+	EQNSYM_inter,
+	EQNSYM_union,
+	EQNSYM_prod,
+	EQNSYM_int,
+	EQNSYM_sum,
+	EQNSYM_grad,
+	EQNSYM_del,
+	EQNSYM_times,
+	EQNSYM_cdot,
+	EQNSYM_nothing,
+	EQNSYM_approx,
+	EQNSYM_prime,
+	EQNSYM_half,
+	EQNSYM_partial,
+	EQNSYM_inf,
+	EQNSYM_muchgreat,
+	EQNSYM_muchless,
+	EQNSYM_larrow,
+	EQNSYM_rarrow,
+	EQNSYM_pm,
+	EQNSYM_nequal,
+	EQNSYM_equiv,
+	EQNSYM_lessequal,
+	EQNSYM_moreequal,
 	EQNSYM__MAX
 };
 
@@ -95,7 +119,7 @@ struct	eqnpart {
 
 struct	eqnsym {
 	struct eqnstr	 str;
-	char		 sym;
+	const char	*sym;
 };
 
 enum	eqnpartt {
@@ -163,41 +187,65 @@ static	const struct eqnstr eqnpiles[EQNP
 };
 
 static	const struct eqnsym eqnsyms[EQNSYM__MAX] = {
-	{ { "alpha", 5 }, 'a' }, /* EQNSYM_alpha */
-	{ { "beta", 4 }, 'b' }, /* EQNSYM_beta */
-	{ { "chi", 3 }, 'x' }, /* EQNSYM_chi */
-	{ { "delta", 5 }, 'd' }, /* EQNSYM_delta */
-	{ { "epsilon", 7 }, 'e' }, /* EQNSYM_epsilon */
-	{ { "eta", 3 }, 'y' }, /* EQNSYM_eta */
-	{ { "gamma", 5 }, 'g' }, /* EQNSYM_gamma */
-	{ { "iota", 4 }, 'i' }, /* EQNSYM_iota */
-	{ { "kappa", 5 }, 'k' }, /* EQNSYM_kappa */
-	{ { "lambda", 6 }, 'l' }, /* EQNSYM_lambda */
-	{ { "mu", 2 }, 'm' }, /* EQNSYM_mu */
-	{ { "nu", 2 }, 'n' }, /* EQNSYM_nu */
-	{ { "omega", 5 }, 'w' }, /* EQNSYM_omega */
-	{ { "omicron", 7 }, 'o' }, /* EQNSYM_omicron */
-	{ { "phi", 3 }, 'f' }, /* EQNSYM_phi */
-	{ { "pi", 2 }, 'p' }, /* EQNSYM_pi */
-	{ { "psi", 2 }, 'q' }, /* EQNSYM_psi */
-	{ { "rho", 3 }, 'r' }, /* EQNSYM_rho */
-	{ { "sigma", 5 }, 's' }, /* EQNSYM_sigma */
-	{ { "tau", 3 }, 't' }, /* EQNSYM_tau */
-	{ { "theta", 5 }, 'h' }, /* EQNSYM_theta */
-	{ { "upsilon", 7 }, 'u' }, /* EQNSYM_upsilon */
-	{ { "xi", 2 }, 'c' }, /* EQNSYM_xi */
-	{ { "zeta", 4 }, 'z' }, /* EQNSYM_zeta */
-	{ { "DELTA", 5 }, 'D' }, /* EQNSYM_DELTA */
-	{ { "GAMMA", 5 }, 'G' }, /* EQNSYM_GAMMA */
-	{ { "LAMBDA", 6 }, 'L' }, /* EQNSYM_LAMBDA */
-	{ { "OMEGA", 5 }, 'W' }, /* EQNSYM_OMEGA */
-	{ { "PHI", 3 }, 'F' }, /* EQNSYM_PHI */
-	{ { "PI", 2 }, 'P' }, /* EQNSYM_PI */
-	{ { "PSI", 3 }, 'Q' }, /* EQNSYM_PSI */
-	{ { "SIGMA", 5 }, 'S' }, /* EQNSYM_SIGMA */
-	{ { "THETA", 5 }, 'H' }, /* EQNSYM_THETA */
-	{ { "UPSILON", 7 }, 'U' }, /* EQNSYM_UPSILON */
-	{ { "XI", 2 }, 'C' }, /* EQNSYM_XI */
+	{ { "alpha", 5 }, "*a" }, /* EQNSYM_alpha */
+	{ { "beta", 4 }, "*b" }, /* EQNSYM_beta */
+	{ { "chi", 3 }, "*x" }, /* EQNSYM_chi */
+	{ { "delta", 5 }, "*d" }, /* EQNSYM_delta */
+	{ { "epsilon", 7 }, "*e" }, /* EQNSYM_epsilon */
+	{ { "eta", 3 }, "*y" }, /* EQNSYM_eta */
+	{ { "gamma", 5 }, "*g" }, /* EQNSYM_gamma */
+	{ { "iota", 4 }, "*i" }, /* EQNSYM_iota */
+	{ { "kappa", 5 }, "*k" }, /* EQNSYM_kappa */
+	{ { "lambda", 6 }, "*l" }, /* EQNSYM_lambda */
+	{ { "mu", 2 }, "*m" }, /* EQNSYM_mu */
+	{ { "nu", 2 }, "*n" }, /* EQNSYM_nu */
+	{ { "omega", 5 }, "*w" }, /* EQNSYM_omega */
+	{ { "omicron", 7 }, "*o" }, /* EQNSYM_omicron */
+	{ { "phi", 3 }, "*f" }, /* EQNSYM_phi */
+	{ { "pi", 2 }, "*p" }, /* EQNSYM_pi */
+	{ { "psi", 2 }, "*q" }, /* EQNSYM_psi */
+	{ { "rho", 3 }, "*r" }, /* EQNSYM_rho */
+	{ { "sigma", 5 }, "*s" }, /* EQNSYM_sigma */
+	{ { "tau", 3 }, "*t" }, /* EQNSYM_tau */
+	{ { "theta", 5 }, "*h" }, /* EQNSYM_theta */
+	{ { "upsilon", 7 }, "*u" }, /* EQNSYM_upsilon */
+	{ { "xi", 2 }, "*c" }, /* EQNSYM_xi */
+	{ { "zeta", 4 }, "*z" }, /* EQNSYM_zeta */
+	{ { "DELTA", 5 }, "*D" }, /* EQNSYM_DELTA */
+	{ { "GAMMA", 5 }, "*G" }, /* EQNSYM_GAMMA */
+	{ { "LAMBDA", 6 }, "*L" }, /* EQNSYM_LAMBDA */
+	{ { "OMEGA", 5 }, "*W" }, /* EQNSYM_OMEGA */
+	{ { "PHI", 3 }, "*F" }, /* EQNSYM_PHI */
+	{ { "PI", 2 }, "*P" }, /* EQNSYM_PI */
+	{ { "PSI", 3 }, "*Q" }, /* EQNSYM_PSI */
+	{ { "SIGMA", 5 }, "*S" }, /* EQNSYM_SIGMA */
+	{ { "THETA", 5 }, "*H" }, /* EQNSYM_THETA */
+	{ { "UPSILON", 7 }, "*U" }, /* EQNSYM_UPSILON */
+	{ { "XI", 2 }, "*C" }, /* EQNSYM_XI */
+	{ { "inter", 5 }, "ca" }, /* EQNSYM_inter */
+	{ { "union", 5 }, "cu" }, /* EQNSYM_union */
+	{ { "prod", 4 }, "product" }, /* EQNSYM_prod */
+	{ { "int", 3 }, "integral" }, /* EQNSYM_int */
+	{ { "sum", 3 }, "sum" }, /* EQNSYM_sum */
+	{ { "grad", 4 }, "gr" }, /* EQNSYM_grad */
+	{ { "del", 3 }, "gr" }, /* EQNSYM_del */
+	{ { "times", 5 }, "mu" }, /* EQNSYM_times */
+	{ { "cdot", 4 }, "pc" }, /* EQNSYM_cdot */
+	{ { "nothing", 7 }, "&" }, /* EQNSYM_nothing */
+	{ { "approx", 6 }, "~~" }, /* EQNSYM_approx */
+	{ { "prime", 5 }, "aq" }, /* EQNSYM_prime */
+	{ { "half", 4 }, "12" }, /* EQNSYM_half */
+	{ { "partial", 7 }, "pd" }, /* EQNSYM_partial */
+	{ { "inf", 3 }, "if" }, /* EQNSYM_inf */
+	{ { ">>", 2 }, ">>" }, /* EQNSYM_muchgreat */
+	{ { "<<", 2 }, "<<" }, /* EQNSYM_muchless */
+	{ { "<-", 2 }, "<-" }, /* EQNSYM_larrow */
+	{ { "->", 2 }, "->" }, /* EQNSYM_rarrow */
+	{ { "+-", 2 }, "+-" }, /* EQNSYM_pm */
+	{ { "!=", 2 }, "!=" }, /* EQNSYM_nequal */
+	{ { "==", 2 }, "==" }, /* EQNSYM_equiv */
+	{ { "<=", 2 }, "<=" }, /* EQNSYM_lessequal */
+	{ { ">=", 2 }, ">=" }, /* EQNSYM_moreequal */
 };
 
 /* ARGSUSED */
@@ -342,7 +390,7 @@ eqn_box(struct eqn_node *ep, struct eqn_
 	size_t		 sz;
 	const char	*start;
 	char		*left;
-	char		 sym[5];
+	char		 sym[64];
 	enum eqn_rest	 c;
 	int		 i, size;
 	struct eqn_box	*bp;
@@ -472,11 +520,8 @@ eqn_box(struct eqn_node *ep, struct eqn_
 	bp->type = EQN_TEXT;
 	for (i = 0; i < (int)EQNSYM__MAX; i++)
 		if (EQNSTREQ(&eqnsyms[i].str, start, sz)) {
-			sym[0] = '\\';
-			sym[1] = '(';
-			sym[2] = '*';
-			sym[3] = eqnsyms[i].sym;
-			sym[4] = '\0';
+			sym[63] = '\0';
+			snprintf(sym, 62, "\\[%s]", eqnsyms[i].sym);
 			bp->text = mandoc_strdup(sym);
 			return(EQN_OK);
 		}
Index: eqn.7
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/eqn.7,v
retrieving revision 1.15
retrieving revision 1.16
diff -Leqn.7 -Leqn.7 -u -p -r1.15 -r1.16
--- eqn.7
+++ eqn.7
@@ -89,11 +89,19 @@ non-empty quoted string.
 Unless within a quoted string, white-space (and enclosing literal quote
 pairs) is thrown away.
 Quoted strings are not scanned for replacement definitions.
-The following text tokens are translated into an acceptable front-end
-format, if available: alpha, beta, chi, delta, epsilon, eta, gamma,
-iota, kappa, lambda, mu, nu, omega, omicron, phi, pi, psi, rho, sigma,
-tau, theta, upsilon, xi, zeta, DELTA, GAMMA, LAMBDA, OMEGA, PHI, PI,
-PSI, SIGMA, THETA, UPSILON, and XI.
+.Pp
+The following TEXT terms are translated into a rendered glyph, if
+available: alpha, beta, chi, delta, epsilon, eta, gamma, iota, kappa,
+lambda, mu, nu, omega, omicron, phi, pi, psi, rho, sigma, tau, theta,
+upsilon, xi, zeta, DELTA, GAMMA, LAMBDA, OMEGA, PHI, PI, PSI, SIGMA,
+THETA, UPSILON, XI, inter (intersection), union (union), prod (product),
+int (integral), sum (summation), grad (gradient), del (vector
+differential), times (multiply), cdot (centre-dot), nothing (zero-width
+space), approx (approximately equals), prime (prime), half (one-half),
+partial (partial differential), inf (infinity), >> (much greater), <<
+(much less), \-> (left arrow), <\- (right arrow), += (plus-minus), !=
+(not equal), == (equivalence), <= (less-than-equal), and >=
+(more-than-equal).
 .Pp
 The following control statements are available:
 .Bl -tag -width Ds
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-07-22 14:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-22 14:26 mdocml: Add all rendered symbols used by eqn kristaps

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).