gsch2pcb: Make --m4-file and -m4-pcbdir arguments work again.
[geda-gaf/peter-b.git] / gnetlist / src / g_rc.c
blob3114e04ee8657a92ac659627d53c0a46fdc8720c
1 /* gEDA - GPL Electronic Design Automation
2 * gnetlist - gEDA Netlist
3 * Copyright (C) 1998-2010 Ales Hvezda
4 * Copyright (C) 1998-2010 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
21 #include <config.h>
22 #include <missing.h>
23 #include <version.h>
25 #include <stdio.h>
26 #include <ctype.h>
27 #include <sys/stat.h>
28 #ifdef HAVE_STRING_H
29 #include <string.h>
30 #endif
31 #ifdef HAVE_STDLIB_H
32 #include <stdlib.h>
33 #endif
34 #ifdef HAVE_UNISTD_H
35 #include <unistd.h>
36 #endif
38 #include <libgeda/libgeda.h>
40 #include "../include/globals.h"
41 #include "../include/i_vars.h"
42 #include "../include/prototype.h"
44 #ifdef HAVE_LIBDMALLOC
45 #include <dmalloc.h>
46 #endif
48 SCM g_rc_gnetlist_version(SCM scm_version)
50 char *version;
51 SCM ret = SCM_BOOL_T;
53 SCM_ASSERT (scm_is_string (scm_version), scm_version,
54 SCM_ARG1, "gnetlist-version");
56 version = scm_to_utf8_string (scm_version);
57 if (strcmp (version, PACKAGE_DATE_VERSION) != 0) {
58 fprintf(stderr,
59 "You are running gEDA/gaf version [%s%s.%s],\n",
60 PREPEND_VERSION_STRING, PACKAGE_DOTTED_VERSION,
61 PACKAGE_DATE_VERSION);
62 fprintf(stderr,
63 "but you have a version [%s] gnetlistrc file:\n[%s]\n",
64 version, rc_filename);
65 fprintf(stderr,
66 "Please be sure that you have the latest rc file.\n");
67 ret = SCM_BOOL_F;
70 free (version);
71 return ret;
75 SCM g_rc_net_naming_priority(SCM mode)
77 static const vstbl_entry mode_table[] = {
78 {NETATTRIB_ATTRIBUTE, "netattrib"},
79 {NETNAME_ATTRIBUTE, "netname"}
82 RETURN_G_RC_MODE("net-naming-priority", default_net_naming_priority,
83 2);
86 SCM g_rc_hierarchy_traversal(SCM mode)
88 static const vstbl_entry mode_table[] = {
89 {TRUE, "enabled"},
90 {FALSE, "disabled"}
93 RETURN_G_RC_MODE("hierarchy-traversal", default_hierarchy_traversal,
94 2);
97 SCM g_rc_hierarchy_uref_mangle(SCM mode)
99 static const vstbl_entry mode_table[] = {
100 {TRUE, "enabled"},
101 {FALSE, "disabled"}
104 RETURN_G_RC_MODE("hierarchy-uref-mangle",
105 default_hierarchy_uref_mangle, 2);
108 SCM g_rc_hierarchy_netname_mangle(SCM mode)
110 static const vstbl_entry mode_table[] = {
111 {TRUE, "enabled"},
112 {FALSE, "disabled"}
115 RETURN_G_RC_MODE("hierarchy-netname-mangle",
116 default_hierarchy_netname_mangle, 2);
119 SCM g_rc_hierarchy_netattrib_mangle(SCM mode)
121 static const vstbl_entry mode_table[] = {
122 {TRUE, "enabled"},
123 {FALSE, "disabled"}
126 RETURN_G_RC_MODE("hierarchy-netattrib-mangle",
127 default_hierarchy_netattrib_mangle, 2);
130 static char *
131 g_strdup_scm_string(SCM scm_s)
133 char *s, *ret;
135 s = scm_to_utf8_string (scm_s);
136 ret = g_strdup (s);
137 free (s);
138 return ret;
141 SCM g_rc_hierarchy_netname_separator(SCM name)
143 SCM_ASSERT (scm_is_string (name), name,
144 SCM_ARG1, "hierarchy-netname-separator");
146 g_free(default_hierarchy_netname_separator);
148 default_hierarchy_netname_separator = g_strdup_scm_string (name);
150 return SCM_BOOL_T;
153 SCM g_rc_hierarchy_netattrib_separator(SCM name)
155 SCM_ASSERT (scm_is_string (name), name,
156 SCM_ARG1, "hierarchy-netattrib-separator");
158 g_free(default_hierarchy_netattrib_separator);
160 default_hierarchy_netattrib_separator = g_strdup_scm_string (name);
162 return SCM_BOOL_T;
165 SCM g_rc_hierarchy_uref_separator(SCM name)
167 SCM_ASSERT (scm_is_string (name), name,
168 SCM_ARG1, "hierarchy-uref-separator");
170 g_free(default_hierarchy_uref_separator);
172 default_hierarchy_uref_separator = g_strdup_scm_string (name);
174 return SCM_BOOL_T;
177 SCM g_rc_hierarchy_netattrib_order(SCM mode)
179 static const vstbl_entry mode_table[] = {
180 {PREPEND, "prepend"},
181 {APPEND, "append"}
184 RETURN_G_RC_MODE("hierarchy-netattrib-order",
185 default_hierarchy_netattrib_order, 2);
188 SCM g_rc_hierarchy_netname_order(SCM mode)
190 static const vstbl_entry mode_table[] = {
191 {PREPEND, "prepend"},
192 {APPEND, "append"}
195 RETURN_G_RC_MODE("hierarchy-netname-order",
196 default_hierarchy_netname_order, 2);
199 SCM g_rc_hierarchy_uref_order(SCM mode)
201 static const vstbl_entry mode_table[] = {
202 {PREPEND, "prepend"},
203 {APPEND, "append"}
206 RETURN_G_RC_MODE("hierarchy-uref-order",
207 default_hierarchy_uref_order, 2);
210 SCM g_rc_unnamed_netname(SCM name)
212 SCM_ASSERT (scm_is_string (name), name,
213 SCM_ARG1, "unamed-netname");
215 g_free(default_unnamed_netname);
217 default_unnamed_netname = g_strdup_scm_string (name);
219 return SCM_BOOL_T;
222 SCM g_rc_unnamed_busname(SCM name)
224 SCM_ASSERT (scm_is_string (name), name,
225 SCM_ARG1, "unamed-busname");
227 g_free(default_unnamed_busname);
229 default_unnamed_busname = g_strdup_scm_string (name);
231 return SCM_BOOL_T;
235 /*************************** GUILE end done *********************************/