gnetlist
|
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 #include <missing.h> 00023 #include <version.h> 00024 00025 #include <stdio.h> 00026 #include <ctype.h> 00027 #include <sys/stat.h> 00028 #ifdef HAVE_STRING_H 00029 #include <string.h> 00030 #endif 00031 #ifdef HAVE_STDLIB_H 00032 #include <stdlib.h> 00033 #endif 00034 #ifdef HAVE_UNISTD_H 00035 #include <unistd.h> 00036 #endif 00037 00038 #include <libgeda/libgeda.h> 00039 00040 #include "../include/globals.h" 00041 #include "../include/i_vars.h" 00042 #include "../include/prototype.h" 00043 00044 #ifdef HAVE_LIBDMALLOC 00045 #include <dmalloc.h> 00046 #endif 00047 00048 SCM g_rc_gnetlist_version(SCM scm_version) 00049 { 00050 char *version; 00051 SCM ret = SCM_BOOL_T; 00052 00053 SCM_ASSERT (scm_is_string (scm_version), scm_version, 00054 SCM_ARG1, "gnetlist-version"); 00055 00056 version = scm_to_utf8_string (scm_version); 00057 if (strcmp (version, PACKAGE_DATE_VERSION) != 0) { 00058 fprintf(stderr, 00059 "You are running gEDA/gaf version [%s%s.%s],\n", 00060 PREPEND_VERSION_STRING, PACKAGE_DOTTED_VERSION, 00061 PACKAGE_DATE_VERSION); 00062 fprintf(stderr, 00063 "but you have a version [%s] gnetlistrc file:\n[%s]\n", 00064 version, rc_filename); 00065 fprintf(stderr, 00066 "Please be sure that you have the latest rc file.\n"); 00067 ret = SCM_BOOL_F; 00068 } 00069 00070 free (version); 00071 return ret; 00072 } 00073 00074 00075 SCM g_rc_net_naming_priority(SCM mode) 00076 { 00077 static const vstbl_entry mode_table[] = { 00078 {NETATTRIB_ATTRIBUTE, "netattrib"}, 00079 {NETNAME_ATTRIBUTE, "netname"} 00080 }; 00081 00082 RETURN_G_RC_MODE("net-naming-priority", default_net_naming_priority, 00083 2); 00084 } 00085 00086 SCM g_rc_hierarchy_traversal(SCM mode) 00087 { 00088 static const vstbl_entry mode_table[] = { 00089 {TRUE, "enabled"}, 00090 {FALSE, "disabled"} 00091 }; 00092 00093 RETURN_G_RC_MODE("hierarchy-traversal", default_hierarchy_traversal, 00094 2); 00095 } 00096 00097 SCM g_rc_hierarchy_uref_mangle(SCM mode) 00098 { 00099 static const vstbl_entry mode_table[] = { 00100 {TRUE, "enabled"}, 00101 {FALSE, "disabled"} 00102 }; 00103 00104 RETURN_G_RC_MODE("hierarchy-uref-mangle", 00105 default_hierarchy_uref_mangle, 2); 00106 } 00107 00108 SCM g_rc_hierarchy_netname_mangle(SCM mode) 00109 { 00110 static const vstbl_entry mode_table[] = { 00111 {TRUE, "enabled"}, 00112 {FALSE, "disabled"} 00113 }; 00114 00115 RETURN_G_RC_MODE("hierarchy-netname-mangle", 00116 default_hierarchy_netname_mangle, 2); 00117 } 00118 00119 SCM g_rc_hierarchy_netattrib_mangle(SCM mode) 00120 { 00121 static const vstbl_entry mode_table[] = { 00122 {TRUE, "enabled"}, 00123 {FALSE, "disabled"} 00124 }; 00125 00126 RETURN_G_RC_MODE("hierarchy-netattrib-mangle", 00127 default_hierarchy_netattrib_mangle, 2); 00128 } 00129 00130 static char * 00131 g_strdup_scm_string(SCM scm_s) 00132 { 00133 char *s, *ret; 00134 00135 s = scm_to_utf8_string (scm_s); 00136 ret = g_strdup (s); 00137 free (s); 00138 return ret; 00139 } 00140 00141 SCM g_rc_hierarchy_netname_separator(SCM name) 00142 { 00143 SCM_ASSERT (scm_is_string (name), name, 00144 SCM_ARG1, "hierarchy-netname-separator"); 00145 00146 g_free(default_hierarchy_netname_separator); 00147 00148 default_hierarchy_netname_separator = g_strdup_scm_string (name); 00149 00150 return SCM_BOOL_T; 00151 } 00152 00153 SCM g_rc_hierarchy_netattrib_separator(SCM name) 00154 { 00155 SCM_ASSERT (scm_is_string (name), name, 00156 SCM_ARG1, "hierarchy-netattrib-separator"); 00157 00158 g_free(default_hierarchy_netattrib_separator); 00159 00160 default_hierarchy_netattrib_separator = g_strdup_scm_string (name); 00161 00162 return SCM_BOOL_T; 00163 } 00164 00165 SCM g_rc_hierarchy_uref_separator(SCM name) 00166 { 00167 SCM_ASSERT (scm_is_string (name), name, 00168 SCM_ARG1, "hierarchy-uref-separator"); 00169 00170 g_free(default_hierarchy_uref_separator); 00171 00172 default_hierarchy_uref_separator = g_strdup_scm_string (name); 00173 00174 return SCM_BOOL_T; 00175 } 00176 00177 SCM g_rc_hierarchy_netattrib_order(SCM mode) 00178 { 00179 static const vstbl_entry mode_table[] = { 00180 {PREPEND, "prepend"}, 00181 {APPEND, "append"} 00182 }; 00183 00184 RETURN_G_RC_MODE("hierarchy-netattrib-order", 00185 default_hierarchy_netattrib_order, 2); 00186 } 00187 00188 SCM g_rc_hierarchy_netname_order(SCM mode) 00189 { 00190 static const vstbl_entry mode_table[] = { 00191 {PREPEND, "prepend"}, 00192 {APPEND, "append"} 00193 }; 00194 00195 RETURN_G_RC_MODE("hierarchy-netname-order", 00196 default_hierarchy_netname_order, 2); 00197 } 00198 00199 SCM g_rc_hierarchy_uref_order(SCM mode) 00200 { 00201 static const vstbl_entry mode_table[] = { 00202 {PREPEND, "prepend"}, 00203 {APPEND, "append"} 00204 }; 00205 00206 RETURN_G_RC_MODE("hierarchy-uref-order", 00207 default_hierarchy_uref_order, 2); 00208 } 00209 00210 SCM g_rc_unnamed_netname(SCM name) 00211 { 00212 SCM_ASSERT (scm_is_string (name), name, 00213 SCM_ARG1, "unamed-netname"); 00214 00215 g_free(default_unnamed_netname); 00216 00217 default_unnamed_netname = g_strdup_scm_string (name); 00218 00219 return SCM_BOOL_T; 00220 } 00221 00222 SCM g_rc_unnamed_busname(SCM name) 00223 { 00224 SCM_ASSERT (scm_is_string (name), name, 00225 SCM_ARG1, "unamed-busname"); 00226 00227 g_free(default_unnamed_busname); 00228 00229 default_unnamed_busname = g_strdup_scm_string (name); 00230 00231 return SCM_BOOL_T; 00232 } 00233 00234 00235 /*************************** GUILE end done *********************************/ 00236