Debian Codegraph @

src/gen/lib/gvc/gvlayout__c.java

raw symbols SCIP
1 /* ========================================================================
2 * PlantUML : a free UML diagram generator
3 * ========================================================================
4 *
5 * Project Info: http://plantuml.com
6 *
7 * If you like this project or if you find it useful, you can support us at:
8 *
9 * http://plantuml.com/patreon (only 1$ per month!)
10 * http://plantuml.com/paypal
11 *
12 * This file is part of Smetana.
13 * Smetana is a partial translation of Graphviz/Dot sources from C to Java.
14 *
15 * (C) Copyright 2009-2020, Arnaud Roques
16 *
17 * This translation is distributed under the same Licence as the original C program:
18 *
19 *************************************************************************
20 * Copyright (c) 2011 AT&T Intellectual Property
21 * All rights reserved. This program and the accompanying materials
22 * are made available under the terms of the Eclipse Public License v1.0
23 * which accompanies this distribution, and is available at
24 * http://www.eclipse.org/legal/epl-v10.html
25 *
26 * Contributors: See CVS logs. Details at http://www.graphviz.org/
27 *************************************************************************
28 *
29 * THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC
30 * LICENSE ("AGREEMENT"). [Eclipse Public License - v 1.0]
31 *
32 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES
33 * RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
34 *
35 * You may obtain a copy of the License at
36 *
37 * http://www.eclipse.org/legal/epl-v10.html
38 *
39 * Unless required by applicable law or agreed to in writing, software
40 * distributed under the License is distributed on an "AS IS" BASIS,
41 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
42 * See the License for the specific language governing permissions and
43 * limitations under the License.
44 *
45 */
46 package gen.lib.gvc;
47 import static gen.lib.cgraph.obj__c.agroot;
48 import static gen.lib.cgraph.rec__c.agbindrec;
49 import static gen.lib.common.emit__c.gv_fixLocale;
50 import static gen.lib.common.input__c.graph_init;
51 import static smetana.core.JUtils.LOG2;
52 import static smetana.core.JUtils.NEQ;
53 import static smetana.core.JUtils.enumAsInt;
54 import static smetana.core.JUtils.function;
55 import static smetana.core.JUtils.sizeof;
56 import static smetana.core.JUtilsDebug.ENTERING;
57 import static smetana.core.JUtilsDebug.LEAVING;
58 import static smetana.core.Macro.GD_cleanup;
59 import static smetana.core.Macro.GD_drawing;
60 import static smetana.core.Macro.GD_gvc;
61 import static smetana.core.Macro.N;
62 import static smetana.core.Macro.UNSUPPORTED;
63 import h.ST_Agraph_s;
64 import h.ST_Agraphinfo_t;
65 import h.ST_GVC_s;
66 import h.ST_gvlayout_engine_s;
67 import h.ST_gvlayout_features_t;
68 import h.ST_gvplugin_installed_t;
69 import h.layout_type;
70 import smetana.core.CString;
71
72 public class gvlayout__c {
73 //1 2digov3edok6d5srhgtlmrycs
74 // extern lt_symlist_t lt_preloaded_symbols[]
75
76
77 //1 baedz5i9est5csw3epz3cv7z
78 // typedef Ppoly_t Ppolyline_t
79
80
81 //1 9k44uhd5foylaeoekf3llonjq
82 // extern Dtmethod_t* Dtset
83
84
85 //1 1ahfywsmzcpcig2oxm7pt9ihj
86 // extern Dtmethod_t* Dtbag
87
88
89 //1 anhghfj3k7dmkudy2n7rvt31v
90 // extern Dtmethod_t* Dtoset
91
92
93 //1 5l6oj1ux946zjwvir94ykejbc
94 // extern Dtmethod_t* Dtobag
95
96
97 //1 2wtf222ak6cui8cfjnw6w377z
98 // extern Dtmethod_t* Dtlist
99
100
101 //1 d1s1s6ibtcsmst88e3057u9r7
102 // extern Dtmethod_t* Dtstack
103
104
105 //1 axa7mflo824p6fspjn1rdk0mt
106 // extern Dtmethod_t* Dtqueue
107
108
109 //1 ega812utobm4xx9oa9w9ayij6
110 // extern Dtmethod_t* Dtdeque
111
112
113 //1 cyfr996ur43045jv1tjbelzmj
114 // extern Dtmethod_t* Dtorder
115
116
117 //1 wlofoiftbjgrrabzb2brkycg
118 // extern Dtmethod_t* Dttree
119
120
121 //1 12bds94t7voj7ulwpcvgf6agr
122 // extern Dtmethod_t* Dthash
123
124
125 //1 9lqknzty480cy7zsubmabkk8h
126 // extern Dtmethod_t _Dttree
127
128
129 //1 bvn6zkbcp8vjdhkccqo1xrkrb
130 // extern Dtmethod_t _Dthash
131
132
133 //1 9lidhtd6nsmmv3e7vjv9e10gw
134 // extern Dtmethod_t _Dtlist
135
136
137 //1 34ujfamjxo7xn89u90oh2k6f8
138 // extern Dtmethod_t _Dtqueue
139
140
141 //1 3jy4aceckzkdv950h89p4wjc8
142 // extern Dtmethod_t _Dtstack
143
144
145 //1 8dfqgf3u1v830qzcjqh9o8ha7
146 // extern Agmemdisc_t AgMemDisc
147
148
149 //1 18k2oh2t6llfsdc5x0wlcnby8
150 // extern Agiddisc_t AgIdDisc
151
152
153 //1 a4r7hi80gdxtsv4hdoqpyiivn
154 // extern Agiodisc_t AgIoDisc
155
156
157 //1 bnzt5syjb7mgeru19114vd6xx
158 // extern Agdisc_t AgDefaultDisc
159
160
161 //1 35y2gbegsdjilegaribes00mg
162 // extern Agdesc_t Agdirected, Agstrictdirected, Agundirected, Agstrictundirected
163
164
165 //1 c2rygslq6bcuka3awmvy2b3ow
166 // typedef Agsubnode_t Agnoderef_t
167
168
169 //1 xam6yv0dcsx57dtg44igpbzn
170 // typedef Dtlink_t Agedgeref_t
171
172
173
174
175 private final static ST_gvlayout_features_t dotgen_features = new ST_gvlayout_features_t();
176 private final static ST_gvlayout_engine_s dotgen_engine = new ST_gvlayout_engine_s();
177 static {
178 dotgen_features.setInt("flags", 1<<0);
179 dotgen_engine.setPtr("layout", function(gen.lib.dotgen.dotinit__c.class, "dot_layout"));
180 dotgen_engine.setPtr("cleanup", function(gen.lib.dotgen.dotinit__c.class, "dot_cleanup"));
181 }
182 //3 2g20jitdi8afuoei8p1mcfg9l
183 //int gvlayout_select(GVC_t * gvc, const char *layout)
184 public static int gvlayout_select(ST_GVC_s gvc, CString layout) {
185 ENTERING("2g20jitdi8afuoei8p1mcfg9l","gvlayout_select");
186 try {
187 ST_gvplugin_installed_t gvlayout_dot_layout = new ST_gvplugin_installed_t();
188 gvlayout_dot_layout.setInt("id", enumAsInt(layout_type.class, "LAYOUT_DOT"));
189 gvlayout_dot_layout.setPtr("type", new CString("dot"));
190 gvlayout_dot_layout.setInt("quality", 0);
191 gvlayout_dot_layout.setPtr("engine", dotgen_engine);
192 gvlayout_dot_layout.setPtr("features", dotgen_features);
193
194 // gvplugin_available_t *plugin;
195 ST_gvplugin_installed_t typeptr = gvlayout_dot_layout;
196 // plugin = gvplugin_load(gvc, API_layout, layout);
197 // if (plugin) {
198 // typeptr = plugin->typeptr;
199 gvc.layout.setPtr("type", typeptr.type);
200 gvc.layout.setPtr("engine", typeptr.engine);
201 gvc.layout.setInt("id", typeptr.id);
202 gvc.layout.setPtr("features", typeptr.features);
203 return 300; /* FIXME - need better return code */
204 // }
205 // return 999;
206 } finally {
207 LEAVING("2g20jitdi8afuoei8p1mcfg9l","gvlayout_select");
208 }
209 }
210
211
212
213
214 //3 991b7t7n0x8ifkp49zotjs78x
215 // int gvLayoutJobs(GVC_t * gvc, Agraph_t * g)
216 public static int gvLayoutJobs(ST_GVC_s gvc, ST_Agraph_s g) {
217 ENTERING("991b7t7n0x8ifkp49zotjs78x","gvLayoutJobs");
218 try {
219 ST_gvlayout_engine_s gvle;
220 CString p = null;
221 int rc;
222 agbindrec(g, new CString("Agraphinfo_t"), sizeof(ST_Agraphinfo_t.class), (N(0)));
223 GD_gvc(g, gvc);
224 if (NEQ(g, agroot(g)))
225 UNSUPPORTED("ah9ygbaap1fyxr97z734juk0j"); // (((Agraphinfo_t*)(((Agobj_t*)(agroot(g)))->data))->gvc) = gvc;
226 /* if ((p = agget(g, new CString("layout")))!=null) {
227 UNSUPPORTED("dlm1jil8gt2pv7p8yrit1tuls"); // gvc->layout.engine = NULL;
228 UNSUPPORTED("efl8rjna6ij4qjxb0xlyu3hh1"); // rc = gvlayout_select(gvc, p);
229 UNSUPPORTED("7smbmph5nldinro02iqf3qlxv"); // if (rc == 999) {
230 UNSUPPORTED("6ru23qpjrx893ivwviirr1ikc"); // agerr (AGERR, "Layout type: \"%s\" not recognized. Use one of:%s\n",
231 UNSUPPORTED("f3vrr10ga3mqymh2qxomxn326"); // p, gvplugin_list(gvc, API_layout, p));
232 UNSUPPORTED("aivfd7ajlfz8o8oi68d4u5s5z"); // return -1;
233 UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); // }
234 }*/
235
236 rc = gvlayout_select(gvc, p); //Let's force things
237
238 gvle = (ST_gvlayout_engine_s) gvc.layout.engine;
239 if (N(gvle))
240 UNSUPPORTED("return -1;");
241 gv_fixLocale (1);
242 graph_init(g, (gvc.layout.features.flags & (1<<0))!=0);
243 GD_drawing(agroot(g), GD_drawing(g));
244 if (gvle!=null && gvle.layout!=null) {
245 gvle.layout.exe(g);
246 if (gvle.cleanup!=null)
247 if (GD_cleanup(g)==null)
248 LOG2("WARNING WE CHEAT GD_cleanup(g) is NULL"); else
249 GD_cleanup(g).setPtr(gvle.cleanup);
250 }
251 gv_fixLocale (0);
252 return 0;
253 } finally {
254 LEAVING("991b7t7n0x8ifkp49zotjs78x","gvLayoutJobs");
255 }
256 }
257
258
259
260
261 //3 3c99zdwpmvsunk8fuj6my9c14
262 // int gvFreeLayout(GVC_t * gvc, Agraph_t * g)
263 public static Object gvFreeLayout(Object... arg) {
264 UNSUPPORTED("miztaqpyzsrx0tzflsbk18df"); // int gvFreeLayout(GVC_t * gvc, Agraph_t * g)
265 UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
266 UNSUPPORTED("an78d0x2t0pcnm5p7x0nsyl8o"); // /* skip if no Agraphinfo_t yet */
267 UNSUPPORTED("y9n04abevv5wkts4l75cl1au"); // if (! agbindrec(g, "Agraphinfo_t", 0, NOT(0)))
268 UNSUPPORTED("6f1138i13x0xz1bf1thxgjgka"); // return 0;
269 UNSUPPORTED("3tq49gfbuixakj7ae5tf9mzxz"); // if (GD_cleanup(g)) {
270 UNSUPPORTED("66fe8hcy8mktqozsl94u84wy4"); // (GD_cleanup(g))(g);
271 UNSUPPORTED("9otfc4inu4hywb5uzke8hroh8"); // GD_cleanup(g) = NULL;
272 UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
273 UNSUPPORTED("6o4u7hjlds1wsu4tuaotw2xvr"); // if (GD_drawing(g)) {
274 UNSUPPORTED("614pp135h9hyyoa6quv172ent"); // graph_cleanup(g);
275 UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
276 UNSUPPORTED("5oxhd3fvp0gfmrmz12vndnjt"); // return 0;
277 UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
278
279 throw new UnsupportedOperationException();
280 }
281
282
283 }