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
29 #include <libgeda/libgeda.h>
31 #include "../include/prototype.h"
33 #ifdef HAVE_LIBDMALLOC
37 #define DEFAULT_BITMAP_DIRECTORY "non-existant"
38 #define DEFAULT_HIERARCHY_NETNAME_SEPARATOR "/"
39 #define DEFAULT_HIERARCHY_NETATTRIB_SEPARATOR "/"
40 #define DEFAULT_HIERARCHY_UREF_SEPARATOR "/"
42 #define INIT_STR(w, name, str) { \
44 (w)->name = g_strdup (((default_ ## name) != NULL) ? \
45 (default_ ## name) : (str)); \
48 int default_hierarchy_uref_mangle
= TRUE
;
49 int default_hierarchy_netname_mangle
= TRUE
;
50 int default_hierarchy_netattrib_mangle
= TRUE
;
51 int default_hierarchy_netattrib_order
= APPEND
;
52 int default_hierarchy_netname_order
= APPEND
;
53 int default_hierarchy_uref_order
= APPEND
;
54 char *default_hierarchy_netname_separator
= NULL
;
55 char *default_hierarchy_netattrib_separator
= NULL
;
56 char *default_hierarchy_uref_separator
= NULL
;
58 void i_vars_set(TOPLEVEL
* pr_current
)
60 i_vars_libgeda_set(pr_current
);
62 pr_current
->hierarchy_uref_mangle
= default_hierarchy_uref_mangle
;
63 pr_current
->hierarchy_netname_mangle
=
64 default_hierarchy_netname_mangle
;
65 pr_current
->hierarchy_netattrib_mangle
=
66 default_hierarchy_netattrib_mangle
;
67 pr_current
->hierarchy_netattrib_order
=
68 default_hierarchy_netattrib_order
;
69 pr_current
->hierarchy_netname_order
= default_hierarchy_netname_order
;
70 pr_current
->hierarchy_uref_order
= default_hierarchy_uref_order
;
72 if (pr_current
->hierarchy_uref_mangle
== FALSE
) {
73 if (pr_current
->hierarchy_uref_separator
) {
74 strcpy(pr_current
->hierarchy_uref_separator
, "/");
76 pr_current
->hierarchy_uref_separator
= g_strdup("/");
80 if (!default_hierarchy_netname_separator
) {
81 default_hierarchy_netname_separator
=
82 g_strdup (DEFAULT_HIERARCHY_NETNAME_SEPARATOR
);
84 if (!default_hierarchy_netattrib_separator
) {
85 default_hierarchy_netattrib_separator
=
86 g_strdup (DEFAULT_HIERARCHY_NETATTRIB_SEPARATOR
);
88 if (!default_hierarchy_uref_separator
) {
89 default_hierarchy_uref_separator
=
90 g_strdup (DEFAULT_HIERARCHY_UREF_SEPARATOR
);
93 INIT_STR(pr_current
, hierarchy_netname_separator
,
94 default_hierarchy_netname_separator
);
95 INIT_STR(pr_current
, hierarchy_netattrib_separator
,
96 default_hierarchy_netattrib_separator
);
97 INIT_STR(pr_current
, hierarchy_uref_separator
,
98 default_hierarchy_uref_separator
);
102 /*! \brief Setup gnetlist default configuration.
103 * \par Function Description
104 * Populate the default configuration context with compiled-in
108 i_vars_init_gnetlist_defaults(void)
110 EdaConfig
*cfg
= eda_config_get_default_context ();
112 /* This is the default name used for nets for which the user has set
113 * no explicit name via the netname= or net= attributes. */
114 eda_config_set_string (cfg
, "gnetlist", "default-net-name", "unnamed_net");
116 /* This is the default name used for buses for which the user has set
117 * no explicit name via the netname= or net= attributes. */
118 eda_config_set_string (cfg
, "gnetlist", "default-bus-name", "unnamed_bus");
120 /* By default, hierarchy processing is enabled. */
121 eda_config_set_boolean (cfg
, "gnetlist", "traverse-hierarchy", TRUE
);
123 /* By default, net= attributes beat netname= attributes. */
124 eda_config_set_string (cfg
, "gnetlist", "net-naming-priority", "net-attribute");