source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Implement the obsolete macros .En .Es .Fr .Ot for backward
@ 2014-07-02  3:48 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2014-07-02  3:48 UTC (permalink / raw)
  To: source

Log Message:
-----------
Implement the obsolete macros .En .Es .Fr .Ot for backward compatibility,
since this is hardly more complicated than explicitly ignoring them
as we did in the past.  Of course, do not use them!

Modified Files:
--------------
    mdocml:
        libmdoc.h
        mandoc.h
        mdoc.7
        mdoc.c
        mdoc.h
        mdoc_argv.c
        mdoc_html.c
        mdoc_macro.c
        mdoc_man.c
        mdoc_term.c
        mdoc_validate.c
        read.c

Revision Data
-------------
Index: mdoc_man.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_man.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -Lmdoc_man.c -Lmdoc_man.c -u -p -r1.63 -r1.64
--- mdoc_man.c
+++ mdoc_man.c
@@ -51,6 +51,7 @@ static	void	  post_bf(DECL_ARGS);
 static	void	  post_bk(DECL_ARGS);
 static	void	  post_bl(DECL_ARGS);
 static	void	  post_dl(DECL_ARGS);
+static	void	  post_en(DECL_ARGS);
 static	void	  post_enc(DECL_ARGS);
 static	void	  post_eo(DECL_ARGS);
 static	void	  post_fa(DECL_ARGS);
@@ -78,8 +79,10 @@ static	int	  pre_bl(DECL_ARGS);
 static	int	  pre_br(DECL_ARGS);
 static	int	  pre_bx(DECL_ARGS);
 static	int	  pre_dl(DECL_ARGS);
+static	int	  pre_en(DECL_ARGS);
 static	int	  pre_enc(DECL_ARGS);
 static	int	  pre_em(DECL_ARGS);
+static	int	  pre_es(DECL_ARGS);
 static	int	  pre_fa(DECL_ARGS);
 static	int	  pre_fd(DECL_ARGS);
 static	int	  pre_fl(DECL_ARGS);
