Ejemplo n.º 1
0
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);
	}
Ejemplo n.º 2
0
Archivo: scheme.c Proyecto: nizmic/nwm
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);
}
Ejemplo n.º 3
0
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);
}
Ejemplo n.º 4
0
/* 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"
}
Ejemplo n.º 5
0
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);
}
Ejemplo n.º 6
0
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);
}
Ejemplo n.º 7
0
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);
}
Ejemplo n.º 8
0
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);
}
Ejemplo n.º 9
0
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);
}
Ejemplo n.º 10
0
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());
	}
Ejemplo n.º 11
0
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;
    }
}