From: schwarze@mandoc.bsd.lv
To: source@mandoc.bsd.lv
Subject: docbook2mdoc: Delete the rest of rules.c.
Date: Fri, 22 Mar 2019 10:55:13 -0500 (EST) [thread overview]
Message-ID: <e3fc906279d4645f@fantadrom.bsd.lv> (raw)
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
reply other threads:[~2019-03-22 15:55 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e3fc906279d4645f@fantadrom.bsd.lv \
--to=schwarze@mandoc.bsd.lv \
--cc=source@mandoc.bsd.lv \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).