source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: move .ll to the roff modules
@ 2017-05-05 13:18 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2017-05-05 13:18 UTC (permalink / raw)
  To: source

Log Message:
-----------
move .ll to the roff modules

Modified Files:
--------------
    mdocml:
        man_html.c
        man_macro.c
        man_term.c
        man_validate.c
        mandocdb.c
        mdoc_argv.c
        mdoc_html.c
        mdoc_macro.c
        mdoc_man.c
        mdoc_markdown.c
        mdoc_state.c
        mdoc_term.c
        mdoc_validate.c
        roff.c
        roff.h
        roff_term.c
        roff_validate.c

Revision Data
-------------
Index: mdoc_markdown.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_markdown.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -Lmdoc_markdown.c -Lmdoc_markdown.c -u -p -r1.19 -r1.20
--- mdoc_markdown.c
+++ mdoc_markdown.c
@@ -19,7 +19,6 @@
 #include <assert.h>
 #include <ctype.h>
 #include <stdio.h>
-#include <stdlib.h>
 #include <string.h>
 
 #include "mandoc_aux.h"
@@ -226,7 +225,6 @@ static	const struct md_act __md_acts[MDO
 	{ NULL, md_pre_Pp, NULL, NULL, NULL }, /* sp */
 	{ NULL, md_pre_Lk, md_post_pc, NULL, NULL }, /* %U */
 	{ NULL, NULL, NULL, NULL, NULL }, /* Ta */
-	{ NULL, NULL, NULL, NULL, NULL }, /* ll */
 };
 static	const struct md_act *const md_acts = __md_acts - MDOC_Dd;
 
@@ -325,11 +323,9 @@ md_node(struct roff_node *n)
 		case ROFF_br:
 			process_children = md_pre_br(n);
 			break;
-		case ROFF_ft:
+		default:
 			process_children = 0;
 			break;
-		default:
-			abort();
 		}
 	} else {
 		assert(n->tok >= MDOC_Dd && n->tok < MDOC_MAX);
Index: man_html.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/man_html.c,v
retrieving revision 1.139
retrieving revision 1.140
diff -Lman_html.c -Lman_html.c -u -p -r1.139 -r1.140
--- man_html.c
+++ man_html.c
@@ -107,7 +107,6 @@ static	const struct htmlman __mans[MAN_M
 	{ NULL, NULL }, /* EE */
 	{ man_UR_pre, NULL }, /* UR */
 	{ NULL, NULL }, /* UE */
-	{ man_ign_pre, NULL }, /* ll */
 };
 static	const struct htmlman *const mans = __mans - MAN_TH;
 
Index: mdoc_argv.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_argv.c,v
retrieving revision 1.112
retrieving revision 1.113
diff -Lmdoc_argv.c -Lmdoc_argv.c -u -p -r1.112 -r1.113
--- mdoc_argv.c
+++ mdoc_argv.c
@@ -266,7 +266,6 @@ static	const struct mdocarg __mdocargs[M
 	{ ARGSFL_NONE, NULL }, /* sp */
 	{ ARGSFL_NONE, NULL }, /* %U */
 	{ ARGSFL_NONE, NULL }, /* Ta */
-	{ ARGSFL_NONE, NULL }, /* ll */
 };
 static	const struct mdocarg *const mdocargs = __mdocargs - MDOC_Dd;
 
Index: mdoc_html.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_html.c,v
retrieving revision 1.283
retrieving revision 1.284
diff -Lmdoc_html.c -Lmdoc_html.c -u -p -r1.283 -r1.284
--- mdoc_html.c
+++ mdoc_html.c
@@ -240,7 +240,6 @@ static	const struct htmlmdoc __mdocs[MDO
 	{mdoc_sp_pre, NULL}, /* sp */
 	{mdoc__x_pre, mdoc__x_post}, /* %U */
 	{NULL, NULL}, /* Ta */
-	{mdoc_skip_pre, NULL}, /* ll */
 };
 static	const struct htmlmdoc *const mdocs = __mdocs - MDOC_Dd;
 
Index: mdoc_validate.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_validate.c,v
retrieving revision 1.324
retrieving revision 1.325
diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.324 -r1.325
--- mdoc_validate.c
+++ mdoc_validate.c
@@ -230,7 +230,6 @@ static	const v_post __mdoc_valids[MDOC_M
 	post_par,	/* sp */
 	NULL,		/* %U */
 	NULL,		/* Ta */
-	NULL,		/* ll */
 };
 static	const v_post *const mdoc_valids = __mdoc_valids - MDOC_Dd;
 
Index: roff_validate.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/roff_validate.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lroff_validate.c -Lroff_validate.c -u -p -r1.1 -r1.2
--- roff_validate.c
+++ roff_validate.c
@@ -33,6 +33,7 @@ static	void	  roff_valid_ft(ROFF_VALID_A
 static	const roff_valid_fp roff_valids[ROFF_MAX] = {
 	NULL,  /* br */
 	roff_valid_ft,  /* ft */
+	NULL,  /* ll */
 };
 
 
Index: mandocdb.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mandocdb.c,v
retrieving revision 1.247
retrieving revision 1.248
diff -Lmandocdb.c -Lmandocdb.c -u -p -r1.247 -r1.248
--- mandocdb.c
+++ mandocdb.c
@@ -305,7 +305,6 @@ static	const struct mdoc_handler __mdocs
 	{ NULL, 0, 0 },  /* sp */
 	{ NULL, 0, 0 },  /* %U */
 	{ NULL, 0, 0 },  /* Ta */
-	{ NULL, 0, 0 },  /* ll */
 };
 static	const struct mdoc_handler *const mdocs = __mdocs - MDOC_Dd;
 
Index: mdoc_state.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_state.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -Lmdoc_state.c -Lmdoc_state.c -u -p -r1.6 -r1.7
--- mdoc_state.c
+++ mdoc_state.c
@@ -158,7 +158,6 @@ static	const state_handler __state_handl
 	NULL,		/* sp */
 	NULL,		/* %U */
 	NULL,		/* Ta */
-	NULL,		/* ll */
 };
 static const state_handler *const state_handlers = __state_handlers - MDOC_Dd;
 
