Example #1
0
void
tr_table_initialize_from_strings(struct tr_table *table, int argc, VALUE *argv)
{
    tr_table_initialize(table, argv[0]);
    for (int i = 1; i < argc; i++)
            tr_table_add(table, RVAL2USTRING_ANY(argv[i]));
}
Example #2
0
int register_trans_mod(char *mod_name, tr_export_t *items)
{
	int ret;
	int i;

	if (items==0)
		return 0;

	for ( i=0 ; items[i].tclass.s ; i++ ) {
		ret = tr_table_add(&items[i]);
		if (ret!=0) {
			LM_ERR("failed to register pseudo-variable <%.*s> for module %s\n",
					items[i].tclass.len, items[i].tclass.s, mod_name);
		}
	}
	return 0;
}
Example #3
0
void
tr_table_initialize(struct tr_table *table, VALUE rbstring)
{
        const struct rb_u_string *string = RVAL2USTRING_ANY(rbstring);

        struct tr tr;
        tr_init(&tr, USTRING_STR(string), USTRING_END(string));

        table->exclude = tr_should_exclude(&tr);

        for (size_t i = 0; i < lengthof(table->continuous); i++)
                table->continuous[i] = true;

        table->sparse = Qnil;

        tr_table_add(table, string);
}