* mdocml: First, make -man ARGS_EOLN et al.
@ 2011-03-23 12:40 kristaps
0 siblings, 0 replies; only message in thread
From: kristaps @ 2011-03-23 12:40 UTC (permalink / raw)
To: source
Log Message:
-----------
First, make -man ARGS_EOLN et al. be an enum. Second, remove
ARGS_ERROR, as it is never returned by man_args(). Then clean up
invocations of man_args() to only check for ARGS_EOLN.
Modified Files:
--------------
mdocml:
libman.h
man_argv.c
man_macro.c
Revision Data
-------------
Index: man_argv.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man_argv.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -Lman_argv.c -Lman_argv.c -u -p -r1.7 -r1.8
--- man_argv.c
+++ man_argv.c
@@ -18,8 +18,6 @@
#include "config.h"
#endif
-#include <sys/types.h>
-
#include <assert.h>
#include "man.h"
@@ -27,7 +25,7 @@
#include "libman.h"
#include "libmandoc.h"
-int
+enum margserr
man_args(struct man *m, int line, int *pos, char *buf, char **v)
{
char *start;
Index: libman.h
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/libman.h,v
retrieving revision 1.49
retrieving revision 1.50
diff -Llibman.h -Llibman.h -u -p -r1.49 -r1.50
--- libman.h
+++ libman.h
@@ -56,6 +56,12 @@ struct man_macro {
#define MAN_NOCLOSE (1 << 4) /* See blk_exp(). */
};
+enum margserr {
+ ARGS_EOLN,
+ ARGS_WORD,
+ ARGS_QWORD
+};
+
extern const struct man_macro *const man_macros;
__BEGIN_DECLS
@@ -72,13 +78,9 @@ int man_body_alloc(struct man *, int,
int man_elem_alloc(struct man *, int, int, enum mant);
void man_node_delete(struct man *, struct man_node *);
void man_hash_init(void);
-enum mant man_hash_find(const char *);
+enum mant man_hash_find(const char *);
int man_macroend(struct man *);
-int man_args(struct man *, int, int *, char *, char **);
-#define ARGS_ERROR (-1)
-#define ARGS_EOLN (0)
-#define ARGS_WORD (1)
-#define ARGS_QWORD (1)
+enum margserr man_args(struct man *, int, int *, char *, char **);
int man_valid_post(struct man *);
int man_valid_pre(struct man *, struct man_node *);
int man_unscope(struct man *,
Index: man_macro.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man_macro.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -Lman_macro.c -Lman_macro.c -u -p -r1.58 -r1.59
--- man_macro.c
+++ man_macro.c
@@ -296,7 +296,7 @@ blk_close(MACRO_PROT_ARGS)
int
blk_exp(MACRO_PROT_ARGS)
{
- int w, la;
+ int la;
char *p;
/*
@@ -317,13 +317,8 @@ blk_exp(MACRO_PROT_ARGS)
for (;;) {
la = *pos;
- w = man_args(m, line, pos, buf, &p);
-
- if (-1 == w)
- return(0);
- if (0 == w)
+ if (ARGS_EOLN == man_args(m, line, pos, buf, &p))
break;
-
if ( ! man_word_alloc(m, line, la, p))
return(0);
}
@@ -348,7 +343,7 @@ blk_exp(MACRO_PROT_ARGS)
int
blk_imp(MACRO_PROT_ARGS)
{
- int w, la;
+ int la;
char *p;
struct man_node *n;
@@ -372,13 +367,8 @@ blk_imp(MACRO_PROT_ARGS)
for (;;) {
la = *pos;
- w = man_args(m, line, pos, buf, &p);
-
- if (-1 == w)
- return(0);
- if (0 == w)
+ if (ARGS_EOLN == man_args(m, line, pos, buf, &p))
break;
-
if ( ! man_word_alloc(m, line, la, p))
return(0);
}
@@ -406,7 +396,7 @@ blk_imp(MACRO_PROT_ARGS)
int
in_line_eoln(MACRO_PROT_ARGS)
{
- int w, la;
+ int la;
char *p;
struct man_node *n;
@@ -417,11 +407,7 @@ in_line_eoln(MACRO_PROT_ARGS)
for (;;) {
la = *pos;
- w = man_args(m, line, pos, buf, &p);
-
- if (-1 == w)
- return(0);
- if (0 == w)
+ if (ARGS_EOLN == man_args(m, line, pos, buf, &p))
break;
if ( ! man_word_alloc(m, line, la, p))
return(0);
--
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:[~2011-03-23 12:40 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-23 12:40 mdocml: First, make -man ARGS_EOLN et al 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).