Beispiel #1
0
static
Value *
builtin_relation_is_sublattice(Scope *args, MemorySpace *memspace) {
	Value *arg[] = {
		get_value_by_name(args, memspace, "0"),
		get_value_by_name(args, memspace, "1"),
	};
	Value *rval = value_new();

	value_set_bool(rval, rf_relation_is_sublattice(arg[0]->as_Relation, arg[1]->as_Relation));

	return rval;
}
Beispiel #2
0
static
Value *
builtin_set_is_subset(Scope *args, MemorySpace *memspace) {
	Value *arg[] = {
		get_value_by_name(args, memspace, "0"),
		get_value_by_name(args, memspace, "1"),
	};
	Value *rval = value_new();

	value_set_bool(rval, rf_set_is_subset(arg[0]->as_Set, arg[1]->as_Set));

	return rval;
}
Beispiel #3
0
static
Value *
builtin_relation_generate_random(Scope *args, MemorySpace *memspace) {
	Value *arg[] = {
		get_value_by_name(args, memspace, "0"),
		get_value_by_name(args, memspace, "1"),
		get_value_by_name(args, memspace, "2"),
	};
	Value *rval = value_new();

	rf_Relation *r = rf_relation_generate_random(arg[0]->as_Set, arg[1]->as_Set, arg[2]->as_float);
	value_set_relation(rval, r);

	return rval;
}
Beispiel #4
0
void LogControlModule::add_hook()
{
	auto type = controller->get_enum_type("GstDebugLevel");
	if (!type) return;
	auto value = type->get_value_by_name(log_levels_combobox->get_active_text());
	if (value)
		controller->send_set_log_hook_command(true, debug_categories_combobox->get_active_text(), value.get());
}
Beispiel #5
0
void parse_vars_in_string(const char *string,char *out,int max_len)
{
    const char *scan= string;
    char buf[SCAN_SIZE + 1];
    char *dest;
    char *out_scan = out;
    shell_value *value;
    int out_len = 0;
    int len_cnt;
    int out_max_len= max_len;
    int can_move;
    char *text;

    while((*scan != 0) && (*scan != '\'') && (out_max_len > 0)){
        if(*scan == '$'){
            scan++;
            dest = buf;
            len_cnt = SCAN_SIZE;

            while ((*scan != 0) && (IS_IDENT_CHAR(*scan)) &&(len_cnt > 0)){

                *dest = *scan;
                dest++;
                scan++;
                len_cnt--;

            }

            *dest = 0;
            value = get_value_by_name(buf);

            if(value != NULL){

                text = shell_value_to_char(value);
                can_move = strlen(text);

                if(can_move > out_max_len) can_move = out_max_len;

                memcpy(out_scan,text,can_move);
                out_max_len -= can_move;
                out_scan += can_move;

                free(text);

            }

        } else{

            *out_scan = *scan;
            out_len++;
            out_scan++;
            scan ++;
            out_max_len--;

        }
    }
    *out_scan= 0;
}
Beispiel #6
0
static
Value *
builtin_bool2str(Scope *args, MemorySpace *memspace) {
	Value *arg[] = {
		get_value_by_name(args, memspace, "0"),
	};
	Value *rval = value_new();

	value_set_string(rval, strdup((arg[0]->as_bool) ? "true" : "false"));

	return rval;
}
Beispiel #7
0
static
Value *
builtin_relation_is_partial_order(Scope *args, MemorySpace *memspace) {
	Value *arg[] = {
		get_value_by_name(args, memspace, "0"),
	};
	Value *rval = value_new();

	value_set_bool(rval, rf_relation_is_partial_order(arg[0]->as_Relation));

	return rval;
}
Beispiel #8
0
static
Value *
builtin_relation_new_converse(Scope *args, MemorySpace *memspace) {
	Value *arg[] = {
		get_value_by_name(args, memspace, "0"),
	};
	Value *rval = value_new();

	value_set_relation(rval, rf_relation_new_converse(arg[0]->as_Relation));

	return rval;
}
Beispiel #9
0
static
Value *
builtin_set_new_powerset(Scope *args, MemorySpace *memspace) {
	Value *arg[] = {
		get_value_by_name(args, memspace, "0"),
	};
	Value *rval = value_new();

	value_set_set(rval, rf_set_new_powerset(arg[0]->as_Set));

	return rval;
}
Beispiel #10
0
static
Value *
builtin_println(Scope *args, MemorySpace *memspace) {
	Value *arg[] = {
		get_value_by_name(args, memspace, "0"),
	};
	Value *rval = value_new();

	printf("%s\n", arg[0]->as_String);
	value_set_void(rval);

	return rval;
}
Beispiel #11
0
int main() {
    char a[100] = "?action=add_permission&acc_1=acc1&acc_2=123";
    char *split, *split2, *split3, *ret;
    int n;
    char buff[50];

    scanf("%s", buff);

    split3 = get_value_by_name(buff, a);

    printf("split: %s\n", split3);

    return 0;
}
Beispiel #12
0
static
Value *
builtin_r2tex(Scope *args, MemorySpace *memspace) {
	Value *arg[] = {
		get_value_by_name(args, memspace, "0"),
	};
	Value *rval = value_new();

	char *buf = rf_relation_format_tex(arg[0]->as_Relation);
	value_set_string(rval, strdup(buf));
	rf_string_free(buf);

	return rval;
}
Beispiel #13
0
static
Value *
builtin_set2str(Scope *args, MemorySpace *memspace) {
	Value *arg[] = {
		get_value_by_name(args, memspace, "0"),
	};
	Value *rval = value_new();

	char *buf = rf_set_to_string(arg[0]->as_Set);
	value_set_string(rval, strdup(buf));
	rf_string_free(buf);

	return rval;
}
Beispiel #14
0
static
Value *
builtin_float2str(Scope *args, MemorySpace *memspace) {
	Value *arg[] = {
		get_value_by_name(args, memspace, "0"),
	};
	Value *rval = value_new();

	char buf[64];
	snprintf(buf, 64, "%f", arg[0]->as_float);
	value_set_string(rval, strdup(buf));

	return rval;
}