gnetlist

g_register.c

Go to the documentation of this file.
00001 /* gEDA - GPL Electronic Design Automation
00002  * gnetlist - gEDA Netlist
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 
00023 #include <stdio.h>
00024 #include <sys/stat.h>
00025 #ifdef HAVE_STDLIB_H
00026 #include <stdlib.h>
00027 #endif
00028 #ifdef HAVE_ASSERT_H
00029 #include <assert.h>
00030 #endif
00031 #ifdef HAVE_UNISTD_H
00032 #include <unistd.h>
00033 #endif
00034 
00035 #include <libgeda/libgeda.h>
00036 
00037 #include "../include/globals.h"
00038 #include "../include/prototype.h"
00039 
00040 #ifdef HAVE_LIBDMALLOC
00041 #include <dmalloc.h>
00042 #endif
00043 
00044 
00045 struct gsubr_t {
00046   char* name;
00047   int req;
00048   int opt;
00049   int rst;
00050   SCM (*fnc)();
00051 };
00052 
00053 static struct gsubr_t gnetlist_funcs[] = {
00054   { "quit",                         0, 0, 0, g_quit },
00055   { "exit",                         0, 0, 0, g_quit },
00056 
00057   /* gnetlistrc functions */
00058   { "gnetlist-version",             1, 0, 0, g_rc_gnetlist_version },
00059     
00060   { "net-naming-priority",          1, 0, 0, g_rc_net_naming_priority },
00061   { "hierarchy-traversal",          1, 0, 0, g_rc_hierarchy_traversal },
00062   { "hierarchy-uref-mangle",        1, 0, 0, g_rc_hierarchy_uref_mangle },
00063   { "hierarchy-netname-mangle",     1, 0, 0, g_rc_hierarchy_netname_mangle },
00064   { "hierarchy-netattrib-mangle",   1, 0, 0, g_rc_hierarchy_netattrib_mangle },
00065   { "hierarchy-uref-separator",     1, 0, 0, g_rc_hierarchy_uref_separator },
00066   { "hierarchy-netname-separator",  1, 0, 0, g_rc_hierarchy_netname_separator },
00067   { "hierarchy-netattrib-separator", 1, 0, 0, g_rc_hierarchy_netattrib_separator },
00068   { "hierarchy-netattrib-order",    1, 0, 0, g_rc_hierarchy_netattrib_order },
00069   { "hierarchy-netname-order",      1, 0, 0, g_rc_hierarchy_netname_order },
00070   { "hierarchy-uref-order",         1, 0, 0, g_rc_hierarchy_uref_order },
00071   { "unnamed-netname",              1, 0, 0, g_rc_unnamed_netname },
00072   { "unnamed-busname",              1, 0, 0, g_rc_unnamed_busname },
00073 
00074   /* netlist functions */
00075   { "gnetlist:get-packages",        1, 0, 0, g_get_packages },
00076   { "gnetlist:get-non-unique-packages", 1, 0, 0, g_get_non_unique_packages },
00077   { "gnetlist:get-pins",            1, 0, 0, g_get_pins },
00078   { "gnetlist:get-all-nets",        1, 0, 0, g_get_all_nets },
00079   { "gnetlist:get-all-unique-nets", 1, 0, 0, g_get_all_unique_nets },
00080   { "gnetlist:get-all-connections", 1, 0, 0, g_get_all_connections },
00081   { "gnetlist:get-nets",            2, 0, 0, g_get_nets },
00082   { "gnetlist:get-pins-nets",       1, 0, 0, g_get_pins_nets },
00083 
00084   { "gnetlist:get-all-package-attributes", 2, 0, 0, g_get_all_package_attributes },
00085   { "gnetlist:get-toplevel-attribute", 1, 0, 0, g_get_toplevel_attribute },
00086   /* { "gnetlist:set-netlist-mode", 1, 0, 0, g_set_netlist_mode }, no longer needed */
00087   { "gnetlist:get-renamed-nets",    1, 0, 0, g_get_renamed_nets },
00088   { "gnetlist:get-attribute-by-pinseq",    3, 0, 0, g_get_attribute_by_pinseq },
00089   { "gnetlist:get-attribute-by-pinnumber", 3, 0, 0, g_get_attribute_by_pinnumber },
00090   { "gnetlist:vams-get-package-attributes", 1, 0, 0, vams_get_package_attributes },
00091 
00092   { "gnetlist:graphical-objs-in-net-with-attrib-get-attrib",    
00093     3, 0, 0, g_graphical_objs_in_net_with_attrib_get_attrib },
00094 
00095   /* SDB -- 9.1.2003 */
00096   { "gnetlist:get-backend-arguments", 0, 0, 0, g_get_backend_arguments },
00097   { "gnetlist:get-input-files",     0, 0, 0, g_get_input_files },
00098   { NULL,                           0, 0, 0, NULL } };
00099 
00100 
00101 void g_register_funcs(void)
00102 {
00103   struct gsubr_t *tmp = gnetlist_funcs;
00104   
00105   while (tmp->name != NULL) {
00106     scm_c_define_gsubr (tmp->name, tmp->req, tmp->opt, tmp->rst, tmp->fnc);
00107     tmp++;
00108   }
00109 
00110 }
00111 
00112 SCM g_quit(void)
00113 {
00114     gnetlist_quit();
00115     exit(0);
00116 }
 All Data Structures Files Functions Variables Defines