Index: roff_term.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/roff_term.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lroff_term.c -Lroff_term.c -u -p -r1.2 -r1.3
--- roff_term.c
+++ roff_term.c
@@ -1,6 +1,6 @@
 /*	$OpenBSD$ */
 /*
- * Copyright (c) 2010, 2017 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2010, 2014, 2017 Ingo Schwarze <schwarze@openbsd.org>
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -17,6 +17,7 @@
 #include <sys/types.h>
 
 #include <assert.h>
+#include <stddef.h>
 
 #include "roff.h"
 #include "out.h"
@@ -28,10 +29,12 @@ typedef	void	(*roff_term_pre_fp)(ROFF_TE
 
 static	void	  roff_term_pre_br(ROFF_TERM_ARGS);
 static	void	  roff_term_pre_ft(ROFF_TERM_ARGS);
+static	void	  roff_term_pre_ll(ROFF_TERM_ARGS);
 
 static	const roff_term_pre_fp roff_term_pre_acts[ROFF_MAX] = {
 	roff_term_pre_br,  /* br */
 	roff_term_pre_ft,  /* ft */
+	roff_term_pre_ll,  /* ft */
 };
 
 
@@ -77,4 +80,10 @@ roff_term_pre_ft(ROFF_TERM_ARGS)
 	default:
 		break;
 	}
+}
+
+static void
+roff_term_pre_ll(ROFF_TERM_ARGS)
+{
+	term_setwidth(p, n->child != NULL ? n->child->string : NULL);
 }
Index: man_macro.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/man_macro.c,v
retrieving revision 1.118
retrieving revision 1.119
diff -Lman_macro.c -Lman_macro.c -u -p -r1.118 -r1.119
--- man_macro.c
+++ man_macro.c
@@ -76,7 +76,6 @@ const	struct man_macro __man_macros[MAN_
 	{ in_line_eoln, MAN_BSCOPE }, /* EE */
 	{ blk_exp, MAN_BSCOPE }, /* UR */
 	{ blk_close, MAN_BSCOPE }, /* UE */
-	{ in_line_eoln, 0 }, /* ll */
 };
 const	struct man_macro *const man_macros = __man_macros - MAN_TH;
 
Index: man_term.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/man_term.c,v
retrieving revision 1.195
retrieving revision 1.196
diff -Lman_term.c -Lman_term.c -u -p -r1.195 -r1.196
--- man_term.c
+++ man_term.c
@@ -83,7 +83,6 @@ static	int		  pre_alternate(DECL_ARGS);
 static	int		  pre_ign(DECL_ARGS);
 static	int		  pre_in(DECL_ARGS);
 static	int		  pre_literal(DECL_ARGS);
-static	int		  pre_ll(DECL_ARGS);
 static	int		  pre_sp(DECL_ARGS);
 
 static	void		  post_IP(DECL_ARGS);
