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
29 #include <libgeda/libgeda.h>
31 #include "../include/prototype.h"
33 #define DEFAULT_BITMAP_DIRECTORY "non-existant"
34 #define DEFAULT_HIERARCHY_NETNAME_SEPARATOR "/"
35 #define DEFAULT_HIERARCHY_NETATTRIB_SEPARATOR "/"
36 #define DEFAULT_HIERARCHY_UREF_SEPARATOR "/"
37 #define DEFAULT_UNNAMED_NETNAME "unnamed_net"
38 #define DEFAULT_UNNAMED_BUSNAME "unnamed_bus"
40 #define INIT_STR(w, name, str) { \
42 (w)->name = g_strdup (((default_ ## name) != NULL) ? \
43 (default_ ## name) : (str)); \
46 int default_net_naming_priority
= NETATTRIB_ATTRIBUTE
;
47 int default_hierarchy_traversal
= TRUE
;
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
;
57 char *default_unnamed_netname
= NULL
;
58 char *default_unnamed_busname
= NULL
;
60 void i_vars_set(TOPLEVEL
* pr_current
)
62 i_vars_libgeda_set(pr_current
);
64 pr_current
->net_naming_priority
= default_net_naming_priority
;
65 pr_current
->hierarchy_traversal
= default_hierarchy_traversal
;
66 pr_current
->hierarchy_uref_mangle
= default_hierarchy_uref_mangle
;
67 pr_current
->hierarchy_netname_mangle
=
68 default_hierarchy_netname_mangle
;
69 pr_current
->hierarchy_netattrib_mangle
=
70 default_hierarchy_netattrib_mangle
;
71 pr_current
->hierarchy_netattrib_order
=
72 default_hierarchy_netattrib_order
;
73 pr_current
->hierarchy_netname_order
= default_hierarchy_netname_order
;
74 pr_current
->hierarchy_uref_order
= default_hierarchy_uref_order
;
76 if (pr_current
->hierarchy_uref_mangle
== FALSE
) {
77 if (pr_current
->hierarchy_uref_separator
) {
78 strcpy(pr_current
->hierarchy_uref_separator
, "/");
80 pr_current
->hierarchy_uref_separator
= g_strdup("/");
84 if (!default_hierarchy_netname_separator
) {
85 default_hierarchy_netname_separator
=
86 g_strdup (DEFAULT_HIERARCHY_NETNAME_SEPARATOR
);
88 if (!default_hierarchy_netattrib_separator
) {
89 default_hierarchy_netattrib_separator
=
90 g_strdup (DEFAULT_HIERARCHY_NETATTRIB_SEPARATOR
);
92 if (!default_hierarchy_uref_separator
) {
93 default_hierarchy_uref_separator
=
94 g_strdup (DEFAULT_HIERARCHY_UREF_SEPARATOR
);
96 if (!default_unnamed_netname
) {
97 default_unnamed_netname
=
98 g_strdup (DEFAULT_UNNAMED_NETNAME
);
100 if (!default_unnamed_busname
) {
101 default_unnamed_busname
=
102 g_strdup (DEFAULT_UNNAMED_BUSNAME
);
105 INIT_STR(pr_current
, hierarchy_netname_separator
,
106 default_hierarchy_netname_separator
);
107 INIT_STR(pr_current
, hierarchy_netattrib_separator
,
108 default_hierarchy_netattrib_separator
);
109 INIT_STR(pr_current
, hierarchy_uref_separator
,
110 default_hierarchy_uref_separator
);
112 INIT_STR(pr_current
, unnamed_netname
, default_unnamed_netname
);
113 INIT_STR(pr_current
, unnamed_busname
, default_unnamed_busname
);