<commit_before>#include <racr/racr.h>
#include <stdio.h>
#include <error.h>



Scheme_Env* global_env;


Scheme_Object* eq_Token(int argc, Scheme_Object** argv) {
	return racr_call(scheme_eval_string("eq?", global_env), "*s", argv[0], "Token");
}
Scheme_Object* eq_Euro(int argc, Scheme_Object** argv) {
	return racr_call(scheme_eval_string("eq?", global_env), "*s", argv[0], "Euro");
}
Scheme_Object* ge_two(int argc, Scheme_Object** argv) {
	return racr_call(scheme_eval_string(">=", global_env), "*i", argv[0], 2);
}
Scheme_Object* take_any(int argc, Scheme_Object** argv) {
	return scheme_true;
}


Scheme_Object* yield_Euro(int argc, Scheme_Object** argv) {
	return racr_list("s", "Euro");
}
Scheme_Object* yield_Token(int argc, Scheme_Object** argv) {
	return racr_list("s", "Token");
}
Scheme_Object* yield_minus_two(int argc, Scheme_Object** argv) {
	long x;
	scheme_get_int_val(argv[1], &x);
	return racr_list("i", x - 2);
}
Scheme_Object* yield_yz(int argc, Scheme_Object** argv) {
	return racr_list("**", argv[1], argv[2]);
}


Scheme_Object* fire_callback(int argc, Scheme_Object** argv) {
	printf("CALLBACK - transition name: %s\n",
		SCHEME_SYM_VAL(racr_ast_child_by_name("name", argv[0])));


	return scheme_false;
}


int main(int argc, char** argv) {

	static const const char* modules[] = {
		"petrinets/main_",
		"petrinets/ui",
		NULL
	};


	RACR_INIT(env, "bin/bc", modules);
	global_env = env;


	Scheme_Object* petri_spec = scheme_eval_string("petrinet-specification", env);
	racr_ast_rule(petri_spec, "EventTransition:Transition->callback");


	racr_call(scheme_eval_string("init-ast", env), "");
	racr_call(scheme_eval_string("init-attribution", env), "");



	Scheme_Object* wrap_eq_Euro = scheme_make_prim_w_arity(eq_Euro, "eq_Euro", 1, 1);
	Scheme_Object* wrap_eq_Token = scheme_make_prim_w_arity(eq_Token, "eq_Token", 1, 1);
	Scheme_Object* wrap_ge_two = scheme_make_prim_w_arity(ge_two, "ge_two", 1, 1);<commit_msg>give bytecode hint<commit_after>#include <racr/racr.h>
#include <stdio.h>
#include <error.h>

/*
	This test uses the petrinets/ui module.
	That module must be included in the bc-file.
*/


Scheme_Env* global_env;


Scheme_Object* eq_Token(int argc, Scheme_Object** argv) {
	return racr_call(scheme_eval_string("eq?", global_env), "*s", argv[0], "Token");
}
Scheme_Object* eq_Euro(int argc, Scheme_Object** argv) {
	return racr_call(scheme_eval_string("eq?", global_env), "*s", argv[0], "Euro");
}
Scheme_Object* ge_two(int argc, Scheme_Object** argv) {
	return racr_call(scheme_eval_string(">=", global_env), "*i", argv[0], 2);
}
Scheme_Object* take_any(int argc, Scheme_Object** argv) {
	return scheme_true;
}


Scheme_Object* yield_Euro(int argc, Scheme_Object** argv) {
	return racr_list("s", "Euro");
}
Scheme_Object* yield_Token(int argc, Scheme_Object** argv) {
	return racr_list("s", "Token");
}
Scheme_Object* yield_minus_two(int argc, Scheme_Object** argv) {
	long x;
	scheme_get_int_val(argv[1], &x);
	return racr_list("i", x - 2);
}
Scheme_Object* yield_yz(int argc, Scheme_Object** argv) {
	return racr_list("**", argv[1], argv[2]);
}


Scheme_Object* fire_callback(int argc, Scheme_Object** argv) {
	printf("CALLBACK - transition name: %s\n",
		SCHEME_SYM_VAL(racr_ast_child_by_name("name", argv[0])));


	return scheme_false;
}


int main(int argc, char** argv) {

	static const const char* modules[] = {
		"petrinets/main_",
		"petrinets/ui",
		NULL
	};

	RACR_INIT(env, "bin/bc", modules);
	global_env = env;


	Scheme_Object* petri_spec = scheme_eval_string("petrinet-specification", env);
	racr_ast_rule(petri_spec, "EventTransition:Transition->callback");


	racr_call(scheme_eval_string("init-ast", env), "");
	racr_call(scheme_eval_string("init-attribution", env), "");



	Scheme_Object* wrap_eq_Euro = scheme_make_prim_w_arity(eq_Euro, "eq_Euro", 1, 1);
	Scheme_Object* wrap_eq_Token = scheme_make_prim_w_arity(eq_Token, "eq_Token", 1, 1);
	Scheme_Object* wrap_ge_two = scheme_make_prim_w_arity(ge_two, "ge_two", 1, 1);
{'fraction_non_alphanumeric': 0.1595184349134688, 'fraction_numerical': 0.007524454477050414, 'mean_word_length': 6.7890625, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4592222', 'n_tokens_mistral': 1604, 'n_tokens_neox': 1506, 'n_words': 305}