Debian Codegraph @

src/smetana/core/JUtils.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 * THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC
20 * LICENSE ("AGREEMENT"). [Eclipse Public License - v 1.0]
21 *
22 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES
23 * RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
24 *
25 * You may obtain a copy of the License at
26 *
27 * http://www.eclipse.org/legal/epl-v10.html
28 *
29 * Unless required by applicable law or agreed to in writing, software
30 * distributed under the License is distributed on an "AS IS" BASIS,
31 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
32 * See the License for the specific language governing permissions and
33 * limitations under the License.
34 *
35 */
36
37 package smetana.core;
38
39 import h.Agcbstack_s;
40 import h.Agdstate_s;
41 import h.Agiodisc_s;
42 import h.GVCOMMON_t;
43 import h.LeafList_t;
44 import h.ST_Agattr_s;
45 import h.ST_Agcbstack_s;
46 import h.ST_Agclos_s;
47 import h.ST_Agdatadict_s;
48 import h.ST_Agdesc_s;
49 import h.ST_Agdisc_s;
50 import h.ST_Agdstate_s;
51 import h.ST_Agedge_s;
52 import h.ST_Agedgeinfo_t;
53 import h.ST_Agedgepair_s;
54 import h.ST_Agiddisc_s;
55 import h.ST_Agiodisc_s;
56 import h.ST_Agmemdisc_s;
57 import h.ST_Agnode_s;
58 import h.ST_Agnodeinfo_t;
59 import h.ST_Agobj_s;
60 import h.ST_Agraph_s;
61 import h.ST_Agraphinfo_t;
62 import h.ST_Agrec_s;
63 import h.ST_Agsubnode_s;
64 import h.ST_Agsym_s;
65 import h.ST_GVCOMMON_t;
66 import h.ST_GVC_s;
67 import h.ST_HDict_t;
68 import h.ST_IMapEntry_t;
69 import h.ST_LeafList_t;
70 import h.ST_Node_t___;
71 import h.ST_Pedge_t;
72 import h.ST_Ppoly_t;
73 import h.ST_RTree;
74 import h.ST_XLabels_t;
75 import h.ST_arrowtype_t;
76 import h.ST_aspect_t;
77 import h.ST_bezier;
78 import h.ST_boxf;
79 import h.ST_cinfo_t;
80 import h.ST_dt_s;
81 import h.ST_dtdata_s;
82 import h.ST_dtdisc_s;
83 import h.ST_dthold_s;
84 import h.ST_dtlink_s;
85 import h.ST_dtmethod_s;
86 import h.ST_elist;
87 import h.ST_fontinfo;
88 import h.ST_label_params_t;
89 import h.ST_layout_t;
90 import h.ST_nlist_t;
91 import h.ST_nodequeue;
92 import h.ST_object_t;
93 import h.ST_pack_info;
94 import h.ST_path;
95 import h.ST_pathend_t;
96 import h.ST_pointf;
97 import h.ST_pointnlink_t;
98 import h.ST_polygon_t;
99 import h.ST_port;
100 import h.ST_rank_t;
101 import h.ST_refstr_t;
102 import h.ST_shape_desc;
103 import h.ST_shape_functions;
104 import h.ST_splineInfo;
105 import h.ST_spline_info_t;
106 import h.ST_splines;
107 import h.ST_tedge_t;
108 import h.ST_textfont_t;
109 import h.ST_textlabel_t;
110 import h.ST_textspan_t;
111 import h.ST_tna_t;
112 import h.ST_triangle_t;
113 import h.ST_xlabel_t;
114 import h.ST_dthold_s;
115 import h.layout_t;
116 import h.rank_t;
117 import h.tedge_t;
118
119 import java.util.LinkedHashSet;
120 import java.util.Set;
121
122 import smetana.core.amiga.StarArrayOfInteger;
123 import smetana.core.amiga.StarStruct;
124
125 // http://docs.oracle.com/javase/specs/jls/se5.0/html/expressions.html#15.7.4
126 // http://www.jbox.dk/sanos/source/lib/string.c.html
127
128 public class JUtils {
129
130 public static int USHRT_MAX = 65535;
131
132 public static size_t sizeof(Class cl) {
133 return new size_t_struct(cl);
134 }
135
136 public static size_t sizeof(String name, int sz) {
137 if (name.equals("char*")) {
138 return new size_t_array_of_charstars(sz);
139 }
140 throw new UnsupportedOperationException();
141 }
142
143 public static size_t size_t_array_of_integer(int nb) {
144 return new size_t_array_of_integer(nb);
145 }
146
147 public static int strcmp(CString s1, CString s2) {
148 return s1.compareTo(s2);
149 }
150
151 public static int strncmp(CString s1, CString s2, int n) {
152 return s1.compareTo(s2, n);
153 }
154
155 public static CString strstr(CString s1, CString s2) {
156 throw new UnsupportedOperationException("s1=" + s1 + " s2=" + s2);
157 }
158
159 public static void strncpy(CString destination, CString source, int nb) {
160 destination.copyFrom(source, nb);
161 }
162
163 public static CString strchr(CString str, char c) {
164 return str.strchr(c);
165 }
166
167 public static int strtol(CString str, CString[] endptr, int base) {
168 if (base != 10) {
169 throw new IllegalArgumentException();
170 }
171 CString end = str;
172 int result = Integer.parseInt(end.getContent());
173 endptr[0] = end.plus(("" + result).length());
174 return result;
175 }
176
177 public static double strtod(CString str, CString[] endptr) {
178 final double result = Double.parseDouble(str.getContent());
179 return result;
180 }
181
182 public static double atof(CString str) {
183 return Double.parseDouble(str.getContent());
184 }
185
186 public static int memcmp(__ptr__ s1, __ptr__ s2, int sz) {
187 throw new UnsupportedOperationException("s1=" + s1 + " s2=" + s2 + " sz=" + sz);
188 }
189
190 public static void memset(__ptr__ obj, int value, size_t nbytes) {
191 if (value != 0) {
192 throw new UnsupportedOperationException();
193 }
194 }
195
196 public static int strlen(CString s) {
197 return s.length();
198 }
199
200 public static double abs(double x) {
201 return Math.abs(x);
202 }
203
204 public static double cos(double x) {
205 return Math.cos(x);
206 }
207
208 public static double sin(double x) {
209 return Math.sin(x);
210 }
211
212 public static double sqrt(double x) {
213 return Math.sqrt(x);
214 }
215
216 public static double atan2(double a, double b) {
217 return Math.atan2(a, b);
218 }
219
220 public static double pow(double a, double b) {
221 return Math.pow(a, b);
222 }
223
224 public static boolean isdigit(char c) {
225 return Character.isDigit(c);
226 }
227
228 public static int atoi(CString s) {
229 return Integer.parseInt(s.getContent());
230 }
231
232 public static char tolower(char c) {
233 return Character.toLowerCase(c);
234 }
235
236 public static CFunction function(Class codingClass, String name) {
237 return CFunctionImpl.create(codingClass, name);
238 }
239
240 public static int enumAsInt(Class enumClass, String name) {
241 CEnumInterpretor interpretor = new CEnumInterpretor(enumClass);
242 final int result = interpretor.valueOf(name);
243 JUtils.LOG("result for " + name + " is " + result);
244 return result;
245 }
246
247 public static CString getenv(CString var) {
248 return null;
249 }
250
251 public static void LOG(String s) {
252 // System.err.println(s);
253 }
254
255 public static void LOG2(String s) {
256 // System.err.println(s);
257 }
258
259 public static boolean EQ(Object o1, Object o2) {
260 final boolean result = EQ_(o1, o2);
261 if (o1 instanceof UnsupportedStarStruct && o2 instanceof UnsupportedStarStruct) {
262 UnsupportedStarStruct ooo1 = (UnsupportedStarStruct) o1;
263 UnsupportedStarStruct ooo2 = (UnsupportedStarStruct) o2;
264 if ((ooo1.UID == ooo2.UID) != result) {
265 // throw new UnsupportedOperationException();
266 }
267 }
268 return result;
269 }
270
271 private static boolean EQ_(Object o1, Object o2) {
272 if (o1 == o2) {
273 return true;
274 }
275 if (o1 == null && o2 != null) {
276 return false;
277 }
278 if (o2 == null && o1 != null) {
279 return false;
280 }
281 // if (o1 instanceof AreaArray && o2 instanceof AreaArray) {
282 // return ((AreaArray) o1).isSameThan((AreaArray) o2);
283 // }
284 if (o1 instanceof ST_pointnlink_t && o2 instanceof ST_pointnlink_t) {
285 return ((ST_pointnlink_t) o1).isSameThan((ST_pointnlink_t) o2);
286 }
287 if (o1 instanceof ST_object_t && o2 instanceof ST_object_t) {
288 return ((ST_object_t) o1).isSameThan((ST_object_t) o2);
289 }
290 if (o1 instanceof StarStruct && o2 instanceof StarStruct) {
291 // System.err.println("o1="+o1.getClass());
292 // System.err.println("o2="+o2.getClass());
293 return ((StarStruct) o1).isSameThan((StarStruct) o2);
294 }
295 if (o1 instanceof CString && o2 instanceof CString) {
296 return ((CString) o1).isSameThan((CString) o2);
297 }
298 if (o1 instanceof ST_Agnode_s.ArrayOfStar && o2 instanceof ST_Agnode_s.ArrayOfStar) {
299 return ((ST_Agnode_s.ArrayOfStar) o1).isSameThan2((ST_Agnode_s.ArrayOfStar) o2);
300 }
301 // if (o1 instanceof StarStar && o2 instanceof StarArrayOfPtr) {
302 // __ptr__ o1b = ((StarStar) o1).getPtr();
303 // __ptr__ o2b = ((StarArrayOfPtr) o2).getPtr();
304 // if (((StarStruct) o1b).getRealClass() != ((StarStruct) o2b).getRealClass()) {
305 // throw new UnsupportedOperationException();
306 // }
307 // return EQ(o1b, o2b);
308 // }
309 System.err.println("o1=" + o1.getClass() + " " + o1);
310 System.err.println("o2=" + o2.getClass() + " " + o2);
311 throw new UnsupportedOperationException();
312 }
313
314 public static boolean NEQ(Object o1, Object o2) {
315 return EQ(o1, o2) == false;
316 }
317
318 public static void qsort(__ptr__ array, int nb, CFunction compare) {
319 if (nb <= 1) {
320 return;
321 }
322 JUtils.LOG("array=" + array);
323 JUtils.LOG("nb=" + nb);
324 JUtils.LOG("compare=" + compare);
325 boolean change;
326 do {
327 change = false;
328 for (int i = 0; i < nb - 1; i++) {
329 __ptr__ element1 = array.plus(i);
330 __ptr__ element2 = array.plus(i + 1);
331 Integer cmp = (Integer) compare.exe(element1, element2);
332 JUtils.LOG("cmp=" + cmp);
333 if (cmp.intValue() > 0) {
334 change = true;
335 if (array instanceof StarArrayOfInteger) {
336 ((StarArrayOfInteger) array).swap(i, i + 1);
337 // } else if (array instanceof STStarArrayOfPointer) {
338 // ((STStarArrayOfPointer) array).swap(i, i + 1);
339 } else if (array instanceof ST_Agnode_s.ArrayOfStar) {
340 ((ST_Agnode_s.ArrayOfStar) array).swap(i, i + 1);
341 } else if (array instanceof ST_Agedge_s.ArrayOfStar) {
342 ((ST_Agedge_s.ArrayOfStar) array).swap(i, i + 1);
343 } else {
344 throw new UnsupportedOperationException();
345 // ((StarStar) array).swap(i, i + 1);
346 }
347 }
348 }
349 } while (change);
350 for (int i = 0; i < nb - 1; i++) {
351 __ptr__ element1 = array.plus(i);
352 __ptr__ element2 = array.plus(i + 1);
353 JUtils.LOG("element1=" + element1);
354 JUtils.LOG("element2=" + element2);
355 Integer cmp = (Integer) compare.exe(element1, element2);
356 JUtils.LOG("cmp=" + cmp);
357 if (cmp.intValue() > 0) {
358 throw new IllegalStateException();
359 }
360 }
361 }
362
363 static public int setjmp(jmp_buf jmp) {
364 // if (jmp.hasBeenCalled()) {
365 // throw new UnsupportedOperationException();
366 // }
367 jmp.saveCallingEnvironment();
368 return 0;
369 }
370
371 // DEBUG
372
373 public static void printDebugEdge(ST_Agedge_s e) {
374 System.err.println("*********** PRINT EDGE ********** ");
375 final ST_Agedgeinfo_t data = (ST_Agedgeinfo_t) Macro.AGDATA(e).castTo(ST_Agedgeinfo_t.class);
376 final ST_splines splines = (ST_splines) data.spl;
377 // ST_boxf bb = (ST_boxf) splines.bb;
378 final ST_bezier list = splines.list.getPtr();
379 System.err.println("splines.size=" + splines.size);
380 //System.err.println("bb.LL=" + pointftoString(bb.LL));
381 //System.err.println("bb.UR=" + pointftoString(bb.UR));
382 printDebugBezier((ST_bezier) splines.list.getPtr());
383
384 }
385
386 private static String pointftoString(ST_pointf point) {
387 final StringBuilder sb = new StringBuilder();
388 sb.append("(");
389 sb.append(point.x);
390 sb.append(" ; ");
391 sb.append(point.y);
392 sb.append(")");
393 return sb.toString();
394 }
395
396 private static void printDebugBezier(ST_bezier bezier) {
397 System.err.println("bezier.size=" + bezier.size);
398 System.err.println("bezier.sflag=" + bezier.sflag);
399 System.err.println("splines.eflag=" + bezier.eflag);
400 System.err.println("bezier.sp=" + pointftoString(bezier.sp));
401 System.err.println("bezier.ep=" + pointftoString(bezier.ep));
402 for (int i = 0; i < bezier.size; i++) {
403 final ST_pointf pt = bezier.list.get(i);
404 System.err.println("pt=" + pointftoString(pt));
405 }
406 }
407
408 public static <C extends __ptr__> __struct__<C> from(Class<C> theClass) {
409 if (theClass == ST_dtmethod_s.class) {
410 return new ST_dtmethod_s();
411 }
412 if (theClass == ST_dtdisc_s.class) {
413 return new ST_dtdisc_s();
414 }
415 if (theClass == ST_Agdesc_s.class) {
416 return new ST_Agdesc_s();
417 }
418 // if (theClass == Agtag_s.class) {
419 // return new ST_Agtag_s();
420 // }
421 if (theClass == ST_Agiddisc_s.class) {
422 return new ST_Agiddisc_s();
423 }
424 if (theClass == ST_Agmemdisc_s.class) {
425 return new ST_Agmemdisc_s();
426 }
427 if (theClass == ST_nlist_t.class) {
428 return new ST_nlist_t();
429 }
430 if (theClass == ST_arrowtype_t.class) {
431 return new ST_arrowtype_t();
432 }
433 if (theClass == ST_elist.class) {
434 return new ST_elist();
435 }
436 if (theClass == ST_pointf.class) {
437 return new ST_pointf();
438 }
439 if (theClass == ST_boxf.class) {
440 return new ST_boxf();
441 }
442 if (theClass == ST_port.class) {
443 return new ST_port();
444 }
445 if (theClass == ST_polygon_t.class) {
446 return new ST_polygon_t();
447 }
448 if (theClass == ST_shape_functions.class) {
449 return new ST_shape_functions();
450 }
451 if (theClass == ST_shape_desc.class) {
452 return new ST_shape_desc();
453 }
454 // if (theClass == deque_t.class) {
455 // return new ST_deque_t();
456 // }
457 // if (theClass == pointnlink_t.class) {
458 // return new ST_pointnlink_t();
459 // }
460 if (theClass == ST_Ppoly_t.class) {
461 return new ST_Ppoly_t();
462 }
463 if (theClass == ST_splineInfo.class) {
464 return new ST_splineInfo();
465 }
466 if (theClass == ST_textfont_t.class) {
467 return new ST_textfont_t();
468 }
469 //
470 // if (UmlDiagram.SMETANA_BETA) {
471 if (theClass == ST_Agsubnode_s.class) {
472 return new ST_Agsubnode_s();
473 }
474 if (theClass == ST_dtlink_s.class) {
475 return new ST_dtlink_s();
476 }
477 if (theClass == ST_refstr_t.class) {
478 return new ST_refstr_t();
479 }
480 if (theClass == ST_refstr_t.class) {
481 return new ST_refstr_t();
482 }
483 if (theClass == ST_Agsym_s.class) {
484 return new ST_Agsym_s();
485 }
486 if (theClass == ST_Agedge_s.class) {
487 return new ST_Agedge_s();
488 }
489 if (theClass == ST_Agobj_s.class) {
490 return new ST_Agobj_s();
491 }
492 if (theClass == ST_Agrec_s.class) {
493 return new ST_Agrec_s();
494 }
495 if (theClass == ST_Agraph_s.class) {
496 return new ST_Agraph_s();
497 }
498 if (theClass == ST_Agclos_s.class) {
499 return new ST_Agclos_s();
500 }
501 if (theClass == ST_Agdisc_s.class) {
502 return new ST_Agdisc_s();
503 }
504 if (theClass == Agdstate_s.class) {
505 return new ST_Agdstate_s();
506 }
507 if (theClass == Agiodisc_s.class) {
508 return new ST_Agiodisc_s();
509 }
510 if (theClass == ST_dt_s.class) {
511 return new ST_dt_s();
512 }
513 if (theClass == ST_dtdata_s.class) {
514 return new ST_dtdata_s();
515 }
516 if (theClass == ST_Agdatadict_s.class) {
517 return new ST_Agdatadict_s();
518 }
519 if (theClass == ST_Agattr_s.class) {
520 return new ST_Agattr_s();
521 }
522 if (theClass == Agcbstack_s.class) {
523 return new ST_Agcbstack_s();
524 }
525 if (theClass == ST_Agnode_s.class) {
526 return new ST_Agnode_s();
527 }
528 if (theClass == ST_Agedgepair_s.class) {
529 return new ST_Agedgepair_s();
530 }
531 if (theClass == ST_Agraphinfo_t.class) {
532 return new ST_Agraphinfo_t();
533 }
534 if (theClass == ST_GVC_s.class) {
535 return new ST_GVC_s();
536 }
537 if (theClass == GVCOMMON_t.class) {
538 return new ST_GVCOMMON_t();
539 }
540 // if (theClass == ST_gvlayout_engine_s.class) {
541 // return new ST_gvlayout_engine_s();
542 // }
543 // if (theClass == gvlayout_features_t.class) {
544 // return new ST_gvlayout_features_t();
545 // }
546 // if (theClass == gvplugin_active_layout_t.class) {
547 // return new ST_gvplugin_active_layout_t();
548 // }
549 // if (theClass == gvplugin_installed_t.class) {
550 // return new ST_gvplugin_installed_t();
551 // }
552 if (theClass == layout_t.class) {
553 return new ST_layout_t();
554 }
555 if (theClass == ST_Agnodeinfo_t.class) {
556 return new ST_Agnodeinfo_t();
557 }
558 if (theClass == ST_textlabel_t.class) {
559 return new ST_textlabel_t();
560 }
561 if (theClass == ST_textspan_t.class) {
562 return new ST_textspan_t();
563 }
564 if (theClass == rank_t.class) {
565 return new ST_rank_t();
566 }
567 // if (theClass == adjmatrix_t.class) {
568 // return new ST_adjmatrix_t();
569 // }
570 if (theClass == ST_Agedgeinfo_t.class) {
571 return new ST_Agedgeinfo_t();
572 }
573 if (theClass == ST_splines.class) {
574 return new ST_splines();
575 }
576 if (theClass == ST_bezier.class) {
577 return new ST_bezier();
578 }
579 if (theClass == ST_dthold_s.class) {
580 return new ST_dthold_s();
581 }
582 //
583 if (theClass == ST_pack_info.class) {
584 return new ST_pack_info();
585 }
586 if (theClass == ST_aspect_t.class) {
587 return new ST_aspect_t();
588 }
589 if (theClass == ST_fontinfo.class) {
590 return new ST_fontinfo();
591 }
592 if (theClass == ST_IMapEntry_t.class) {
593 return new ST_IMapEntry_t();
594 }
595 // if (theClass == point.class) {
596 // return new ST_point();
597 // }
598 if (theClass == ST_nodequeue.class) {
599 return new ST_nodequeue();
600 }
601 if (theClass == ST_spline_info_t.class) {
602 return new ST_spline_info_t();
603 }
604 if (theClass == ST_path.class) {
605 return new ST_path();
606 }
607 if (theClass == ST_pathend_t.class) {
608 return new ST_pathend_t();
609 }
610 // if (theClass == inside_t.class) {
611 // return new ST_inside_t();
612 // }
613 if (theClass == ST_triangle_t.class) {
614 return new ST_triangle_t();
615 }
616 if (theClass == tedge_t.class) {
617 return new ST_tedge_t();
618 }
619 if (theClass == ST_Pedge_t.class) {
620 return new ST_Pedge_t();
621 }
622 if (theClass == ST_tna_t.class) {
623 return new ST_tna_t();
624 }
625 if (theClass == ST_label_params_t.class) {
626 return new ST_label_params_t();
627 }
628 if (theClass == ST_object_t.class) {
629 return new ST_object_t();
630 }
631 if (theClass == ST_xlabel_t.class) {
632 return new ST_xlabel_t();
633 }
634 if (theClass == ST_XLabels_t.class) {
635 return new ST_XLabels_t();
636 }
637 if (theClass == ST_HDict_t.class) {
638 return new ST_HDict_t();
639 }
640 if (theClass == ST_RTree.class) {
641 return new ST_RTree();
642 }
643 if (theClass == ST_Node_t___.class) {
644 return new ST_Node_t___();
645 }
646 if (theClass == ST_cinfo_t.class) {
647 return new ST_cinfo_t();
648 }
649 // }
650 notFound(theClass);
651 throw new UnsupportedOperationException();
652 }
653
654 public static StarStruct create(Class theClass, StarStruct parent) {
655 if (theClass == ST_dtmethod_s.class) {
656 throw new IllegalArgumentException(theClass.toString());
657 }
658 if (theClass == ST_dtdisc_s.class) {
659 return new ST_dtdisc_s(parent);
660 }
661 if (theClass == ST_Agdesc_s.class) {
662 return new ST_Agdesc_s(parent);
663 }
664 if (theClass == ST_nlist_t.class) {
665 return new ST_nlist_t(parent);
666 }
667 if (theClass == ST_elist.class) {
668 return new ST_elist(parent);
669 }
670 if (theClass == ST_pointf.class) {
671 return new ST_pointf(parent);
672 }
673 if (theClass == ST_boxf.class) {
674 return new ST_boxf(parent);
675 }
676 if (theClass == ST_port.class) {
677 return new ST_port(parent);
678 }
679 if (theClass == ST_polygon_t.class) {
680 return new ST_polygon_t(parent);
681 }
682 if (theClass == ST_shape_functions.class) {
683 return new ST_shape_functions(parent);
684 }
685 if (theClass == ST_shape_desc.class) {
686 return new ST_shape_desc(parent);
687 }
688 // if (theClass == deque_t.class) {
689 // return new ST_deque_t(parent);
690 // }
691 // if (theClass == pointnlink_t.class) {
692 // return new ST_pointnlink_t(parent);
693 // }
694 if (theClass == ST_Ppoly_t.class) {
695 return new ST_Ppoly_t(parent);
696 }
697 if (theClass == ST_splineInfo.class) {
698 return new ST_splineInfo(parent);
699 }
700 if (theClass == ST_textfont_t.class) {
701 return new ST_textfont_t(parent);
702 }
703 //
704 // if (UmlDiagram.SMETANA_BETA) {
705 if (theClass == ST_Agsubnode_s.class) {
706 return new ST_Agsubnode_s(parent);
707 }
708 if (theClass == ST_dtlink_s.class) {
709 return new ST_dtlink_s(parent);
710 }
711 if (theClass == ST_refstr_t.class) {
712 return new ST_refstr_t();
713 }
714 if (theClass == ST_refstr_t.class) {
715 return new ST_refstr_t();
716 }
717 if (theClass == ST_Agsym_s.class) {
718 return new ST_Agsym_s(parent);
719 }
720 if (theClass == ST_Agedge_s.class) {
721 return new ST_Agedge_s(parent);
722 }
723 if (theClass == ST_Agobj_s.class) {
724 return new ST_Agobj_s(parent);
725 }
726 if (theClass == ST_Agrec_s.class) {
727 return new ST_Agrec_s(parent);
728 }
729 if (theClass == ST_Agraph_s.class) {
730 return new ST_Agraph_s(parent);
731 }
732 if (theClass == ST_Agclos_s.class) {
733 return new ST_Agclos_s(parent);
734 }
735 if (theClass == ST_Agdisc_s.class) {
736 return new ST_Agdisc_s(parent);
737 }
738 if (theClass == Agdstate_s.class) {
739 return new ST_Agdstate_s(parent);
740 }
741 if (theClass == ST_dt_s.class) {
742 return new ST_dt_s(parent);
743 }
744 if (theClass == ST_dtdata_s.class) {
745 return new ST_dtdata_s(parent);
746 }
747 if (theClass == ST_Agdatadict_s.class) {
748 return new ST_Agdatadict_s(parent);
749 }
750 if (theClass == ST_Agattr_s.class) {
751 return new ST_Agattr_s(parent);
752 }
753 if (theClass == Agcbstack_s.class) {
754 return new ST_Agcbstack_s(parent);
755 }
756 if (theClass == ST_Agnode_s.class) {
757 return new ST_Agnode_s(parent);
758 }
759 if (theClass == ST_Agedgepair_s.class) {
760 return new ST_Agedgepair_s(parent);
761 }
762 if (theClass == ST_Agraphinfo_t.class) {
763 return new ST_Agraphinfo_t(parent);
764 }
765 if (theClass == ST_GVC_s.class) {
766 return new ST_GVC_s(parent);
767 }
768 if (theClass == GVCOMMON_t.class) {
769 return new ST_GVCOMMON_t(parent);
770 }
771 // if (theClass == ST_gvlayout_engine_s.class) {
772 // throw new UnsupportedOperationException();
773 // // return new ST_gvlayout_engine_s(parent);
774 // }
775 // if (theClass == gvlayout_features_t.class) {
776 // throw new UnsupportedOperationException();
777 // // return new ST_gvlayout_features_t(parent);
778 // }
779 // if (theClass == gvplugin_active_layout_t.class) {
780 // throw new UnsupportedOperationException();
781 // // return new ST_gvplugin_active_layout_t(parent);
782 // }
783 // if (theClass == gvplugin_installed_t.class) {
784 // return new ST_gvplugin_installed_t(parent);
785 // }
786 if (theClass == layout_t.class) {
787 return new ST_layout_t(parent);
788 }
789 if (theClass == ST_Agnodeinfo_t.class) {
790 return new ST_Agnodeinfo_t(parent);
791 }
792 if (theClass == ST_textlabel_t.class) {
793 return new ST_textlabel_t(parent);
794 }
795 if (theClass == ST_textspan_t.class) {
796 return new ST_textspan_t(parent);
797 }
798 if (theClass == rank_t.class) {
799 return new ST_rank_t(parent);
800 }
801 // if (theClass == adjmatrix_t.class) {
802 // return new ST_adjmatrix_t(parent);
803 // }
804 if (theClass == ST_Agedgeinfo_t.class) {
805 return new ST_Agedgeinfo_t(parent);
806 }
807 if (theClass == ST_splines.class) {
808 return new ST_splines(parent);
809 }
810 if (theClass == ST_bezier.class) {
811 return new ST_bezier(parent);
812 }
813 if (theClass == ST_dthold_s.class) {
814 return new ST_dthold_s(parent);
815 }
816 //
817 if (theClass == ST_pack_info.class) {
818 return new ST_pack_info(parent);
819 }
820 if (theClass == ST_aspect_t.class) {
821 return new ST_aspect_t(parent);
822 }
823 if (theClass == ST_fontinfo.class) {
824 return new ST_fontinfo(parent);
825 }
826 if (theClass == ST_IMapEntry_t.class) {
827 return new ST_IMapEntry_t(parent);
828 }
829 // if (theClass == point.class) {
830 // return new ST_point(parent);
831 // }
832 if (theClass == ST_nodequeue.class) {
833 return new ST_nodequeue(parent);
834 }
835 if (theClass == ST_spline_info_t.class) {
836 return new ST_spline_info_t(parent);
837 }
838 if (theClass == ST_path.class) {
839 return new ST_path(parent);
840 }
841 if (theClass == ST_pathend_t.class) {
842 return new ST_pathend_t(parent);
843 }
844 // if (theClass == inside_t.class) {
845 // return new ST_inside_t(parent);
846 // }
847 if (theClass == ST_triangle_t.class) {
848 return new ST_triangle_t(parent);
849 }
850 if (theClass == tedge_t.class) {
851 return new ST_tedge_t(parent);
852 }
853 if (theClass == ST_Pedge_t.class) {
854 return new ST_Pedge_t(parent);
855 }
856 if (theClass == ST_tna_t.class) {
857 return new ST_tna_t(parent);
858 }
859 if (theClass == ST_label_params_t.class) {
860 return new ST_label_params_t(parent);
861 }
862 if (theClass == ST_object_t.class) {
863 return new ST_object_t(parent);
864 }
865 if (theClass == ST_xlabel_t.class) {
866 return new ST_xlabel_t(parent);
867 }
868 if (theClass == ST_XLabels_t.class) {
869 return new ST_XLabels_t(parent);
870 }
871 if (theClass == ST_HDict_t.class) {
872 return new ST_HDict_t(parent);
873 }
874 if (theClass == ST_RTree.class) {
875 return new ST_RTree(parent);
876 }
877 if (theClass == ST_Node_t___.class) {
878 return new ST_Node_t___(parent);
879 }
880 if (theClass == ST_cinfo_t.class) {
881 return new ST_cinfo_t(parent);
882 }
883 // }
884 notFound(theClass);
885 throw new UnsupportedOperationException();
886 }
887
888 private static final Set<String> todo = new LinkedHashSet<String>();
889
890 private static void notFound(Class theClass) {
891 todo.add(theClass.getName());
892 System.err.println("todo=" + todo);
893 }
894
895 }