source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* docbook2mdoc: Delete the rest of rules.c.
@ 2019-03-22 15:55 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2019-03-22 15:55 UTC (permalink / raw)
  To: source

Log Message:
-----------
Delete the rest of rules.c.

Just like validation of element nesting is pointless,
validating attributes makes no sense either.

Modified Files:
--------------
    docbook2mdoc:
        Makefile
        docbook2mdoc.c
        extern.h

Removed Files:
-------------
    docbook2mdoc:
        rules.c

Revision Data
-------------
Index: Makefile
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/Makefile,v
retrieving revision 1.16
retrieving revision 1.17
diff -LMakefile -LMakefile -u -p -r1.16 -r1.17
--- Makefile
+++ Makefile
@@ -5,8 +5,8 @@ PREFIX = /usr/local
 
 all: docbook2mdoc
 
-docbook2mdoc: docbook2mdoc.o rules.o
-	$(CC) -o $@ docbook2mdoc.o rules.o -lexpat
+docbook2mdoc: docbook2mdoc.o
+	$(CC) -o $@ docbook2mdoc.o -lexpat
 
 www: index.html docbook2mdoc.1.html docbook2mdoc-$(VERSION).tgz README.txt
 
@@ -26,11 +26,11 @@ dist: docbook2mdoc-$(VERSION).tgz
 
 docbook2mdoc-$(VERSION).tgz:
 	mkdir -p .dist/docbook2mdoc-$(VERSION)
-	install -m 0444 docbook2mdoc.c rules.c extern.h Makefile docbook2mdoc.1 .dist/docbook2mdoc-$(VERSION)
+	install -m 0444 docbook2mdoc.c extern.h Makefile docbook2mdoc.1 .dist/docbook2mdoc-$(VERSION)
 	(cd .dist && tar zcf ../$@ docbook2mdoc-$(VERSION))
 	rm -rf .dist
 
-docbook2mdoc.o rules.o: extern.h
+docbook2mdoc.o: extern.h
 
 index.html: index.xml
 	sed "s!@VERSION@!$(VERSION)!g" index.xml >$@
@@ -42,6 +42,6 @@ README.txt: README
 	cp README $@
 
 clean:
-	rm -f docbook2mdoc docbook2mdoc.o rules.o
+	rm -f docbook2mdoc docbook2mdoc.o
 	rm -rf docbook2mdoc.dSYM
 	rm -f index.html docbook2mdoc.1.html docbook2mdoc-$(VERSION).tgz README.txt
--- rules.c
+++ /dev/null
@@ -1,58 +0,0 @@
-#include <stdlib.h>
-
-#include "extern.h"
-
-int
-isattrkey(enum nodeid node, enum attrkey key)
-{
-
-	switch (key) {
-	case (ATTRKEY_CHOICE):
-		switch (node) {
-		case (NODE_ARG):
-		case (NODE_GROUP):
-			return(1);
-		default:
-			break;
-		}
-		return(0);
-	case (ATTRKEY_OPEN):
-	case (ATTRKEY_CLOSE):
-		return(node == NODE_MML_MFENCED);
-	case (ATTRKEY_ID):
-		/* Common to all. */
-		return(1);
-	case (ATTRKEY_REP):
-		switch (node) {
-		case (NODE_ARG):
-		case (NODE_GROUP):
-			return(1);
-		default:
-			break;
-		}
-		return(0);
-	default:
-		break;
-	}
-	abort();
-	return(0);
-}
-
-int
-isattrval(enum attrkey key, enum attrval val)
-{
-
-	switch (val) {
-	case (ATTRVAL_OPT):
-	case (ATTRVAL_PLAIN):
-	case (ATTRVAL_REQ):
-		return(key == ATTRKEY_CHOICE);
-	case (ATTRVAL_REPEAT):
-	case (ATTRVAL_NOREPEAT):
-		return(key == ATTRKEY_REP);
-	default:
-		break;
-	}
-	abort();
-	return(0);
-}
Index: extern.h
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/extern.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -Lextern.h -Lextern.h -u -p -r1.26 -r1.27
--- extern.h
+++ extern.h
@@ -1,6 +1,3 @@
-#ifndef EXTERN_H
-#define EXTERN_H
-
 /*
  * All recognised node types.
  */
@@ -131,12 +128,3 @@ enum	attrval {
 	ATTRVAL_REQ,
 	ATTRVAL__MAX
 };
-
-__BEGIN_DECLS
-
-int isattrkey(enum nodeid node, enum attrkey key);
-int isattrval(enum attrkey key, enum attrval val);
-
-__END_DECLS
-
-#endif
Index: docbook2mdoc.c
===================================================================
RCS file: /home/cvs/mdocml/docbook2mdoc/docbook2mdoc.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -Ldocbook2mdoc.c -Ldocbook2mdoc.c -u -p -r1.48 -r1.49
--- docbook2mdoc.c
+++ docbook2mdoc.c
@@ -366,29 +366,10 @@ xml_elem_start(void *arg, const XML_Char
 					XML_GetCurrentColumnNumber(ps->xml),
 					*att);
 			continue;
-		} else if ( ! isattrkey(node, key)) {
-			if (warn)
-				fprintf(stderr, "%s:%zu:%zu: warning: "
-					"bad attribute \"%s\"\n",
-					ps->fname,
-					XML_GetCurrentLineNumber(ps->xml),
-					XML_GetCurrentColumnNumber(ps->xml),
-					*att);
-			continue;
 		}
 		for (val = 0; val < ATTRVAL__MAX; val++)
 			if (0 == strcmp(*(att + 1), attrvals[val]))
 				break;
-		if (ATTRVAL__MAX != val && ! isattrval(key, val)) {
-			if (warn)
-				fprintf(stderr, "%s:%zu:%zu: warning: "
-					"bad attribute value \"%s\"\n",
-					ps->fname,
-					XML_GetCurrentLineNumber(ps->xml),
-					XML_GetCurrentColumnNumber(ps->xml),
-					*(att + 1));
-			continue;
-		}
 		pattr = calloc(1, sizeof(struct pattr));
 		pattr->key = key;
 		pattr->val = val;
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv

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

only message in thread, other threads:[~2019-03-22 15:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-22 15:55 docbook2mdoc: Delete the rest of rules.c 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).