libgeda

g_register.c

Go to the documentation of this file.
00001 /* gEDA - GPL Electronic Design Automation
00002  * libgeda - gEDA's library
00003  * Copyright (C) 1998-2010 Ales Hvezda
00004  * Copyright (C) 1998-2010 gEDA Contributors (see ChangeLog for details)
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00019  */
00020 
00021 #include <config.h>
00022 #include <missing.h>
00023 
00024 #include <stdio.h>
00025 #include <sys/stat.h>
00026 #ifdef HAVE_STDLIB_H
00027 #include <stdlib.h>
00028 #endif
00029 #ifdef HAVE_UNISTD_H
00030 #include <unistd.h>
00031 #endif
00032 
00033 #include "libgeda_priv.h"
00034 
00035 #ifdef HAVE_LIBDMALLOC
00036 #include <dmalloc.h>
00037 #endif
00038 
00040 struct gsubr_t {
00041   char* name;
00042   int req;
00043   int opt;
00044   int rst;
00045   SCM (*fnc)();
00046 };
00047 
00049 static struct gsubr_t libgeda_funcs[] = {
00050   { "eval-protected",           1, 1, 0, g_scm_eval_protected },
00051   { "eval-string-protected",    1, 0, 0, g_scm_eval_string_protected },
00052 
00053   { "component-library",        1, 1, 0, g_rc_component_library },
00054   { "component-library-command", 3, 0, 0, g_rc_component_library_command },
00055   { "component-library-funcs",  3, 0, 0, g_rc_component_library_funcs },
00056   { "source-library",           1, 0, 0, g_rc_source_library },
00057   { "source-library-search",    1, 0, 0, g_rc_source_library_search },
00058   
00059   { "world-size",               3, 0, 0, g_rc_world_size },
00060   
00061   { "reset-component-library",  0, 0, 0, g_rc_reset_component_library },
00062   { "reset-source-library",     0, 0, 0, g_rc_reset_source_library },
00063   
00064   { "untitled-name",            1, 0, 0, g_rc_untitled_name },
00065   { "scheme-directory",         1, 0, 0, g_rc_scheme_directory },
00066   { "bitmap-directory",         1, 0, 0, g_rc_bitmap_directory },
00067   { "bus-ripper-symname",       1, 0, 0, g_rc_bus_ripper_symname },
00068   { "postscript-prolog",        1, 0, 0, g_rc_postscript_prolog },
00069   { "attribute-promotion",       1, 0, 0, g_rc_attribute_promotion },
00070   { "promote-invisible",         1, 0, 0, g_rc_promote_invisible },
00071   { "keep-invisible",            1, 0, 0, g_rc_keep_invisible },
00072   { "always-promote-attributes",1, 0, 0, g_rc_always_promote_attributes },
00073   { "make-backup-files",        1, 0, 0, g_rc_make_backup_files },
00074   { "print-color-map", 0, 1, 0, g_rc_print_color_map },
00075   { "rc-filename",              0, 0, 0, g_rc_rc_filename },
00076   { NULL,                       0, 0, 0, NULL } };
00077 
00083 void g_register_libgeda_funcs (void)
00084 {
00085   struct gsubr_t *tmp = libgeda_funcs;
00086   
00087   while (tmp->name != NULL) {
00088     scm_c_define_gsubr (tmp->name, tmp->req, tmp->opt, tmp->rst, tmp->fnc);
00089     tmp++;
00090   }
00091   
00092 }
00093 
00099 void
00100 g_register_libgeda_dirs (void)
00101 {
00102   char *scheme_dir;
00103 
00104   scheme_dir = g_build_filename (s_path_sys_data (), "scheme", NULL);
00105   g_rc_scheme_directory (scm_from_utf8_string (scheme_dir));
00106   g_free (scheme_dir);
00107 }
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines