Exemple #1
0
void register_math(Context* ctx) {
	unsigned i;
	unsigned constCount = ARRSIZE(_math_const_names);
	
	for(i = 0; i < constCount; i++) {
		Builtin* blt = Builtin_new(_math_const_names[i], _math_consts[i], false);
		Builtin_register(blt, ctx);
	}
	
	unsigned funcCount = ARRSIZE(_math_names);
	
	for(i = 0; i < funcCount; i++) {
		Builtin* blt = Builtin_new(_math_names[i], _math_funcs[i], true);
		Builtin_register(blt, ctx);
	}
}
Exemple #2
0
/* This is just a copy of register_math remade for vectors */
void Vector_register(Context *ctx) {
	unsigned count = sizeof(vector_names) / sizeof(vector_names[0]);
	unsigned i;
	for(i = 0; i < count; i++) {
		Builtin* blt = Builtin_new(vector_names[i], vector_funcs[i]);
		Builtin_register(blt, ctx);
	}
}