source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Drop useless architecture table.
@ 2014-11-28 18:09 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2014-11-28 18:09 UTC (permalink / raw)
  To: source

Log Message:
-----------
Drop useless architecture table.  Validating architecture names
is a job for makewhatis(8)/mandoc.db(5), not for the parser.
Removes 150 lines from source files and 4k (1%) from the binary.
Bloat found by deraadt@.

Modified Files:
--------------
    mdocml:
        Makefile
        mandoc.1
        mandoc.h
        mdoc.7
        mdoc_validate.c
        read.c

Removed Files:
-------------
    mdocml:
        arch.c
        arch.in

Revision Data
-------------
Index: mdoc_validate.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_validate.c,v
retrieving revision 1.260
retrieving revision 1.261
diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.260 -r1.261
--- mdoc_validate.c
+++ mdoc_validate.c
@@ -2283,11 +2283,9 @@ post_dt(POST_ARGS)
 	if (NULL == (nn = nn->next))
 		goto out;
 
-	/* Handles: `.Dt TITLE SEC VOL'
-	 * title = TITLE,
-	 * volume = VOL is vol ? format(VOL) :
-	 *	    VOL is arch ? format(arch) :
-	 *	    VOL
+	/*
+	 * If the third argument is a volume name, format is,
+	 * otherwise assume it's an architecture.
 	 */
 
 	cp = mdoc_a2vol(nn->string);
@@ -2295,14 +2293,9 @@ post_dt(POST_ARGS)
 		free(mdoc->meta.vol);
 		mdoc->meta.vol = mandoc_strdup(cp);
 	} else {
-		cp = mdoc_a2arch(nn->string);
-		if (NULL == cp) {
-			mandoc_vmsg(MANDOCERR_ARCH_BAD, mdoc->parse,
-			    nn->line, nn->pos, "Dt ... %s", nn->string);
-			free(mdoc->meta.vol);
-			mdoc->meta.vol = mandoc_strdup(nn->string);
-		} else
-			mdoc->meta.arch = mandoc_strdup(cp);
+		for (p = nn->string; *p; p++)
+			*p = tolower((unsigned char)*p);
+		mdoc->meta.arch = mandoc_strdup(nn->string);
 	}
 
 	/* Ignore any subsequent parameters... */
Index: Makefile
===================================================================
RCS file: /home/cvs/mdocml/mdocml/Makefile,v
retrieving revision 1.445
retrieving revision 1.446
diff -LMakefile -LMakefile -u -p -r1.445 -r1.446
--- Makefile
+++ Makefile
@@ -35,8 +35,7 @@ TESTSRCS	 = test-dirent-namlen.c \
 		   test-strsep.c \
 		   test-wchar.c
 
-SRCS		 = arch.c \
-		   att.c \
+SRCS		 = att.c \
 		   cgi.c \
 		   chars.c \
 		   compat_fgetln.c \
@@ -103,7 +102,6 @@ DISTFILES	 = INSTALL \
 		   NEWS \
 		   TODO \
 		   apropos.1 \
-		   arch.in \
 		   att.in \
 		   cgi.h.example \
 		   chars.in \
@@ -160,8 +158,7 @@ LIBMAN_OBJS	 = man.o \
 		   man_macro.o \
 		   man_validate.o
 
-LIBMDOC_OBJS	 = arch.o \
-		   att.o \
+LIBMDOC_OBJS	 = att.o \
 		   lib.o \
 		   mdoc.o \
 		   mdoc_argv.o \
