source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Added `in' macro support for -man -Tascii.
@ 2010-07-22 23:03 kristaps
  0 siblings, 0 replies; only message in thread
From: kristaps @ 2010-07-22 23:03 UTC (permalink / raw)
  To: source

Log Message:
-----------
Added `in' macro support for -man -Tascii.  This is not yet supported in
-Thtml (I'm surprised to note that neither is LITERAL mode).

Modified Files:
--------------
    mdocml:
        man.7
        man.c
        man.h
        man_action.c
        man_html.c
        man_macro.c
        man_term.c
        man_validate.c
        out.c

Revision Data
-------------
Index: man.7
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man.7,v
retrieving revision 1.78
retrieving revision 1.79
diff -Lman.7 -Lman.7 -u -p -r1.78 -r1.79
--- man.7
+++ man.7
@@ -427,6 +427,7 @@ The syntax is as follows:
 .It Sx \&br  Ta    0         Ta    current   Ta    compat
 .It Sx \&fi  Ta    0         Ta    current   Ta    compat
 .It Sx \&i   Ta    n         Ta    current   Ta    compat
+.It Sx \&in  Ta    1         Ta    current   Ta    compat
 .It Sx \&na  Ta    0         Ta    current   Ta    compat
 .It Sx \&nf  Ta    0         Ta    current   Ta    compat
 .It Sx \&r   Ta    0         Ta    current   Ta    compat
@@ -853,6 +854,16 @@ See also
 .Sx \&b ,
 and
 .Sx \&r .
+.Ss \&in
+Indent relative to the current indentation:
+.Pp
+.D1 Pf \. Sx \&in Op Cm width
+.Pp
+If
+.Cm width
+is signed, the new offset is relative.
+Otherwise, it is absolute.
+This value is reset upon the next paragraph, section, or sub-section.
 .Ss \&na
 Don't align to the right margin.
 .Ss \&nf
Index: man_html.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man_html.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -Lman_html.c -Lman_html.c -u -p -r1.42 -r1.43
--- man_html.c
+++ man_html.c
@@ -108,6 +108,7 @@ static	const struct htmlman mans[MAN_MAX
 	{ man_ign_pre, NULL }, /* Vb */
 	{ NULL, NULL }, /* Ve */
 	{ man_ign_pre, NULL }, /* AT */
+	{ man-in_pre, NULL }, /* in */
 };
 
 
Index: man.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -Lman.c -Lman.c -u -p -r1.83 -r1.84
--- man.c
+++ man.c
@@ -41,6 +41,7 @@ const	char *const __man_macronames[MAN_M
 	"nf",		"fi",		"r",		"RE",
 	"RS",		"DT",		"UC",		"PD",
 	"Sp",		"Vb",		"Ve",		"AT",
+	"in"
 	};
 
 const	char * const *man_macronames = __man_macronames;
Index: out.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/out.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -Lout.c -Lout.c -u -p -r1.22 -r1.23
--- out.c
+++ out.c
@@ -116,6 +116,7 @@ a2roffsu(const char *src, struct roffsu 
 		return(0);
 	}
 
+	/* FIXME: do this in the caller. */
 	if ((dst->scale = atof(buf)) < 0)
 		dst->scale = 0;
 	dst->unit = unit;
Index: man_term.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man_term.c,v
retrieving revision 1.82
retrieving revision 1.83
diff -Lman_term.c -Lman_term.c -u -p -r1.82 -r1.83
--- man_term.c
+++ man_term.c
@@ -94,6 +94,7 @@ static	int		  pre_SS(DECL_ARGS);
 static	int		  pre_TP(DECL_ARGS);
 static	int		  pre_fi(DECL_ARGS);
 static	int		  pre_ign(DECL_ARGS);
+static	int		  pre_in(DECL_ARGS);
 static	int		  pre_nf(DECL_ARGS);
 static	int		  pre_sp(DECL_ARGS);
 
@@ -141,6 +142,7 @@ static	const struct termact termacts[MAN
  	{ pre_nf, NULL, 0 }, /* Vb */
  	{ pre_fi, NULL, 0 }, /* Ve */
 	{ pre_ign, NULL, 0 }, /* AT */
+	{ pre_in, NULL, MAN_NOTEXT }, /* in */
 };
 
 
@@ -349,6 +351,47 @@ pre_B(DECL_ARGS)
 
 	term_fontrepl(p, TERMFONT_BOLD);
 	return(1);
+}
+
+
+/* ARGSUSED */
+static int
+pre_in(DECL_ARGS)
+{
+	int		 len, less;
+	size_t		 v;
+	const char	*cp;
+
+	term_newln(p);
+
+	if (NULL == n->child) {
+		p->offset = mt->offset;
+		return(0);
+	}
+
+	cp = n->child->string;
+	less = 0;
+
+	if ('-' == *cp)
+		less = -1;
+	else if ('+' == *cp)
+		less = 1;
+	else
+		cp--;
+
+	if ((len = a2width(p, ++cp)) < 0)
+		return(0);
+
+	v = (size_t)len;
+
+	if (less < 0)
+		p->offset -= p->offset > v ? v : p->offset;
+	else if (less > 0)
+		p->offset += v;
+	else 
+		p->offset = v;
+
+	return(0);
 }
 
 
