missing NULL terminator in set_config_x
[geda-gaf.git] / gnetlist-legacy / src / g_rc.c
blobfbf38d0d7329e08adf98d7e73e9ea7c0f3d82035
1 /* gEDA - GPL Electronic Design Automation
2 * gnetlist - gEDA Netlist
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
21 #include <config.h>
22 #include <version.h>
24 #include <stdio.h>
25 #include <ctype.h>
26 #include <sys/stat.h>
27 #ifdef HAVE_STRING_H
28 #include <string.h>
29 #endif
30 #ifdef HAVE_STDLIB_H
31 #include <stdlib.h>
32 #endif
33 #ifdef HAVE_UNISTD_H
34 #include <unistd.h>
35 #endif
37 #include <libgeda/libgeda.h>
39 #include "../include/globals.h"
40 #include "../include/i_vars.h"
41 #include "../include/prototype.h"
42 #include "../include/gettext.h"
44 SCM g_rc_gnetlist_version(SCM scm_version)
46 char *version;
47 SCM ret = SCM_BOOL_T;
49 SCM_ASSERT (scm_is_string (scm_version), scm_version,
50 SCM_ARG1, "gnetlist-version");
52 version = scm_to_utf8_string (scm_version);
53 if (strcmp (version, PACKAGE_DATE_VERSION) != 0) {
54 fprintf(stderr, _(
55 "You are running gEDA/gaf version [%s%s.%s],\n"
56 "but you have a version [%s] gnetlistrc file:\n[%s]\n"
57 "Please be sure that you have the latest rc file.\n"),
58 PREPEND_VERSION_STRING, PACKAGE_DOTTED_VERSION,
59 PACKAGE_DATE_VERSION, version, rc_filename);
60 ret = SCM_BOOL_F;
63 free (version);
64 return ret;
68 SCM g_rc_net_naming_priority(SCM mode)
70 static const vstbl_entry mode_table[] = {
71 {NETATTRIB_ATTRIBUTE, "netattrib"},
72 {NETNAME_ATTRIBUTE, "netname"}
75 RETURN_G_RC_MODE("net-naming-priority", default_net_naming_priority,
76 2);
79 SCM g_rc_hierarchy_traversal(SCM mode)
81 static const vstbl_entry mode_table[] = {
82 {TRUE, "enabled"},
83 {FALSE, "disabled"}
86 RETURN_G_RC_MODE("hierarchy-traversal", default_hierarchy_traversal,
87 2);
90 SCM g_rc_hierarchy_uref_mangle(SCM mode)
92 static const vstbl_entry mode_table[] = {
93 {TRUE, "enabled"},
94 {FALSE, "disabled"}
97 RETURN_G_RC_MODE("hierarchy-uref-mangle",
98 default_hierarchy_uref_mangle, 2);
101 SCM g_rc_hierarchy_netname_mangle(SCM mode)
103 static const vstbl_entry mode_table[] = {
104 {TRUE, "enabled"},
105 {FALSE, "disabled"}
108 RETURN_G_RC_MODE("hierarchy-netname-mangle",
109 default_hierarchy_netname_mangle, 2);
112 SCM g_rc_hierarchy_netattrib_mangle(SCM mode)
114 static const vstbl_entry mode_table[] = {
115 {TRUE, "enabled"},
116 {FALSE, "disabled"}
119 RETURN_G_RC_MODE("hierarchy-netattrib-mangle",
120 default_hierarchy_netattrib_mangle, 2);
123 static char *
124 g_strdup_scm_string(SCM scm_s)
126 char *s, *ret;
128 s = scm_to_utf8_string (scm_s);
129 ret = g_strdup (s);
130 free (s);
131 return ret;
134 SCM g_rc_hierarchy_netname_separator(SCM name)
136 SCM_ASSERT (scm_is_string (name), name,
137 SCM_ARG1, "hierarchy-netname-separator");
139 g_free(default_hierarchy_netname_separator);
141 default_hierarchy_netname_separator = g_strdup_scm_string (name);
143 return SCM_BOOL_T;
146 SCM g_rc_hierarchy_netattrib_separator(SCM name)
148 SCM_ASSERT (scm_is_string (name), name,
149 SCM_ARG1, "hierarchy-netattrib-separator");
151 g_free(default_hierarchy_netattrib_separator);
153 default_hierarchy_netattrib_separator = g_strdup_scm_string (name);
155 return SCM_BOOL_T;
158 SCM g_rc_hierarchy_uref_separator(SCM name)
160 SCM_ASSERT (scm_is_string (name), name,
161 SCM_ARG1, "hierarchy-uref-separator");
163 g_free(default_hierarchy_uref_separator);
165 default_hierarchy_uref_separator = g_strdup_scm_string (name);
167 return SCM_BOOL_T;
170 SCM g_rc_hierarchy_netattrib_order(SCM mode)
172 static const vstbl_entry mode_table[] = {
173 {PREPEND, "prepend"},
174 {APPEND, "append"}
177 RETURN_G_RC_MODE("hierarchy-netattrib-order",
178 default_hierarchy_netattrib_order, 2);
181 SCM g_rc_hierarchy_netname_order(SCM mode)
183 static const vstbl_entry mode_table[] = {
184 {PREPEND, "prepend"},
185 {APPEND, "append"}
188 RETURN_G_RC_MODE("hierarchy-netname-order",
189 default_hierarchy_netname_order, 2);
192 SCM g_rc_hierarchy_uref_order(SCM mode)
194 static const vstbl_entry mode_table[] = {
195 {PREPEND, "prepend"},
196 {APPEND, "append"}
199 RETURN_G_RC_MODE("hierarchy-uref-order",
200 default_hierarchy_uref_order, 2);
203 SCM g_rc_unnamed_netname(SCM name)
205 SCM_ASSERT (scm_is_string (name), name,
206 SCM_ARG1, "unamed-netname");
208 g_free(default_unnamed_netname);
210 default_unnamed_netname = g_strdup_scm_string (name);
212 return SCM_BOOL_T;
215 SCM g_rc_unnamed_busname(SCM name)
217 SCM_ASSERT (scm_is_string (name), name,
218 SCM_ARG1, "unamed-busname");
220 g_free(default_unnamed_busname);
222 default_unnamed_busname = g_strdup_scm_string (name);
224 return SCM_BOOL_T;
228 /*************************** GUILE end done *********************************/