Commit 4e162e9b 4e162e9bb1a48269ce57a739a07d8c933a17bd57 by Sergey Poznyakoff

Further cleanup of sieve namespace

Prefix internal function names with mu_i_
1 parent 15404d91
......@@ -563,7 +563,7 @@ static mu_sieve_tag_group_t fileinto_tag_groups[] = {
};
void
mu_sv_register_standard_actions (mu_sieve_machine_t mach)
mu_i_sv_register_standard_actions (mu_sieve_machine_t mach)
{
mu_sieve_register_action (mach, "stop", sieve_action_stop, NULL, NULL, 1);
mu_sieve_register_action (mach, "keep", sieve_action_keep, NULL, NULL, 1);
......
......@@ -502,7 +502,7 @@ i_ascii_numeric_eq (const char *pattern, const char *text)
}
void
mu_sv_register_standard_comparators (mu_sieve_machine_t mach)
mu_i_sv_register_standard_comparators (mu_sieve_machine_t mach)
{
mu_sieve_register_comparator (mach,
"i;octet",
......
......@@ -136,7 +136,7 @@ _add_load_dir (void *item, void *unused)
}
int
mu_sv_load_add_dir (mu_sieve_machine_t mach, const char *name)
mu_i_sv_load_add_dir (mu_sieve_machine_t mach, const char *name)
{
if (sieve_init_load_path ())
return 1;
......@@ -155,7 +155,7 @@ mu_sieve_load_ext (mu_sieve_machine_t mach, const char *name)
}
int
mu_sv_load_add_dir (mu_sieve_machine_t mach, const char *name)
mu_i_sv_load_add_dir (mu_sieve_machine_t mach, const char *name)
{
return 1;
}
......
......@@ -50,7 +50,7 @@ file_eq (char const *a, char const *b)
{
if (a)
return b ? (strcmp (a, b) == 0) : 1;
return b ? -1 : 0;
return b ? 0 : 1;
}
/* FIXME: 1. Only beg is stored
......@@ -61,12 +61,12 @@ mu_i_sv_locus (struct mu_sieve_machine *mach, struct mu_locus_range *lr)
{
if (!file_eq (mach->locus.mu_file, lr->beg.mu_file))
{
mu_i_sv_code (mach, (sieve_op_t) _mu_sv_instr_source);
mu_i_sv_code (mach, (sieve_op_t) _mu_i_sv_instr_source);
mu_i_sv_code (mach, (sieve_op_t) lr->beg.mu_file);
}
if (mach->locus.mu_line != lr->beg.mu_line)
{
mu_i_sv_code (mach, (sieve_op_t) _mu_sv_instr_line);
mu_i_sv_code (mach, (sieve_op_t) _mu_i_sv_instr_line);
mu_i_sv_code (mach, (sieve_op_t) lr->beg.mu_line);
}
......@@ -339,7 +339,7 @@ int
mu_i_sv_code_action (struct mu_sieve_machine *mach,
mu_sieve_register_t *reg, mu_list_t arglist)
{
return mu_i_sv_code (mach, (sieve_op_t) _mu_sv_instr_action)
return mu_i_sv_code (mach, (sieve_op_t) _mu_i_sv_instr_action)
|| sv_code_command (mach, reg, arglist);
}
......@@ -347,7 +347,7 @@ int
mu_i_sv_code_test (struct mu_sieve_machine *mach,
mu_sieve_register_t *reg, mu_list_t arglist)
{
return mu_i_sv_code (mach, (sieve_op_t) _mu_sv_instr_test)
return mu_i_sv_code (mach, (sieve_op_t) _mu_i_sv_instr_test)
|| sv_code_command (mach, reg, arglist);
}
......
......@@ -32,14 +32,14 @@
#define INSTR_DISASS(m) ((m)->debug_level & MU_SIEVE_DEBUG_DISAS)
void
_mu_sv_instr_nop (mu_sieve_machine_t mach)
_mu_i_sv_instr_nop (mu_sieve_machine_t mach)
{
if (INSTR_DEBUG (mach))
mu_sieve_debug (mach, "%4lu: NOP", (unsigned long) (mach->pc - 1));
}
void
_mu_sv_instr_source (mu_sieve_machine_t mach)
_mu_i_sv_instr_source (mu_sieve_machine_t mach)
{
mach->locus.mu_file = (char*) SIEVE_ARG (mach, 0, string);
mu_stream_ioctl (mach->errstream, MU_IOCTL_LOGSTREAM,
......@@ -53,7 +53,7 @@ _mu_sv_instr_source (mu_sieve_machine_t mach)
}
void
_mu_sv_instr_line (mu_sieve_machine_t mach)
_mu_i_sv_instr_line (mu_sieve_machine_t mach)
{
mach->locus.mu_line = SIEVE_ARG (mach, 0, line);
mu_stream_ioctl (mach->errstream, MU_IOCTL_LOGSTREAM,
......@@ -80,9 +80,9 @@ instr_run (mu_sieve_machine_t mach)
{
mu_stream_printf (mach->errstream,
"\033s<%d>Arguments: ", MU_LOG_DEBUG);
mu_sv_print_value_list (arg_list, mach->errstream);
mu_i_sv_print_value_list (arg_list, mach->errstream);
mu_stream_printf (mach->errstream, "\n\033s<%d>Tags: ", MU_LOG_DEBUG);
mu_sv_print_tag_list (tag_list, mach->errstream);
mu_i_sv_print_tag_list (tag_list, mach->errstream);
mu_stream_printf (mach->errstream, "\n");
}
......@@ -92,7 +92,7 @@ instr_run (mu_sieve_machine_t mach)
}
void
_mu_sv_instr_action (mu_sieve_machine_t mach)
_mu_i_sv_instr_action (mu_sieve_machine_t mach)
{
mach->identifier = SIEVE_ARG (mach, 3, string);
if (INSTR_DEBUG (mach))
......@@ -105,7 +105,7 @@ _mu_sv_instr_action (mu_sieve_machine_t mach)
}
void
_mu_sv_instr_test (mu_sieve_machine_t mach)
_mu_i_sv_instr_test (mu_sieve_machine_t mach)
{
mach->identifier = SIEVE_ARG (mach, 3, string);
if (INSTR_DEBUG (mach))
......@@ -117,7 +117,7 @@ _mu_sv_instr_test (mu_sieve_machine_t mach)
}
void
_mu_sv_instr_push (mu_sieve_machine_t mach)
_mu_i_sv_instr_push (mu_sieve_machine_t mach)
{
if (INSTR_DEBUG (mach))
{
......@@ -135,7 +135,7 @@ _mu_sv_instr_push (mu_sieve_machine_t mach)
}
void
_mu_sv_instr_pop (mu_sieve_machine_t mach)
_mu_i_sv_instr_pop (mu_sieve_machine_t mach)
{
if (INSTR_DEBUG (mach))
{
......@@ -153,7 +153,7 @@ _mu_sv_instr_pop (mu_sieve_machine_t mach)
}
void
_mu_sv_instr_not (mu_sieve_machine_t mach)
_mu_i_sv_instr_not (mu_sieve_machine_t mach)
{
if (INSTR_DEBUG (mach))
{
......@@ -165,7 +165,7 @@ _mu_sv_instr_not (mu_sieve_machine_t mach)
}
void
_mu_sv_instr_branch (mu_sieve_machine_t mach)
_mu_i_sv_instr_branch (mu_sieve_machine_t mach)
{
long num = SIEVE_ARG (mach, 0, number);
......@@ -183,7 +183,7 @@ _mu_sv_instr_branch (mu_sieve_machine_t mach)
}
void
_mu_sv_instr_brz (mu_sieve_machine_t mach)
_mu_i_sv_instr_brz (mu_sieve_machine_t mach)
{
long num = SIEVE_ARG (mach, 0, number);
SIEVE_ADJUST (mach, 1);
......@@ -202,7 +202,7 @@ _mu_sv_instr_brz (mu_sieve_machine_t mach)
}
void
_mu_sv_instr_brnz (mu_sieve_machine_t mach)
_mu_i_sv_instr_brnz (mu_sieve_machine_t mach)
{
long num = SIEVE_ARG (mach, 0, number);
SIEVE_ADJUST (mach, 1);
......
......@@ -157,26 +157,26 @@ int mu_i_sv_code_test (struct mu_sieve_machine *mach,
mu_sieve_register_t *reg, mu_list_t arglist);
/* Opcodes */
void _mu_sv_instr_action (mu_sieve_machine_t mach);
void _mu_sv_instr_test (mu_sieve_machine_t mach);
void _mu_sv_instr_push (mu_sieve_machine_t mach);
void _mu_sv_instr_pop (mu_sieve_machine_t mach);
void _mu_sv_instr_not (mu_sieve_machine_t mach);
void _mu_sv_instr_branch (mu_sieve_machine_t mach);
void _mu_sv_instr_brz (mu_sieve_machine_t mach);
void _mu_sv_instr_brnz (mu_sieve_machine_t mach);
void _mu_sv_instr_nop (mu_sieve_machine_t mach);
void _mu_sv_instr_source (mu_sieve_machine_t mach);
void _mu_sv_instr_line (mu_sieve_machine_t mach);
int mu_sv_load_add_dir (mu_sieve_machine_t mach, const char *name);
void _mu_i_sv_instr_action (mu_sieve_machine_t mach);
void _mu_i_sv_instr_test (mu_sieve_machine_t mach);
void _mu_i_sv_instr_push (mu_sieve_machine_t mach);
void _mu_i_sv_instr_pop (mu_sieve_machine_t mach);
void _mu_i_sv_instr_not (mu_sieve_machine_t mach);
void _mu_i_sv_instr_branch (mu_sieve_machine_t mach);
void _mu_i_sv_instr_brz (mu_sieve_machine_t mach);
void _mu_i_sv_instr_brnz (mu_sieve_machine_t mach);
void _mu_i_sv_instr_nop (mu_sieve_machine_t mach);
void _mu_i_sv_instr_source (mu_sieve_machine_t mach);
void _mu_i_sv_instr_line (mu_sieve_machine_t mach);
int mu_i_sv_load_add_dir (mu_sieve_machine_t mach, const char *name);
void mu_sv_register_standard_actions (mu_sieve_machine_t mach);
void mu_sv_register_standard_tests (mu_sieve_machine_t mach);
void mu_sv_register_standard_comparators (mu_sieve_machine_t mach);
void mu_i_sv_register_standard_actions (mu_sieve_machine_t mach);
void mu_i_sv_register_standard_tests (mu_sieve_machine_t mach);
void mu_i_sv_register_standard_comparators (mu_sieve_machine_t mach);
void mu_sv_print_value_list (mu_list_t list, mu_stream_t str);
void mu_sv_print_tag_list (mu_list_t list, mu_stream_t str);
void mu_i_sv_print_value_list (mu_list_t list, mu_stream_t str);
void mu_i_sv_print_tag_list (mu_list_t list, mu_stream_t str);
void mu_i_sv_error (mu_sieve_machine_t mach);
......
......@@ -461,7 +461,7 @@ sieve_searchpath (void)
name = get_file_name (p, endp, NULL);
if (name)
{
mu_sv_load_add_dir (mu_sieve_machine, name);
mu_i_sv_load_add_dir (mu_sieve_machine, name);
free (name);
}
}
......
......@@ -604,7 +604,7 @@ code_node_cond (struct mu_sieve_machine *mach, struct mu_sieve_node *node)
size_t br1;
tree_code (mach, node->v.cond.expr);
mu_i_sv_code (mach, (sieve_op_t) _mu_sv_instr_brz);
mu_i_sv_code (mach, (sieve_op_t) _mu_i_sv_instr_brz);
br1 = mach->pc;
mu_i_sv_code (mach, (sieve_op_t) 0);
tree_code (mach, node->v.cond.iftrue);
......@@ -613,7 +613,7 @@ code_node_cond (struct mu_sieve_machine *mach, struct mu_sieve_node *node)
{
size_t br2;
mu_i_sv_code (mach, (sieve_op_t) _mu_sv_instr_branch);
mu_i_sv_code (mach, (sieve_op_t) _mu_i_sv_instr_branch);
br2 = mach->pc;
mu_i_sv_code (mach, (sieve_op_t) 0);
......@@ -761,7 +761,7 @@ optimize_node_anyof (struct mu_sieve_node *node)
static int
code_node_anyof (struct mu_sieve_machine *mach, struct mu_sieve_node *node)
{
return code_node_x_of (mach, node, (sieve_op_t) _mu_sv_instr_brnz);
return code_node_x_of (mach, node, (sieve_op_t) _mu_i_sv_instr_brnz);
}
/* mu_sieve_node_allof */
......@@ -774,7 +774,7 @@ optimize_node_allof (struct mu_sieve_node *node)
static int
code_node_allof (struct mu_sieve_machine *mach, struct mu_sieve_node *node)
{
return code_node_x_of (mach, node, (sieve_op_t) _mu_sv_instr_brz);
return code_node_x_of (mach, node, (sieve_op_t) _mu_i_sv_instr_brz);
}
/* mu_sieve_node_not */
......@@ -809,7 +809,7 @@ static int
code_node_not (struct mu_sieve_machine *mach, struct mu_sieve_node *node)
{
node_code (mach, node->v.node);
return mu_i_sv_code (mach, (sieve_op_t) _mu_sv_instr_not);
return mu_i_sv_code (mach, (sieve_op_t) _mu_i_sv_instr_not);
}
static void
......@@ -1230,9 +1230,9 @@ mu_sieve_machine_destroy (mu_sieve_machine_t *pmach)
static void
sieve_machine_begin (mu_sieve_machine_t mach, const char *file)
{
mu_sv_register_standard_actions (mach);
mu_sv_register_standard_tests (mach);
mu_sv_register_standard_comparators (mach);
mu_i_sv_register_standard_actions (mach);
mu_i_sv_register_standard_tests (mach);
mu_i_sv_register_standard_comparators (mach);
mu_sieve_machine = mach;
}
......@@ -1292,6 +1292,12 @@ sieve_parse (void)
tree_dump (mu_strerr, sieve_tree, 0);
}
mu_i_sv_code (mu_sieve_machine, (sieve_op_t) 0);
/* Clear location, so that mu_i_sv_locus will do its job. */
mu_sieve_machine->locus.mu_file = NULL;
mu_sieve_machine->locus.mu_line = 0;
mu_sieve_machine->locus.mu_col = 0;
rc = tree_code (mu_sieve_machine, sieve_tree);
if (rc)
mu_i_sv_error (mu_sieve_machine);
......
......@@ -428,7 +428,7 @@ mu_sieve_tag_group_t header_tag_groups[] = {
};
void
mu_sv_register_standard_tests (mu_sieve_machine_t mach)
mu_i_sv_register_standard_tests (mu_sieve_machine_t mach)
{
/* true and false are built-ins */
mu_sieve_register_test (mach, "address", sieve_test_address,
......
......@@ -339,7 +339,7 @@ sieve_print_value (mu_sieve_value_t *val, mu_stream_t str)
}
void
mu_sv_print_value_list (mu_list_t list, mu_stream_t str)
mu_i_sv_print_value_list (mu_list_t list, mu_stream_t str)
{
mu_sieve_value_t val;
......@@ -366,7 +366,7 @@ tag_printer (void *item, void *data)
}
void
mu_sv_print_tag_list (mu_list_t list, mu_stream_t str)
mu_i_sv_print_tag_list (mu_list_t list, mu_stream_t str)
{
mu_list_foreach (list, tag_printer, str);
}
......