Index: man.h
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man.h,v
retrieving revision 1.40
retrieving revision 1.41
diff -Lman.h -Lman.h -u -p -r1.40 -r1.41
--- man.h
+++ man.h
@@ -56,6 +56,7 @@ enum	mant {
 	MAN_Vb,
 	MAN_Ve,
 	MAN_AT,
+	MAN_in,
 	MAN_MAX
 };
 
Index: man_action.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man_action.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -Lman_action.c -Lman_action.c -u -p -r1.39 -r1.40
--- man_action.c
+++ man_action.c
@@ -73,6 +73,7 @@ const	struct actions man_actions[MAN_MAX
 	{ post_nf }, /* Vb */
 	{ post_fi }, /* Ve */
 	{ post_AT }, /* AT */
+	{ NULL }, /* in */
 };
 
 
Index: man_macro.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man_macro.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -Lman_macro.c -Lman_macro.c -u -p -r1.48 -r1.49
--- man_macro.c
+++ man_macro.c
@@ -83,6 +83,7 @@ const	struct man_macro __man_macros[MAN_
 	{ in_line_eoln, 0 }, /* Vb */
 	{ in_line_eoln, 0 }, /* Ve */
 	{ in_line_eoln, 0 }, /* AT */
+	{ in_line_eoln, 0 }, /* in */
 };
 
 const	struct man_macro * const man_macros = __man_macros;
Index: man_validate.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man_validate.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -Lman_validate.c -Lman_validate.c -u -p -r1.46 -r1.47
--- man_validate.c
+++ man_validate.c
@@ -83,9 +83,9 @@ static	const struct man_valid man_valids
 	{ NULL, NULL }, /* I */
 	{ NULL, NULL }, /* IR */
 	{ NULL, NULL }, /* RI */
-	{ NULL, posts_eq0 }, /* na */
+	{ NULL, posts_eq0 }, /* na */ /* FIXME: should warn only. */
 	{ NULL, NULL }, /* i */
-	{ NULL, posts_le1 }, /* sp */
+	{ NULL, posts_le1 }, /* sp */ /* FIXME: should warn only. */
 	{ pres_bline, posts_eq0 }, /* nf */
 	{ pres_bline, posts_eq0 }, /* fi */
 	{ NULL, NULL }, /* r */
@@ -94,10 +94,11 @@ static	const struct man_valid man_valids
 	{ NULL, NULL }, /* DT */
 	{ NULL, NULL }, /* UC */
 	{ NULL, NULL }, /* PD */
-	{ NULL, posts_le1 }, /* Sp */
-	{ pres_bline, posts_le1 }, /* Vb */
+	{ NULL, posts_le1 }, /* Sp */ /* FIXME: should warn only. */
+	{ pres_bline, posts_le1 }, /* Vb */ /* FIXME: should warn only. */
 	{ pres_bline, posts_eq0 }, /* Ve */
 	{ NULL, NULL }, /* AT */
+	{ NULL, NULL }, /* in */
 };
 
 
--
 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:[~2010-07-22 23:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-22 23:03 mdocml: Added `in' macro support for -man -Tascii 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).