Index: mandoc.h
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mandoc.h,v
retrieving revision 1.170
retrieving revision 1.171
diff -Lmandoc.h -Lmandoc.h -u -p -r1.170 -r1.171
--- mandoc.h
+++ mandoc.h
@@ -54,7 +54,6 @@ enum	mandocerr {
 	MANDOCERR_TITLE_CASE, /* lower case character in document title */
 	MANDOCERR_MSEC_MISSING, /* missing manual section, using "": macro */
 	MANDOCERR_MSEC_BAD, /* unknown manual section: Dt ... section */
-	MANDOCERR_ARCH_BAD, /* unknown manual volume or arch: Dt ... volume */
 	MANDOCERR_DATE_MISSING, /* missing date, using today's date */
 	MANDOCERR_DATE_BAD, /* cannot parse date, using it verbatim: date */
 	MANDOCERR_OS_MISSING, /* missing Os macro, using "" */
Index: read.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/read.c,v
retrieving revision 1.100
retrieving revision 1.101
diff -Lread.c -Lread.c -u -p -r1.100 -r1.101
--- read.c
+++ read.c
@@ -97,7 +97,6 @@ static	const char * const	mandocerrs[MAN
 	"lower case character in document title",
 	"missing manual section, using \"\"",
 	"unknown manual section",
-	"unknown manual volume or arch",
 	"missing date, using today's date",
 	"cannot parse date, using it verbatim",
 	"missing Os macro, using \"\"",
Index: mdoc.7
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc.7,v
retrieving revision 1.242
retrieving revision 1.243
diff -Lmdoc.7 -Lmdoc.7 -u -p -r1.242 -r1.243
--- mdoc.7
+++ mdoc.7
@@ -1385,12 +1385,7 @@ where relevant, for example
 .Cm i386 ,
 or
 .Cm sparc64 .
-The list of supported architectures varies by operating system.
-For the full list of all architectures recognized by
-.Xr mandoc 1 ,
-see the file
-.Pa arch.in
-in the source distribution.
+The list of valid architectures varies by operating system.
 .El
 .Pp
 Examples:
--- arch.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/*	$Id: arch.c,v 1.12 2014/08/10 23:54:41 schwarze Exp $ */
-/*
- * Copyright (c) 2009 Kristaps Dzonsons <kristaps@bsd.lv>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-#include "config.h"
-
-#include <sys/types.h>
-
-#include <string.h>
-
-#include "mdoc.h"
-#include "libmdoc.h"
-
-#define LINE(x, y) \
-	if (0 == strcmp(p, x)) return(y);
-
-
-const char *
-mdoc_a2arch(const char *p)
-{
-
-#include "arch.in"
-
-	return(NULL);
-}
Index: mandoc.1
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mandoc.1,v
retrieving revision 1.124
retrieving revision 1.125
diff -Lmandoc.1 -Lmandoc.1 -u -p -r1.124 -r1.125
--- mandoc.1
+++ mandoc.1
@@ -665,12 +665,6 @@ macro lacks the mandatory section argume
 The section number in a
 .Ic \&Dt
 line is invalid, but still used.
-.It Sy "unknown manual volume or arch"
-.Pq mdoc
-The volume name in a
-.Ic \&Dt
-line is invalid, but still used.
-The manual is assumed to be architecture-independent.
 .It Sy "missing date, using today's date"
 .Pq mdoc, man
 The document was parsed as
--- arch.in
+++ /dev/null
@@ -1,112 +0,0 @@
-/*	$Id: arch.in,v 1.15 2014/04/27 22:42:15 schwarze Exp $ */
-/*
- * Copyright (c) 2009 Kristaps Dzonsons <kristaps@bsd.lv>
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-/*
- * This file defines the architecture token of the .Dt prologue macro.
- * All architectures that your system supports (or the manuals of your
- * system) should be included here.  The right-hand-side is the
- * formatted output.
- *
- * Be sure to escape strings.
- *
- * REMEMBER TO ADD NEW ARCHITECTURES TO MDOC.7!
- */
-
-LINE("acorn26",		"Acorn26")
-LINE("acorn32",		"Acorn32")
-LINE("algor",		"Algor")
-LINE("alpha",		"Alpha")
-LINE("amd64",		"AMD64")
-LINE("amiga",		"Amiga")
-LINE("amigappc",	"AmigaPPC")
-LINE("arc",		"ARC")
-LINE("arm",		"ARM")
-LINE("arm26",		"ARM26")
-LINE("arm32",		"ARM32")
-LINE("armish",		"ARMISH")
-LINE("armv7",		"ARMv7")
-LINE("aviion",		"AViiON")
-LINE("atari",		"ATARI")
-LINE("bebox",		"BeBox")
-LINE("cats",		"cats")
-LINE("cesfic",		"CESFIC")
-LINE("cobalt",		"Cobalt")
-LINE("dreamcast",	"Dreamcast")
-LINE("emips",		"EMIPS")
-LINE("evbarm",		"evbARM")
-LINE("evbmips",		"evbMIPS")
-LINE("evbppc",		"evbPPC")
-LINE("evbsh3",		"evbSH3")
-LINE("ews4800mips",	"EWS4800MIPS")
-LINE("hp300",		"HP300")
-LINE("hp700",		"HP700")
-LINE("hpcarm",		"HPCARM")
-LINE("hpcmips",		"HPCMIPS")
-LINE("hpcsh",		"HPCSH")
-LINE("hppa",		"HPPA")
-LINE("hppa64",		"HPPA64")
-LINE("ia64",		"ia64")
-LINE("i386",		"i386")
-LINE("ibmnws",		"IBMNWS")
-LINE("iyonix",		"Iyonix")
-LINE("landisk",		"LANDISK")
-LINE("loongson",	"Loongson")
-LINE("luna68k",		"LUNA68K")
-LINE("luna88k",		"LUNA88K")
-LINE("m68k",		"m68k")
-LINE("mac68k",		"Mac68k")
-LINE("macppc",		"MacPPC")
-LINE("mips",		"MIPS")
-LINE("mips64",		"MIPS64")
-LINE("mipsco",		"MIPSCo")
-LINE("mmeye",		"mmEye")
-LINE("mvme68k",		"MVME68k")
-LINE("mvme88k",		"MVME88k")
-LINE("mvmeppc",		"MVMEPPC")
-LINE("netwinder",	"NetWinder")
-LINE("news68k",		"NeWS68k")
-LINE("newsmips",	"NeWSMIPS")
-LINE("next68k",		"NeXT68k")
-LINE("octeon",		"OCTEON")
-LINE("ofppc",		"OFPPC")
-LINE("palm",		"Palm")
-LINE("pc532",		"PC532")
-LINE("playstation2",	"PlayStation2")
-LINE("pmax",		"PMAX")
-LINE("pmppc",		"pmPPC")
-LINE("powerpc",		"PowerPC")
-LINE("prep",		"PReP")
-LINE("rs6000",		"RS6000")
-LINE("sandpoint",	"Sandpoint")
-LINE("sbmips",		"SBMIPS")
-LINE("sgi",		"SGI")
-LINE("sgimips",		"SGIMIPS")
-LINE("sh3",		"SH3")
-LINE("shark",		"Shark")
-LINE("socppc",		"SOCPPC")
-LINE("solbourne",	"Solbourne")
-LINE("sparc",		"SPARC")
-LINE("sparc64",		"SPARC64")
-LINE("sun2",		"Sun2")
-LINE("sun3",		"Sun3")
-LINE("tahoe",		"Tahoe")
-LINE("vax",		"VAX")
-LINE("x68k",		"X68k")
-LINE("x86",		"x86")
-LINE("x86_64",		"x86_64")
-LINE("xen",		"Xen")
-LINE("zaurus",		"Zaurus")
--
 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-11-28 18:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-28 18:09 mdocml: Drop useless architecture table 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).