diff options
93 files changed, 3448 insertions, 1234 deletions
@@ -1,2 +1,2 @@ -GNU mailutils NEWS -- history of user-visible changes. 2017-06-01 +GNU mailutils NEWS -- history of user-visible changes. 2017-06-16 Copyright (C) 2002-2017 Free Software Foundation, Inc. @@ -77,2 +77,9 @@ section is not defined. +* Source location API + +Libmailutils provides functions for keeping track of locations in +source files for diagnostic purposes. + +* Improve error reporting + * AM_GNU_MAILUTILS autoconf macro diff --git a/am/bison.m4 b/am/bison.m4 new file mode 100644 index 000000000..875b326d0 --- /dev/null +++ b/am/bison.m4 @@ -0,0 +1,11 @@ +# bison.m4 serial 1 +AC_DEFUN([MU_PROG_BISON], +[ + if test "x$ac_cv_prog_YACC" = x; then + AC_PROG_YACC + if ! $YACC --version 2>/dev/null | grep -q '^bison '; then + YACC="$SHELL $missing_dir/missing bison" + fi + fi +]) + diff --git a/am/flex.m4 b/am/flex.m4 new file mode 100644 index 000000000..58d2c4b0a --- /dev/null +++ b/am/flex.m4 @@ -0,0 +1,12 @@ +# flex.m4 serial 1 +AC_DEFUN([MU_PROG_FLEX], +[ + if test "x$LEX" = x; then + AC_PROG_LEX + if ! $LEX --version 2>/dev/null | grep -q '^flex '; then + LEX="$SHELL $missing_dir/missing flex" + AC_SUBST([LEX_OUTPUT_ROOT], [lex.yy]) + AC_SUBST([LEXLIB], ['']) + fi +]) + diff --git a/comsat/action.c b/comsat/action.c index 6ff766a82..24080a511 100644 --- a/comsat/action.c +++ b/comsat/action.c @@ -300,3 +300,3 @@ struct biffrc_environ mu_stream_t input; - struct mu_locus locus; + struct mu_locus_range locus; int use_default; @@ -525,5 +525,5 @@ eval_biffrc (struct biffrc_environ *env) mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, - MU_IOCTL_LOGSTREAM_SET_LOCUS, &env->locus); + MU_IOCTL_LOGSTREAM_SET_LOCUS_RANGE, &env->locus); mu_stream_ioctl (env->logstr, MU_IOCTL_LOGSTREAM, - MU_IOCTL_LOGSTREAM_SET_LOCUS, &env->locus); + MU_IOCTL_LOGSTREAM_SET_LOCUS_RANGE, &env->locus); while (mu_stream_getline (env->input, &stmt, &size, &n) == 0 && n > 0) @@ -534,3 +534,3 @@ eval_biffrc (struct biffrc_environ *env) - env->locus.mu_line = strtoul (stmt + 6, &p, 10); + env->locus.beg.mu_line = strtoul (stmt + 6, &p, 10); if (*p != '\n') @@ -543,6 +543,6 @@ eval_biffrc (struct biffrc_environ *env) MU_IOCTL_LOGSTREAM_SET_LOCUS_LINE, - &env->locus.mu_line); + &env->locus.beg.mu_line); mu_stream_ioctl (env->logstr, MU_IOCTL_LOGSTREAM, MU_IOCTL_LOGSTREAM_SET_LOCUS_LINE, - &env->locus.mu_line); + &env->locus.beg.mu_line); } @@ -602,5 +602,5 @@ eval_biffrc (struct biffrc_environ *env) mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, - MU_IOCTL_LOGSTREAM_SET_LOCUS, NULL); + MU_IOCTL_LOGSTREAM_SET_LOCUS_RANGE, NULL); mu_stream_ioctl (env->logstr, MU_IOCTL_LOGSTREAM, - MU_IOCTL_LOGSTREAM_SET_LOCUS, NULL); + MU_IOCTL_LOGSTREAM_SET_LOCUS_RANGE, NULL); } @@ -647,9 +647,10 @@ run_user_action (const char *device, mu_message_t msg) mu_diag_funcall (MU_DIAG_ERROR, "mu_make_file_name", NULL, ENOMEM); - env.locus.mu_file = BIFF_RC; + env.locus.beg.mu_file = BIFF_RC; } else - env.locus.mu_file = rcname; + env.locus.beg.mu_file = rcname; - env.locus.mu_line = 1; - env.locus.mu_col = 0; + env.locus.beg.mu_line = 1; + env.locus.beg.mu_col = 0; + memset (&env.locus.end, 0, sizeof env.locus.end); env.use_default = 0; @@ -681,5 +682,5 @@ run_user_action (const char *device, mu_message_t msg) { - env.locus.mu_file = "<default>"; - env.locus.mu_line = 1; - env.locus.mu_col = 0; + env.locus.beg.mu_file = "<default>"; + env.locus.beg.mu_line = 1; + env.locus.beg.mu_col = 0; eval_biffrc (&env); diff --git a/configure.ac b/configure.ac index 3f8418873..86bc16faf 100644 --- a/configure.ac +++ b/configure.ac @@ -73,2 +73,5 @@ AC_SUBST(MU_APP_COMMON_INCLUDES,'-I${srcdir} -I${top_srcdir}/include -I${top_src +# Use our replacement for the ylwrap tool +AC_SUBST([MU_YLWRAP],'$(mu_aux_dir)/gylwrap --') + dnl Check for programs @@ -82,4 +85,4 @@ AC_LIBTOOL_DLOPEN AC_PROG_LIBTOOL -AC_PROG_YACC -AM_PROG_LEX +MU_PROG_BISON +MU_PROG_LEX AM_PROG_LIBTOOL @@ -1497,2 +1500,3 @@ AC_CONFIG_FILES([ libmailutils/list/Makefile + libmailutils/locus/Makefile libmailutils/mailbox/Makefile diff --git a/include/mailutils/Makefile.am b/include/mailutils/Makefile.am index 6b83274e3..95de7e79b 100644 --- a/include/mailutils/Makefile.am +++ b/include/mailutils/Makefile.am @@ -75,2 +75,3 @@ pkginclude_HEADERS = \ list.h\ + locus.h\ locker.h\ @@ -118,3 +119,4 @@ pkginclude_HEADERS = \ version.h\ - wordsplit.h + wordsplit.h\ + yyloc.h diff --git a/include/mailutils/assoc.h b/include/mailutils/assoc.h index a8f9845e1..930ff2de5 100644 --- a/include/mailutils/assoc.h +++ b/include/mailutils/assoc.h @@ -39,2 +39,4 @@ int mu_assoc_lookup_ref (mu_assoc_t assoc, const char *name, void *dataptr); int mu_assoc_install_ref (mu_assoc_t assoc, const char *name, void *pval); +int mu_assoc_install_ref2 (mu_assoc_t assoc, const char *name, + void *ret_val, const char **ret_name); diff --git a/include/mailutils/auth.h b/include/mailutils/auth.h index 04dbfd37c..998779b69 100644 --- a/include/mailutils/auth.h +++ b/include/mailutils/auth.h @@ -22,2 +22,3 @@ #include <mailutils/types.h> +#include <mailutils/locus.h> @@ -79,3 +80,3 @@ int mu_file_wicket_create (mu_wicket_t *pwicket, const char *filename); struct mu_debug_locus; -int mu_wicket_stream_match_url (mu_stream_t stream, struct mu_locus *loc, +int mu_wicket_stream_match_url (mu_stream_t stream, struct mu_locus_point *loc, mu_url_t url, int parse_flags, diff --git a/include/mailutils/cfg.h b/include/mailutils/cfg.h index 8ccd7f4eb..de84af6e1 100644 --- a/include/mailutils/cfg.h +++ b/include/mailutils/cfg.h @@ -25,2 +25,3 @@ #include <mailutils/util.h> +#include <mailutils/locus.h> #include <sys/socket.h> @@ -66,3 +67,3 @@ struct mu_cfg_node { - struct mu_locus locus; + struct mu_locus_range locus; enum mu_cfg_node_type type; @@ -121,4 +122,2 @@ int mu_cfg_tree_postprocess (mu_cfg_tree_t *tree, -extern struct mu_locus mu_cfg_locus; - mu_opool_t mu_cfg_lexer_pool (void); @@ -287,3 +286,3 @@ mu_cfg_node_t *mu_cfg_tree_create_node (struct mu_cfg_tree *tree, enum mu_cfg_node_type type, - const struct mu_locus *loc, + const struct mu_locus_range *loc, const char *tag, diff --git a/include/mailutils/debug.h b/include/mailutils/debug.h index 647a0582c..8ec2e88c7 100644 --- a/include/mailutils/debug.h +++ b/include/mailutils/debug.h @@ -108,3 +108,3 @@ int mu_debug_get_iterator (mu_iterator_t *piterator, int skipunset); mu_debug_log_begin ("\033X<%d>%s:%d: ", \ - MU_LOGMODE_LOCUS, __FILE__, __LINE__); \ + MU_LOGMODE_LOCUS, __FILE__, __LINE__); \ mu_debug_log_end s; \ diff --git a/include/mailutils/diag.h b/include/mailutils/diag.h index 3b57aae9d..03a0eacc2 100644 --- a/include/mailutils/diag.h +++ b/include/mailutils/diag.h @@ -26,2 +26,3 @@ #include <mailutils/debug.h> +#include <mailutils/locus.h> @@ -53,4 +54,6 @@ void mu_diag_voutput (int, const char *, va_list); void mu_diag_output (int, const char *, ...) MU_PRINTFLIKE(2,3); -void mu_diag_at_locus (int level, struct mu_locus const *loc, - const char *fmt, ...); +void mu_diag_at_locus_point (int level, struct mu_locus_point const *loc, + const char *fmt, ...); +void mu_diag_at_locus_range (int level, struct mu_locus_range const *loc, + const char *fmt, ...); diff --git a/include/mailutils/locus.h b/include/mailutils/locus.h new file mode 100644 index 000000000..f8efa1321 --- /dev/null +++ b/include/mailutils/locus.h @@ -0,0 +1,111 @@ +/* GNU Mailutils -- a suite of utilities for electronic mail + Copyright (C) 2017 Free Software |