1 /* gEDA - GPL Electronic Design Automation
2 * gnetlist - gEDA Netlist
3 * Copyright (C) 1998-2007 Ales Hvezda
4 * Copyright (C) 1998-2007 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., 59 Temple Place, Suite 330, Boston, MA 02111 USA
29 #include <libgeda/libgeda.h>
31 #include "../include/papersizes.h"
32 #include "../include/prototype.h"
34 #ifdef HAVE_LIBDMALLOC
38 #define DEFAULT_SERIES_NAME "untitled"
39 #define DEFAULT_UNTITLED_NAME "untitled"
40 #define DEFAULT_SCHEME_DIRECTORY "./"
41 #define DEFAULT_FONT_DIRECTORY "../lib/sym/font"
42 #define DEFAULT_BITMAP_DIRECTORY "non-existant"
44 #define INIT_STR(w, name, str) { \
48 (w)->name = g_strdup (((default_ ## name) != NULL) ? \
49 (default_ ## name) : (str)); \
52 int default_net_naming_priority
= NETATTRIB_ATTRIBUTE
;
53 int default_hierarchy_traversal
= TRUE
;
54 int default_hierarchy_uref_mangle
= TRUE
;
55 int default_hierarchy_netname_mangle
= TRUE
;
56 int default_hierarchy_netattrib_mangle
= TRUE
;
57 int default_hierarchy_netattrib_order
= APPEND
;
58 int default_hierarchy_netname_order
= APPEND
;
59 int default_hierarchy_uref_order
= APPEND
;
60 char *default_hierarchy_netname_separator
= NULL
;
61 char *default_hierarchy_netattrib_separator
= NULL
;
62 char *default_hierarchy_uref_separator
= NULL
;
63 char *default_unnamed_netname
= NULL
;
65 void i_vars_set(TOPLEVEL
* pr_current
)
67 i_vars_libgeda_set(pr_current
);
69 pr_current
->net_naming_priority
= default_net_naming_priority
;
70 pr_current
->hierarchy_traversal
= default_hierarchy_traversal
;
71 pr_current
->hierarchy_uref_mangle
= default_hierarchy_uref_mangle
;
72 pr_current
->hierarchy_netname_mangle
=
73 default_hierarchy_netname_mangle
;
74 pr_current
->hierarchy_netattrib_mangle
=
75 default_hierarchy_netattrib_mangle
;
76 pr_current
->hierarchy_netattrib_order
=
77 default_hierarchy_netattrib_order
;
78 pr_current
->hierarchy_netname_order
= default_hierarchy_netname_order
;
79 pr_current
->hierarchy_uref_order
= default_hierarchy_uref_order
;
81 if (pr_current
->hierarchy_uref_mangle
== FALSE
) {
82 if (pr_current
->hierarchy_uref_separator
) {
83 strcpy(pr_current
->hierarchy_uref_separator
, "/");
85 pr_current
->hierarchy_uref_separator
= g_strdup("/");
89 if (!default_hierarchy_netname_separator
||
90 !default_hierarchy_netattrib_separator
||
91 !default_hierarchy_uref_separator
||
92 !default_unnamed_netname
) {
93 fprintf(stderr
, "Some rc variables are not set!\n");
94 fprintf(stderr
, "Check log and make sure the system-gnetlistrc file was found! (exiting)\n");
98 INIT_STR(pr_current
, hierarchy_netname_separator
,
99 default_hierarchy_netname_separator
);
100 INIT_STR(pr_current
, hierarchy_netattrib_separator
,
101 default_hierarchy_netattrib_separator
);
102 INIT_STR(pr_current
, hierarchy_uref_separator
,
103 default_hierarchy_uref_separator
);
105 INIT_STR(pr_current
, unnamed_netname
, default_unnamed_netname
);