Bump gEDA version
[geda-gaf.git] / gschem / src / g_register.c
blob0b7146ff6d46d7ab4f1ae2acdf9be25dc7f6f90b
1 /* gEDA - GPL Electronic Design Automation
2 * gschem - gEDA Schematic Capture
3 * Copyright (C) 1998-2010 Ales Hvezda
4 * Copyright (C) 1998-2020 gEDA Contributors (see ChangeLog for details)
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 #include <config.h>
22 #include <stdio.h>
23 #include <sys/stat.h>
24 #ifdef HAVE_STDLIB_H
25 #include <stdlib.h>
26 #endif
27 #ifdef HAVE_ASSERT_H
28 #include <assert.h>
29 #endif
30 #ifdef HAVE_UNISTD_H
31 #include <unistd.h>
32 #endif
34 #include "gschem.h"
36 /*! \brief */
37 struct gsubr_t {
38 char* name;
39 int req;
40 int opt;
41 int rst;
42 SCM (*fnc)();
45 /*! \brief */
46 static struct gsubr_t gschem_funcs[] = {
47 /* rc file */
48 { "gschem-version", 1, 0, 0, g_rc_gschem_version },
50 { "display-color-map", 0, 1, 0, g_rc_display_color_map },
51 { "display-outline-color-map", 0, 1, 0, g_rc_display_outline_color_map },
53 { "net-direction-mode", 1, 0, 0, g_rc_net_direction_mode },
54 { "net-selection-mode", 1, 0, 0, g_rc_net_selection_mode },
55 { "zoom-with-pan", 1, 0, 0, g_rc_zoom_with_pan },
56 { "action-feedback-mode", 1, 0, 0, g_rc_action_feedback_mode },
57 { "scrollbars", 1, 0, 0, g_rc_scrollbars },
58 { "embed-components", 1, 0, 0, g_rc_embed_components },
59 { "logging", 1, 0, 0, g_rc_logging },
60 { "text-size", 1, 0, 0, g_rc_text_size },
61 { "snap-size", 1, 0, 0, g_rc_snap_size },
63 { "text-caps-style", 1, 0, 0, g_rc_text_caps_style },
64 { "logging-destination", 1, 0, 0, g_rc_logging_destination },
66 { "attribute-name", 1, 0, 0, g_rc_attribute_name },
68 { "image-color", 1, 0, 0, g_rc_image_color },
69 { "image-size", 2, 0, 0, g_rc_image_size },
70 { "log-window", 1, 0, 0, g_rc_log_window },
71 { "log-window-type", 1, 0, 0, g_rc_log_window_type },
72 { "third-button", 1, 0, 0, g_rc_third_button },
73 { "third-button-cancel", 1, 0, 0, g_rc_third_button_cancel },
74 { "middle-button", 1, 0, 0, g_rc_middle_button },
75 { "scroll-wheel", 1, 0, 0, g_rc_scroll_wheel },
76 { "net-consolidate", 1, 0, 0, g_rc_net_consolidate },
77 { "file-preview", 1, 0, 0, g_rc_file_preview },
78 { "enforce-hierarchy", 1, 0, 0, g_rc_enforce_hierarchy },
79 { "fast-mousepan", 1, 0, 0, g_rc_fast_mousepan },
80 { "raise-dialog-boxes-on-expose", 1, 0, 0, g_rc_raise_dialog_boxes_on_expose },
81 { "continue-component-place", 1, 0, 0, g_rc_continue_component_place },
82 { "undo-levels", 1, 0, 0, g_rc_undo_levels },
83 { "undo-control", 1, 0, 0, g_rc_undo_control },
84 { "undo-type", 1, 0, 0, g_rc_undo_type },
85 { "undo-panzoom", 1, 0, 0, g_rc_undo_panzoom },
87 { "draw-grips", 1, 0, 0, g_rc_draw_grips },
88 { "netconn-rubberband", 1, 0, 0, g_rc_netconn_rubberband },
89 { "magnetic-net-mode", 1, 0, 0, g_rc_magnetic_net_mode },
90 { "window-size", 2, 0, 0, g_rc_window_size },
91 { "warp-cursor", 1, 0, 0, g_rc_warp_cursor },
92 { "toolbars", 1, 0, 0, g_rc_toolbars },
93 { "handleboxes", 1, 0, 0, g_rc_handleboxes },
94 { "bus-ripper-size", 1, 0, 0, g_rc_bus_ripper_size },
95 { "bus-ripper-type", 1, 0, 0, g_rc_bus_ripper_type },
96 { "bus-ripper-rotation", 1, 0, 0, g_rc_bus_ripper_rotation },
97 { "force-boundingbox", 1, 0, 0, g_rc_force_boundingbox },
98 { "grid-mode", 1, 0, 0, g_rc_grid_mode },
99 { "dots-grid-dot-size", 1, 0, 0, g_rc_dots_grid_dot_size },
100 { "dots-grid-mode", 1, 0, 0, g_rc_dots_grid_mode },
101 { "dots-grid-fixed-threshold", 1, 0, 0, g_rc_dots_grid_fixed_threshold },
102 { "mesh-grid-display-threshold", 1, 0, 0, g_rc_mesh_grid_display_threshold },
103 { "add-attribute-offset", 1, 0, 0, g_rc_add_attribute_offset },
104 { "mousepan-gain", 1, 0, 0, g_rc_mousepan_gain },
105 { "keyboardpan-gain", 1, 0, 0, g_rc_keyboardpan_gain },
106 { "select-slack-pixels", 1, 0, 0, g_rc_select_slack_pixels },
107 { "zoom-gain", 1, 0, 0, g_rc_zoom_gain },
108 { "scrollpan-steps", 1, 0, 0, g_rc_scrollpan_steps },
110 /* backup functions */
111 { "auto-save-interval", 1, 0, 0, g_rc_auto_save_interval },
113 /* general guile functions */
114 { "gschem-pdf", 1, 0, 0, g_funcs_pdf },
115 { "gschem-image", 1, 0, 0, g_funcs_image },
116 { "gschem-use-rc-values", 0, 0, 0, g_funcs_use_rc_values },
117 { "gschem-exit", 0, 0, 0, g_funcs_exit },
118 { "gschem-log", 1, 0, 0, g_funcs_log },
119 { "gschem-msg", 1, 0, 0, g_funcs_msg },
120 { "gschem-confirm", 1, 0, 0, g_funcs_confirm },
121 { "gschem-filesel", 2, 0, 1, g_funcs_filesel },
123 { NULL, 0, 0, 0, NULL } };
125 /*! \brief Define a hook.
126 * \par Function Description
127 * Creates a Guile new hook with \a n_args arguments, and binds it to
128 * the variable \a name, returning the newly created hook.
130 * \param n_args Number of arguments the hook should take.
131 * \param name Name of variable to bind the hook to.
133 * \return the newly-created hook.
135 static SCM
136 create_hook (const char *name, int n_args)
138 SCM hook = scm_make_hook (scm_from_int (n_args));
139 scm_c_define (name, hook);
140 return scm_permanent_object (hook);
143 /*! \brief Register function with Scheme.
144 * \par Function Description
145 * Creates <B>subr</B> objects to make <B>g_rc_*</B> functions that are defined * #g_rc.c and #g_funcs.c visible to Scheme.
147 void g_register_funcs (void)
149 struct gsubr_t *tmp = gschem_funcs;
151 while (tmp->name != NULL) {
152 scm_c_define_gsubr (tmp->name, tmp->req, tmp->opt, tmp->rst, tmp->fnc);
153 tmp++;
156 /* Hook stuff */
157 complex_place_list_changed_hook = create_hook ("complex-place-list-changed-hook", 1);