diff options
93 files changed, 3448 insertions, 1234 deletions
@@ -1,4 +1,4 @@ -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. See the end of file for copying conditions. @@ -75,6 +75,13 @@ value is anything but "no", the settings from the global "tls" section will be used. In this case, it is an error if the global "tls" 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 Required version must be literal string. 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 @@ -298,7 +298,7 @@ struct biffrc_environ mu_stream_t logstr; mu_message_t msg; mu_stream_t input; - struct mu_locus locus; + struct mu_locus_range locus; int use_default; char *errbuf; size_t errsize; @@ -523,16 +523,16 @@ eval_biffrc (struct biffrc_environ *env) ws.ws_comment = "#"; wsflags = MU_WRDSF_DEFFLAGS | MU_WRDSF_COMMENT; 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) { if (strncmp (stmt, "#line ", 6) == 0) { char *p; - env->locus.mu_line = strtoul (stmt + 6, &p, 10); + env->locus.beg.mu_line = strtoul (stmt + 6, &p, 10); if (*p != '\n') { report_error (env, _("malformed #line directive: %s")); @@ -541,10 +541,10 @@ eval_biffrc (struct biffrc_environ *env) { mu_stream_ioctl (mu_strerr, MU_IOCTL_LOGSTREAM, 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); } continue; } @@ -600,9 +600,9 @@ eval_biffrc (struct biffrc_environ *env) free (stmt); mu_wordsplit_free (&ws); 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); } void @@ -645,13 +645,14 @@ run_user_action (const char *device, mu_message_t msg) if (!rcname) { 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; eval_biffrc (&env); mu_stream_destroy (&env.input); @@ -679,9 +680,9 @@ run_user_action (const char *device, mu_message_t msg) } else { - 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); mu_stream_destroy (&env.input); } diff --git a/configure.ac b/configure.ac index 3f8418873..86bc16faf 100644 --- a/configure.ac +++ b/configure.ac @@ -71,6 +71,9 @@ AC_SUBST(MU_LIB_COMMON_INCLUDES,'-I${top_builddir} -I${top_srcdir}/include -I${ AC_SUBST(MU_APP_COMMON_INCLUDES,'-I${srcdir} -I${top_srcdir}/include -I${top_srcdir}/lib -I${top_srcdir}/lib/gnu -I${top_builddir}/lib/gnu -I${top_builddir} -I${top_builddir}/include') +# Use our replacement for the ylwrap tool +AC_SUBST([MU_YLWRAP],'$(mu_aux_dir)/gylwrap --') + dnl Check for programs AC_PROG_CC AM_PROG_CC_C_O @@ -80,8 +83,8 @@ AC_PROG_INSTALL AC_PROG_LN_S AC_LIBTOOL_DLOPEN AC_PROG_LIBTOOL -AC_PROG_YACC -AM_PROG_LEX +MU_PROG_BISON +MU_PROG_LEX AM_PROG_LIBTOOL ## Predefine several variables used to display configuration status @@ -1495,6 +1498,7 @@ AC_CONFIG_FILES([ libmailutils/filter/Makefile libmailutils/imapio/Makefile libmailutils/list/Makefile + libmailutils/locus/Makefile libmailutils/mailbox/Makefile libmailutils/mailer/Makefile libmailutils/mime/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 @@ -73,6 +73,7 @@ pkginclude_HEADERS = \ kwd.h\ ldap.h\ list.h\ + locus.h\ locker.h\ log.h\ mailbox.h\ @@ -116,7 +117,8 @@ pkginclude_HEADERS = \ types.h\ url.h\ version.h\ - wordsplit.h + wordsplit.h\ + yyloc.h if MU_COND_SUPPORT_CXX CPP_DIR = cpp 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 @@ -37,6 +37,8 @@ int mu_assoc_install (mu_assoc_t assoc, const char *name, void *value); 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); int mu_assoc_get_iterator (mu_assoc_t assoc, mu_iterator_t *piterator); int mu_assoc_remove (mu_assoc_t assoc, const char *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 @@ -20,6 +20,7 @@ #define _MAILUTILS_AUTH_H #include <mailutils/types.h> +#include <mailutils/locus.h> #ifdef __cplusplus extern "C" { @@ -77,7 +78,7 @@ int mu_wicket_set_get_ticket (mu_wicket_t wicket, 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, mu_url_t *pticket_url); int mu_wicket_file_match_url (const char *name, mu_url_t url, 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 @@ -23,6 +23,7 @@ #include <mailutils/debug.h> #include <mailutils/opool.h> #include <mailutils/util.h> +#include <mailutils/locus.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> @@ -64,7 +65,7 @@ enum mu_cfg_node_type struct mu_cfg_node { - struct mu_locus locus; + struct mu_locus_range locus; enum mu_cfg_node_type type; char *tag; mu_config_value_t *label; @@ -119,8 +120,6 @@ int mu_cfg_tree_union (mu_cfg_tree_t **pa, mu_cfg_tree_t **pb); int mu_cfg_tree_postprocess (mu_cfg_tree_t *tree, struct mu_cfg_parse_hints *hints); -extern struct mu_locus mu_cfg_locus; - mu_opool_t mu_cfg_lexer_pool (void); #define MU_CFG_ITER_OK 0 @@ -285,7 +284,7 @@ int mu_cfg_parse_file (mu_cfg_tree_t **return_tree, const char *file, int mu_cfg_tree_create (struct mu_cfg_tree **ptree); 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, |