@@ -130,7 +129,6 @@ static	const struct termact __termacts[M
 	{ pre_literal, NULL, 0 }, /* EE */
 	{ pre_UR, post_UR, 0 }, /* UR */
 	{ NULL, NULL, 0 }, /* UE */
-	{ pre_ll, NULL, MAN_NOTEXT }, /* ll */
 };
 static	const struct termact *termacts = __termacts - MAN_TH;
 
@@ -213,14 +211,6 @@ static int
 pre_ign(DECL_ARGS)
 {
 
-	return 0;
-}
-
-static int
-pre_ll(DECL_ARGS)
-{
-
-	term_setwidth(p, n->child != NULL ? n->child->string : NULL);
 	return 0;
 }
 
Index: roff.h
===================================================================
RCS file: /home/cvs/mdocml/mdocml/roff.h,v
retrieving revision 1.44
retrieving revision 1.45
diff -Lroff.h -Lroff.h -u -p -r1.44 -r1.45
--- roff.h
+++ roff.h
@@ -68,6 +68,7 @@ enum	roff_type {
 enum	roff_tok {
 	ROFF_br = 0,
 	ROFF_ft,
+	ROFF_ll,
 	ROFF_MAX,
 	ROFF_ab,
 	ROFF_ad,
@@ -196,7 +197,6 @@ enum	roff_tok {
 	ROFF_lg,
 	ROFF_lhang,
 	ROFF_linetabs,
-	/* MAN_ll, MDOC_ll */
 	ROFF_lnr,
 	ROFF_lnrf,
 	ROFF_lpfx,
@@ -432,7 +432,6 @@ enum	roff_tok {
 	MDOC_sp,
 	MDOC__U,
 	MDOC_Ta,
-	MDOC_ll,
 	MDOC_MAX,
 	MAN_TH,
 	MAN_SH,
@@ -469,7 +468,6 @@ enum	roff_tok {
 	MAN_EE,
 	MAN_UR,
 	MAN_UE,
-	MAN_ll,
 	MAN_MAX
 };
 
Index: roff.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/roff.c,v
retrieving revision 1.297
retrieving revision 1.298
diff -Lroff.c -Lroff.c -u -p -r1.297 -r1.298
--- roff.c
+++ roff.c
@@ -211,7 +211,7 @@ static	enum rofferr	 roff_userdef(ROFF_A
 #define	ROFFNUM_WHITE	(1 << 1)  /* Skip whitespace in roff_evalnum(). */
 
 const char *__roff_name[MAN_MAX + 1] = {
-	"br",		"ft",		NULL,
+	"br",		"ft",		"ll",		NULL,
 	"ab",		"ad",		"af",		"aln",
 	"als",		"am",		"am1",		"ami",
 	"ami1",		"as",		"as1",		"asciify",
@@ -302,7 +302,7 @@ const char *__roff_name[MAN_MAX + 1] = {
 	"Lk",		"Mt",		"Brq",		"Bro",
 	"Brc",		"%C",		"Es",		"En",
 	"Dx",		"%Q",		"sp",
-	"%U",		"Ta",		"ll",		NULL,
+	"%U",		"Ta",		NULL,
 	"TH",		"SH",		"SS",		"TP",
 	"LP",		"PP",		"P",		"IP",
 	"HP",		"SM",		"SB",		"BI",
@@ -312,13 +312,14 @@ const char *__roff_name[MAN_MAX + 1] = {
 	"RE",		"RS",		"DT",		"UC",
 	"PD",		"AT",		"in",
 	"OP",		"EX",		"EE",		"UR",
-	"UE",		"ll",		NULL
+	"UE",		NULL
 };
 const	char *const *roff_name = __roff_name;
 
 static	struct roffmac	 roffs[TOKEN_NONE] = {
 	{ roff_br, NULL, NULL, 0 },  /* br */
 	{ roff_onearg, NULL, NULL, 0 },  /* ft */
+	{ roff_onearg, NULL, NULL, 0 },  /* ll */
 	{ NULL, NULL, NULL, 0 },  /* ROFF_MAX */
 	{ roff_unsupp, NULL, NULL, 0 },  /* ab */
 	{ roff_line_ignore, NULL, NULL, 0 },  /* ad */
Index: man_validate.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/man_validate.c,v
retrieving revision 1.125
retrieving revision 1.126
diff -Lman_validate.c -Lman_validate.c -u -p -r1.125 -r1.126
--- man_validate.c
+++ man_validate.c
@@ -89,7 +89,6 @@ static	const v_check __man_valids[MAN_MA
 	NULL,       /* EE */
 	post_UR,    /* UR */
 	NULL,       /* UE */
-	NULL,       /* ll */
 };
 static	const v_check *man_valids = __man_valids - MAN_TH;
 
Index: mdoc_term.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_term.c,v
retrieving revision 1.353
retrieving revision 1.354
diff -Lmdoc_term.c -Lmdoc_term.c -u -p -r1.353 -r1.354
--- mdoc_term.c
+++ mdoc_term.c
@@ -106,7 +106,6 @@ static	int	  termp_ft_pre(DECL_ARGS);
 static	int	  termp_in_pre(DECL_ARGS);
 static	int	  termp_it_pre(DECL_ARGS);
 static	int	  termp_li_pre(DECL_ARGS);
-static	int	  termp_ll_pre(DECL_ARGS);
 static	int	  termp_lk_pre(DECL_ARGS);
 static	int	  termp_nd_pre(DECL_ARGS);
 static	int	  termp_nm_pre(DECL_ARGS);
@@ -247,7 +246,6 @@ static	const struct termact __termacts[M
 	{ termp_sp_pre, NULL }, /* sp */
 	{ NULL, termp____post }, /* %U */
 	{ NULL, NULL }, /* Ta */
-	{ termp_ll_pre, NULL }, /* ll */
 };
 static	const struct termact *const termacts = __termacts - MDOC_Dd;
 
@@ -366,8 +364,7 @@ print_mdoc_node(DECL_ARGS)
 	default:
 		if (n->tok < ROFF_MAX) {
 			roff_term_pre(p, n);
-			chld = 0;
-			break;
+			return;
 		}
 		assert(n->tok >= MDOC_Dd && n->tok < MDOC_MAX);
 		if (termacts[n->tok].pre != NULL &&
@@ -391,9 +388,7 @@ print_mdoc_node(DECL_ARGS)
 	case ROFFT_EQN:
 		break;
 	default:
-		if (n->tok < ROFF_MAX ||
-		    termacts[n->tok].post == NULL ||
-		    n->flags & NODE_ENDED)
+		if (termacts[n->tok].post == NULL || n->flags & NODE_ENDED)
 			break;
 		(void)(*termacts[n->tok].post)(p, &npair, meta, n);
 
@@ -410,10 +405,8 @@ print_mdoc_node(DECL_ARGS)
 	if (NODE_EOS & n->flags)
 		p->flags |= TERMP_SENTENCE;
 
-	if (MDOC_ll != n->tok) {
-		p->offset = offset;
-		p->rmargin = rmargin;
-	}
+	p->offset = offset;
+	p->rmargin = rmargin;
 }
 
 static void
@@ -603,14 +596,6 @@ print_bvspace(struct termp *p,
 	term_vspace(p);
 }
 
-
-static int
-termp_ll_pre(DECL_ARGS)
-{
-
-	term_setwidth(p, n->child != NULL ? n->child->string : NULL);
-	return 0;
-}
 
 static int
 termp_it_pre(DECL_ARGS)
Index: mdoc_man.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_man.c,v
retrieving revision 1.111
retrieving revision 1.112
diff -Lmdoc_man.c -Lmdoc_man.c -u -p -r1.111 -r1.112
--- mdoc_man.c
+++ mdoc_man.c
@@ -33,10 +33,13 @@
 
 #define	DECL_ARGS const struct roff_meta *meta, struct roff_node *n
 
+typedef	int	(*int_fp)(DECL_ARGS);
+typedef	void	(*void_fp)(DECL_ARGS);
+
 struct	manact {
-	int		(*cond)(DECL_ARGS); /* DON'T run actions */
-	int		(*pre)(DECL_ARGS); /* pre-node action */
-	void		(*post)(DECL_ARGS); /* post-node action */
+	int_fp		  cond; /* DON'T run actions */
+	int_fp		  pre; /* pre-node action */
+	void_fp		  post; /* post-node action */
 	const char	 *prefix; /* pre-node string constant */
 	const char	 *suffix; /* post-node string constant */
 };
@@ -80,7 +83,7 @@ static	int	  pre_bd(DECL_ARGS);
 static	int	  pre_bf(DECL_ARGS);
 static	int	  pre_bk(DECL_ARGS);
 static	int	  pre_bl(DECL_ARGS);
-static	int	  pre_br(DECL_ARGS);
+static	void	  pre_br(DECL_ARGS);
 static	int	  pre_dl(DECL_ARGS);
 static	int	  pre_en(DECL_ARGS);
 static	int	  pre_enc(DECL_ARGS);
@@ -93,13 +96,13 @@ static	int	  pre_fd(DECL_ARGS);
 static	int	  pre_fl(DECL_ARGS);
 static	int	  pre_fn(DECL_ARGS);
 static	int	  pre_fo(DECL_ARGS);
-static	int	  pre_ft(DECL_ARGS);
+static	void	  pre_ft(DECL_ARGS);
 static	int	  pre_Ft(DECL_ARGS);
 static	int	  pre_in(DECL_ARGS);
 static	int	  pre_it(DECL_ARGS);
 static	int	  pre_lk(DECL_ARGS);
 static	int	  pre_li(DECL_ARGS);
-static	int	  pre_ll(DECL_ARGS);
+static	void	  pre_ll(DECL_ARGS);
 static	int	  pre_nm(DECL_ARGS);
 static	int	  pre_no(DECL_ARGS);
 static	int	  pre_ns(DECL_ARGS);
@@ -121,6 +124,12 @@ static	void	  print_width(const struct m
 static	void	  print_count(int *);
 static	void	  print_node(DECL_ARGS);
 
+static	const void_fp roff_manacts[ROFF_MAX] = {
+	pre_br,
+	pre_ft,
+	pre_ll,
+};
+
 static	const struct manact __manacts[MDOC_MAX - MDOC_Dd] = {
 	{ NULL, NULL, NULL, NULL, NULL }, /* Dd */
 	{ NULL, NULL, NULL, NULL, NULL }, /* Dt */
@@ -243,7 +252,6 @@ static	const struct manact __manacts[MDO
 	{ NULL, pre_sp, post_sp, NULL, NULL }, /* sp */
 	{ NULL, NULL, post_percent, NULL, NULL }, /* %U */
 	{ NULL, NULL, NULL, NULL, NULL }, /* Ta */
-	{ NULL, pre_ll, post_sp, NULL, NULL }, /* ll */
 };
 static	const struct manact *const manacts = __manacts - MDOC_Dd;
 
@@ -653,16 +661,8 @@ print_node(DECL_ARGS)
 		else if (outflags & MMAN_Sm)
 			outflags |= MMAN_spc;
 	} else if (n->tok < ROFF_MAX) {
-		switch (n->tok) {
-		case ROFF_br:
-			do_sub = pre_br(meta, n);
-			break;
-		case ROFF_ft:
-			do_sub = pre_ft(meta, n);
-			break;
-		default:
-			abort();
-		}
+		(*roff_manacts[n->tok])(meta, n);
+		return;
 	} else {
 		assert(n->tok >= MDOC_Dd && n->tok < MDOC_MAX);
 		/*
@@ -1068,12 +1068,10 @@ post_bl(DECL_ARGS)
 
 }
 
-static int
+static void
 pre_br(DECL_ARGS)
 {
-
 	outflags |= MMAN_br;
-	return 0;
 }
 
 static int
@@ -1326,13 +1324,12 @@ pre_Ft(DECL_ARGS)
 	return 1;
 }
 
-static int
+static void
 pre_ft(DECL_ARGS)
 {
 	print_line(".ft", 0);
 	print_word(n->child->string);
 	outflags |= MMAN_nl;
-	return 0;
 }
 
 static int
@@ -1567,12 +1564,13 @@ pre_lk(DECL_ARGS)
 	return 0;
 }
 
-static int
+static void
 pre_ll(DECL_ARGS)
 {
-
 	print_line(".ll", 0);
-	return 1;
+	if (n->child != NULL)
+		print_word(n->child->string);
+	outflags |= MMAN_nl;
 }
 
 static int
Index: mdoc_macro.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_macro.c,v
retrieving revision 1.221
retrieving revision 1.222
diff -Lmdoc_macro.c -Lmdoc_macro.c -u -p -r1.221 -r1.222
--- mdoc_macro.c
+++ mdoc_macro.c
@@ -200,7 +200,6 @@ const	struct mdoc_macro __mdoc_macros[MD
 	{ in_line_eoln, 0 }, /* sp */
 	{ in_line_eoln, 0 }, /* %U */
 	{ phrase_ta, MDOC_CALLABLE | MDOC_PARSED | MDOC_JOIN }, /* Ta */
-	{ in_line_eoln, MDOC_PROLOGUE }, /* ll */
 };
 const	struct mdoc_macro *const mdoc_macros = __mdoc_macros - MDOC_Dd;
 
@@ -250,7 +249,7 @@ lookup(struct roff_man *mdoc, int from, 
 		if (res != TOKEN_NONE) {
 			if (mdoc_macros[res].flags & MDOC_CALLABLE)
 				return res;
-			if (res != MDOC_sp && res != MDOC_ll)
+			if (res != MDOC_sp)
 				mandoc_msg(MANDOCERR_MACRO_CALL,
 				    mdoc->parse, line, ppos, p);
 		}
--
 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:[~2017-05-05 13:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-05 13:18 mdocml: move .ll to the roff modules 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).