void init_postgres(void) { pg_conn_tag = scm_make_smob_type("pg_conn", sizeof(struct pg_conn)); scm_set_smob_free(pg_conn_tag, free_pg_conn); scm_set_smob_mark(pg_conn_tag, mark_pg_conn); pg_res_tag = scm_make_smob_type("pg_res", sizeof(struct pg_res)); scm_set_smob_free(pg_res_tag, free_pg_res); scm_set_smob_mark(pg_res_tag, mark_pg_res); scm_c_define_gsubr("pg-open-primitive", 1, 0, 0, pg_open_primitive); scm_c_define_gsubr("pg-close", 1, 0, 0, pg_close); scm_c_define_gsubr("pg-exec-primitive", 2, 0, 0, pg_exec); scm_c_define_gsubr("pg-clear", 1, 0, 0, pg_clear); scm_c_define_gsubr("pg-tuples", 1, 0, 0, pg_tuples); scm_c_define_gsubr("pg-cmd-tuples", 1, 0, 0, pg_cmd_tuples); scm_c_define_gsubr("pg-fields", 1, 0, 0, pg_fields); scm_c_define_gsubr("pg-get-row", 1, 0, 0, pg_get_row); scm_c_define_gsubr("pg-each-row", 2, 0, 0, pg_each_row); scm_c_define_gsubr("pg-next-row", 1, 0, 0, pg_next_row); scm_c_define_gsubr("pg-one-row-primitive", 2, 0, 0, pg_one_row); scm_c_define_gsubr("pg-map-rows", 1, 0, 1, pg_map_rows); scm_c_define_gsubr("pg-end-stream?", 1, 0, 0, pg_done); scm_c_define_gsubr("pg-format", 2, 0, 0, pg_format_sql); scm_c_define_gsubr("pg-cell", 2, 0, 0, pg_cell); scm_c_define_gsubr("pg-error-msg", 1, 0, 0, pg_error_msg); scm_c_define_gsubr("decode-ts", 1, 0, 0, decode_ts); int vers = PQlibVersion(); log_msg("PQlib version %d.%d.%d\n", vers / 10000, (vers / 100) % 100, vers % 100); }
void init_tensorflow(void) { tf_tensor_tag = scm_make_smob_type("tensor", sizeof(struct tf_tensor_t)); scm_set_smob_free(tf_tensor_tag, free_tensor); tf_graph_tag = scm_make_smob_type("graph", sizeof(struct tf_graph_t)); scm_set_smob_free(tf_graph_tag, free_graph); tf_description_tag = scm_make_smob_type("description", sizeof(struct tf_description_t)); scm_set_smob_free(tf_description_tag, free_description); tf_output_tag = scm_make_smob_type("output", sizeof(struct tf_output_t)); scm_set_smob_free(tf_output_tag, free_output); tf_session_tag = scm_make_smob_type("session", sizeof(struct tf_session_t)); scm_set_smob_free(tf_session_tag, free_session); _status = TF_NewStatus(); scm_c_define("TF_FLOAT" , scm_from_int(TF_FLOAT )); scm_c_define("TF_DOUBLE" , scm_from_int(TF_DOUBLE )); scm_c_define("TF_UINT8" , scm_from_int(TF_UINT8 )); scm_c_define("TF_INT8" , scm_from_int(TF_INT8 )); scm_c_define("TF_UINT16" , scm_from_int(TF_UINT16 )); scm_c_define("TF_INT16" , scm_from_int(TF_INT16 )); scm_c_define("TF_UINT32" , scm_from_int(TF_UINT32 )); scm_c_define("TF_INT32" , scm_from_int(TF_INT32 )); scm_c_define("TF_UINT64" , scm_from_int(TF_UINT64 )); scm_c_define("TF_COMPLEX64" , scm_from_int(TF_COMPLEX64 )); scm_c_define("TF_INT64" , scm_from_int(TF_INT64 )); scm_c_define("TF_BOOL" , scm_from_int(TF_BOOL )); scm_c_define("TF_COMPLEX128", scm_from_int(TF_COMPLEX128)); scm_c_define("TF_STRING" , scm_from_int(TF_STRING )); scm_c_define_gsubr("make-tensor" , 4, 0, 0, SCM_FUNC(make_tensor )); scm_c_define_gsubr("tf-from-tensor" , 1, 0, 0, SCM_FUNC(tf_from_tensor )); scm_c_define_gsubr("make-graph" , 0, 0, 0, SCM_FUNC(make_graph )); scm_c_define_gsubr("tf-graph-export_" , 2, 0, 0, SCM_FUNC(tf_graph_export_ )); scm_c_define_gsubr("tf-graph-import_" , 2, 0, 0, SCM_FUNC(tf_graph_import_ )); scm_c_define_gsubr("make-description" , 3, 0, 0, SCM_FUNC(make_description )); scm_c_define_gsubr("tf-finish-operation" , 2, 0, 0, SCM_FUNC(tf_finish_operation )); scm_c_define_gsubr("tf-add-input" , 2, 0, 0, SCM_FUNC(tf_add_input )); scm_c_define_gsubr("tf-add-input-list" , 2, 0, 0, SCM_FUNC(tf_add_input_list )); scm_c_define_gsubr("tf-set-attr-string" , 3, 0, 0, SCM_FUNC(tf_set_attr_string )); scm_c_define_gsubr("tf-set-attr-int" , 3, 0, 0, SCM_FUNC(tf_set_attr_int )); scm_c_define_gsubr("tf-set-attr-int-list" , 3, 0, 0, SCM_FUNC(tf_set_attr_int_list )); scm_c_define_gsubr("tf-set-attr-bool" , 3, 0, 0, SCM_FUNC(tf_set_attr_bool )); scm_c_define_gsubr("tf-set-attr-float" , 3, 0, 0, SCM_FUNC(tf_set_attr_float )); scm_c_define_gsubr("tf-set-attr-float-list" , 3, 0, 0, SCM_FUNC(tf_set_attr_float_list )); scm_c_define_gsubr("tf-set-attr-type" , 3, 0, 0, SCM_FUNC(tf_set_attr_type )); scm_c_define_gsubr("tf-set-attr-shape" , 3, 0, 0, SCM_FUNC(tf_set_attr_shape )); scm_c_define_gsubr("tf-set-attr-tensor" , 3, 0, 0, SCM_FUNC(tf_set_attr_tensor )); scm_c_define_gsubr("make-tf-session" , 1, 0, 0, SCM_FUNC(make_tf_session )); scm_c_define_gsubr("tf-run" , 3, 0, 0, SCM_FUNC(tf_run )); scm_c_define_gsubr("tf-add-gradient_" , 3, 0, 0, SCM_FUNC(tf_add_gradient_ )); scm_c_define_gsubr("tf-output?" , 1, 0, 0, SCM_FUNC(tf_outputq )); scm_c_define_gsubr("tf-graph-operation-by-name_" , 2, 0, 0, SCM_FUNC(tf_graph_operation_by_name_)); scm_c_define_gsubr("tf-operation-names_" , 1, 0, 0, SCM_FUNC(tf_operation_names_ )); }
void init_ffmpeg(void) { av_register_all(); avformat_network_init(); ffmpeg_tag = scm_make_smob_type("ffmpeg", sizeof(struct ffmpeg_t)); scm_set_smob_free(ffmpeg_tag, free_ffmpeg); scm_c_define_gsubr("make-ffmpeg-input" , 2, 0, 0, SCM_FUNC(make_ffmpeg_input )); scm_c_define_gsubr("make-ffmpeg-output" , 7, 0, 0, SCM_FUNC(make_ffmpeg_output )); scm_c_define_gsubr("ffmpeg-have-video?" , 1, 0, 0, SCM_FUNC(ffmpeg_have_video )); scm_c_define_gsubr("ffmpeg-have-audio?" , 1, 0, 0, SCM_FUNC(ffmpeg_have_audio )); scm_c_define_gsubr("ffmpeg-shape" , 1, 0, 0, SCM_FUNC(ffmpeg_shape )); scm_c_define_gsubr("ffmpeg-destroy" , 1, 0, 0, SCM_FUNC(ffmpeg_destroy )); scm_c_define_gsubr("ffmpeg-frame-rate" , 1, 0, 0, SCM_FUNC(ffmpeg_frame_rate )); scm_c_define_gsubr("ffmpeg-video-bit-rate" , 1, 0, 0, SCM_FUNC(ffmpeg_video_bit_rate )); scm_c_define_gsubr("ffmpeg-aspect-ratio" , 1, 0, 0, SCM_FUNC(ffmpeg_aspect_ratio )); scm_c_define_gsubr("ffmpeg-channels" , 1, 0, 0, SCM_FUNC(ffmpeg_channels )); scm_c_define_gsubr("ffmpeg-rate" , 1, 0, 0, SCM_FUNC(ffmpeg_rate )); scm_c_define_gsubr("ffmpeg-typecode" , 1, 0, 0, SCM_FUNC(ffmpeg_typecode )); scm_c_define_gsubr("ffmpeg-decode-audio/video" , 1, 0, 0, SCM_FUNC(ffmpeg_decode_audio_video )); scm_c_define_gsubr("ffmpeg-target-video-frame" , 1, 0, 0, SCM_FUNC(ffmpeg_target_video_frame )); scm_c_define_gsubr("ffmpeg-target-audio-frame" , 1, 0, 0, SCM_FUNC(ffmpeg_target_audio_frame )); scm_c_define_gsubr("ffmpeg-packed-audio-frame" , 1, 0, 0, SCM_FUNC(ffmpeg_packed_audio_frame )); scm_c_define_gsubr("ffmpeg-encode-video" , 1, 0, 0, SCM_FUNC(ffmpeg_encode_video )); scm_c_define_gsubr("ffmpeg-audio-buffer-fill" , 1, 0, 0, SCM_FUNC(ffmpeg_audio_buffer_fill )); scm_c_define_gsubr("ffmpeg-buffer-audio" , 3, 0, 0, SCM_FUNC(ffmpeg_buffer_audio )); scm_c_define_gsubr("ffmpeg-fetch-audio" , 3, 0, 0, SCM_FUNC(ffmpeg_fetch_audio )); scm_c_define_gsubr("ffmpeg-encode-audio" , 1, 0, 0, SCM_FUNC(ffmpeg_encode_audio )); scm_c_define_gsubr("ffmpeg-seek" , 2, 0, 0, SCM_FUNC(ffmpeg_seek )); scm_c_define_gsubr("ffmpeg-flush" , 1, 0, 0, SCM_FUNC(ffmpeg_flush )); scm_c_define_gsubr("ffmpeg-crop-audio-frame-size", 2, 0, 0, SCM_FUNC(ffmpeg_crop_audio_frame_size)); }
static void init_client_type(void) { client_tag = scm_make_smob_type("client", sizeof(client_t)); scm_set_smob_mark(client_tag, mark_client); scm_set_smob_free(client_tag, free_client); scm_set_smob_print(client_tag, print_client); scm_set_smob_equalp(client_tag, equalp_client); }
void init_stream_vorbis(void) { vorbis_stream_tag = scm_make_smob_type("vorbis_stream", sizeof(VORBIS_STREAM)); scm_set_smob_free(vorbis_stream_tag, free_vorbis); scm_c_define_gsubr("stream-vorbis", 4, 0, 1, open_vorbis_stream); log_msg("Ogg Vorbis version %s\n", vorbis_version_string()); return; }
void init_cell_type (void) { cell_tag = scm_make_smob_type("cell", sizeof(struct cell)); scm_set_smob_mark(cell_tag, mark_cell); scm_set_smob_free(cell_tag, free_cell); scm_set_smob_print(cell_tag, print_cell); scm_c_define_gsubr("make-cell", 3, 0, 0, make_cell); scm_c_define_gsubr("set-cell", 2, 0, 0, set_cell); scm_c_define_gsubr("get-status", 1, 0, 0, get_status); }
void init_vndb(){ tls_tag = scm_make_smob_type("tls", sizeof(BIO*)); scm_set_smob_free(tls_tag, scm_tls_free); scm_c_define_gsubr("tls-connect", 2, 0, 0, scm_connect_tls); scm_c_define_gsubr("tls-get-fd", 1, 0, 0, scm_tls_get_fd); scm_c_define_gsubr("tls-get-cipher-info", 1, 0, 0, scm_tls_get_cipher_info); scm_c_define_gsubr("tls-send", 2, 0, 0, scm_tls_send); scm_c_define_gsubr("tls-recv!", 2, 0, 0, scm_tls_recv_x); //from zlib scm_c_define_gsubr("gunzip-bytevector", 2, 0, 0, scm_gunzip_buf); }
/* Key smob initialization. */ void init_key_type (void) { key_tag = scm_make_smob_type ("key", sizeof (struct key_data)); scm_set_smob_mark (key_tag, mark_key_smob); scm_set_smob_free (key_tag, free_key_smob); scm_set_smob_print (key_tag, print_key); scm_set_smob_equalp (key_tag, equalp_key); #include "key-type.x" }
void register_matrix_smobs(void) { #ifdef HAVE_SCM_MAKE_SMOB_TYPE scm_tc16_smob_evectmatrix = scm_make_smob_type("evectmatrix", 0); scm_set_smob_free(scm_tc16_smob_evectmatrix, free_evectmatrix); scm_set_smob_print(scm_tc16_smob_evectmatrix, print_evectmatrix); scm_tc16_smob_sqmatrix = scm_make_smob_type("sqmatrix", 0); scm_set_smob_free(scm_tc16_smob_sqmatrix, free_sqmatrix); scm_set_smob_print(scm_tc16_smob_sqmatrix, print_sqmatrix); #else /* old way to register smobs */ MAKE_SMOBFUNS(evectmatrix); MAKE_SMOBFUNS(sqmatrix); REGISTER_SMOBFUNS(evectmatrix); REGISTER_SMOBFUNS(sqmatrix); #endif gh_new_procedure("evectmatrix?", evectmatrix_p, 1, 0, 0); gh_new_procedure("sqmatrix?", sqmatrix_p, 1, 0, 0); }
SWIGINTERN SCM SWIG_Guile_Init () { static SCM swig_module; if (swig_initialized) return swig_module; swig_initialized = 1; swig_module = scm_c_resolve_module("Swig swigrun"); if (ensure_smob_tag(swig_module, &swig_tag, "swig-pointer", "swig-pointer-tag")) { scm_set_smob_print(swig_tag, print_swig); scm_set_smob_equalp(swig_tag, equalp_swig); } if (ensure_smob_tag(swig_module, &swig_collectable_tag, "collectable-swig-pointer", "collectable-swig-pointer-tag")) { scm_set_smob_print(swig_collectable_tag, print_collectable_swig); scm_set_smob_equalp(swig_collectable_tag, equalp_swig); scm_set_smob_free(swig_collectable_tag, free_swig); } if (ensure_smob_tag(swig_module, &swig_destroyed_tag, "destroyed-swig-pointer", "destroyed-swig-pointer-tag")) { scm_set_smob_print(swig_destroyed_tag, print_destroyed_swig); scm_set_smob_equalp(swig_destroyed_tag, equalp_swig); } if (ensure_smob_tag(swig_module, &swig_member_function_tag, "swig-member-function-pointer", "swig-member-function-pointer-tag")) { scm_set_smob_print(swig_member_function_tag, print_member_function_swig); scm_set_smob_free(swig_member_function_tag, free_swig_member_function); } swig_make_func = scm_permanent_object( scm_variable_ref(scm_c_module_lookup(scm_c_resolve_module("oop goops"), "make"))); swig_keyword = scm_permanent_object(scm_from_locale_keyword((char*) "init-smob")); swig_symbol = scm_permanent_object(scm_from_locale_symbol("swig-smob")); #ifdef SWIG_INIT_RUNTIME_MODULE SWIG_INIT_RUNTIME_MODULE #endif return swig_module; }
void init_Segment2(void) { DB_PRINTF("\ninit_Segment2()\n\n"); tag_Segment2 = scm_make_smob_type("gtSegment2", sizeof(Segment2)); scm_set_smob_mark (tag_Segment2, mark_Segment2); scm_set_smob_free (tag_Segment2, free_Segment2); scm_set_smob_print(tag_Segment2, print_Segment2); scm_c_define_gsubr("gt-segment2?", 1, 0, 0, is_Segment2); scm_c_define_gsubr("gt-make-line2", 4, 0, 0, make_Segment2_line); scm_c_define_gsubr("gt-make-arc2", 6, 0, 0, make_Segment2_arc); }
void Display::initGuile() { /* Functions */ scm_c_define_gsubr("init-graphics", 1, 0, 0, (SCM (*)()) scm_init_graphics); scm_c_define_gsubr("quit-graphics", 0, 0, 0, (SCM (*)()) scm_quit_graphics); scm_c_define_gsubr("update-graphics", 0, 0, 0, (SCM (*)()) scm_update_graphics); /* Smobs */ m_tImageTag = scm_make_smob_type ("image", sizeof(struct image)); scm_set_smob_mark(m_tImageTag, mark_image); scm_set_smob_free(m_tImageTag, free_image); scm_c_define_gsubr("load-image", 1, 0, 0, (SCM (*)()) scm_load_image); scm_c_define_gsubr("draw-image", 2, 0, 0, (SCM (*)()) scm_draw_image); }
/*! * \brief Initialise the basic gEDA smob types. * \par Function Description * Registers the gEDA core smob types and some procedures acting on * them. gEDA only uses a single Guile smob, and uses the flags field * to multiplex the several different underlying C structures that may * be represented by that smob. Should only be called by * edascm_init(). */ void edascm_init_smob () { /* Register gEDA smob type */ geda_smob_tag = scm_make_smob_type ("geda", 0); scm_set_smob_free (geda_smob_tag, smob_free); scm_set_smob_print (geda_smob_tag, smob_print); scm_set_smob_equalp (geda_smob_tag, smob_equalp); /* Define the (geda core smob) module */ scm_c_define_module ("geda core smob", init_module_geda_core_smob, NULL); }
void init_sample_type (void) { sample_tag = scm_make_smob_type ("Sample", sizeof (Sample)); scm_set_smob_mark (sample_tag, 0); scm_set_smob_free (sample_tag, free_sample); scm_set_smob_print (sample_tag, print_sample); scm_c_define_gsubr ("load-sample", 1, 0, 0, load_sample); scm_c_define_gsubr ("play-sample", 4, 0, 0, play_sample); scm_c_export ("load-sample", NULL); scm_c_export ("play-sample", NULL); }
void init_board_type (void) { board_tag = scm_make_smob_type("board", sizeof(struct board)); scm_set_smob_mark(board_tag, mark_board); scm_set_smob_free(board_tag, free_board); scm_set_smob_print(board_tag, print_board); scm_c_define_gsubr("make-board", 2, 0, 0, make_board); scm_c_define_gsubr("clear-board", 1, 0, 0, clear_board); scm_c_define_gsubr("get-cell", 3, 0, 0, get_cell); scm_c_define_gsubr("get-neighbors", 2, 0, 0, get_neighbors); scm_c_define_gsubr("get-living-neighbors", 2, 0, 0, get_living_neighbors); scm_c_define_gsubr("apply-rule", 2, 0, 0, apply_rule); scm_c_define_gsubr("status-list", 1, 0, 0, status_list); }
void register_field_smobs(void) { #ifdef HAVE_SCM_MAKE_SMOB_TYPE scm_tc16_smob_field_smob = scm_make_smob_type("field", 0); scm_set_smob_free(scm_tc16_smob_field_smob, free_field_smob); scm_set_smob_print(scm_tc16_smob_field_smob, print_field_smob); #else /* old way to register smobs */ MAKE_SMOBFUNS(field_smob); REGISTER_SMOBFUNS(field_smob); #endif gh_new_procedure("field?", field_p, 1, 0, 0); gh_new_procedure("rscalar-field?", rscalar_field_p, 1, 0, 0); gh_new_procedure("cscalar-field?", cscalar_field_p, 1, 0, 0); gh_new_procedure("cvector-field?", cvector_field_p, 1, 0, 0); }
void banmi_thit(void) { thit_model_tag = scm_make_smob_type("banmi_model", sizeof(banmi_model_t*)); scm_set_smob_free(thit_model_tag, thit_free_model); rng = gsl_rng_alloc(gsl_rng_mt19937); gsl_rng_set(rng, time(NULL)); thit_error = scm_from_locale_symbol("thit-error"); scm_c_define_gsubr("new-banmi-model", 7, 0, 0, thit_new_model); scm_c_define_gsubr("banmi-get-lambda", 1, 0, 0, thit_get_lambda); scm_c_define_gsubr("banmi-get-sigma", 1, 0, 0, thit_get_sigma); scm_c_define_gsubr("banmi-get-data", 1, 0, 0, thit_get_data); scm_c_define_gsubr("banmi-get-imputed-data", 1, 0, 0, thit_get_imputed_data); scm_c_define_gsubr("banmi-load-row!", 1, 0, 1, thit_load_row_x); scm_c_define_gsubr("banmi-data-augmentation!", 2, 0, 0, thit_data_augmentation_x); scm_c_define_gsubr("banmi-count-unique-modes", 1, 0, 0, thit_count_unique_modes); }
void init_game_type (void) { game_tag = scm_make_smob_type ("Game", sizeof (Game)); scm_set_smob_mark (game_tag, mark_game); scm_set_smob_free (game_tag, free_game); scm_set_smob_print (game_tag, print_game); scm_c_define_gsubr ("make-game", 0, 0, 0, make_game); scm_c_define_gsubr ("game-on-start-hook", 2, 0, 0, on_start_hook); scm_c_define_gsubr ("game-on-update-hook", 2, 0, 0, on_update_hook); scm_c_define_gsubr ("game-on-draw-hook", 2, 0, 0, on_draw_hook); scm_c_define_gsubr ("game-on-key-pressed-hook", 2, 0, 0, on_key_pressed_hook); scm_c_define_gsubr ("game-on-key-released-hook", 2, 0, 0, on_key_released_hook); scm_c_define_gsubr ("game-init", 4, 0, 0, game_init); scm_c_define_gsubr ("game-run", 1, 0, 0, game_run); scm_c_define_gsubr ("game-stop", 1, 0, 0, game_stop); scm_c_define_gsubr ("game-get-time", 1, 0, 0, game_get_time); scm_c_define_gsubr ("game-display-width", 1, 0, 0, game_display_width); scm_c_define_gsubr ("game-display-height", 1, 0, 0, game_display_height); scm_c_define_gsubr ("game-resize-display", 3, 0, 0, game_resize_display); scm_c_define_gsubr ("game-fullscreen?", 1, 0, 0, game_fullscreen); scm_c_define_gsubr ("set-game-fullscreen", 2, 0, 0, set_game_fullscreen); scm_c_define_gsubr ("game-reset-draw-target", 1, 0, 0, reset_draw_target); scm_c_export ("make-game", NULL); scm_c_export ("game-on-start-hook", NULL); scm_c_export ("game-on-update-hook", NULL); scm_c_export ("game-on-draw-hook", NULL); scm_c_export ("game-on-key-pressed-hook", NULL); scm_c_export ("game-on-key-released-hook", NULL); scm_c_export ("game-init", NULL); scm_c_export ("game-run", NULL); scm_c_export ("game-stop", NULL); scm_c_export ("game-get-time", NULL); scm_c_export ("game-display-width", NULL); scm_c_export ("game-display-height", NULL); scm_c_export ("game-resize-display", NULL); scm_c_export ("game-fullscreen?", NULL); scm_c_export ("set-game-fullscreen", NULL); scm_c_export ("game-reset-draw-target", NULL); }
void init_cache(void) { make_node_tag = scm_make_smob_type("make-node", sizeof(MAKE_NODE)); scm_set_smob_free(make_node_tag, free_node); scm_set_smob_mark(make_node_tag, mark_node); deflate_tag = scm_make_smob_type("gzip-blob", sizeof(DEFLATE_BLOB)); sessions_db = scm_from_locale_string("sessions"); scm_gc_protect_object(sessions_db); scm_permanent_object(file_sym = scm_from_utf8_symbol("file")); scm_permanent_object(data_sym = scm_from_utf8_symbol("data")); scm_permanent_object(stamp_sym = scm_from_utf8_symbol("stamp")); scm_c_define_gsubr("make-doc", 2, 0, 0, make_doc); scm_c_define_gsubr("touch-doc", 1, 0, 1, touch_node); scm_c_define_gsubr("fetch-doc", 1, 0, 1, fetch_node); scm_c_define_gsubr("touched-doc?", 1, 0, 0, touched_node); scm_c_define_gsubr("gzip", 1, 0, 0, gzip); scm_c_define_gsubr("zdeflate", 1, 0, 0, zdeflate); scm_c_define_gsubr("zdeflate-size", 1, 0, 0, deflate_size); scm_c_define_gsubr("zdeflate?", 1, 0, 0, is_gzip); scm_c_define_gsubr("zinflate", 1, 0, 0, gunzip); log_msg("zlib version %s\n", zlibVersion()); }
void ragnarok_epoll_module_init() { // epoll set SMOB init rag_epoll_event_set_tag = scm_make_smob_type("ragnarok-epoll-event-type", sizeof(scm_rag_event_set)); scm_set_smob_print(rag_epoll_event_set_tag ,ragnarok_print_epoll_event_set); scm_set_smob_free(rag_epoll_event_set_tag ,ragnarok_free_epoll_event_set); scm_c_define_gsubr("make-epoll-event" ,5 ,0 ,0 ,scm_ragnarok_make_epoll_event); scm_c_define_gsubr("make-epoll-event-set" ,2 ,0 ,0 ,scm_make_epoll_event_set); scm_c_define_gsubr("ragnarok-epoll-init", 1 ,0 ,0 ,scm_ragnarok_epoll_init); scm_c_define_gsubr("ragnarok-epoll-handler", 1 ,2 ,0 ,scm_ragnarok_epoll_handler); scm_c_define_gsubr("ragnarok-epoll-wait", 1 ,2 ,0 ,scm_ragnarok_epoll_wait); scm_c_define_gsubr("ragnarok-epoll-add-event", 2 ,0 ,0 ,scm_ragnarok_epoll_add_event); scm_c_define_gsubr("ragnarok-epoll-del-event", 2 ,0 ,0 ,scm_ragnarok_epoll_del_event); SCM_MAKE_GSUBR_OBJ_GET(epoll_event_set ,size); SCM_MAKE_GSUBR_OBJ_SET(epoll_event_set ,size); SCM_MAKE_GSUBR_OBJ_GET(epoll_event_set ,count); SCM_MAKE_GSUBR_OBJ_SET(epoll_event_set ,count); SCM_MAKE_GSUBR_OBJ_GET(epoll_event_set ,epfd); SCM_MAKE_GSUBR_OBJ_SET(epoll_event_set ,epfd); //event module interface scm_c_define_gsubr("ragnarok-event-init" ,1 ,0 ,0 ,RAGNAROK_EVENT_INIT); scm_c_define_gsubr("ragnarok-event-handler" ,1 ,2 ,0 ,RAGNAROK_EVENT_HANDLER); scm_c_define_gsubr("ragnarok-event-add" ,2 ,0 ,0 ,RAGNAROK_EVENT_ADD); scm_c_define_gsubr("ragnarok-event-del" ,2 ,0 ,0 ,RAGNAROK_EVENT_DEL); scm_c_define_gsubr("ragnarok-make-new-event" ,5 ,0 ,0 ,RAGNAROK_NEW_EVENT); }
void init_core(void) { LLVMLinkInMCJIT(); LLVMInitializeNativeTarget(); LLVMInitializeNativeAsmPrinter(); LLVMInitializeNativeAsmParser(); llvm_module_tag = scm_make_smob_type("llvm_module", sizeof(struct llvm_module_t)); scm_set_smob_free(llvm_module_tag, free_llvm_module); llvm_function_tag = scm_make_smob_type("llvm_function", sizeof(struct llvm_function_t)); scm_set_smob_free(llvm_function_tag, free_llvm_function); llvm_value_tag = scm_make_smob_type("llvm_value", sizeof(struct llvm_value_t)); llvm_basic_block_tag = scm_make_smob_type("llvm_basic_block", sizeof(struct llvm_basic_block_t)); scm_c_define("llvm-bool" , scm_from_int(SCM_FOREIGN_TYPE_LAST + 1)); scm_c_define("llvm-void" , scm_from_int(SCM_FOREIGN_TYPE_VOID )); scm_c_define("llvm-float" , scm_from_int(SCM_FOREIGN_TYPE_FLOAT )); scm_c_define("llvm-double", scm_from_int(SCM_FOREIGN_TYPE_DOUBLE )); scm_c_define("llvm-uint8" , scm_from_int(SCM_FOREIGN_TYPE_UINT8 )); scm_c_define("llvm-int8" , scm_from_int(SCM_FOREIGN_TYPE_INT8 )); scm_c_define("llvm-uint16", scm_from_int(SCM_FOREIGN_TYPE_UINT16 )); scm_c_define("llvm-int16" , scm_from_int(SCM_FOREIGN_TYPE_INT16 )); scm_c_define("llvm-uint32", scm_from_int(SCM_FOREIGN_TYPE_UINT32 )); scm_c_define("llvm-int32" , scm_from_int(SCM_FOREIGN_TYPE_INT32 )); scm_c_define("llvm-uint64", scm_from_int(SCM_FOREIGN_TYPE_UINT64 )); scm_c_define("llvm-int64" , scm_from_int(SCM_FOREIGN_TYPE_INT64 )); scm_c_define("llvm-int-slt" , scm_from_int(LLVMIntSLT)); scm_c_define("llvm-int-ult" , scm_from_int(LLVMIntULT)); scm_c_define("llvm-int-sle" , scm_from_int(LLVMIntSLE)); scm_c_define("llvm-int-ule" , scm_from_int(LLVMIntULE)); scm_c_define("llvm-int-ugt" , scm_from_int(LLVMIntUGT)); scm_c_define("llvm-int-sgt" , scm_from_int(LLVMIntSGT)); scm_c_define("llvm-int-uge" , scm_from_int(LLVMIntUGE)); scm_c_define("llvm-int-sge" , scm_from_int(LLVMIntSGE)); scm_c_define("llvm-int-eq" , scm_from_int(LLVMIntEQ )); scm_c_define("llvm-int-ne" , scm_from_int(LLVMIntNE )); scm_c_define("llvm-real-lt" , scm_from_int(LLVMRealOLT)); scm_c_define("llvm-real-le" , scm_from_int(LLVMRealOLE)); scm_c_define("llvm-real-gt" , scm_from_int(LLVMRealOGT)); scm_c_define("llvm-real-ge" , scm_from_int(LLVMRealOGE)); scm_c_define("llvm-real-eq" , scm_from_int(LLVMRealOEQ)); scm_c_define("llvm-real-ne" , scm_from_int(LLVMRealONE)); scm_c_define_gsubr("make-llvm-module-base" , 0, 0, 0, SCM_FUNC(make_llvm_module_base )); scm_c_define_gsubr("llvm-module-destroy" , 1, 0, 0, SCM_FUNC(llvm_module_destroy )); scm_c_define_gsubr("llvm-dump-module" , 1, 0, 0, SCM_FUNC(llvm_dump_module )); scm_c_define_gsubr("make-llvm-function" , 4, 0, 0, SCM_FUNC(make_llvm_function )); scm_c_define_gsubr("llvm-function-destroy" , 1, 0, 0, SCM_FUNC(llvm_function_destroy )); scm_c_define_gsubr("llvm-function-return" , 2, 0, 0, SCM_FUNC(llvm_function_return )); scm_c_define_gsubr("llvm-function-return-void" , 1, 0, 0, SCM_FUNC(llvm_function_return_void )); scm_c_define_gsubr("llvm-compile-module" , 1, 0, 0, SCM_FUNC(llvm_compile_module )); scm_c_define_gsubr("llvm-get-function-address" , 2, 0, 0, SCM_FUNC(llvm_get_function_address )); scm_c_define_gsubr("llvm-verify-module" , 1, 0, 0, SCM_FUNC(llvm_verify_module )); scm_c_define_gsubr("make-llvm-basic-block" , 2, 0, 0, SCM_FUNC(make_llvm_basic_block )); scm_c_define_gsubr("llvm-position-builder-at-end", 2, 0, 0, SCM_FUNC(llvm_position_builder_at_end)); scm_c_define_gsubr("llvm-build-branch" , 2, 0, 0, SCM_FUNC(llvm_build_branch )); scm_c_define_gsubr("llvm-build-cond-branch" , 4, 0, 0, SCM_FUNC(llvm_build_cond_branch )); scm_c_define_gsubr("llvm-build-select" , 4, 0, 0, SCM_FUNC(llvm_build_select )); scm_c_define_gsubr("make-llvm-constant" , 2, 0, 0, SCM_FUNC(make_llvm_constant )); scm_c_define_gsubr("llvm-get-type" , 1, 0, 0, SCM_FUNC(llvm_get_type )); scm_c_define_gsubr("llvm-build-load" , 3, 0, 0, SCM_FUNC(llvm_build_load )); scm_c_define_gsubr("llvm-build-store" , 4, 0, 0, SCM_FUNC(llvm_build_store )); scm_c_define_gsubr("llvm-get-param" , 2, 0, 0, SCM_FUNC(llvm_get_param )); scm_c_define_gsubr("llvm-build-neg" , 2, 0, 0, SCM_FUNC(llvm_build_neg )); scm_c_define_gsubr("llvm-build-fneg" , 2, 0, 0, SCM_FUNC(llvm_build_fneg )); scm_c_define_gsubr("llvm-build-not" , 2, 0, 0, SCM_FUNC(llvm_build_not )); scm_c_define_gsubr("llvm-build-add" , 3, 0, 0, SCM_FUNC(llvm_build_add )); scm_c_define_gsubr("llvm-build-fadd" , 3, 0, 0, SCM_FUNC(llvm_build_fadd )); scm_c_define_gsubr("llvm-build-sub" , 3, 0, 0, SCM_FUNC(llvm_build_sub )); scm_c_define_gsubr("llvm-build-fsub" , 3, 0, 0, SCM_FUNC(llvm_build_fsub )); scm_c_define_gsubr("llvm-build-mul" , 3, 0, 0, SCM_FUNC(llvm_build_mul )); scm_c_define_gsubr("llvm-build-fmul" , 3, 0, 0, SCM_FUNC(llvm_build_fmul )); scm_c_define_gsubr("llvm-build-udiv" , 3, 0, 0, SCM_FUNC(llvm_build_udiv )); scm_c_define_gsubr("llvm-build-sdiv" , 3, 0, 0, SCM_FUNC(llvm_build_sdiv )); scm_c_define_gsubr("llvm-build-fdiv" , 3, 0, 0, SCM_FUNC(llvm_build_fdiv )); scm_c_define_gsubr("llvm-build-shl" , 3, 0, 0, SCM_FUNC(llvm_build_shl )); scm_c_define_gsubr("llvm-build-lshr" , 3, 0, 0, SCM_FUNC(llvm_build_lshr )); scm_c_define_gsubr("llvm-build-ashr" , 3, 0, 0, SCM_FUNC(llvm_build_ashr )); scm_c_define_gsubr("llvm-build-urem" , 3, 0, 0, SCM_FUNC(llvm_build_urem )); scm_c_define_gsubr("llvm-build-srem" , 3, 0, 0, SCM_FUNC(llvm_build_srem )); scm_c_define_gsubr("llvm-build-frem" , 3, 0, 0, SCM_FUNC(llvm_build_frem )); scm_c_define_gsubr("llvm-build-and" , 3, 0, 0, SCM_FUNC(llvm_build_and )); scm_c_define_gsubr("llvm-build-or" , 3, 0, 0, SCM_FUNC(llvm_build_or )); scm_c_define_gsubr("llvm-build-xor" , 3, 0, 0, SCM_FUNC(llvm_build_xor )); scm_c_define_gsubr("llvm-build-trunc" , 3, 0, 0, SCM_FUNC(llvm_build_trunc )); scm_c_define_gsubr("llvm-build-sext" , 3, 0, 0, SCM_FUNC(llvm_build_sext )); scm_c_define_gsubr("llvm-build-zext" , 3, 0, 0, SCM_FUNC(llvm_build_zext )); scm_c_define_gsubr("llvm-build-fp-cast" , 3, 0, 0, SCM_FUNC(llvm_build_fp_cast )); scm_c_define_gsubr("llvm-build-fp-to-si" , 3, 0, 0, SCM_FUNC(llvm_build_fp_to_si )); scm_c_define_gsubr("llvm-build-fp-to-ui" , 3, 0, 0, SCM_FUNC(llvm_build_fp_to_ui )); scm_c_define_gsubr("llvm-build-si-to-fp" , 3, 0, 0, SCM_FUNC(llvm_build_si_to_fp )); scm_c_define_gsubr("llvm-build-ui-to-fp" , 3, 0, 0, SCM_FUNC(llvm_build_ui_to_fp )); scm_c_define_gsubr("llvm-build-call" , 6, 0, 0, SCM_FUNC(llvm_build_call )); scm_c_define_gsubr("llvm-build-integer-cmp" , 4, 0, 0, SCM_FUNC(llvm_build_integer_cmp )); scm_c_define_gsubr("llvm-build-float-cmp" , 4, 0, 0, SCM_FUNC(llvm_build_float_cmp )); scm_c_define_gsubr("llvm-build-alloca" , 2, 0, 0, SCM_FUNC(llvm_build_alloca )); scm_c_define_gsubr("llvm-build-phi" , 2, 0, 0, SCM_FUNC(llvm_build_phi )); scm_c_define_gsubr("llvm-add-incoming" , 3, 0, 0, SCM_FUNC(llvm_add_incoming )); }
void gupl_plot_init (void) { static int first = 1; if (first) { port_funcs.read = port_read; port_funcs.write = port_write; port_funcs.seek = port_seek; port_funcs.close = port_close; plparams_tag = scm_make_smob_type ("plparams", sizeof (plPlotterParams *)); scm_set_smob_mark (plparams_tag, mark_plparams); scm_set_smob_free (plparams_tag, free_plparams); scm_set_smob_print (plparams_tag, print_plparams); scm_set_smob_equalp (plparams_tag, equalp_plparams); scm_c_define_gsubr ("plparams?", 1, 0, 0, gupl_is_plparams_p); scm_c_define_gsubr ("newplparams", 0, 0, 0, gupl_newplparams); plotter_tag = scm_make_smob_type ("plotter", sizeof (plPlotter *)); scm_set_smob_mark (plotter_tag, mark_plotter); scm_set_smob_free (plotter_tag, free_plotter); scm_set_smob_print (plotter_tag, print_plotter); scm_set_smob_equalp (plotter_tag, equalp_plotter); scm_c_define_gsubr ("plotter?", 1, 0, 0, gupl_is_plotter_p); scm_c_define_gsubr ("newpl", 4, 0, 0, gupl_newpl); scm_c_define_gsubr ("%alabel!", 4, 0, 0, gupl_alabel_x); scm_c_define_gsubr ("arc!", 7, 0, 0, gupl_arc_x); scm_c_define_gsubr ("arcrel!", 7, 0, 0, gupl_arcrel_x); scm_c_define_gsubr ("bezier2!", 7, 0, 0, gupl_bezier2_x); scm_c_define_gsubr ("bezier2rel!", 7, 0, 0, gupl_bezier2rel_x); scm_c_define_gsubr ("bezier3!", 9, 0, 0, gupl_bezier3_x); scm_c_define_gsubr ("bezier3rel!", 9, 0, 0, gupl_bezier3rel_x); scm_c_define_gsubr ("bgcolor!", 4, 0, 0, gupl_bgcolor_x); scm_c_define_gsubr ("bgcolorname!", 2, 0, 0, gupl_bgcolorname_x); scm_c_define_gsubr ("box!", 5, 0, 0, gupl_box_x); scm_c_define_gsubr ("boxrel!", 5, 0, 0, gupl_boxrel_x); scm_c_define_gsubr ("capmod!", 2, 0, 0, gupl_capmod_x); scm_c_define_gsubr ("circle!", 4, 0, 0, gupl_circle_x); scm_c_define_gsubr ("circlerel!", 4, 0, 0, gupl_circlerel_x); scm_c_define_gsubr ("closepl!", 1, 0, 0, gupl_closepl_x); scm_c_define_gsubr ("color!", 4, 0, 0, gupl_color_x); scm_c_define_gsubr ("colorname!", 2, 0, 0, gupl_colorname_x); scm_c_define_gsubr ("concat!", 7, 0, 0, gupl_concat_x); scm_c_define_gsubr ("cont!", 3, 0, 0, gupl_cont_x); scm_c_define_gsubr ("contrel!", 3, 0, 0, gupl_contrel_x); scm_c_define_gsubr ("ellarc!", 7, 0, 0, gupl_ellarc_x); scm_c_define_gsubr ("ellarcrel!", 7, 0, 0, gupl_ellarcrel_x); scm_c_define_gsubr ("ellipse!", 6, 0, 0, gupl_ellipse_x); scm_c_define_gsubr ("ellipserel!", 6, 0, 0, gupl_ellipserel_x); scm_c_define_gsubr ("endpath!", 1, 0, 0, gupl_endpath_x); scm_c_define_gsubr ("endsubpath!", 1, 0, 0, gupl_endsubpath_x); scm_c_define_gsubr ("erase!", 1, 0, 0, gupl_erase_x); scm_c_define_gsubr ("fillcolor!", 4, 0, 0, gupl_fillcolor_x); scm_c_define_gsubr ("fillcolorname!", 2, 0, 0, gupl_fillcolorname_x); scm_c_define_gsubr ("fillmod!", 2, 0, 0, gupl_fillmod_x); scm_c_define_gsubr ("filltype!", 2, 0, 0, gupl_filltype_x); scm_c_define_gsubr ("flushpl!", 1, 0, 0, gupl_flushpl_x); scm_c_define_gsubr ("fontname!", 2, 0, 0, gupl_fontname_x); scm_c_define_gsubr ("fontsize!", 2, 0, 0, gupl_fontsize_x); scm_c_define_gsubr ("havecap", 2, 0, 0, gupl_havecap); scm_c_define_gsubr ("joinmod!", 2, 0, 0, gupl_joinmod_x); scm_c_define_gsubr ("label!", 2, 0, 0, gupl_label_x); scm_c_define_gsubr ("labelwidth!", 2, 0, 0, gupl_labelwidth_x); scm_c_define_gsubr ("line!", 5, 0, 0, gupl_line_x); scm_c_define_gsubr ("linemod!", 2, 0, 0, gupl_linemod_x); scm_c_define_gsubr ("linerel!", 5, 0, 0, gupl_linerel_x); scm_c_define_gsubr ("linewidth!", 2, 0, 0, gupl_linewidth_x); scm_c_define_gsubr ("marker!", 5, 0, 0, gupl_marker_x); scm_c_define_gsubr ("markerrel!", 5, 0, 0, gupl_markerrel_x); scm_c_define_gsubr ("miterlimit!", 2, 0, 0, gupl_miterlimit_x); scm_c_define_gsubr ("move!", 3, 0, 0, gupl_move_x); scm_c_define_gsubr ("moverel!", 3, 0, 0, gupl_moverel_x); scm_c_define_gsubr ("openpl!", 1, 0, 0, gupl_openpl_x); scm_c_define_gsubr ("orientation!", 2, 0, 0, gupl_orientation_x); scm_c_define_gsubr ("pencolor!", 4, 0, 0, gupl_pencolor_x); scm_c_define_gsubr ("pencolorname!", 2, 0, 0, gupl_pencolorname_x); scm_c_define_gsubr ("pentype!", 2, 0, 0, gupl_pentype_x); scm_c_define_gsubr ("point!", 3, 0, 0, gupl_point_x); scm_c_define_gsubr ("pointrel!", 3, 0, 0, gupl_pointrel_x); scm_c_define_gsubr ("restorestate!", 1, 0, 0, gupl_restorestate_x); scm_c_define_gsubr ("rotate!", 2, 0, 0, gupl_rotate_x); scm_c_define_gsubr ("savestate!", 1, 0, 0, gupl_savestate_x); scm_c_define_gsubr ("scale!", 3, 0, 0, gupl_scale_x); scm_c_define_gsubr ("setmatrix!", 7, 0, 0, gupl_setmatrix_x); scm_c_define_gsubr ("setplparam!", 3, 0, 0, gupl_setplparam_x); scm_c_define_gsubr ("space!", 5, 0, 0, gupl_space_x); scm_c_define_gsubr ("space2!", 7, 0, 0, gupl_space2_x); scm_c_define_gsubr ("textangle!", 2, 0, 0, gupl_textangle_x); scm_c_define_gsubr ("translate!", 3, 0, 0, gupl_translate_x); first = 0; } }