@@ -150,7 +153,7 @@ static	const struct manact manacts[MDOC_
 	{ cond_head, pre_enc, NULL, "\\- ", NULL }, /* Nd */
 	{ NULL, pre_nm, post_nm, NULL, NULL }, /* Nm */
 	{ cond_body, pre_enc, post_enc, "[", "]" }, /* Op */
-	{ NULL, NULL, NULL, NULL, NULL }, /* Ot */
+	{ NULL, pre_ft, post_font, NULL, NULL }, /* Ot */
 	{ NULL, pre_em, post_font, NULL, NULL }, /* Pa */
 	{ NULL, pre_enc, post_enc, "The \\fB",
 		"\\fP\nfunction returns the value 0 if successful;\n"
@@ -224,7 +227,7 @@ static	const struct manact manacts[MDOC_
 	{ NULL, NULL, NULL, NULL, NULL }, /* Ek */
 	{ NULL, pre_ux, NULL, "is currently in beta test.", NULL }, /* Bt */
 	{ NULL, NULL, NULL, NULL, NULL }, /* Hf */
-	{ NULL, NULL, NULL, NULL, NULL }, /* Fr */
+	{ NULL, pre_em, post_font, NULL, NULL }, /* Fr */
 	{ NULL, pre_ux, NULL, "currently under development.", NULL }, /* Ud */
 	{ NULL, NULL, post_lb, NULL, NULL }, /* Lb */
 	{ NULL, pre_pp, NULL, NULL, NULL }, /* Lp */
@@ -234,8 +237,8 @@ static	const struct manact manacts[MDOC_
 	{ cond_body, pre_enc, post_enc, "{", "}" }, /* Bro */
 	{ NULL, NULL, NULL, NULL, NULL }, /* Brc */
 	{ NULL, NULL, post_percent, NULL, NULL }, /* %C */
-	{ NULL, NULL, NULL, NULL, NULL }, /* Es */
-	{ NULL, NULL, NULL, NULL, NULL }, /* En */
+	{ NULL, pre_es, NULL, NULL, NULL }, /* Es */
+	{ cond_body, pre_en, post_en, NULL, NULL }, /* En */
 	{ NULL, pre_ux, NULL, "DragonFly", NULL }, /* Dx */
 	{ NULL, NULL, post_percent, NULL, NULL }, /* %Q */
 	{ NULL, pre_br, NULL, NULL, NULL }, /* br */
@@ -1035,12 +1038,46 @@ pre_em(DECL_ARGS)
 	return(1);
 }
 
+static int
+pre_en(DECL_ARGS)
+{
+
+	if (NULL == n->norm->Es ||
+	    NULL == n->norm->Es->child)
+		return(1);
+
+	print_word(n->norm->Es->child->string);
+	outflags &= ~MMAN_spc;
+	return(1);
+}
+
+static void
+post_en(DECL_ARGS)
+{
+
+	if (NULL == n->norm->Es ||
+	    NULL == n->norm->Es->child ||
+	    NULL == n->norm->Es->child->next)
+		return;
+
+	outflags &= ~MMAN_spc;
+	print_word(n->norm->Es->child->next->string);
+	return;
+}
+
 static void
 post_eo(DECL_ARGS)
 {
 
 	if (MDOC_HEAD == n->type || MDOC_BODY == n->type)
 		outflags &= ~MMAN_spc;
+}
+
+static int
+pre_es(DECL_ARGS)
+{
+
+	return(0);
 }
 
 static int
Index: mdoc_html.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_html.c,v
retrieving revision 1.190
retrieving revision 1.191
diff -Lmdoc_html.c -Lmdoc_html.c -u -p -r1.190 -r1.191
--- mdoc_html.c
+++ mdoc_html.c
@@ -97,7 +97,6 @@ static	int		  mdoc_it_pre(MDOC_ARGS);
 static	int		  mdoc_lb_pre(MDOC_ARGS);
 static	int		  mdoc_li_pre(MDOC_ARGS);
 static	int		  mdoc_lk_pre(MDOC_ARGS);
-static	int		  mdoc_ll_pre(MDOC_ARGS);
 static	int		  mdoc_mt_pre(MDOC_ARGS);
 static	int		  mdoc_ms_pre(MDOC_ARGS);
 static	int		  mdoc_nd_pre(MDOC_ARGS);
@@ -111,6 +110,7 @@ static	int		  mdoc_quote_pre(MDOC_ARGS);
 static	int		  mdoc_rs_pre(MDOC_ARGS);
 static	int		  mdoc_rv_pre(MDOC_ARGS);
 static	int		  mdoc_sh_pre(MDOC_ARGS);
+static	int		  mdoc_skip_pre(MDOC_ARGS);
 static	int		  mdoc_sm_pre(MDOC_ARGS);
 static	int		  mdoc_sp_pre(MDOC_ARGS);
 static	int		  mdoc_ss_pre(MDOC_ARGS);
@@ -157,7 +157,7 @@ static	const struct htmlmdoc mdocs[MDOC_
 	{mdoc_nd_pre, NULL}, /* Nd */
 	{mdoc_nm_pre, NULL}, /* Nm */
 	{mdoc_quote_pre, mdoc_quote_post}, /* Op */
-	{NULL, NULL}, /* Ot */
+	{mdoc_ft_pre, NULL}, /* Ot */
 	{mdoc_pa_pre, NULL}, /* Pa */
 	{mdoc_rv_pre, NULL}, /* Rv */
 	{NULL, NULL}, /* St */
@@ -227,7 +227,7 @@ static	const struct htmlmdoc mdocs[MDOC_
 	{NULL, NULL}, /* Ek */
 	{mdoc_bt_pre, NULL}, /* Bt */
 	{NULL, NULL}, /* Hf */
-	{NULL, NULL}, /* Fr */
+	{mdoc_em_pre, NULL}, /* Fr */
 	{mdoc_ud_pre, NULL}, /* Ud */
 	{mdoc_lb_pre, NULL}, /* Lb */
 	{mdoc_pp_pre, NULL}, /* Lp */
@@ -237,15 +237,15 @@ static	const struct htmlmdoc mdocs[MDOC_
 	{mdoc_quote_pre, mdoc_quote_post}, /* Bro */
 	{NULL, NULL}, /* Brc */
 	{mdoc__x_pre, mdoc__x_post}, /* %C */
-	{NULL, NULL}, /* Es */  /* TODO */
-	{NULL, NULL}, /* En */  /* TODO */
+	{mdoc_skip_pre, NULL}, /* Es */
+	{mdoc_quote_pre, mdoc_quote_post}, /* En */
 	{mdoc_xx_pre, NULL}, /* Dx */
 	{mdoc__x_pre, mdoc__x_post}, /* %Q */
 	{mdoc_sp_pre, NULL}, /* br */
 	{mdoc_sp_pre, NULL}, /* sp */
 	{mdoc__x_pre, mdoc__x_post}, /* %U */
 	{NULL, NULL}, /* Ta */
-	{mdoc_ll_pre, NULL}, /* ll */
+	{mdoc_skip_pre, NULL}, /* ll */
 };
 
 static	const char * const lists[LIST_MAX] = {
@@ -1545,7 +1545,7 @@ mdoc_sm_pre(MDOC_ARGS)
 }
 
 static int
-mdoc_ll_pre(MDOC_ARGS)
+mdoc_skip_pre(MDOC_ARGS)
 {
 
 	return(0);
@@ -2085,6 +2085,12 @@ mdoc_quote_pre(MDOC_ARGS)
 		PAIR_CLASS_INIT(&tag, "opt");
 		print_otag(h, TAG_SPAN, 1, &tag);
 		break;
+	case MDOC_En:
+		if (NULL == n->norm->Es ||
+		    NULL == n->norm->Es->child)
+			return(1);
+		print_text(h, n->norm->Es->child->string);
+		break;
 	case MDOC_Eo:
 		break;
 	case MDOC_Do:
@@ -2128,7 +2134,8 @@ mdoc_quote_post(MDOC_ARGS)
 	if (MDOC_BODY != n->type)
 		return;
 
-	h->flags |= HTML_NOSPACE;
+	if (MDOC_En != n->tok)
+		h->flags |= HTML_NOSPACE;
 
 	switch (n->tok) {
 	case MDOC_Ao:
@@ -2149,6 +2156,14 @@ mdoc_quote_post(MDOC_ARGS)
 		/* FALLTHROUGH */
 	case MDOC_Bq:
 		print_text(h, "\\(rB");
+		break;
+	case MDOC_En:
+		if (NULL != n->norm->Es &&
+		    NULL != n->norm->Es->child &&
+		    NULL != n->norm->Es->child->next) {
+			h->flags |= HTML_NOSPACE;
+			print_text(h, n->norm->Es->child->next->string);
+		}
 		break;
 	case MDOC_Eo:
 		break;
Index: libmdoc.h
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/libmdoc.h,v
retrieving revision 1.84
retrieving revision 1.85
diff -Llibmdoc.h -Llibmdoc.h -u -p -r1.84 -r1.85
--- libmdoc.h
+++ libmdoc.h
@@ -41,6 +41,7 @@ struct	mdoc {
 	enum mdoc_next	  next; /* where to put the next node */
 	struct mdoc_node *last; /* the last node parsed */
 	struct mdoc_node *first; /* the first node parsed */
+	struct mdoc_node *last_es; /* the most recent Es node */
 	struct mdoc_meta  meta; /* document meta-data */
 	enum mdoc_sec	  lastnamed;
 	enum mdoc_sec	  lastsec;
Index: mdoc.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc.c,v
retrieving revision 1.216
retrieving revision 1.217
diff -Lmdoc.c -Lmdoc.c -u -p -r1.216 -r1.217
--- mdoc.c
+++ mdoc.c
@@ -516,6 +516,8 @@ mdoc_block_alloc(struct mdoc *mdoc, int 
 		/* FALLTHROUGH */
 	case MDOC_Bl:
 		/* FALLTHROUGH */
+	case MDOC_En:
+		/* FALLTHROUGH */
 	case MDOC_Rs:
 		p->norm = mandoc_calloc(1, sizeof(union mdoc_data));
 		break;
Index: mandoc.h
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandoc.h,v
retrieving revision 1.125
retrieving revision 1.126
diff -Lmandoc.h -Lmandoc.h -u -p -r1.125 -r1.126
--- mandoc.h
+++ mandoc.h
@@ -71,7 +71,7 @@ enum	mandocerr {
 	MANDOCERR_SEC_MSEC, /* unexpected section: title for ... only */
 
 	/* related to macros and nesting */
-	MANDOCERR_MACROOBS, /* skipping obsolete macro */
+	MANDOCERR_MACRO_OBS, /* obsolete macro: macro */
 	MANDOCERR_IGNPAR, /* skipping paragraph macro */
 	MANDOCERR_MOVEPAR, /* moving paragraph macro out of list */
 	MANDOCERR_IGNNS, /* skipping no-space macro */
Index: mdoc.7
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc.7,v
retrieving revision 1.230
retrieving revision 1.231
diff -Lmdoc.7 -Lmdoc.7 -u -p -r1.230 -r1.231
--- mdoc.7
+++ mdoc.7
@@ -1487,8 +1487,14 @@ See also
 and
 .Sx \&Sy .
 .Ss \&En
-This macro is obsolete and ignored by
-.Xr mandoc 1 .
+This macro is obsolete.
+Use
+.Sx \&Eo
+or any of the other enclosure macros.
+.Pp
+It encloses its argument in the delimiters specified by the last
+.Sx \&Es
+macro.
 .Ss \&Eo
 An arbitrary enclosure.
 Its syntax is as follows:
@@ -1514,8 +1520,14 @@ See also
 .Sx \&Dv
 for general constants.
 .Ss \&Es
-This macro is obsolete and ignored by
-.Xr mandoc 1 .
+This macro is obsolete.
+Use
+.Sx \&Eo
+or any of the other enclosure macros.
+.Pp
+It takes two arguments, defining the delimiters to be used by subsequent
+.Sx \&En
+macros.
 .Ss \&Ev
 Environmental variables such as those specified in
 .Xr environ 7 .
@@ -1695,13 +1707,10 @@ See also
 and
 .Sx \&Ft .
 .Ss \&Fr
-This macro is obsolete and ignored by
-.Xr mandoc 1 .
+This macro is obsolete.
+No replacement markup is needed.
 .Pp
-It was used to show function return values.
-The syntax was:
-.Pp
-.Dl Pf . Sx \&Fr Ar value
+It was used to show numerical function return values in an italic font.
 .Ss \&Ft
 A function type.
 Its syntax is as follows:
@@ -2114,8 +2123,12 @@ See also
 and
 .Sx \&Dt .
 .Ss \&Ot
-This macro is obsolete and ignored by
-.Xr mandoc 1 .
+This macro is obsolete.
+Use
+.Sx \&Ft
+instead; with
+.Xr mandoc 1 ,
+both have the same effect.
 .Pp
 Historical
 .Nm
@@ -2890,6 +2903,7 @@ end of the line.
 .It Sx \&D1  Ta    \&No     Ta    \&Yes
 .It Sx \&Dl  Ta    \&No     Ta    Yes
 .It Sx \&Dq  Ta    Yes      Ta    Yes
+.It Sx \&En  Ta    Yes      Ta    Yes
 .It Sx \&Op  Ta    Yes      Ta    Yes
 .It Sx \&Pq  Ta    Yes      Ta    Yes
 .It Sx \&Ql  Ta    Yes      Ta    Yes
@@ -2967,16 +2981,15 @@ then the macro accepts an arbitrary numb
 .It Sx \&Dv  Ta    Yes      Ta    Yes      Ta    >0
 .It Sx \&Dx  Ta    Yes      Ta    Yes      Ta    n
 .It Sx \&Em  Ta    Yes      Ta    Yes      Ta    >0
-.It Sx \&En  Ta    \&No     Ta    \&No     Ta    0
 .It Sx \&Er  Ta    Yes      Ta    Yes      Ta    >0
-.It Sx \&Es  Ta    \&No     Ta    \&No     Ta    0
+.It Sx \&Es  Ta    Yes      Ta    Yes      Ta    2
 .It Sx \&Ev  Ta    Yes      Ta    Yes      Ta    >0
 .It Sx \&Ex  Ta    \&No     Ta    \&No     Ta    n
 .It Sx \&Fa  Ta    Yes      Ta    Yes      Ta    >0
 .It Sx \&Fd  Ta    \&No     Ta    \&No     Ta    >0
 .It Sx \&Fl  Ta    Yes      Ta    Yes      Ta    n
 .It Sx \&Fn  Ta    Yes      Ta    Yes      Ta    >0
-.It Sx \&Fr  Ta    \&No     Ta    \&No     Ta    n
+.It Sx \&Fr  Ta    Yes      Ta    Yes      Ta    >0
 .It Sx \&Ft  Ta    Yes      Ta    Yes      Ta    >0
 .It Sx \&Fx  Ta    Yes      Ta    Yes      Ta    n
 .It Sx \&Hf  Ta    \&No     Ta    \&No     Ta    n
@@ -2993,7 +3006,7 @@ then the macro accepts an arbitrary numb
 .It Sx \&Ns  Ta    Yes      Ta    Yes      Ta    0
 .It Sx \&Nx  Ta    Yes      Ta    Yes      Ta    n
 .It Sx \&Os  Ta    \&No     Ta    \&No     Ta    n
-.It Sx \&Ot  Ta    \&No     Ta    \&No     Ta    n
+.It Sx \&Ot  Ta    Yes      Ta    Yes      Ta    >0
 .It Sx \&Ox  Ta    Yes      Ta    Yes      Ta    n
 .It Sx \&Pa  Ta    Yes      Ta    Yes      Ta    n
 .It Sx \&Pf  Ta    Yes      Ta    Yes      Ta    1
Index: mdoc_validate.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_validate.c,v
retrieving revision 1.217
retrieving revision 1.218
diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.217 -r1.218
--- mdoc_validate.c
+++ mdoc_validate.c
@@ -98,6 +98,8 @@ static	int	 post_bx(POST_ARGS);
 static	int	 post_defaults(POST_ARGS);
 static	int	 post_dd(POST_ARGS);
 static	int	 post_dt(POST_ARGS);
+static	int	 post_en(POST_ARGS);
+static	int	 post_es(POST_ARGS);
 static	int	 post_eoln(POST_ARGS);
 static	int	 post_hyph(POST_ARGS);
 static	int	 post_ignpar(POST_ARGS);
@@ -125,6 +127,7 @@ static	int	 pre_display(PRE_ARGS);
 static	int	 pre_dt(PRE_ARGS);
 static	int	 pre_it(PRE_ARGS);
 static	int	 pre_literal(PRE_ARGS);
+static	int	 pre_obsolete(PRE_ARGS);
 static	int	 pre_os(PRE_ARGS);
 static	int	 pre_par(PRE_ARGS);
 static	int	 pre_sh(PRE_ARGS);
@@ -145,6 +148,8 @@ static	v_post	 posts_d1[] = { bwarn_ge1,
 static	v_post	 posts_dd[] = { post_dd, post_prol, NULL };
 static	v_post	 posts_dl[] = { post_literal, bwarn_ge1, NULL };
 static	v_post	 posts_dt[] = { post_dt, post_prol, NULL };
+static	v_post	 posts_en[] = { post_en, NULL };
+static	v_post	 posts_es[] = { post_es, NULL };
 static	v_post	 posts_fo[] = { hwarn_eq1, bwarn_ge1, NULL };
 static	v_post	 posts_hyph[] = { post_hyph, NULL };
 static	v_post	 posts_hyphtext[] = { ewarn_ge1, post_hyph, NULL };
@@ -173,6 +178,7 @@ static	v_pre	 pres_dl[] = { pre_literal,
 static	v_pre	 pres_dd[] = { pre_dd, NULL };
 static	v_pre	 pres_dt[] = { pre_dt, NULL };
 static	v_pre	 pres_it[] = { pre_it, pre_par, NULL };
+static	v_pre	 pres_obsolete[] = { pre_obsolete, NULL };
 static	v_pre	 pres_os[] = { pre_os, NULL };
 static	v_pre	 pres_pp[] = { pre_par, NULL };
 static	v_pre	 pres_sh[] = { pre_sh, NULL };
@@ -214,7 +220,7 @@ static	const struct valids mdoc_valids[M
 	{ NULL, posts_nd },			/* Nd */
 	{ NULL, posts_nm },			/* Nm */
 	{ NULL, NULL },				/* Op */
-	{ NULL, NULL },				/* Ot */
+	{ pres_obsolete, NULL },		/* Ot */
 	{ NULL, posts_defaults },		/* Pa */
 	{ pres_std, posts_std },		/* Rv */
 	{ NULL, posts_st },			/* St */
@@ -284,7 +290,7 @@ static	const struct valids mdoc_valids[M
 	{ NULL, NULL },				/* Ek */
 	{ NULL, posts_eoln },			/* Bt */
 	{ NULL, NULL },				/* Hf */
-	{ NULL, NULL },				/* Fr */
+	{ pres_obsolete, NULL },		/* Fr */
 	{ NULL, posts_eoln },			/* Ud */
 	{ NULL, posts_lb },			/* Lb */
 	{ pres_pp, posts_pp },			/* Lp */
@@ -294,8 +300,8 @@ static	const struct valids mdoc_valids[M
 	{ NULL, NULL },				/* Bro */
 	{ NULL, NULL },				/* Brc */
 	{ NULL, posts_text },			/* %C */
-	{ NULL, NULL },				/* Es */
-	{ NULL, NULL },				/* En */
+	{ pres_obsolete, posts_es },		/* Es */
+	{ pres_obsolete, posts_en },		/* En */
 	{ NULL, NULL },				/* Dx */
 	{ NULL, posts_text },			/* %Q */
 	{ NULL, posts_pp },			/* br */
@@ -931,6 +937,16 @@ pre_std(PRE_ARGS)
 }
 
 static int
+pre_obsolete(PRE_ARGS)
+{
+
+	if (MDOC_ELEM == n->type || MDOC_BLOCK == n->type)
+		mandoc_msg(MANDOCERR_MACRO_OBS, mdoc->parse,
+		    n->line, n->pos, mdoc_macronames[n->tok]);
+	return(1);
+}
+
+static int
 pre_dt(PRE_ARGS)
 {
 
@@ -1226,6 +1242,23 @@ post_an(POST_ARGS)
 	} else if (np->child)
 		check_count(mdoc, MDOC_ELEM, CHECK_WARN, CHECK_EQ, 0);
 
+	return(1);
+}
+
+static int
+post_en(POST_ARGS)
+{
+
+	if (MDOC_BLOCK == mdoc->last->type)
+		mdoc->last->norm->Es = mdoc->last_es;
+	return(1);
+}
+
+static int
+post_es(POST_ARGS)
+{
+
+	mdoc->last_es = mdoc->last;
 	return(1);
 }
 
Index: mdoc_macro.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_macro.c,v
retrieving revision 1.131
retrieving revision 1.132
diff -Lmdoc_macro.c -Lmdoc_macro.c -u -p -r1.131 -r1.132
--- mdoc_macro.c
+++ mdoc_macro.c
@@ -48,7 +48,6 @@ static	int		ctx_synopsis(MACRO_PROT_ARGS
 static	int		in_line_eoln(MACRO_PROT_ARGS);
 static	int		in_line_argn(MACRO_PROT_ARGS);
 static	int		in_line(MACRO_PROT_ARGS);
-static	int		obsolete(MACRO_PROT_ARGS);
 static	int		phrase_ta(MACRO_PROT_ARGS);
 
 static	int		dword(struct mdoc *, int, int, const char *,
@@ -104,7 +103,7 @@ const	struct mdoc_macro __mdoc_macros[MD
 	{ blk_full, MDOC_JOIN }, /* Nd */
 	{ ctx_synopsis, MDOC_CALLABLE | MDOC_PARSED }, /* Nm */
 	{ blk_part_imp, MDOC_CALLABLE | MDOC_PARSED }, /* Op */
-	{ obsolete, 0 }, /* Ot */
+	{ in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Ot */
 	{ in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Pa */
 	{ in_line_eoln, 0 }, /* Rv */
 	{ in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* St */
@@ -191,7 +190,7 @@ const	struct mdoc_macro __mdoc_macros[MD
 	{ blk_exp_close, MDOC_EXPLICIT | MDOC_JOIN }, /* Ek */
 	{ in_line_eoln, 0 }, /* Bt */
 	{ in_line_eoln, 0 }, /* Hf */
-	{ obsolete, 0 }, /* Fr */
+	{ in_line, MDOC_CALLABLE | MDOC_PARSED }, /* Fr */
 	{ in_line_eoln, 0 }, /* Ud */
 	{ in_line, 0 }, /* Lb */
 	{ in_line_eoln, 0 }, /* Lp */
@@ -203,8 +202,8 @@ const	struct mdoc_macro __mdoc_macros[MD
 	{ blk_exp_close, MDOC_CALLABLE | MDOC_PARSED |
 			 MDOC_EXPLICIT | MDOC_JOIN }, /* Brc */
 	{ in_line_eoln, MDOC_JOIN }, /* %C */
-	{ obsolete, 0 }, /* Es */
-	{ obsolete, 0 }, /* En */
+	{ in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Es */
+	{ blk_part_imp, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* En */
 	{ in_line_argn, MDOC_CALLABLE | MDOC_PARSED }, /* Dx */
 	{ in_line_eoln, MDOC_JOIN }, /* %Q */
 	{ in_line_eoln, 0 }, /* br */
@@ -1528,6 +1527,8 @@ in_line_argn(MACRO_PROT_ARGS)
 		break;
 	case MDOC_Bx:
 		/* FALLTHROUGH */
+	case MDOC_Es:
+		/* FALLTHROUGH */
 	case MDOC_Xr:
 		maxargs = 2;
 		break;
@@ -1713,14 +1714,6 @@ ctx_synopsis(MACRO_PROT_ARGS)
 		return(blk_full(mdoc, tok, line, ppos, pos, buf));
 	assert(MDOC_Vt == tok);
 	return(blk_part_imp(mdoc, tok, line, ppos, pos, buf));
-}
-
-static int
-obsolete(MACRO_PROT_ARGS)
-{
-
-	mdoc_pmsg(mdoc, line, ppos, MANDOCERR_MACROOBS);
-	return(1);
 }
 
 /*
Index: mdoc_term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_term.c,v
retrieving revision 1.267
retrieving revision 1.268
diff -Lmdoc_term.c -Lmdoc_term.c -u -p -r1.267 -r1.268
--- mdoc_term.c
+++ mdoc_term.c
@@ -95,6 +95,7 @@ static	int	  termp_bt_pre(DECL_ARGS);
 static	int	  termp_bx_pre(DECL_ARGS);
 static	int	  termp_cd_pre(DECL_ARGS);
 static	int	  termp_d1_pre(DECL_ARGS);
+static	int	  termp_es_pre(DECL_ARGS);
 static	int	  termp_ex_pre(DECL_ARGS);
 static	int	  termp_fa_pre(DECL_ARGS);
 static	int	  termp_fd_pre(DECL_ARGS);
@@ -158,7 +159,7 @@ static	const struct termact termacts[MDO
 	{ termp_nd_pre, NULL }, /* Nd */
 	{ termp_nm_pre, termp_nm_post }, /* Nm */
 	{ termp_quote_pre, termp_quote_post }, /* Op */
-	{ NULL, NULL }, /* Ot */
+	{ termp_ft_pre, NULL }, /* Ot */
 	{ termp_under_pre, NULL }, /* Pa */
 	{ termp_rv_pre, NULL }, /* Rv */
 	{ NULL, NULL }, /* St */
@@ -228,7 +229,7 @@ static	const struct termact termacts[MDO
 	{ NULL, NULL }, /* Ek */
 	{ termp_bt_pre, NULL }, /* Bt */
 	{ NULL, NULL }, /* Hf */
-	{ NULL, NULL }, /* Fr */
+	{ termp_under_pre, NULL }, /* Fr */
 	{ termp_ud_pre, NULL }, /* Ud */
 	{ NULL, termp_lb_post }, /* Lb */
 	{ termp_sp_pre, NULL }, /* Lp */
@@ -238,8 +239,8 @@ static	const struct termact termacts[MDO
 	{ termp_quote_pre, termp_quote_post }, /* Bro */
 	{ NULL, NULL }, /* Brc */
 	{ NULL, termp____post }, /* %C */
-	{ NULL, NULL }, /* Es */ /* TODO */
-	{ NULL, NULL }, /* En */ /* TODO */
+	{ termp_es_pre, NULL }, /* Es */
+	{ termp_quote_pre, termp_quote_post }, /* En */
 	{ termp_xx_pre, NULL }, /* Dx */
 	{ NULL, termp____post }, /* %Q */
 	{ termp_sp_pre, NULL }, /* br */
@@ -1829,6 +1830,13 @@ termp_sp_pre(DECL_ARGS)
 }
 
 static int
+termp_es_pre(DECL_ARGS)
+{
+
+	return(0);
+}
+
+static int
 termp_quote_pre(DECL_ARGS)
 {
 
@@ -1860,6 +1868,12 @@ termp_quote_pre(DECL_ARGS)
 	case MDOC_Dq:
 		term_word(p, "\\(lq");
 		break;
+	case MDOC_En:
+		if (NULL == n->norm->Es ||
+		    NULL == n->norm->Es->child)
+			return(1);
+		term_word(p, n->norm->Es->child->string);
+		break;
 	case MDOC_Eo:
 		break;
 	case MDOC_Po:
@@ -1897,7 +1911,8 @@ termp_quote_post(DECL_ARGS)
 	if (MDOC_BODY != n->type && MDOC_ELEM != n->type)
 		return;
 
-	p->flags |= TERMP_NOSPACE;
+	if (MDOC_En != n->tok)
+		p->flags |= TERMP_NOSPACE;
 
 	switch (n->tok) {
 	case MDOC_Ao:
@@ -1923,6 +1938,14 @@ termp_quote_post(DECL_ARGS)
 		/* FALLTHROUGH */
 	case MDOC_Dq:
 		term_word(p, "\\(rq");
+		break;
+	case MDOC_En:
+		if (NULL != n->norm->Es &&
+		    NULL != n->norm->Es->child &&
+		    NULL != n->norm->Es->child->next) {
+			p->flags |= TERMP_NOSPACE;
+			term_word(p, n->norm->Es->child->next->string);
+		}
 		break;
 	case MDOC_Eo:
 		break;
Index: mdoc.h
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc.h,v
retrieving revision 1.129
retrieving revision 1.130
diff -Lmdoc.h -Lmdoc.h -u -p -r1.129 -r1.130
--- mdoc.h
+++ mdoc.h
@@ -338,6 +338,7 @@ union	mdoc_data {
 	struct mdoc_bd	  Bd;
 	struct mdoc_bf	  Bf;
 	struct mdoc_bl	  Bl;
+	struct mdoc_node *Es;
 	struct mdoc_rs	  Rs;
 };
 
Index: mdoc_argv.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_argv.c,v
retrieving revision 1.93
retrieving revision 1.94
diff -Lmdoc_argv.c -Lmdoc_argv.c -u -p -r1.93 -r1.94
--- mdoc_argv.c
+++ mdoc_argv.c
@@ -179,7 +179,7 @@ static	const struct mdocarg mdocargs[MDO
 	{ ARGSFL_NONE, NULL }, /* Nd */
 	{ ARGSFL_DELIM, NULL }, /* Nm */
 	{ ARGSFL_DELIM, NULL }, /* Op */
-	{ ARGSFL_NONE, NULL }, /* Ot */
+	{ ARGSFL_DELIM, NULL }, /* Ot */
 	{ ARGSFL_DELIM, NULL }, /* Pa */
 	{ ARGSFL_NONE, args_Ex }, /* Rv */
 	{ ARGSFL_DELIM, NULL }, /* St */
@@ -249,7 +249,7 @@ static	const struct mdocarg mdocargs[MDO
 	{ ARGSFL_NONE, NULL }, /* Ek */
 	{ ARGSFL_NONE, NULL }, /* Bt */
 	{ ARGSFL_NONE, NULL }, /* Hf */
-	{ ARGSFL_NONE, NULL }, /* Fr */
+	{ ARGSFL_DELIM, NULL }, /* Fr */
 	{ ARGSFL_NONE, NULL }, /* Ud */
 	{ ARGSFL_DELIM, NULL }, /* Lb */
 	{ ARGSFL_NONE, NULL }, /* Lp */
@@ -260,7 +260,7 @@ static	const struct mdocarg mdocargs[MDO
 	{ ARGSFL_DELIM, NULL }, /* Brc */
 	{ ARGSFL_NONE, NULL }, /* %C */
 	{ ARGSFL_NONE, NULL }, /* Es */
-	{ ARGSFL_NONE, NULL }, /* En */
+	{ ARGSFL_DELIM, NULL }, /* En */
 	{ ARGSFL_DELIM, NULL }, /* Dx */
 	{ ARGSFL_NONE, NULL }, /* %Q */
 	{ ARGSFL_NONE, NULL }, /* br */
Index: read.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/read.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -Lread.c -Lread.c -u -p -r1.54 -r1.55
--- read.c
+++ read.c
@@ -115,7 +115,7 @@ static	const char * const	mandocerrs[MAN
 	"unexpected section",
 
 	/* related to macros and nesting */
-	"skipping obsolete macro",
+	"obsolete macro",
 	"skipping paragraph macro",
 	"moving paragraph macro out of list",
 	"skipping no-space macro",
--
 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:[~2014-07-02  3:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-02  3:48 mdocml: Implement the obsolete macros .En .Es .Fr .Ot for backward schwarze

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).