1 /* gEDA - GPL Electronic Design Automation
2 * libgeda - gEDA's library
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
28 #include "libgeda_priv.h"
30 #ifdef HAVE_LIBDMALLOC
34 /*! \todo Finish function documentation!!!
36 * \par Function Description
39 void s_cue_postscript_fillbox(TOPLEVEL
* toplevel
, FILE * fp
, int x
,
45 /* hard coded values */
46 offset
= CUE_BOX_SIZE
;
49 f_print_set_color(toplevel
, fp
, NET_ENDPOINT_COLOR
);
51 fprintf(fp
, "%d %d %d %d fbox\n",
52 offset2
, offset2
, x
-offset
, y
-offset
);
55 /*! \todo Finish function documentation!!!
57 * \par Function Description
60 void s_cue_postscript_junction (TOPLEVEL
* toplevel
, FILE * fp
,
61 int x
, int y
, int bus_involved
)
66 offset2
= JUNCTION_CUE_SIZE_BUS
;
68 offset2
= JUNCTION_CUE_SIZE_NET
;
71 f_print_set_color(toplevel
, fp
, JUNCTION_COLOR
);
73 fprintf(fp
, "newpath\n");
74 fprintf(fp
, "%d %d\n", x
, y
);
75 fprintf(fp
, "%d\n", offset2
/ 2);
76 fprintf(fp
, "0 360 arc\n");
77 fprintf(fp
, "fill\n");
81 /*! \todo Finish function documentation!!!
83 * \par Function Description
86 void s_cue_output_all (TOPLEVEL
* toplevel
, const GList
*obj_list
, FILE * fp
,
93 while (iter
!= NULL
) {
94 o_current
= (OBJECT
*)iter
->data
;
95 switch (o_current
->type
) {
99 s_cue_output_single(toplevel
, o_current
, fp
, type
);
103 case (OBJ_PLACEHOLDER
):
104 s_cue_output_all(toplevel
, o_current
->complex->prim_objs
, fp
,
109 iter
= g_list_next (iter
);
113 /*! \todo Finish function documentation!!!
115 * \par Function Description
118 void s_cue_output_lowlevel(TOPLEVEL
* toplevel
, OBJECT
* object
, int whichone
,
119 FILE * fp
, int output_type
)
126 int bus_involved
= FALSE
;
128 x
= object
->line
->x
[whichone
];
129 y
= object
->line
->y
[whichone
];
131 type
= CONN_ENDPOINT
;
133 if (object
->type
== OBJ_BUS
||
134 (object
->type
== OBJ_PIN
&& object
->pin_type
== PIN_TYPE_BUS
))
137 cl_current
= object
->conn_list
;
138 while (cl_current
!= NULL
&& !done
) {
139 conn
= (CONN
*) cl_current
->data
;
141 if (conn
->x
== x
&& conn
->y
== y
) {
143 if (conn
->other_object
&&
144 (conn
->other_object
->type
== OBJ_BUS
||
145 (conn
->other_object
->type
== OBJ_PIN
&&
146 conn
->other_object
->pin_type
== PIN_TYPE_BUS
)))
149 switch (conn
->type
) {
151 case (CONN_ENDPOINT
):
155 case (CONN_MIDPOINT
):
156 type
= CONN_MIDPOINT
;
163 cl_current
= g_list_next(cl_current
);
167 printf("type: %d count: %d\n", type
, count
);
172 case (CONN_ENDPOINT
):
173 if (object
->type
== OBJ_NET
) { /* only nets have these cues */
174 if (count
< 1) { /* Didn't find anything connected there */
175 if (output_type
== POSTSCRIPT
) {
176 s_cue_postscript_fillbox(toplevel
, fp
, x
, y
);
180 } else if (count
>= 2) {
181 if (output_type
== POSTSCRIPT
)
182 s_cue_postscript_junction (toplevel
, fp
, x
, y
, bus_involved
);
187 case (CONN_MIDPOINT
):
188 if (output_type
== POSTSCRIPT
)
189 s_cue_postscript_junction (toplevel
, fp
, x
, y
, bus_involved
);
195 /*! \todo Finish function documentation!!!
197 * \par Function Description
200 void s_cue_output_lowlevel_midpoints(TOPLEVEL
* toplevel
, OBJECT
* object
,
201 FILE * fp
, int output_type
)
206 int bus_involved
= FALSE
;
208 if (object
->type
== OBJ_BUS
)
211 cl_current
= object
->conn_list
;
212 while (cl_current
!= NULL
) {
213 conn
= (CONN
*) cl_current
->data
;
215 switch (conn
->type
) {
216 case (CONN_MIDPOINT
):
221 if (conn
->other_object
&& conn
->other_object
->type
== OBJ_BUS
)
224 if (output_type
== POSTSCRIPT
) {
225 s_cue_postscript_junction (toplevel
, fp
, x
, y
, bus_involved
);
231 cl_current
= g_list_next(cl_current
);
235 /*! \todo Finish function documentation!!!
237 * \par Function Description
240 void s_cue_output_single(TOPLEVEL
* toplevel
, OBJECT
* object
, FILE * fp
,
247 if (object
->type
!= OBJ_NET
&& object
->type
!= OBJ_PIN
&&
248 object
->type
!= OBJ_BUS
) {
252 s_cue_output_lowlevel(toplevel
, object
, 0, fp
, type
);
253 s_cue_output_lowlevel(toplevel
, object
, 1, fp
, type
);
254 s_cue_output_lowlevel_midpoints(toplevel
, object
, fp
, type
);