diff --git a/src/gen/lib/cdt/dttree__c.java b/src/gen/lib/cdt/dttree__c.java index c0065f00a..614f0e77c 100644 --- a/src/gen/lib/cdt/dttree__c.java +++ b/src/gen/lib/cdt/dttree__c.java @@ -60,6 +60,7 @@ import h._dthold_s; import h._dtlink_s; import smetana.core.CFunction; import smetana.core.CString; +import smetana.core.JUtils; import smetana.core.__ptr__; import smetana.core.__struct__; @@ -144,7 +145,7 @@ try { _dtlink_s root, t; int cmp, lk, sz, ky; _dtlink_s l, r, me=null; - final __struct__<_dtlink_s> link = __struct__.from(_dtlink_s.class); + final __struct__<_dtlink_s> link = JUtils.from(_dtlink_s.class); Object o, k, key = null; int n, minp; //, turn[(sizeof(size_t)*8 - 2)]; Dtcompar_f cmpf; @@ -556,7 +557,7 @@ LEAVING("abqfzg1d1vkzk51225tcdlik5","dttree"); //1 5kf1n1yhdy9ojgc0mc3pyowaz // Dtmethod_t _Dttree = -/*public static final __struct__<_dtmethod_s> _Dttree = __struct__.from(_dtmethod_s.class); +/*public static final __struct__<_dtmethod_s> _Dttree = JUtils.from(_dtmethod_s.class); static { _Dttree.setPtr("searchf", function(dttree__c.class, "dttree")); _Dttree.setInt("type", 0000004); diff --git a/src/gen/lib/cgraph/attr__c.java b/src/gen/lib/cgraph/attr__c.java index f67c780f0..4867d9a91 100644 --- a/src/gen/lib/cgraph/attr__c.java +++ b/src/gen/lib/cgraph/attr__c.java @@ -83,6 +83,8 @@ import h.Agobj_s; import h.Agraph_s; import h.Agrec_s; import h.Agsym_s; +import h.ST_Agdesc_s; +import h.ST_Agtag_s; import h._dt_s; import h._dtdisc_s; import smetana.core.CString; @@ -225,7 +227,7 @@ public class attr__c { //1 cwbgwzo8cprw4eobs3iji59dp // Dtdisc_t AgDataDictDisc = -/*static public final __struct__<_dtdisc_s> AgDataDictDisc = __struct__.from(_dtdisc_s.class); +/*static public final __struct__<_dtdisc_s> AgDataDictDisc = JUtils.from(_dtdisc_s.class); static { AgDataDictDisc.setInt("key", OFFSET.create(Agsym_s.class, "name").toInt()); AgDataDictDisc.setInt("size", -1); @@ -241,7 +243,7 @@ static { public final static CString DataDictName = new CString("_AG_datadict"); //1 1qn6s7dwoq08ugdjnmsvdgj6u // static Agdesc_t ProtoDesc = -/*static final public __struct__ ProtoDesc = __struct__.from(Agdesc_s.class); +/*static final public __struct__ ProtoDesc = JUtils.from(Agdesc_s.class); static { ProtoDesc.setInt("directed", 1); ProtoDesc.setInt("strict", 0); @@ -720,7 +722,7 @@ try { /* Agdatadict_t *dd; */ /* Agrec_t *attr; */ Agraph_s context; - g.getStruct("desc").setInt("has_attrs", 1); + ((ST_Agdesc_s)g.getStruct("desc")).has_attrs = 1; /* dd = */ agmakedatadict(g); if (N(context = agparent(g))) context = g; @@ -909,7 +911,7 @@ try { agstrfree(g, data.getArrayOfCString("str").plus(sym.getInt("id")).getCString()); data.getArrayOfCString("str").plus(sym.getInt("id")).setCString(agstrdup(g, value)); - if (hdr.getStruct("tag").getInt("objtype") == AGRAPH) { + if (((ST_Agtag_s)hdr.getStruct("tag")).objtype == AGRAPH) { /* also update dict default */ _dt_s dict; dict = (_dt_s) agdatadict(g, false).getPtr("dict.g"); diff --git a/src/gen/lib/cgraph/edge__c.java b/src/gen/lib/cgraph/edge__c.java index 93baf1eeb..861d1f49a 100644 --- a/src/gen/lib/cgraph/edge__c.java +++ b/src/gen/lib/cgraph/edge__c.java @@ -86,11 +86,14 @@ import h.Agnode_s; import h.Agraph_s; import h.Agsubnode_s; import h.Agtag_s; +import h.ST_Agdesc_s; +import h.ST_Agtag_s; import h._dt_s; import h._dtdisc_s; import h._dtlink_s; import smetana.core.ACCESS; import smetana.core.CString; +import smetana.core.JUtils; import smetana.core.Memory; import smetana.core.STARSTAR; import smetana.core.Z; @@ -232,7 +235,7 @@ public class edge__c { //1 cee3kc2m61ml4f8le5ueoyrjb // static Agtag_t Tag -//private final static __struct__ Tag = __struct__.from(Agtag_s.class); +//private final static __struct__ Tag = JUtils.from(Agtag_s.class); @@ -431,7 +434,7 @@ public static Agsubnode_s agsubrep(Agraph_s g, Agnode_s n) { ENTERING("b32ssm6ex1pdz1b3nt4fwlhul","agsubrep"); try { Agsubnode_s sn; - final __struct__ template = __struct__.from(Agsubnode_s.class); + final __struct__ template = JUtils.from(Agsubnode_s.class); if (EQ(g, n.getPtr("root"))) sn = (Agsubnode_s) n.getStruct("mainsub").amp(); else { template.setPtr("node", n); @@ -580,7 +583,7 @@ try { in.setPtr("node", t); out.setPtr("node", h); installedge(g, out); - if (g.getStruct("desc").getBoolean("has_attrs")) { + if (((ST_Agdesc_s)g.getStruct("desc")).has_attrs!=0) { agbindrec(out, AgDataRecName, sizeof(Agattr_s.class), false); agedgeattr_init(g, out); } @@ -599,12 +602,12 @@ LEAVING("4rzjui6oo0k009o64bxwgjmvq","newedge"); public static boolean ok_to_make_edge(Agraph_s g, Agnode_s t, Agnode_s h) { ENTERING("1ufxhg5xnmll1pe5339477823","ok_to_make_edge"); try { - final __struct__ key = __struct__.from(Agtag_s.class); + final __struct__ key = JUtils.from(Agtag_s.class); /* protect against self, multi-edges in strict graphs */ if (agisstrict(g)) { if (g.getPtr("desc").getBoolean("no_loop") && (EQ(t, h))) /* simple graphs */ return false; - key.____(Z.z().Tag); + key.___(Z.z().Tag); key.setInt("objtype", 0); /* wild card */ if (agfindedge_by_key(g, t, h, key)!=null) return false; @@ -659,14 +662,14 @@ try { have_id = agmapnametoid(g, AGEDGE, name, id, false); if (have_id!=0 || ((name == null) && ((NOT(cflag)) || agisstrict(g)))) { /* probe for pre-existing edge */ - final __struct__ key = __struct__.from(Agtag_s.class); - key.____(Z.z().Tag); + final ST_Agtag_s key = new ST_Agtag_s(); + key.___(Z.z().Tag); if (have_id!=0) { - key.setInt("id", id[0]); - key.setInt("objtype", AGEDGE); + key.id = id[0]; + key.objtype = AGEDGE; } else { - key.setInt("id", 0); - key.setInt("objtype", 0); + key.id = 0; + key.objtype = 0; } /* might already exist locally */ e = agfindedge_by_key(g, t, h, key); @@ -834,7 +837,7 @@ LEAVING("b6jhzc16xvrknu4e7jp6zx0ue","agedgeseqcmpf"); //1 d058zqckpiqls71p4vkuxe87o // Dtdisc_t Ag_mainedge_seq_disc = -/*static final public __struct__<_dtdisc_s> Ag_mainedge_seq_disc = __struct__.from(_dtdisc_s.class); +/*static final public __struct__<_dtdisc_s> Ag_mainedge_seq_disc = JUtils.from(_dtdisc_s.class); static { Ag_mainedge_seq_disc.setInt("key", 0); Ag_mainedge_seq_disc.setInt("size", 0); @@ -849,7 +852,7 @@ static { //1 7n5e8w5zjp9b4oeecyvyl96il // Dtdisc_t Ag_subedge_seq_disc = -/*static public final __struct__<_dtdisc_s> Ag_subedge_seq_disc = __struct__.from(_dtdisc_s.class); +/*static public final __struct__<_dtdisc_s> Ag_subedge_seq_disc = JUtils.from(_dtdisc_s.class); static { Ag_subedge_seq_disc.setInt("key", 0); Ag_subedge_seq_disc.setInt("size", 0); @@ -865,7 +868,7 @@ static { //1 7grv8f2wvpg0db2pn1g7r5abv // Dtdisc_t Ag_mainedge_id_disc = -/*static final public __struct__<_dtdisc_s> Ag_mainedge_id_disc = __struct__.from(_dtdisc_s.class); +/*static final public __struct__<_dtdisc_s> Ag_mainedge_id_disc = JUtils.from(_dtdisc_s.class); static { Ag_mainedge_id_disc.setInt("key", 0); Ag_mainedge_id_disc.setInt("size", 0); @@ -880,7 +883,7 @@ static { //1 9u0ic8u2hrwlmlqalv37s053f // Dtdisc_t Ag_subedge_id_disc = -/*static public final __struct__<_dtdisc_s> Ag_subedge_id_disc = __struct__.from(_dtdisc_s.class); +/*static public final __struct__<_dtdisc_s> Ag_subedge_id_disc = JUtils.from(_dtdisc_s.class); static { Ag_subedge_id_disc.setInt("key", 0); Ag_subedge_id_disc.setInt("size", 0); diff --git a/src/gen/lib/cgraph/graph__c.java b/src/gen/lib/cgraph/graph__c.java index 780629da9..01bbe3a07 100644 --- a/src/gen/lib/cgraph/graph__c.java +++ b/src/gen/lib/cgraph/graph__c.java @@ -76,6 +76,7 @@ import h.Agmemdisc_s; import h.Agnode_s; import h.Agraph_s; import h.Agsubnode_s; +import h.ST_Agdesc_s; import h._dt_s; import h._dtdisc_s; import h._dtlink_s; @@ -268,7 +269,7 @@ try { AGTYPE(g, AGRAPH); g.setPtr("clos", clos); g.setStruct("desc", desc); - g.getStruct("desc").setInt("maingraph", ASINT((N(0)))); + ((ST_Agdesc_s)g.getStruct("desc")).maingraph = ASINT((N(0))); g.setPtr("root", g); g.getPtr("clos").getStruct("state").setPtr("id", (__ptr__) g.getPtr("clos").getStruct("disc").getPtr("id").call("open", g, arg_disc)); if (agmapnametoid(g, AGRAPH, name, gid, (N(0)))!=0) @@ -301,7 +302,7 @@ try { AGSEQ(g, agnextseq(par, AGRAPH)); par.getPtr("g_dict").call("searchf", par.getPtr("g_dict"),g,0000001); } /* else AGSEQ=0 */ - if (N(par) || par.getStruct("desc").getBoolean("has_attrs")) + if (N(par) || ((ST_Agdesc_s)par.getStruct("desc")).has_attrs!=0) agraphattr_init(g); agmethod_init(g, g); return g; @@ -445,7 +446,7 @@ throw new UnsupportedOperationException(); public static boolean agisdirected(Agraph_s g) { ENTERING("blvn1w3v0icnucu5m5xvbrba1","agisdirected"); try { - return g.getStruct("desc").getBoolean("directed"); + return ((ST_Agdesc_s)g.getStruct("desc")).directed!=0; } finally { LEAVING("blvn1w3v0icnucu5m5xvbrba1","agisdirected"); } @@ -473,7 +474,7 @@ LEAVING("8thgds4eioot64flko26m8ns0","agisundirected"); public static boolean agisstrict(Agraph_s g) { ENTERING("9qgdebmdfrcfjm394bg59a7y5","agisstrict"); try { - return g.getStruct("desc").getBoolean("strict"); + return ((ST_Agdesc_s)g.getStruct("desc")).strict!=0; } finally { LEAVING("9qgdebmdfrcfjm394bg59a7y5","agisstrict"); } @@ -616,7 +617,7 @@ throw new UnsupportedOperationException(); //1 cqgilvgau98cgaulohsii8vx4 // Dtdisc_t Ag_subgraph_id_disc = -/*static final public __struct__<_dtdisc_s> Ag_subgraph_id_disc = __struct__.from(_dtdisc_s.class); +/*static final public __struct__<_dtdisc_s> Ag_subgraph_id_disc = JUtils.from(_dtdisc_s.class); static { Ag_subgraph_id_disc.setInt("key", 0); Ag_subgraph_id_disc.setInt("size", 0); @@ -631,7 +632,7 @@ static { //1 98aldesvg4i0qxoidbuanebv7 // Agdesc_t Agdirected = -/*static final public __struct__ Agdirected = __struct__.from(Agdesc_s.class); +/*static final public __struct__ Agdirected = JUtils.from(Agdesc_s.class); static { Agdirected.setInt("directed", 1); Agdirected.setInt("strict", 0); diff --git a/src/gen/lib/cgraph/id__c.java b/src/gen/lib/cgraph/id__c.java index 02eb218cc..90b0493ec 100644 --- a/src/gen/lib/cgraph/id__c.java +++ b/src/gen/lib/cgraph/id__c.java @@ -321,7 +321,7 @@ LEAVING("5bjqo0ihl0x25vaspoiehmwzk","idregister"); //1 cxrk51474ugltvklkcvp3v2ly // Agiddisc_t AgIdDisc = -/*public final static __struct__ AgIdDisc = __struct__.from(Agiddisc_s.class); +/*public final static __struct__ AgIdDisc = JUtils.from(Agiddisc_s.class); static { AgIdDisc.setPtr("open", function(id__c.class, "idopen")); AgIdDisc.setPtr("map", function(id__c.class, "idmap")); diff --git a/src/gen/lib/cgraph/mem__c.java b/src/gen/lib/cgraph/mem__c.java index ba57cd42c..7de15ad1c 100644 --- a/src/gen/lib/cgraph/mem__c.java +++ b/src/gen/lib/cgraph/mem__c.java @@ -252,7 +252,7 @@ throw new UnsupportedOperationException(); //1 1cni5q244gsprpvtjsq7gs17m // Agmemdisc_t AgMemDisc = -/*public static final __struct__ AgMemDisc = __struct__.from(Agmemdisc_s.class); +/*public static final __struct__ AgMemDisc = JUtils.from(Agmemdisc_s.class); static { AgMemDisc.setPtr("open", function(mem__c.class, "memopen")); AgMemDisc.setPtr("alloc", function(mem__c.class, "memalloc")); diff --git a/src/gen/lib/cgraph/node__c.java b/src/gen/lib/cgraph/node__c.java index 632362112..67bf6d024 100644 --- a/src/gen/lib/cgraph/node__c.java +++ b/src/gen/lib/cgraph/node__c.java @@ -72,6 +72,8 @@ import h.Agattr_s; import h.Agnode_s; import h.Agraph_s; import h.Agsubnode_s; +import h.ST_Agdesc_s; +import h.ST_Agtag_s; import h._dt_s; import h._dtdisc_s; import smetana.core.CString; @@ -215,13 +217,13 @@ public class node__c { //3 4w89du6uel405pm3vxsr3ayxt // Agnode_t *agfindnode_by_id(Agraph_t * g, unsigned long id) -//private static __struct__ template = __struct__.from(Agsubnode_s.class); -//private static __struct__ dummy = __struct__.from(Agnode_s.class); +//private static __struct__ template = JUtils.from(Agsubnode_s.class); +//private static __struct__ dummy = JUtils.from(Agnode_s.class); public static Agnode_s agfindnode_by_id(Agraph_s g, int id) { ENTERING("4w89du6uel405pm3vxsr3ayxt","agfindnode_by_id"); try { Agsubnode_s sn; - Z.z().dummy.getStruct("base").getStruct("tag").setInt("id", id); + ((ST_Agtag_s)Z.z().dummy.getStruct("base").getStruct("tag")).id = id; Z.z().template.setPtr("node", Z.z().dummy.amp()); sn = (Agsubnode_s) (g.getPtr("n_id").call("searchf", g.getPtr("n_id"), Z.z().template.amp(),0000004)); return (Agnode_s) (sn!=null ? sn.getPtr("node") : null); @@ -339,7 +341,7 @@ try { AGID(n, id); AGSEQ(n, seq); n.setPtr("root", agroot(g)); - if (agroot(g).getStruct("desc").getInt("has_attrs")!=0) + if (((ST_Agdesc_s)agroot(g).getStruct("desc")).has_attrs!=0) agbindrec(n, AgDataRecName, sizeof(Agattr_s.class), false); /* nodeattr_init and method_init will be called later, from the * subgraph where the node was actually created, but first it has @@ -396,7 +398,7 @@ LEAVING("3mfxjcaeepn8nitirs3yoqaed","installnodetoroot"); public static void initnode(Agraph_s g, Agnode_s n) { ENTERING("85bb9mezhsgtzar3kqz95mq1","initnode"); try { - if (agroot(g).getStruct("desc").getInt("has_attrs")!=0) + if (((ST_Agdesc_s)agroot(g).getStruct("desc")).has_attrs!=0) agnodeattr_init(g,n); agmethod_init(g, n); } finally { @@ -666,7 +668,7 @@ throw new UnsupportedOperationException(); //1 us7d1n3fefkf0qyr6thv1sai // Dtdisc_t Ag_subnode_id_disc = -/*public static final __struct__<_dtdisc_s> Ag_subnode_id_disc = __struct__.from(_dtdisc_s.class); +/*public static final __struct__<_dtdisc_s> Ag_subnode_id_disc = JUtils.from(_dtdisc_s.class); static { Ag_subnode_id_disc.setInt("key", 0); Ag_subnode_id_disc.setInt("size", 0); @@ -681,7 +683,7 @@ static { //1 3gqjvodjfsv6wz1tk75zy19p9 // Dtdisc_t Ag_subnode_seq_disc = -/*public static final __struct__<_dtdisc_s> Ag_subnode_seq_disc = __struct__.from(_dtdisc_s.class); +/*public static final __struct__<_dtdisc_s> Ag_subnode_seq_disc = JUtils.from(_dtdisc_s.class); static { Ag_subnode_seq_disc.setInt("key", 0); Ag_subnode_seq_disc.setInt("size", 0); diff --git a/src/gen/lib/cgraph/rec__c.java b/src/gen/lib/cgraph/rec__c.java index 88c9ca453..d04fe8591 100644 --- a/src/gen/lib/cgraph/rec__c.java +++ b/src/gen/lib/cgraph/rec__c.java @@ -67,6 +67,8 @@ import h.Agedge_s; import h.Agobj_s; import h.Agraph_s; import h.Agrec_s; +import h.ST_Agdesc_s; +import h.ST_Agtag_s; import smetana.core.CString; import smetana.core.__ptr__; import smetana.core.size_t; @@ -213,11 +215,11 @@ ENTERING("62z9z5vraa2as0c9t108j9xaf","set_data"); try { Agedge_s e; obj.setPtr("data", data); - obj.getStruct("tag").setInt("mtflock", mtflock); + ((ST_Agtag_s)obj.getStruct("tag")).mtflock = mtflock; if ((AGTYPE(obj) == AGINEDGE) || (AGTYPE(obj) == AGOUTEDGE)) { e = (Agedge_s) agopp(obj.castTo(Agedge_s.class)); AGDATA(e, data); - e.getStruct("base").getStruct("tag").setInt("mtflock", mtflock); + ((ST_Agtag_s)e.getStruct("base").getStruct("tag")).mtflock = mtflock; } } finally { LEAVING("62z9z5vraa2as0c9t108j9xaf","set_data"); @@ -246,11 +248,11 @@ try { } } if (d!=null) { - if (hdr.getStruct("tag").getBoolean("mtflock")) { + if (((ST_Agtag_s)hdr.getStruct("tag")).mtflock!=0) { if (mtf && NEQ(hdr.getPtr("data"), d)) System.err.println("move to front lock inconsistency"); } else { - if (NEQ(d, first) || (mtf != hdr.getStruct("tag").getBoolean("mtflock"))) + if (NEQ(d, first) || (mtf != ((((ST_Agtag_s)hdr.getStruct("tag")).mtflock)!=0))) set_data(hdr, d, ASINT(mtf)); /* Always optimize */ } } @@ -282,7 +284,7 @@ try { firstrec.setPtr("next", newrec); } } - if (NOT(obj.getStruct("tag").getInt("mtflock"))) + if (NOT(((ST_Agtag_s)obj.getStruct("tag")).mtflock)) set_data(obj, newrec, (0)); } finally { LEAVING("7sk4k5ipm2jnd244556g1kr6","objputrec"); @@ -307,7 +309,7 @@ try { rec = (Agrec_s) ((__ptr__)agalloc(g, recsize)).castTo(Agrec_s.class); // rec = (Agrec_s) Memory.malloc(Agrec_s.class); rec.setPtr("name", agstrdup(g, recname)); - switch (obj.getStruct("tag").getInt("objtype")) { + switch (((ST_Agtag_s)obj.getStruct("tag")).objtype) { case AGRAPH: objputrec(g, obj, rec); break; diff --git a/src/gen/lib/cgraph/refstr__c.java b/src/gen/lib/cgraph/refstr__c.java index ab919bdd4..0bc080aa6 100644 --- a/src/gen/lib/cgraph/refstr__c.java +++ b/src/gen/lib/cgraph/refstr__c.java @@ -57,6 +57,7 @@ import h._dt_s; import h.refstr_t; import smetana.core.ACCESS; import smetana.core.CString; +import smetana.core.JUtils; import smetana.core.OFFSET; import smetana.core.STARSTAR; import smetana.core.Z; @@ -206,7 +207,7 @@ public class refstr__c { //1 boyxdmkhstn4i64pqf6sv1mi7 // static Dtdisc_t Refstrdisc = -/*static public final __struct__<_dtdisc_s> Refstrdisc = __struct__.from(_dtdisc_s.class); +/*static public final __struct__<_dtdisc_s> Refstrdisc = JUtils.from(_dtdisc_s.class); static { Refstrdisc.setInt("key", OFFSET.create(refstr_t.class, "s").toInt()); // *s is the third field in refstr_t Refstrdisc.setInt("size", -1); @@ -282,7 +283,7 @@ throw new UnsupportedOperationException(); public static refstr_t refsymbind(_dt_s strdict, CString s) { ENTERING("9ts4wqhw2xafdv3tlcilneewq","refsymbind"); try { - final __struct__ key = __struct__.from(refstr_t.class); + final __struct__ key = JUtils.from(refstr_t.class); refstr_t r; // key.setPtr("s", s.duplicate()); key.setPtr("s", s); diff --git a/src/gen/lib/cgraph/subg__c.java b/src/gen/lib/cgraph/subg__c.java index cdf131913..b602bcade 100644 --- a/src/gen/lib/cgraph/subg__c.java +++ b/src/gen/lib/cgraph/subg__c.java @@ -57,8 +57,10 @@ import static smetana.core.Macro.AGRAPH; import static smetana.core.Macro.N; import static smetana.core.Macro.UNSUPPORTED; import h.Agraph_s; +import h.ST_Agdesc_s; import h._dt_s; import smetana.core.CString; +import smetana.core.JUtils; import smetana.core.Z; import smetana.core.__ptr__; import smetana.core.__struct__; @@ -203,7 +205,7 @@ public class subg__c { public static Agraph_s agfindsubg_by_id(Agraph_s g, int id) { ENTERING("11ezyrsjsotjz9b3cyvb4ie8p","agfindsubg_by_id"); try { - final __struct__ template = __struct__.from(Agraph_s.class); + final __struct__ template = JUtils.from(Agraph_s.class); agdtdisc(g, (_dt_s) g.getPtr("g_dict"), Z.z().Ag_subgraph_id_disc.amp()); AGID(template.amp(), id); return (Agraph_s) g.getPtr("g_dict").castTo(_dt_s.class).call("searchf", g.getPtr("g_dict"), template.amp(), 0000004); @@ -227,7 +229,7 @@ try { subg = (Agraph_s) agalloc(g, sizeof(Agraph_s.class)); subg.setPtr("clos", g.getPtr("clos")); subg.setStruct("desc", g.getStruct("desc")); - subg.getStruct("desc").setBoolean("maingraph", false); + ((ST_Agdesc_s)subg.getStruct("desc")).maingraph = 0; subg.setPtr("parent", g); subg.setPtr("root", g.getPtr("root")); AGID(subg, id); diff --git a/src/gen/lib/cgraph/utils__c.java b/src/gen/lib/cgraph/utils__c.java index 96abdda06..d5b74b5ab 100644 --- a/src/gen/lib/cgraph/utils__c.java +++ b/src/gen/lib/cgraph/utils__c.java @@ -61,6 +61,7 @@ import h._dtmethod_s; import smetana.core.Memory; import smetana.core.Z; import smetana.core.size_t; +import smetana.core.amiga.StarStruct; public class utils__c { //1 9k44uhd5foylaeoekf3llonjq @@ -251,7 +252,7 @@ throw new UnsupportedOperationException(); //3 48ox0bg1qmasrer8np51uwsyk // Dict_t *agdtopen(Agraph_t * g, Dtdisc_t * disc, Dtmethod_t * method) -public static _dt_s agdtopen(Agraph_s g, _dtdisc_s disc, _dtmethod_s method) { +public static _dt_s agdtopen(Agraph_s g, StarStruct disc, _dtmethod_s method) { ENTERING("48ox0bg1qmasrer8np51uwsyk","agdtopen"); try { Dtmemory_f memf; diff --git a/src/gen/lib/circogen/block__c.java b/src/gen/lib/circogen/block__c.java index c1759c5a1..659bbbe57 100644 --- a/src/gen/lib/circogen/block__c.java +++ b/src/gen/lib/circogen/block__c.java @@ -49,6 +49,7 @@ import static smetana.core.JUtilsDebug.LEAVING; import static smetana.core.Macro.UNSUPPORTED; import h.boxf; import h.pointf; +import smetana.core.JUtils; import smetana.core.__struct__; public class block__c { @@ -316,7 +317,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -354,7 +355,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -394,7 +395,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/circogen/blockpath__c.java b/src/gen/lib/circogen/blockpath__c.java index 908d74518..4ed713459 100644 --- a/src/gen/lib/circogen/blockpath__c.java +++ b/src/gen/lib/circogen/blockpath__c.java @@ -49,6 +49,7 @@ import static smetana.core.JUtilsDebug.LEAVING; import static smetana.core.Macro.UNSUPPORTED; import h.boxf; import h.pointf; +import smetana.core.JUtils; import smetana.core.__struct__; public class blockpath__c { @@ -316,7 +317,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -354,7 +355,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -394,7 +395,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/circogen/blocktree__c.java b/src/gen/lib/circogen/blocktree__c.java index e25bdc0e2..b519d82fc 100644 --- a/src/gen/lib/circogen/blocktree__c.java +++ b/src/gen/lib/circogen/blocktree__c.java @@ -49,6 +49,7 @@ import static smetana.core.JUtilsDebug.LEAVING; import static smetana.core.Macro.UNSUPPORTED; import h.boxf; import h.pointf; +import smetana.core.JUtils; import smetana.core.__struct__; public class blocktree__c { @@ -316,7 +317,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -354,7 +355,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -394,7 +395,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/circogen/circpos__c.java b/src/gen/lib/circogen/circpos__c.java index 154675404..ff2135c8d 100644 --- a/src/gen/lib/circogen/circpos__c.java +++ b/src/gen/lib/circogen/circpos__c.java @@ -49,6 +49,7 @@ import static smetana.core.JUtilsDebug.LEAVING; import static smetana.core.Macro.UNSUPPORTED; import h.boxf; import h.pointf; +import smetana.core.JUtils; import smetana.core.__struct__; public class circpos__c { @@ -316,7 +317,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -354,7 +355,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -394,7 +395,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/circogen/circular__c.java b/src/gen/lib/circogen/circular__c.java index 6d86c2fe0..93a89308f 100644 --- a/src/gen/lib/circogen/circular__c.java +++ b/src/gen/lib/circogen/circular__c.java @@ -49,6 +49,7 @@ import static smetana.core.JUtilsDebug.LEAVING; import static smetana.core.Macro.UNSUPPORTED; import h.boxf; import h.pointf; +import smetana.core.JUtils; import smetana.core.__struct__; public class circular__c { @@ -316,7 +317,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -354,7 +355,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -394,7 +395,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/circogen/circularinit__c.java b/src/gen/lib/circogen/circularinit__c.java index e92cef389..6a7d87d5a 100644 --- a/src/gen/lib/circogen/circularinit__c.java +++ b/src/gen/lib/circogen/circularinit__c.java @@ -49,6 +49,7 @@ import static smetana.core.JUtilsDebug.LEAVING; import static smetana.core.Macro.UNSUPPORTED; import h.boxf; import h.pointf; +import smetana.core.JUtils; import smetana.core.__struct__; public class circularinit__c { @@ -316,7 +317,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -354,7 +355,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -394,7 +395,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/circogen/deglist__c.java b/src/gen/lib/circogen/deglist__c.java index 4c255cf88..74b6856f3 100644 --- a/src/gen/lib/circogen/deglist__c.java +++ b/src/gen/lib/circogen/deglist__c.java @@ -49,6 +49,7 @@ import static smetana.core.JUtilsDebug.LEAVING; import static smetana.core.Macro.UNSUPPORTED; import h.boxf; import h.pointf; +import smetana.core.JUtils; import smetana.core.__struct__; public class deglist__c { @@ -316,7 +317,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -354,7 +355,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -394,7 +395,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/circogen/edgelist__c.java b/src/gen/lib/circogen/edgelist__c.java index a54d39dcf..80ac12b1d 100644 --- a/src/gen/lib/circogen/edgelist__c.java +++ b/src/gen/lib/circogen/edgelist__c.java @@ -49,6 +49,7 @@ import static smetana.core.JUtilsDebug.LEAVING; import static smetana.core.Macro.UNSUPPORTED; import h.boxf; import h.pointf; +import smetana.core.JUtils; import smetana.core.__struct__; public class edgelist__c { @@ -316,7 +317,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -354,7 +355,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -394,7 +395,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/circogen/nodelist__c.java b/src/gen/lib/circogen/nodelist__c.java index b5cd51d83..b9bef2000 100644 --- a/src/gen/lib/circogen/nodelist__c.java +++ b/src/gen/lib/circogen/nodelist__c.java @@ -49,6 +49,7 @@ import static smetana.core.JUtilsDebug.LEAVING; import static smetana.core.Macro.UNSUPPORTED; import h.boxf; import h.pointf; +import smetana.core.JUtils; import smetana.core.__struct__; public class nodelist__c { @@ -316,7 +317,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -354,7 +355,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -394,7 +395,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/circogen/nodeset__c.java b/src/gen/lib/circogen/nodeset__c.java index cfebe5649..1d773c0c2 100644 --- a/src/gen/lib/circogen/nodeset__c.java +++ b/src/gen/lib/circogen/nodeset__c.java @@ -49,6 +49,7 @@ import static smetana.core.JUtilsDebug.LEAVING; import static smetana.core.Macro.UNSUPPORTED; import h.boxf; import h.pointf; +import smetana.core.JUtils; import smetana.core.__struct__; public class nodeset__c { @@ -316,7 +317,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -354,7 +355,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -394,7 +395,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/common/args__c.java b/src/gen/lib/common/args__c.java index d8c583b77..825ef9e63 100644 --- a/src/gen/lib/common/args__c.java +++ b/src/gen/lib/common/args__c.java @@ -49,6 +49,7 @@ import static smetana.core.JUtilsDebug.LEAVING; import static smetana.core.Macro.UNSUPPORTED; import h.boxf; import h.pointf; +import smetana.core.JUtils; import smetana.core.__struct__; public class args__c { @@ -316,7 +317,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -354,7 +355,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -394,7 +395,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/common/arrows__c.java b/src/gen/lib/common/arrows__c.java index ef467f23e..1c49c22f5 100644 --- a/src/gen/lib/common/arrows__c.java +++ b/src/gen/lib/common/arrows__c.java @@ -64,6 +64,7 @@ import h.boxf; import h.inside_t; import h.pointf; import smetana.core.CString; +import smetana.core.JUtils; import smetana.core.MutableDouble; import smetana.core.Z; import smetana.core.__array_of_struct__; @@ -335,7 +336,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -373,7 +374,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -413,7 +414,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; @@ -735,7 +736,7 @@ static { Arrownames.plus(2).setStruct(create_arrowname_t(null, 0)); } private final static __struct__ create_arrowname_t(String name, int type) { - final __struct__ result = __struct__.from(arrowname_t.class); + final __struct__ result = JUtils.from(arrowname_t.class); result.setCString("name", name==null?null:new CString(name)); result.setInt("type", type); return result; @@ -755,7 +756,7 @@ static { Arrowtypes.plus(8).setStruct(createArrowtypes(0, 0.0, null)); } private final static __struct__ createArrowtypes(int type, double lenfact, CFunction function) { - final __struct__ result = __struct__.from(arrowtype_t.class); + final __struct__ result = JUtils.from(arrowtype_t.class); result.setInt("type", type); result.setDouble("lenfact", lenfact); result.setPtr("gen", function); @@ -932,7 +933,7 @@ LEAVING("7ymcsnwqkr1crisrga0kezh1f","inside"); public static int arrowEndClip(Agedge_s e, __ptr__ ps, int startp, int endp, bezier spl, int eflag) { ENTERING("9eellwhg4gsa2pdszpeqihs2d","arrowEndClip"); try { - final __struct__ inside_context = __struct__.from(inside_t.class); + final __struct__ inside_context = JUtils.from(inside_t.class); final __array_of_struct__ sp = __array_of_struct__.malloc(pointf.class, 4); double elen; MutableDouble elen2 = new MutableDouble(0); @@ -966,34 +967,36 @@ LEAVING("9eellwhg4gsa2pdszpeqihs2d","arrowEndClip"); //3 q7y4oxn0paexbgynmtg2zmiv // int arrowStartClip(edge_t* e, pointf * ps, int startp, int endp, bezier * spl, int sflag) -public static Object arrowStartClip(Object... arg) { -UNSUPPORTED("7yvz6xdsdp7elmx244pl0gazz"); // int arrowStartClip(edge_t* e, pointf * ps, int startp, -UNSUPPORTED("8k5ruwl8qgfm72sur688h274s"); // int endp, bezier * spl, int sflag) -UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // { -UNSUPPORTED("114lbsab8twbq15luo36j31q2"); // inside_t inside_context; -UNSUPPORTED("96gdnugus7n28odgvctx3xuls"); // pointf sp[4]; -UNSUPPORTED("7igs7akkknm38zfqq5ws6i8e1"); // double slen, slen2; -UNSUPPORTED("hda5ej3tl5f5yl2yv519fh9g"); // slen = arrow_length(e, sflag); -UNSUPPORTED("cn1u0njiskbqzm1ytxc60hvhn"); // slen2 = slen * slen; -UNSUPPORTED("4wg1jjuy1tzmozuyrpld67lyo"); // spl->sflag = sflag, spl->sp = ps[startp]; -UNSUPPORTED("3kwfclot4ahgcgki9f7gyz7hp"); // if (endp > startp && DIST2(ps[startp], ps[startp + 3]) < slen2) { -UNSUPPORTED("ee4c7giu5c5wj9p89yhrftlm4"); // startp += 3; -UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // } -UNSUPPORTED("58e2ypxz9985jahejomcb3q9c"); // sp[0] = ps[startp + 3]; -UNSUPPORTED("q6t1k12ql53bpk2kf68hsi5y"); // sp[1] = ps[startp + 2]; -UNSUPPORTED("76tg0a3uda3p8svf251tnr0yi"); // sp[2] = ps[startp + 1]; -UNSUPPORTED("agxcxgo6w8v0tipza7n9c05xt"); // sp[3] = spl->sp; /* ensure endpoint starts inside */ -UNSUPPORTED("58ncmwp330cx9zr4kpm4xoidb"); // inside_context.a.p = &sp[3]; -UNSUPPORTED("80bq4dpb1ulq3sd3d5z3lpmub"); // inside_context.a.r = &slen2; -UNSUPPORTED("90ahfjp59dwgkcrmlb5p9li27"); // bezier_clip(&inside_context, inside, sp, 0); -UNSUPPORTED("7wfhuqxd87aw2hxd3hl4izmjh"); // ps[startp] = sp[3]; -UNSUPPORTED("3olq3bup4vl7pzvxu3imphze9"); // ps[startp + 1] = sp[2]; -UNSUPPORTED("dm3yq6cmfbrst02xdf1yqfx3j"); // ps[startp + 2] = sp[1]; -UNSUPPORTED("49s7487urjz20iy0mbbgjvrjh"); // ps[startp + 3] = sp[0]; -UNSUPPORTED("4acg3jbqtner5sse4kbl0829m"); // return startp; -UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // } - -throw new UnsupportedOperationException(); +public static int arrowStartClip(Agedge_s e, __ptr__ ps, int startp, int endp, bezier spl, int sflag) { +ENTERING("q7y4oxn0paexbgynmtg2zmiv","arrowStartClip"); +try { + final __struct__ inside_context = JUtils.from(inside_t.class); + final __array_of_struct__ sp = __array_of_struct__.malloc(pointf.class, 4); + double slen; + MutableDouble slen2 = new MutableDouble(0); + slen = arrow_length(e, sflag); + slen2.setValue(slen * slen); + spl.setInt("sflag", sflag); + spl.setStruct("sp", ps.plus(startp).getStruct()); + if (endp > startp && DIST2(ps.plus(startp).getPtr(), ps.plus(startp + 3).getPtr()) < slen2.getValue()) { + startp += 3; + } + sp.plus(0).setStruct(ps.plus(startp+3).getStruct()); + sp.plus(1).setStruct(ps.plus(startp+2).getStruct()); + sp.plus(2).setStruct(ps.plus(startp+1).getStruct()); + sp.plus(3).setStruct(spl.getStruct("sp")); + /* ensure endpoint starts inside */ + inside_context.setPtr("a.p", sp.plus(3).asPtr()); + inside_context.setPtr("a.r", slen2.amp()); + bezier_clip(inside_context.amp(), function(arrows__c.class, "inside"), sp, false); + ps.plus(startp).setStruct(sp.plus(3).getStruct()); + ps.plus(startp+1).setStruct(sp.plus(2).getStruct()); + ps.plus(startp+2).setStruct(sp.plus(1).getStruct()); + ps.plus(startp+3).setStruct(sp.plus(0).getStruct()); + return startp; +} finally { +LEAVING("9eellwhg4gsa2pdszpeqihs2d","arrowEndClip"); +} } diff --git a/src/gen/lib/common/ellipse__c.java b/src/gen/lib/common/ellipse__c.java index ec1b87cc3..c4677075e 100644 --- a/src/gen/lib/common/ellipse__c.java +++ b/src/gen/lib/common/ellipse__c.java @@ -49,6 +49,7 @@ import static smetana.core.JUtilsDebug.LEAVING; import static smetana.core.Macro.UNSUPPORTED; import h.boxf; import h.pointf; +import smetana.core.JUtils; import smetana.core.__struct__; public class ellipse__c { @@ -316,7 +317,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -354,7 +355,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -394,7 +395,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/common/emit__c.java b/src/gen/lib/common/emit__c.java index 3b6e149b1..c58ad8095 100644 --- a/src/gen/lib/common/emit__c.java +++ b/src/gen/lib/common/emit__c.java @@ -56,6 +56,7 @@ import h.boxf; import h.pointf; import h.xdot; import smetana.core.CString; +import smetana.core.JUtils; import smetana.core.__array_of_struct__; import smetana.core.__ptr__; import smetana.core.__struct__; @@ -325,7 +326,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -363,7 +364,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -403,7 +404,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/common/geom__c.java b/src/gen/lib/common/geom__c.java index 580a14a12..85533efed 100644 --- a/src/gen/lib/common/geom__c.java +++ b/src/gen/lib/common/geom__c.java @@ -49,6 +49,7 @@ import static smetana.core.JUtilsDebug.LEAVING; import static smetana.core.Macro.UNSUPPORTED; import h.boxf; import h.pointf; +import smetana.core.JUtils; import smetana.core.__struct__; public class geom__c { @@ -80,7 +81,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -118,7 +119,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -158,7 +159,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/common/globals__c.java b/src/gen/lib/common/globals__c.java index 8a97e6cb6..4ec9eb0bf 100644 --- a/src/gen/lib/common/globals__c.java +++ b/src/gen/lib/common/globals__c.java @@ -49,6 +49,7 @@ import static smetana.core.JUtilsDebug.LEAVING; import static smetana.core.Macro.UNSUPPORTED; import h.boxf; import h.pointf; +import smetana.core.JUtils; import smetana.core.__struct__; public class globals__c { @@ -344,7 +345,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -382,7 +383,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -422,7 +423,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/common/htmllex__c.java b/src/gen/lib/common/htmllex__c.java index 102ea613e..9c56dd21a 100644 --- a/src/gen/lib/common/htmllex__c.java +++ b/src/gen/lib/common/htmllex__c.java @@ -49,6 +49,7 @@ import static smetana.core.JUtilsDebug.LEAVING; import static smetana.core.Macro.UNSUPPORTED; import h.boxf; import h.pointf; +import smetana.core.JUtils; import smetana.core.__struct__; public class htmllex__c { @@ -316,7 +317,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -354,7 +355,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -394,7 +395,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/common/htmlparse__c.java b/src/gen/lib/common/htmlparse__c.java index c608a5446..1f616a6c9 100644 --- a/src/gen/lib/common/htmlparse__c.java +++ b/src/gen/lib/common/htmlparse__c.java @@ -49,6 +49,7 @@ import static smetana.core.JUtilsDebug.LEAVING; import static smetana.core.Macro.UNSUPPORTED; import h.boxf; import h.pointf; +import smetana.core.JUtils; import smetana.core.__struct__; public class htmlparse__c { @@ -316,7 +317,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -354,7 +355,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -394,7 +395,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/common/htmltable__c.java b/src/gen/lib/common/htmltable__c.java index 87e03fbd9..7d663364f 100644 --- a/src/gen/lib/common/htmltable__c.java +++ b/src/gen/lib/common/htmltable__c.java @@ -50,6 +50,7 @@ import static smetana.core.Macro.UNSUPPORTED; import h.boxf; import h.pointf; import h.textlabel_t; +import smetana.core.JUtils; import smetana.core.__ptr__; import smetana.core.__struct__; @@ -318,7 +319,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -356,7 +357,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -396,7 +397,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/common/input__c.java b/src/gen/lib/common/input__c.java index 6b22c8736..115d98b6c 100644 --- a/src/gen/lib/common/input__c.java +++ b/src/gen/lib/common/input__c.java @@ -93,6 +93,7 @@ import h.fontname_kind; import h.layout_t; import h.pointf; import smetana.core.CString; +import smetana.core.JUtils; import smetana.core.Z; import smetana.core.__struct__; @@ -361,7 +362,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -399,7 +400,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -439,7 +440,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; @@ -1562,7 +1563,7 @@ try { /* it would be nice to allow multiple graph labels in the future */ if ((str = agget(sg, new CString("label")))!=null && (str.charAt(0) != '\0')) { char pos_flag=0; - final __struct__ dimen = __struct__.from(pointf.class); + final __struct__ dimen = JUtils.from(pointf.class); GD_has_labels(sg.getPtr("root"), GD_has_labels(sg.getPtr("root")) | (1 << 3)); GD_label(sg, make_label(sg, str, (aghtmlstr(str)!=0 ? (1 << 1) : (0 << 1)), late_double(sg, (agattr(sg,AGRAPH,new CString("fontsize"),null)), @@ -1596,7 +1597,7 @@ UNSUPPORTED("evu9w6pw3kkh7z8w7t4rx4qxc"); // pos_flag |= 4; return; /* Set border information for cluster labels to allow space */ - dimen.____(GD_label(sg).getStruct("dimen")); + dimen.___(GD_label(sg).getStruct("dimen")); dimen.setDouble("x", dimen.getDouble("x") + 4*4); dimen.setDouble("y", dimen.getDouble("y") + 2*4); if (N(GD_flip(agroot(sg)))) { diff --git a/src/gen/lib/common/labels__c.java b/src/gen/lib/common/labels__c.java index fe916be27..4aa1671b7 100644 --- a/src/gen/lib/common/labels__c.java +++ b/src/gen/lib/common/labels__c.java @@ -77,12 +77,14 @@ import h.Agobj_s; import h.Agraph_s; import h.Agraphinfo_t; import h.GVC_s; +import h.ST_pointf; +import h.ST_port; import h.boxf; import h.pointf; -import h.port; import h.textlabel_t; import h.textspan_t; import smetana.core.CString; +import smetana.core.JUtils; import smetana.core.Memory; import smetana.core.Z; import smetana.core.__ptr__; @@ -353,7 +355,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -391,7 +393,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -431,7 +433,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; @@ -730,11 +732,11 @@ throw new UnsupportedOperationException(); //3 4wkeqik2dt7ecr64ej6ltbnvb // static void storeline(GVC_t *gvc, textlabel_t *lp, char *line, char terminator) -//private static __struct__ tf = __struct__.from(textfont_t.class); +//private static __struct__ tf = JUtils.from(textfont_t.class); public static void storeline(GVC_s gvc, textlabel_t lp, CString line, char terminator) { ENTERING("4wkeqik2dt7ecr64ej6ltbnvb","storeline"); try { - final __struct__ size = __struct__.from(pointf.class); + final __struct__ size = JUtils.from(pointf.class); __ptr__ span = null; int oldsz = lp.getInt("u.txt.nspans") + 1; lp.setPtr("u.txt.span", ZALLOC(oldsz + 1, lp.getPtr("u.txt.span"), textspan_t.class, oldsz)); @@ -745,22 +747,22 @@ try { Z.z().tf.setPtr("name", lp.getPtr("fontname")); Z.z().tf.setDouble("size", lp.getDouble("fontsize")); // WE CHEAT - size.setDouble("x", 0.0); - size.setDouble("y", (int)(lp.getDouble("fontsize") * 1.20)); + ((ST_pointf) size).x = 0.0; + ((ST_pointf) size).y = (int)(lp.getDouble("fontsize") * 1.20); hackInitDimensionFromLabel(size, line.getContent()); - span.getStruct("size").setDouble("y", (int)size.getDouble("y")); + ((ST_pointf) span.getStruct("size")).y = (int)size.getDouble("y"); } else { System.err.println("YOU SHOULD NOT SEE THAT"); - size.setDouble("x", 0.0); - size.setDouble("y", (int)(lp.getDouble("fontsize") * 1.20)); + ((ST_pointf) size).x = 0.0; + ((ST_pointf) size).y = (int)(lp.getDouble("fontsize") * 1.20); span.getStruct("size").setDouble("y", (int)(lp.getDouble("fontsize") * 1.20)); } lp.setInt("u.txt.nspans", lp.getInt("u.txt.nspans") + 1); /* width = max line width */ - lp.getStruct("dimen").setDouble("x", MAX(lp.getStruct("dimen").getDouble("x"), size.getDouble("x"))); + ((ST_pointf) lp.getStruct("dimen")).x = MAX(lp.getStruct("dimen").getDouble("x"), size.getDouble("x")); /* accumulate height */ - lp.getStruct("dimen").setDouble("y", lp.getStruct("dimen").getDouble("y") + size.getDouble("y")); + ((ST_pointf) lp.getStruct("dimen")).y = lp.getStruct("dimen").getDouble("y") + size.getDouble("y"); } finally { LEAVING("4wkeqik2dt7ecr64ej6ltbnvb","storeline"); } @@ -777,8 +779,8 @@ try { char c; CString p, line, lineptr, str = lp.getCString("text"); char bytee = 0x00; - lp.getStruct("dimen").setDouble("x", 0.0); - lp.getStruct("dimen").setDouble("y", 0.0); + ((ST_pointf) lp.getStruct("dimen")).x = 0.0; + ((ST_pointf) lp.getStruct("dimen")).y = 0.0; if (str.charAt(0) == '\0') return; line = lineptr = null; @@ -1043,7 +1045,7 @@ try { int newlen = 0; int isEdge = 0; textlabel_t tl; - final __struct__ pt = __struct__.from(port.class); + final ST_port pt = new ST_port(); /* prepare substitution strings */ switch (agobjkind(obj)) { case AGRAPH: @@ -1072,13 +1074,13 @@ try { g_len = strlen(g_str); t_str = agnameof(agtail((obj.castTo(Agedge_s.class)))); t_len = strlen(t_str); - pt.____(ED_tail_port(obj.castTo(Agedge_s.class))); - if ((tp_str = pt.getCString("name"))!=null) + pt.___(ED_tail_port(obj.castTo(Agedge_s.class))); + if ((tp_str = pt.name)!=null) tp_len = strlen(tp_str); h_str = agnameof(aghead((obj.castTo(Agedge_s.class)))); h_len = strlen(h_str); - pt.____(ED_head_port(obj.castTo(Agedge_s.class))); - if ((hp_str = pt.getCString("name"))!=null) + pt.___(ED_head_port(obj.castTo(Agedge_s.class))); + if ((hp_str = pt.name)!=null) hp_len = strlen(hp_str); h_len = strlen(h_str); tl = ED_label(obj.castTo(Agedge_s.class)); diff --git a/src/gen/lib/common/ns__c.java b/src/gen/lib/common/ns__c.java index 3ffd9fcc7..b22bb7ab0 100644 --- a/src/gen/lib/common/ns__c.java +++ b/src/gen/lib/common/ns__c.java @@ -95,6 +95,7 @@ import h.boxf; import h.nodequeue; import h.pointf; import smetana.core.CString; +import smetana.core.JUtils; import smetana.core.Memory; import smetana.core.Z; import smetana.core.__ptr__; @@ -366,7 +367,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -404,7 +405,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -444,7 +445,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; @@ -764,11 +765,11 @@ private static jmp_buf jbuf = new jmp_buf(); //1 3t9aql1n1eclyvy7p2nwyacor // static nlist_t Tree_node -//private static final __struct__ Tree_node = __struct__.from(nlist_t.class); +//private static final __struct__ Tree_node = JUtils.from(nlist_t.class); //1 11b7xeg0x1f09v305mxwvgbhs // static elist Tree_edge -//private static final __struct__ Tree_edge = __struct__.from(elist.class); +//private static final __struct__ Tree_edge = JUtils.from(elist.class); @@ -782,39 +783,39 @@ try { UNSUPPORTED("cq4nqjjxvb0dtdfy4c7pwpqai"); // agerr(AGERR, "add_tree_edge: missing tree edge\n"); UNSUPPORTED("6fzmgjpkhmnx0a2cnt0q0rceg"); // longjmp (jbuf, 1); } - ED_tree_index(e, Z.z().Tree_edge.getInt("size")); + ED_tree_index(e, Z.z().Tree_edge.size); - Z.z().Tree_edge.getArrayOfPtr("list").plus(Z.z().Tree_edge.getInt("size")).setPtr(e); - Z.z().Tree_edge.setInt("size", 1+ Z.z().Tree_edge.getInt("size")); + Z.z().Tree_edge.setInList(Z.z().Tree_edge.size, e); + Z.z().Tree_edge.size = 1+ Z.z().Tree_edge.size; if (ND_mark(agtail(e)) == 0) { - Z.z().Tree_node.getArrayOfPtr("list").plus(Z.z().Tree_node.getInt("size")).setPtr(agtail(e)); - Z.z().Tree_node.setInt("size", 1+ Z.z().Tree_node.getInt("size")); + Z.z().Tree_node.setInList(Z.z().Tree_node.size, agtail(e)); + Z.z().Tree_node.size = 1+ Z.z().Tree_node.size; } if (ND_mark(aghead(e)) == 0) { - Z.z().Tree_node.getArrayOfPtr("list").plus(Z.z().Tree_node.getInt("size")).setPtr(aghead(e)); - Z.z().Tree_node.setInt("size", 1+ Z.z().Tree_node.getInt("size")); + Z.z().Tree_node.setInList(Z.z().Tree_node.size, aghead(e)); + Z.z().Tree_node.size = 1+ Z.z().Tree_node.size; } n = agtail(e); ND_mark(n, 1); - ND_tree_out(n).getArrayOfPtr("list").plus(ND_tree_out(n).getInt("size")).setPtr(e); - ND_tree_out(n).setInt("size", 1+ND_tree_out(n).getInt("size")); - ND_tree_out(n).getArrayOfPtr("list").plus(ND_tree_out(n).getInt("size")).setPtr(null); + ND_tree_out(n).setInList(ND_tree_out(n).size, e); + ND_tree_out(n).size = 1+ND_tree_out(n).size; + ND_tree_out(n).setInList(ND_tree_out(n).size, null); - if (ND_out(n).getArrayOfPtr("list").plus(ND_tree_out(n).getInt("size") - 1).getPtr() == null) { + if (ND_out(n).getFromList(ND_tree_out(n).size - 1) == null) { UNSUPPORTED("9src34zgmgy8yvdzfs1ozlh0w"); // agerr(AGERR, "add_tree_edge: empty outedge list\n"); UNSUPPORTED("6fzmgjpkhmnx0a2cnt0q0rceg"); // longjmp (jbuf, 1); } n = aghead(e); ND_mark(n, 1); - ND_tree_in(n).getArrayOfPtr("list").plus(ND_tree_in(n).getInt("size")).setPtr(e); - ND_tree_in(n).setInt("size", 1+ND_tree_in(n).getInt("size")); - ND_tree_in(n).getArrayOfPtr("list").plus(ND_tree_in(n).getInt("size")).setPtr(null); + ND_tree_in(n).setInList(ND_tree_in(n).size, e); + ND_tree_in(n).size = 1+ND_tree_in(n).size; + ND_tree_in(n).setInList(ND_tree_in(n).size, null); - if (ND_in(n).getArrayOfPtr("list").plus(ND_tree_in(n).getInt("size") - 1).getPtr() == null) { + if (ND_in(n).getFromList(ND_tree_in(n).size - 1) == null) { UNSUPPORTED("f0uri98pv606g2qjpy9k385cy"); // agerr(AGERR, "add_tree_edge: empty inedge list\n"); UNSUPPORTED("6fzmgjpkhmnx0a2cnt0q0rceg"); // longjmp (jbuf, 1); } @@ -834,32 +835,32 @@ try { int i, j; Agnode_s n; ED_tree_index(f, ED_tree_index(e)); - Z.z().Tree_edge.getArrayOfPtr("list").plus(ED_tree_index(e)).setPtr(f); + Z.z().Tree_edge.setInList(ED_tree_index(e), f); ED_tree_index(e, -1); n = agtail(e); - ND_tree_out(n).setInt("size", ND_tree_out(n).getInt("size") -1); - i = ND_tree_out(n).getInt("size"); + ND_tree_out(n).size = ND_tree_out(n).size -1; + i = ND_tree_out(n).size; for (j = 0; j <= i; j++) - if (EQ(ND_tree_out(n).getArrayOfPtr("list").plus(j).getPtr(), e)) + if (EQ(ND_tree_out(n).getFromList(j), e)) break; - ND_tree_out(n).getArrayOfPtr("list").plus(j).setPtr(ND_tree_out(n).getArrayOfPtr("list").plus(i).getPtr()); - ND_tree_out(n).getArrayOfPtr("list").plus(i).setPtr(null); + ND_tree_out(n).setInList(j, ND_tree_out(n).getFromList(i)); + ND_tree_out(n).setInList(i, null); n = aghead(e); - ND_tree_in(n).setInt("size", ND_tree_in(n).getInt("size") -1); - i = ND_tree_in(n).getInt("size"); + ND_tree_in(n).size = ND_tree_in(n).size -1; + i = ND_tree_in(n).size; for (j = 0; j <= i; j++) - if (EQ(ND_tree_in(n).getArrayOfPtr("list").plus(j).getPtr(), e)) + if (EQ(ND_tree_in(n).getFromList(j), e)) break; - ND_tree_in(n).getArrayOfPtr("list").plus(j).setPtr(ND_tree_in(n).getArrayOfPtr("list").plus(i).getPtr()); - ND_tree_in(n).getArrayOfPtr("list").plus(i).setPtr(null); + ND_tree_in(n).setInList(j, ND_tree_in(n).getFromList(i)); + ND_tree_in(n).setInList(i, null); n = agtail(f); - ND_tree_out(n).getArrayOfPtr("list").plus(ND_tree_out(n).getInt("size")).setPtr(f); - ND_tree_out(n).setInt("size", ND_tree_out(n).getInt("size") +1); - ND_tree_out(n).getArrayOfPtr("list").plus(ND_tree_out(n).getInt("size")).setPtr(null); + ND_tree_out(n).setInList(ND_tree_out(n).size, f); + ND_tree_out(n).size = ND_tree_out(n).size +1; + ND_tree_out(n).setInList(ND_tree_out(n).size, null); n = aghead(f); - ND_tree_in(n).getArrayOfPtr("list").plus(ND_tree_in(n).getInt("size")).setPtr(f); - ND_tree_in(n).setInt("size", ND_tree_in(n).getInt("size") +1); - ND_tree_in(n).getArrayOfPtr("list").plus(ND_tree_in(n).getInt("size")).setPtr(null); + ND_tree_in(n).setInList(ND_tree_in(n).size, f); + ND_tree_in(n).size = ND_tree_in(n).size +1; + ND_tree_in(n).setInList(ND_tree_in(n).size, null); } finally { LEAVING("9b7b78pmafynmvffztrqnlxtn","exchange_tree_edges"); } @@ -886,9 +887,9 @@ try { while ((v = dequeue(Q))!=null) { ND_rank(v, 0); ctr++; - for (i = 0; (e = (Agedge_s) ND_in(v).getArrayOfPtr("list").plus(i).getPtr())!=null; i++) + for (i = 0; (e = (Agedge_s) ND_in(v).getFromList(i))!=null; i++) ND_rank(v, MAX(ND_rank(v), ND_rank(agtail(e)) + ED_minlen(e))); - for (i = 0; (e = (Agedge_s) ND_out(v).getArrayOfPtr("list").plus(i).getPtr())!=null; i++) { + for (i = 0; (e = (Agedge_s) ND_out(v).getFromList(i))!=null; i++) { ND_priority(aghead(e), ND_priority(aghead(e)) -1 ); if ((ND_priority(aghead(e))) <= 0) enqueue(Q, aghead(e)); @@ -938,13 +939,13 @@ try { Agedge_s f, rv = null; int j, cnt = 0; j = Z.z().S_i; - while (Z.z().S_i < Z.z().Tree_edge.getInt("size")) { - if (ED_cutvalue(f = (Agedge_s) Z.z().Tree_edge.getArrayOfPtr("list").plus(Z.z().S_i).getPtr()) < 0) { + while (Z.z().S_i < Z.z().Tree_edge.size) { + if (ED_cutvalue(f = (Agedge_s) Z.z().Tree_edge.getFromList(Z.z().S_i)) < 0) { if (rv!=null) { if (ED_cutvalue(rv) > ED_cutvalue(f)) rv = f; } else - rv = (Agedge_s) Z.z().Tree_edge.getArrayOfPtr("list").plus(Z.z().S_i).getPtr(); + rv = (Agedge_s) Z.z().Tree_edge.getFromList(Z.z().S_i); if (++cnt >= Z.z().Search_size) return rv; } @@ -953,12 +954,12 @@ try { if (j > 0) { Z.z().S_i = 0; while (Z.z().S_i < j) { - if (ED_cutvalue(f = (Agedge_s) Z.z().Tree_edge.getArrayOfPtr("list").plus(Z.z().S_i).getPtr()) < 0) { + if (ED_cutvalue(f = (Agedge_s) Z.z().Tree_edge.getFromList(Z.z().S_i)) < 0) { if (rv!=null) { if (ED_cutvalue(rv) > ED_cutvalue(f)) rv = f; } else - rv = (Agedge_s) Z.z().Tree_edge.getArrayOfPtr("list").plus(Z.z().S_i).getPtr(); + rv = (Agedge_s) Z.z().Tree_edge.getFromList(Z.z().S_i); if (++cnt >= Z.z().Search_size) return rv; } @@ -989,7 +990,7 @@ ENTERING("10lkpr4y40luvy2idlozfiva3","dfs_enter_outedge"); try { int i, slack; Agedge_s e; - for (i = 0; (e = (Agedge_s) ND_out(v).getArrayOfPtr("list").plus(i).getPtr())!=null; i++) { + for (i = 0; (e = (Agedge_s) ND_out(v).getFromList(i))!=null; i++) { if (TREE_EDGE(e) == false) { if (N(SEQ(Z.z().Low, ND_lim(aghead(e)), Z.z().Lim))) { slack = SLACK(e); @@ -1001,7 +1002,7 @@ try { } else if (ND_lim(aghead(e)) < ND_lim(v)) dfs_enter_outedge(aghead(e)); } - for (i = 0; (e = (Agedge_s) ND_tree_in(v).getArrayOfPtr("list").plus(i).getPtr())!=null && (Z.z().Slack > 0); i++) + for (i = 0; (e = (Agedge_s) ND_tree_in(v).getFromList(i))!=null && (Z.z().Slack > 0); i++) if (ND_lim(agtail(e)) < ND_lim(v)) dfs_enter_outedge(agtail(e)); } finally { @@ -1019,7 +1020,7 @@ ENTERING("2z9nii6380p8qlql8nznzgvof","dfs_enter_inedge"); try { int i, slack; Agedge_s e; - for (i = 0; (e = (Agedge_s) ND_in(v).getArrayOfPtr("list").plus(i).getPtr())!=null; i++) { + for (i = 0; (e = (Agedge_s) ND_in(v).getFromList(i))!=null; i++) { if (TREE_EDGE(e) == false) { if (N(SEQ(Z.z().Low, ND_lim(agtail(e)), Z.z().Lim))) { slack = SLACK(e); @@ -1031,7 +1032,7 @@ try { } else if (ND_lim(agtail(e)) < ND_lim(v)) dfs_enter_inedge(agtail(e)); } - for (i = 0; (e = (Agedge_s) ND_tree_out(v).getArrayOfPtr("list").plus(i).getPtr())!=null && (Z.z().Slack > 0); i++) + for (i = 0; (e = (Agedge_s) ND_tree_out(v).getFromList(i))!=null && (Z.z().Slack > 0); i++) if (ND_lim(aghead(e)) < ND_lim(v)) dfs_enter_inedge(aghead(e)); } finally { @@ -1081,17 +1082,17 @@ ENTERING("1gvyafmercq92v3lg6gb33cbt","treesearch"); try { int i; Agedge_s e; - for (i = 0; (e = (Agedge_s) ND_out(v).getArrayOfPtr("list").plus(i).getPtr())!=null; i++) { + for (i = 0; (e = (Agedge_s) ND_out(v).getFromList(i))!=null; i++) { if ((ND_mark(aghead(e)) == 0) && (SLACK(e) == 0)) { add_tree_edge(e); - if ((Z.z().Tree_edge.getInt("size") == Z.z().N_nodes - 1) || treesearch(aghead(e))) + if ((Z.z().Tree_edge.size == Z.z().N_nodes - 1) || treesearch(aghead(e))) return NOT(0); } } - for (i = 0; (e = (Agedge_s) ND_in(v).getArrayOfPtr("list").plus(i).getPtr())!=null; i++) { + for (i = 0; (e = (Agedge_s) ND_in(v).getFromList(i))!=null; i++) { if ((ND_mark(agtail(e)) == 0) && (SLACK(e) == 0)) { add_tree_edge(e); - if ((Z.z().Tree_edge.getInt("size") == Z.z().N_nodes - 1) || treesearch(agtail(e))) + if ((Z.z().Tree_edge.size == Z.z().N_nodes - 1) || treesearch(agtail(e))) return NOT(0); } } @@ -1113,18 +1114,18 @@ try { Agnode_s n; for (n = GD_nlist(Z.z().G_ns); n!=null; n = ND_next(n)) { ND_mark(n, 0); - ND_tree_in(n).getArrayOfPtr("list").plus(0).setPtr(null); - ND_tree_out(n).getArrayOfPtr("list").plus(0).setPtr(null); - ND_tree_in(n).setInt("size", 0); - ND_tree_out(n).setInt("size", 0); + ND_tree_in(n).setInList(0, null); + ND_tree_out(n).setInList(0, null); + ND_tree_in(n).size = 0; + ND_tree_out(n).size = 0; } - for (i = 0; i < Z.z().Tree_edge.getInt("size"); i++) - ED_tree_index(Z.z().Tree_edge.getArrayOfPtr("list").plus(i).getPtr(), -1); - Z.z().Tree_node.setInt("size", 0); - Z.z().Tree_edge.setInt("size", 0); - for (n = GD_nlist(Z.z().G_ns); n!=null && (Z.z().Tree_edge.getInt("size") == 0); n = ND_next(n)) + for (i = 0; i < Z.z().Tree_edge.size; i++) + ED_tree_index(Z.z().Tree_edge.getFromList(i), -1); + Z.z().Tree_node.size = 0; + Z.z().Tree_edge.size = 0; + for (n = GD_nlist(Z.z().G_ns); n!=null && (Z.z().Tree_edge.size == 0); n = ND_next(n)) treesearch(n); - return Z.z().Tree_node.getInt("size"); + return Z.z().Tree_node.size; } finally { LEAVING("c98bj1u8j43cdezeczn33mec0","tight_tree"); } @@ -1161,7 +1162,7 @@ try { while (tight_tree() < Z.z().N_nodes) { e = null; for (n = GD_nlist(Z.z().G_ns); n!=null; n = ND_next(n)) { - for (i = 0; (f = (Agedge_s) ND_out(n).getArrayOfPtr("list").plus(i).getPtr())!=null; i++) { + for (i = 0; (f = (Agedge_s) ND_out(n).getFromList(i))!=null; i++) { if ((TREE_EDGE(f) == false) && incident(f)!=null && ((e == null) || (SLACK(f) < @@ -1175,8 +1176,8 @@ try { if (delta!=0) { if (EQ(incident(e), aghead(e))) delta = -delta; - for (i = 0; i < Z.z().Tree_node.getInt("size"); i++) - ND_rank(Z.z().Tree_node.getArrayOfPtr("list").plus(i).getPtr(), ND_rank(Z.z().Tree_node.getArrayOfPtr("list").plus(i).getPtr()) + delta); + for (i = 0; i < Z.z().Tree_node.size; i++) + ND_rank(Z.z().Tree_node.getFromList(i), ND_rank(Z.z().Tree_node.getFromList(i)) + delta); } } else { return 1; @@ -1231,10 +1232,10 @@ try { int i; Agedge_s e; ND_rank(v, ND_rank(v) - delta); - for (i = 0; (e = (Agedge_s) ND_tree_out(v).getArrayOfPtr("list").plus(i).getPtr())!=null; i++) + for (i = 0; (e = (Agedge_s) ND_tree_out(v).getFromList(i))!=null; i++) if (NEQ(e, ND_par(v))) rerank(aghead(e), delta); - for (i = 0; (e = (Agedge_s) ND_tree_in(v).getArrayOfPtr("list").plus(i).getPtr())!=null; i++) + for (i = 0; (e = (Agedge_s) ND_tree_in(v).getFromList(i))!=null; i++) if (NEQ(e, ND_par(v))) rerank(agtail(e), delta); } finally { @@ -1256,11 +1257,11 @@ try { /* "for (v = in nodes in tail side of e) do ND_rank(v) -= delta;" */ if (delta > 0) { int s; - s = ND_tree_in(agtail(e)).getInt("size") + ND_tree_out(agtail(e)).getInt("size"); + s = ND_tree_in(agtail(e)).size + ND_tree_out(agtail(e)).size; if (s == 1) rerank(agtail(e), delta); else { - s = ND_tree_in(aghead(e)).getInt("size") + ND_tree_out(aghead(e)).getInt("size"); + s = ND_tree_in(aghead(e)).size + ND_tree_out(aghead(e)).size; if (s == 1) rerank(aghead(e), -delta); else { @@ -1343,8 +1344,8 @@ ENTERING("9gx8p7md3v3mzp640xdjj814a","LR_balance"); try { int i, delta; Agedge_s e, f; - for (i = 0; i < Z.z().Tree_edge.getInt("size"); i++) { - e = (Agedge_s) Z.z().Tree_edge.getArrayOfPtr("list").plus(i).getPtr(); + for (i = 0; i < Z.z().Tree_edge.size; i++) { + e = (Agedge_s) Z.z().Tree_edge.getFromList(i); if (ED_cutvalue(e) == 0) { f = enter_edge(e); if (f == null) @@ -1391,11 +1392,11 @@ try { inweight = outweight = 0; low = 0; high = Z.z().Maxrank; - for (i = 0; (e = (Agedge_s) ND_in(n).getArrayOfPtr("list").plus(i).getPtr())!=null; i++) { + for (i = 0; (e = (Agedge_s) ND_in(n).getFromList(i))!=null; i++) { inweight += ED_weight(e); low = MAX(low, ND_rank(agtail(e)) + ED_minlen(e)); } - for (i = 0; (e = (Agedge_s) ND_out(n).getArrayOfPtr("list").plus(i).getPtr())!=null; i++) { + for (i = 0; (e = (Agedge_s) ND_out(n).getFromList(i))!=null; i++) { outweight += ED_weight(e); high = MIN(high, ND_rank(aghead(e)) - ED_minlen(e)); } @@ -1436,17 +1437,18 @@ try { for (n = GD_nlist(g); n!=null; n = ND_next(n)) { ND_mark(n, 0); Z.z().N_nodes++; - for (i = 0; (e = (Agedge_s) ND_out(n).getArrayOfPtr("list").plus(i).getPtr())!=null; i++) + for (i = 0; (e = (Agedge_s) ND_out(n).getFromList(i))!=null; i++) Z.z().N_edges++; } - Z.z().Tree_node.setPtr("list", ALLOC_empty(Z.z().N_nodes, Z.z().Tree_node.getPtr("list"), Agnode_s.class)); - Z.z().Tree_node.setInt("size", 0); - Z.z().Tree_edge.setPtr("list", ALLOC_empty(Z.z().N_nodes, Z.z().Tree_edge.getPtr("list"), Agedge_s.class)); - Z.z().Tree_edge.setInt("size", 0); + Z.z().Tree_node.reallocEmpty(Z.z().N_nodes, Agnode_s.class); + Z.z().Tree_node.size = 0; + // Z.z().Tree_edge.setPtr("list", ALLOC_empty(Z.z().N_nodes, Z.z().Tree_edge.getPtr("list"), Agedge_s.class)); + Z.z().Tree_edge.realloc(Z.z().N_nodes); + Z.z().Tree_edge.size = 0; feasible = 1; for (n = GD_nlist(g); n!=null; n = ND_next(n)) { ND_priority(n, 0); - for (i = 0; (e = (Agedge_s) ND_in(n).getArrayOfPtr("list").plus(i).getPtr())!=null; i++) { + for (i = 0; (e = (Agedge_s) ND_in(n).getFromList(i))!=null; i++) { ND_priority(n, 1+ND_priority(n)); ED_cutvalue(e, 0); ED_tree_index(e, -1); @@ -1454,11 +1456,13 @@ try { && (ND_rank(aghead(e)) - ND_rank(agtail(e)) < ED_minlen(e))) feasible = 0; } - ND_tree_in(n).setPtr("list", zmalloc(sizeof(Agedge_s.class, i+1)));; - ND_tree_in(n).setInt("size", 0); - for (i = 0; (e = (Agedge_s) ND_out(n).getArrayOfPtr("list").plus(i).getPtr())!=null; i++); - ND_tree_out(n).setPtr("list", zmalloc(sizeof(Agedge_s.class, i+1))); - ND_tree_out(n).setInt("size", 0); + // ND_tree_in(n).setPtr("list", zmalloc(sizeof(Agedge_s.class, i+1)));; + ND_tree_in(n).mallocEmpty(Agedge_s.class, i+1); + ND_tree_in(n).size = 0; + for (i = 0; (e = (Agedge_s) ND_out(n).getFromList(i))!=null; i++); + // ND_tree_out(n).setPtr("list", zmalloc(sizeof(Agedge_s.class, i+1))); + ND_tree_out(n).mallocEmpty(Agedge_s.class, i+1); + ND_tree_out(n).size = 0; } return feasible; } finally { @@ -1606,9 +1610,9 @@ try { dir = -1; } sum = 0; - for (i = 0; (e = (Agedge_s) ND_out(v).getArrayOfPtr("list").plus(i).getPtr())!=null; i++) + for (i = 0; (e = (Agedge_s) ND_out(v).getFromList(i))!=null; i++) sum += x_val(e, v, dir); - for (i = 0; (e = (Agedge_s) ND_in(v).getArrayOfPtr("list").plus(i).getPtr())!=null; i++) + for (i = 0; (e = (Agedge_s) ND_in(v).getFromList(i))!=null; i++) sum += x_val(e, v, dir); ED_cutvalue(f, sum); } finally { @@ -1672,10 +1676,10 @@ ENTERING("ah65iqmwa5j0qwotm6amhijlg","dfs_cutval"); try { int i; Agedge_s e; - for (i = 0; (e = (Agedge_s) ND_tree_out(v).getArrayOfPtr("list").plus(i).getPtr())!=null; i++) + for (i = 0; (e = (Agedge_s) ND_tree_out(v).getFromList(i))!=null; i++) if (NEQ(e, par)) dfs_cutval(aghead(e), e); - for (i = 0; (e = (Agedge_s) ND_tree_in(v).getArrayOfPtr("list").plus(i).getPtr())!=null; i++) + for (i = 0; (e = (Agedge_s) ND_tree_in(v).getFromList(i))!=null; i++) if (NEQ(e, par)) dfs_cutval(agtail(e), e); if (par!=null) @@ -1698,10 +1702,10 @@ try { lim = low; ND_par(v, par); ND_low(v, low); - for (i = 0; (e = (Agedge_s) ND_tree_out(v).getArrayOfPtr("list").plus(i).getPtr())!=null; i++) + for (i = 0; (e = (Agedge_s) ND_tree_out(v).getFromList(i))!=null; i++) if (NEQ(e, par)) lim = dfs_range(aghead(e), e, lim); - for (i = 0; (e = (Agedge_s) ND_tree_in(v).getArrayOfPtr("list").plus(i).getPtr())!=null; i++) + for (i = 0; (e = (Agedge_s) ND_tree_in(v).getFromList(i))!=null; i++) if (NEQ(e, par)) lim = dfs_range(agtail(e), e, lim); ND_lim(v, lim); diff --git a/src/gen/lib/common/output__c.java b/src/gen/lib/common/output__c.java index 65794ab7c..4c6dad47e 100644 --- a/src/gen/lib/common/output__c.java +++ b/src/gen/lib/common/output__c.java @@ -49,6 +49,7 @@ import static smetana.core.JUtilsDebug.LEAVING; import static smetana.core.Macro.UNSUPPORTED; import h.boxf; import h.pointf; +import smetana.core.JUtils; import smetana.core.__struct__; public class output__c { @@ -316,7 +317,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -354,7 +355,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -394,7 +395,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/common/pointset__c.java b/src/gen/lib/common/pointset__c.java index 4c630a4b3..b42b7616b 100644 --- a/src/gen/lib/common/pointset__c.java +++ b/src/gen/lib/common/pointset__c.java @@ -49,6 +49,7 @@ import static smetana.core.JUtilsDebug.LEAVING; import static smetana.core.Macro.UNSUPPORTED; import h.boxf; import h.pointf; +import smetana.core.JUtils; import smetana.core.__struct__; public class pointset__c { @@ -316,7 +317,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -354,7 +355,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -394,7 +395,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/common/postproc__c.java b/src/gen/lib/common/postproc__c.java index 87d78e2b6..f7055129c 100644 --- a/src/gen/lib/common/postproc__c.java +++ b/src/gen/lib/common/postproc__c.java @@ -81,6 +81,7 @@ import h.Agedge_s; import h.Agnode_s; import h.Agraph_s; import h.Agsym_s; +import h.ST_boxf; import h.bezier; import h.boxf; import h.label_params_t; @@ -88,6 +89,7 @@ import h.object_t; import h.pointf; import h.textlabel_t; import h.xlabel_t; +import smetana.core.JUtils; import smetana.core.Z; import smetana.core.__struct__; @@ -356,7 +358,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -394,7 +396,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -434,7 +436,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; @@ -739,7 +741,7 @@ throw new UnsupportedOperationException(); //1 ejooa1m5uoq0ue852wtuerpy // static pointf Offset -//private final static __struct__ Offset = __struct__.from(pointf.class); +//private final static __struct__ Offset = JUtils.from(pointf.class); @@ -752,7 +754,7 @@ return map_point_w_(p.copy()).copy(); private static __struct__ map_point_w_(final __struct__ p) { ENTERING("dajapw16wus3rwimkrk5ihi2b","map_point"); try { - p.____(ccwrotatepf(p, Z.z().Rankdir * 90)); + p.___(ccwrotatepf(p, Z.z().Rankdir * 90)); p.setDouble("x", p.getDouble("x") - Z.z().Offset.getDouble("x")); p.setDouble("y", p.getDouble("y") - Z.z().Offset.getDouble("y")); return p; @@ -770,7 +772,7 @@ public static void map_edge(Agedge_s e) { ENTERING("bvq3vvonvotn47mfe5zsvchie","map_edge"); try { int j, k; - final __struct__ bz = __struct__.from(bezier.class); + final __struct__ bz = JUtils.from(bezier.class); if (ED_spl(e) == null) { if ((Z.z().Concentrate == false) && (ED_edge_type(e) != 6)) System.err.println("lost %s %s edge\n"+ agnameof(agtail(e))+ @@ -778,18 +780,18 @@ try { return; } for (j = 0; j < ED_spl(e).getInt("size"); j++) { - bz.____(ED_spl(e).getArrayOfPtr("list").plus(j).getStruct()); + bz.___(ED_spl(e).getArrayOfPtr("list").plus(j).getStruct()); for (k = 0; k < bz.getInt("size"); k++) { bz.getArrayOfPtr("list").plus(k).setStruct(map_point(bz.getArrayOfPtr("list").plus(k).getStruct())); } if (bz.getBoolean("sflag")) UNSUPPORTED("7894dgzvk2um2w1a5ph2r0bcc"); // ED_spl(e)->list[j].sp = map_point(ED_spl(e)->list[j].sp); if (bz.getBoolean("eflag")) { - ED_spl(e).getArrayOfPtr("list").plus(j).getStruct("ep").____(map_point(ED_spl(e).getArrayOfPtr("list").plus(j).getStruct("ep"))); + ED_spl(e).getArrayOfPtr("list").plus(j).getStruct("ep").___(map_point(ED_spl(e).getArrayOfPtr("list").plus(j).getStruct("ep"))); } } if (ED_label(e)!=null) - ED_label(e).getStruct("pos").____(map_point(ED_label(e).getStruct("pos"))); + ED_label(e).getStruct("pos").___(map_point(ED_label(e).getStruct("pos"))); if (ED_xlabel(e)!=null) UNSUPPORTED("al3tnq9zjjqeq1ll7qdxyu3ja"); // ED_xlabel(e)->pos = map_point(ED_xlabel(e)->pos); /* vladimir */ @@ -811,16 +813,16 @@ public static void translate_bb(Agraph_s g, int rankdir) { ENTERING("a3hf82rxsojxbunj6p8a6bkse","translate_bb"); try { int c; - final __struct__ bb = __struct__.from(boxf.class), new_bb = __struct__.from(boxf.class); - bb.____(GD_bb(g)); + final ST_boxf bb = new ST_boxf(), new_bb = new ST_boxf(); + bb.___(GD_bb(g)); if (rankdir == 1 || rankdir == 2) { UNSUPPORTED("d4wrtj0h7lkb0e0vernd9czq9"); // new_bb.LL = map_point(pointfof(bb.LL.x, bb.UR.y)); UNSUPPORTED("crysiae5zxc69cj3v2ygfs8xn"); // new_bb.UR = map_point(pointfof(bb.UR.x, bb.LL.y)); } else { - new_bb.getStruct("LL").____(map_point(pointfof(bb.getStruct("LL").getDouble("x"), bb.getStruct("LL").getDouble("y")))); - new_bb.getStruct("UR").____(map_point(pointfof(bb.getStruct("UR").getDouble("x"), bb.getStruct("UR").getDouble("y")))); + new_bb.LL.___(map_point(pointfof(bb.LL.x, bb.LL.y))); + new_bb.UR.___(map_point(pointfof(bb.UR.x, bb.UR.y))); } - GD_bb(g).____(new_bb); + GD_bb(g).___(new_bb); if (GD_label(g)!=null) { GD_label(g).setStruct("pos", map_point(GD_label(g).getStruct("pos"))); } @@ -847,7 +849,7 @@ try { for (v = agfstnode(g); v!=null; v = agnxtnode(g, v)) { if (Z.z().Rankdir!=0) UNSUPPORTED("e0j848r4j1j7sojfht5gwikvi"); // gv_nodesize(v, 0); - ND_coord(v).____(map_point(ND_coord(v))); + ND_coord(v).___(map_point(ND_coord(v))); if (ND_xlabel(v)!=null) UNSUPPORTED("3fy0l7w2v24hzrvlpstpknwl7"); // ND_xlabel(v)->pos = map_point(ND_xlabel(v)->pos); if (Z.z().State == 1) @@ -1157,10 +1159,10 @@ try { int n_elbls = 0; /* # of unset edge labels or xlabels */ int n_set_lbls = 0; /* # of set xlabels and edge labels */ int n_clbls = 0; /* # of set cluster labels */ - final __struct__ bb = __struct__.from(boxf.class); - final __struct__ ur = __struct__.from(pointf.class); + final __struct__ bb = JUtils.from(boxf.class); + final __struct__ ur = JUtils.from(pointf.class); textlabel_t lp; - final __struct__ params = __struct__.from(label_params_t.class); + final __struct__ params = JUtils.from(label_params_t.class); object_t objs; xlabel_t lbls; object_t objp; @@ -1344,7 +1346,7 @@ public static void gv_postprocess(Agraph_s g, int allowTranslation) { ENTERING("8fc0zxg8y7hec3n4evx3jw6cq","gv_postprocess"); try { double diff; - final __struct__ dimen = __struct__.from(pointf.class); + final __struct__ dimen = JUtils.from(pointf.class); Z.z().Rankdir = GD_rankdir(g); Z.z().Flip = GD_flip(g)!=0; /* Handle cluster labels */ @@ -1395,7 +1397,7 @@ UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); // } if (allowTranslation!=0) { switch (Z.z().Rankdir) { case 0: - Z.z().Offset.____(GD_bb(g).getStruct("LL")); + Z.z().Offset.___(GD_bb(g).LL); break; case 1: UNSUPPORTED("5t3j9lrc86kd5ouaqgzvz3qcm"); // Offset = pointfof(-GD_bb(g).UR.y, GD_bb(g).LL.x); @@ -1483,11 +1485,11 @@ public static void place_graph_label(Agraph_s g) { ENTERING("72zw1alhd5vd0g6mhum507rvx","place_graph_label"); try { int c; - final __struct__ p = __struct__.from(pointf.class), d = __struct__.from(pointf.class); + final __struct__ p = JUtils.from(pointf.class), d = JUtils.from(pointf.class); if (NEQ(g, agroot(g)) && (GD_label(g)!=null) && N(GD_label(g).getInt("set"))) { if ((GD_label_pos(g) & 1)!=0) { - d.____(GD_border(g).plus(2).getStruct()); - p.setDouble("y", GD_bb(g).getStruct("UR").getDouble("y") - d.getDouble("y") / 2); + d.___(GD_border(g).plus(2).getStruct()); + p.setDouble("y", GD_bb(g).UR.y - d.getDouble("y") / 2); } else { UNSUPPORTED("1w38no4welthbwa0i10hei16b"); // d = GD_border(g)[0]; UNSUPPORTED("2xa4n9ca16xpf1kahaycmkl4r"); // p.y = GD_bb(g).LL.y + d.y / 2; @@ -1497,7 +1499,7 @@ UNSUPPORTED("cgv3bcg9c274cdwxi1y0sja3p"); // p.x = GD_bb(g).UR.x - d.x / 2; } else if ((GD_label_pos(g) & 2)!=0) { UNSUPPORTED("7ictv9eqmjvxjii5lqlyw8nu"); // p.x = GD_bb(g).LL.x + d.x / 2; } else { - p.setDouble("x", (GD_bb(g).getStruct("LL").getDouble("x") + GD_bb(g).getStruct("UR").getDouble("x")) / 2); + p.setDouble("x", (GD_bb(g).LL.x + GD_bb(g).UR.x) / 2); } GD_label(g).setStruct("pos", p); GD_label(g).setBoolean("set", NOT(false)); diff --git a/src/gen/lib/common/psusershape__c.java b/src/gen/lib/common/psusershape__c.java index 249c8deed..d5e548592 100644 --- a/src/gen/lib/common/psusershape__c.java +++ b/src/gen/lib/common/psusershape__c.java @@ -49,6 +49,7 @@ import static smetana.core.JUtilsDebug.LEAVING; import static smetana.core.Macro.UNSUPPORTED; import h.boxf; import h.pointf; +import smetana.core.JUtils; import smetana.core.__struct__; public class psusershape__c { @@ -316,7 +317,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -354,7 +355,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -394,7 +395,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/common/routespl__c.java b/src/gen/lib/common/routespl__c.java index f273d7ef4..17f6a97e5 100644 --- a/src/gen/lib/common/routespl__c.java +++ b/src/gen/lib/common/routespl__c.java @@ -71,9 +71,11 @@ import static smetana.core.Macro.UNSUPPORTED; import h.Agedge_s; import h.Pedge_t; import h.Ppoly_t; +import h.ST_boxf; import h.boxf; import h.path; import h.pointf; +import smetana.core.JUtils; import smetana.core.Memory; import smetana.core.Z; import smetana.core.__array_of_ptr__; @@ -346,7 +348,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -384,7 +386,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -424,7 +426,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; @@ -762,7 +764,7 @@ return simpleSplineRoute_w_(tp.copy(), hp.copy(), poly.copy(), n_spl_pts, polyli private static pointf simpleSplineRoute_w_(final __struct__ tp, final __struct__ hp, final __struct__ poly, int[] n_spl_pts, boolean polyline) { ENTERING("7ebl6qohcfpf1b9ucih5r9qgp","simpleSplineRoute"); try { - final __struct__ pl = __struct__.from(Ppoly_t.class), spl = __struct__.from(Ppoly_t.class); + final __struct__ pl = JUtils.from(Ppoly_t.class), spl = JUtils.from(Ppoly_t.class); final __array_of_struct__ eps = __array_of_struct__.malloc(pointf.class, 2); final __array_of_struct__ evs = __array_of_struct__.malloc(pointf.class, 2); int i; @@ -860,10 +862,10 @@ try { for (splinepi = 0; splinepi + 3 < pn; splinepi += 3) { for (si = 0; si <= num_div; si++) { t = si / (double)num_div; - sp.plus(0).getStruct().____(pps.plus(splinepi).getStruct()); - sp.plus(1).getStruct().____(pps.plus(splinepi+1).getStruct()); - sp.plus(2).getStruct().____(pps.plus(splinepi+2).getStruct()); - sp.plus(3).getStruct().____(pps.plus(splinepi+3).getStruct()); + sp.plus(0).getStruct().___(pps.plus(splinepi).getStruct()); + sp.plus(1).getStruct().___(pps.plus(splinepi+1).getStruct()); + sp.plus(2).getStruct().___(pps.plus(splinepi+2).getStruct()); + sp.plus(3).getStruct().___(pps.plus(splinepi+3).getStruct()); sp.plus(0).setDouble("x", sp.plus(0).getDouble("x") + t * (sp.plus(1).getDouble("x") - sp.plus(0).getDouble("x"))); sp.plus(0).setDouble("y", sp.plus(0).getDouble("y") + t * (sp.plus(1).getDouble("y") - sp.plus(0).getDouble("y"))); sp.plus(1).setDouble("x", sp.plus(1).getDouble("x") + t * (sp.plus(2).getDouble("x") - sp.plus(1).getDouble("x"))); @@ -901,8 +903,8 @@ LEAVING("cu8ssjizw7ileqe9u7tcclq7k","limitBoxes"); public static __ptr__ _routesplines(path pp, int npoints[], int polyline) { ENTERING("3mcnemqisisnqtd4mr72ej76y","_routesplines"); try { - final __struct__ poly = __struct__.from(Ppoly_t.class); - final __struct__ pl = __struct__.from(Ppoly_t.class), spl = __struct__.from(Ppoly_t.class); + final __struct__ poly = JUtils.from(Ppoly_t.class); + final __struct__ pl = JUtils.from(Ppoly_t.class), spl = JUtils.from(Ppoly_t.class); int splinepi; final __array_of_struct__ eps = __array_of_struct__.malloc(pointf.class, 2); final __array_of_struct__ evs = __array_of_struct__.malloc(pointf.class, 2); @@ -931,12 +933,12 @@ try { Z.z().polypoints = ALLOC_allocated2(boxn * 8, Z.z().polypoints, pointf.class); Z.z().polypointn = boxn * 8; } - if ((boxn > 1) && (boxes.plus(0).getStruct().getStruct("LL").getDouble("y") > boxes.plus(1).getStruct().getStruct("LL").getDouble("y"))) { + if ((boxn > 1) && (((ST_boxf)boxes.plus(0).getStruct()).LL.y > ((ST_boxf)boxes.plus(1).getStruct()).LL.y)) { flip = 1; for (bi = 0; bi < boxn; bi++) { - double v = boxes.plus(bi).getStruct().getStruct("UR").getDouble("y"); - boxes.plus(bi).getStruct().getStruct("UR").setDouble("y",-1*boxes.plus(bi).getStruct().getStruct("LL").getDouble("y")); - boxes.plus(bi).getStruct().getStruct("LL").setDouble("y", -v); + double v = ((ST_boxf)boxes.plus(bi).getStruct()).UR.y; + ((ST_boxf)boxes.plus(bi).getStruct()).UR.y= -1*((ST_boxf)boxes.plus(bi).getStruct()).LL.y; + ((ST_boxf)boxes.plus(bi).getStruct()).LL.y = -v; } } else flip = 0; @@ -946,20 +948,20 @@ try { for (bi = 0, pi = 0; bi < boxn; bi++) { next = prev = 0; if (bi > 0) - prev = (boxes.plus(bi).getStruct().getStruct("LL").getDouble("y") > boxes.plus(bi-1).getStruct().getStruct("LL").getDouble("y")) ? -1 : 1; + prev = (((ST_boxf)boxes.plus(bi).getStruct()).LL.y > ((ST_boxf)boxes.plus(bi-1).getStruct()).LL.y) ? -1 : 1; if (bi < boxn - 1) - next = (boxes.plus(bi+1).getStruct().getStruct("LL").getDouble("y") > boxes.plus(bi).getStruct().getStruct("LL").getDouble("y")) ? 1 : -1; + next = (((ST_boxf)boxes.plus(bi+1).getStruct()).LL.y > ((ST_boxf)boxes.plus(bi).getStruct()).LL.y) ? 1 : -1; if (prev != next) { if (next == -1 || prev == 1) { - Z.z().polypoints.plus(pi).setDouble("x", boxes.plus(bi).getStruct().getStruct("LL").getDouble("x")); - Z.z().polypoints.plus(pi++).setDouble("y", boxes.plus(bi).getStruct().getStruct("UR").getDouble("y")); - Z.z().polypoints.plus(pi).setDouble("x", boxes.plus(bi).getStruct().getStruct("LL").getDouble("x")); - Z.z().polypoints.plus(pi++).setDouble("y", boxes.plus(bi).getStruct().getStruct("LL").getDouble("y")); + Z.z().polypoints.plus(pi).setDouble("x", ((ST_boxf)boxes.plus(bi).getStruct()).LL.x); + Z.z().polypoints.plus(pi++).setDouble("y", ((ST_boxf)boxes.plus(bi).getStruct()).UR.y); + Z.z().polypoints.plus(pi).setDouble("x", ((ST_boxf)boxes.plus(bi).getStruct()).LL.x); + Z.z().polypoints.plus(pi++).setDouble("y", ((ST_boxf)boxes.plus(bi).getStruct()).LL.y); } else { - Z.z().polypoints.plus(pi).setDouble("x", boxes.plus(bi).getStruct().getStruct("UR").getDouble("x")); - Z.z().polypoints.plus(pi++).setDouble("y", boxes.plus(bi).getStruct().getStruct("LL").getDouble("y")); - Z.z().polypoints.plus(pi).setDouble("x", boxes.plus(bi).getStruct().getStruct("UR").getDouble("x")); - Z.z().polypoints.plus(pi++).setDouble("y", boxes.plus(bi).getStruct().getStruct("UR").getDouble("y")); + Z.z().polypoints.plus(pi).setDouble("x", ((ST_boxf)boxes.plus(bi).getStruct()).UR.x); + Z.z().polypoints.plus(pi++).setDouble("y", ((ST_boxf)boxes.plus(bi).getStruct()).LL.y); + Z.z().polypoints.plus(pi).setDouble("x", ((ST_boxf)boxes.plus(bi).getStruct()).UR.x); + Z.z().polypoints.plus(pi++).setDouble("y", ((ST_boxf)boxes.plus(bi).getStruct()).UR.y); } } else if (prev == 0) { /* single box */ @@ -978,20 +980,20 @@ UNSUPPORTED("9idk92zg2ysz316lfwzvvvde6"); // return NULL; for (bi = boxn - 1; bi >= 0; bi--) { next = prev = 0; if (bi < boxn - 1) - prev = (boxes.plus(bi).getStruct().getStruct("LL").getDouble("y") > boxes.plus(bi+1).getStruct().getStruct("LL").getDouble("y")) ? -1 : 1; + prev = (((ST_boxf)boxes.plus(bi).getStruct()).LL.y > ((ST_boxf)boxes.plus(bi+1).getStruct()).LL.y) ? -1 : 1; if (bi > 0) - next = (boxes.plus(bi-1).getStruct().getStruct("LL").getDouble("y") > boxes.plus(bi).getStruct().getStruct("LL").getDouble("y")) ? 1 : -1; + next = (((ST_boxf)boxes.plus(bi-1).getStruct()).LL.y > ((ST_boxf)boxes.plus(bi).getStruct()).LL.y) ? 1 : -1; if (prev != next) { if (next == -1 || prev == 1 ) { - Z.z().polypoints.plus(pi).setDouble("x", boxes.plus(bi).getStruct().getStruct("LL").getDouble("x")); - Z.z().polypoints.plus(pi++).setDouble("y", boxes.plus(bi).getStruct().getStruct("UR").getDouble("y")); - Z.z().polypoints.plus(pi).setDouble("x", boxes.plus(bi).getStruct().getStruct("LL").getDouble("x")); - Z.z().polypoints.plus(pi++).setDouble("y", boxes.plus(bi).getStruct().getStruct("LL").getDouble("y")); + Z.z().polypoints.plus(pi).setDouble("x", ((ST_boxf)boxes.plus(bi).getStruct()).LL.x); + Z.z().polypoints.plus(pi++).setDouble("y", ((ST_boxf)boxes.plus(bi).getStruct()).UR.y); + Z.z().polypoints.plus(pi).setDouble("x", ((ST_boxf)boxes.plus(bi).getStruct()).LL.x); + Z.z().polypoints.plus(pi++).setDouble("y", ((ST_boxf)boxes.plus(bi).getStruct()).LL.y); } else { - Z.z().polypoints.plus(pi).setDouble("x", boxes.plus(bi).getStruct().getStruct("UR").getDouble("x")); - Z.z().polypoints.plus(pi++).setDouble("y", boxes.plus(bi).getStruct().getStruct("LL").getDouble("y")); - Z.z().polypoints.plus(pi).setDouble("x", boxes.plus(bi).getStruct().getStruct("UR").getDouble("x")); - Z.z().polypoints.plus(pi++).setDouble("y", boxes.plus(bi).getStruct().getStruct("UR").getDouble("y")); + Z.z().polypoints.plus(pi).setDouble("x", ((ST_boxf)boxes.plus(bi).getStruct()).UR.x); + Z.z().polypoints.plus(pi++).setDouble("y", ((ST_boxf)boxes.plus(bi).getStruct()).LL.y); + Z.z().polypoints.plus(pi).setDouble("x", ((ST_boxf)boxes.plus(bi).getStruct()).UR.x); + Z.z().polypoints.plus(pi++).setDouble("y", ((ST_boxf)boxes.plus(bi).getStruct()).UR.y); } } else if (prev == 0) { /* single box */ @@ -1006,14 +1008,14 @@ UNSUPPORTED("87y5d0ts6xdjyx905bha50f3s"); // /* it went badly, e.g. degene UNSUPPORTED("1qt7hixteu3pt64wk1sqw352a"); // agerr(AGERR, "in routesplines, illegal values of prev %d and next %d, line %d\n", prev, next, 476); UNSUPPORTED("35untdbpd42pt4c74gjbxqx7q"); // return NULL; /* for correctness sake, it's best to just stop */ } - Z.z().polypoints.plus(pi).setDouble("x", boxes.plus(bi).getStruct().getStruct("UR").getDouble("x")); - Z.z().polypoints.plus(pi++).setDouble("y", boxes.plus(bi).getStruct().getStruct("LL").getDouble("y")); - Z.z().polypoints.plus(pi).setDouble("x", boxes.plus(bi).getStruct().getStruct("UR").getDouble("x")); - Z.z().polypoints.plus(pi++).setDouble("y", boxes.plus(bi).getStruct().getStruct("UR").getDouble("y")); - Z.z().polypoints.plus(pi).setDouble("x", boxes.plus(bi).getStruct().getStruct("LL").getDouble("x")); - Z.z().polypoints.plus(pi++).setDouble("y", boxes.plus(bi).getStruct().getStruct("UR").getDouble("y")); - Z.z().polypoints.plus(pi).setDouble("x", boxes.plus(bi).getStruct().getStruct("LL").getDouble("x")); - Z.z().polypoints.plus(pi++).setDouble("y", boxes.plus(bi).getStruct().getStruct("LL").getDouble("y")); + Z.z().polypoints.plus(pi).setDouble("x", ((ST_boxf)boxes.plus(bi).getStruct()).UR.x); + Z.z().polypoints.plus(pi++).setDouble("y", ((ST_boxf)boxes.plus(bi).getStruct()).LL.y); + Z.z().polypoints.plus(pi).setDouble("x", ((ST_boxf)boxes.plus(bi).getStruct()).UR.x); + Z.z().polypoints.plus(pi++).setDouble("y", ((ST_boxf)boxes.plus(bi).getStruct()).UR.y); + Z.z().polypoints.plus(pi).setDouble("x", ((ST_boxf)boxes.plus(bi).getStruct()).LL.x); + Z.z().polypoints.plus(pi++).setDouble("y", ((ST_boxf)boxes.plus(bi).getStruct()).UR.y); + Z.z().polypoints.plus(pi).setDouble("x", ((ST_boxf)boxes.plus(bi).getStruct()).LL.x); + Z.z().polypoints.plus(pi++).setDouble("y", ((ST_boxf)boxes.plus(bi).getStruct()).LL.y); } } } @@ -1024,16 +1026,16 @@ UNSUPPORTED("11hwqop4xebvtcskop4uhpp01"); // return NULL; if (flip!=0) { int i; for (bi = 0; bi < boxn; bi++) { - int v = (int) boxes.plus(bi).getStruct().getStruct("UR").getDouble("y"); - boxes.plus(bi).getStruct().getStruct("UR").setDouble("y", -1*boxes.plus(bi).getStruct().getStruct("LL").getDouble("y")); - boxes.plus(bi).getStruct().getStruct("LL").setDouble("y", -v); + int v = (int) ((ST_boxf)boxes.plus(bi).getStruct()).UR.y; + ((ST_boxf)boxes.plus(bi).getStruct()).UR.y = -1*((ST_boxf)boxes.plus(bi).getStruct()).LL.y; + ((ST_boxf)boxes.plus(bi).getStruct()).LL.y = -v; } for (i = 0; i < pi; i++) Z.z().polypoints.plus(i).setDouble("y", -1 * Z.z().polypoints.plus(i).getDouble("y")); } for (bi = 0; bi < boxn; bi++) { - boxes.plus(bi).getStruct().getStruct("LL").setDouble("x", INT_MAX); - boxes.plus(bi).getStruct().getStruct("UR").setDouble("x", INT_MIN); + ((ST_boxf)boxes.plus(bi).getStruct()).LL.x = INT_MAX; + ((ST_boxf)boxes.plus(bi).getStruct()).UR.x = INT_MIN; } poly.setPtr("ps", Z.z().polypoints); poly.setInt("pn", pi); @@ -1042,8 +1044,8 @@ UNSUPPORTED("11hwqop4xebvtcskop4uhpp01"); // return NULL; eps.plus(1).getStruct().setDouble("x", pp.getStruct("end").getStruct("p").getDouble("x")); eps.plus(1).getStruct().setDouble("y", pp.getStruct("end").getStruct("p").getDouble("y")); if (Pshortestpath((Ppoly_t) poly.amp(), eps, (Ppoly_t) pl.amp()) < 0) { -UNSUPPORTED("5wo4uqzvxd2gjq9bz036zhavp"); // agerr(AGERR, "in routesplines, Pshortestpath failed\n"); -UNSUPPORTED("11hwqop4xebvtcskop4uhpp01"); // return NULL; + System.err.println("in routesplines, Pshortestpath failed\n"); + return null; } if (polyline!=0) { UNSUPPORTED("48veztc3k9dfw8tqolu7jsktk"); // make_polyline (pl, &spl); @@ -1081,8 +1083,8 @@ UNSUPPORTED("7t3fvwp9cv90qu5bdjdglcgtk"); // return NULL; if (mkspacep(spl.getInt("pn"))) UNSUPPORTED("7x5kpcbvg4va887hky7ufm45y"); // return NULL; /* Bailout if no memory left */ for (bi = 0; bi < boxn; bi++) { - boxes.plus(bi).getStruct("LL").setDouble("x", INT_MAX); - boxes.plus(bi).getStruct("UR").setDouble("x", INT_MIN); + boxes.plus(bi).getStruct("LL").setDouble("x", INT_MAX); + boxes.plus(bi).getStruct("UR").setDouble("x", INT_MIN); } unbounded = NOT(false); for (splinepi = 0; splinepi < spl.getInt("pn"); splinepi++) { @@ -1114,7 +1116,7 @@ UNSUPPORTED("7x5kpcbvg4va887hky7ufm45y"); // return NULL; /* Bailout if no mem * to bound the boxes. This will probably mean a bad edge, but we avoid an infinite * loop and we can see the bad edge, and even use the showboxes scaffolding. */ - final __struct__ polyspl = __struct__.from(Ppoly_t.class); + final __struct__ polyspl = JUtils.from(Ppoly_t.class); System.err.println("Unable to reclaim box space in spline routing for edge \"%s\" -> \"%s\". Something is probably seriously wrong.\n"); make_polyline (pl, polyspl.amp()); limitBoxes (boxes, boxn, polyspl.getPtr("ps"), polyspl.getInt("pn"), 10); @@ -1198,9 +1200,9 @@ try { /* remove degenerate boxes. */ i = 0; for (bi = 0; bi < boxn; bi++) { - if (ABS(boxes.plus(bi).getStruct().getStruct("LL").getDouble("y") - boxes.plus(bi).getStruct().getStruct("UR").getDouble("y")) < .01) + if (ABS(((ST_boxf)boxes.plus(bi).getStruct()).LL.y - ((ST_boxf)boxes.plus(bi).getStruct()).UR.y) < .01) continue; - if (ABS(boxes.plus(bi).getStruct().getStruct("LL").getDouble("x") - boxes.plus(bi).getStruct().getStruct("UR").getDouble("x")) < .01) + if (ABS(((ST_boxf)boxes.plus(bi).getStruct()).LL.x - ((ST_boxf)boxes.plus(bi).getStruct()).UR.x) < .01) continue; if (i != bi) boxes.plus(i).setStruct(boxes.plus(bi).getStruct()); @@ -1241,8 +1243,12 @@ UNSUPPORTED("btmwubugs9vkexo4yb7a5nqel"); // return 1; bb.getStruct("LL").setDouble("x", xy); l = 0; } - else if (r == 1) -UNSUPPORTED("3naapn9c6ymy8kj291147k4z4"); // xy = ba.getStruct("LL").getDouble("x"), ba.getStruct("LL").getDouble("x") = bb.getStruct("UR").getDouble("x"), bb.getStruct("UR").getDouble("x") = xy, r = 0; + else if (r == 1) { + xy = (int)(ba.getStruct("LL").getDouble("x")); + ba.getStruct("LL").setDouble("x", bb.getStruct("UR").getDouble("x")); + bb.getStruct("UR").setDouble("x", xy); + r = 0; + } else if (d == 1) UNSUPPORTED("eg1w87s0blk4i583rqumhmv6n"); // xy = ba.getStruct("UR").getDouble("y"), ba.getStruct("UR").getDouble("y") = bb.getStruct("LL").getDouble("y"), bb.getStruct("LL").getDouble("y") = xy, d = 0; else if (u == 1) @@ -1266,70 +1272,70 @@ UNSUPPORTED("2cnb1bdjh6y26f98vonla73qa"); // bb.getStruct("UR").getDouble("y" xoverlap = overlap(ba.getStruct("LL").getDouble("x"), ba.getStruct("UR").getDouble("x"), bb.getStruct("LL").getDouble("x"), bb.getStruct("UR").getDouble("x")); yoverlap = overlap(ba.getStruct("LL").getDouble("y"), ba.getStruct("UR").getDouble("y"), bb.getStruct("LL").getDouble("y"), bb.getStruct("UR").getDouble("y")); if (xoverlap!=0 && yoverlap!=0) { -UNSUPPORTED("d2y9tmfuv1tsgkmmjchguto8b"); // if (xoverlap < yoverlap) { -UNSUPPORTED("1wqz597xk17qe9z6tjsf0c3cy"); // if (ba.getStruct("UR").getDouble("x") - ba.getStruct("LL").getDouble("x") > bb.getStruct("UR").getDouble("x") - bb.getStruct("LL").getDouble("x")) { -UNSUPPORTED("c9abicea7ozw5xtcem9pfdfh1"); // /* take space from ba */ + if (xoverlap < yoverlap) { + if (ba.getStruct("UR").getDouble("x") - ba.getStruct("LL").getDouble("x") > bb.getStruct("UR").getDouble("x") - bb.getStruct("LL").getDouble("x")) { + /* take space from ba */ UNSUPPORTED("5dqxf3gq05pjtobtnru1g2tuj"); // if (ba.getStruct("UR").getDouble("x") < bb.getStruct("UR").getDouble("x")) UNSUPPORTED("8gz6k803qp9zyw9s459cpp039"); // ba.getStruct("UR").getDouble("x") = bb.getStruct("LL").getDouble("x"); UNSUPPORTED("9acag2yacl63g8rg6r1alu62x"); // else UNSUPPORTED("5r6ck8hfb1cxywn9go61se9kx"); // ba.getStruct("LL").getDouble("x") = bb.getStruct("UR").getDouble("x"); -UNSUPPORTED("a47jqpic91ky93e1ohxv590l5"); // } else { -UNSUPPORTED("6f5ihsq4qpci45h8av0c9wdi4"); // /* take space from bb */ -UNSUPPORTED("5dqxf3gq05pjtobtnru1g2tuj"); // if (ba.getStruct("UR").getDouble("x") < bb.getStruct("UR").getDouble("x")) -UNSUPPORTED("aojz6tby78spomt80sc91qedn"); // bb.getStruct("LL").getDouble("x") = ba.getStruct("UR").getDouble("x"); -UNSUPPORTED("9acag2yacl63g8rg6r1alu62x"); // else -UNSUPPORTED("cdx834oywc193yujb6sgnv8m7"); // bb.getStruct("UR").getDouble("x") = ba.getStruct("LL").getDouble("x"); -UNSUPPORTED("6eq5kf0bj692bokt0bixy1ixh"); // } -UNSUPPORTED("6mdyr1xpycmbl0dew79oujjj4"); // } else { /* symmetric for y coords */ -UNSUPPORTED("18cdu0l0poruy7djzfr7vazf3"); // if (ba.getStruct("UR").getDouble("y") - ba.getStruct("LL").getDouble("y") > bb.getStruct("UR").getDouble("y") - bb.getStruct("LL").getDouble("y")) { -UNSUPPORTED("c9abicea7ozw5xtcem9pfdfh1"); // /* take space from ba */ -UNSUPPORTED("ahgq8sh8si0vwzdw93diqa9e"); // if (ba.getStruct("UR").getDouble("y") < bb.getStruct("UR").getDouble("y")) -UNSUPPORTED("n1xvon1d7b8odl1mhbw8fsc2"); // ba.getStruct("UR").getDouble("y") = bb.getStruct("LL").getDouble("y"); -UNSUPPORTED("9acag2yacl63g8rg6r1alu62x"); // else -UNSUPPORTED("3h281jzhb4w3dt2115b900130"); // ba.getStruct("LL").getDouble("y") = bb.getStruct("UR").getDouble("y"); -UNSUPPORTED("a47jqpic91ky93e1ohxv590l5"); // } else { -UNSUPPORTED("6f5ihsq4qpci45h8av0c9wdi4"); // /* take space from bb */ -UNSUPPORTED("ahgq8sh8si0vwzdw93diqa9e"); // if (ba.getStruct("UR").getDouble("y") < bb.getStruct("UR").getDouble("y")) -UNSUPPORTED("5ws4vr52jf28wejgwepvdf82g"); // bb.getStruct("LL").getDouble("y") = ba.getStruct("UR").getDouble("y"); -UNSUPPORTED("9acag2yacl63g8rg6r1alu62x"); // else -UNSUPPORTED("cityroxzrcmi8458m7ynqkew9"); // bb.getStruct("UR").getDouble("y") = ba.getStruct("LL").getDouble("y"); -UNSUPPORTED("6eq5kf0bj692bokt0bixy1ixh"); // } -UNSUPPORTED("6t98dcecgbvbvtpycwiq2ynnj"); // } + } else { + /* take space from bb */ + if (ba.getStruct("UR").getDouble("x") < bb.getStruct("UR").getDouble("x")) + bb.getStruct("LL").setDouble("x", ba.getStruct("UR").getDouble("x")); + else + bb.getStruct("UR").setDouble("x", ba.getStruct("LL").getDouble("x")); + } + } else { /* symmetric for y coords */ + if (ba.getStruct("UR").getDouble("y") - ba.getStruct("LL").getDouble("y") > bb.getStruct("UR").getDouble("y") - bb.getStruct("LL").getDouble("y")) { + /* take space from ba */ + if (ba.getStruct("UR").getDouble("y") < bb.getStruct("UR").getDouble("y")) + ba.getStruct("UR").setDouble("y", bb.getStruct("LL").getDouble("y")); + else + ba.getStruct("LL").setDouble("y", bb.getStruct("UR").getDouble("y")); + } else { + /* take space from bb */ + if (ba.getStruct("UR").getDouble("y") < bb.getStruct("UR").getDouble("y")) + bb.getStruct("LL").setDouble("y", ba.getStruct("UR").getDouble("y")); + else + bb.getStruct("UR").setDouble("y", ba.getStruct("LL").getDouble("y")); + } + } } } - if (thepath.getStruct("start").getStruct("p").getDouble("x") < boxes.plus(0).getStruct().getStruct("LL").getDouble("x") - || thepath.getStruct("start").getStruct("p").getDouble("x") > boxes.plus(0).getStruct().getStruct("UR").getDouble("x") - || thepath.getStruct("start").getStruct("p").getDouble("y") < boxes.plus(0).getStruct().getStruct("LL").getDouble("y") - || thepath.getStruct("start").getStruct("p").getDouble("y") > boxes.plus(0).getStruct().getStruct("UR").getDouble("y")) { + if (thepath.getStruct("start").getStruct("p").getDouble("x") < ((ST_boxf)boxes.plus(0).getStruct()).LL.x + || thepath.getStruct("start").getStruct("p").getDouble("x") > ((ST_boxf)boxes.plus(0).getStruct()).UR.x + || thepath.getStruct("start").getStruct("p").getDouble("y") < ((ST_boxf)boxes.plus(0).getStruct()).LL.y + || thepath.getStruct("start").getStruct("p").getDouble("y") > ((ST_boxf)boxes.plus(0).getStruct()).UR.y) { /*if (Verbose) { fprintf(stderr, "in checkpath, start port not in first box\n"); printpath(thepath); }*/ - if (thepath.getStruct("start").getStruct("p").getDouble("x") < boxes.plus(0).getStruct().getStruct("LL").getDouble("x")) - thepath.getStruct("start").getStruct("p").setDouble("x", boxes.plus(0).getStruct().getStruct("LL").getDouble("x")); - if (thepath.getStruct("start").getStruct("p").getDouble("x") > boxes.plus(0).getStruct().getStruct("UR").getDouble("x")) - thepath.getStruct("start").getStruct("p").setDouble("x", boxes.plus(0).getStruct().getStruct("UR").getDouble("x")); - if (thepath.getStruct("start").getStruct("p").getDouble("y") < boxes.plus(0).getStruct().getStruct("LL").getDouble("y")) - thepath.getStruct("start").getStruct("p").setDouble("y", boxes.plus(0).getStruct().getStruct("LL").getDouble("y")); - if (thepath.getStruct("start").getStruct("p").getDouble("y") > boxes.plus(0).getStruct().getStruct("UR").getDouble("y")) - thepath.getStruct("start").getStruct("p").setDouble("y", boxes.plus(0).getStruct().getStruct("UR").getDouble("y")); + if (thepath.getStruct("start").getStruct("p").getDouble("x") < ((ST_boxf)boxes.plus(0).getStruct()).LL.x) + thepath.getStruct("start").getStruct("p").setDouble("x", ((ST_boxf)boxes.plus(0).getStruct()).LL.x); + if (thepath.getStruct("start").getStruct("p").getDouble("x") > ((ST_boxf)boxes.plus(0).getStruct()).UR.x) + thepath.getStruct("start").getStruct("p").setDouble("x", ((ST_boxf)boxes.plus(0).getStruct()).UR.x); + if (thepath.getStruct("start").getStruct("p").getDouble("y") < ((ST_boxf)boxes.plus(0).getStruct()).LL.y) + thepath.getStruct("start").getStruct("p").setDouble("y", ((ST_boxf)boxes.plus(0).getStruct()).LL.y); + if (thepath.getStruct("start").getStruct("p").getDouble("y") > ((ST_boxf)boxes.plus(0).getStruct()).UR.y) + thepath.getStruct("start").getStruct("p").setDouble("y", ((ST_boxf)boxes.plus(0).getStruct()).UR.y); } - if (thepath.getStruct("end").getStruct("p").getDouble("x") < boxes.plus(boxn - 1).getStruct().getStruct("LL").getDouble("x") - || thepath.getStruct("end").getStruct("p").getDouble("x") > boxes.plus(boxn - 1).getStruct().getStruct("UR").getDouble("x") - || thepath.getStruct("end").getStruct("p").getDouble("y") < boxes.plus(boxn - 1).getStruct().getStruct("LL").getDouble("y") - || thepath.getStruct("end").getStruct("p").getDouble("y") > boxes.plus(boxn - 1).getStruct().getStruct("UR").getDouble("y")) { + if (thepath.getStruct("end").getStruct("p").getDouble("x") < ((ST_boxf)boxes.plus(boxn - 1).getStruct()).LL.x + || thepath.getStruct("end").getStruct("p").getDouble("x") > ((ST_boxf)boxes.plus(boxn - 1).getStruct()).UR.x + || thepath.getStruct("end").getStruct("p").getDouble("y") < ((ST_boxf)boxes.plus(boxn - 1).getStruct()).LL.y + || thepath.getStruct("end").getStruct("p").getDouble("y") > ((ST_boxf)boxes.plus(boxn - 1).getStruct()).UR.y) { /*if (Verbose) { fprintf(stderr, "in checkpath, end port not in last box\n"); printpath(thepath); }*/ - if (thepath.getStruct("end").getStruct("p").getDouble("x") < boxes.plus(boxn - 1).getStruct().getStruct("LL").getDouble("x")) - thepath.getStruct("end").getStruct("p").setDouble("x", boxes.plus(boxn - 1).getStruct().getStruct("LL").getDouble("x")); - if (thepath.getStruct("end").getStruct("p").getDouble("x") > boxes.plus(boxn - 1).getStruct().getStruct("UR").getDouble("x")) - thepath.getStruct("end").getStruct("p").setDouble("x", boxes.plus(boxn - 1).getStruct().getStruct("UR").getDouble("x")); - if (thepath.getStruct("end").getStruct("p").getDouble("y") < boxes.plus(boxn - 1).getStruct().getStruct("LL").getDouble("y")) - thepath.getStruct("end").getStruct("p").setDouble("y", boxes.plus(boxn - 1).getStruct().getStruct("LL").getDouble("y")); - if (thepath.getStruct("end").getStruct("p").getDouble("y") > boxes.plus(boxn - 1).getStruct().getStruct("UR").getDouble("y")) - thepath.getStruct("end").getStruct("p").setDouble("y", boxes.plus(boxn - 1).getStruct().getStruct("UR").getDouble("y")); + if (thepath.getStruct("end").getStruct("p").getDouble("x") < ((ST_boxf)boxes.plus(boxn - 1).getStruct()).LL.x) + thepath.getStruct("end").getStruct("p").setDouble("x", ((ST_boxf)boxes.plus(boxn - 1).getStruct()).LL.x); + if (thepath.getStruct("end").getStruct("p").getDouble("x") > ((ST_boxf)boxes.plus(boxn - 1).getStruct()).UR.x) + thepath.getStruct("end").getStruct("p").setDouble("x", ((ST_boxf)boxes.plus(boxn - 1).getStruct()).UR.x); + if (thepath.getStruct("end").getStruct("p").getDouble("y") < ((ST_boxf)boxes.plus(boxn - 1).getStruct()).LL.y) + thepath.getStruct("end").getStruct("p").setDouble("y", ((ST_boxf)boxes.plus(boxn - 1).getStruct()).LL.y); + if (thepath.getStruct("end").getStruct("p").getDouble("y") > ((ST_boxf)boxes.plus(boxn - 1).getStruct()).UR.y) + thepath.getStruct("end").getStruct("p").setDouble("y", ((ST_boxf)boxes.plus(boxn - 1).getStruct()).UR.y); } return 0; } finally { diff --git a/src/gen/lib/common/shapes__c.java b/src/gen/lib/common/shapes__c.java index ecd0cca32..de19ece0d 100644 --- a/src/gen/lib/common/shapes__c.java +++ b/src/gen/lib/common/shapes__c.java @@ -91,6 +91,9 @@ import h.Agnode_s; import h.Agnodeinfo_t; import h.Agobj_s; import h.Agraphinfo_t; +import h.ST_boxf; +import h.ST_pointf; +import h.ST_port; import h.boxf; import h.inside_t; import h.point; @@ -101,10 +104,13 @@ import h.shape_desc; import h.shape_kind; import smetana.core.CFunctionImpl; import smetana.core.CString; +import smetana.core.JUtils; import smetana.core.Memory; import smetana.core.Z; +import smetana.core.__c__fields; import smetana.core.__ptr__; import smetana.core.__struct__; +import smetana.core.amiga.StarArrayOfPtr; public class shapes__c { //1 2digov3edok6d5srhgtlmrycs @@ -371,7 +377,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -409,7 +415,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -449,7 +455,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; @@ -746,7 +752,7 @@ throw new UnsupportedOperationException(); //1 8h06z4a8bluhfqji3ysnlr3q8 // static port Center = -/*private final static __struct__ Center = __struct__.from(port.class); +/*private final static __struct__ Center = JUtils.from(port.class); static { Center.getStruct("p").setDouble("x", 0); Center.getStruct("p").setDouble("y", 0); @@ -774,7 +780,7 @@ Center.setInt("side", 0); //1 606ee1uued1p0d2o7h96efu9d // static polygon_t p_ellipse = -/*public static final __struct__ p_ellipse = __struct__.from(polygon_t.class); +/*public static final __struct__ p_ellipse = JUtils.from(polygon_t.class); static { p_ellipse.setInt("regular", 0); p_ellipse.setInt("peripheries", 1); @@ -798,7 +804,7 @@ p_ellipse.setDouble("skew", 0.); //1 bw9fxu2ppyosdc0fayd10ik29 // static polygon_t p_box = -/*public final static __struct__ p_box = __struct__.from(polygon_t.class); +/*public final static __struct__ p_box = JUtils.from(polygon_t.class); static { p_box.setInt("regular", 0); p_box.setInt("peripheries", 1); @@ -994,7 +1000,7 @@ p_box.setDouble("skew", 0.); //1 dkgul6r2xulzqk2twms3pswmy // static shape_functions poly_fns = -/*public final static __struct__ poly_fns = __struct__.from(shape_functions.class); +/*public final static __struct__ poly_fns = JUtils.from(shape_functions.class); static { poly_fns.setPtr("initfn", function(shapes__c.class, "poly_init")); poly_fns.setPtr("freefn", function(shapes__c.class, "poly_free")); @@ -2569,9 +2575,9 @@ throw new UnsupportedOperationException(); public static void poly_init(Agnode_s n) { ENTERING("a11xv6duihbr3d6gkgo2ye2j5","poly_init"); try { - final __struct__ dimen = __struct__.from(pointf.class), min_bb = __struct__.from(pointf.class), bb = __struct__.from(pointf.class); - final __struct__ imagesize = __struct__.from(point.class); - final __struct__ P = __struct__.from(pointf.class), Q = __struct__.from(pointf.class), R = __struct__.from(pointf.class); + final __struct__ dimen = JUtils.from(pointf.class), min_bb = JUtils.from(pointf.class), bb = JUtils.from(pointf.class); + final __struct__ imagesize = JUtils.from(point.class); + final __struct__ P = JUtils.from(pointf.class), Q = JUtils.from(pointf.class), R = JUtils.from(pointf.class); __ptr__ vertices = null; CString p, sfile, fxd; double temp, alpha, beta, gamma; @@ -2616,7 +2622,7 @@ UNSUPPORTED("cp83hdn3dp0a7rp9bauc3bgki"); // sides = late_int(n, N_sides, 4, 0) UNSUPPORTED("abmuc3vqirf3i48480fj0k14g"); // distortion = late_double(n, N_distortion, 0.0, -100.0); } /* get label dimensions */ - dimen.____(ND_label(n).getStruct("dimen")); + dimen.___(ND_label(n).getStruct("dimen")); /* minimal whitespace around label */ if (ROUND(abs(dimen.getDouble("x")))!=0 || ROUND(abs(dimen.getDouble("y")))!=0) { /* padding */ @@ -2637,8 +2643,8 @@ UNSUPPORTED("afk9bpom7x393euamnvwwkx6b"); // } else UNSUPPORTED("87bdwkkwbzyswxnepdd9bj8mb"); // {((dimen).x += 4*4); ((dimen).y += 2*4);}; } else { - dimen.setDouble("x", dimen.getDouble("x") + 4*4); - dimen.setDouble("y", dimen.getDouble("y") + 2*4); + ((ST_pointf) dimen).x = dimen.getDouble("x") + 4*4; + ((ST_pointf) dimen).y = dimen.getDouble("y") + 2*4; }; } spacex = dimen.getDouble("x") - ND_label(n).getStruct("dimen").getDouble("x"); @@ -2683,8 +2689,8 @@ UNSUPPORTED("1x57knvrmlciu7odfroo3paso"); // imagesize.y += 2; UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); // } } /* initialize node bb to labelsize */ - bb.setDouble("x", ((dimen.getDouble("x"))>(imagesize.getInt("x"))?(dimen.getDouble("x")):(imagesize.getInt("x")))); - bb.setDouble("y", ((dimen.getDouble("y"))>(imagesize.getInt("y"))?(dimen.getDouble("y")):(imagesize.getInt("y")))); + ((ST_pointf) bb).x = ((dimen.getDouble("x"))>(imagesize.getInt("x"))?(dimen.getDouble("x")):(imagesize.getInt("x"))); + ((ST_pointf) bb).y = ((dimen.getDouble("y"))>(imagesize.getInt("y"))?(dimen.getDouble("y")):(imagesize.getInt("y"))); /* I don't know how to distort or skew ellipses in postscript */ /* Convert request to a polygon with a large number of sides */ if ((sides <= 2) && ((distortion != 0.) || (skew != 0.))) { @@ -2727,7 +2733,7 @@ UNSUPPORTED("1fjwgzo5xkijo98ycmzhal8yv"); // bb = pd->size_gen(bb); } } /* at this point, bb is the minimum size of node that can hold the label */ - min_bb.____(bb); + min_bb.___(bb); /* increase node size to width/height if needed */ fxd = late_string(n, Z.z().N_fixed, new CString("false")); if ((fxd.charAt(0) == 's') && (N(strcmp(fxd,new CString("shape"))))) { @@ -2745,9 +2751,9 @@ UNSUPPORTED("1fjwgzo5xkijo98ycmzhal8yv"); // bb = pd->size_gen(bb); bb.setDouble("y", height); } else { width = MAX(width, bb.getDouble("x")); - bb.setDouble("x", width); + ((ST_pointf) bb).x = width; height = MAX(height, bb.getDouble("y")); - bb.setDouble("y", height); + ((ST_pointf) bb).y = height; } /* If regular, make dimensions the same. * Need this to guarantee final node size is regular. @@ -2755,13 +2761,13 @@ UNSUPPORTED("1fjwgzo5xkijo98ycmzhal8yv"); // bb = pd->size_gen(bb); if (regular) { width = MAX(bb.getDouble("x"), bb.getDouble("y")); height = width; - bb.setDouble("x", width); - bb.setDouble("y", width); + ((ST_pointf) bb).x = width; + ((ST_pointf) bb).y = width; } /* Compute space available for label. Provides the justification borders */ if (N(mapbool(late_string(n, Z.z().N_nojustify, new CString("false"))))) { if (isBox) { - ND_label(n).getStruct("space").setDouble("x", MAX(dimen.getDouble("x"),bb.getDouble("x")) - spacex); + ((ST_pointf) ND_label(n).getStruct("space")).x = MAX(dimen.getDouble("x"),bb.getDouble("x")) - spacex; } else if (dimen.getDouble("y") < bb.getDouble("y")) { temp = bb.getDouble("x") * sqrt(1.0 - SQR(dimen.getDouble("y")) / SQR(bb.getDouble("y"))); @@ -2776,7 +2782,7 @@ UNSUPPORTED("1fjwgzo5xkijo98ycmzhal8yv"); // bb = pd->size_gen(bb); temp = bb.getDouble("y") - min_bb.getDouble("y"); if (dimen.getDouble("y") < imagesize.getInt("y")) temp += imagesize.getInt("y") - dimen.getDouble("y"); - ND_label(n).getStruct("space").setDouble("y", dimen.getDouble("y") + temp); + ((ST_pointf) ND_label(n).getStruct("space")).y = dimen.getDouble("y") + temp; } outp = peripheries; if (peripheries < 1) @@ -2831,41 +2837,41 @@ UNSUPPORTED("39rdmp8vl9muqtv7xs1xwtrwk"); // ymax = bb.y/2; gskew = skew / 2.; angle = (sectorangle - M_PI) / 2.; sinx = sin(angle); cosx = cos(angle); - R.setDouble("x", .5 * cosx); - R.setDouble("y", .5 * sinx); + ((ST_pointf) R).x = .5 * cosx; + ((ST_pointf) R).y = .5 * sinx; xmax = ymax = 0.; angle += (M_PI - sectorangle) / 2.; for (i = 0; i < sides; i++) { /*next regular vertex */ angle += sectorangle; sinx = sin(angle); cosx = cos(angle); - R.setDouble("x", R.getDouble("x") + sidelength * cosx); - R.setDouble("y", R.getDouble("y") + sidelength * sinx); + ((ST_pointf) R).x = R.getDouble("x") + sidelength * cosx; + ((ST_pointf) R).y = R.getDouble("y") + sidelength * sinx; /*distort and skew */ - P.setDouble("x", R.getDouble("x") * (skewdist + R.getDouble("y") * gdistortion) + R.getDouble("y") * gskew); - P.setDouble("y", R.getDouble("y")); + ((ST_pointf) P).x = R.getDouble("x") * (skewdist + R.getDouble("y") * gdistortion) + R.getDouble("y") * gskew; + ((ST_pointf) P).y = R.getDouble("y"); /*orient P.x,P.y */ alpha = RADIANS(orientation) + atan2(P.getDouble("y"), P.getDouble("x")); sinx = sin(alpha); cosx = cos(alpha); - P.setDouble("y", hypot(P.getDouble("x"), P.getDouble("y"))); - P.setDouble("x", P.getDouble("y")); - P.setDouble("x", P.getDouble("x") * cosx); - P.setDouble("y", P.getDouble("y") * sinx); + ((ST_pointf) P).y = hypot(P.getDouble("x"), P.getDouble("y")); + ((ST_pointf) P).x = P.getDouble("y"); + ((ST_pointf) P).x = P.getDouble("x") * cosx; + ((ST_pointf) P).y = P.getDouble("y") * sinx; /*scale for label */ - P.setDouble("x", P.getDouble("x") * bb.getDouble("x")); - P.setDouble("y", P.getDouble("y") * bb.getDouble("y")); + ((ST_pointf) P).x = P.getDouble("x") * bb.getDouble("x"); + ((ST_pointf) P).y = P.getDouble("y") * bb.getDouble("y"); /*find max for bounding box */ xmax = MAX(fabs(P.getDouble("x")), xmax); ymax = MAX(fabs(P.getDouble("y")), ymax); /* store result in array of points */ vertices.plus(i).setStruct(P); if (isBox) { /* enforce exact symmetry of box */ - vertices.plus(1).setDouble("x", -P.getDouble("x")); - vertices.plus(1).setDouble("y", P.getDouble("y")); - vertices.plus(2).setDouble("x", -P.getDouble("x")); - vertices.plus(2).setDouble("y", -P.getDouble("y")); - vertices.plus(3).setDouble("x", P.getDouble("x")); - vertices.plus(3).setDouble("y", -P.getDouble("y")); + ((ST_pointf)((__c__fields)(((StarArrayOfPtr) vertices.plus(1)).getInternalArray().getInternal(0)))).x = -P.getDouble("x"); + ((ST_pointf)((__c__fields)(((StarArrayOfPtr) vertices.plus(1)).getInternalArray().getInternal(0)))).y = P.getDouble("y"); + ((ST_pointf)((__c__fields)(((StarArrayOfPtr) vertices.plus(2)).getInternalArray().getInternal(0)))).x = -P.getDouble("x"); + ((ST_pointf)((__c__fields)(((StarArrayOfPtr) vertices.plus(2)).getInternalArray().getInternal(0)))).y = -P.getDouble("y"); + ((ST_pointf)((__c__fields)(((StarArrayOfPtr) vertices.plus(3)).getInternalArray().getInternal(0)))).x = P.getDouble("x"); + ((ST_pointf)((__c__fields)(((StarArrayOfPtr) vertices.plus(3)).getInternalArray().getInternal(0)))).y = -P.getDouble("y"); break; } } @@ -2873,14 +2879,14 @@ UNSUPPORTED("39rdmp8vl9muqtv7xs1xwtrwk"); // ymax = bb.y/2; /* apply minimum dimensions */ xmax *= 2.; ymax *= 2.; - bb.setDouble("x", MAX(width, xmax)); - bb.setDouble("y", MAX(height, ymax)); + ((ST_pointf) bb).x = MAX(width, xmax); + ((ST_pointf) bb).y = MAX(height, ymax); scalex = bb.getDouble("x") / xmax; scaley = bb.getDouble("y") / ymax; for (i = 0; i < sides; i++) { P.____(vertices.plus(i)); - P.setDouble("x", P.getDouble("x") * scalex); - P.setDouble("y", P.getDouble("y") * scaley); + ((ST_pointf) P).x = P.getDouble("x") * scalex; + ((ST_pointf) P).y = P.getDouble("y") * scaley; vertices.plus(i).setStruct(P); } if (peripheries > 1) { @@ -2964,7 +2970,7 @@ throw new UnsupportedOperationException(); //static Agnode_s lastn; /* last node argument */ //static polygon_t poly; //static int last, outp, sides; -//static final __struct__ O = __struct__.from(pointf.class); /* point (0,0) */ +//static final __struct__ O = JUtils.from(pointf.class); /* point (0,0) */ //static pointf vertex; //static double xsize, ysize, scalex, scaley, box_URx, box_URy; public static boolean poly_inside(inside_t inside_context, final __struct__ p) { @@ -2976,14 +2982,14 @@ ENTERING("570t4xovyyfqipaikkf63crmk","poly_inside"); try { int i, i1, j; boolean s; - final __struct__ P = __struct__.from(pointf.class), Q = __struct__.from(pointf.class), R = __struct__.from(pointf.class); + final ST_pointf P = new ST_pointf(), Q = new ST_pointf(), R = new ST_pointf(); __ptr__ bp = inside_context.getPtr("s.bp"); __ptr__ n = inside_context.getPtr("s.n"); - P.____(ccwrotatepf(p, 90 * GD_rankdir(agraphof(n)))); + P.___(ccwrotatepf(p, 90 * GD_rankdir(agraphof(n)))); /* Quick test if port rectangle is target */ if (bp!=null) { - final __struct__ bbox = __struct__.from(boxf.class); - bbox.____(bp.getStruct()); + final ST_boxf bbox = new ST_boxf(); + bbox.___(bp.getStruct()); return INSIDE(P, bbox); } if (NEQ(n, Z.z().lastn)) { @@ -3042,8 +3048,8 @@ UNSUPPORTED("8t3g4d9acruono62leh5a8hxh"); // xsize = ND_ht(n); /* use fast test in case we are converging on a segment */ i = Z.z().last % Z.z().sides; /* in case last left over from larger polygon */ i1 = (i + 1) % Z.z().sides; - Q.____(Z.z().vertex.plus(i + Z.z().outp).getStruct()); - R.____(Z.z().vertex.plus(i1 + Z.z().outp).getStruct()); + Q.___(Z.z().vertex.plus(i + Z.z().outp).getStruct()); + R.___(Z.z().vertex.plus(i1 + Z.z().outp).getStruct()); if (N(same_side(P, Z.z().O, Q, R))) /* false if outside the segment's face */ return false; /* else inside the segment face... */ @@ -3430,7 +3436,7 @@ return poly_port_w_(n, portname, compass).copy(); private static __struct__ poly_port_w_(Agnode_s n, CString portname, CString compass) { ENTERING("5k2b9gfpwm2tj3zmzniuz9azt","poly_port"); try { - final __struct__ rv= __struct__.from(port.class); + final __struct__ rv= JUtils.from(port.class); boxf bp; int sides; /* bitmap of which sides the port lies along */ if (portname.charAt(0) == '\0') @@ -4890,11 +4896,11 @@ throw new UnsupportedOperationException(); //3 ckbg1dyu9jzx7g0c9dbriez7r // port resolvePort(node_t * n, node_t * other, port * oldport) -public static __struct__ resolvePort(Agnode_s n, Agnode_s other, port oldport) { +public static ST_port resolvePort(Agnode_s n, Agnode_s other, port oldport) { // WARNING!! STRUCT return resolvePort_w_(n, other, oldport).copy(); } -private static __struct__ resolvePort_w_(Agnode_s n, Agnode_s other, port oldport) { +private static ST_port resolvePort_w_(Agnode_s n, Agnode_s other, port oldport) { ENTERING("ckbg1dyu9jzx7g0c9dbriez7r","resolvePort"); try { UNSUPPORTED("1aa44pvk8su341rug2x5h5h9o"); // port resolvePort(node_t * n, node_t * other, port * oldport) diff --git a/src/gen/lib/common/splines__c.java b/src/gen/lib/common/splines__c.java index b20f51af2..a354c741c 100644 --- a/src/gen/lib/common/splines__c.java +++ b/src/gen/lib/common/splines__c.java @@ -48,6 +48,7 @@ import static gen.lib.cgraph.edge__c.aghead; import static gen.lib.cgraph.edge__c.agtail; import static gen.lib.cgraph.obj__c.agraphof; import static gen.lib.common.arrows__c.arrowEndClip; +import static gen.lib.common.arrows__c.arrowStartClip; import static gen.lib.common.arrows__c.arrow_flags; import static gen.lib.common.emit__c.update_bb_bz; import static gen.lib.common.memory__c.zmalloc; @@ -83,6 +84,8 @@ import static smetana.core.Macro.UNSUPPORTED; import h.Agedge_s; import h.Agnode_s; import h.Agraph_s; +import h.ST_boxf; +import h.ST_pointf; import h.bezier; import h.boxf; import h.inside_t; @@ -93,6 +96,7 @@ import h.splineInfo; import h.splines; import h.textlabel_t; import smetana.core.CFunction; +import smetana.core.JUtils; import smetana.core.MutableDouble; import smetana.core.__array_of_struct__; import smetana.core.__ptr__; @@ -363,7 +367,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -401,7 +405,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -441,7 +445,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; @@ -770,8 +774,8 @@ UNSUPPORTED("dzbrwr2ulubtjkbd8j2o4yyov"); // arrowOrthoClip(e, ps, *startp, } else { if (sflag[0]!=0) - UNSUPPORTED("startp[0] ="); - //arrowStartClip(e, ps, startp, endp, spl, sflag); + startp[0] = + arrowStartClip(e, ps, startp[0], endp[0], spl, sflag[0]); if (eflag[0]!=0) endp[0] = arrowEndClip(e, ps, startp[0], endp[0], spl, eflag[0]); @@ -791,7 +795,7 @@ ENTERING("q4t1ywnk3wm1vyh5seoj7xye","bezier_clip"); try { final __array_of_struct__ seg = __array_of_struct__.malloc(pointf.class, 4); final __array_of_struct__ best = __array_of_struct__.malloc(pointf.class, 4); - final __struct__ pt = __struct__.from(pointf.class), opt = __struct__.from(pointf.class); + final __struct__ pt = JUtils.from(pointf.class), opt = JUtils.from(pointf.class); __ptr__ left, right; final MutableDouble low = new MutableDouble(0), high = new MutableDouble(0); double t; @@ -801,13 +805,13 @@ try { if (left_inside) { left = null; right = (pointf) seg.asPtr(); - pt.____(sp.plus(0).getStruct()); + pt.___(sp.plus(0).getStruct()); idir = low; odir = high; } else { left = (pointf) seg.asPtr(); right = null; - pt.____(sp.plus(3).getStruct()); + pt.___(sp.plus(3).getStruct()); idir = high; odir = low; } @@ -815,9 +819,9 @@ try { low.setValue(0.0); high.setValue(1.0); do { - opt.____(pt); + opt.___(pt); t = (high.getValue() + low.getValue()) / 2.0; - pt.____(Bezier(sp, 3, t, left, right)); + pt.___(Bezier(sp, 3, t, left, right)); if ((Boolean) ((CFunction)inside).exe(inside_context, pt)) { idir.setValue(t); } else { @@ -931,7 +935,7 @@ LEAVING("bdirexg1qdtophlh0ofjvsmj7","new_spline"); public static void clip_and_install(Agedge_s fe, Agnode_s hn, __ptr__ ps, int pn, __ptr__ info) { ENTERING("duednxyuvf6xrff752uuv620f","clip_and_install"); try { - final __struct__ p2 = __struct__.from(pointf.class); + final __struct__ p2 = JUtils.from(pointf.class); bezier newspl; Agnode_s tn; int start[] = new int[] {0}; @@ -940,7 +944,7 @@ try { Agraph_s g; Agedge_s orig; boxf tbox=null, hbox=null; - final __struct__ inside_context = __struct__.from(inside_t.class); + final __struct__ inside_context = JUtils.from(inside_t.class); tn = agtail(fe); g = agraphof(tn); newspl = new_spline(fe, pn); @@ -1058,14 +1062,14 @@ LEAVING("25ndy15kghfrogsv0b0o0xkgv","conc_slope"); //3 egq4f4tmy1dhyj6jpj92r7xhu // void add_box(path * P, boxf b) -public static void add_box(path P, final __struct__ b) { +public static void add_box(path P, final ST_boxf b) { // WARNING!! STRUCT add_box_w_(P, b.copy()); } -private static void add_box_w_(path P, final __struct__ b) { +private static void add_box_w_(path P, final ST_boxf b) { ENTERING("egq4f4tmy1dhyj6jpj92r7xhu","add_box"); try { - if (b.getStruct("LL").getDouble("x") < b.getStruct("UR").getDouble("x") && b.getStruct("LL").getDouble("y") < b.getStruct("UR").getDouble("y")) + if (b.LL.x < b.UR.x && b.LL.y < b.UR.y) { P.getArrayOfPtr("boxes").plus(P.getInt("nbox")).setStruct(b); P.setInt("nbox", P.getInt("nbox")+1); @@ -1087,7 +1091,7 @@ try { Agnode_s n; CFunction pboxfn; n = agtail(e); - if (ED_tail_port(e).getInt("dyna")!=0) + if (ED_tail_port(e).dyna!=0) ED_tail_port(e, resolvePort(agtail(e), aghead(e), ED_tail_port(e).amp())); if (ND_shape(n)!=null) pboxfn = (CFunction) ND_shape(n).getPtr("fns").getPtr("pboxfn"); @@ -1108,7 +1112,7 @@ try { P.setInt("nbox", 0); P.setPtr("data", e); endp.setStruct("np", P.getStruct("start").getStruct("p")); - if ((et == 1) && (ND_node_type(n) == 0) && ((side = ED_tail_port(e).getInt("side"))!=0)) { + if ((et == 1) && (ND_node_type(n) == 0) && ((side = ED_tail_port(e).side)!=0)) { UNSUPPORTED("a7lrhlfwr0y475aqjk6abhb3b"); // edge_t* orig; UNSUPPORTED("ew7nyfe712nsiphifeztwxfop"); // boxf b0, b = endp->nb; UNSUPPORTED("ait3wtnnvt134z2k87lvhq4ek"); // if (side & (1<<2)) { @@ -1174,7 +1178,7 @@ UNSUPPORTED("9352ql3e58qs4fzapgjfrms2s"); // else UNSUPPORTED("2tw6ymudedo6qij3ux424ydsi"); // ED_head_port(orig).clip = 0; UNSUPPORTED("a7fgam0j0jm7bar0mblsv3no4"); // return; } - if ((et == 2) && ((side = ED_tail_port(e).getInt("side"))!=0)) { + if ((et == 2) && ((side = ED_tail_port(e).side)!=0)) { UNSUPPORTED("ew7nyfe712nsiphifeztwxfop"); // boxf b0, b = endp->nb; UNSUPPORTED("a7lrhlfwr0y475aqjk6abhb3b"); // edge_t* orig; UNSUPPORTED("ait3wtnnvt134z2k87lvhq4ek"); // if (side & (1<<2)) { @@ -1259,12 +1263,12 @@ UNSUPPORTED("auefgwb39x5hzqqc9b1zgl239"); // endp->sidemask = (1<<0); break; case 2: if (endp.getInt("sidemask") == (1<<2)) - endp.getArrayOfStruct("boxes").plus(0).getStruct().getStruct("LL").setDouble("y", P.getStruct("start").getStruct("p").getDouble("y")); + ((ST_boxf)endp.getArrayOfStruct("boxes").plus(0).getStruct()).LL.y = P.getStruct("start").getStruct("p").getDouble("y"); else - endp.getArrayOfStruct("boxes").plus(0).getStruct().getStruct("UR").setDouble("y", P.getStruct("start").getStruct("p").getDouble("y")); + ((ST_boxf)endp.getArrayOfStruct("boxes").plus(0).getStruct()).UR.y = P.getStruct("start").getStruct("p").getDouble("y"); break; case 1: - endp.getArrayOfStruct("boxes").plus(0).getStruct().getStruct("UR").setDouble("y", P.getStruct("start").getStruct("p").getDouble("y")); + ((ST_boxf)endp.getArrayOfStruct("boxes").plus(0).getStruct()).UR.y = P.getStruct("start").getStruct("p").getDouble("y"); endp.setInt("sidemask", (1<<0)); P.getStruct("start").getStruct("p").setDouble("y", P.getStruct("start").getStruct("p").getDouble("y") - 1); break; @@ -1307,7 +1311,7 @@ UNSUPPORTED("2w0c22i5xgcch77xd9jg104nw"); // P->end.constrained = NOT(0); P.getStruct("end").setInt("constrained", 0); } endp.setStruct("np", P.getStruct("end").getStruct("p")); - if ((et == 1) && (ND_node_type(n) == 0) && ((side = ED_head_port(e).getInt("side"))!=0)) { + if ((et == 1) && (ND_node_type(n) == 0) && ((side = ED_head_port(e).side)!=0)) { UNSUPPORTED("a7lrhlfwr0y475aqjk6abhb3b"); // edge_t* orig; UNSUPPORTED("ew7nyfe712nsiphifeztwxfop"); // boxf b0, b = endp->nb; UNSUPPORTED("ait3wtnnvt134z2k87lvhq4ek"); // if (side & (1<<2)) { @@ -1374,7 +1378,7 @@ UNSUPPORTED("dk49xvmby8949ngdmft4sgrox"); // ED_tail_port(orig).clip = 0; UNSUPPORTED("8jqn3kj2hrrlcifbw3x9sf6qu"); // endp->sidemask = side; UNSUPPORTED("a7fgam0j0jm7bar0mblsv3no4"); // return; } - if ((et == 2) && ((side = ED_head_port(e).getInt("side"))!=0)) { + if ((et == 2) && ((side = ED_head_port(e).side)!=0)) { UNSUPPORTED("ew7nyfe712nsiphifeztwxfop"); // boxf b0, b = endp->nb; UNSUPPORTED("a7lrhlfwr0y475aqjk6abhb3b"); // edge_t* orig; UNSUPPORTED("ait3wtnnvt134z2k87lvhq4ek"); // if (side & (1<<2)) { @@ -1459,12 +1463,12 @@ UNSUPPORTED("1r4lctdj9z1ivlz3uqpcj1yzf"); // endp->sidemask = (1<<2); UNSUPPORTED("ai3czg6gaaxspsmndknpyvuiu"); // break; case 2: if (endp.getInt("sidemask") == (1<<2)) - endp.getArrayOfStruct("boxes").plus(0).getStruct().getStruct("LL").setDouble("y", P.getStruct("end").getStruct("p").getDouble("y")); + ((ST_boxf)endp.getArrayOfStruct("boxes").plus(0).getStruct()).LL.y = P.getStruct("end").getStruct("p").getDouble("y"); else - endp.getArrayOfStruct("boxes").plus(0).getStruct().getStruct("UR").setDouble("y", P.getStruct("end").getStruct("p").getDouble("y")); + ((ST_boxf)endp.getArrayOfStruct("boxes").plus(0).getStruct()).UR.y = P.getStruct("end").getStruct("p").getDouble("y"); break; case 1: - endp.getArrayOfStruct("boxes").plus(0).getStruct().getStruct("LL").setDouble("y", P.getStruct("end").getStruct("p").getDouble("y")); + ((ST_boxf)endp.getArrayOfStruct("boxes").plus(0).getStruct()).LL.y = P.getStruct("end").getStruct("p").getDouble("y"); endp.setInt("sidemask", (1<<2)); P.getStruct("end").getStruct("p").setDouble("y", P.getStruct("end").getStruct("p").getDouble("y") +1); break; @@ -1709,7 +1713,7 @@ ENTERING("3sr8gvj4141qql0v12lb89cyt","selfRight"); try { int i, sgn, point_pair; double hx, tx, stepy, dx, dy, width, height; - final __struct__ tp = __struct__.from(pointf.class), hp = __struct__.from(pointf.class), np = __struct__.from(pointf.class); + final ST_pointf tp = new ST_pointf(), hp = new ST_pointf(), np = new ST_pointf(); Agnode_s n; Agedge_s e; final __array_of_struct__ points = __array_of_struct__.malloc(pointf.class, 1000); @@ -1719,11 +1723,11 @@ try { stepy = (sizey / 2.) / cnt; stepy = MAX(stepy, 2.); pointn = 0; - np.____(ND_coord(n)); - tp.____(ED_tail_port(e).getStruct("p")); + np.___(ND_coord(n)); + tp.___(ED_tail_port(e).getStruct("p")); tp.setDouble("x", tp.getDouble("x") + np.getDouble("x")); tp.setDouble("y", tp.getDouble("y") + np.getDouble("y")); - hp.____(ED_head_port(e).getStruct("p")); + hp.___(ED_head_port(e).getStruct("p")); hp.setDouble("x", hp.getDouble("x") + np.getDouble("x")); hp.setDouble("y", hp.getDouble("y") + np.getDouble("y")); if (tp.getDouble("y") >= hp.getDouble("y")) sgn = 1; @@ -1732,7 +1736,7 @@ try { dy = 0; // certain adjustments are required for some point_pairs in order to improve the // display of the edge path between them - point_pair = convert_sides_to_points(ED_tail_port(e).getInt("side"),ED_head_port(e).getInt("side")); + point_pair = convert_sides_to_points(ED_tail_port(e).side,ED_head_port(e).side); switch(point_pair){ case 32: case 65: if(tp.getDouble("y") == hp.getDouble("y")) @@ -1865,12 +1869,12 @@ try { int sw=0; double label_width; textlabel_t l = ED_label(e); - if ((N(ED_tail_port(e).getBoolean("defined")) && N(ED_head_port(e).getBoolean("defined"))) || + if ((N(ED_tail_port(e).defined) && N(ED_head_port(e).defined)) || ( - N(ED_tail_port(e).getInt("side") & (1<<3)) && - N(ED_head_port(e).getInt("side") & (1<<3)) && - ((ED_tail_port(e).getInt("side") != ED_head_port(e).getInt("side")) || - (N(ED_tail_port(e).getInt("side") & ((1<<2)|(1<<0))))) + N(ED_tail_port(e).side & (1<<3)) && + N(ED_head_port(e).side & (1<<3)) && + ((ED_tail_port(e).side != ED_head_port(e).side) || + (N(ED_tail_port(e).side & ((1<<2)|(1<<0))))) )) { sw = 18; if (l!=null) { @@ -1899,18 +1903,18 @@ try { * self edge with all ports inside, on the right, or at most 1 on top * and at most 1 on bottom */ - if ((N(ED_tail_port(e).getBoolean("defined")) && N(ED_head_port(e).getBoolean("defined"))) || + if ((N(ED_tail_port(e).defined) && N(ED_head_port(e).defined)) || ( - N(ED_tail_port(e).getInt("side") & (1<<3)) && - N(ED_head_port(e).getInt("side") & (1<<3)) && - ((ED_tail_port(e).getInt("side") != ED_head_port(e).getInt("side")) || - (N(ED_tail_port(e).getInt("side") & ((1<<2)|(1<<0))))))) { + N(ED_tail_port(e).side & (1<<3)) && + N(ED_head_port(e).side & (1<<3)) && + ((ED_tail_port(e).side != ED_head_port(e).side) || + (N(ED_tail_port(e).side & ((1<<2)|(1<<0))))))) { selfRight(edges, ind, cnt, sizex, sizey, sinfo); } /* self edge with port on left side */ - else if ((ED_tail_port(e).getInt("side") & (1<<3))!=0 || (ED_head_port(e).getInt("side") & (1<<3))!=0) { + else if ((ED_tail_port(e).side & (1<<3))!=0 || (ED_head_port(e).side & (1<<3))!=0) { /* handle L-R specially */ - if ((ED_tail_port(e).getInt("side") & (1<<1))!=0 || (ED_head_port(e).getInt("side") & (1<<1))!=0) { + if ((ED_tail_port(e).side & (1<<1))!=0 || (ED_head_port(e).side & (1<<1))!=0) { selfTop(edges, ind, cnt, sizex, sizey, sinfo); } else { @@ -1918,10 +1922,10 @@ try { } } /* self edge with both ports on top side */ - else if ((ED_tail_port(e).getInt("side") & (1<<2))!=0) { + else if ((ED_tail_port(e).side & (1<<2))!=0) { selfTop(edges, ind, cnt, sizex, sizey, sinfo); } - else if ((ED_tail_port(e).getInt("side") & (1<<0))!=0) { + else if ((ED_tail_port(e).side & (1<<0))!=0) { selfBottom(edges, ind, cnt, sizex, sizey, sinfo); } else assert(false); diff --git a/src/gen/lib/common/textspan__c.java b/src/gen/lib/common/textspan__c.java index 62d166878..aed083f7d 100644 --- a/src/gen/lib/common/textspan__c.java +++ b/src/gen/lib/common/textspan__c.java @@ -51,6 +51,7 @@ import h.GVC_s; import h._dt_s; import h.boxf; import h.pointf; +import smetana.core.JUtils; import smetana.core.__ptr__; import smetana.core.__struct__; @@ -319,7 +320,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -357,7 +358,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -397,7 +398,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/common/utils__c.java b/src/gen/lib/common/utils__c.java index aab354e5d..a2428d987 100644 --- a/src/gen/lib/common/utils__c.java +++ b/src/gen/lib/common/utils__c.java @@ -94,6 +94,8 @@ import h.Agedge_s; import h.Agnode_s; import h.Agraph_s; import h.Agsym_s; +import h.ST_boxf; +import h.ST_port; import h.boxf; import h.fontinfo; import h.nodequeue; @@ -103,6 +105,7 @@ import h.shape_kind; import h.textlabel_t; import smetana.core.CFunction; import smetana.core.CString; +import smetana.core.JUtils; import smetana.core.Memory; import smetana.core.Z; import smetana.core.__array_of_struct__; @@ -374,7 +377,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -412,7 +415,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -452,7 +455,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; @@ -1537,14 +1540,14 @@ LEAVING("bgnk1zwht9rwx6thmly98iofb","noClip"); //3 9vnr1bc7p533acazoxbhbfmx3 // static port chkPort (port (*pf)(node_t*, char*, char*), node_t* n, char* s) -public static __struct__ chkPort(CFunction pf, Agnode_s n, CString s) { +public static ST_port chkPort(CFunction pf, Agnode_s n, CString s) { // WARNING!! STRUCT return chkPort_w_(pf, n, s).copy(); } -private static __struct__ chkPort_w_(CFunction pf, Agnode_s n, CString s) { +private static ST_port chkPort_w_(CFunction pf, Agnode_s n, CString s) { ENTERING("9vnr1bc7p533acazoxbhbfmx3","chkPort"); try { - final __struct__ pt = __struct__.from(port.class); + final ST_port pt = new ST_port(); CString cp=null; if(s!=null) cp= strchr(s,':'); @@ -1555,8 +1558,8 @@ UNSUPPORTED("971i954brvgqb35cftazlqhon"); // *cp = ':'; UNSUPPORTED("2o9oidtrr5gspl1dh6vnz7mlz"); // pt.name = cp+1; } else - pt.____((__struct__) pf.exe(n, s, null)); - pt.setPtr("name", s); + pt.___((__struct__) pf.exe(n, s, null)); + pt.name = s; return pt; } finally { LEAVING("9vnr1bc7p533acazoxbhbfmx3","chkPort"); @@ -1573,8 +1576,8 @@ ENTERING("3aqh64lxwv4da2snfe7fvr45b","common_init_edge"); try { CString str; int r = 0; - final __struct__ fi = __struct__.from(fontinfo.class); - final __struct__ lfi = __struct__.from(fontinfo.class); + final __struct__ fi = JUtils.from(fontinfo.class); + final __struct__ lfi = JUtils.from(fontinfo.class); Agraph_s sg = agraphof(agtail(e)); fi.setPtr("fontname", null); lfi.setPtr("fontname", null); @@ -1643,16 +1646,16 @@ LEAVING("3aqh64lxwv4da2snfe7fvr45b","common_init_edge"); //3 3mkqvtbyq9j8ktzil6t7vakg5 // static boxf addLabelBB(boxf bb, textlabel_t * lp, boolean flipxy) -public static __struct__ addLabelBB(final __struct__ bb, textlabel_t lp, boolean flipxy) { +public static __struct__ addLabelBB(final ST_boxf bb, textlabel_t lp, boolean flipxy) { // WARNING!! STRUCT return addLabelBB_w_(bb.copy(), lp, flipxy).copy(); } -private static __struct__ addLabelBB_w_(final __struct__ bb, textlabel_t lp, boolean flipxy) { +private static __struct__ addLabelBB_w_(final ST_boxf bb, textlabel_t lp, boolean flipxy) { ENTERING("3mkqvtbyq9j8ktzil6t7vakg5","addLabelBB"); try { double width, height; - final __struct__ p = __struct__.from(pointf.class); - p.____(lp.getStruct("pos")); + final __struct__ p = JUtils.from(pointf.class); + p.___(lp.getStruct("pos")); double min, max; if (flipxy) { height = lp.getStruct("dimen").getDouble("x"); @@ -1664,16 +1667,16 @@ try { } min = p.getDouble("x") - width / 2.; max = p.getDouble("x") + width / 2.; - if (min < bb.getStruct("LL").getDouble("x")) - bb.getStruct("LL").setDouble("x", min); - if (max > bb.getStruct("UR").getDouble("x")) - bb.getStruct("UR").setDouble("x", max); + if (min < bb.LL.x) + bb.LL.x = min; + if (max > bb.UR.x) + bb.UR.x = max; min = p.getDouble("y") - height / 2.; max = p.getDouble("y") + height / 2.; - if (min < bb.getStruct("LL").getDouble("y")) - bb.getStruct("LL").setDouble("y", min); - if (max > bb.getStruct("UR").getDouble("y")) - bb.getStruct("UR").setDouble("y", max); + if (min < bb.LL.y) + bb.LL.y = min; + if (max > bb.UR.y) + bb.UR.y = max; return bb; } finally { LEAVING("3mkqvtbyq9j8ktzil6t7vakg5","addLabelBB"); @@ -1714,7 +1717,7 @@ throw new UnsupportedOperationException(); public static void updateBB(Agraph_s g, textlabel_t lp) { ENTERING("bz7kjecium6a7xa39qfobwwnc","updateBB"); try { - GD_bb(g).____(addLabelBB(GD_bb(g), lp, GD_flip(g)!=0)); + GD_bb(g).___(addLabelBB(GD_bb(g), lp, GD_flip(g)!=0)); } finally { LEAVING("bz7kjecium6a7xa39qfobwwnc","updateBB"); } diff --git a/src/gen/lib/dotgen/acyclic__c.java b/src/gen/lib/dotgen/acyclic__c.java index 2d5cb9b45..a661a1038 100644 --- a/src/gen/lib/dotgen/acyclic__c.java +++ b/src/gen/lib/dotgen/acyclic__c.java @@ -64,6 +64,7 @@ import h.Agnode_s; import h.Agraph_s; import h.boxf; import h.pointf; +import smetana.core.JUtils; import smetana.core.__struct__; public class acyclic__c { @@ -331,7 +332,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -369,7 +370,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -409,7 +410,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; @@ -737,7 +738,7 @@ try { return; ND_mark(n, 1); ND_onstack(n, 1); - for (i = 0; (e = (Agedge_s) ND_out(n).getArrayOfPtr("list").plus(i).getPtr())!=null; i++) { + for (i = 0; (e = (Agedge_s) ND_out(n).getFromList(i))!=null; i++) { w = aghead(e); if (ND_onstack(w)) { reverse_edge(e); @@ -763,8 +764,8 @@ ENTERING("1ejgnwd7ek344caegjwg46n6h","acyclic"); try { int c; Agnode_s n; - for (c = 0; c < GD_comp(g).getInt("size"); c++) { - GD_nlist(g, GD_comp(g).getArrayOfPtr("list").plus(c).getPtr()); + for (c = 0; c < GD_comp(g).size; c++) { + GD_nlist(g, GD_comp(g).getFromList(c)); for (n = GD_nlist(g); n!=null; n = ND_next(n)) ND_mark(n, 0); for (n = GD_nlist(g); n!=null; n = ND_next(n)) diff --git a/src/gen/lib/dotgen/aspect__c.java b/src/gen/lib/dotgen/aspect__c.java index 34a71f545..cf6b5e419 100644 --- a/src/gen/lib/dotgen/aspect__c.java +++ b/src/gen/lib/dotgen/aspect__c.java @@ -54,6 +54,7 @@ import h.aspect_t; import h.boxf; import h.pointf; import smetana.core.CString; +import smetana.core.JUtils; import smetana.core.__struct__; public class aspect__c { @@ -321,7 +322,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -359,7 +360,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -399,7 +400,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/dotgen/class1__c.java b/src/gen/lib/dotgen/class1__c.java index a15ad019a..fad352f14 100644 --- a/src/gen/lib/dotgen/class1__c.java +++ b/src/gen/lib/dotgen/class1__c.java @@ -77,6 +77,7 @@ import h.Agraph_s; import h.boxf; import h.pointf; import smetana.core.CString; +import smetana.core.JUtils; import smetana.core.Z; import smetana.core.__struct__; @@ -345,7 +346,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -383,7 +384,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -423,7 +424,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/dotgen/class2__c.java b/src/gen/lib/dotgen/class2__c.java index 917a3bdd7..843107dcd 100644 --- a/src/gen/lib/dotgen/class2__c.java +++ b/src/gen/lib/dotgen/class2__c.java @@ -104,6 +104,7 @@ import h.Agnode_s; import h.Agraph_s; import h.boxf; import h.pointf; +import smetana.core.JUtils; import smetana.core.Z; import smetana.core.__struct__; @@ -372,7 +373,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -410,7 +411,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -450,7 +451,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; @@ -753,8 +754,8 @@ public static Agnode_s label_vnode(Agraph_s g, Agedge_s orig) { ENTERING("2zn7c6ulmwwzaibdxo127jf04","label_vnode"); try { Agnode_s v; - final __struct__ dimen = __struct__.from(pointf.class); - dimen.____(ED_label(orig).getStruct("dimen")); + final __struct__ dimen = JUtils.from(pointf.class); + dimen.___(ED_label(orig).getStruct("dimen")); v = virtual_node(g); ND_label(v, ED_label(orig)); ND_lw(v, GD_nodesep(agroot(v))); @@ -893,7 +894,7 @@ try { make_chain(g, t, h, e); /* mark as cluster edge */ for (ve = ED_to_virt(e); ve!=null && (ND_rank(aghead(ve)) <= ND_rank(h)); - ve = (Agedge_s) ND_out(aghead(ve)).getArrayOfPtr("list").plus(0).getPtr()) + ve = (Agedge_s) ND_out(aghead(ve)).getFromList(0)) ED_edge_type(ve, 5); } /* else ignore intra-cluster edges at this point */ @@ -939,7 +940,7 @@ try { if (ND_rank(aghead(rep)) == lastrank) break; incr_width(g, aghead(rep)); - rep = (Agedge_s) ND_out(aghead(rep)).getArrayOfPtr("list").plus(0).getPtr(); + rep = (Agedge_s) ND_out(aghead(rep)).getFromList(0); } while (rep!=null); } finally { LEAVING("c45973dtaighb3u0auuekcs1y","merge_chain"); @@ -1087,8 +1088,8 @@ try { } /* since decompose() is not called on subgraphs */ if (NEQ(g, dot_root(g))) { - GD_comp(g).setPtr("list", ALLOC_empty(1, GD_comp(g).getPtr("list"), Agnode_s.class)); - GD_comp(g).getArrayOfPtr("list").plus(0).setPtr(GD_nlist(g)); + GD_comp(g).reallocEmpty(1, Agnode_s.class); + GD_comp(g).setInList(0, GD_nlist(g)); } } finally { LEAVING("d0bxlkysxucmww7t74u9krrgz","class2"); diff --git a/src/gen/lib/dotgen/cluster__c.java b/src/gen/lib/dotgen/cluster__c.java index 4d78a4d72..9befefa86 100644 --- a/src/gen/lib/dotgen/cluster__c.java +++ b/src/gen/lib/dotgen/cluster__c.java @@ -115,6 +115,7 @@ import h.Agraph_s; import h.boxf; import h.nodequeue; import h.pointf; +import smetana.core.JUtils; import smetana.core.__ptr__; import smetana.core.__struct__; @@ -383,7 +384,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -421,7 +422,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -461,7 +462,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; @@ -871,7 +872,7 @@ try { ED_edge_type(e, type); u = v; ED_count(ve, ED_count(ve) - 1); - ve = (Agedge_s) ND_out(aghead(ve)).getArrayOfPtr("list").plus(0).getPtr(); + ve = (Agedge_s) ND_out(aghead(ve)).getFromList(0); } } else { if (ND_rank(to) - ND_rank(from) == 1) { @@ -899,7 +900,7 @@ try { } else e = ve; while (ND_rank(aghead(e)) != ND_rank(to)) - e = (Agedge_s) ND_out(aghead(e)).getArrayOfPtr("list").plus(0).getPtr(); + e = (Agedge_s) ND_out(aghead(e)).getFromList(0); if (NEQ(aghead(e), to)) { ve = e; e = virtual_edge(agtail(e), to, orig); @@ -958,12 +959,12 @@ try { e = AGMKOUT(e); /* short/flat multi edges */ if (mergeable(prev, e)) { -UNSUPPORTED("1pv8kbb78w6fs8m3i4x1mrsfv"); // if (ND_rank(agtail(e)) == ND_rank(aghead(e))) -UNSUPPORTED("dzrp230epur5myrngxf86icdl"); // ED_to_virt(e) = prev; -UNSUPPORTED("7e1uy5mzei37p66t8jp01r3mk"); // else -UNSUPPORTED("80avg8pw0q6u1yek5npatayak"); // ED_to_virt(e) = NULL; -UNSUPPORTED("2oxl2hzhfzzfn7q7i6phwgkqd"); // if (ED_to_virt(prev) == NULL) -UNSUPPORTED("10wljk1lfxrvhkb8y6bzvxz35"); // continue; /* internal edge */ + if (ND_rank(agtail(e)) == ND_rank(aghead(e))) + ED_to_virt(e, prev); + else + ED_to_virt(e, null); + if (ED_to_virt(prev) == null) + continue; /* internal edge */ UNSUPPORTED("8d5mw7m9lzlseqbyx8a8mncgs"); // merge_chain(subg, e, ED_to_virt(prev), 0); UNSUPPORTED("87mmnlsj8quzlzg0vxax15kt2"); // safe_other_edge(e); UNSUPPORTED("6hyelvzskqfqa07xtgjtvg2is"); // continue; @@ -1057,9 +1058,9 @@ try { for (r = GD_minrank(g); r <= GD_maxrank(g); r++) { v = (Agnode_s) GD_rankleader(g).plus(r).getPtr(); /* remove the entire chain */ - while ((e = (Agedge_s) ND_out(v).getArrayOfPtr("list").plus(0).getPtr())!=null) + while ((e = (Agedge_s) ND_out(v).getFromList(0))!=null) delete_fast_edge(e); - while ((e = (Agedge_s) ND_in(v).getArrayOfPtr("list").plus(0).getPtr())!=null) + while ((e = (Agedge_s) ND_in(v).getFromList(0))!=null) delete_fast_edge(e); delete_fast_node(dot_root(g), v); GD_rankleader(g).plus(r).setPtr(null); @@ -1079,8 +1080,9 @@ ENTERING("ecrplg8hsyl484f9kxc5xp0go","expand_cluster"); try { /* build internal structure of the cluster */ class2(subg); - GD_comp(subg).setInt("size", 1); - GD_comp(subg).getArrayOfPtr("list").plus(0).setPtr(GD_nlist(subg)); + GD_comp(subg).size = 1; + // GD_comp(subg).getArrayOfPtr("list").plus(0).setPtr(GD_nlist(subg)); + GD_comp(subg).setInList(0, GD_nlist(subg)); allocate_ranks(subg); build_ranks(subg, 0); merge_ranks(subg); @@ -1130,7 +1132,7 @@ UNSUPPORTED("6hyelvzskqfqa07xtgjtvg2is"); // continue; if ((e = ED_to_virt(orig))!=null) { while (e!=null && ND_node_type(vn =aghead(e)) == 1) { ND_clust(vn, clust); - e = (Agedge_s) ND_out(aghead(e)).getArrayOfPtr("list").plus(0).getPtr(); + e = (Agedge_s) ND_out(aghead(e)).getFromList(0); /* trouble if concentrators and clusters are mixed */ } } @@ -1173,7 +1175,7 @@ try { ND_UF_size(rl, ND_UF_size(rl)+1); for (e = agfstout(subg, v); e!=null; e = agnxtout(subg, e)) { for (r = ND_rank(agtail(e)); r < ND_rank(aghead(e)); r++) { - ED_count(ND_out(rl).getArrayOfPtr("list").plus(0).getPtr(), ED_count(ND_out(rl).getArrayOfPtr("list").plus(0).getPtr())+1); + ED_count(ND_out(rl).getFromList(0), ED_count(ND_out(rl).getFromList(0))+1); } } } @@ -1227,7 +1229,7 @@ try { if ((e = ED_to_virt(orig))!=null) { while (e!=null && (ND_node_type(vn = aghead(e))) == 1) { ND_clust(vn, null); - e = (Agedge_s) ND_out(aghead(e)).getArrayOfPtr("list").plus(0).getPtr(); + e = (Agedge_s) ND_out(aghead(e)).getFromList(0); } } } @@ -1264,7 +1266,7 @@ try { while (e!=null && (ND_node_type(vn = aghead(e))) == 1) { if (ND_clust(vn) == null) ND_clust(vn, g); - e = (Agedge_s) ND_out(aghead(e)).getArrayOfPtr("list").plus(0).getPtr(); + e = (Agedge_s) ND_out(aghead(e)).getFromList(0); } } } diff --git a/src/gen/lib/dotgen/compound__c.java b/src/gen/lib/dotgen/compound__c.java index 10808103e..614cae934 100644 --- a/src/gen/lib/dotgen/compound__c.java +++ b/src/gen/lib/dotgen/compound__c.java @@ -49,6 +49,7 @@ import static smetana.core.JUtilsDebug.LEAVING; import static smetana.core.Macro.UNSUPPORTED; import h.boxf; import h.pointf; +import smetana.core.JUtils; import smetana.core.__struct__; public class compound__c { @@ -316,7 +317,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -354,7 +355,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -394,7 +395,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/dotgen/conc__c.java b/src/gen/lib/dotgen/conc__c.java index b33a4a5f3..ea9d4191d 100644 --- a/src/gen/lib/dotgen/conc__c.java +++ b/src/gen/lib/dotgen/conc__c.java @@ -49,6 +49,7 @@ import static smetana.core.JUtilsDebug.LEAVING; import static smetana.core.Macro.UNSUPPORTED; import h.boxf; import h.pointf; +import smetana.core.JUtils; import smetana.core.__struct__; import smetana.core.jmp_buf; @@ -317,7 +318,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -355,7 +356,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -395,7 +396,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/dotgen/decomp__c.java b/src/gen/lib/dotgen/decomp__c.java index 820c828af..75e30a6e2 100644 --- a/src/gen/lib/dotgen/decomp__c.java +++ b/src/gen/lib/dotgen/decomp__c.java @@ -52,7 +52,6 @@ import static gen.lib.common.utils__c.UF_find; import static smetana.core.JUtils.EQ; import static smetana.core.JUtilsDebug.ENTERING; import static smetana.core.JUtilsDebug.LEAVING; -import static smetana.core.Macro.ALLOC_empty; import static smetana.core.Macro.GD_comp; import static smetana.core.Macro.GD_n_nodes; import static smetana.core.Macro.GD_nlist; @@ -70,9 +69,11 @@ import static smetana.core.Macro.UNSUPPORTED; import h.Agedge_s; import h.Agnode_s; import h.Agraph_s; +import h.ST_elist; import h.boxf; import h.elist; import h.pointf; +import smetana.core.JUtils; import smetana.core.Z; import smetana.core.__array_of_struct__; import smetana.core.__struct__; @@ -342,7 +343,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -380,7 +381,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -420,7 +421,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; @@ -771,10 +772,10 @@ public static void end_component() { ENTERING("5o8hxpr6ppi15pinuy79m7u04","end_component"); try { int i; - i = GD_comp(Z.z().G_decomp).getInt("size"); - GD_comp(Z.z().G_decomp).setInt("size", 1+GD_comp(Z.z().G_decomp).getInt("size")); - GD_comp(Z.z().G_decomp).setPtr("list", ALLOC_empty(GD_comp(Z.z().G_decomp).getInt("size"), GD_comp(Z.z().G_decomp).getPtr("list"), Agnode_s.class)); - GD_comp(Z.z().G_decomp).getArrayOfPtr("list").plus(i).setPtr(GD_nlist(Z.z().G_decomp)); + i = GD_comp(Z.z().G_decomp).size; + GD_comp(Z.z().G_decomp).size = 1+GD_comp(Z.z().G_decomp).size; + GD_comp(Z.z().G_decomp).reallocEmpty(GD_comp(Z.z().G_decomp).size, Agnode_s.class); + GD_comp(Z.z().G_decomp).setInList(i ,GD_nlist(Z.z().G_decomp)); } finally { LEAVING("5o8hxpr6ppi15pinuy79m7u04","end_component"); } @@ -798,8 +799,8 @@ try { vec.plus(2).setStruct(ND_flat_out(n)); vec.plus(3).setStruct(ND_flat_in(n)); for (c = 0; c <= 3; c++) { - if (vec.plus(c).getStruct().getPtr("list")!=null) - for (i = 0; (e = (Agedge_s) vec.plus(c).getStruct().getArrayOfPtr("list").plus(i).getPtr())!=null; i++) { + if (((ST_elist) vec.plus(c).getStruct()).listNotNull()) + for (i = 0; (e = (Agedge_s) ((ST_elist) vec.plus(c).getStruct()).getFromList(i))!=null; i++) { if (EQ(other = aghead(e), n)) other = agtail(e); if ((ND_mark(other) != Z.z().Cmark) && (EQ(other, UF_find(other)))) @@ -825,7 +826,7 @@ try { if (++Z.z().Cmark == 0) Z.z().Cmark = 1; GD_n_nodes(g, 0); - GD_comp(g).setInt("size", 0); + GD_comp(g).size = 0; for (n = agfstnode(g); n!=null; n = agnxtnode(g, n)) { v = n; if ((pass > 0) && (subg = ND_clust(v))!=null) diff --git a/src/gen/lib/dotgen/dotinit__c.java b/src/gen/lib/dotgen/dotinit__c.java index c34a509de..f6768c044 100644 --- a/src/gen/lib/dotgen/dotinit__c.java +++ b/src/gen/lib/dotgen/dotinit__c.java @@ -113,6 +113,7 @@ import h.pack_info; import h.pack_mode; import h.pointf; import smetana.core.CString; +import smetana.core.JUtils; import smetana.core.Memory; import smetana.core.Z; import smetana.core.__ptr__; @@ -383,7 +384,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -421,7 +422,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -461,7 +462,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/dotgen/dotsplines__c.java b/src/gen/lib/dotgen/dotsplines__c.java index 2dbf0b689..4265f908b 100644 --- a/src/gen/lib/dotgen/dotsplines__c.java +++ b/src/gen/lib/dotgen/dotsplines__c.java @@ -129,15 +129,17 @@ import h.Agedgepair_s; import h.Agnode_s; import h.Agraph_s; import h.Ppoly_t; +import h.ST_boxf; +import h.ST_port; import h.attr_state_t; import h.bezier; import h.boxf; import h.path; import h.pathend_t; import h.pointf; -import h.port; import h.spline_info_t; import h.splines; +import smetana.core.JUtils; import smetana.core.Memory; import smetana.core.Z; import smetana.core.__array_of_struct__; @@ -409,7 +411,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -440,18 +442,18 @@ throw new UnsupportedOperationException(); //3 1vvsta5i8of59frav6uymguav // static inline boxf boxfof(double llx, double lly, double urx, double ury) -public static __struct__ boxfof(double llx, double lly, double urx, double ury) { +public static ST_boxf boxfof(double llx, double lly, double urx, double ury) { // WARNING!! STRUCT return boxfof_w_(llx, lly, urx, ury).copy(); } -private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { +private static ST_boxf boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); - b.getStruct("LL").setDouble("x", llx); - b.getStruct("LL").setDouble("y", lly); - b.getStruct("UR").setDouble("x", urx); - b.getStruct("UR").setDouble("y", ury); + final ST_boxf b = new ST_boxf(); + b.LL.x = llx; + b.LL.y = lly; + b.UR.x = urx; + b.UR.y = ury; return b; } finally { LEAVING("1vvsta5i8of59frav6uymguav","boxfof"); @@ -487,7 +489,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; @@ -813,7 +815,7 @@ public static boolean spline_merge(Agnode_s n) { ENTERING("ddeny5ht7w8b16ztj5zt840ld","spline_merge"); try { return ((ND_node_type(n) == 1) - && ((ND_in(n).getInt("size") > 1) || (ND_out(n).getInt("size") > 1))); + && ((ND_in(n).size > 1) || (ND_out(n).size > 1))); } finally { LEAVING("ddeny5ht7w8b16ztj5zt840ld","spline_merge"); } @@ -844,7 +846,7 @@ LEAVING("36ofw2qfqlh5ci8gc8cfkqgg3","swap_ends_p"); //1 300wnvw9sndobgke752j9u139 // static splineInfo sinfo = -/*static final __struct__ sinfo = __struct__.from(splineInfo.class); +/*static final __struct__ sinfo = JUtils.from(splineInfo.class); static { sinfo.setPtr("swapEnds", function(dotsplines__c.class, "swap_ends_p")); sinfo.setPtr("splineMerge", function(dotsplines__c.class, "spline_merge")); @@ -855,21 +857,21 @@ static { //3 3krohso3quojiv4fveh1en7o6 // int portcmp(port p0, port p1) -public static int portcmp(final __struct__ p0, final __struct__ p1) { +public static int portcmp(final ST_port p0, final ST_port p1) { // WARNING!! STRUCT return portcmp_w_(p0.copy(), p1.copy()); } -private static int portcmp_w_(final __struct__ p0, final __struct__ p1) { +private static int portcmp_w_(final ST_port p0, final ST_port p1) { ENTERING("3krohso3quojiv4fveh1en7o6","portcmp"); try { int rv; - if (p1.getBoolean("defined") == false) - return (p0.getBoolean("defined") ? 1 : 0); - if (p0.getBoolean("defined") == false) + if (p1.defined == 0) + return (p0.defined!=0 ? 1 : 0); + if (p0.defined == 0) return -1; - rv = (int) (p0.getStruct("p").getDouble("x") - p1.getStruct("p").getDouble("x")); + rv = (int) (p0.p.x - p1.p.x); if (rv == 0) - rv = (int) (p0.getStruct("p").getDouble("y") - p1.getStruct("p").getDouble("y")); + rv = (int) (p0.p.y - p1.p.y); return rv; } finally { LEAVING("3krohso3quojiv4fveh1en7o6","portcmp"); @@ -893,7 +895,7 @@ try { lp = list; olp = old.getArrayOfPtr("list").plus(sz - 1).asPtr(); for (i = 0; i < sz; i++) { /* reverse list of points */ - lp.getStruct().____(olp.getStruct()); + lp.getStruct().___(olp.getStruct()); lp=lp.plus(1); olp=olp.plus(-1); } @@ -1024,12 +1026,12 @@ ENTERING("6agx6m2qof9lg57co232lwakj","_dot_splines"); try { int i, j, k, n_nodes, n_edges, ind, cnt; Agnode_s n; - final __struct__ fwdedgeai = __struct__.from(Agedgeinfo_t.class), fwdedgebi = __struct__.from(Agedgeinfo_t.class); - final __struct__ fwdedgea = __struct__.from(Agedgepair_s.class), fwdedgeb = __struct__.from(Agedgepair_s.class); + final __struct__ fwdedgeai = JUtils.from(Agedgeinfo_t.class), fwdedgebi = JUtils.from(Agedgeinfo_t.class); + final __struct__ fwdedgea = JUtils.from(Agedgepair_s.class), fwdedgeb = JUtils.from(Agedgepair_s.class); Agedge_s e, e0, e1, ea, eb, le0, le1; __ptr__ edges; path P; - final __struct__ sd = __struct__.from(spline_info_t.class); + final __struct__ sd = JUtils.from(spline_info_t.class); int et = (GD_flags(g) & (7 << 1)); fwdedgea.getStruct("out").getStruct("base").setPtr("data", fwdedgeai.amp()); fwdedgeb.getStruct("out").getStruct("base").setPtr("data", fwdedgebi.amp()); @@ -1079,7 +1081,7 @@ UNSUPPORTED("46btiag50nczzur103eqhjcup"); // goto finish; if ((ND_node_type(n) != 0) && ((Boolean)Z.z().sinfo.call("splineMerge", n) == false)) continue; - for (k = 0; (e = (Agedge_s) ND_out(n).getArrayOfPtr("list").plus(k).getPtr())!=null; k++) { + for (k = 0; (e = (Agedge_s) ND_out(n).getFromList(k))!=null; k++) { if ((ED_edge_type(e) == 4) || (ED_edge_type(e) == 6)) continue; @@ -1088,14 +1090,14 @@ UNSUPPORTED("46btiag50nczzur103eqhjcup"); // goto finish; if (n_edges % 128 == 0) edges = ALLOC_empty (n_edges + 128, edges, Agedge_s.class); } - if (ND_flat_out(n).getPtr("list")!=null) - for (k = 0; (e = (Agedge_s) ND_flat_out(n).getArrayOfPtr("list").plus(k).getPtr())!=null; k++) { + if (ND_flat_out(n).listNotNull()) + for (k = 0; (e = (Agedge_s) ND_flat_out(n).getFromList(k))!=null; k++) { setflags(e, 2, 0, 128); edges.plus(n_edges++).setPtr(e); if (n_edges % 128 == 0) edges = ALLOC_empty (n_edges + 128, edges, Agedge_s.class); } - if (ND_other(n).getPtr("list")!=null) { + if (ND_other(n).listNotNull()) { /* In position, each node has its rw stored in mval and, * if a node is part of a loop, rw may be increased to * reflect the loops and associated labels. We restore @@ -1106,7 +1108,7 @@ UNSUPPORTED("46btiag50nczzur103eqhjcup"); // goto finish; ND_rw(n, ND_mval(n)); ND_mval(n, tmp); } - for (k = 0; (e = (Agedge_s) ND_other(n).getArrayOfPtr("list").plus(k).getPtr())!=null; k++) { + for (k = 0; (e = (Agedge_s) ND_other(n).getFromList(k))!=null; k++) { setflags(e, 0, 0, 128); edges.plus(n_edges++).setPtr(e); if (n_edges % 128 == 0) @@ -1141,7 +1143,7 @@ UNSUPPORTED("46btiag50nczzur103eqhjcup"); // goto finish; boolean havePorts; ind = i; le0 = getmainedge((e0 = (Agedge_s) edges.plus(i++).getPtr())); - if (ED_tail_port(e0).getBoolean("defined") || ED_head_port(e0).getBoolean("defined")) { + if (ED_tail_port(e0).defined!=0 || ED_head_port(e0).defined!=0) { havePorts = NOT(false); ea = e0; } else { @@ -1156,7 +1158,7 @@ UNSUPPORTED("46btiag50nczzur103eqhjcup"); // goto finish; if (NEQ(le0, (le1 = getmainedge((e1 = (Agedge_s) edges.plus(i).getPtr()))))) break; if (ED_adjacent(e0)!=0) continue; /* all flat adjacent edges at once */ - if (ED_tail_port(e1).getBoolean("defined") || ED_head_port(e1).getBoolean("defined")) { + if (ED_tail_port(e1).defined!=0 || ED_head_port(e1).defined!=0) { if (N(havePorts)) break; else eb = e1; @@ -1280,14 +1282,14 @@ LEAVING("5n306wbdfjbfnimdo9lg6jjaa","dot_splines"); public static void place_vnlabel(Agnode_s n) { ENTERING("8jja9ukzsq8tlb9yy7uzavg91","place_vnlabel"); try { - final __struct__ dimen = __struct__.from(pointf.class); + final __struct__ dimen = JUtils.from(pointf.class); double width; Agedge_s e; - if (ND_in(n).getInt("size") == 0) + if (ND_in(n).size == 0) return; /* skip flat edge labels here */ - for (e = (Agedge_s) ND_out(n).getArrayOfPtr("list").plus(0).getPtr(); ED_edge_type(e) != 0; + for (e = (Agedge_s) ND_out(n).getFromList(0); ED_edge_type(e) != 0; e = ED_to_orig(e)); - dimen.____(ED_label(e).getStruct("dimen")); + dimen.___(ED_label(e).getStruct("dimen")); width = GD_flip(agraphof(n))!=0 ? dimen.getDouble("y") : dimen.getDouble("x"); ED_label(e).getStruct("pos").setDouble("x", ND_coord(n).getDouble("x") + width / 2.0); ED_label(e).getStruct("pos").setDouble("y", ND_coord(n).getDouble("y")); @@ -1310,7 +1312,7 @@ try { f1 = hint1; else { if (EQ(agtail(e), aghead(e))) - if (ED_tail_port(e).getBoolean("defined") || ED_head_port(e).getBoolean("defined")) + if (ED_tail_port(e).defined!=0 || ED_head_port(e).defined!=0) f1 = 4; else f1 = 8; @@ -1343,8 +1345,8 @@ LEAVING("598jn37hjkm7j0kcg2nmdvlwq","setflags"); public static int edgecmp(__ptr__ ptr0, __ptr__ ptr1) { ENTERING("1nf1s6wkn35ptjn884ii56fh","edgecmp"); try { - final __struct__ fwdedgeai = __struct__.from(Agedgeinfo_t.class), fwdedgebi = __struct__.from(Agedgeinfo_t.class); - final __struct__ fwdedgea = __struct__.from(Agedgepair_s.class), fwdedgeb = __struct__.from(Agedgepair_s.class); + final __struct__ fwdedgeai = JUtils.from(Agedgeinfo_t.class), fwdedgebi = JUtils.from(Agedgeinfo_t.class); + final __struct__ fwdedgea = JUtils.from(Agedgepair_s.class), fwdedgeb = JUtils.from(Agedgepair_s.class); Agedge_s e0, e1, ea, eb, le0, le1; int et0, et1, v0, v1, rv; double t0, t1; @@ -1373,12 +1375,12 @@ try { /* This provides a cheap test for edges having the same set of endpoints. */ if (AGSEQ(le0) != AGSEQ(le1)) return (AGSEQ(le0) - AGSEQ(le1)); - ea = (ED_tail_port(e0).getBoolean("defined") || ED_head_port(e0).getBoolean("defined")) ? e0 : le0; + ea = (ED_tail_port(e0).defined!=0 || ED_head_port(e0).defined!=0) ? e0 : le0; if ((ED_tree_index(ea) & 32)!=0) { MAKEFWDEDGE(fwdedgea.getStruct("out").amp(), ea); ea = fwdedgea.getStruct("out").amp(); } - eb = (ED_tail_port(e1).getBoolean("defined") || ED_head_port(e1).getBoolean("defined")) ? e1 : le1; + eb = (ED_tail_port(e1).defined!=0 || ED_head_port(e1).defined!=0) ? e1 : le1; if ((ED_tree_index(eb) & 32)!=0) { MAKEFWDEDGE(fwdedgeb.getStruct("out").amp(), eb); eb = fwdedgeb.getStruct("out").amp(); @@ -1676,13 +1678,13 @@ public static int edgelblcmpfn(__ptr__ ptr0, __ptr__ ptr1) { ENTERING("bmsa24i3avg14po4sp17yh89k","edgelblcmpfn"); try { Agedge_s e0, e1; - final __struct__ sz0 = __struct__.from(pointf.class), sz1 = __struct__.from(pointf.class); + final __struct__ sz0 = JUtils.from(pointf.class), sz1 = JUtils.from(pointf.class); e0 = (Agedge_s) ptr0.getPtr(); e1 = (Agedge_s) ptr1.getPtr(); if (ED_label(e0)!=null) { if (ED_label(e1)!=null) { - sz0.____(ED_label(e0).getStruct("dimen")); - sz1.____(ED_label(e1).getStruct("dimen")); + sz0.___(ED_label(e0).getStruct("dimen")); + sz1.___(ED_label(e1).getStruct("dimen")); if (sz0.getDouble("x") > sz1.getDouble("x")) return -1; else if (sz0.getDouble("x") < sz1.getDouble("x")) return 1; else if (sz0.getDouble("y") > sz1.getDouble("y")) return -1; @@ -1711,11 +1713,11 @@ public static void makeSimpleFlatLabels(Agnode_s tn, Agnode_s hn, __ptr__ edges, ENTERING("3xmylrnypvoqrj2yrxnomsj5k","makeSimpleFlatLabels"); try { pointf ps; - final __struct__ poly = __struct__.from(Ppoly_t.class); + final __struct__ poly = JUtils.from(Ppoly_t.class); int pn[] = new int[1]; Agedge_s e = (Agedge_s) edges.plus(ind).getPtr(); final __array_of_struct__ points = __array_of_struct__.malloc(pointf.class, 10); - final __struct__ tp = __struct__.from(pointf.class), hp = __struct__.from(pointf.class); + final __struct__ tp = JUtils.from(pointf.class), hp = JUtils.from(pointf.class); int i, pointn; double leftend, rightend, ctrx=0, ctry=0, miny, maxy; double uminx=0, umaxx=0; @@ -1728,8 +1730,8 @@ try { cnt, sizeof(earray.plus(0)), function(dotsplines__c.class, "edgelblcmpfn")); - tp.____(add_pointf(ND_coord(tn), ED_tail_port(e).getStruct("p"))); - hp.____(add_pointf(ND_coord(hn), ED_head_port(e).getStruct("p"))); + tp.___(add_pointf(ND_coord(tn), ED_tail_port(e).getStruct("p"))); + hp.___(add_pointf(ND_coord(hn), ED_head_port(e).getStruct("p"))); leftend = tp.getDouble("x")+ND_rw(tn); rightend = hp.getDouble("x")-ND_lw(hn); ctrx = (leftend + rightend)/2.0; @@ -1864,11 +1866,11 @@ ENTERING("8kqyzk43ovc2sq6jegua6ytp","makeSimpleFlat"); try { Agedge_s e = (Agedge_s) edges.plus(ind).getPtr(); final __array_of_struct__ points = __array_of_struct__.malloc(pointf.class, 10); - final __struct__ tp = __struct__.from(pointf.class), hp = __struct__.from(pointf.class); + final __struct__ tp = JUtils.from(pointf.class), hp = JUtils.from(pointf.class); int i, pointn; double stepy, dy; - tp.____(add_pointf(ND_coord(tn), ED_tail_port(e).getStruct("p"))); - hp.____(add_pointf(ND_coord(hn), ED_head_port(e).getStruct("p"))); + tp.___(add_pointf(ND_coord(tn), ED_tail_port(e).getStruct("p"))); + hp.___(add_pointf(ND_coord(hn), ED_head_port(e).getStruct("p"))); stepy = (cnt > 1) ? ND_ht(tn) / (double)(cnt - 1) : 0.; dy = tp.getDouble("y") - ((cnt > 1) ? ND_ht(tn) / 2. : 0.); for (i = 0; i < cnt; i++) { @@ -1917,14 +1919,14 @@ try { Agnode_s auxt, auxh; Agedge_s auxe; int i, j, midx, midy, leftx, rightx; - final __struct__ del = __struct__.from(pointf.class); + final __struct__ del = JUtils.from(pointf.class); Agedge_s hvye = null; attr_state_t attrs; tn = agtail(e0); hn = aghead(e0); for (i = 0; i < cnt; i++) { e = (Agedge_s) edges.plus(ind + i).getPtr(); if (ED_label(e)!=null) labels++; - if (ED_tail_port(e).getBoolean("defined") || ED_head_port(e).getBoolean("defined")) ports = 1; + if (ED_tail_port(e).defined!=0 || ED_head_port(e).defined!=0) ports = 1; } if (ports == 0) { /* flat edges without ports and labels can go straight left to right */ @@ -2051,16 +2053,16 @@ LEAVING("bhnjospwghq4plid12757c928","make_flat_adj_edges"); public static void makeFlatEnd(Agraph_s g, spline_info_t sp, path P, Agnode_s n, Agedge_s e, pathend_t endp, boolean isBegin) { ENTERING("fybar4mljnmkh3kure5k1eod","makeFlatEnd"); try { - final __struct__ b = __struct__.from(boxf.class); - b.____(maximal_bbox(g, sp, n, null, e)); + final ST_boxf b = new ST_boxf(); + b.___(maximal_bbox(g, sp, n, null, e)); endp.setStruct("nb", b); endp.setInt("sidemask", 1<<2); if (isBegin) beginpath(P, e, 2, endp, false); else endpath(P, e, 2, endp, false); - b.getStruct("UR").setDouble("y", endp.getArrayOfStruct("boxes").plus(endp.getInt("boxn") - 1).getStruct().getStruct("UR").getDouble("y")); - b.getStruct("LL").setDouble("y", endp.getArrayOfStruct("boxes").plus(endp.getInt("boxn") - 1).getStruct().getStruct("LL").getDouble("y")); - b.____(makeregularend(b, (1<<2), ND_coord(n).getDouble("y") + GD_rank(g).plus(ND_rank(n)).getDouble("ht2"))); - if (b.getStruct("LL").getDouble("x") < b.getStruct("UR").getDouble("x") && b.getStruct("LL").getDouble("y") < b.getStruct("UR").getDouble("y")) + b.UR.y = ((ST_boxf)endp.getArrayOfStruct("boxes").plus(endp.getInt("boxn") - 1).getStruct()).UR.y; + b.LL.y = ((ST_boxf)endp.getArrayOfStruct("boxes").plus(endp.getInt("boxn") - 1).getStruct()).LL.y; + b.___(makeregularend((ST_boxf) b, (1<<2), ND_coord(n).getDouble("y") + GD_rank(g).plus(ND_rank(n)).getDouble("ht2"))); + if (b.LL.x < b.UR.x && b.LL.y < b.UR.y) UNSUPPORTED("cmjm4y40vf7wklmgz0ae4k36v"); // endp->boxes[endp->boxn++] = b; } finally { LEAVING("fybar4mljnmkh3kure5k1eod","makeFlatEnd"); @@ -2102,8 +2104,8 @@ ENTERING("w8ptjibydq995d2lexg85mku","make_flat_labeled_edge"); try { Agnode_s tn, hn, ln; pointf ps = null; - final __struct__ tend = __struct__.from(pathend_t.class), hend = __struct__.from(pathend_t.class); - final __struct__ lb = __struct__.from(boxf.class); + final __struct__ tend = JUtils.from(pathend_t.class), hend = JUtils.from(pathend_t.class); + final ST_boxf lb = new ST_boxf(); int boxn, i, ydelta; int pn[] = new int[1]; Agedge_s f; @@ -2127,34 +2129,34 @@ UNSUPPORTED("68ojpcos92c96bc0i5ag1yb6v"); // ps = points; UNSUPPORTED("1uunj4jbr2uhiqxwor6rzmr3j"); // pn = 7; } else { - lb.getStruct("LL").setDouble("x", ND_coord(ln).getDouble("x") - ND_lw(ln)); - lb.getStruct("UR").setDouble("x", ND_coord(ln).getDouble("x") + ND_rw(ln)); - lb.getStruct("UR").setDouble("y", ND_coord(ln).getDouble("y") + ND_ht(ln)/2); + lb.LL.x = ND_coord(ln).getDouble("x") - ND_lw(ln); + lb.UR.x = ND_coord(ln).getDouble("x") + ND_rw(ln); + lb.UR.y = ND_coord(ln).getDouble("y") + ND_ht(ln)/2; ydelta = (int)(ND_coord(ln).getDouble("y") - GD_rank(g).plus(ND_rank(tn)).getDouble("ht1") - ND_coord(tn).getDouble("y") + GD_rank(g).plus(ND_rank(tn)).getDouble("ht2")); ydelta = (int)(ydelta / 6.); - lb.getStruct("LL").setDouble("y", lb.getStruct("UR").getDouble("y") - MAX(5.,ydelta)); + lb.LL.y = lb.UR.y - MAX(5.,ydelta); boxn = 0; makeFlatEnd (g, sp, P, tn, e, tend.amp(), NOT(false)); makeFlatEnd (g, sp, P, hn, e, hend.amp(), false); - Z.z().boxes.plus(boxn).getStruct().getStruct("LL").setDouble("x", tend.getArrayOfStruct("boxes").plus(tend.getInt("boxn") - 1).getStruct().getStruct("LL").getDouble("x")); - Z.z().boxes.plus(boxn).getStruct().getStruct("LL").setDouble("y", tend.getArrayOfStruct("boxes").plus(tend.getInt("boxn") - 1).getStruct().getStruct("UR").getDouble("y")); - Z.z().boxes.plus(boxn).getStruct().getStruct("UR").setDouble("x", lb.getStruct("LL").getDouble("x")); - Z.z().boxes.plus(boxn).getStruct().getStruct("UR").setDouble("y", lb.getStruct("LL").getDouble("y")); + ((ST_boxf)Z.z().boxes.plus(boxn).getStruct()).LL.x = ((ST_boxf)tend.getArrayOfStruct("boxes").plus(tend.getInt("boxn") - 1).getStruct()).LL.x; + ((ST_boxf)Z.z().boxes.plus(boxn).getStruct()).LL.y = ((ST_boxf)tend.getArrayOfStruct("boxes").plus(tend.getInt("boxn") - 1).getStruct()).UR.y; + ((ST_boxf)Z.z().boxes.plus(boxn).getStruct()).UR.x = lb.LL.x; + ((ST_boxf)Z.z().boxes.plus(boxn).getStruct()).UR.y = lb.LL.y; boxn++; - Z.z().boxes.plus(boxn).getStruct().getStruct("LL").setDouble("x", tend.getArrayOfStruct("boxes").plus(tend.getInt("boxn") - 1).getStruct().getStruct("LL").getDouble("x")); - Z.z().boxes.plus(boxn).getStruct().getStruct("LL").setDouble("y", lb.getStruct("LL").getDouble("y")); - Z.z().boxes.plus(boxn).getStruct().getStruct("UR").setDouble("x", hend.getArrayOfStruct("boxes").plus(hend.getInt("boxn") - 1).getStruct().getStruct("UR").getDouble("x")); - Z.z().boxes.plus(boxn).getStruct().getStruct("UR").setDouble("y", lb.getStruct("UR").getDouble("y")); + ((ST_boxf)Z.z().boxes.plus(boxn).getStruct()).LL.x = ((ST_boxf)tend.getArrayOfStruct("boxes").plus(tend.getInt("boxn") - 1).getStruct()).LL.x; + ((ST_boxf)Z.z().boxes.plus(boxn).getStruct()).LL.y = lb.LL.y; + ((ST_boxf)Z.z().boxes.plus(boxn).getStruct()).UR.x = ((ST_boxf)hend.getArrayOfStruct("boxes").plus(hend.getInt("boxn") - 1).getStruct()).UR.x; + ((ST_boxf)Z.z().boxes.plus(boxn).getStruct()).UR.y = lb.UR.y; boxn++; - Z.z().boxes.plus(boxn).getStruct().getStruct("LL").setDouble("x", lb.getStruct("UR").getDouble("x")); - Z.z().boxes.plus(boxn).getStruct().getStruct("UR").setDouble("y", lb.getStruct("LL").getDouble("y")); - Z.z().boxes.plus(boxn).getStruct().getStruct("LL").setDouble("y", hend.getArrayOfStruct("boxes").plus(hend.getInt("boxn") - 1).getStruct().getStruct("UR").getDouble("y")); - Z.z().boxes.plus(boxn).getStruct().getStruct("UR").setDouble("x", hend.getArrayOfStruct("boxes").plus(hend.getInt("boxn") - 1).getStruct().getStruct("UR").getDouble("x")); + ((ST_boxf)Z.z().boxes.plus(boxn).getStruct()).LL.x = lb.UR.x; + ((ST_boxf)Z.z().boxes.plus(boxn).getStruct()).UR.y = lb.LL.y; + ((ST_boxf)Z.z().boxes.plus(boxn).getStruct()).LL.y = ((ST_boxf)hend.getArrayOfStruct("boxes").plus(hend.getInt("boxn") - 1).getStruct()).UR.y; + ((ST_boxf)Z.z().boxes.plus(boxn).getStruct()).UR.x = ((ST_boxf)hend.getArrayOfStruct("boxes").plus(hend.getInt("boxn") - 1).getStruct()).UR.x; boxn++; - for (i = 0; i < tend.getInt("boxn"); i++) add_box(P, tend.getArrayOfStruct("boxes").plus(i).getStruct()); - for (i = 0; i < boxn; i++) add_box(P, Z.z().boxes.plus(i).getStruct()); - for (i = hend.getInt("boxn") - 1; i >= 0; i--) add_box(P, hend.getArrayOfStruct("boxes").plus(i).getStruct()); + for (i = 0; i < tend.getInt("boxn"); i++) add_box(P, (ST_boxf)tend.getArrayOfStruct("boxes").plus(i).getStruct()); + for (i = 0; i < boxn; i++) add_box(P, (ST_boxf)Z.z().boxes.plus(i).getStruct()); + for (i = hend.getInt("boxn") - 1; i >= 0; i--) add_box(P, (ST_boxf)hend.getArrayOfStruct("boxes").plus(i).getStruct()); if (et == (5 << 1)) ps = routesplines(P, pn); else ps = routepolylines(P, pn); if (pn[0] == 0) return; @@ -2243,15 +2245,15 @@ public static void make_flat_edge(Agraph_s g, spline_info_t sp, path P, __ptr__ ENTERING("6yr3jfkljl5w0z6dv354ryx63","make_flat_edge"); try { Agnode_s tn, hn; - final __struct__ fwdedgei = __struct__.from(Agedgeinfo_t.class); - final __struct__ fwdedge = __struct__.from(Agedgepair_s.class); + final __struct__ fwdedgei = JUtils.from(Agedgeinfo_t.class); + final __struct__ fwdedge = JUtils.from(Agedgepair_s.class); Agedge_s e; int j, i, r, isAdjacent; double stepx, stepy, vspace; int tside, hside; int pn[] = new int[] {0}; pointf ps; - final __struct__ tend = __struct__.from(pathend_t.class), hend = __struct__.from(pathend_t.class); + final __struct__ tend = JUtils.from(pathend_t.class), hend = JUtils.from(pathend_t.class); fwdedge.getStruct("out").getStruct("base").setPtr("data", fwdedgei.amp()); /* Get sample edge; normalize to go from left to right */ e = (Agedge_s) edges.plus(ind).getPtr(); @@ -2309,29 +2311,29 @@ try { makeFlatEnd (g, sp, P, hn, e, hend.amp(), false); for (i = 0; i < cnt; i++) { int boxn; - final __struct__ b = __struct__.from(boxf.class); + final ST_boxf b = new ST_boxf(); e = (Agedge_s) edges.plus(ind + i).getPtr(); boxn = 0; - b.____(tend.getArrayOfStruct("boxes").plus(tend.getInt("boxn") - 1).getStruct()); - Z.z().boxes.plus(boxn).getStruct().getStruct("LL").setDouble("x", b.getStruct("LL").getDouble("x")); - Z.z().boxes.plus(boxn).getStruct().getStruct("LL").setDouble("y", b.getStruct("UR").getDouble("y")); - Z.z().boxes.plus(boxn).getStruct().getStruct("UR").setDouble("x", b.getStruct("UR").getDouble("x") + (i + 1) * stepx); - Z.z().boxes.plus(boxn).getStruct().getStruct("UR").setDouble("y", b.getStruct("UR").getDouble("y") + (i + 1) * stepy); + b.___(tend.getArrayOfStruct("boxes").plus(tend.getInt("boxn") - 1).getStruct()); + ((ST_boxf)Z.z().boxes.plus(boxn).getStruct()).LL.x = b.LL.x; + ((ST_boxf)Z.z().boxes.plus(boxn).getStruct()).LL.y = b.UR.y; + ((ST_boxf)Z.z().boxes.plus(boxn).getStruct()).UR.x = b.UR.x + (i + 1) * stepx; + ((ST_boxf)Z.z().boxes.plus(boxn).getStruct()).UR.y = b.UR.y + (i + 1) * stepy; boxn++; - Z.z().boxes.plus(boxn).getStruct().getStruct("LL").setDouble("x", tend.getArrayOfStruct("boxes").plus(tend.getInt("boxn") - 1).getStruct().getStruct("LL").getDouble("x")); - Z.z().boxes.plus(boxn).getStruct().getStruct("LL").setDouble("y", Z.z().boxes.plus(boxn-1).getStruct().getStruct("UR").getDouble("y")); - Z.z().boxes.plus(boxn).getStruct().getStruct("UR").setDouble("x", hend.getArrayOfStruct("boxes").plus(hend.getInt("boxn") - 1).getStruct().getStruct("UR").getDouble("x")); - Z.z().boxes.plus(boxn).getStruct().getStruct("UR").setDouble("y", Z.z().boxes.plus(boxn).getStruct().getStruct("LL").getDouble("y") + stepy); + ((ST_boxf)Z.z().boxes.plus(boxn).getStruct()).LL.x = ((ST_boxf)(tend.getArrayOfStruct("boxes").plus(tend.getInt("boxn") - 1).getStruct())).LL.x; + ((ST_boxf)Z.z().boxes.plus(boxn).getStruct()).LL.y = ((ST_boxf)Z.z().boxes.plus(boxn-1).getStruct()).UR.y; + ((ST_boxf)Z.z().boxes.plus(boxn).getStruct()).UR.x = ((ST_boxf)(hend.getArrayOfStruct("boxes").plus(hend.getInt("boxn") - 1).getStruct())).UR.x; + ((ST_boxf)Z.z().boxes.plus(boxn).getStruct()).UR.y = ((ST_boxf)Z.z().boxes.plus(boxn).getStruct()).LL.y + stepy; boxn++; - b.____(hend.getArrayOfStruct("boxes").plus(hend.getInt("boxn") - 1).getStruct()); - Z.z().boxes.plus(boxn).getStruct().getStruct("UR").setDouble("x", b.getStruct("UR").getDouble("x")); - Z.z().boxes.plus(boxn).getStruct().getStruct("LL").setDouble("y", b.getStruct("UR").getDouble("y")); - Z.z().boxes.plus(boxn).getStruct().getStruct("LL").setDouble("x", b.getStruct("LL").getDouble("x") - (i + 1) * stepx); - Z.z().boxes.plus(boxn).getStruct().getStruct("UR").setDouble("y", Z.z().boxes.plus(boxn-1).getStruct().getStruct("LL").getDouble("y")); + b.___(hend.getArrayOfStruct("boxes").plus(hend.getInt("boxn") - 1).getStruct()); + ((ST_boxf)Z.z().boxes.plus(boxn).getStruct()).UR.x = b.UR.x; + ((ST_boxf)Z.z().boxes.plus(boxn).getStruct()).LL.y = b.UR.y; + ((ST_boxf)Z.z().boxes.plus(boxn).getStruct()).LL.x = b.LL.x - (i + 1) * stepx; + ((ST_boxf)Z.z().boxes.plus(boxn).getStruct()).UR.y = ((ST_boxf)Z.z().boxes.plus(boxn-1).getStruct()).LL.y; boxn++; - for (j = 0; j < tend.getInt("boxn"); j++) add_box(P, tend.getArrayOfStruct("boxes").plus(j).getStruct()); - for (j = 0; j < boxn; j++) add_box(P, Z.z().boxes.plus(j).getStruct()); - for (j = hend.getInt("boxn") - 1; j >= 0; j--) add_box(P, hend.getArrayOfStruct("boxes").plus(j).getStruct()); + for (j = 0; j < tend.getInt("boxn"); j++) add_box(P, (ST_boxf)tend.getArrayOfStruct("boxes").plus(j).getStruct()); + for (j = 0; j < boxn; j++) add_box(P, (ST_boxf)Z.z().boxes.plus(j).getStruct()); + for (j = hend.getInt("boxn") - 1; j >= 0; j--) add_box(P, (ST_boxf)hend.getArrayOfStruct("boxes").plus(j).getStruct()); if (et == (5 << 1)) ps = (pointf) routesplines(P, pn); else ps = (pointf) routepolylines(P, pn); if (pn[0] == 0) @@ -2448,12 +2450,12 @@ public static void make_regular_edge(Agraph_s g, spline_info_t sp, path P, __ptr ENTERING("30wfq1dby4t07hft9io52nq6z","make_regular_edge"); try { Agnode_s tn, hn = null; - final __struct__ fwdedgeai = __struct__.from(Agedgeinfo_t.class), fwdedgebi = __struct__.from(Agedgeinfo_t.class), fwdedgei = __struct__.from(Agedgeinfo_t.class); - final __struct__ fwdedgea = __struct__.from(Agedgepair_s.class), fwdedgeb = __struct__.from(Agedgepair_s.class), fwdedge = __struct__.from(Agedgepair_s.class); + final __struct__ fwdedgeai = JUtils.from(Agedgeinfo_t.class), fwdedgebi = JUtils.from(Agedgeinfo_t.class), fwdedgei = JUtils.from(Agedgeinfo_t.class); + final __struct__ fwdedgea = JUtils.from(Agedgepair_s.class), fwdedgeb = JUtils.from(Agedgepair_s.class), fwdedge = JUtils.from(Agedgepair_s.class); Agedge_s e, fe, le, segfirst; pointf ps = null; - final __struct__ tend = __struct__.from(pathend_t.class), hend = __struct__.from(pathend_t.class); - final __struct__ b = __struct__.from(boxf.class); + final __struct__ tend = JUtils.from(pathend_t.class), hend = JUtils.from(pathend_t.class); + final ST_boxf b = new ST_boxf(); int boxn, sl, si, i, j, dx, hackflag, longedge; boolean smode; int pn[] = new int[] {0}; @@ -2511,16 +2513,16 @@ UNSUPPORTED("bxkpl0bp0qhtxaj6rspd19d1k"); // hackflag = NOT(0); segfirst = e; tn = agtail(e); hn = aghead(e); - b.____(maximal_bbox(g, sp, tn, null, e)); - tend.getStruct("nb").____(b); + b.___(maximal_bbox(g, sp, tn, null, e)); + tend.getStruct("nb").___(b); beginpath(P, e, 1, tend.amp(), spline_merge(tn)); - b.getStruct("UR").setDouble("y", - tend.getArrayOfStruct("boxes").plus(tend.getInt("boxn") - 1).getStruct().getStruct("UR").getDouble("y")); - b.getStruct("LL").setDouble("y", - tend.getArrayOfStruct("boxes").plus(tend.getInt("boxn") - 1).getStruct().getStruct("LL").getDouble("y")); - b.____(makeregularend(b, (1<<0), + b.UR.y = + ((ST_boxf)tend.getArrayOfStruct("boxes").plus(tend.getInt("boxn") - 1).getStruct()).UR.y; + b.LL.y = + ((ST_boxf)tend.getArrayOfStruct("boxes").plus(tend.getInt("boxn") - 1).getStruct()).LL.y; + b.___(makeregularend(b, (1<<0), ND_coord(tn).getDouble("y") - GD_rank(g).plus(ND_rank(tn)).getDouble("ht1"))); - if (b.getStruct("LL").getDouble("x") < b.getStruct("UR").getDouble("x") && b.getStruct("LL").getDouble("y") < b.getStruct("UR").getDouble("y")) + if (b.LL.x < b.UR.x && b.LL.y < b.UR.y) { tend.getArrayOfStruct("boxes").plus(tend.getInt("boxn")).setStruct(b); tend.setInt("boxn", tend.getInt("boxn") + 1); @@ -2538,17 +2540,17 @@ UNSUPPORTED("bxkpl0bp0qhtxaj6rspd19d1k"); // hackflag = NOT(0); } if (N(smode) || si > 0) { si--; - Z.z().boxes.plus(boxn++).setStruct( maximal_bbox(g, sp, hn, e, (Agedge_s) ND_out(hn).getArrayOfPtr("list").plus(0).getPtr())); - e = (Agedge_s) ND_out(hn).getArrayOfPtr("list").plus(0).getPtr(); + Z.z().boxes.plus(boxn++).setStruct( maximal_bbox(g, sp, hn, e, (Agedge_s) ND_out(hn).getFromList(0))); + e = (Agedge_s) ND_out(hn).getFromList(0); tn = agtail(e); hn = aghead(e); continue; } - hend.setStruct("nb", maximal_bbox(g, sp, hn, e, (Agedge_s) ND_out(hn).getArrayOfPtr("list").plus(0).getPtr())); + hend.setStruct("nb", maximal_bbox(g, sp, hn, e, (Agedge_s) ND_out(hn).getFromList(0))); endpath(P, e, 1, hend.amp(), spline_merge(aghead(e))); - b.____(makeregularend(hend.getArrayOfStruct("boxes").plus(hend.getInt("boxn") - 1).getStruct(), (1<<2), + b.___(makeregularend((ST_boxf) hend.getArrayOfStruct("boxes").plus(hend.getInt("boxn") - 1).getStruct(), (1<<2), ND_coord(hn).getDouble("y") + GD_rank(g).plus(ND_rank(hn)).getDouble("ht2"))); - if (b.getStruct("LL").getDouble("x") < b.getStruct("UR").getDouble("x") && b.getStruct("LL").getDouble("y") < b.getStruct("UR").getDouble("y")) + if (b.LL.x < b.UR.x && b.LL.y < b.UR.y) UNSUPPORTED("1crhubfzekx1qi2ti9ajqsfoc"); // hend.boxes[hend.boxn++] = b; P.getStruct("end").setDouble("theta", M_PI / 2); P.getStruct("end").setBoolean("constrained", NOT(false)); @@ -2574,31 +2576,31 @@ UNSUPPORTED("8kbxhk7qirj3tr7hn1ukwar3h"); // pointfs = RALLOC(numpts, pointfs, for (i = 0; i < pn[0]; i++) { Z.z().pointfs.plus(pointn[0]++).setStruct(ps.plus(i).getStruct()); } - e = straight_path((Agedge_s)ND_out(hn).getArrayOfPtr("list").plus(0).getPtr(), sl, Z.z().pointfs, pointn); + e = straight_path((Agedge_s)ND_out(hn).getFromList(0), sl, Z.z().pointfs, pointn); recover_slack(segfirst, P); segfirst = e; tn = agtail(e); hn = aghead(e); boxn = 0; - tend.setStruct("nb", maximal_bbox(g, sp, tn, (Agedge_s) ND_in(tn).getArrayOfPtr("list").plus(0).getPtr(), e)); + tend.setStruct("nb", maximal_bbox(g, sp, tn, (Agedge_s) ND_in(tn).getFromList(0), e)); beginpath(P, e, 1, tend.amp(), spline_merge(tn)); - b.____(makeregularend(tend.getArrayOfStruct("boxes").plus(tend.getInt("boxn") - 1).getStruct(), (1<<0), + b.___(makeregularend((ST_boxf) tend.getArrayOfStruct("boxes").plus(tend.getInt("boxn") - 1).getStruct(), (1<<0), ND_coord(tn).getDouble("y") - GD_rank(g).plus(ND_rank(tn)).getDouble("ht1"))); - if (b.getStruct("LL").getDouble("x") < b.getStruct("UR").getDouble("x") && b.getStruct("LL").getDouble("y") < b.getStruct("UR").getDouble("y")) + if (b.LL.x < b.UR.x && b.LL.y < b.UR.y) UNSUPPORTED("cjx6tldge3otk1pk6ks1pkn2w"); // tend.boxes[tend.boxn++] = b; P.getStruct("start").setDouble("theta", -M_PI / 2); P.getStruct("start").setBoolean("constrained", NOT(false)); smode = false; } Z.z().boxes.plus(boxn++).setStruct(rank_box(sp, g, ND_rank(tn))); - b.____(maximal_bbox(g, sp, hn, e, null)); - hend.getStruct("nb").____(b); + b.___(maximal_bbox(g, sp, hn, e, null)); + hend.getStruct("nb").___(b); endpath(P, hackflag!=0 ? fwdedgeb.getStruct("out").amp() : e, 1, hend.amp(), spline_merge(aghead(e))); - b.getStruct("UR").setDouble("y", hend.getArrayOfStruct("boxes").plus(hend.getInt("boxn") - 1).getStruct().getStruct("UR").getDouble("y")); - b.getStruct("LL").setDouble("y", hend.getArrayOfStruct("boxes").plus(hend.getInt("boxn") - 1).getStruct().getStruct("LL").getDouble("y")); - b.____(makeregularend(b, (1<<2), + b.UR.y = ((ST_boxf)hend.getArrayOfStruct("boxes").plus(hend.getInt("boxn") - 1).getStruct()).UR.y; + b.LL.y = ((ST_boxf)hend.getArrayOfStruct("boxes").plus(hend.getInt("boxn") - 1).getStruct()).LL.y; + b.___(makeregularend(b, (1<<2), ND_coord(hn).getDouble("y") + GD_rank(g).plus(ND_rank(hn)).getDouble("ht2"))); - if (b.getStruct("LL").getDouble("x") < b.getStruct("UR").getDouble("x") && b.getStruct("LL").getDouble("y") < b.getStruct("UR").getDouble("y")) + if (b.LL.x < b.UR.x && b.LL.y < b.UR.y) { hend.getArrayOfStruct("boxes").plus(hend.getInt("boxn")).setStruct(b); hend.setInt("boxn", hend.getInt("boxn")+1); @@ -2702,13 +2704,13 @@ try { pn = spl.getArrayOfPtr("list").plus(spl.getInt("size") - 1).getPtr().getInt("size"); } for (i = 0; i < tendp.getInt("boxn"); i++) - add_box(P, tendp.getArrayOfStruct("boxes").plus(i).getStruct()); + add_box(P, (ST_boxf)tendp.getArrayOfStruct("boxes").plus(i).getStruct()); fb = P.getInt("nbox") + 1; lb = fb + boxn - 3; for (i = 0; i < boxn; i++) - add_box(P, boxes.plus(i).getStruct()); + add_box(P, (ST_boxf)boxes.plus(i).getStruct()); for (i = hendp.getInt("boxn") - 1; i >= 0; i--) - add_box(P, hendp.getArrayOfStruct("boxes").plus(i).getStruct()); + add_box(P, (ST_boxf)hendp.getArrayOfStruct("boxes").plus(i).getStruct()); adjustregularpath(P, fb, lb); } finally { LEAVING("va61hggynvb6z6j34w7otmab","completeregularpath"); @@ -2720,20 +2722,20 @@ LEAVING("va61hggynvb6z6j34w7otmab","completeregularpath"); //3 3wwhczhpkcnflwr1l9wcga7tq // static boxf makeregularend(boxf b, int side, double y) -public static __struct__ makeregularend(final __struct__ b, int side, double y) { +public static __struct__ makeregularend(final ST_boxf b, int side, double y) { // WARNING!! STRUCT return makeregularend_w_(b.copy(), side, y).copy(); } -private static __struct__ makeregularend_w_(final __struct__ b, int side, double y) { +private static __struct__ makeregularend_w_(final ST_boxf b, int side, double y) { ENTERING("3wwhczhpkcnflwr1l9wcga7tq","makeregularend"); try { - final __struct__ newb = __struct__.from(boxf.class); + final __struct__ newb = JUtils.from(boxf.class); switch (side) { case (1<<0): - newb.____(boxfof(b.getStruct("LL").getDouble("x"), y, b.getStruct("UR").getDouble("x"), b.getStruct("LL").getDouble("y"))); + newb.___(boxfof(b.LL.x, y, b.UR.x, b.LL.y)); break; case (1<<2): - newb.____(boxfof(b.getStruct("LL").getDouble("x"), b.getStruct("UR").getDouble("y"), b.getStruct("UR").getDouble("x"), y)); + newb.___(boxfof(b.LL.x, b.UR.y, b.UR.x, y)); break; } return newb; @@ -2793,25 +2795,25 @@ LEAVING("88xrlzjovkxcnay9b2y5zyiid","adjustregularpath"); //3 bajn5vx0isu427n6dh131b985 // static boxf rank_box(spline_info_t* sp, graph_t * g, int r) -public static __struct__ rank_box(spline_info_t sp, Agraph_s g, int r) { +public static ST_boxf rank_box(spline_info_t sp, Agraph_s g, int r) { // WARNING!! STRUCT return rank_box_w_(sp, g, r).copy(); } -private static __struct__ rank_box_w_(spline_info_t sp, Agraph_s g, int r) { +private static ST_boxf rank_box_w_(spline_info_t sp, Agraph_s g, int r) { ENTERING("bajn5vx0isu427n6dh131b985","rank_box"); try { - final __struct__ b = __struct__.from(boxf.class); + final ST_boxf b = new ST_boxf(); Agnode_s /* *right0, *right1, */ left0, left1; - b.____(sp.getPtr("Rank_box").plus(r).getStruct()); - if (b.getStruct("LL").getDouble("x") == b.getStruct("UR").getDouble("x")) { + b.___(sp.getPtr("Rank_box").plus(r).getStruct()); + if (b.LL.x == b.UR.x) { left0 = (Agnode_s) GD_rank(g).plus(r).getArrayOfPtr("v").plus(0).getPtr(); /* right0 = GD_rank(g)[r].v[GD_rank(g)[r].n - 1]; */ left1 = (Agnode_s) GD_rank(g).plus(r + 1).getArrayOfPtr("v").plus(0).getPtr(); /* right1 = GD_rank(g)[r + 1].v[GD_rank(g)[r + 1].n - 1]; */ - b.getStruct("LL").setDouble("x", sp.getInt("LeftBound")); - b.getStruct("LL").setDouble("y", ND_coord(left1).getDouble("y") + GD_rank(g).plus(r + 1).getDouble("ht2")); - b.getStruct("UR").setDouble("x", sp.getInt("RightBound")); - b.getStruct("UR").setDouble("y", ND_coord(left0).getDouble("y") - GD_rank(g).plus(r).getDouble("ht1")); + b.LL.x = sp.getInt("LeftBound"); + b.LL.y = ND_coord(left1).getDouble("y") + GD_rank(g).plus(r + 1).getDouble("ht2"); + b.UR.x = sp.getInt("RightBound"); + b.UR.y = ND_coord(left0).getDouble("y") - GD_rank(g).plus(r).getDouble("ht1"); sp.getPtr("Rank_box").plus(r).setStruct(b); } return b; @@ -2832,10 +2834,10 @@ try { Agnode_s v; v = n; while (true) { - v = (Agnode_s) aghead(ND_out(v).getArrayOfPtr("list").plus(0).getPtr()); + v = (Agnode_s) aghead(ND_out(v).getFromList(0)); if (ND_node_type(v) != 1) break; - if ((ND_out(v).getInt("size") != 1) || (ND_in(v).getInt("size") != 1)) + if ((ND_out(v).size != 1) || (ND_in(v).size != 1)) break; if (ND_coord(v).getDouble("x") != ND_coord(n).getDouble("x")) break; @@ -2858,7 +2860,7 @@ try { int n = np[0]; Agedge_s f = e; while ((cnt--)!=0) - f = (Agedge_s) ND_out(aghead(f)).getArrayOfPtr("list").plus(0).getPtr(); + f = (Agedge_s) ND_out(aghead(f)).getFromList(0); plist.plus(np[0]++).setStruct(plist.plus(n - 1).getStruct()); plist.plus(np[0]++).setStruct(plist.plus(n - 1).getStruct()); plist.plus(np[0]).setStruct(ND_coord(agtail(f))); /* will be overwritten by next spline */ @@ -2881,7 +2883,7 @@ try { b = 0; /* skip first rank box */ for (vn = aghead(e); ND_node_type(vn) == 1 && N(((Boolean)Z.z().sinfo.call("splineMerge", vn)).booleanValue()); - vn = aghead(ND_out(vn).getArrayOfPtr("list").plus(0).getPtr())) { + vn = aghead(ND_out(vn).getFromList(0))) { while ((b < p.getInt("nbox")) && (p.getPtr("boxes").plus(b).getStruct("LL").getDouble("y") > ND_coord(vn).getDouble("y"))) b++; if (b >= p.getInt("nbox")) @@ -2927,7 +2929,7 @@ ENTERING("9t0v5wicmjuc3ij9hko6iawle","top_bound"); try { Agedge_s f, ans = null; int i; - for (i = 0; (f = (Agedge_s) ND_out(agtail(e)).getArrayOfPtr("list").plus(i).getPtr())!=null; i++) { + for (i = 0; (f = (Agedge_s) ND_out(agtail(e)).getFromList(i))!=null; i++) { if (side * (ND_order(aghead(f)) - ND_order(aghead(e))) <= 0) continue; if ((ED_spl(f) == null) @@ -2953,7 +2955,7 @@ ENTERING("9fsg0uiyhtrayd4mimmc0i25e","bot_bound"); try { Agedge_s f, ans = null; int i; - for (i = 0; (f = (Agedge_s) ND_in(aghead(e)).getArrayOfPtr("list").plus(i).getPtr())!=null; i++) { + for (i = 0; (f = (Agedge_s) ND_in(aghead(e)).getFromList(i))!=null; i++) { if (side * (ND_order(agtail(f)) - ND_order(agtail(e))) <= 0) continue; if ((ED_spl(f) == null) @@ -2977,8 +2979,8 @@ LEAVING("9fsg0uiyhtrayd4mimmc0i25e","bot_bound"); public static boolean cl_vninside(Agraph_s cl, Agnode_s n) { ENTERING("65uvkv1mextaah5m997ibe3qs","cl_vninside"); try { - return (BETWEEN(GD_bb(cl).getStruct("LL").getDouble("x"), (double)(ND_coord(n).getDouble("x")), GD_bb(cl).getStruct("UR").getDouble("x")) && - BETWEEN(GD_bb(cl).getStruct("LL").getDouble("y"), (double)(ND_coord(n).getDouble("y")), GD_bb(cl).getStruct("UR").getDouble("y"))); + return (BETWEEN(GD_bb(cl).LL.x, (double)(ND_coord(n).getDouble("x")), GD_bb(cl).UR.x) && + BETWEEN(GD_bb(cl).LL.y, (double)(ND_coord(n).getDouble("y")), GD_bb(cl).UR.y)); } finally { LEAVING("65uvkv1mextaah5m997ibe3qs","cl_vninside"); } @@ -2998,7 +3000,7 @@ try { if (ND_node_type(n) == 0) tcl = hcl = ND_clust(n); else { - orig = ED_to_orig(ND_out(n).getArrayOfPtr("list").plus(0).getPtr()); + orig = ED_to_orig(ND_out(n).getFromList(0)); tcl = ND_clust(agtail(orig)); hcl = ND_clust(aghead(orig)); } @@ -3007,7 +3009,7 @@ try { if (cl!=null && NEQ(cl, tcl) && NEQ(cl, hcl)) rv = cl; } else { - orig = ED_to_orig(ND_out(adj).getArrayOfPtr("list").plus(0).getPtr()); + orig = ED_to_orig(ND_out(adj).getFromList(0)); cl = ( EQ(ND_clust(agtail(orig)), g) ? null:ND_clust(agtail(orig))); if (cl!=null && NEQ(cl, tcl) && NEQ(cl, hcl) && cl_vninside(cl, adj)) rv = cl; @@ -3038,13 +3040,13 @@ try { double b, nb; Agraph_s left_cl, right_cl; Agnode_s left, right; - final __struct__ rv = __struct__.from(boxf.class); + final ST_boxf rv = new ST_boxf(); left_cl = right_cl = null; /* give this node all the available space up to its neighbors */ b = (double)(ND_coord(vn).getDouble("x") - ND_lw(vn) - 4); if ((left = neighbor(g, vn, ie, oe, -1))!=null) { if ((left_cl = cl_bound(g, vn, left))!=null) - nb = GD_bb(left_cl).getStruct("UR").getDouble("x") + (double)(sp.getInt("Splinesep")); + nb = GD_bb(left_cl).UR.x + (double)(sp.getInt("Splinesep")); else { nb = (double)(ND_coord(left).getDouble("x") + ND_mval(left)); if (ND_node_type(left) == 0) @@ -3054,9 +3056,9 @@ try { } if (nb < b) b = nb; - rv.getStruct("LL").setDouble("x", ROUND(b)); + rv.LL.x = ROUND(b); } else - rv.getStruct("LL").setDouble("x", MIN(ROUND(b), sp.getInt("LeftBound"))); + rv.LL.x = MIN(ROUND(b), sp.getInt("LeftBound")); /* we have to leave room for our own label! */ if ((ND_node_type(vn) == 1) && (ND_label(vn)!=null)) b = (double)(ND_coord(vn).getDouble("x") + 10); @@ -3064,7 +3066,7 @@ try { b = (double)(ND_coord(vn).getDouble("x") + ND_rw(vn) + 4); if ((right = neighbor(g, vn, ie, oe, 1))!=null) { if ((right_cl = cl_bound(g, vn, right))!=null) - nb = GD_bb(right_cl).getStruct("LL").getDouble("x") - (double)(sp.getInt("Splinesep")); + nb = GD_bb(right_cl).LL.x - (double)(sp.getInt("Splinesep")); else { nb = ND_coord(right).getDouble("x") - ND_lw(right); if (ND_node_type(right) == 0) @@ -3074,15 +3076,15 @@ try { } if (nb > b) b = nb; - rv.getStruct("UR").setDouble("x", ROUND(b)); + rv.UR.x = ROUND(b); } else - rv.getStruct("UR").setDouble("x", MAX(ROUND(b), sp.getInt("RightBound"))); + rv.UR.x = MAX(ROUND(b), sp.getInt("RightBound")); if ((ND_node_type(vn) == 1) && (ND_label(vn)!=null)) { - rv.getStruct("UR").setDouble("x", rv.getStruct("UR").getDouble("x") - ND_rw(vn)); - if (rv.getStruct("UR").getDouble("x") < rv.getStruct("LL").getDouble("x")) rv.getStruct("UR").setDouble("x", ND_coord(vn).getDouble("x")); + rv.UR.x = rv.UR.x - ND_rw(vn); + if (rv.UR.x < rv.LL.x) rv.UR.x = ND_coord(vn).getDouble("x"); } - rv.getStruct("LL").setDouble("y", ND_coord(vn).getDouble("y") - GD_rank(g).plus(ND_rank(vn)).getDouble("ht1")); - rv.getStruct("UR").setDouble("y", ND_coord(vn).getDouble("y") + GD_rank(g).plus(ND_rank(vn)).getDouble("ht2")); + rv.LL.y = ND_coord(vn).getDouble("y") - GD_rank(g).plus(ND_rank(vn)).getDouble("ht1"); + rv.UR.y = ND_coord(vn).getDouble("y") + GD_rank(g).plus(ND_rank(vn)).getDouble("ht2"); return rv; } finally { LEAVING("6qwgl36ugfnduc5x59ohuewv1","maximal_bbox"); @@ -3134,38 +3136,38 @@ try { boolean order; int cnt; order = (ND_order(n0) > ND_order(n1)); - if ((ND_out(n0).getInt("size") != 1) && (ND_out(n0).getInt("size") != 1)) + if ((ND_out(n0).size != 1) && (ND_out(n0).size != 1)) return false; e1 = oe1; - if (ND_out(n0).getInt("size") == 1 && e1!=null) { - e0 = (Agedge_s) ND_out(n0).getArrayOfPtr("list").plus(0).getPtr(); + if (ND_out(n0).size == 1 && e1!=null) { + e0 = (Agedge_s) ND_out(n0).getFromList(0); for (cnt = 0; cnt < 2; cnt++) { if (EQ(na = aghead(e0), nb = aghead(e1))) break; if (order != (ND_order(na) > ND_order(nb))) return NOT(false); - if ((ND_out(na).getInt("size") != 1) || (ND_node_type(na) == 0)) + if ((ND_out(na).size != 1) || (ND_node_type(na) == 0)) break; - e0 = (Agedge_s) ND_out(na).getArrayOfPtr("list").plus(0).getPtr(); - if ((ND_out(nb).getInt("size") != 1) || (ND_node_type(nb) == 0)) + e0 = (Agedge_s) ND_out(na).getFromList(0); + if ((ND_out(nb).size != 1) || (ND_node_type(nb) == 0)) break; - e1 = (Agedge_s) ND_out(nb).getArrayOfPtr("list").plus(0).getPtr(); + e1 = (Agedge_s) ND_out(nb).getFromList(0); } } e1 = ie1; - if (ND_in(n0).getInt("size") == 1 && e1!=null) { - e0 = (Agedge_s) ND_in(n0).getArrayOfPtr("list").plus(0).getPtr(); + if (ND_in(n0).size == 1 && e1!=null) { + e0 = (Agedge_s) ND_in(n0).getFromList(0); for (cnt = 0; cnt < 2; cnt++) { if (EQ(na = agtail(e0), nb = agtail(e1))) break; if (order != (ND_order(na) > ND_order(nb))) return NOT(false); - if ((ND_in(na).getInt("size") != 1) || (ND_node_type(na) == 0)) + if ((ND_in(na).size != 1) || (ND_node_type(na) == 0)) break; - e0 = (Agedge_s) ND_in(na).getArrayOfPtr("list").plus(0).getPtr(); - if ((ND_in(nb).getInt("size") != 1) || (ND_node_type(nb) == 0)) + e0 = (Agedge_s) ND_in(na).getFromList(0); + if ((ND_in(nb).size != 1) || (ND_node_type(nb) == 0)) break; - e1 = (Agedge_s) ND_in(nb).getArrayOfPtr("list").plus(0).getPtr(); + e1 = (Agedge_s) ND_in(nb).getFromList(0); } } return false; diff --git a/src/gen/lib/dotgen/fastgr__c.java b/src/gen/lib/dotgen/fastgr__c.java index 4316fc430..6f9e9fe92 100644 --- a/src/gen/lib/dotgen/fastgr__c.java +++ b/src/gen/lib/dotgen/fastgr__c.java @@ -95,9 +95,11 @@ import h.Agnode_s; import h.Agnodeinfo_t; import h.Agraph_s; import h.Agrec_s; +import h.ST_elist; import h.boxf; import h.elist; import h.pointf; +import smetana.core.JUtils; import smetana.core.__struct__; public class fastgr__c { @@ -365,7 +367,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -403,7 +405,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -443,7 +445,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; @@ -742,22 +744,22 @@ throw new UnsupportedOperationException(); //3 econbrl314rr46qnvvw5e32j7 // static edge_t *ffe(node_t * u, elist uL, node_t * v, elist vL) -public static Agedge_s ffe(Agnode_s u, final __struct__ uL, Agnode_s v, final __struct__ vL) { +public static Agedge_s ffe(Agnode_s u, final ST_elist uL, Agnode_s v, final ST_elist vL) { // WARNING!! STRUCT return ffe_w_(u, uL.copy(), v, vL.copy()); } -private static Agedge_s ffe_w_(Agnode_s u, final __struct__ uL, Agnode_s v, final __struct__ vL) { +private static Agedge_s ffe_w_(Agnode_s u, final ST_elist uL, Agnode_s v, final ST_elist vL) { ENTERING("econbrl314rr46qnvvw5e32j7","ffe"); try { int i; Agedge_s e = null; - if ((uL.getInt("size") > 0) && (vL.getInt("size") > 0)) { - if (uL.getInt("size") < vL.getInt("size")) { - for (i = 0; (e = (Agedge_s) uL.getArrayOfPtr("list").plus(i).getPtr())!=null; i++) + if ((uL.size > 0) && (vL.size > 0)) { + if (uL.size < vL.size) { + for (i = 0; (e = (Agedge_s) uL.getFromList(i))!=null; i++) if (EQ(aghead(e), v)) break; } else { - for (i = 0; (e = (Agedge_s) vL.getArrayOfPtr("list").plus(i).getPtr())!=null; i++) + for (i = 0; (e = (Agedge_s) vL.getFromList(i))!=null; i++) if (EQ(agtail(e), u)) break; } diff --git a/src/gen/lib/dotgen/flat__c.java b/src/gen/lib/dotgen/flat__c.java index e48a949ff..a3e79f3bd 100644 --- a/src/gen/lib/dotgen/flat__c.java +++ b/src/gen/lib/dotgen/flat__c.java @@ -96,6 +96,7 @@ import h.Agraph_s; import h.boxf; import h.pointf; import h.rank_t; +import smetana.core.JUtils; import smetana.core.__ptr__; import smetana.core.__struct__; @@ -364,7 +365,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -402,7 +403,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -442,7 +443,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; @@ -801,9 +802,9 @@ try { Agedge_s f; if (ND_node_type(v) == 1) { ord = ND_order(v); - if (ND_in(v).getInt("size") == 0) { /* flat */ - assert(ND_out(v).getInt("size") == 2); - findlr((Agnode_s) aghead(ND_out(v).getArrayOfPtr("list").plus(0).getPtr()), (Agnode_s) aghead(ND_out(v).getArrayOfPtr("list").plus(1).getPtr()), l, + if (ND_in(v).size == 0) { /* flat */ + assert(ND_out(v).size == 2); + findlr((Agnode_s) aghead(ND_out(v).getFromList(0)), (Agnode_s) aghead(ND_out(v).getFromList(1)), l, r); /* the other flat edge could be to the left or right */ if (r[0] <= lpos[0]) @@ -822,7 +823,7 @@ try { } else { /* forward */ boolean onleft, onright; onleft = onright = false; - for (i = 0; (f = (Agedge_s) ND_out(v).getArrayOfPtr("list").plus(i).getPtr())!=null; i++) { + for (i = 0; (f = (Agedge_s) ND_out(v).getFromList(i))!=null; i++) { if (ND_order(aghead(f)) <= lpos[0]) { onleft = NOT(false); continue; @@ -893,7 +894,7 @@ try { Agraph_s g; Agnode_s n, vn; Agedge_s ve; - final __struct__ dimen = __struct__.from(pointf.class); + final __struct__ dimen = JUtils.from(pointf.class); if (ED_label(e) == null) return; g = dot_root(agtail(e)); @@ -907,7 +908,7 @@ try { ypos = (int)(ND_coord(n).getDouble("y") + GD_rank(g).plus(r).getDouble("ht2") + GD_ranksep(g)); } vn = make_vn_slot(g, r - 1, place); - dimen.____(ED_label(e).getStruct("dimen")); + dimen.___(ED_label(e).getStruct("dimen")); if (GD_flip(g)!=0) { double f = dimen.getDouble("x"); dimen.setDouble("x", dimen.getDouble("y")); @@ -1022,20 +1023,20 @@ try { Agedge_s e; int found = 0; for (n = GD_nlist(g); n!=null; n = ND_next(n)) { - if (ND_flat_out(n).getPtr("list")!=null) { - for (j = 0; (e = (Agedge_s) ND_flat_out(n).getArrayOfPtr("list").plus(j).getPtr())!=null; j++) { + if (ND_flat_out(n).listNotNull()) { + for (j = 0; (e = (Agedge_s) ND_flat_out(n).getFromList(j))!=null; j++) { checkFlatAdjacent (e); } } - for (j = 0; j < ND_other(n).getInt("size"); j++) { - e = (Agedge_s) ND_other(n).getArrayOfPtr("list").plus(j).getPtr(); + for (j = 0; j < ND_other(n).size; j++) { + e = (Agedge_s) ND_other(n).getFromList(j); if (ND_rank(aghead(e)) == ND_rank(agtail(e))) checkFlatAdjacent (e); } } if ((GD_rank(g).plus(0).getPtr("flat")!=null) || (GD_n_cluster(g) > 0)) { for (i = 0; (n = (Agnode_s) GD_rank(g).plus(0).getArrayOfPtr("v").plus(i).getPtr())!=null; i++) { - for (j = 0; (e = (Agedge_s) ND_flat_in(n).getArrayOfPtr("list").plus(j).getPtr())!=null; j++) { + for (j = 0; (e = (Agedge_s) ND_flat_in(n).getFromList(j))!=null; j++) { if ((ED_label(e)!=null) && N(ED_adjacent(e))) { abomination(g); found = 1; @@ -1049,8 +1050,8 @@ try { rec_save_vlists(g); for (n = GD_nlist(g); n!=null; n = ND_next(n)) { /* if n is the tail of any flat edge, one will be in flat_out */ - if (ND_flat_out(n).getPtr("list")!=null) { - for (i = 0; (e = (Agedge_s) ND_flat_out(n).getArrayOfPtr("list").plus(i).getPtr())!=null; i++) { + if (ND_flat_out(n).listNotNull()) { + for (i = 0; (e = (Agedge_s) ND_flat_out(n).getFromList(i))!=null; i++) { if (ED_label(e)!=null) { if (ED_adjacent(e)!=0) { if (GD_flip(g)!=0) ED_dist(e, ED_label(e).getStruct("dimen").getDouble("y")); @@ -1063,9 +1064,9 @@ try { } } /* look for other flat edges with labels */ - for (j = 0; j < ND_other(n).getInt("size"); j++) { + for (j = 0; j < ND_other(n).size; j++) { Agedge_s le; - e = (Agedge_s) ND_other(n).getArrayOfPtr("list").plus(j).getPtr(); + e = (Agedge_s) ND_other(n).getFromList(j); if (ND_rank(agtail(e)) != ND_rank(aghead(e))) continue; if (EQ(agtail(e), aghead(e))) continue; /* skip loops */ le = e; diff --git a/src/gen/lib/dotgen/mincross__c.java b/src/gen/lib/dotgen/mincross__c.java index 5af9074cd..09aef4b24 100644 --- a/src/gen/lib/dotgen/mincross__c.java +++ b/src/gen/lib/dotgen/mincross__c.java @@ -137,6 +137,7 @@ import h.nodequeue; import h.pointf; import h.rank_t; import smetana.core.CString; +import smetana.core.JUtils; import smetana.core.Memory; import smetana.core.Z; import smetana.core.__array_of_ptr__; @@ -408,7 +409,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -446,7 +447,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -486,7 +487,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; @@ -863,7 +864,7 @@ try { int c, nc; CString s; init_mincross(g); - for (nc = c = 0; c < GD_comp(g).getInt("size"); c++) { + for (nc = c = 0; c < GD_comp(g).size; c++) { init_mccomp(g, c); nc += mincross_(g, 0, 2, doBalance); } @@ -928,7 +929,8 @@ public static void init_mccomp(Agraph_s g, int c) { ENTERING("49vw7fkn99wbojtfksugvuruh","init_mccomp"); try { int r; - GD_nlist(g, GD_comp(g).getArrayOfPtr("list").plus(c).getPtr()); + // GD_nlist(g, GD_comp(g).getFromListt(c).getPtr()); + GD_nlist(g, GD_comp(g).getFromList(c)); if (c > 0) { for (r = GD_minrank(g); r <= GD_maxrank(g); r++) { GD_rank(g).plus(r).setPtr("v", GD_rank(g).plus(r).getPtr("v").plus(GD_rank(g).plus(r).getInt("n"))); @@ -1164,10 +1166,10 @@ try { __array_of_ptr__ e1; __array_of_ptr__ e2; int inv, cross = 0, t; - for (e2 = ND_in(w).getArrayOfPtr("list"); e2.getPtr()!=null; e2=e2.plus(1)) { + for (e2 = ND_in(w).getTheArray(); e2.getPtr()!=null; e2=e2.plus(1)) { int cnt = ED_xpenalty(e2.getPtr()); inv = ND_order((agtail(e2.getPtr()))); - for (e1 = ND_in(v).getArrayOfPtr("list"); e1.getPtr()!=null; e1=e1.plus(1)) { + for (e1 = ND_in(v).getTheArray(); e1.getPtr()!=null; e1=e1.plus(1)) { t = ND_order(agtail(e1.getPtr())) - inv; if ((t > 0) || ((t == 0) @@ -1191,10 +1193,10 @@ ENTERING("b7mf74np8ewrgzwd5u0o8fqod","out_cross"); try { __array_of_ptr__ e1, e2; int inv, cross = 0, t; - for (e2 = ND_out(w).getArrayOfPtr("list"); e2.getPtr()!=null; e2=e2.plus(1)) { + for (e2 = ND_out(w).getTheArray(); e2.getPtr()!=null; e2=e2.plus(1)) { int cnt = ED_xpenalty((Agedge_s)e2.getPtr()); inv = ND_order(aghead(e2.getPtr())); - for (e1 = ND_out(v).getArrayOfPtr("list"); e1.getPtr()!=null; e1=e1.plus(1)) { + for (e1 = ND_out(v).getTheArray(); e1.getPtr()!=null; e1=e1.plus(1)) { t = ND_order(aghead(e1.getPtr())) - inv; if ((t > 0) || ((t == 0) @@ -1532,7 +1534,7 @@ ENTERING("8uyqc48j0oul206l3np85wj9p","save_best"); try { Agnode_s n; for (n = GD_nlist(g); n!=null; n = ND_next(n)) - (ND_coord(n)).setDouble("x", ND_order(n)); + (ND_coord(n)).x = ND_order(n); } finally { LEAVING("8uyqc48j0oul206l3np85wj9p","save_best"); } @@ -1548,11 +1550,11 @@ ENTERING("6d08fwi4dsk6ikk5d0gy6rq2h","merge_components"); try { int c; Agnode_s u, v; - if (GD_comp(g).getInt("size") <= 1) + if (GD_comp(g).size <= 1) return; u = null; - for (c = 0; c < GD_comp(g).getInt("size"); c++) { - v = (Agnode_s) GD_comp(g).getArrayOfPtr("list").plus(c).getPtr(); + for (c = 0; c < GD_comp(g).size; c++) { + v = (Agnode_s) GD_comp(g).getFromList(c); if (u!=null) ND_next(u, v); ND_prev(v, u); @@ -1561,8 +1563,8 @@ try { } u = v; } - GD_comp(g).setInt("size", 1); - GD_nlist(g, GD_comp(g).getArrayOfPtr("list").plus(0).getPtr()); + GD_comp(g).size = 1; + GD_nlist(g, GD_comp(g).getFromList(0)); GD_minrank(g, Z.z().GlobalMinRank); GD_maxrank(g, Z.z().GlobalMaxRank); } finally { @@ -1631,8 +1633,8 @@ try { for (i = 0; i < GD_rank(g).plus(r).getInt("n"); i++) { v = (Agnode_s) GD_rank(g).plus(r).getArrayOfPtr("v").plus(i).getPtr(); ND_order(v, i); - if (ND_flat_out(v).getPtr("list")!=null) { - for (j = 0; (e = (Agedge_s) ND_flat_out(v).getArrayOfPtr("list").plus(j).getPtr())!=null; j++) + if (ND_flat_out(v).listNotNull()) { + for (j = 0; (e = (Agedge_s) ND_flat_out(v).getFromList(j))!=null; j++) if (ED_edge_type(e) == 4) { delete_flat_edge(e); Memory.free(e.getPtr("base.data")); @@ -1697,8 +1699,8 @@ public static boolean is_a_vnode_of_an_edge_of(Agraph_s g, Agnode_s v) { ENTERING("9f8atyi1unmleplge3rijdt4s","is_a_vnode_of_an_edge_of"); try { if ((ND_node_type(v) == 1) - && (ND_in(v).getInt("size") == 1) && (ND_out(v).getInt("size") == 1)) { - Agedge_s e = (Agedge_s) ND_out(v).getArrayOfPtr("list").plus(0).getPtr(); + && (ND_in(v).size == 1) && (ND_out(v).size == 1)) { + Agedge_s e = (Agedge_s) ND_out(v).getFromList(0); while (ED_edge_type(e) != 0) e = ED_to_orig(e); if (agcontains(g, e)) @@ -1920,10 +1922,11 @@ ENTERING("6fprrp93vmz0jn3l4ro0iropp","flat_rev"); try { int j; Agedge_s rev; - if (N(ND_flat_out(aghead(e)).getArrayOfPtr("list"))) + if (ND_flat_out(aghead(e)).listNotNull()==false) + // if (N(ND_flat_out(aghead(e)).getArrayOfPtr("list"))) rev = null; else - for (j = 0; (rev = (Agedge_s) ND_flat_out(aghead(e)).getArrayOfPtr("list").plus(j).getPtr())!=null; j++) + for (j = 0; (rev = (Agedge_s) ND_flat_out(aghead(e)).getFromList(j))!=null; j++) if (EQ(aghead(rev), agtail(e))) break; if (rev!=null) { @@ -1963,8 +1966,8 @@ try { ND_mark(v, NOT(false)); ND_onstack(v, NOT(false)); hascl = (GD_n_cluster(dot_root(g)) > 0); - if (ND_flat_out(v).getArrayOfPtr("list")!=null) - for (i = 0; (e = (Agedge_s) ND_flat_out(v).getArrayOfPtr("list").plus(i).getPtr())!=null; i++) { + if (ND_flat_out(v).listNotNull()) + for (i = 0; (e = (Agedge_s) ND_flat_out(v).getFromList(i))!=null; i++) { if (hascl && NOT(agcontains(g, agtail(e)) && agcontains(g, aghead(e)))) continue; @@ -2010,7 +2013,7 @@ try { ND_mark(v, 0); ND_onstack(v, 0); ND_low(v, i); - if ((ND_flat_out(v).getInt("size") > 0) && (flat == 0)) { + if ((ND_flat_out(v).size > 0) && (flat == 0)) { GD_rank(g).plus(r).setPtr("flat", new_matrix(GD_rank(g).plus(r).getInt("n"), GD_rank(g).plus(r).getInt("n"))); flat = 1; @@ -2131,7 +2134,7 @@ try { for (i = GD_minrank(g); i <= GD_maxrank(g); i++) GD_rank(g).plus(i).setInt("n", 0); for (n = GD_nlist(g); n!=null; n = ND_next(n)) { - otheredges = ((pass == 0) ? ND_in(n).getPtr("list") : ND_out(n).getPtr("list")); + otheredges = ((pass == 0) ? ND_in(n).getTheList() : ND_out(n).getTheList()); if (otheredges.plus(0).getPtr() != null) continue; if ((ND_mark(n)) == 0) { @@ -2179,16 +2182,16 @@ try { int i; Agedge_s e; if (pass == 0) { - for (i = 0; i < ND_out(n0).getInt("size"); i++) { - e = (Agedge_s) ND_out(n0).getArrayOfPtr("list").plus(i).getPtr(); + for (i = 0; i < ND_out(n0).size; i++) { + e = (Agedge_s) ND_out(n0).getFromList(i); if (((ND_mark(aghead(e)))) == 0) { ND_mark(aghead(e), 1); enqueue(q, aghead(e)); } } } else { - for (i = 0; i < ND_in(n0).getInt("size"); i++) { - e = (Agedge_s) ND_in(n0).getArrayOfPtr("list").plus(i).getPtr(); + for (i = 0; i < ND_in(n0).size; i++) { + e = (Agedge_s) ND_in(n0).getFromList(i); if (((ND_mark(agtail(e)))) == 0) { ND_mark(agtail(e), 1); enqueue(q, agtail(e)); @@ -2228,8 +2231,8 @@ try { Agedge_s e; int i, cnt = 0; ND_mark(v, NOT(false)); - if (ND_flat_out(v).getInt("size") > 0) { - for (i = 0; (e = (Agedge_s) ND_flat_out(v).getArrayOfPtr("list").plus(i).getPtr())!=null; i++) { + if (ND_flat_out(v).size > 0) { + for (i = 0; (e = (Agedge_s) ND_flat_out(v).getFromList(i))!=null; i++) { if (N(constraining_flat_edge(g,v,e))) continue; if ((ND_mark(aghead(e))) == 0) cnt += postorder(g, aghead(e), list.plus(cnt), r); @@ -2270,12 +2273,12 @@ try { if (GD_flip(g)!=0) v = (Agnode_s) GD_rank(g).plus(r).getArrayOfPtr("v").plus(i).getPtr(); else v = (Agnode_s) GD_rank(g).plus(r).getArrayOfPtr("v").plus(GD_rank(g).plus(r).getInt("n") - i - 1).getPtr(); local_in_cnt = local_out_cnt = 0; - for (j = 0; j < ND_flat_in(v).getInt("size"); j++) { - flat_e = (Agedge_s) ND_flat_in(v).getArrayOfPtr("list").plus(j).getPtr(); + for (j = 0; j < ND_flat_in(v).size; j++) { + flat_e = (Agedge_s) ND_flat_in(v).getFromList(j); if (constraining_flat_edge(g,v,flat_e)) local_in_cnt++; } - for (j = 0; j < ND_flat_out(v).getInt("size"); j++) { - flat_e = (Agedge_s) ND_flat_out(v).getArrayOfPtr("list").plus(j).getPtr(); + for (j = 0; j < ND_flat_out(v).size; j++) { + flat_e = (Agedge_s) ND_flat_out(v).getFromList(j); if (constraining_flat_edge(g,v,flat_e)) local_out_cnt++; } if ((local_in_cnt == 0) && (local_out_cnt == 0)) @@ -2308,8 +2311,8 @@ try { /* nonconstraint flat edges must be made LR */ for (i = 0; i < GD_rank(g).plus(r).getInt("n"); i++) { v = (Agnode_s) GD_rank(g).plus(r).getArrayOfPtr("v").plus(i).getPtr(); - if (ND_flat_out(v).getArrayOfPtr("list")!=null) { - for (j = 0; (e = (Agedge_s) ND_flat_out(v).getArrayOfPtr("list").plus(j).getPtr())!=null; j++) { + if (ND_flat_out(v).listNotNull()) { + for (j = 0; (e = (Agedge_s) ND_flat_out(v).getFromList(j))!=null; j++) { if ( ((GD_flip(g) == 0) && (ND_order(aghead(e)) < ND_order(agtail(e)))) || ( (GD_flip(g)!=0) && (ND_order(aghead(e)) > ND_order(agtail(e)) ))) { assert(constraining_flat_edge(g,v,e) == false); @@ -2506,12 +2509,12 @@ try { for (top = 0; top < GD_rank(g).plus(r).getInt("n"); top++) { Agedge_s e; if (max > 0) { - for (i = 0; (e = (Agedge_s) ND_out(rtop.plus(top).getPtr()).getArrayOfPtr("list").plus(i).getPtr())!=null; i++) { + for (i = 0; (e = (Agedge_s) ND_out(rtop.plus(top).getPtr()).getFromList(i))!=null; i++) { for (k = ND_order(aghead(e)) + 1; k <= max; k++) cross += Z.z().Count.plus(k).getInt() * ED_xpenalty(e); } } - for (i = 0; (e = (Agedge_s) ND_out(rtop.plus(top).getPtr()).getArrayOfPtr("list").plus(i).getPtr())!=null; i++) { + for (i = 0; (e = (Agedge_s) ND_out(rtop.plus(top).getPtr()).getFromList(i))!=null; i++) { int inv = ND_order(aghead(e)); if (inv > max) max = inv; @@ -2587,8 +2590,8 @@ try { Agedge_s e; __ptr__ fl; Agnode_s nn; - if (ND_flat_in(n).getInt("size") > 0) { - fl = ND_flat_in(n).getPtr("list"); + if (ND_flat_in(n).size > 0) { + fl = ND_flat_in(n).getTheList(); nn = agtail(fl.plus(0).getPtr()); for (i = 1; (e = (Agedge_s) fl.plus(i).getPtr())!=null; i++) if (ND_order(agtail(e)) > ND_order(nn)) @@ -2597,8 +2600,8 @@ try { ND_mval(n, ND_mval(nn) + 1); return false; } - } else if (ND_flat_out(n).getInt("size") > 0) { - fl = ND_flat_out(n).getPtr("list"); + } else if (ND_flat_out(n).size > 0) { + fl = ND_flat_out(n).getTheList(); nn = aghead(fl.plus(0).getPtr()); for (i = 1; (e = (Agedge_s) fl.plus(i).getPtr())!=null; i++) if (ND_order(aghead(e)) < ND_order(nn)) @@ -2634,11 +2637,11 @@ try { n = (Agnode_s) v.plus(i).getPtr(); j = 0; if (r1 > r0) - for (j0 = 0; (e = (Agedge_s) ND_out(n).getArrayOfPtr("list").plus(j0).getPtr())!=null; j0++) { + for (j0 = 0; (e = (Agedge_s) ND_out(n).getFromList(j0))!=null; j0++) { if (ED_xpenalty(e) > 0) list.plus(j++).setInt((256 * ND_order(aghead(e)) + (ED_head_port(e)).getInt("order"))); } else - for (j0 = 0; (e = (Agedge_s) ND_in(n).getArrayOfPtr("list").plus(j0).getPtr())!=null; j0++) { + for (j0 = 0; (e = (Agedge_s) ND_in(n).getFromList(j0))!=null; j0++) { if (ED_xpenalty(e) > 0) list.plus(j++).setInt((256 * ND_order(agtail(e)) + (ED_tail_port(e)).getInt("order"))); } @@ -2676,7 +2679,7 @@ try { } for (i = 0; i < GD_rank(g).plus(r0).getInt("n"); i++) { n = (Agnode_s) v.plus(i).getPtr(); - if ((ND_out(n).getInt("size") == 0) && (ND_in(n).getInt("size") == 0)) + if ((ND_out(n).size == 0) && (ND_in(n).size == 0)) hasfixed |= flat_mval(n); } return hasfixed; diff --git a/src/gen/lib/dotgen/position__c.java b/src/gen/lib/dotgen/position__c.java index 6c266066c..b0e40a143 100644 --- a/src/gen/lib/dotgen/position__c.java +++ b/src/gen/lib/dotgen/position__c.java @@ -138,12 +138,14 @@ import h.Agedgeinfo_t; import h.Agedgepair_s; import h.Agnode_s; import h.Agraph_s; +import h.ST_pointf; import h.aspect_t; import h.boxf; import h.point; import h.pointf; import h.ratio_t; import smetana.core.CString; +import smetana.core.JUtils; import smetana.core.Memory; import smetana.core.Z; import smetana.core.__ptr__; @@ -414,7 +416,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -452,7 +454,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -492,7 +494,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; @@ -827,8 +829,8 @@ try { tp = null; for (i = 0; i < rp.getPtr().getInt("n"); i++) { tp = (Agnode_s) rp.getPtr().getArrayOfPtr("v").plus(i).getPtr(); - if (ND_save_out(tp).getPtr("list")!=null) { - for (j = 0; (e = (Agedge_s) ND_save_out(tp).getArrayOfPtr("list").plus(j).getPtr())!=null; j++) { + if (ND_save_out(tp).listNotNull()) { + for (j = 0; (e = (Agedge_s) ND_save_out(tp).getFromList(j))!=null; j++) { if ((ND_rank(aghead(e)) > r) || (ND_rank(agtail(e)) > r)) { found = 1; break; @@ -836,8 +838,8 @@ try { } if (found!=0) break; } - if (ND_save_in(tp).getPtr("list")!=null) { - for (j = 0; (e = (Agedge_s) ND_save_in(tp).getArrayOfPtr("list").plus(j).getPtr())!=null; j++) { + if (ND_save_in(tp).listNotNull()) { + for (j = 0; (e = (Agedge_s) ND_save_in(tp).getFromList(j))!=null; j++) { if ((ND_rank(agtail(e)) > r) || (ND_rank(aghead(e)) > r)) { found = 1; break; @@ -924,7 +926,7 @@ try { Agedge_s e; if (EQ(u, v)) return NOT(false); - for (i = 0; (e = (Agedge_s) ND_out(u).getArrayOfPtr("list").plus(i).getPtr())!=null; i++) { + for (i = 0; (e = (Agedge_s) ND_out(u).getFromList(i))!=null; i++) { if (go(aghead(e), v)) return NOT(false); } @@ -989,8 +991,8 @@ try { for (n = GD_nlist(g); n!=null; n = ND_next(n)) { ND_save_in(n, ND_in(n)); ND_save_out(n, ND_out(n)); - for (i = 0; ND_out(n).getArrayOfPtr("list").plus(i).getPtr()!=null; i++); - for (j = 0; ND_in(n).getArrayOfPtr("list").plus(j).getPtr()!=null; j++); + for (i = 0; ND_out(n).getFromList(i)!=null; i++); + for (j = 0; ND_in(n).getFromList(j)!=null; j++); n_in = i + j; alloc_elist(n_in + 3, ND_in(n), Agnode_s.class); alloc_elist(3, ND_out(n), Agnode_s.class); @@ -1034,7 +1036,7 @@ try { for (j = 0; j < rank.plus(i).getInt("n"); j++) { u = (Agnode_s) rank.plus(i).getArrayOfPtr("v").plus(j).getPtr(); ND_mval(u, ND_rw(u)); /* keep it somewhere safe */ - if (ND_other(u).getInt("size") > 0) { /* compute self size */ + if (ND_other(u).size > 0) { /* compute self size */ /* FIX: dot assumes all self-edges go to the right. This * is no longer true, though makeSelfEdge still attempts to * put as many as reasonable on the right. The dot code @@ -1044,7 +1046,7 @@ try { * positioning but may also affect interrank spacing. */ sw = 0; - for (k = 0; (e = (Agedge_s) ND_other(u).getArrayOfPtr("list").plus(k).getPtr())!=null; k++) { + for (k = 0; (e = (Agedge_s) ND_other(u).getFromList(k))!=null; k++) { if (EQ(agtail(e), aghead(e))) { sw += selfRightSpace (e); } @@ -1060,8 +1062,8 @@ try { } /* constraints from labels of flat edges on previous rank */ if ((e = (Agedge_s) ND_alg(u))!=null) { - e0 = (Agedge_s) ND_save_out(u).getArrayOfPtr("list").plus(0).getPtr(); - e1 = (Agedge_s) ND_save_out(u).getArrayOfPtr("list").plus(1).getPtr(); + e0 = (Agedge_s) ND_save_out(u).getFromList(0); + e1 = (Agedge_s) ND_save_out(u).getFromList(1); if (ND_order(aghead(e0)) > ND_order(aghead(e1))) { ff = e0; e0 = e1; @@ -1080,8 +1082,8 @@ try { ED_weight(e)); } /* position flat edge endpoints */ - for (k = 0; k < ND_flat_out(u).getInt("size"); k++) { - e = (Agedge_s) ND_flat_out(u).getArrayOfPtr("list").plus(k).getPtr(); + for (k = 0; k < ND_flat_out(u).size; k++) { + e = (Agedge_s) ND_flat_out(u).getFromList(k); if (ND_order(agtail(e)) < ND_order(aghead(e))) { t0 = agtail(e); h0 = aghead(e); @@ -1131,11 +1133,11 @@ try { Agnode_s n, sn; Agedge_s e; for (n = GD_nlist(g); n!=null; n = ND_next(n)) { - if (ND_save_out(n).getPtr("list")!=null) - for (i = 0; (e = (Agedge_s) ND_save_out(n).getArrayOfPtr("list").plus(i).getPtr())!=null; i++) { + if (ND_save_out(n).listNotNull()) + for (i = 0; (e = (Agedge_s) ND_save_out(n).getFromList(i))!=null; i++) { sn = virtual_node(g); ND_node_type(sn, 2); - m0 = (int)(ED_head_port(e).getStruct("p").getDouble("x") - ED_tail_port(e).getStruct("p").getDouble("x")); + m0 = (int)(ED_head_port(e).p.x - ED_tail_port(e).p.x); if (m0 > 0) m1 = 0; else { @@ -1189,7 +1191,7 @@ try { Agedge_s e; if (ND_node_type(v) != 1) return false; - for (e = (Agedge_s) ND_save_out(v).getArrayOfPtr("list").plus(0).getPtr(); ED_to_orig(e)!=null; e = ED_to_orig(e)); + for (e = (Agedge_s) ND_save_out(v).getFromList(0); ED_to_orig(e)!=null; e = ED_to_orig(e)); if (agcontains(g, agtail(e))) return false; if (agcontains(g, aghead(e))) @@ -1392,7 +1394,7 @@ try { Agnode_s n, nnext, nprev; Agedge_s e; for (n = GD_nlist(g); n!=null; n = ND_next(n)) { - for (i = 0; (e = (Agedge_s) ND_out(n).getArrayOfPtr("list").plus(i).getPtr())!=null; i++) { + for (i = 0; (e = (Agedge_s) ND_out(n).getFromList(i))!=null; i++) { Memory.free(e.getStruct("base").getPtr("data")); Memory.free(e); } @@ -1435,7 +1437,7 @@ try { for (i = GD_minrank(g); i <= GD_maxrank(g); i++) { for (j = 0; j < rank.plus(i).getInt("n"); j++) { v = (Agnode_s) rank.plus(i).getArrayOfPtr("v").plus(j).getPtr(); - ND_coord(v).setDouble("x", ND_rank(v)); + ND_coord(v).x = ND_rank(v); ND_rank(v, i); } } @@ -1604,8 +1606,8 @@ try { /* assumes symmetry, ht1 = ht2 */ ht2 = ND_ht(n) / 2; /* have to look for high self-edge labels, too */ - if (ND_other(n).getPtr("list")!=null) - for (j = 0; (e = (Agedge_s) ND_other(n).getArrayOfPtr("list").plus(j).getPtr())!=null; j++) { + if (ND_other(n).listNotNull()) + for (j = 0; (e = (Agedge_s) ND_other(n).getFromList(j))!=null; j++) { if (EQ(agtail(e), aghead(e))) { if (ED_label(e)!=null) ht2 = MAX(ht2, ED_label(e).getStruct("dimen").getDouble("y") / 2); @@ -1672,7 +1674,7 @@ UNSUPPORTED("e6dfx5uesysjaefb0djyfp7f"); // (ND_coord(rank[r + 1].v[0])).y } /* copy ycoord assignment from leftmost nodes to others */ for (n = GD_nlist(g); n!=null; n = ND_next(n)) - ND_coord(n).setDouble("y", (ND_coord(rank.plus(ND_rank(n)).getArrayOfPtr("v").plus(0).getPtr())).getDouble("y")); + ND_coord(n).y = ND_coord(rank.plus(ND_rank(n)).getArrayOfPtr("v").plus(0).getPtr()).getDouble("y"); } finally { LEAVING("bp8vmol4ncadervcfossysdtd","set_ycoords"); } @@ -1682,18 +1684,18 @@ LEAVING("bp8vmol4ncadervcfossysdtd","set_ycoords"); //3 9ay2xnnmh407i32pfokujfda5 -// static void dot_compute_bb(graph_t * g, graph_t * root) +//static void dot_compute_bb(graph_t * g, graph_t * root) public static void dot_compute_bb(Agraph_s g, Agraph_s root) { ENTERING("9ay2xnnmh407i32pfokujfda5","dot_compute_bb"); try { - int r, c; - double x, offset; - Agnode_s v; - final __struct__ LL = __struct__.from(pointf.class); - final __struct__ UR = __struct__.from(pointf.class); - if (EQ(g, dot_root(g))) { - LL.setDouble("x", INT_MAX); - UR.setDouble("x", -((double)INT_MAX)); + int r, c; + double x, offset; + Agnode_s v; + final ST_pointf LL = new ST_pointf(); + final ST_pointf UR = new ST_pointf(); + if (EQ(g, dot_root(g))) { + LL.x = INT_MAX; + UR.x = -((double)INT_MAX); for (r = GD_minrank(g); r <= GD_maxrank(g); r++) { int rnkn = GD_rank(g).plus(r).getInt("n"); if (rnkn == 0) @@ -1712,23 +1714,23 @@ try { for (c = rnkn-2; ND_node_type(v) != 0; c--) v = (Agnode_s) GD_rank(g).plus(r).getArrayOfPtr("v").plus(c).getPtr(); x = ND_coord(v).getDouble("x") + ND_rw(v); - UR.setDouble("x", MAX(UR.getDouble("x"), x)); + UR.x = MAX(UR.getDouble("x"), x); } offset = 8; for (c = 1; c <= GD_n_cluster(g); c++) { - x = (double)(GD_bb(GD_clust(g).plus(c)).getStruct("LL").getDouble("x") - offset); - LL.setDouble("x", MIN(LL.getDouble("x"), x)); - x = (double)(GD_bb(GD_clust(g).plus(c)).getStruct("UR").getDouble("x") + offset); - UR.setDouble("x", MAX(UR.getDouble("x"), x)); + x = (double)(GD_bb(GD_clust(g).plus(c)).LL.x - offset); + LL.x = MIN(LL.getDouble("x"), x); + x = (double)(GD_bb(GD_clust(g).plus(c)).UR.x + offset); + UR.x = MAX(UR.getDouble("x"), x); } - } else { - LL.setDouble("x", (double)(ND_rank(GD_ln(g)))); - UR.setDouble("x", (double)(ND_rank(GD_rn(g)))); - } - LL.setDouble("y", ND_coord(GD_rank(root).plus(GD_maxrank(g)).getArrayOfPtr("v").plus(0).getPtr()).getDouble("y") - GD_ht1(g)); - UR.setDouble("y", ND_coord(GD_rank(root).plus(GD_minrank(g)).getArrayOfPtr("v").plus(0).getPtr()).getDouble("y") + GD_ht2(g)); - GD_bb(g).setStruct("LL", LL); - GD_bb(g).setStruct("UR", UR); + } else { + LL.x = (double)(ND_rank(GD_ln(g))); + UR.x = (double)(ND_rank(GD_rn(g))); + } + LL.y = ND_coord(GD_rank(root).plus(GD_maxrank(g)).getArrayOfPtr("v").plus(0).getPtr()).getDouble("y") - GD_ht1(g); + UR.y = ND_coord(GD_rank(root).plus(GD_minrank(g)).getArrayOfPtr("v").plus(0).getPtr()).getDouble("y") + GD_ht2(g); + GD_bb(g).setStruct("LL", LL); + GD_bb(g).setStruct("UR", UR); } finally { LEAVING("9ay2xnnmh407i32pfokujfda5","dot_compute_bb"); } @@ -1737,6 +1739,7 @@ LEAVING("9ay2xnnmh407i32pfokujfda5","dot_compute_bb"); + //3 dlbpiimh9g9ff9w7wjoabf817 // static void rec_bb(graph_t * g, graph_t * root) public static void rec_bb(Agraph_s g, Agraph_s root) { @@ -2017,13 +2020,13 @@ throw new UnsupportedOperationException(); public static boolean ports_eq(Agedge_s e, Agedge_s f) { ENTERING("alpljm8o6nsam95ly6leelnbp","ports_eq"); try { - return ((ED_head_port(e).getBoolean("defined") == ED_head_port(f).getBoolean("defined")) - && (((ED_head_port(e).getStruct("p").getDouble("x") == ED_head_port(f).getStruct("p").getDouble("x")) && - (ED_head_port(e).getStruct("p").getDouble("y") == ED_head_port(f).getStruct("p").getDouble("y"))) - || (ED_head_port(e).getBoolean("defined") == false)) - && (((ED_tail_port(e).getStruct("p").getDouble("x") == ED_tail_port(f).getStruct("p").getDouble("x")) && - (ED_tail_port(e).getStruct("p").getDouble("y") == ED_tail_port(f).getStruct("p").getDouble("y"))) - || (ED_tail_port(e).getBoolean("defined") == false)) + return ((ED_head_port(e).defined == ED_head_port(f).defined) + && (((ED_head_port(e).p.x == ED_head_port(f).p.x) && + (ED_head_port(e).p.y == ED_head_port(f).p.y)) + || (ED_head_port(e).defined == 0)) + && (((ED_tail_port(e).p.x == ED_tail_port(f).p.x) && + (ED_tail_port(e).p.y == ED_tail_port(f).p.y)) + || (ED_tail_port(e).defined == 0)) ); } finally { LEAVING("alpljm8o6nsam95ly6leelnbp","ports_eq"); @@ -2047,8 +2050,8 @@ try { do_leaves(g, ND_inleaf(n)); if (ND_outleaf(n)!=null) do_leaves(g, ND_outleaf(n)); - if (ND_other(n).getPtr("list")!=null) - for (i = 0; (e = (Agedge_s) ND_other(n).getArrayOfPtr("list").plus(i).getPtr())!=null; i++) { + if (ND_other(n).listNotNull()) + for (i = 0; (e = (Agedge_s) ND_other(n).getFromList(i))!=null; i++) { if ((d = ND_rank(aghead(e)) - ND_rank(aghead(e))) == 0) continue; f = ED_to_orig(e); diff --git a/src/gen/lib/dotgen/rank__c.java b/src/gen/lib/dotgen/rank__c.java index d4c288b66..6e6aa2cf7 100644 --- a/src/gen/lib/dotgen/rank__c.java +++ b/src/gen/lib/dotgen/rank__c.java @@ -111,6 +111,7 @@ import h.elist; import h.point; import h.pointf; import smetana.core.CString; +import smetana.core.JUtils; import smetana.core.Memory; import smetana.core.Z; import smetana.core.__struct__; @@ -380,7 +381,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -418,7 +419,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -458,7 +459,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; @@ -780,8 +781,8 @@ try { Agnode_s n; Agedge_s e, f; int c; - for (c = 0; c < GD_comp(g).getInt("size"); c++) { - GD_nlist(g, GD_comp(g).getArrayOfPtr("list").plus(c).getPtr()); + for (c = 0; c < GD_comp(g).size; c++) { + GD_nlist(g, GD_comp(g).getFromList(c)); for (n = GD_nlist(g); n!=null; n = ND_next(n)) { renewlist(ND_in(n).amp()); renewlist(ND_out(n).amp()); @@ -814,9 +815,8 @@ try { ED_to_virt(e, null); } } - Memory.free(GD_comp(g).getPtr("list")); - GD_comp(g).setPtr("list", null); - GD_comp(g).setInt("size", 0); + GD_comp(g).resetList(); + GD_comp(g).size = 0; } finally { LEAVING("1xov2qhuxj1f9nbzu3xsa6679","cleanup1"); } @@ -1130,7 +1130,7 @@ ENTERING("3bcr1748gqnu8ogb73jeja7ly","minmax_edges"); try { Agnode_s n; Agedge_s e; - final __struct__ slen = __struct__.from(point.class); + final __struct__ slen = JUtils.from(point.class); slen.setInt("x", 0); slen.setInt("y", 0); if ((GD_maxset(g) == null) && (GD_minset(g) == null)) @@ -1211,8 +1211,9 @@ try { CString s; if ((s = agget(g, new CString("nslimit1")))!=null) UNSUPPORTED("9tp2zk1tsr4ce9rwsr0is9u3o"); // maxiter = atof(s) * agnnodes(g); - for (c = 0; c < GD_comp(g).getInt("size"); c++) { - GD_nlist(g, GD_comp(g).getArrayOfPtr("list").plus(c).getPtr()); + for (c = 0; c < GD_comp(g).size; c++) { + //GD_nlist(g, GD_comp(g).getArrayOfPtr("list").plus(c).getPtr()); + GD_nlist(g, GD_comp(g).getFromList(c)); rank(g, (GD_n_cluster(g) == 0 ? 1 : 0), maxiter); /* TB balance */ } } finally { @@ -1273,7 +1274,7 @@ LEAVING("cdh8wnb99v90dy6efpbzmrjix","expand_ranksets"); public static void dot1_rank(Agraph_s g, aspect_t asp) { ENTERING("2o4rmb4o6f6zh46ak3se91rwr","dot1_rank"); try { - final __struct__ p = __struct__.from(point.class); + final __struct__ p = JUtils.from(point.class); edgelabel_ranks(g); if (asp!=null) { UNSUPPORTED("kh7e20nqwuserrnpf3zpvuyl"); // init_UF_size(g); @@ -1282,7 +1283,7 @@ UNSUPPORTED("d88j5oswhz0d3yvd4wlvxohmu"); // initEdgeTypes(g); collapse_sets(g,g); /*collapse_leaves(g); */ class1_(g); - p.____(minmax_edges(g)); + p.___(minmax_edges(g)); decompose(g, 0); if (asp!=null && ((GD_comp(g).getInt("size") > 1)||(GD_n_cluster(g) > 0))) { UNSUPPORTED("evcjt85irnaa02v8cam07i009"); // asp->badGraph = 1; diff --git a/src/gen/lib/dotgen/sameport__c.java b/src/gen/lib/dotgen/sameport__c.java index dda73b2bd..63b20dcc5 100644 --- a/src/gen/lib/dotgen/sameport__c.java +++ b/src/gen/lib/dotgen/sameport__c.java @@ -56,6 +56,7 @@ import h.Agraph_s; import h.boxf; import h.pointf; import smetana.core.CString; +import smetana.core.JUtils; import smetana.core.Z; import smetana.core.__struct__; @@ -324,7 +325,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -362,7 +363,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -402,7 +403,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/fdpgen/clusteredges__c.java b/src/gen/lib/fdpgen/clusteredges__c.java index 2112679f4..48afde6ac 100644 --- a/src/gen/lib/fdpgen/clusteredges__c.java +++ b/src/gen/lib/fdpgen/clusteredges__c.java @@ -49,6 +49,7 @@ import static smetana.core.JUtilsDebug.LEAVING; import static smetana.core.Macro.UNSUPPORTED; import h.boxf; import h.pointf; +import smetana.core.JUtils; import smetana.core.__struct__; public class clusteredges__c { @@ -316,7 +317,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -354,7 +355,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -394,7 +395,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/fdpgen/comp__c.java b/src/gen/lib/fdpgen/comp__c.java index 991979fa3..42f974575 100644 --- a/src/gen/lib/fdpgen/comp__c.java +++ b/src/gen/lib/fdpgen/comp__c.java @@ -49,6 +49,7 @@ import static smetana.core.JUtilsDebug.LEAVING; import static smetana.core.Macro.UNSUPPORTED; import h.boxf; import h.pointf; +import smetana.core.JUtils; import smetana.core.__struct__; public class comp__c { @@ -316,7 +317,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -354,7 +355,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -394,7 +395,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/fdpgen/fdpinit__c.java b/src/gen/lib/fdpgen/fdpinit__c.java index f9fea2f15..457cc4cdb 100644 --- a/src/gen/lib/fdpgen/fdpinit__c.java +++ b/src/gen/lib/fdpgen/fdpinit__c.java @@ -49,6 +49,7 @@ import static smetana.core.JUtilsDebug.LEAVING; import static smetana.core.Macro.UNSUPPORTED; import h.boxf; import h.pointf; +import smetana.core.JUtils; import smetana.core.__struct__; public class fdpinit__c { @@ -316,7 +317,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -354,7 +355,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -394,7 +395,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/fdpgen/grid__c.java b/src/gen/lib/fdpgen/grid__c.java index 42a45608d..35122bc0f 100644 --- a/src/gen/lib/fdpgen/grid__c.java +++ b/src/gen/lib/fdpgen/grid__c.java @@ -49,6 +49,7 @@ import static smetana.core.JUtilsDebug.LEAVING; import static smetana.core.Macro.UNSUPPORTED; import h.boxf; import h.pointf; +import smetana.core.JUtils; import smetana.core.__struct__; public class grid__c { @@ -316,7 +317,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -354,7 +355,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -394,7 +395,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/fdpgen/layout__c.java b/src/gen/lib/fdpgen/layout__c.java index 4cba97c99..12a820373 100644 --- a/src/gen/lib/fdpgen/layout__c.java +++ b/src/gen/lib/fdpgen/layout__c.java @@ -49,6 +49,7 @@ import static smetana.core.JUtilsDebug.LEAVING; import static smetana.core.Macro.UNSUPPORTED; import h.boxf; import h.pointf; +import smetana.core.JUtils; import smetana.core.__struct__; import smetana.core.jmp_buf; @@ -317,7 +318,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -355,7 +356,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -395,7 +396,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/fdpgen/tlayout__c.java b/src/gen/lib/fdpgen/tlayout__c.java index b5b752c93..81c576046 100644 --- a/src/gen/lib/fdpgen/tlayout__c.java +++ b/src/gen/lib/fdpgen/tlayout__c.java @@ -49,6 +49,7 @@ import static smetana.core.JUtilsDebug.LEAVING; import static smetana.core.Macro.UNSUPPORTED; import h.boxf; import h.pointf; +import smetana.core.JUtils; import smetana.core.__struct__; public class tlayout__c { @@ -316,7 +317,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -354,7 +355,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -394,7 +395,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/fdpgen/xlayout__c.java b/src/gen/lib/fdpgen/xlayout__c.java index f2c94ad79..8614a2056 100644 --- a/src/gen/lib/fdpgen/xlayout__c.java +++ b/src/gen/lib/fdpgen/xlayout__c.java @@ -49,6 +49,7 @@ import static smetana.core.JUtilsDebug.LEAVING; import static smetana.core.Macro.UNSUPPORTED; import h.boxf; import h.pointf; +import smetana.core.JUtils; import smetana.core.__struct__; public class xlayout__c { @@ -316,7 +317,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -354,7 +355,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -394,7 +395,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/gvc/gvlayout__c.java b/src/gen/lib/gvc/gvlayout__c.java index 60e14017e..e305e48ff 100644 --- a/src/gen/lib/gvc/gvlayout__c.java +++ b/src/gen/lib/gvc/gvlayout__c.java @@ -68,6 +68,7 @@ import h.gvlayout_features_t; import h.gvplugin_installed_t; import h.layout_type; import smetana.core.CString; +import smetana.core.JUtils; import smetana.core.Memory; import smetana.core.__struct__; @@ -176,8 +177,8 @@ public class gvlayout__c { //3 2g20jitdi8afuoei8p1mcfg9l // int gvlayout_select(GVC_t * gvc, const char *layout) -private final static __struct__ dotgen_features = __struct__.from(gvlayout_features_t.class); -private final static __struct__ dotgen_engine = __struct__.from(gvlayout_engine_s.class); +private final static __struct__ dotgen_features = JUtils.from(gvlayout_features_t.class); +private final static __struct__ dotgen_engine = JUtils.from(gvlayout_engine_s.class); static { dotgen_features.setInt("flags", 1<<0); dotgen_engine.setPtr("layout", function(gen.lib.dotgen.dotinit__c.class, "dot_layout")); diff --git a/src/gen/lib/gvc/gvrender__c.java b/src/gen/lib/gvc/gvrender__c.java index eee6d81f4..8467a4870 100644 --- a/src/gen/lib/gvc/gvrender__c.java +++ b/src/gen/lib/gvc/gvrender__c.java @@ -49,6 +49,7 @@ import static smetana.core.JUtilsDebug.LEAVING; import static smetana.core.Macro.UNSUPPORTED; import h.boxf; import h.pointf; +import smetana.core.JUtils; import smetana.core.__struct__; public class gvrender__c { @@ -180,7 +181,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -218,7 +219,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -258,7 +259,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/label/nrtmain__c.java b/src/gen/lib/label/nrtmain__c.java index 9ba51aeac..8cd455954 100644 --- a/src/gen/lib/label/nrtmain__c.java +++ b/src/gen/lib/label/nrtmain__c.java @@ -48,6 +48,7 @@ import static smetana.core.JUtilsDebug.ENTERING; import static smetana.core.JUtilsDebug.LEAVING; import static smetana.core.Macro.UNSUPPORTED; import h.pointf; +import smetana.core.JUtils; import smetana.core.__struct__; public class nrtmain__c { @@ -170,7 +171,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; diff --git a/src/gen/lib/ortho/ortho__c.java b/src/gen/lib/ortho/ortho__c.java index 2368cfe01..8f66e6d80 100644 --- a/src/gen/lib/ortho/ortho__c.java +++ b/src/gen/lib/ortho/ortho__c.java @@ -49,6 +49,7 @@ import static smetana.core.JUtilsDebug.LEAVING; import static smetana.core.Macro.UNSUPPORTED; import h.boxf; import h.pointf; +import smetana.core.JUtils; import smetana.core.__struct__; import smetana.core.jmp_buf; @@ -185,7 +186,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -223,7 +224,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -263,7 +264,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/pack/ccomps__c.java b/src/gen/lib/pack/ccomps__c.java index 927c845f8..48bb06551 100644 --- a/src/gen/lib/pack/ccomps__c.java +++ b/src/gen/lib/pack/ccomps__c.java @@ -49,6 +49,7 @@ import static smetana.core.JUtilsDebug.LEAVING; import static smetana.core.Macro.UNSUPPORTED; import h.boxf; import h.pointf; +import smetana.core.JUtils; import smetana.core.__struct__; import smetana.core.jmp_buf; @@ -317,7 +318,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -355,7 +356,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -395,7 +396,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/pack/pack__c.java b/src/gen/lib/pack/pack__c.java index ad374a68b..9222007b5 100644 --- a/src/gen/lib/pack/pack__c.java +++ b/src/gen/lib/pack/pack__c.java @@ -53,6 +53,7 @@ import h.boxf; import h.pack_info; import h.pointf; import smetana.core.CString; +import smetana.core.JUtils; import smetana.core.__struct__; public class pack__c { @@ -320,7 +321,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -358,7 +359,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -398,7 +399,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/pack/ptest__c.java b/src/gen/lib/pack/ptest__c.java index bf8a4b6ab..9f2f1c94b 100644 --- a/src/gen/lib/pack/ptest__c.java +++ b/src/gen/lib/pack/ptest__c.java @@ -49,6 +49,7 @@ import static smetana.core.JUtilsDebug.LEAVING; import static smetana.core.Macro.UNSUPPORTED; import h.boxf; import h.pointf; +import smetana.core.JUtils; import smetana.core.__struct__; public class ptest__c { @@ -316,7 +317,7 @@ return pointfof_w_(x, y).copy(); private static __struct__ pointfof_w_(double x, double y) { ENTERING("c1s4k85p1cdfn176o3uryeros","pointfof"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", x); r.setDouble("y", y); return r; @@ -354,7 +355,7 @@ return boxfof_w_(llx, lly, urx, ury).copy(); private static __struct__ boxfof_w_(double llx, double lly, double urx, double ury) { ENTERING("1vvsta5i8of59frav6uymguav","boxfof"); try { - final __struct__ b = __struct__.from(boxf.class); + final __struct__ b = JUtils.from(boxf.class); b.getStruct("LL").setDouble("x", llx); b.getStruct("LL").setDouble("y", lly); b.getStruct("UR").setDouble("x", urx); @@ -394,7 +395,7 @@ return add_pointf_w_(p.copy(), q.copy()).copy(); private static __struct__ add_pointf_w_(final __struct__ p, final __struct__ q) { ENTERING("arrsbik9b5tnfcbzsm8gr2chx","add_pointf"); try { - final __struct__ r = __struct__.from(pointf.class); + final __struct__ r = JUtils.from(pointf.class); r.setDouble("x", p.getDouble("x") + q.getDouble("x")); r.setDouble("y", p.getDouble("y") + q.getDouble("y")); return r; diff --git a/src/gen/lib/pathplan/route__c.java b/src/gen/lib/pathplan/route__c.java index 2c5a9637a..b141968a3 100644 --- a/src/gen/lib/pathplan/route__c.java +++ b/src/gen/lib/pathplan/route__c.java @@ -56,6 +56,7 @@ import static smetana.core.Macro.UNSUPPORTED; import h.Ppoly_t; import h.pointf; import h.tna_t; +import smetana.core.JUtils; import smetana.core.Memory; import smetana.core.Z; import smetana.core.__array_of_struct__; @@ -104,8 +105,8 @@ try { if (setjmp(jbuf)!=0) UNSUPPORTED("8d9xfgejx5vgd6shva5wk5k06"); // return -1; /* generate the splines */ - evs.plus(0).getStruct().____(normv(evs.plus(0).getStruct())); - evs.plus(1).getStruct().____(normv(evs.plus(1).getStruct())); + evs.plus(0).getStruct().___(normv(evs.plus(0).getStruct())); + evs.plus(1).getStruct().___(normv(evs.plus(1).getStruct())); Z.z().opl = 0; growops(4); Z.z().ops_route.plus(Z.z().opl).setStruct(inps.plus(0).getStruct()); @@ -134,8 +135,8 @@ return reallyroutespline_w_(edges, edgen, inps, inpn, ev0.copy(), ev1.copy()); private static int reallyroutespline_w_(__ptr__ edges, int edgen, __ptr__ inps, int inpn, final __struct__ ev0, final __struct__ ev1) { ENTERING("13dxqzbgtpl4ubnnvw6ehzzi9","reallyroutespline"); try { - final __struct__ p1 = __struct__.from(pointf.class), p2 = __struct__.from(pointf.class), cp1 = __struct__.from(pointf.class), cp2 = __struct__.from(pointf.class), p = __struct__.from(pointf.class); - final __struct__ v1 = __struct__.from(pointf.class), v2 = __struct__.from(pointf.class), splitv = __struct__.from(pointf.class), splitv1 = __struct__.from(pointf.class), splitv2 = __struct__.from(pointf.class); + final __struct__ p1 = JUtils.from(pointf.class), p2 = JUtils.from(pointf.class), cp1 = JUtils.from(pointf.class), cp2 = JUtils.from(pointf.class), p = JUtils.from(pointf.class); + final __struct__ v1 = JUtils.from(pointf.class), v2 = JUtils.from(pointf.class), splitv = JUtils.from(pointf.class), splitv1 = JUtils.from(pointf.class), splitv2 = JUtils.from(pointf.class); double maxd, d, t; int maxi, i, spliti; if (Z.z().tnan < inpn) { @@ -161,8 +162,8 @@ try { return -1; if (splinefits(edges, edgen, p1, v1, p2, v2, inps, inpn)!=0) return 0; - cp1.____(add(p1, scale(v1, 1 / 3.0))); - cp2.____(sub(p2, scale(v2, 1 / 3.0))); + cp1.___(add(p1, scale(v1, 1 / 3.0))); + cp2.___(sub(p2, scale(v2, 1 / 3.0))); for (maxd = -1, maxi = -1, i = 1; i < inpn - 1; i++) { t = Z.z().tnas.plus(i).getDouble("t"); p.setDouble("x", B0(t) * p1.getDouble("x") + B1(t) * cp1.getDouble("x") + B2(t) * cp2.getDouble("x") + B3(t) * p2.getDouble("x")); @@ -171,9 +172,9 @@ try { {maxd = d; maxi = i;} } spliti = maxi; - splitv1.____(normv(sub(inps.plus(spliti).getStruct(), inps.plus(spliti - 1).getStruct()))); - splitv2.____(normv(sub(inps.plus(spliti + 1).getStruct(), inps.plus(spliti).getStruct()))); - splitv.____(normv(add(splitv1, splitv2))); + splitv1.___(normv(sub(inps.plus(spliti).getStruct(), inps.plus(spliti - 1).getStruct()))); + splitv2.___(normv(sub(inps.plus(spliti + 1).getStruct(), inps.plus(spliti).getStruct()))); + splitv.___(normv(add(splitv1, splitv2))); reallyroutespline(edges, edgen, inps, spliti + 1, ev0, splitv); reallyroutespline(edges, edgen, inps.plus(spliti), inpn - spliti, splitv, ev1); @@ -195,7 +196,7 @@ return mkspline_w_(inps, inpn, tnas, ev0.copy(), ev1.copy(), sp0, sv0, sp1, sv1) private static int mkspline_w_(__ptr__ inps, int inpn, __ptr__ tnas, final __struct__ ev0, final __struct__ ev1, __ptr__ sp0, __ptr__ sv0, __ptr__ sp1, __ptr__ sv1) { ENTERING("29sok6jkfyobf83q130snkhmh","mkspline"); try { - final __struct__ tmp = __struct__.from(pointf.class); + final __struct__ tmp = JUtils.from(pointf.class); double c[][] = new double[2][2]; double x[] = new double[2]; double det01, det0X, detX1; @@ -209,7 +210,7 @@ try { c[0][1] += dot(tnas.plus(i).getStruct().getArrayOfStruct("a").plus(0).getStruct(), tnas.plus(i).getStruct().getArrayOfStruct("a").plus(1).getStruct()); c[1][0] = c[0][1]; c[1][1] += dot(tnas.plus(i).getStruct().getArrayOfStruct("a").plus(1).getStruct(), tnas.plus(i).getStruct().getArrayOfStruct("a").plus(1).getStruct()); - tmp.____(sub(inps.plus(i).getStruct(), add(scale(inps.plus(0).getStruct(), B01(tnas.plus(i).getStruct().getDouble("t"))), + tmp.___(sub(inps.plus(i).getStruct(), add(scale(inps.plus(0).getStruct(), B01(tnas.plus(i).getStruct().getDouble("t"))), scale(inps.plus(inpn - 1).getStruct(), B23(tnas.plus(i).getStruct().getDouble("t")))))); x[0] += dot(tnas.plus(i).getStruct().getArrayOfStruct("a").plus(0).getStruct(), tmp); x[1] += dot(tnas.plus(i).getStruct().getArrayOfStruct("a").plus(1).getStruct(), tmp); @@ -344,7 +345,7 @@ try { int rooti, rootn; int ei; final __array_of_struct__ lps = __array_of_struct__.malloc(pointf.class, 2); - final __struct__ ip = __struct__.from(pointf.class); + final __struct__ ip = JUtils.from(pointf.class); double t, ta, tb, tc, td; for (ei = 0; ei < edgen; ei++) { lps.plus(0).setStruct(edges.plus(ei).getStruct("a")); diff --git a/src/gen/lib/pathplan/shortest__c.java b/src/gen/lib/pathplan/shortest__c.java index 500b7cc28..79337e9ac 100644 --- a/src/gen/lib/pathplan/shortest__c.java +++ b/src/gen/lib/pathplan/shortest__c.java @@ -59,6 +59,7 @@ import h.Ppoly_t; import h.pointf; import h.pointnlink_t; import h.triangle_t; +import smetana.core.JUtils; import smetana.core.Memory; import smetana.core.Z; import smetana.core.__array_of_struct__; @@ -98,7 +99,7 @@ private static jmp_buf jbuf = new jmp_buf(); //1 cc2hmcygbtg3adbwgkunssdhx // static deque_t dq -//private final static __struct__ dq = __struct__.from(deque_t.class); +//private final static __struct__ dq = JUtils.from(deque_t.class); //1 3k2f2er3efsrl0210su710vf // static Ppoint_t *ops @@ -117,7 +118,7 @@ ENTERING("2gub5b19vo2qexn56nw23wage","Pshortestpath"); try { int pi, minpi; double minx; - final __struct__ p1 = __struct__.from(pointf.class), p2 = __struct__.from(pointf.class), p3 = __struct__.from(pointf.class); + final __struct__ p1 = JUtils.from(pointf.class), p2 = JUtils.from(pointf.class), p3 = JUtils.from(pointf.class); int trii, trij, ftrii, ltrii; int ei; final __array_of_struct__ epnls = __array_of_struct__.malloc(pointnlink_t.class, 2); @@ -572,7 +573,7 @@ LEAVING("22a9ajg9t8ovqsigk3tyu3rkd","intersects"); public static boolean between(__ptr__ pap, __ptr__ pbp, __ptr__ pcp) { ENTERING("uh5n18rzyevtb4cwpni70qpc","between"); try { - final __struct__ p1 = __struct__.from(pointf.class), p2 = __struct__.from(pointf.class); + final __struct__ p1 = JUtils.from(pointf.class), p2 = JUtils.from(pointf.class); p1.setDouble("x", pbp.getDouble("x") - pap.getDouble("x")); p1.setDouble("y", pbp.getDouble("y") - pap.getDouble("y")); p2.setDouble("x", pcp.getDouble("x") - pap.getDouble("x")); diff --git a/src/h/ST_Agdesc_s.java b/src/h/ST_Agdesc_s.java new file mode 100644 index 000000000..f0f9da7cf --- /dev/null +++ b/src/h/ST_Agdesc_s.java @@ -0,0 +1,160 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of Smetana. + * Smetana is a partial translation of Graphviz/Dot sources from C to Java. + * + * (C) Copyright 2009-2017, Arnaud Roques + * + * This translation is distributed under the same Licence as the original C program: + * + ************************************************************************* + * Copyright (c) 2011 AT&T Intellectual Property + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: See CVS logs. Details at http://www.graphviz.org/ + ************************************************************************* + * + * THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC + * LICENSE ("AGREEMENT"). [Eclipse Public License - v 1.0] + * + * ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES + * RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + * + * You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package h; + +import smetana.core.HardcodedStruct; +import smetana.core.UnsupportedStarStruct; +import smetana.core.UnsupportedStruct; +import smetana.core.UnsupportedStructAndPtr; +import smetana.core.__struct__; +import smetana.core.amiga.Area; +import smetana.core.amiga.AreaInt; +import smetana.core.amiga.InternalData; +import smetana.core.amiga.StarStruct; + +public class ST_Agdesc_s extends UnsupportedStructAndPtr implements HardcodedStruct { + public int directed; /* if edges are asymmetric */ + public int strict; /* if multi-edges forbidden */ + public int no_loop; /* if no loops */ + public int maingraph; /* if this is the top level graph */ + public int flatlock; /* if sets are flattened into lists in cdt */ + public int no_write; /* if a temporary subgraph */ + public int has_attrs; /* if string attr tables should be initialized */ + public int has_cmpnd; /* if may contain collapsed nodes */ + + public ST_Agdesc_s() { + this(null); + } + + public ST_Agdesc_s(StarStruct parent) { + } + + @Override + public __struct__ copy() { + final ST_Agdesc_s result = new ST_Agdesc_s(); + result.directed = directed; + result.strict = strict; + result.no_loop = no_loop; + result.maingraph = maingraph; + result.flatlock = flatlock; + result.no_write = no_write; + result.has_attrs = has_attrs; + result.has_cmpnd = has_cmpnd; + return result; + } + + @Override + public void copyDataFrom(__struct__ other) { + ST_Agdesc_s other2 = (ST_Agdesc_s) other; + directed = other2.directed; + strict = other2.strict; + no_loop = other2.no_loop; + maingraph = other2.maingraph; + flatlock = other2.flatlock; + no_write = other2.no_write; + has_attrs = other2.has_attrs; + has_cmpnd = other2.has_cmpnd; + } + + public class MyInternalData extends UnsupportedStarStruct implements InternalData { + + @Override + public Area getArea(String name) { + final AreaInt result = new AreaInt(); + if (name.equals("directed")) { + result.setInternal(directed); + return result; + } + if (name.equals("strict")) { + result.setInternal(strict); + return result; + } + if (name.equals("no_loop")) { + result.setInternal(no_loop); + return result; + } + if (name.equals("maingraph")) { + result.setInternal(maingraph); + return result; + } + if (name.equals("flatlock")) { + result.setInternal(flatlock); + return result; + } + if (name.equals("no_write")) { + result.setInternal(no_write); + return result; + } + if (name.equals("has_attrs")) { + result.setInternal(has_attrs); + return result; + } + if (name.equals("has_cmpnd")) { + result.setInternal(has_cmpnd); + return result; + } + return super.getArea(name); + } + + } + + @Override + public StarStruct getInternalData() { + return new MyInternalData(); + } + +} + +// struct Agdesc_s { /* graph descriptor */ +// unsigned directed:1; /* if edges are asymmetric */ +// unsigned strict:1; /* if multi-edges forbidden */ +// unsigned no_loop:1; /* if no loops */ +// unsigned maingraph:1; /* if this is the top level graph */ +// unsigned flatlock:1; /* if sets are flattened into lists in cdt */ +// unsigned no_write:1; /* if a temporary subgraph */ +// unsigned has_attrs:1; /* if string attr tables should be initialized */ +// unsigned has_cmpnd:1; /* if may contain collapsed nodes */ +// }; \ No newline at end of file diff --git a/src/h/ST_Agiddisc_s.java b/src/h/ST_Agiddisc_s.java new file mode 100644 index 000000000..38e8e090d --- /dev/null +++ b/src/h/ST_Agiddisc_s.java @@ -0,0 +1,118 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of Smetana. + * Smetana is a partial translation of Graphviz/Dot sources from C to Java. + * + * (C) Copyright 2009-2017, Arnaud Roques + * + * This translation is distributed under the same Licence as the original C program: + * + ************************************************************************* + * Copyright (c) 2011 AT&T Intellectual Property + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: See CVS logs. Details at http://www.graphviz.org/ + ************************************************************************* + * + * THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC + * LICENSE ("AGREEMENT"). [Eclipse Public License - v 1.0] + * + * ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES + * RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + * + * You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package h; + +import smetana.core.CFunction; +import smetana.core.UnsupportedStarStruct; +import smetana.core.UnsupportedStruct; +import smetana.core.__ptr__; +import smetana.core.amiga.StarStruct; + + +public class ST_Agiddisc_s extends UnsupportedStruct { + + public CFunction open; + public CFunction map; + public CFunction alloc; + public CFunction free; + public CFunction print; + public CFunction close; + public CFunction idregister; + + @Override + public StarStruct amp() { + return new UnsupportedStarStruct() { + @Override + public Object call(String fieldName, Object... args) { + if (fieldName.equals("open")) { + return open.exe(args); + } + if (fieldName.equals("map")) { + return map.exe(args); + } + if (fieldName.equals("idregister")) { + return idregister.exe(args); + } + if (fieldName.equals("print")) { + return print.exe(args); + } + return super.call(fieldName, args); + } + + @Override + public __ptr__ getPtr(String fieldName) { + if (fieldName.equals("print")) { + return print; + } + return super.getPtr(fieldName); + } + + }; + } + + // public static List DEFINITION = Arrays.asList( + // "struct Agiddisc_s", + // "{", + // "void *(*open) (Agraph_t * g, Agdisc_t*)", + // "long (*map) (void *state, int objtype, char *str, unsigned long *id, int createflag)", + // "long (*alloc) (void *state, int objtype, unsigned long id)", + // "void (*free) (void *state, int objtype, unsigned long id)", + // "char *(*print) (void *state, int objtype, unsigned long id)", + // "void (*close) (void *state)", + // "void (*idregister) (void *state, int objtype, void *obj)", + // "}"); +} + +// struct Agiddisc_s { /* object ID allocator */ +// void *(*open) (Agraph_t * g, Agdisc_t*); /* associated with a graph */ +// long (*map) (void *state, int objtype, char *str, unsigned long *id, +// int createflag); +// long (*alloc) (void *state, int objtype, unsigned long id); +// void (*free) (void *state, int objtype, unsigned long id); +// char *(*print) (void *state, int objtype, unsigned long id); +// void (*close) (void *state); +// void (*idregister) (void *state, int objtype, void *obj); +// }; \ No newline at end of file diff --git a/src/h/ST_Agmemdisc_s.java b/src/h/ST_Agmemdisc_s.java new file mode 100644 index 000000000..8ef104584 --- /dev/null +++ b/src/h/ST_Agmemdisc_s.java @@ -0,0 +1,95 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of Smetana. + * Smetana is a partial translation of Graphviz/Dot sources from C to Java. + * + * (C) Copyright 2009-2017, Arnaud Roques + * + * This translation is distributed under the same Licence as the original C program: + * + ************************************************************************* + * Copyright (c) 2011 AT&T Intellectual Property + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: See CVS logs. Details at http://www.graphviz.org/ + ************************************************************************* + * + * THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC + * LICENSE ("AGREEMENT"). [Eclipse Public License - v 1.0] + * + * ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES + * RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + * + * You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package h; + +import smetana.core.CFunction; +import smetana.core.UnsupportedStarStruct; +import smetana.core.UnsupportedStruct; +import smetana.core.amiga.StarStruct; + +public class ST_Agmemdisc_s extends UnsupportedStruct { + + public CFunction open; + public CFunction alloc; + public CFunction resize; + public CFunction free; + public CFunction close; + + @Override + public StarStruct amp() { + return new UnsupportedStarStruct() { + + @Override + public Object call(String fieldName, Object... args) { + if (fieldName.equals("open")) { + return open.exe(args); + } + if (fieldName.equals("alloc")) { + return alloc.exe(args); + } + return super.call(fieldName, args); + } + }; + } + + // public static List DEFINITION = Arrays.asList( + // "struct Agmemdisc_s", + // "{", + // "void *(*open) (Agdisc_t*)", + // "void *(*alloc) (void *state, size_t req)", + // "void *(*resize) (void *state, void *ptr, size_t old, size_t req)", + // "void (*free) (void *state, void *ptr)", + // "void (*close) (void *state)", + // "}"); +} + +// struct Agmemdisc_s { /* memory allocator */ +// void *(*open) (Agdisc_t*); /* independent of other resources */ +// void *(*alloc) (void *state, size_t req); +// void *(*resize) (void *state, void *ptr, size_t old, size_t req); +// void (*free) (void *state, void *ptr); +// void (*close) (void *state); +// }; \ No newline at end of file diff --git a/src/h/ST_Agtag_s.java b/src/h/ST_Agtag_s.java new file mode 100644 index 000000000..cf72f25cb --- /dev/null +++ b/src/h/ST_Agtag_s.java @@ -0,0 +1,198 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of Smetana. + * Smetana is a partial translation of Graphviz/Dot sources from C to Java. + * + * (C) Copyright 2009-2017, Arnaud Roques + * + * This translation is distributed under the same Licence as the original C program: + * + ************************************************************************* + * Copyright (c) 2011 AT&T Intellectual Property + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: See CVS logs. Details at http://www.graphviz.org/ + ************************************************************************* + * + * THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC + * LICENSE ("AGREEMENT"). [Eclipse Public License - v 1.0] + * + * ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES + * RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + * + * You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package h; + +import smetana.core.HardcodedStruct; +import smetana.core.UnsupportedStarStruct; +import smetana.core.UnsupportedStructAndPtr; +import smetana.core.__struct__; +import smetana.core.amiga.Area; +import smetana.core.amiga.AreaInt; +import smetana.core.amiga.InternalData; +import smetana.core.amiga.StarStruct; + +public class ST_Agtag_s extends UnsupportedStructAndPtr implements HardcodedStruct { + public int objtype; + public int mtflock; + public int attrwf; + public int seq; + public int id; + + public ST_Agtag_s(StarStruct parent) { + } + + public ST_Agtag_s() { + this(null); + } + + @Override + public Class getRealClass() { + return Agtag_s.class; + } + + @Override + public __struct__ copy() { + final ST_Agtag_s result = new ST_Agtag_s(); + result.objtype = objtype; + result.mtflock = mtflock; + result.attrwf = attrwf; + result.seq = seq; + result.id = id; + return result; + } + + @Override + public void copyDataFrom(__struct__ other) { + // if (other instanceof ST_Agtag_s) { + final ST_Agtag_s other2 = (ST_Agtag_s) other; + objtype = other2.objtype; + mtflock = other2.mtflock; + attrwf = other2.attrwf; + seq = other2.seq; + id = other2.id; + // } else { + // objtype = other.getInt("objtype"); + // mtflock = other.getInt("mtflock"); + // attrwf = other.getInt("attrwf"); + // seq = other.getInt("seq"); + // id = other.getInt("id"); + // } + } + + @Override + public void memcopyFrom(Area source) { + final ST_Agtag_s other2 = (ST_Agtag_s) source; + objtype = other2.objtype; + mtflock = other2.mtflock; + attrwf = other2.attrwf; + seq = other2.seq; + id = other2.id; + } + + @Override + public void ___(__struct__ other) { + copyDataFrom(other); + } + + @Override + public Area getArea(String name) { + final AreaInt result = new AreaInt(); + if (name.equals("objtype")) { + result.setInternal(objtype); + return result; + } + if (name.equals("mtflock")) { + result.setInternal(mtflock); + return result; + } + if (name.equals("attrwf")) { + result.setInternal(attrwf); + return result; + } + if (name.equals("seq")) { + result.setInternal(seq); + return result; + } + if (name.equals("id")) { + result.setInternal(id); + return result; + } + return super.getArea(name); + } + + public class MyInternalData extends UnsupportedStarStruct implements InternalData { + + @Override + public Area getArea(String name) { + final AreaInt result = new AreaInt(); + if (name.equals("objtype")) { + result.setInternal(objtype); + return result; + } + if (name.equals("mtflock")) { + result.setInternal(mtflock); + return result; + } + if (name.equals("attrwf")) { + result.setInternal(attrwf); + return result; + } + if (name.equals("seq")) { + result.setInternal(seq); + return result; + } + if (name.equals("id")) { + result.setInternal(id); + return result; + } + return super.getArea(name); + } + + } + + @Override + public StarStruct getInternalData() { + return new MyInternalData(); + } + + // public static List DEFINITION = Arrays.asList( + // "struct Agtag_s", + // "{", + // "unsigned objtype:2", + // "unsigned mtflock:1", + // "unsigned attrwf:1", + // "unsigned seq:(sizeof(unsigned) * 8 - 4)", + // "unsigned long id", + // "}"); +} + +// struct Agtag_s { +// unsigned objtype:2; /* see literal tags below */ +// unsigned mtflock:1; /* move-to-front lock, see above */ +// unsigned attrwf:1; /* attrs written (parity, write.c) */ +// unsigned seq:(sizeof(unsigned) * 8 - 4); /* sequence no. */ +// unsigned long id; /* client ID */ +// }; \ No newline at end of file diff --git a/src/h/ST_arrowname_t.java b/src/h/ST_arrowname_t.java new file mode 100644 index 000000000..6108f2c5b --- /dev/null +++ b/src/h/ST_arrowname_t.java @@ -0,0 +1,75 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of Smetana. + * Smetana is a partial translation of Graphviz/Dot sources from C to Java. + * + * (C) Copyright 2009-2017, Arnaud Roques + * + * This translation is distributed under the same Licence as the original C program: + * + ************************************************************************* + * Copyright (c) 2011 AT&T Intellectual Property + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: See CVS logs. Details at http://www.graphviz.org/ + ************************************************************************* + * + * THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC + * LICENSE ("AGREEMENT"). [Eclipse Public License - v 1.0] + * + * ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES + * RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + * + * You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package h; + +import smetana.core.CString; +import smetana.core.UnsupportedStructAndPtr; +import smetana.core.__struct__; + +public class ST_arrowname_t extends UnsupportedStructAndPtr { + + public CString name; + public int type; + + @Override + public void ___(__struct__ other) { + ST_arrowname_t other2 = (ST_arrowname_t) other; + this.name = other2.name == null ? null : other2.name.duplicate(); + this.type = other2.type; + } + // public static List DEFINITION = Arrays.asList( + // "typedef struct arrowname_t", + // "{", + // "char *name", + // "int type", + // "}", + // "arrowname_t"); +} + +// typedef struct arrowname_t { +// char *name; +// int type; +// } arrowname_t; \ No newline at end of file diff --git a/src/h/ST_arrowtype_t.java b/src/h/ST_arrowtype_t.java new file mode 100644 index 000000000..c3e2067a3 --- /dev/null +++ b/src/h/ST_arrowtype_t.java @@ -0,0 +1,106 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of Smetana. + * Smetana is a partial translation of Graphviz/Dot sources from C to Java. + * + * (C) Copyright 2009-2017, Arnaud Roques + * + * This translation is distributed under the same Licence as the original C program: + * + ************************************************************************* + * Copyright (c) 2011 AT&T Intellectual Property + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: See CVS logs. Details at http://www.graphviz.org/ + ************************************************************************* + * + * THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC + * LICENSE ("AGREEMENT"). [Eclipse Public License - v 1.0] + * + * ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES + * RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + * + * You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package h; + +import smetana.core.CFunction; +import smetana.core.UnsupportedStructAndPtr; +import smetana.core.__ptr__; +import smetana.core.__struct__; + +public class ST_arrowtype_t extends UnsupportedStructAndPtr { + + public int type; + public double lenfact; + public CFunction gen; + + @Override + public void ___(__struct__ other) { + ST_arrowtype_t other2 = (ST_arrowtype_t) other; + type = other2.type; + lenfact = other2.lenfact; + gen = other2.gen; + } + + @Override + public int getInt(String fieldName) { + if (fieldName.equals("type")) { + return type; + } + return super.getInt(fieldName); + } + + @Override + public double getDouble(String fieldName) { + if (fieldName.equals("lenfact")) { + return lenfact; + } + return super.getDouble(fieldName); + } + + @Override + public __ptr__ getPtr(String fieldName) { + if (fieldName.equals("gen")) { + return gen; + } + return super.getPtr(fieldName); + } + + // public static List DEFINITION = Arrays.asList( + // "typedef struct arrowtype_t", + // "{", + // "int type", + // "double lenfact", + // "void (*gen) (GVJ_t * job, pointf p, pointf u, double arrowsize, double penwidth, int flag)", + // "}", + // "arrowtype_t"); +} + +// typedef struct arrowtype_t { +// int type; +// double lenfact; /* ratio of length of this arrow type to standard arrow */ +// void (*gen) (GVJ_t * job, pointf p, pointf u, double arrowsize, double penwidth, int flag); /* generator function for +// type */ +// } arrowtype_t; \ No newline at end of file diff --git a/src/h/ST_boxf.java b/src/h/ST_boxf.java new file mode 100644 index 000000000..b882759f2 --- /dev/null +++ b/src/h/ST_boxf.java @@ -0,0 +1,170 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of Smetana. + * Smetana is a partial translation of Graphviz/Dot sources from C to Java. + * + * (C) Copyright 2009-2017, Arnaud Roques + * + * This translation is distributed under the same Licence as the original C program: + * + ************************************************************************* + * Copyright (c) 2011 AT&T Intellectual Property + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: See CVS logs. Details at http://www.graphviz.org/ + ************************************************************************* + * + * THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC + * LICENSE ("AGREEMENT"). [Eclipse Public License - v 1.0] + * + * ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES + * RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + * + * You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package h; + +import smetana.core.HardcodedStruct; +import smetana.core.UnsupportedStarStruct; +import smetana.core.UnsupportedStructAndPtr; +import smetana.core.__ptr__; +import smetana.core.__struct__; +import smetana.core.amiga.StarStruct; + +public class ST_boxf extends UnsupportedStructAndPtr implements HardcodedStruct { + + public final ST_pointf LL = new ST_pointf(this); + public final ST_pointf UR = new ST_pointf(this); + + public ST_boxf(StarStruct parent) { + } + + public ST_boxf() { + } + + // @Override + // public void setStruct(__struct__ value) { + // final ST_boxf other = (ST_boxf) value; + // this.LL.setStruct(other.LL); + // this.UR.setStruct(other.UR); + // } + + @Override + public __struct__ getStruct(String fieldName) { + // if (fieldName.equals("LL")) { + // return LL; + // } + // if (fieldName.equals("UR")) { + // return UR; + // } + return super.getStruct(fieldName); + } + + public __struct__ getStructInternal(String fieldName) { + if (fieldName.equals("LL")) { + return LL; + } + if (fieldName.equals("UR")) { + return UR; + } + throw new IllegalArgumentException(); + } + + @Override + public void setStruct(String fieldName, __struct__ newData) { + if (fieldName.equals("LL")) { + this.LL.setStruct(newData); + return; + } + if (fieldName.equals("UR")) { + this.UR.setStruct(newData); + return; + } + super.setStruct(fieldName, newData); + } + + @Override + public ST_boxf copy() { + final ST_boxf result = new ST_boxf(); + result.LL.copyDataFrom((__struct__) this.LL); + result.UR.copyDataFrom((__struct__) this.UR); + return result; + } + + @Override + public void copyDataFrom(__struct__ value) { + final ST_boxf other = (ST_boxf) value; + this.LL.setStruct(other.LL); + this.UR.setStruct(other.UR); + } + + // @Override + // public void copyDataFrom(__ptr__ value) { + // final ST_boxf other = (ST_boxf) value; + // this.LL.setStruct(other.LL); + // this.UR.setStruct(other.UR); + // } + + @Override + public void ___(__struct__ value) { + final ST_boxf other = (ST_boxf) value; + this.LL.setStruct(other.LL); + this.UR.setStruct(other.UR); + } + + class Amp extends UnsupportedStarStruct { + + @Override + public __struct__ getStruct(String fieldName) { + if (fieldName.equals("LL")) { + return LL; + } + if (fieldName.equals("UR")) { + return UR; + } + return super.getStruct(fieldName); + } + + @Override + public __struct__ getStruct() { + return ST_boxf.this; + } + + } + + @Override + public StarStruct amp() { + return new Amp(); + } + + // public interface ST_boxf extends __ptr__ { + // public static List DEFINITION = Arrays.asList( + // "typedef struct", + // "{", + // "pointf LL, UR", + // "}", + // "boxf"); +} + +// typedef struct { pointf LL, UR; } boxf; \ No newline at end of file diff --git a/src/h/ST_dtdisc_s.java b/src/h/ST_dtdisc_s.java new file mode 100644 index 000000000..43af69aec --- /dev/null +++ b/src/h/ST_dtdisc_s.java @@ -0,0 +1,146 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of Smetana. + * Smetana is a partial translation of Graphviz/Dot sources from C to Java. + * + * (C) Copyright 2009-2017, Arnaud Roques + * + * This translation is distributed under the same Licence as the original C program: + * + ************************************************************************* + * Copyright (c) 2011 AT&T Intellectual Property + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: See CVS logs. Details at http://www.graphviz.org/ + ************************************************************************* + * + * THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC + * LICENSE ("AGREEMENT"). [Eclipse Public License - v 1.0] + * + * ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES + * RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + * + * You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package h; + +import smetana.core.CFunction; +import smetana.core.UnsupportedStarStruct; +import smetana.core.UnsupportedStructAndPtr; +import smetana.core.__ptr__; +import smetana.core.amiga.StarStruct; + +public class ST_dtdisc_s extends UnsupportedStructAndPtr { + + public int key; /* where the key begins in an object */ + public int size; /* key size and type */ + public int link; /* offset to Dtlink_t field */ + public CFunction makef; /* object constructor */ + public CFunction freef; /* object destructor */ + public CFunction comparf;/* to compare two objects */ + public CFunction hashf; /* to compute hash value of an object */ + public CFunction memoryf;/* to allocate/free memory */ + public CFunction eventf; /* to process events */ + + public ST_dtdisc_s(StarStruct parent) { + } + + public ST_dtdisc_s() { + this(null); + } + + class Amp extends UnsupportedStarStruct { + + private final ST_dtdisc_s parent; + + public Amp(ST_dtdisc_s me) { + parent = me; + } + + @Override + public boolean isSameThan(StarStruct other) { + final Amp other2 = (Amp) other; + return parent == other2.parent; + } + + @Override + public __ptr__ getPtr(String fieldName) { + if (fieldName.equals("memoryf")) { + return memoryf; + } + if (fieldName.equals("eventf")) { + return eventf; + } + if (fieldName.equals("comparf")) { + return comparf; + } + if (fieldName.equals("makef")) { + return makef; + } + return super.getPtr(fieldName); + } + + @Override + public int getInt(String fieldName) { + if (fieldName.equals("key")) { + return key; + } + if (fieldName.equals("size")) { + return size; + } + if (fieldName.equals("link")) { + return link; + } + return super.getInt(fieldName); + } + + @Override + public __ptr__ setPtr(String fieldName, __ptr__ newData) { + if (fieldName.equals("memoryf")) { + memoryf = (CFunction) newData; + return newData; + } + return super.setPtr(fieldName, newData); + } + + } + + @Override + public StarStruct amp() { + return new Amp(this); + } + +} + +// struct _dtdisc_s +// { int key; /* where the key begins in an object */ +// int size; /* key size and type */ +// int link; /* offset to Dtlink_t field */ +// Dtmake_f makef; /* object constructor */ +// Dtfree_f freef; /* object destructor */ +// Dtcompar_f comparf;/* to compare two objects */ +// Dthash_f hashf; /* to compute hash value of an object */ +// Dtmemory_f memoryf;/* to allocate/free memory */ +// Dtevent_f eventf; /* to process events */ +// }; \ No newline at end of file diff --git a/src/h/ST_dtmethod_s.java b/src/h/ST_dtmethod_s.java new file mode 100644 index 000000000..7bf33f2e1 --- /dev/null +++ b/src/h/ST_dtmethod_s.java @@ -0,0 +1,101 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of Smetana. + * Smetana is a partial translation of Graphviz/Dot sources from C to Java. + * + * (C) Copyright 2009-2017, Arnaud Roques + * + * This translation is distributed under the same Licence as the original C program: + * + ************************************************************************* + * Copyright (c) 2011 AT&T Intellectual Property + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: See CVS logs. Details at http://www.graphviz.org/ + ************************************************************************* + * + * THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC + * LICENSE ("AGREEMENT"). [Eclipse Public License - v 1.0] + * + * ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES + * RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + * + * You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package h; + +import smetana.core.CFunction; +import smetana.core.UnsupportedStarStruct; +import smetana.core.UnsupportedStruct; +import smetana.core.__ptr__; +import smetana.core.amiga.StarStruct; + +public class ST_dtmethod_s extends UnsupportedStruct { + + public CFunction searchf; + public int type; + + // public static List DEFINITION = Arrays.asList( + // "struct _dtmethod_s", + // "{", + // "Dtsearch_f searchf", + // "int type", + // "}"); + @Override + public ST_dtmethod_s copy() { + final ST_dtmethod_s result = new ST_dtmethod_s(); + result.searchf = this.searchf; + result.type = this.type; + return result; + } + + @Override + public StarStruct amp() { + return new UnsupportedStarStruct() { + @Override + public int getInt(String fieldName) { + if (fieldName.equals("type")) { + return type; + } + return super.getInt(fieldName); + } + + @Override + public __ptr__ getPtr(String fieldName) { + if (fieldName.equals("searchf")) { + return searchf; + } + return super.getPtr(fieldName); + } + + @Override + public Object call(String fieldName, Object... args) { + if (fieldName.equals("searchf")) { + return searchf.exe(args); + } + return super.call(fieldName, args); + } + }; + } +} \ No newline at end of file diff --git a/src/h/ST_elist.java b/src/h/ST_elist.java new file mode 100644 index 000000000..63736d874 --- /dev/null +++ b/src/h/ST_elist.java @@ -0,0 +1,234 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of Smetana. + * Smetana is a partial translation of Graphviz/Dot sources from C to Java. + * + * (C) Copyright 2009-2017, Arnaud Roques + * + * This translation is distributed under the same Licence as the original C program: + * + ************************************************************************* + * Copyright (c) 2011 AT&T Intellectual Property + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: See CVS logs. Details at http://www.graphviz.org/ + ************************************************************************* + * + * THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC + * LICENSE ("AGREEMENT"). [Eclipse Public License - v 1.0] + * + * ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES + * RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + * + * You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package h; + +import java.util.ArrayList; +import java.util.List; + +import smetana.core.HardcodedStruct; +import smetana.core.UnsupportedArrayOfPtr; +import smetana.core.UnsupportedStarStruct; +import smetana.core.UnsupportedStructAndPtr; +import smetana.core.__array_of_ptr__; +import smetana.core.__ptr__; +import smetana.core.__struct__; +import smetana.core.amiga.StarStruct; + +public class ST_elist extends UnsupportedStructAndPtr implements HardcodedStruct { + + public int size; + private List list; + + public ST_elist() { + this(null); + } + + public ST_elist(StarStruct parent) { + } + + @Override + public void copyDataFrom(__struct__ other) { + ST_elist other2 = (ST_elist) other; + this.size = other2.size; + this.list = other2.list; + } + + @Override + public void ___(__struct__ other) { + ST_elist other2 = (ST_elist) other; + this.size = other2.size; + this.list = other2.list; + } + + @Override + public ST_elist copy() { + final ST_elist result = new ST_elist(); + result.size = this.size; + result.list = this.list; + return result; + } + + public boolean listNotNull() { + return list != null; + } + + public void mallocEmpty(Class cl, int nb) { + list = new ArrayList(); + while (list.size() < nb) { + list.add(null); + } + } + + class ArrayOfPtr extends UnsupportedArrayOfPtr { + + private int pos; + + private ArrayOfPtr(int pos) { + this.pos = pos; + } + + @Override + public __array_of_ptr__ plus(int delta) { + return new ArrayOfPtr(pos + delta); + } + + @Override + public void setPtr(__ptr__ value) { + list.set(pos, value); + } + + @Override + public __ptr__ getPtr() { + return (__ptr__) list.get(pos); + } + + } + + class Amp extends UnsupportedStarStruct { + + @Override + public int getInt(String fieldName) { + if (fieldName.equals("size")) { + return size; + } + return ST_elist.this.getInt(fieldName); + } + + @Override + public void setInt(String fieldName, int data) { + if (fieldName.equals("size")) { + size = data; + return; + } + ST_elist.this.setInt(fieldName, data); + } + + @Override + public __array_of_ptr__ getArrayOfPtr(String fieldName) { + if (fieldName.equals("list")) { + if (list == null) { + return null; + } + return new ArrayOfPtr(0); + } + return ST_elist.this.getArrayOfPtr(fieldName); + } + + } + + @Override + public StarStruct amp() { + return new Amp(); + } + + public void realloc(int nb) { + if (list == null) { + list = new ArrayList(); + } + while (list.size() < nb) { + list.add(null); + } + } + + class Ptr extends UnsupportedStructAndPtr { + + private final int pos; + + public Ptr(int pos) { + this.pos = pos; + } + + @Override + public __ptr__ plus(int pointerMove) { + return new Ptr(pos + pointerMove); + } + + @Override + public __ptr__ getPtr() { + return (__ptr__) list.get(pos); + } + + } + + public void free() { + list = null; + } + + public void setInList(int idx, Object value) { + list.set(idx, value); + } + + public __ptr__ getFromList(int i) { + return (__ptr__) list.get(i); + } + + public __ptr__ getTheList() { + if (list == null) { + throw new IllegalStateException(); + } + return new Ptr(0); + } + + public __array_of_ptr__ getTheArray() { + if (list == null) { + throw new IllegalStateException(); + } + return new ArrayOfPtr(0); + } + + // public static List DEFINITION = Arrays.asList( + // "typedef struct elist", + // "{", + // "edge_t **list", + // "int size", + // "}", + // "elist"); +} + +// typedef struct elist { +// edge_t **list; +// int size; +// } elist; \ No newline at end of file diff --git a/src/h/ST_nlist_t.java b/src/h/ST_nlist_t.java new file mode 100644 index 000000000..fe88a55bb --- /dev/null +++ b/src/h/ST_nlist_t.java @@ -0,0 +1,104 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of Smetana. + * Smetana is a partial translation of Graphviz/Dot sources from C to Java. + * + * (C) Copyright 2009-2017, Arnaud Roques + * + * This translation is distributed under the same Licence as the original C program: + * + ************************************************************************* + * Copyright (c) 2011 AT&T Intellectual Property + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: See CVS logs. Details at http://www.graphviz.org/ + ************************************************************************* + * + * THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC + * LICENSE ("AGREEMENT"). [Eclipse Public License - v 1.0] + * + * ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES + * RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + * + * You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package h; + +import java.util.ArrayList; +import java.util.List; + +import smetana.core.HardcodedStruct; +import smetana.core.UnsupportedStructAndPtr; +import smetana.core.__ptr__; +import smetana.core.amiga.StarStruct; + +public class ST_nlist_t extends UnsupportedStructAndPtr implements HardcodedStruct { + + // public __ptr__ list; + public int size; + private final List data = new ArrayList(); + + public ST_nlist_t(StarStruct parent) { + } + + public ST_nlist_t() { + this(null); + } + + public void reallocEmpty(int n_nodes, Class class1) { + while (data.size() < n_nodes) { + data.add(null); + } + } + + public void allocEmpty(int n_nodes, Class class1) { + data.clear(); + reallocEmpty(n_nodes, class1); + } + + public void setInList(int idx, Agnode_s value) { + data.set(idx, value); + } + + public __ptr__ getFromList(int i) { + return (__ptr__) data.get(i); + } + + public void resetList() { + data.clear(); + } + + // public static List DEFINITION = Arrays.asList( + // "typedef struct nlist_t", + // "{", + // "node_t **list", + // "int size", + // "}", + // "nlist_t"); +} + +// typedef struct nlist_t { +// node_t **list; +// int size; +// } nlist_t; \ No newline at end of file diff --git a/src/h/ST_pointf.java b/src/h/ST_pointf.java new file mode 100644 index 000000000..111c293d9 --- /dev/null +++ b/src/h/ST_pointf.java @@ -0,0 +1,211 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of Smetana. + * Smetana is a partial translation of Graphviz/Dot sources from C to Java. + * + * (C) Copyright 2009-2017, Arnaud Roques + * + * This translation is distributed under the same Licence as the original C program: + * + ************************************************************************* + * Copyright (c) 2011 AT&T Intellectual Property + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: See CVS logs. Details at http://www.graphviz.org/ + ************************************************************************* + * + * THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC + * LICENSE ("AGREEMENT"). [Eclipse Public License - v 1.0] + * + * ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES + * RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + * + * You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package h; + +import smetana.core.HardcodedStruct; +import smetana.core.UnsupportedStarStruct; +import smetana.core.UnsupportedStructAndPtr; +import smetana.core.__array_of_ptr__; +import smetana.core.__ptr__; +import smetana.core.__struct__; +import smetana.core.amiga.Area; +import smetana.core.amiga.StarArrayOfPtr; +import smetana.core.amiga.StarArrayOfStruct; +import smetana.core.amiga.StarStruct; + +public class ST_pointf extends UnsupportedStructAndPtr implements HardcodedStruct { + + public double x; + public double y; + + public ST_pointf() { + this(null); + } + + public class Amp extends UnsupportedStarStruct { + + public double getX() { + return x; + } + + public double getY() { + return y; + } + + public void setX(double value) { + x = value; + } + + public void setY(double value) { + y = value; + } + + @Override + public __struct__ getStruct() { + return ST_pointf.this; + } + + @Override + public double getDouble(String fieldName) { + return ST_pointf.this.getDouble(fieldName); + } + + @Override + public void setStruct(__struct__ value) { + ST_pointf.this.setStruct(value); + } + } + + @Override + public __struct__ copy() { + final ST_pointf result = new ST_pointf(); + result.x = this.x; + result.y = this.y; + return result; + } + + @Override + public void setStruct(__struct__ value) { + final ST_pointf other2 = (ST_pointf) value; + this.x = other2.x; + this.y = other2.y; + } + + @Override + public void memcopyFrom(Area source) { + if (source instanceof StarArrayOfPtr) { + final Amp other2 = (Amp) ((StarArrayOfPtr) source).getPtr(); + this.x = other2.getX(); + this.y = other2.getY(); + return; + + } + final ST_pointf other2 = (ST_pointf) source; + this.x = other2.x; + this.y = other2.y; + } + + @Override + public void ___(__struct__ other) { + final ST_pointf other2 = (ST_pointf) other; + this.x = other2.x; + this.y = other2.y; + } + + @Override + public void ____(__ptr__ other) { + if (other instanceof __array_of_ptr__) { + Amp other2 = (Amp) other.getPtr(); + this.x = other2.getX(); + this.y = other2.getY(); + return; + } + if (other instanceof StarArrayOfPtr) { + Amp other2 = (Amp) other.getPtr(); + this.x = other2.getX(); + this.y = other2.getY(); + return; + } + if (other instanceof StarArrayOfStruct) { + Amp other2 = (Amp) other.getPtr(); + this.x = other2.getX(); + this.y = other2.getY(); + return; + } + System.err.println("other=" + other.getClass()); + System.err.println("other=" + other.getPtr().getClass()); + super.____(other); + } + + @Override + public void copyDataFrom(__struct__ other) { + final ST_pointf other2 = (ST_pointf) other; + this.x = other2.x; + this.y = other2.y; + } + + @Override + public StarStruct amp() { + return new Amp(); + } + + @Override + public double getDouble(String fieldName) { + if (fieldName.equals("x")) { + return x; + } + if (fieldName.equals("y")) { + return y; + } + return super.getDouble(fieldName); + } + + @Override + public void setDouble(String fieldName, double data) { + if (fieldName.equals("x")) { + this.x = data; + return; + } + if (fieldName.equals("y")) { + this.y = data; + return; + } + super.setDouble(fieldName, data); + } + + public ST_pointf(StarStruct parent) { + } + + // public interface ST_pointf extends __ptr__ { + // public static List DEFINITION = Arrays.asList( + // "typedef struct pointf_s", + // "{", + // "double x, y", + // "}", + // "pointf"); +} + +// typedef struct pointf_s { double x, y; } pointf; \ No newline at end of file diff --git a/src/h/ST_port.java b/src/h/ST_port.java new file mode 100644 index 000000000..94fc458f8 --- /dev/null +++ b/src/h/ST_port.java @@ -0,0 +1,264 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of Smetana. + * Smetana is a partial translation of Graphviz/Dot sources from C to Java. + * + * (C) Copyright 2009-2017, Arnaud Roques + * + * This translation is distributed under the same Licence as the original C program: + * + ************************************************************************* + * Copyright (c) 2011 AT&T Intellectual Property + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: See CVS logs. Details at http://www.graphviz.org/ + ************************************************************************* + * + * THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC + * LICENSE ("AGREEMENT"). [Eclipse Public License - v 1.0] + * + * ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES + * RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + * + * You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package h; + +import javax.swing.text.html.CSS; + +import smetana.core.CString; +import smetana.core.HardcodedStruct; +import smetana.core.UnsupportedStarStruct; +import smetana.core.UnsupportedStructAndPtr; +import smetana.core.__ptr__; +import smetana.core.__struct__; +import smetana.core.amiga.Area; +import smetana.core.amiga.StarStruct; + +public class ST_port extends UnsupportedStructAndPtr implements HardcodedStruct { + + public final ST_pointf p = new ST_pointf(this); + public double theta; + public ST_boxf.Amp bp; + public int defined; + public int constrained; + public int clip; + public int dyna; + public int order; + public int side; + public CString name; + + public ST_port(StarStruct parent) { + } + + public ST_port() { + } + + @Override + public void ___(__struct__ other) { + ST_port other2 = (ST_port) other; + this.p.___(other2.p); + this.theta = other2.theta; + this.bp = other2.bp; + this.defined = other2.defined; + this.constrained = other2.constrained; + this.clip = other2.clip; + this.dyna = other2.dyna; + this.order = other2.order; + this.side = other2.side; + this.name = other2.name; + } + + @Override + public void copyDataFrom(__struct__ other) { + ST_port other2 = (ST_port) other; + this.p.___(other2.p); + this.theta = other2.theta; + this.bp = other2.bp; + this.defined = other2.defined; + this.constrained = other2.constrained; + this.clip = other2.clip; + this.dyna = other2.dyna; + this.order = other2.order; + this.side = other2.side; + this.name = other2.name; + } + + @Override + public void memcopyFrom(Area other) { + ST_port other2 = (ST_port) other; + this.p.___(other2.p); + this.theta = other2.theta; + this.bp = other2.bp; + this.defined = other2.defined; + this.constrained = other2.constrained; + this.clip = other2.clip; + this.dyna = other2.dyna; + this.order = other2.order; + this.side = other2.side; + this.name = other2.name; + } + + @Override + public ST_port copy() { + final ST_port result = new ST_port(); + result.p.___(this.p); + result.theta = this.theta; + result.bp = this.bp; + result.defined = this.defined; + result.constrained = this.constrained; + result.clip = this.clip; + result.dyna = this.dyna; + result.order = this.order; + result.side = this.side; + result.name = this.name; + return result; + } + + @Override + public __struct__ getStruct(String fieldName) { + if (fieldName.equals("p")) { + return p; + } + return super.getStruct(fieldName); + } + + @Override + public void setStruct(String fieldName, __struct__ newData) { + if (fieldName.equals("p")) { + p.copyDataFrom(newData); + return; + } + super.setStruct(fieldName, newData); + } + + @Override + public boolean getBoolean(String fieldName) { + if (fieldName.equals("constrained")) { + return constrained != 0; + } + if (fieldName.equals("dyna")) { + return dyna != 0; + } + return super.getBoolean(fieldName); + } + + @Override + public void setBoolean(String fieldName, boolean data) { + if (fieldName.equals("constrained")) { + constrained = data ? 1 : 0; + return; + } + super.setBoolean(fieldName, data); + } + + @Override + public void setInt(String fieldName, int data) { + if (fieldName.equals("constrained")) { + constrained = data; + return; + } + super.setInt(fieldName, data); + } + + @Override + public int getInt(String fieldName) { + if (fieldName.equals("clip")) { + return clip; + } + if (fieldName.equals("order")) { + return order; + } + if (fieldName.equals("side")) { + return side; + } + return super.getInt(fieldName); + } + + public class Amp extends UnsupportedStarStruct { + } + + @Override + public StarStruct amp() { + return new Amp(); + } + + @Override + public __ptr__ getPtr(String fieldName) { + if (fieldName.equals("bp")) { + return bp; + } + return super.getPtr(fieldName); + } + + @Override + public void setDouble(String fieldName, double data) { + if (fieldName.equals("theta")) { + this.theta = data; + return; + } + super.setDouble(fieldName, data); + } + + @Override + public double getDouble(String fieldName) { + if (fieldName.equals("theta")) { + return theta; + } + return super.getDouble(fieldName); + } + + // "typedef struct port", + // "{", + // "pointf p", + // "double theta", + // "boxf *bp", + // "boolean defined", + // "boolean constrained", + // "boolean clip", + // "boolean dyna", + // "unsigned char order", + // "unsigned char side", + // "char *name", + // "}", + // "port"); +} + +// typedef struct port { /* internal edge endpoint specification */ +// pointf p; /* aiming point relative to node center */ +// double theta; /* slope in radians */ +// boxf *bp; /* if not null, points to bbox of +// * rectangular area that is port target +// */ +// boolean defined; /* if true, edge has port info at this end */ +// boolean constrained; /* if true, constraints such as theta are set */ +// boolean clip; /* if true, clip end to node/port shape */ +// boolean dyna; /* if true, assign compass point dynamically */ +// unsigned char order; /* for mincross */ +// unsigned char side; /* if port is on perimeter of node, this +// * contains the bitwise OR of the sides (TOP, +// * BOTTOM, etc.) it is on. +// */ +// char *name; /* port name, if it was explicitly given, otherwise NULL */ +// } port; \ No newline at end of file diff --git a/src/net/sourceforge/plantuml/ErrorUml.java b/src/net/sourceforge/plantuml/ErrorUml.java index 692560192..f1e25e4c6 100644 --- a/src/net/sourceforge/plantuml/ErrorUml.java +++ b/src/net/sourceforge/plantuml/ErrorUml.java @@ -80,11 +80,11 @@ public class ErrorUml { return type; } - private int getPosition() { + public final int getPosition() { return lineLocation.getPosition(); } - public LineLocation getLineLocation() { + public final LineLocation getLineLocation() { return lineLocation; } diff --git a/src/net/sourceforge/plantuml/Option.java b/src/net/sourceforge/plantuml/Option.java index e2566e090..e86c400dc 100644 --- a/src/net/sourceforge/plantuml/Option.java +++ b/src/net/sourceforge/plantuml/Option.java @@ -78,6 +78,7 @@ public class Option { private int nbThreads = 0; private int ftpPort = -1; private boolean hideMetadata = false; + private int imageIndex = 0; private File outputDir = null; private File outputFile = null; @@ -254,6 +255,7 @@ public class Option { } else if (s.equalsIgnoreCase("-word")) { OptionFlags.getInstance().setWord(true); OptionFlags.getInstance().setQuiet(true); + this.charset = "UTF-8"; } else if (s.equalsIgnoreCase("-quiet")) { OptionFlags.getInstance().setQuiet(true); } else if (s.equalsIgnoreCase("-decodeurl")) { @@ -308,6 +310,15 @@ public class Option { textProgressBar = true; } else if (s.equalsIgnoreCase("-nometadata")) { hideMetadata = true; + } else if (s.equalsIgnoreCase("-pipeimageindex")) { + i++; + if (i == arg.length) { + continue; + } + final String nb = arg[i]; + if (nb.matches("\\d+")) { + this.imageIndex = Integer.parseInt(nb); + } } else if (StringUtils.goLowerCase(s).startsWith("-ftp")) { final int x = s.indexOf(':'); if (x == -1) { @@ -533,4 +544,8 @@ public class Option { return pipeNoStdErr; } + public final int getImageIndex() { + return imageIndex; + } + } diff --git a/src/net/sourceforge/plantuml/OptionPrint.java b/src/net/sourceforge/plantuml/OptionPrint.java index 5d501ec44..07c52a78f 100644 --- a/src/net/sourceforge/plantuml/OptionPrint.java +++ b/src/net/sourceforge/plantuml/OptionPrint.java @@ -140,6 +140,7 @@ public class OptionPrint { System.out.println(" -loopstats\t\tTo continuously print statistics about usage"); System.out.println(" -splash\t\tTo display a splash screen with some progress bar"); System.out.println(" -progress\t\tTo display a textual progress bar in console"); + System.out.println(" -pipeimageindex N\tTo generate the Nth image with pipe option"); System.out.println(); System.out.println("If needed, you can setup the environment variable GRAPHVIZ_DOT."); exit(); diff --git a/src/net/sourceforge/plantuml/Pipe.java b/src/net/sourceforge/plantuml/Pipe.java index f4377ceed..592e810a3 100644 --- a/src/net/sourceforge/plantuml/Pipe.java +++ b/src/net/sourceforge/plantuml/Pipe.java @@ -63,7 +63,6 @@ public class Pipe { public boolean managePipe() throws IOException { boolean error = false; final boolean noStdErr = option.isPipeNoStdErr(); - do { final String source = readOneDiagram(); if (source == null) { @@ -93,7 +92,7 @@ public class Pipe { ps.println(result); } else { final OutputStream os = noStdErr ? new ByteArrayOutputStream() : ps; - final DiagramDescription result = sourceStringReader.outputImage(os, 0, option.getFileFormatOption()); + final DiagramDescription result = sourceStringReader.outputImage(os, option.getImageIndex(), option.getFileFormatOption()); if (result != null && "(error)".equalsIgnoreCase(result.getDescription())) { error = true; manageErrors(noStdErr ? ps : System.err, sourceStringReader); diff --git a/src/net/sourceforge/plantuml/SourceFileReader.java b/src/net/sourceforge/plantuml/SourceFileReader.java index aa25c1323..434ca2ea7 100644 --- a/src/net/sourceforge/plantuml/SourceFileReader.java +++ b/src/net/sourceforge/plantuml/SourceFileReader.java @@ -199,7 +199,7 @@ public class SourceFileReader implements ISourceFileReader { try { os = new BufferedOutputStream(new FileOutputStream(suggested.getFile(0))); UmlDiagram.exportDiagramError(os, t, fileFormatOption, 42, null, blockUml.getFlashData(), - UmlDiagram.getFailureText2(t)); + UmlDiagram.getFailureText2(t, blockUml.getFlashData())); } finally { if (os != null) { os.close(); @@ -264,5 +264,4 @@ public class SourceFileReader implements ISourceFileReader { return builder.getIncludedFiles(); } - } diff --git a/src/net/sourceforge/plantuml/UmlDiagram.java b/src/net/sourceforge/plantuml/UmlDiagram.java index 88ce881d2..7ef34c0c6 100644 --- a/src/net/sourceforge/plantuml/UmlDiagram.java +++ b/src/net/sourceforge/plantuml/UmlDiagram.java @@ -249,7 +249,7 @@ public abstract class UmlDiagram extends AbstractPSystem implements Diagram, Ann private void exportDiagramError(OutputStream os, Throwable exception, FileFormatOption fileFormat, long seed, String graphvizVersion) throws IOException { exportDiagramError(os, exception, fileFormat, seed, getMetadata(), getFlashData(), - getFailureText1(exception, graphvizVersion)); + getFailureText1(exception, graphvizVersion, getFlashData())); } public static void exportDiagramError(OutputStream os, Throwable exception, FileFormatOption fileFormat, long seed, @@ -309,8 +309,8 @@ public abstract class UmlDiagram extends AbstractPSystem implements Diagram, Ann return source.getPlainString(); } - static private List getFailureText1(Throwable exception, String graphvizVersion) { - final List strings = GraphvizCrash.anErrorHasOccured(exception); + static private List getFailureText1(Throwable exception, String graphvizVersion, String textDiagram) { + final List strings = GraphvizCrash.anErrorHasOccured(exception, textDiagram); strings.add("PlantUML (" + Version.versionString() + ") cannot parse result from dot/GraphViz."); if (exception instanceof EmptySvgException) { strings.add("Because dot/GraphViz returns an empty string."); @@ -330,8 +330,8 @@ public abstract class UmlDiagram extends AbstractPSystem implements Diagram, Ann return strings; } - public static List getFailureText2(Throwable exception) { - final List strings = GraphvizCrash.anErrorHasOccured(exception); + public static List getFailureText2(Throwable exception, String textDiagram) { + final List strings = GraphvizCrash.anErrorHasOccured(exception, textDiagram); strings.add("PlantUML (" + Version.versionString() + ") has crashed."); GraphvizCrash.checkOldVersionWarning(strings); strings.add(" "); diff --git a/src/net/sourceforge/plantuml/activitydiagram3/InstructionIf.java b/src/net/sourceforge/plantuml/activitydiagram3/InstructionIf.java index 0361f4e9e..3d6c7cfb0 100644 --- a/src/net/sourceforge/plantuml/activitydiagram3/InstructionIf.java +++ b/src/net/sourceforge/plantuml/activitydiagram3/InstructionIf.java @@ -149,7 +149,7 @@ public class InstructionIf extends WithNote implements Instruction, InstructionC if (branch.getLast().kill() == false) { return false; } - if (elseBranch != null && elseBranch.getLast().kill() == false) { + if (elseBranch != null && elseBranch.getLast()!=null && elseBranch.getLast().kill() == false) { return false; } return true; diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java index d7e1fa97b..4e4f20db0 100644 --- a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java +++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClass.java @@ -59,6 +59,7 @@ import net.sourceforge.plantuml.graphic.color.Colors; public class CommandCreateClass extends SingleLineCommand2 { + public static final String DISPLAY_WITH_GENERIC = "[%g](.+?)(?:\\<(" + GenericRegexProducer.PATTERN + ")\\>)?[%g]"; public static final String CODE = "[^%s{}%g<>]+"; public static final String CODE_NO_DOTDOT = "[^%s{}%g<>:]+"; @@ -76,13 +77,13 @@ public class CommandCreateClass extends SingleLineCommand2 { "(interface|enum|annotation|abstract[%s]+class|abstract|class|entity|circle)[%s]+"), // new RegexOr(// new RegexConcat(// - new RegexLeaf("DISPLAY1", "[%g](.+)[%g]"), // + new RegexLeaf("DISPLAY1", DISPLAY_WITH_GENERIC), // new RegexLeaf("[%s]+as[%s]+"), // new RegexLeaf("CODE1", "(" + CODE + ")")), // new RegexConcat(// new RegexLeaf("CODE2", "(" + CODE + ")"), // new RegexLeaf("[%s]+as[%s]+"), // // - new RegexLeaf("DISPLAY2", "[%g](.+)[%g]")), // + new RegexLeaf("DISPLAY2", DISPLAY_WITH_GENERIC)), // new RegexLeaf("CODE3", "(" + CODE + ")"), // new RegexLeaf("CODE4", "[%g]([^%g]+)[%g]")), // new RegexLeaf("GENERIC", "(?:[%s]*\\<(" + GenericRegexProducer.PATTERN + ")\\>)?"), // @@ -108,9 +109,10 @@ public class CommandCreateClass extends SingleLineCommand2 { final LeafType type = LeafType.getLeafType(StringUtils.goUpperCase(arg.get("TYPE", 0))); final Code code = Code.of(arg.getLazzy("CODE", 0)).eventuallyRemoveStartingAndEndingDoubleQuote("\"([:"); final String display = arg.getLazzy("DISPLAY", 0); + final String genericOption = arg.getLazzy("DISPLAY", 1); + final String generic = genericOption != null ? genericOption : arg.get("GENERIC", 0); final String stereotype = arg.get("STEREO", 0); - final String generic = arg.get("GENERIC", 0); final ILeaf entity; if (diagram.leafExist(code)) { entity = diagram.getOrCreateLeaf(code, type, null); diff --git a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java index 13183be24..cbdab30ae 100644 --- a/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java +++ b/src/net/sourceforge/plantuml/classdiagram/command/CommandCreateClassMultilines.java @@ -89,13 +89,13 @@ public class CommandCreateClassMultilines extends CommandMultilines2)?"), // @@ -189,9 +189,10 @@ public class CommandCreateClassMultilines extends CommandMultilines2 { return EntityGenderUtils.emptyFields(); } if (portion == PORTION_MEMBER) { - return EntityGenderUtils.emptyMembers(); + throw new IllegalArgumentException(); + // return EntityGenderUtils.emptyMembers(); } return EntityGenderUtils.all(); } @@ -169,13 +170,22 @@ public class CommandHideShowByGender extends SingleLineCommand2 { } if (gender != null) { final boolean empty = arg.get("EMPTY", 0) != null; - if (empty == true) { + final boolean emptyMembers = empty && portion == PORTION_MEMBER; + if (empty == true && emptyMembers == false) { gender = EntityGenderUtils.and(gender, emptyByGender(portion)); } if (EntityUtils.groupRoot(classDiagram.getCurrentGroup()) == false) { gender = EntityGenderUtils.and(gender, EntityGenderUtils.byPackage(classDiagram.getCurrentGroup())); } - classDiagram.hideOrShow(gender, portion, arg.get("COMMAND", 0).equalsIgnoreCase("show")); + + if (emptyMembers) { + classDiagram.hideOrShow(EntityGenderUtils.and(gender, emptyByGender(PORTION_FIELD)), PORTION_FIELD, arg + .get("COMMAND", 0).equalsIgnoreCase("show")); + classDiagram.hideOrShow(EntityGenderUtils.and(gender, emptyByGender(PORTION_METHOD)), PORTION_METHOD, + arg.get("COMMAND", 0).equalsIgnoreCase("show")); + } else { + classDiagram.hideOrShow(gender, portion, arg.get("COMMAND", 0).equalsIgnoreCase("show")); + } } return CommandExecutionResult.ok(); } diff --git a/src/net/sourceforge/plantuml/classdiagram/command/GenericRegexProducer.java b/src/net/sourceforge/plantuml/classdiagram/command/GenericRegexProducer.java index 6b4495255..2c0ccc105 100644 --- a/src/net/sourceforge/plantuml/classdiagram/command/GenericRegexProducer.java +++ b/src/net/sourceforge/plantuml/classdiagram/command/GenericRegexProducer.java @@ -38,10 +38,10 @@ package net.sourceforge.plantuml.classdiagram.command; public class GenericRegexProducer { - public final static String PATTERN = "[^\\<\\>]" + getGenericRegex(4); + public final static String PATTERN = "[^\\<\\>/]" + getGenericRegex(4); // \<[^\<\>]([^\<\>]|\<\>)*\> - static final private String part1 = "(?:[^\\<\\>]|\\<"; + static final private String part1 = "(?:[^\\<\\>/]|\\<"; static final private String part2 = "\\>)*"; static String getGenericRegex(int level) { diff --git a/src/net/sourceforge/plantuml/cucadiagram/EntityGenderUtils.java b/src/net/sourceforge/plantuml/cucadiagram/EntityGenderUtils.java index 9e7ad7b55..06fe9df41 100644 --- a/src/net/sourceforge/plantuml/cucadiagram/EntityGenderUtils.java +++ b/src/net/sourceforge/plantuml/cucadiagram/EntityGenderUtils.java @@ -113,13 +113,13 @@ public class EntityGenderUtils { }; } - static public EntityGender emptyMembers() { - return new EntityGender() { - public boolean contains(IEntity test) { - return test.getBodier().getMethodsToDisplay().size() == 0 - && test.getBodier().getFieldsToDisplay().size() == 0; - } - }; - } +// static public EntityGender emptyMembers() { +// return new EntityGender() { +// public boolean contains(IEntity test) { +// return test.getBodier().getMethodsToDisplay().size() == 0 +// && test.getBodier().getFieldsToDisplay().size() == 0; +// } +// }; +// } } diff --git a/src/net/sourceforge/plantuml/descdiagram/DescriptionDiagramFactory.java b/src/net/sourceforge/plantuml/descdiagram/DescriptionDiagramFactory.java index 224359015..75b380b94 100644 --- a/src/net/sourceforge/plantuml/descdiagram/DescriptionDiagramFactory.java +++ b/src/net/sourceforge/plantuml/descdiagram/DescriptionDiagramFactory.java @@ -51,6 +51,7 @@ import net.sourceforge.plantuml.command.note.FactoryNoteOnEntityCommand; import net.sourceforge.plantuml.command.note.FactoryNoteOnLinkCommand; import net.sourceforge.plantuml.command.regex.RegexLeaf; import net.sourceforge.plantuml.command.regex.RegexOr; +import net.sourceforge.plantuml.descdiagram.command.CommandArchimate; import net.sourceforge.plantuml.descdiagram.command.CommandCreateElementFull; import net.sourceforge.plantuml.descdiagram.command.CommandCreateElementMultilines; import net.sourceforge.plantuml.descdiagram.command.CommandLinkElement; @@ -111,6 +112,8 @@ public class DescriptionDiagramFactory extends UmlDiagramFactory { cmds.add(new CommandHideShowSpecificClass()); + cmds.add(new CommandArchimate()); + return cmds; } diff --git a/src/net/sourceforge/plantuml/descdiagram/command/CommandArchimate.java b/src/net/sourceforge/plantuml/descdiagram/command/CommandArchimate.java new file mode 100644 index 000000000..0e4c6de4e --- /dev/null +++ b/src/net/sourceforge/plantuml/descdiagram/command/CommandArchimate.java @@ -0,0 +1,127 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * (C) Copyright 2009-2017, Arnaud Roques + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of PlantUML. + * + * PlantUML is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * PlantUML distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + * License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. + * + * + * Original Author: Arnaud Roques + * + * + */ +package net.sourceforge.plantuml.descdiagram.command; + +import net.sourceforge.plantuml.FontParam; +import net.sourceforge.plantuml.StringUtils; +import net.sourceforge.plantuml.command.CommandExecutionResult; +import net.sourceforge.plantuml.command.SingleLineCommand2; +import net.sourceforge.plantuml.command.regex.RegexConcat; +import net.sourceforge.plantuml.command.regex.RegexLeaf; +import net.sourceforge.plantuml.command.regex.RegexOr; +import net.sourceforge.plantuml.command.regex.RegexResult; +import net.sourceforge.plantuml.cucadiagram.Code; +import net.sourceforge.plantuml.cucadiagram.Display; +import net.sourceforge.plantuml.cucadiagram.IEntity; +import net.sourceforge.plantuml.cucadiagram.LeafType; +import net.sourceforge.plantuml.cucadiagram.Stereotype; +import net.sourceforge.plantuml.descdiagram.DescriptionDiagram; +import net.sourceforge.plantuml.graphic.USymbol; +import net.sourceforge.plantuml.graphic.color.ColorParser; +import net.sourceforge.plantuml.graphic.color.ColorType; +import net.sourceforge.plantuml.graphic.color.Colors; + +public class CommandArchimate extends SingleLineCommand2 { + + public CommandArchimate() { + super(getRegexConcat()); + } + + private static RegexConcat getRegexConcat() { + return new RegexConcat(new RegexLeaf("^"), // + new RegexLeaf("SYMBOL", "archimate"), // + new RegexLeaf("[%s]+"), // + color().getRegex(), // + new RegexLeaf("[%s]+"), // + new RegexOr(// + new RegexLeaf("CODE1", CommandCreateElementFull.CODE_WITH_QUOTE), // + new RegexConcat(// + new RegexLeaf("DISPLAY2", CommandCreateElementFull.DISPLAY), // + new RegexLeaf("STEREOTYPE2", "(?:[%s]+(?:\\<\\<([-\\w]+)\\>\\>))?"), // + new RegexLeaf("[%s]*as[%s]+"), // + new RegexLeaf("CODE2", CommandCreateElementFull.CODE)), // + new RegexConcat(// + new RegexLeaf("CODE3", CommandCreateElementFull.CODE), // + new RegexLeaf("STEREOTYPE3", "(?:[%s]+(?:\\<\\<([-\\w]+)\\>\\>))?"), // + new RegexLeaf("[%s]+as[%s]*"), // + new RegexLeaf("DISPLAY3", CommandCreateElementFull.DISPLAY)), // + new RegexConcat(// + new RegexLeaf("DISPLAY4", CommandCreateElementFull.DISPLAY_WITHOUT_QUOTE), // + new RegexLeaf("STEREOTYPE4", "(?:[%s]+(?:\\<\\<([-\\w]+)\\>\\>))?"), // + new RegexLeaf("[%s]*as[%s]+"), // + new RegexLeaf("CODE4", CommandCreateElementFull.CODE)) // + ), // + new RegexLeaf("[%s]*"), // + new RegexLeaf("STEREOTYPE", "(?:[%s]*(?:\\<\\<([-\\w]+)\\>\\>))?"), // + new RegexLeaf("$")); + } + + private static ColorParser color() { + return ColorParser.simpleColor(ColorType.BACK); + } + + @Override + protected CommandExecutionResult executeArg(DescriptionDiagram diagram, RegexResult arg) { + final String codeRaw = arg.getLazzy("CODE", 0); + + final Code code = Code.of(StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(codeRaw)); + final String icon = arg.getLazzy("STEREOTYPE", 0); + + final IEntity entity = diagram.getOrCreateLeaf(code, LeafType.DESCRIPTION, USymbol.RECTANGLE); + + final String displayRaw = arg.getLazzy("DISPLAY", 0); + + String display = displayRaw; + if (display == null) { + display = code.getFullName(); + } + display = StringUtils.eventuallyRemoveStartingAndEndingDoubleQuote(display); + + entity.setDisplay(Display.getWithNewlines(display)); + entity.setUSymbol(USymbol.RECTANGLE); + if (icon != null) { + entity.setStereotype(new Stereotype("<<$archimate/" + icon + ">>", diagram.getSkinParam() + .getCircledCharacterRadius(), diagram.getSkinParam().getFont(null, false, + FontParam.CIRCLED_CHARACTER), diagram.getSkinParam().getIHtmlColorSet())); + } + + Colors colors = color().getColor(arg, diagram.getSkinParam().getIHtmlColorSet()); + entity.setColors(colors); + + return CommandExecutionResult.ok(); + } + +} diff --git a/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementFull.java b/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementFull.java index 0f2a915f4..7ca1125da 100644 --- a/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementFull.java +++ b/src/net/sourceforge/plantuml/descdiagram/command/CommandCreateElementFull.java @@ -61,7 +61,7 @@ import net.sourceforge.plantuml.graphic.color.Colors; public class CommandCreateElementFull extends SingleLineCommand2 { - public static final String ALL_TYPES = "artifact|actor|folder|card|file|package|rectangle|node|frame|cloud|database|queue|stack|storage|agent|usecase|component|boundary|control|entity|interface"; + public static final String ALL_TYPES = "artifact|actor|folder|card|file|package|rectangle|node|frame|cloud|database|queue|stack|storage|agent|usecase|component|boundary|control|entity|interface|circle"; public CommandCreateElementFull() { super(getRegexConcat()); @@ -70,6 +70,7 @@ public class CommandCreateElementFull extends SingleLineCommand2 bb = data.getStruct("bb"); - final double llx = bb.getStruct("LL").getDouble("x"); - double lly = bb.getStruct("LL").getDouble("y"); - final double urx = bb.getStruct("UR").getDouble("x"); - double ury = bb.getStruct("UR").getDouble("y"); + final ST_boxf bb = (ST_boxf) data.getStruct("bb"); + final double llx = bb.LL.x; + double lly = bb.LL.y; + final double urx = bb.UR.x; + double ury = bb.UR.y; if (ymirror != null) { final double tmpUry = ury; ury = ymirror.getMirrored(lly); @@ -293,6 +294,7 @@ public class CucaDiagramFileMakerJDot implements CucaDiagramFileMaker { private void exportEntity(Agraph_s g, ILeaf leaf) { final Shape shape = dotStringFactory.getBibliotekon().getShape(leaf); + // System.err.println("exportEntity " + leaf); final Agnode_s node = agnode(g, new CString(shape.getUid()), true); agsafeset(node, new CString("shape"), new CString("box"), new CString("")); final String width = "" + (shape.getWidth() / 72); @@ -521,6 +523,7 @@ public class CucaDiagramFileMakerJDot implements CucaDiagramFileMaker { return null; } final Agedge_s e = agedge(g, n, m, null, true); + // System.err.println("createEdge " + link); agsafeset(e, new CString("arrowtail"), new CString("none"), new CString("")); agsafeset(e, new CString("arrowhead"), new CString("none"), new CString("")); diff --git a/src/net/sourceforge/plantuml/jdot/JDotPath.java b/src/net/sourceforge/plantuml/jdot/JDotPath.java index 2995d587f..9c5cc1d44 100644 --- a/src/net/sourceforge/plantuml/jdot/JDotPath.java +++ b/src/net/sourceforge/plantuml/jdot/JDotPath.java @@ -112,11 +112,13 @@ public class JDotPath implements UDrawable { } DotPath dotPath = getDotPath(edge); - if (ymirror != null) { + if (ymirror != null && dotPath != null) { dotPath = ymirror.getMirrored(dotPath); } - ug.apply(new UChangeColor(color)).draw(dotPath); + if (dotPath != null) { + ug.apply(new UChangeColor(color)).draw(dotPath); + } if (getLabelRectangleTranslate() != null) { label.drawU(ug.apply(getLabelRectangleTranslate())); } @@ -190,6 +192,10 @@ public class JDotPath implements UDrawable { } private DotPath getDotPath(splines splines) { + if (splines == null) { + System.err.println("ERROR, no splines for getDotPath"); + return null; + } DotPath result = new DotPath(); final bezier beziers = (bezier) splines.getPtr("list"); final Point2D pt1 = getPoint(splines, 0); diff --git a/src/net/sourceforge/plantuml/preproc/Defines.java b/src/net/sourceforge/plantuml/preproc/Defines.java index 3fba2b6cf..fd3b69ef9 100644 --- a/src/net/sourceforge/plantuml/preproc/Defines.java +++ b/src/net/sourceforge/plantuml/preproc/Defines.java @@ -88,10 +88,20 @@ public class Defines implements Truth { final Defines result = createEmpty(); result.environment.put("filedate", new Date(file.lastModified()).toString()); result.environment.put("filename", file.getName()); + result.environment.put("filenameNoExtension", nameNoExtension(file)); result.environment.put("dirpath", file.getAbsoluteFile().getParentFile().getAbsolutePath().replace('\\', '/')); return result; } + private static String nameNoExtension(File file) { + final String name = file.getName(); + final int x = name.lastIndexOf('.'); + if (x == -1) { + return name; + } + return name.substring(0, x); + } + public void define(String name, List value, boolean emptyParentheses) { values.put(name, new Define(name, value, emptyParentheses)); } diff --git a/src/net/sourceforge/plantuml/preproc/Variables.java b/src/net/sourceforge/plantuml/preproc/Variables.java index 9a31b030e..d916c57cc 100644 --- a/src/net/sourceforge/plantuml/preproc/Variables.java +++ b/src/net/sourceforge/plantuml/preproc/Variables.java @@ -83,6 +83,7 @@ public class Variables { final StringBuilder regex = new StringBuilder("\\b" + fonctionName + "\\("); final List variables = all; + boolean appended = false; for (int j = 0; j < variables.size(); j++) { final DefineVariable variable = variables.get(j); final String varName = variable.getName(); @@ -93,11 +94,14 @@ public class Variables { final int i = 1 + 3 * j; newValue = newValue.replaceAll(var2, "\\$" + i + "\\$" + (i + 1) + "\\$" + (i + 2)); regex.append(","); + appended = true; } else { newValue = newValue.replaceAll(var2, Matcher.quoteReplacement(variable.getDefaultValue())); } } - regex.setLength(regex.length() - 1); + if (appended == true) { + regex.setLength(regex.length() - 1); + } regex.append("\\)"); // System.err.println("regex=" + regex); // System.err.println("newValue=" + newValue); diff --git a/src/net/sourceforge/plantuml/svek/GraphvizCrash.java b/src/net/sourceforge/plantuml/svek/GraphvizCrash.java index 0a75e849d..7a82d6555 100644 --- a/src/net/sourceforge/plantuml/svek/GraphvizCrash.java +++ b/src/net/sourceforge/plantuml/svek/GraphvizCrash.java @@ -40,6 +40,7 @@ import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.List; +import net.sourceforge.plantuml.BackSlash; import net.sourceforge.plantuml.Dimension2DDouble; import net.sourceforge.plantuml.OptionPrint; import net.sourceforge.plantuml.StringUtils; @@ -63,15 +64,17 @@ public class GraphvizCrash extends AbstractTextBlock implements IEntityImage { private final TextBlockBackcolored graphicStrings; private final BufferedImage flashCode; + private final String text; public GraphvizCrash(String text) { + this.text = text; final FlashCodeUtils utils = FlashCodeFactory.getFlashCodeUtils(); - flashCode = utils.exportFlashcode(text); + this.flashCode = utils.exportFlashcode(text); this.graphicStrings = GraphicStrings.createBlackOnWhite(init(), IconLoader.getRandom(), GraphicPosition.BACKGROUND_CORNER_TOP_RIGHT); } - public static List anErrorHasOccured(Throwable exception) { + public static List anErrorHasOccured(Throwable exception, String text) { final List strings = new ArrayList(); if (exception == null) { strings.add("An error has occured!"); @@ -81,9 +84,21 @@ public class GraphvizCrash extends AbstractTextBlock implements IEntityImage { final String quote = StringUtils.rot(QuoteUtils.getSomeQuote()); strings.add("" + quote); strings.add(" "); + strings.add("Diagram size: " + lines(text) + " lines / " + text.length() + " characters."); + strings.add(" "); return strings; } + private static int lines(String text) { + int result = 0; + for (int i = 0; i < text.length(); i++) { + if (text.charAt(i) == BackSlash.CHAR_NEWLINE) { + result++; + } + } + return result; + } + public static void checkOldVersionWarning(final List strings) { final long days = (System.currentTimeMillis() - Version.compileTime()) / 1000L / 3600 / 24; if (days >= 90) { @@ -111,7 +126,7 @@ public class GraphvizCrash extends AbstractTextBlock implements IEntityImage { } private List init() { - final List strings = anErrorHasOccured(null); + final List strings = anErrorHasOccured(null, text); strings.add("For some reason, dot/Graphviz has crashed."); strings.add("This has been generated with PlantUML (" + Version.versionString() + ")."); checkOldVersionWarning(strings); diff --git a/src/net/sourceforge/plantuml/svg/SvgGraphics.java b/src/net/sourceforge/plantuml/svg/SvgGraphics.java index 9b9b20b15..b41e76f1a 100644 --- a/src/net/sourceforge/plantuml/svg/SvgGraphics.java +++ b/src/net/sourceforge/plantuml/svg/SvgGraphics.java @@ -448,6 +448,10 @@ public class SvgGraphics { fontFamily = "monospace"; } elt.setAttribute("font-family", fontFamily); + + if (fontFamily.equalsIgnoreCase("monospace") || fontFamily.equalsIgnoreCase("courier")) { + text = text.replace(' ', (char) 160); + } } if (textBackColor != null) { final String backFilterId = getFilterBackColor(textBackColor); diff --git a/src/net/sourceforge/plantuml/syntax/LanguageDescriptor.java b/src/net/sourceforge/plantuml/syntax/LanguageDescriptor.java index 58831564c..f4dfb0a1d 100644 --- a/src/net/sourceforge/plantuml/syntax/LanguageDescriptor.java +++ b/src/net/sourceforge/plantuml/syntax/LanguageDescriptor.java @@ -78,6 +78,7 @@ public class LanguageDescriptor { type.add("file"); type.add("package"); type.add("queue"); + type.add("archimate"); keyword.add("@startuml"); keyword.add("@enduml"); diff --git a/src/net/sourceforge/plantuml/timingdiagram/Histogram.java b/src/net/sourceforge/plantuml/timingdiagram/Histogram.java index e459f4c59..af319f447 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/Histogram.java +++ b/src/net/sourceforge/plantuml/timingdiagram/Histogram.java @@ -80,6 +80,9 @@ public class Histogram implements TimeDrawing { public IntricatedPoint getTimeProjection(StringBounder stringBounder, TimeTick tick) { final double x = ruler.getPosInPixel(tick); final List states = getStatesAt(tick); + if (states.size() == 0) { + return null; + } if (states.size() == 1) { final double y = getStateYFor(states.get(0)); return new IntricatedPoint(new Point2D.Double(x, y), new Point2D.Double(x, y)); @@ -96,6 +99,9 @@ public class Histogram implements TimeDrawing { } private List getStatesAt(TimeTick tick) { + if (changes.size() == 0) { + return Collections.emptyList(); + } for (int i = 0; i < changes.size(); i++) { if (changes.get(i).getWhen().compareTo(tick) == 0) { if (i == 0 && initialState == null) { @@ -138,8 +144,12 @@ public class Histogram implements TimeDrawing { public void drawU(UGraphic ug) { ug = getContext().apply(ug); final UTranslate deltaY = new UTranslate(0, getFullDeltaY()); + if (changes.size() == 0) { + return; + } if (initialState != null) { - drawHLine(ug, getInitialPoint(), getInitialWidth()); + final Point2D pt = getPoint(0); + drawHLine(ug, getInitialPoint(), getInitialWidth() + pt.getX()); } for (int i = 0; i < changes.size() - 1; i++) { final Point2D pt = getPoint(i); diff --git a/src/net/sourceforge/plantuml/timingdiagram/Player.java b/src/net/sourceforge/plantuml/timingdiagram/Player.java index 0816c1849..fb5c775b2 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/Player.java +++ b/src/net/sourceforge/plantuml/timingdiagram/Player.java @@ -184,6 +184,9 @@ public class Player implements TextBlock, TimeProjected { public IntricatedPoint getTimeProjection(StringBounder stringBounder, TimeTick tick) { final IntricatedPoint point = getTimeDrawing().getTimeProjection(stringBounder, tick); + if (point == null) { + return null; + } final UTranslate translation = getTranslateForTimeDrawing(stringBounder); return point.translated(translation); } diff --git a/src/net/sourceforge/plantuml/timingdiagram/TimingDiagram.java b/src/net/sourceforge/plantuml/timingdiagram/TimingDiagram.java index 0410d4279..6e6037e52 100644 --- a/src/net/sourceforge/plantuml/timingdiagram/TimingDiagram.java +++ b/src/net/sourceforge/plantuml/timingdiagram/TimingDiagram.java @@ -146,6 +146,10 @@ public class TimingDiagram extends UmlDiagram implements Clock { final IntricatedPoint pt1 = player1.getTimeProjection(ug.getStringBounder(), message.getTick1()); final IntricatedPoint pt2 = player2.getTimeProjection(ug.getStringBounder(), message.getTick2()); + if (pt1 == null || pt2 == null) { + return; + } + final TimeArrow timeArrow = TimeArrow.create(pt1.translated(translate1), pt2.translated(translate2), message.getLabel(), getSkinParam()); timeArrow.drawU(ug); diff --git a/src/net/sourceforge/plantuml/version/Version.java b/src/net/sourceforge/plantuml/version/Version.java index 75973bc10..702e4de26 100644 --- a/src/net/sourceforge/plantuml/version/Version.java +++ b/src/net/sourceforge/plantuml/version/Version.java @@ -43,7 +43,7 @@ public class Version { private static final int MAJOR_SEPARATOR = 1000000; public static int version() { - return 1201714; + return 1201715; } public static int versionPatched() { @@ -88,7 +88,7 @@ public class Version { } public static long compileTime() { - return 1496656592758L; + return 1499100334843L; } public static String compileTimeString() { diff --git a/src/smetana/core/HardcodedStruct.java b/src/smetana/core/HardcodedStruct.java new file mode 100644 index 000000000..3487ca419 --- /dev/null +++ b/src/smetana/core/HardcodedStruct.java @@ -0,0 +1,43 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of Smetana. + * Smetana is a partial translation of Graphviz/Dot sources from C to Java. + * + * (C) Copyright 2009-2017, Arnaud Roques + * + * This translation is distributed under the same Licence as the original C program. + * + * THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC + * LICENSE ("AGREEMENT"). [Eclipse Public License - v 1.0] + * + * ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES + * RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + * + * You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package smetana.core; + +public interface HardcodedStruct { + + public void copyDataFrom(__struct__ newData); + +} diff --git a/src/smetana/core/JUtils.java b/src/smetana/core/JUtils.java index 082395b01..e409d3810 100644 --- a/src/smetana/core/JUtils.java +++ b/src/smetana/core/JUtils.java @@ -36,17 +36,42 @@ package smetana.core; +import h.Agdesc_s; import h.Agedge_s; import h.Agedgeinfo_t; +import h.Agiddisc_s; +import h.Agmemdisc_s; +import h.Agtag_s; +import h.ST_Agdesc_s; +import h.ST_Agiddisc_s; +import h.ST_Agmemdisc_s; +import h.ST_Agtag_s; +import h.ST_arrowname_t; +import h.ST_arrowtype_t; +import h.ST_boxf; +import h.ST_dtdisc_s; +import h.ST_dtmethod_s; +import h.ST_elist; +import h.ST_nlist_t; +import h.ST_pointf; +import h.ST_port; +import h._dtdisc_s; +import h._dtmethod_s; +import h.arrowname_t; +import h.arrowtype_t; import h.bezier; import h.boxf; +import h.elist; +import h.nlist_t; import h.pointf; +import h.port; import h.splines; import smetana.core.amiga.StarArrayOfInteger; import smetana.core.amiga.StarArrayOfPtr; import smetana.core.amiga.StarArrayOfStruct; import smetana.core.amiga.StarStar; import smetana.core.amiga.StarStruct; +import smetana.core.amiga.StarStructImpl; // http://docs.oracle.com/javase/specs/jls/se5.0/html/expressions.html#15.7.4 // http://www.jbox.dk/sanos/source/lib/string.c.html @@ -245,12 +270,12 @@ public class JUtils { } return EQ(o1b, o2b); } - if (o1 instanceof StarArrayOfStruct && o2 instanceof StarArrayOfStruct) { + if (o1 instanceof StarArrayOfStruct && o2 instanceof StarArrayOfStruct) { StarArrayOfStruct oo1 = (StarArrayOfStruct) o1; StarArrayOfStruct oo2 = (StarArrayOfStruct) o2; return oo1.isSameThan(oo2); } - if (o1 instanceof StarArrayOfPtr && o2 instanceof StarArrayOfStruct) { + if (o1 instanceof StarArrayOfPtr && o2 instanceof StarArrayOfStruct) { StarArrayOfPtr oo1 = (StarArrayOfPtr) o1; StarArrayOfStruct oo2 = (StarArrayOfStruct) o2; __struct__ s1 = oo1.getStruct(); @@ -361,4 +386,90 @@ public class JUtils { return sb.toString(); } + public static __struct__ from(Class theClass) { + if (theClass == _dtmethod_s.class) { + return new ST_dtmethod_s(); + } + if (theClass == _dtdisc_s.class) { + return new ST_dtdisc_s(); + } + if (theClass == Agdesc_s.class) { + return new ST_Agdesc_s(); + } + if (theClass == Agtag_s.class) { + return new ST_Agtag_s(); + } + if (theClass == Agiddisc_s.class) { + return new ST_Agiddisc_s(); + } + if (theClass == Agmemdisc_s.class) { + return new ST_Agmemdisc_s(); + } + if (theClass == nlist_t.class) { + return new ST_nlist_t(); + } + if (theClass == arrowname_t.class) { + return new ST_arrowname_t(); + } + if (theClass == arrowtype_t.class) { + return new ST_arrowtype_t(); + } + if (theClass == elist.class) { + return new ST_elist(); + } + if (theClass == pointf.class) { + return new ST_pointf(); + } + if (theClass == boxf.class) { + return new ST_boxf(); + } + if (theClass == port.class) { + return new ST_port(); + } + return new __struct_impl__(theClass); + } + + public static StarStruct create(Class theClass, StarStruct parent) { + if (theClass == _dtmethod_s.class) { + throw new IllegalArgumentException(theClass.toString()); + } + if (theClass == _dtdisc_s.class) { + return new ST_dtdisc_s(parent); + } + if (theClass == Agdesc_s.class) { + return new ST_Agdesc_s(parent); + } + if (theClass == Agtag_s.class) { + return new ST_Agtag_s(parent); + } + if (theClass == Agiddisc_s.class) { + throw new IllegalArgumentException(theClass.toString()); + } + if (theClass == Agmemdisc_s.class) { + throw new IllegalArgumentException(theClass.toString()); + } + if (theClass == nlist_t.class) { + return new ST_nlist_t(parent); + } + if (theClass == arrowname_t.class) { + throw new IllegalArgumentException(theClass.toString()); + } + if (theClass == arrowtype_t.class) { + throw new IllegalArgumentException(theClass.toString()); + } + if (theClass == elist.class) { + return new ST_elist(parent); + } + if (theClass == pointf.class) { + return new ST_pointf(parent); + } + if (theClass == boxf.class) { + return new ST_boxf(parent); + } + if (theClass == port.class) { + return new ST_port(parent); + } + return new StarStructImpl(theClass, parent); + } + } diff --git a/src/smetana/core/Macro.java b/src/smetana/core/Macro.java index 06ae84614..097a91309 100644 --- a/src/smetana/core/Macro.java +++ b/src/smetana/core/Macro.java @@ -43,11 +43,14 @@ import h.Agnodeinfo_t; import h.Agobj_s; import h.Agraph_s; import h.Agraphinfo_t; -import h.Agtag_s; import h.GVC_s; -import h.boxf; +import h.ST_Agtag_s; +import h.ST_boxf; +import h.ST_elist; +import h.ST_nlist_t; +import h.ST_pointf; +import h.ST_port; import h.elist; -import h.nlist_t; // http://docs.oracle.com/javase/specs/jls/se5.0/html/expressions.html#15.7.4 // http://www.jbox.dk/sanos/source/lib/string.c.html import h.pointf; @@ -132,35 +135,35 @@ public class Macro { public final static int AGEDGE = AGOUTEDGE; // #define AGTAG(obj) (((Agobj_t*)(obj))->tag) - public static __struct__ AGTAG(__ptr__ obj) { - return obj.castTo(Agobj_s.class).getStruct("tag"); + public static ST_Agtag_s AGTAG(__ptr__ obj) { + return (ST_Agtag_s) obj.castTo(Agobj_s.class).getStruct("tag"); } // #define AGTYPE(obj) (AGTAG(obj).objtype) public static int AGTYPE(__ptr__ obj) { - return AGTAG(obj).getInt("objtype"); + return AGTAG(obj).objtype; } public static void AGTYPE(__ptr__ obj, int v) { - AGTAG(obj).setInt("objtype", v); + AGTAG(obj).objtype = v; } // #define AGID(obj) (AGTAG(obj).id) public static int AGID(__ptr__ obj) { - return AGTAG(obj).getInt("id"); + return AGTAG(obj).id; } public static void AGID(__ptr__ obj, int v) { - AGTAG(obj).setInt("id", v); + AGTAG(obj).id = v; } // #define AGSEQ(obj) (AGTAG(obj).seq) public static int AGSEQ(__ptr__ obj) { - return AGTAG(obj).getInt("seq"); + return AGTAG(obj).seq; } public static void AGSEQ(__ptr__ obj, int v) { - AGTAG(obj).setInt("seq", v); + AGTAG(obj).seq = v; } // #define AGATTRWF(obj) (AGTAG(obj).attrwf) @@ -294,8 +297,8 @@ public class Macro { } // #define GD_bb(g) (((Agraphinfo_t*)AGDATA(g))->bb) - public static __struct__ GD_bb(__ptr__ g) { - return AGDATA(g).castTo(Agraphinfo_t.class).getStruct("bb"); + public static ST_boxf GD_bb(__ptr__ g) { + return (ST_boxf) AGDATA(g).castTo(Agraphinfo_t.class).getStruct("bb"); } // #define GD_gvc(g) (((Agraphinfo_t*)AGDATA(g))->gvc) @@ -338,8 +341,8 @@ public class Macro { } // #define GD_comp(g) (((Agraphinfo_t*)AGDATA(g))->comp) - public static __struct__ GD_comp(Agraph_s g) { - return AGDATA(g).castTo(Agraphinfo_t.class).getStruct("comp"); + public static ST_nlist_t GD_comp(Agraph_s g) { + return (ST_nlist_t) AGDATA(g).castTo(Agraphinfo_t.class).getStruct("comp"); } // #define GD_exact_ranksep(g) (((Agraphinfo_t*)AGDATA(g))->exact_ranksep) @@ -654,20 +657,20 @@ public class Macro { } // #define ND_coord(n) (((Agnodeinfo_t*)AGDATA(n))->coord) - public static __struct__ ND_coord(__ptr__ n) { - return AGDATA(n).castTo(Agnodeinfo_t.class).getStruct("coord"); + public static ST_pointf ND_coord(__ptr__ n) { + return (ST_pointf) AGDATA(n).castTo(Agnodeinfo_t.class).getStruct("coord"); } // #define ND_dist(n) (((Agnodeinfo_t*)AGDATA(n))->dist) // #define ND_flat_in(n) (((Agnodeinfo_t*)AGDATA(n))->flat_in) - public static __struct__ ND_flat_in(Agnode_s n) { - return AGDATA(n).castTo(Agnodeinfo_t.class).getStruct("flat_in"); + public static ST_elist ND_flat_in(Agnode_s n) { + return (ST_elist) AGDATA(n).castTo(Agnodeinfo_t.class).getStruct("flat_in"); } // #define ND_flat_out(n) (((Agnodeinfo_t*)AGDATA(n))->flat_out) - public static __struct__ ND_flat_out(Agnode_s n) { - return AGDATA(n).castTo(Agnodeinfo_t.class).getStruct("flat_out"); + public static ST_elist ND_flat_out(Agnode_s n) { + return (ST_elist) AGDATA(n).castTo(Agnodeinfo_t.class).getStruct("flat_out"); } // #define ND_gui_state(n) (((Agnodeinfo_t*)AGDATA(n))->gui_state) @@ -698,8 +701,8 @@ public class Macro { } // #define ND_in(n) (((Agnodeinfo_t*)AGDATA(n))->in) - public static __struct__ ND_in(Agnode_s n) { - return AGDATA(n).castTo(Agnodeinfo_t.class).getStruct("in"); + public static ST_elist ND_in(Agnode_s n) { + return (ST_elist) AGDATA(n).castTo(Agnodeinfo_t.class).getStruct("in"); } public static void ND_in(__ptr__ n, __struct__ v) { @@ -808,13 +811,13 @@ public class Macro { } // #define ND_other(n) (((Agnodeinfo_t*)AGDATA(n))->other) - public static __struct__ ND_other(Agnode_s n) { - return AGDATA(n).castTo(Agnodeinfo_t.class).getStruct("other"); + public static ST_elist ND_other(Agnode_s n) { + return (ST_elist) AGDATA(n).castTo(Agnodeinfo_t.class).getStruct("other"); } // #define ND_out(n) (((Agnodeinfo_t*)AGDATA(n))->out) - public static __struct__ ND_out(__ptr__ n) { - return AGDATA(n).castTo(Agnodeinfo_t.class).getStruct("out"); + public static ST_elist ND_out(__ptr__ n) { + return (ST_elist) AGDATA(n).castTo(Agnodeinfo_t.class).getStruct("out"); } public static void ND_out(__ptr__ n, __struct__ v) { AGDATA(n).castTo(Agnodeinfo_t.class).setStruct("out", v); @@ -876,8 +879,8 @@ public class Macro { } // #define ND_save_in(n) (((Agnodeinfo_t*)AGDATA(n))->save_in) - public static __struct__ ND_save_in(Agnode_s n) { - return AGDATA(n).castTo(Agnodeinfo_t.class).getStruct("save_in"); + public static ST_elist ND_save_in(Agnode_s n) { + return (ST_elist) AGDATA(n).castTo(Agnodeinfo_t.class).getStruct("save_in"); } public static void ND_save_in(Agnode_s n, __struct__ v) { @@ -885,8 +888,8 @@ public class Macro { } // #define ND_save_out(n) (((Agnodeinfo_t*)AGDATA(n))->save_out) - public static __struct__ ND_save_out(Agnode_s n) { - return AGDATA(n).castTo(Agnodeinfo_t.class).getStruct("save_out"); + public static ST_elist ND_save_out(Agnode_s n) { + return (ST_elist) AGDATA(n).castTo(Agnodeinfo_t.class).getStruct("save_out"); } public static void ND_save_out(Agnode_s n, __struct__ v) { AGDATA(n).castTo(Agnodeinfo_t.class).setStruct("save_out", v); @@ -916,13 +919,13 @@ public class Macro { // #define ND_state(n) (((Agnodeinfo_t*)AGDATA(n))->state) // #define ND_clustnode(n) (((Agnodeinfo_t*)AGDATA(n))->clustnode) // #define ND_tree_in(n) (((Agnodeinfo_t*)AGDATA(n))->tree_in) - public static __struct__ ND_tree_in(Agnode_s n) { - return AGDATA(n).castTo(Agnodeinfo_t.class).getStruct("tree_in"); + public static ST_elist ND_tree_in(Agnode_s n) { + return (ST_elist) AGDATA(n).castTo(Agnodeinfo_t.class).getStruct("tree_in"); } // #define ND_tree_out(n) (((Agnodeinfo_t*)AGDATA(n))->tree_out) - public static __struct__ ND_tree_out(Agnode_s n) { - return AGDATA(n).castTo(Agnodeinfo_t.class).getStruct("tree_out"); + public static ST_elist ND_tree_out(Agnode_s n) { + return (ST_elist) AGDATA(n).castTo(Agnodeinfo_t.class).getStruct("tree_out"); } // #define ND_weight_class(n) (((Agnodeinfo_t*)AGDATA(n))->weight_class) @@ -986,8 +989,8 @@ public class Macro { } // #define ED_head_port(e) (((Agedgeinfo_t*)AGDATA(e))->head_port) - public static __struct__ ED_head_port(__ptr__ e) { - return (__struct__) AGDATA(e).castTo(Agedgeinfo_t.class).getStruct("head_port"); + public static ST_port ED_head_port(__ptr__ e) { + return (ST_port) AGDATA(e).castTo(Agedgeinfo_t.class).getStruct("head_port"); } public static void ED_head_port(Agedge_s e, __struct__ v) { AGDATA(e).castTo(Agedgeinfo_t.class).setStruct("head_port", v); @@ -1045,10 +1048,10 @@ public class Macro { } // #define ED_tail_port(e) (((Agedgeinfo_t*)AGDATA(e))->tail_port) - public static __struct__ ED_tail_port(__ptr__ e) { - return (__struct__) AGDATA(e).castTo(Agedgeinfo_t.class).getStruct("tail_port"); + public static ST_port ED_tail_port(__ptr__ e) { + return (ST_port) AGDATA(e).castTo(Agedgeinfo_t.class).getStruct("tail_port"); } - public static void ED_tail_port(Agedge_s e, __struct__ v) { + public static void ED_tail_port(Agedge_s e, ST_port v) { AGDATA(e).castTo(Agedgeinfo_t.class).setStruct("tail_port", v); } @@ -1165,23 +1168,26 @@ public class Macro { // #define elist_append(item,L) do {L.list = ALLOC(L.size + 2,L.list,edge_t*); L.list[L.size++] = item; // L.list[L.size] = NULL;} while(0) - public static void elist_append(__ptr__ item, __struct__ L) { - L.setPtr("list", ALLOC_empty(L.getInt("size") + 2, L.getPtr("list"), Agedge_s.class)); - L.getArrayOfPtr("list").plus(L.getInt("size")).setPtr(item); - L.setInt("size", 1 + L.getInt("size")); - L.getArrayOfPtr("list").plus(L.getInt("size")).setPtr(null); + public static void elist_append(__ptr__ item, ST_elist L) { +// L.setPtr("list", ALLOC_empty(L.getInt("size") + 2, L.getPtr("list"), Agedge_s.class)); + L.realloc(L.size + 2); + L.setInList(L.size, item); + L.size = 1 + L.size; + L.setInList(L.size, null); } // #define alloc_elist(n,L) do {L.size = 0; L.list = N_NEW(n + 1,edge_t*); } while (0) - public static void alloc_elist(int n, __struct__ L, Class cl) { - L.setInt("size", 0); - L.setPtr("list", (__ptr__) JUtils.sizeof_starstar_empty(cl, n + 1).malloc()); + public static void alloc_elist(int n, ST_elist L, Class cl) { + L.size = 0; + L.mallocEmpty(cl, n + 1); + // L.setPtr("list", (__ptr__) JUtils.sizeof_starstar_empty(cl, n + 1).malloc()); } // #define free_list(L) do {if (L.list) free(L.list);} while (0) - public static void free_list(__struct__ L) { - if (L.getPtr("list") != null) - Memory.free(L.getPtr("list")); + public static void free_list(ST_elist L) { + if (L.listNotNull()) + L.free(); + // Memory.free(L.getPtr("list")); } public static double ABS(double a) { diff --git a/src/smetana/core/Memory.java b/src/smetana/core/Memory.java index 218ef27a6..be0335732 100644 --- a/src/smetana/core/Memory.java +++ b/src/smetana/core/Memory.java @@ -35,15 +35,22 @@ */ package smetana.core; +import h.Agdesc_s; +import h.Agiddisc_s; +import h.Agmemdisc_s; +import h.Agtag_s; +import h.ST_Agtag_s; +import h._dtdisc_s; +import h._dtmethod_s; +import h.nlist_t; import smetana.core.amiga.StarArrayOfPtr; import smetana.core.amiga.StarStar; -import smetana.core.amiga.StarStruct; public class Memory { - public static __ptr__ malloc(Class cl) { - JUtils.LOG("MEMORY::malloc " + cl); - return StarStruct.malloc(cl); + public static __ptr__ malloc(Class theClass) { + JUtils.LOG("MEMORY::malloc " + theClass); + return JUtils.create(theClass, null); } public static __ptr__ malloc(size_t size) { @@ -66,10 +73,10 @@ public class Memory { } public static int identityHashCode(CString data) { - if (data==null) { + if (data == null) { return 0; } - //int result = 2 * System.identityHashCode(data); + // int result = 2 * System.identityHashCode(data); int result = data.getUid(); Z.z().all.put(result, data); // System.err.println("Memory::identityHashCode data=" + data); diff --git a/src/smetana/core/UnsupportedArrayOfPtr.java b/src/smetana/core/UnsupportedArrayOfPtr.java new file mode 100644 index 000000000..dc74c346f --- /dev/null +++ b/src/smetana/core/UnsupportedArrayOfPtr.java @@ -0,0 +1,236 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of Smetana. + * Smetana is a partial translation of Graphviz/Dot sources from C to Java. + * + * (C) Copyright 2009-2017, Arnaud Roques + * + * This translation is distributed under the same Licence as the original C program. + * + * THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC + * LICENSE ("AGREEMENT"). [Eclipse Public License - v 1.0] + * + * ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES + * RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + * + * You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package smetana.core; + +import smetana.core.amiga.Area; +import smetana.core.amiga.StarStruct; + +public class UnsupportedArrayOfPtr implements __array_of_ptr__ { + + public __ptr__ unsupported() { + throw new UnsupportedOperationException(getClass().toString()); + } + + public int comparePointer(__ptr__ other) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public int minus(__ptr__ other) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public int getInt() { + throw new UnsupportedOperationException(getClass().toString()); + } + + public void setInt(int value) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public double getDouble() { + throw new UnsupportedOperationException(getClass().toString()); + } + + public void setDouble(double value) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public __ptr__ getPtr() { + throw new UnsupportedOperationException(getClass().toString()); + } + + public void setPtr(__ptr__ value) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public boolean isSameThan(StarStruct other) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public Class getRealClass() { + throw new UnsupportedOperationException(getClass().toString()); + } + + public __struct__ getStruct() { + throw new UnsupportedOperationException(getClass().toString()); + } + + public Area getArea(String name) { + throw new UnsupportedOperationException(name + " " + getClass().toString()); + } + + public String getUID36() { + throw new UnsupportedOperationException(getClass().toString()); + } + + public String getDebug(String fieldName) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public void setInt(String fieldName, int data) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public void setBoolean(String fieldName, boolean data) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public void setDouble(String fieldName, double data) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public int getInt(String fieldName) { + throw new UnsupportedOperationException(fieldName + " " + getClass().toString()); + } + + public double getDouble(String fieldName) { + throw new UnsupportedOperationException(fieldName + " " + getClass().toString()); + } + + public boolean getBoolean(String fieldName) { + throw new UnsupportedOperationException(fieldName + " " + getClass().toString()); + } + + public CString getCString(String fieldName) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public __array_of_struct__ getArrayOfStruct(String fieldName) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public __array_of_ptr__ getArrayOfPtr(String fieldName) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public __array_of_cstring__ getArrayOfCString(String fieldName) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public __array_of_integer__ getArrayOfInteger(String fieldName) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public __struct__ getStruct(String fieldName) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public __ptr__ getPtr(String fieldName) { + throw new UnsupportedOperationException(fieldName + " " + getClass().toString()); + } + + public void setStruct(String fieldName, __struct__ newData) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public void setCString(String fieldName, CString newData) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public __ptr__ setPtr(String fieldName, __ptr__ newData) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public void memcopyFrom(Area source) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public void copyDataFrom(__struct__ other) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public void setStruct(__struct__ value) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public void copyDataFrom(__ptr__ arg) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public Object call(String fieldName, Object... args) { + throw new UnsupportedOperationException(fieldName + " " + getClass().toString()); + } + + public __ptr__ castTo(Class dest) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public Object addVirtualBytes(int virtualBytes) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public void swap(int i, int j) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public void realloc(int nb) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public __ptr__ asPtr() { + throw new UnsupportedOperationException(getClass().toString()); + } + + public int comparePointerInternal(__array_of_ptr__ other) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public __array_of_ptr__ move(int delta) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public Area getInternal(int idx) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public void setInternalByIndex(int idx, Area value) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public CString getCString() { + throw new UnsupportedOperationException(getClass().toString()); + } + + public void setCString(CString value) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public __array_of_ptr__ plus(int delta) { + throw new UnsupportedOperationException(getClass().toString()); + } + +} diff --git a/src/smetana/core/UnsupportedStarStruct.java b/src/smetana/core/UnsupportedStarStruct.java new file mode 100644 index 000000000..7b36dca42 --- /dev/null +++ b/src/smetana/core/UnsupportedStarStruct.java @@ -0,0 +1,200 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of Smetana. + * Smetana is a partial translation of Graphviz/Dot sources from C to Java. + * + * (C) Copyright 2009-2017, Arnaud Roques + * + * This translation is distributed under the same Licence as the original C program. + * + * THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC + * LICENSE ("AGREEMENT"). [Eclipse Public License - v 1.0] + * + * ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES + * RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + * + * You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package smetana.core; + +import smetana.core.amiga.Area; +import smetana.core.amiga.StarStruct; + +public class UnsupportedStarStruct implements StarStruct { + + public __ptr__ unsupported() { + throw new UnsupportedOperationException(getClass().toString()); + } + + public int comparePointer(__ptr__ other) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public int minus(__ptr__ other) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public int getInt() { + throw new UnsupportedOperationException(getClass().toString()); + } + + public void setInt(int value) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public double getDouble() { + throw new UnsupportedOperationException(getClass().toString()); + } + + public void setDouble(double value) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public __ptr__ getPtr() { + throw new UnsupportedOperationException(getClass().toString()); + } + + public void setPtr(__ptr__ value) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public boolean isSameThan(StarStruct other) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public Class getRealClass() { + throw new UnsupportedOperationException(getClass().toString()); + } + + public __struct__ getStruct() { + throw new UnsupportedOperationException(getClass().toString()); + } + + public Area getArea(String name) { + throw new UnsupportedOperationException(name + " " + getClass().toString()); + } + + public String getUID36() { + throw new UnsupportedOperationException(getClass().toString()); + } + + public String getDebug(String fieldName) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public void setInt(String fieldName, int data) { + throw new UnsupportedOperationException(fieldName + " " + getClass().toString()); + } + + public void setBoolean(String fieldName, boolean data) { + throw new UnsupportedOperationException(fieldName + " " + getClass().toString()); + } + + public void setDouble(String fieldName, double data) { + throw new UnsupportedOperationException(fieldName + " " + getClass().toString()); + } + + public int getInt(String fieldName) { + throw new UnsupportedOperationException(fieldName + " " + getClass().toString()); + } + + public double getDouble(String fieldName) { + throw new UnsupportedOperationException(fieldName + " " + getClass().toString()); + } + + public boolean getBoolean(String fieldName) { + throw new UnsupportedOperationException(fieldName + " " + getClass().toString()); + } + + public __ptr__ plus(int pointerMove) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public CString getCString(String fieldName) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public __array_of_struct__ getArrayOfStruct(String fieldName) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public __array_of_ptr__ getArrayOfPtr(String fieldName) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public __array_of_cstring__ getArrayOfCString(String fieldName) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public __array_of_integer__ getArrayOfInteger(String fieldName) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public __struct__ getStruct(String fieldName) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public __ptr__ getPtr(String fieldName) { + throw new UnsupportedOperationException(fieldName + " " + getClass().toString()); + } + + public void setStruct(String fieldName, __struct__ newData) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public void setCString(String fieldName, CString newData) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public __ptr__ setPtr(String fieldName, __ptr__ newData) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public void memcopyFrom(Area source) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public void copyDataFrom(__struct__ other) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public void setStruct(__struct__ value) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public void copyDataFrom(__ptr__ arg) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public Object call(String fieldName, Object... args) { + throw new UnsupportedOperationException(fieldName + " " + getClass().toString()); + } + + public __ptr__ castTo(Class dest) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public Object addVirtualBytes(int virtualBytes) { + throw new UnsupportedOperationException(getClass().toString()); + } + +} diff --git a/src/smetana/core/UnsupportedStruct.java b/src/smetana/core/UnsupportedStruct.java new file mode 100644 index 000000000..45df65f68 --- /dev/null +++ b/src/smetana/core/UnsupportedStruct.java @@ -0,0 +1,137 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of Smetana. + * Smetana is a partial translation of Graphviz/Dot sources from C to Java. + * + * (C) Copyright 2009-2017, Arnaud Roques + * + * This translation is distributed under the same Licence as the original C program. + * + * THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC + * LICENSE ("AGREEMENT"). [Eclipse Public License - v 1.0] + * + * ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES + * RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + * + * You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package smetana.core; + +import smetana.core.amiga.Area; +import smetana.core.amiga.StarStruct; + +public class UnsupportedStruct implements __struct__ { + + public __ptr__ getPtr(String fieldName) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public __struct__ getStruct(String fieldName) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public boolean getBoolean(String fieldName) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public double getDouble(String fieldName) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public CString getCString(String fieldName) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public int getInt(String fieldName) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public __ptr__ setPtr(String fieldName, __ptr__ value) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public void setCString(String fieldName, CString value) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public void setStruct(String fieldName, __struct__ value) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public void setInt(String fieldName, int value) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public void setBoolean(String fieldName, boolean value) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public void setDouble(String fieldName, double value) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public __array_of_integer__ getArrayOfInteger(String fieldName) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public __array_of_struct__ getArrayOfStruct(String fieldName) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public __array_of_ptr__ getArrayOfPtr(String fieldName) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public __array_of_cstring__ getArrayOfCString(String fieldName) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public void memcopyFrom(Area source) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public __struct__ copy() { + throw new UnsupportedOperationException(getClass().toString()); + } + + public void ___(__struct__ other) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public void ____(__ptr__ other) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public StarStruct amp() { + throw new UnsupportedOperationException(getClass().toString()); + } + + public StarStruct getInternalData() { + throw new UnsupportedOperationException(getClass().toString()); + } + + public Object call(String name, Object... args) { + throw new UnsupportedOperationException(getClass().toString()); + } + + +} diff --git a/src/smetana/core/UnsupportedStructAndPtr.java b/src/smetana/core/UnsupportedStructAndPtr.java new file mode 100644 index 000000000..9f3be4020 --- /dev/null +++ b/src/smetana/core/UnsupportedStructAndPtr.java @@ -0,0 +1,62 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of Smetana. + * Smetana is a partial translation of Graphviz/Dot sources from C to Java. + * + * (C) Copyright 2009-2017, Arnaud Roques + * + * This translation is distributed under the same Licence as the original C program. + * + * THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC + * LICENSE ("AGREEMENT"). [Eclipse Public License - v 1.0] + * + * ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES + * RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + * + * You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package smetana.core; + +import smetana.core.amiga.StarStruct; + +public class UnsupportedStructAndPtr extends UnsupportedStarStruct implements __struct__, __ptr__ { + + public __struct__ copy() { + throw new UnsupportedOperationException(getClass().toString()); + } + + public void ___(__struct__ other) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public void ____(__ptr__ other) { + throw new UnsupportedOperationException(getClass().toString()); + } + + public StarStruct amp() { + throw new UnsupportedOperationException(getClass().toString()); + } + + public StarStruct getInternalData() { + throw new UnsupportedOperationException(getClass().toString()); + } +} diff --git a/src/smetana/core/Z.java b/src/smetana/core/Z.java index d59b186ab..c25fa7db5 100644 --- a/src/smetana/core/Z.java +++ b/src/smetana/core/Z.java @@ -48,28 +48,32 @@ import gen.lib.cgraph.utils__c; import gen.lib.common.arrows__c; import gen.lib.common.shapes__c; import gen.lib.dotgen.dotsplines__c; -import h.Agdesc_s; import h.Agedge_s; -import h.Agiddisc_s; -import h.Agmemdisc_s; import h.Agnode_s; import h.Agraph_s; import h.Agsubnode_s; import h.Agsym_s; import h.Agtag_s; +import h.ST_Agdesc_s; +import h.ST_Agiddisc_s; +import h.ST_Agmemdisc_s; +import h.ST_arrowname_t; +import h.ST_arrowtype_t; +import h.ST_dtdisc_s; +import h.ST_dtmethod_s; +import h.ST_elist; +import h.ST_nlist_t; +import h.ST_pointf; +import h.ST_port; import h._dt_s; -import h._dtdisc_s; import h._dtmethod_s; import h.arrowname_t; import h.arrowtype_t; import h.boxf; import h.deque_t; -import h.elist; -import h.nlist_t; import h.pointf; import h.pointnlink_t; import h.polygon_t; -import h.port; import h.refstr_t; import h.shape_desc; import h.shape_functions; @@ -86,38 +90,38 @@ public class Z { public final Map all = new HashMap(); - public final __struct__<_dtmethod_s> _Dttree = __struct__.from(_dtmethod_s.class); + public final ST_dtmethod_s _Dttree = new ST_dtmethod_s(); public final _dtmethod_s Dttree = _Dttree.amp(); - public final __struct__<_dtdisc_s> AgDataDictDisc = __struct__.from(_dtdisc_s.class); + public final ST_dtdisc_s AgDataDictDisc = new ST_dtdisc_s(); - public final __struct__ ProtoDesc = __struct__.from(Agdesc_s.class); + public final ST_Agdesc_s ProtoDesc = new ST_Agdesc_s(); public Agraph_s ProtoGraph; - public final __struct__ Tag = __struct__.from(Agtag_s.class); + public final __struct__ Tag = JUtils.from(Agtag_s.class); - public final __struct__<_dtdisc_s> Ag_mainedge_seq_disc = __struct__.from(_dtdisc_s.class); + public final ST_dtdisc_s Ag_mainedge_seq_disc = new ST_dtdisc_s(); - public final __struct__<_dtdisc_s> Ag_subedge_seq_disc = __struct__.from(_dtdisc_s.class); + public final ST_dtdisc_s Ag_subedge_seq_disc = new ST_dtdisc_s(); - public final __struct__<_dtdisc_s> Ag_subedge_id_disc = __struct__.from(_dtdisc_s.class); + public final ST_dtdisc_s Ag_subedge_id_disc = new ST_dtdisc_s(); - public final __struct__<_dtdisc_s> Ag_subgraph_id_disc = __struct__.from(_dtdisc_s.class); + public final ST_dtdisc_s Ag_subgraph_id_disc = new ST_dtdisc_s(); - public final __struct__ AgIdDisc = __struct__.from(Agiddisc_s.class); + public final ST_Agiddisc_s AgIdDisc = new ST_Agiddisc_s(); - public final __struct__ AgMemDisc = __struct__.from(Agmemdisc_s.class); + public final ST_Agmemdisc_s AgMemDisc = new ST_Agmemdisc_s(); - public final __struct__<_dtdisc_s> Ag_subnode_id_disc = __struct__.from(_dtdisc_s.class); + public final ST_dtdisc_s Ag_subnode_id_disc = new ST_dtdisc_s(); - public final __struct__<_dtdisc_s> Ag_subnode_seq_disc = __struct__.from(_dtdisc_s.class); + public final ST_dtdisc_s Ag_subnode_seq_disc = new ST_dtdisc_s(); public int HTML_BIT; public int CNT_BITS; - public final __struct__<_dtdisc_s> Refstrdisc = __struct__.from(_dtdisc_s.class); + public final ST_dtdisc_s Refstrdisc = new ST_dtdisc_s(); public _dt_s Refdict_default; @@ -170,9 +174,9 @@ public class Z { public int Search_size; - public final __struct__ Tree_node = __struct__.from(nlist_t.class); + public final ST_nlist_t Tree_node = new ST_nlist_t(); - public final __struct__ Tree_edge = __struct__.from(elist.class); + public final ST_elist Tree_edge = new ST_elist(); public Agedge_s Enter; @@ -182,7 +186,7 @@ public class Z { public boolean Flip; - public final __struct__ Offset = __struct__.from(pointf.class); + public final ST_pointf Offset = new ST_pointf(); public int nedges, nboxes; @@ -230,13 +234,13 @@ public class Z { public pointnlink_t pnls; public __ptr__ pnlps; - public final __struct__ Center = __struct__.from(port.class); + public final ST_port Center = new ST_port(); - public final __struct__ p_ellipse = __struct__.from(polygon_t.class); + public final __struct__ p_ellipse = JUtils.from(polygon_t.class); - public final __struct__ p_box = __struct__.from(polygon_t.class); + public final __struct__ p_box = JUtils.from(polygon_t.class); - public final __struct__ poly_fns = __struct__.from(shape_functions.class); + public final __struct__ poly_fns = JUtils.from(shape_functions.class); public __ptr__ tnas; public int tnan; @@ -244,22 +248,22 @@ public class Z { public final shape_desc Shapes[] = { __Shapes__("box", poly_fns.amp(), p_box.amp()), __Shapes__("ellipse", poly_fns.amp(), p_ellipse.amp()), __Shapes__(null, null, null) }; - public final __struct__<_dtdisc_s> Ag_mainedge_id_disc = __struct__.from(_dtdisc_s.class); + public final ST_dtdisc_s Ag_mainedge_id_disc = new ST_dtdisc_s(); - public final __struct__ dq = __struct__.from(deque_t.class); + public final __struct__ dq = JUtils.from(deque_t.class); - public final __struct__ Agdirected = __struct__.from(Agdesc_s.class); + public final ST_Agdesc_s Agdirected = new ST_Agdesc_s(); - public final __struct__ sinfo = __struct__.from(splineInfo.class); + public final __struct__ sinfo = JUtils.from(splineInfo.class); public Agnode_s lastn; /* last node argument */ public polygon_t poly; public int last, outp, sides; - public final __struct__ O = __struct__.from(pointf.class); /* point (0,0) */ + public final __struct__ O = JUtils.from(pointf.class); /* point (0,0) */ public pointf vertex; public double xsize, ysize, scalex, scaley, box_URx, box_URy; - public final __struct__ tf = __struct__.from(textfont_t.class); + public final __struct__ tf = JUtils.from(textfont_t.class); public __ptr__ pointfs; public __ptr__ pointfs2; @@ -271,8 +275,8 @@ public class Z { public int ctr = 1; - public __struct__ template = __struct__.from(Agsubnode_s.class); - public __struct__ dummy = __struct__.from(Agnode_s.class); + public __struct__ template = JUtils.from(Agsubnode_s.class); + public __struct__ dummy = JUtils.from(Agnode_s.class); public Agraph_s G_ns; public Agraph_s G_decomp; @@ -311,128 +315,128 @@ public class Z { } private final static __struct__ createArrowtypes(int type, double lenfact, CFunction function) { - final __struct__ result = __struct__.from(arrowtype_t.class); - result.setInt("type", type); - result.setDouble("lenfact", lenfact); - result.setPtr("gen", function); + final ST_arrowtype_t result = new ST_arrowtype_t(); + result.type = type; + result.lenfact = lenfact; + result.gen = function; return result; } private final static __struct__ create_arrowname_t(String name, int type) { - final __struct__ result = __struct__.from(arrowname_t.class); - result.setCString("name", name == null ? null : new CString(name)); - result.setInt("type", type); + final ST_arrowname_t result = new ST_arrowname_t(); + result.name = name == null ? null : new CString(name); + result.type = type; return result; } private Z() { - _Dttree.setPtr("searchf", function(dttree__c.class, "dttree")); - _Dttree.setInt("type", 0000004); + _Dttree.searchf = function(dttree__c.class, "dttree"); + _Dttree.type = 0000004; - AgDataDictDisc.setInt("key", OFFSET.create(Agsym_s.class, "name").toInt()); - AgDataDictDisc.setInt("size", -1); - AgDataDictDisc.setInt("link", OFFSET.create(Agsym_s.class, "link").toInt()); - AgDataDictDisc.setPtr("makef", null); - AgDataDictDisc.setPtr("freef", function(attr__c.class, "freesym")); - AgDataDictDisc.setPtr("comparf", null); - AgDataDictDisc.setPtr("hashf", null); + AgDataDictDisc.key = OFFSET.create(Agsym_s.class, "name").toInt(); + AgDataDictDisc.size = -1; + AgDataDictDisc.link = OFFSET.create(Agsym_s.class, "link").toInt(); + AgDataDictDisc.makef = null; + AgDataDictDisc.freef = function(attr__c.class, "freesym"); + AgDataDictDisc.comparf = null; + AgDataDictDisc.hashf = null; - ProtoDesc.setInt("directed", 1); - ProtoDesc.setInt("strict", 0); - ProtoDesc.setInt("no_loop", 1); - ProtoDesc.setInt("maingraph", 0); - ProtoDesc.setInt("flatlock", 1); - ProtoDesc.setInt("no_write", 1); + ProtoDesc.directed = 1; + ProtoDesc.strict = 0; + ProtoDesc.no_loop = 1; + ProtoDesc.maingraph = 0; + ProtoDesc.flatlock = 1; + ProtoDesc.no_write = 1; - Ag_mainedge_seq_disc.setInt("key", 0); - Ag_mainedge_seq_disc.setInt("size", 0); - Ag_mainedge_seq_disc.setInt("link", OFFSET.create(Agedge_s.class, "seq_link").toInt()); // seq_link is the third - // field in Agedge_t - Ag_mainedge_seq_disc.setPtr("makef", null); - Ag_mainedge_seq_disc.setPtr("freef", null); - Ag_mainedge_seq_disc.setPtr("comparf", function(edge__c.class, "agedgeseqcmpf")); - Ag_mainedge_seq_disc.setPtr("hashf", null); - Ag_mainedge_seq_disc.setPtr("memoryf", function(utils__c.class, "agdictobjmem")); - Ag_mainedge_seq_disc.setPtr("eventf", null); + Ag_mainedge_seq_disc.key = 0; + Ag_mainedge_seq_disc.size = 0; + Ag_mainedge_seq_disc.link = OFFSET.create(Agedge_s.class, "seq_link").toInt(); // seq_link is the third + // field in Agedge_t + Ag_mainedge_seq_disc.makef = null; + Ag_mainedge_seq_disc.freef = null; + Ag_mainedge_seq_disc.comparf = function(edge__c.class, "agedgeseqcmpf"); + Ag_mainedge_seq_disc.hashf = null; + Ag_mainedge_seq_disc.memoryf = function(utils__c.class, "agdictobjmem"); + Ag_mainedge_seq_disc.eventf = null; - Ag_subedge_seq_disc.setInt("key", 0); - Ag_subedge_seq_disc.setInt("size", 0); - Ag_subedge_seq_disc.setInt("link", -1); - Ag_subedge_seq_disc.setPtr("makef", null); - Ag_subedge_seq_disc.setPtr("freef", null); - Ag_subedge_seq_disc.setPtr("comparf", function(edge__c.class, "agedgeseqcmpf")); - Ag_subedge_seq_disc.setPtr("hashf", null); - Ag_subedge_seq_disc.setPtr("memoryf", function(utils__c.class, "agdictobjmem")); - Ag_subedge_seq_disc.setPtr("eventf", null); + Ag_subedge_seq_disc.key = 0; + Ag_subedge_seq_disc.size = 0; + Ag_subedge_seq_disc.link = -1; + Ag_subedge_seq_disc.makef = null; + Ag_subedge_seq_disc.freef = null; + Ag_subedge_seq_disc.comparf = function(edge__c.class, "agedgeseqcmpf"); + Ag_subedge_seq_disc.hashf = null; + Ag_subedge_seq_disc.memoryf = function(utils__c.class, "agdictobjmem"); + Ag_subedge_seq_disc.eventf = null; - Ag_subedge_id_disc.setInt("key", 0); - Ag_subedge_id_disc.setInt("size", 0); - Ag_subedge_id_disc.setInt("link", -1); - Ag_subedge_id_disc.setPtr("makef", null); - Ag_subedge_id_disc.setPtr("freef", null); - Ag_subedge_id_disc.setPtr("comparf", function(edge__c.class, "agedgeidcmpf")); - Ag_subedge_id_disc.setPtr("hashf", null); - Ag_subedge_id_disc.setPtr("memoryf", function(utils__c.class, "agdictobjmem")); - Ag_subedge_id_disc.setPtr("eventf", null); + Ag_subedge_id_disc.key = 0; + Ag_subedge_id_disc.size = 0; + Ag_subedge_id_disc.link = -1; + Ag_subedge_id_disc.makef = null; + Ag_subedge_id_disc.freef = null; + Ag_subedge_id_disc.comparf = function(edge__c.class, "agedgeidcmpf"); + Ag_subedge_id_disc.hashf = null; + Ag_subedge_id_disc.memoryf = function(utils__c.class, "agdictobjmem"); + Ag_subedge_id_disc.eventf = null; - Ag_subgraph_id_disc.setInt("key", 0); - Ag_subgraph_id_disc.setInt("size", 0); - Ag_subgraph_id_disc.setInt("link", OFFSET.create(Agraph_s.class, "link").toInt()); // link is the third field in - // Agraph_t - Ag_subgraph_id_disc.setPtr("makef", null); - Ag_subgraph_id_disc.setPtr("freef", null); - Ag_subgraph_id_disc.setPtr("comparf", function(graph__c.class, "agraphidcmpf")); - Ag_subgraph_id_disc.setPtr("hashf", null); - Ag_subgraph_id_disc.setPtr("memoryf", function(utils__c.class, "agdictobjmem")); - Ag_subgraph_id_disc.setPtr("eventf", null); + Ag_subgraph_id_disc.key = 0; + Ag_subgraph_id_disc.size = 0; + Ag_subgraph_id_disc.link = OFFSET.create(Agraph_s.class, "link").toInt(); // link is the third field in + // Agraph_t + Ag_subgraph_id_disc.makef = null; + Ag_subgraph_id_disc.freef = null; + Ag_subgraph_id_disc.comparf = function(graph__c.class, "agraphidcmpf"); + Ag_subgraph_id_disc.hashf = null; + Ag_subgraph_id_disc.memoryf = function(utils__c.class, "agdictobjmem"); + Ag_subgraph_id_disc.eventf = null; - AgIdDisc.setPtr("open", function(id__c.class, "idopen")); - AgIdDisc.setPtr("map", function(id__c.class, "idmap")); - AgIdDisc.setPtr("alloc", function(id__c.class, "idalloc")); - AgIdDisc.setPtr("free", function(id__c.class, "idfree")); - AgIdDisc.setPtr("print", function(id__c.class, "idprint")); - AgIdDisc.setPtr("close", function(id__c.class, "idclose")); - AgIdDisc.setPtr("idregister", function(id__c.class, "idregister")); + AgIdDisc.open = function(id__c.class, "idopen"); + AgIdDisc.map = function(id__c.class, "idmap"); + AgIdDisc.alloc = function(id__c.class, "idalloc"); + AgIdDisc.free = function(id__c.class, "idfree"); + AgIdDisc.print = function(id__c.class, "idprint"); + AgIdDisc.close = function(id__c.class, "idclose"); + AgIdDisc.idregister = function(id__c.class, "idregister"); - AgMemDisc.setPtr("open", function(mem__c.class, "memopen")); - AgMemDisc.setPtr("alloc", function(mem__c.class, "memalloc")); - AgMemDisc.setPtr("resize", function(mem__c.class, "memresize")); - AgMemDisc.setPtr("free", function(mem__c.class, "memfree")); - AgMemDisc.setPtr("close", null); + AgMemDisc.open = function(mem__c.class, "memopen"); + AgMemDisc.alloc = function(mem__c.class, "memalloc"); + AgMemDisc.resize = function(mem__c.class, "memresize"); + AgMemDisc.free = function(mem__c.class, "memfree"); + AgMemDisc.close = null; - Ag_subnode_id_disc.setInt("key", 0); - Ag_subnode_id_disc.setInt("size", 0); - Ag_subnode_id_disc.setInt("link", OFFSET.create(Agsubnode_s.class, "id_link").toInt()); // id_link is the second - // field in Agsubnode_t - Ag_subnode_id_disc.setPtr("makef", null); - Ag_subnode_id_disc.setPtr("freef", null); - Ag_subnode_id_disc.setPtr("comparf", function(node__c.class, "agsubnodeidcmpf")); - Ag_subnode_id_disc.setPtr("hashf", null); - Ag_subnode_id_disc.setPtr("memoryf", function(utils__c.class, "agdictobjmem")); - Ag_subnode_id_disc.setPtr("eventf", null); + Ag_subnode_id_disc.key = 0; + Ag_subnode_id_disc.size = 0; + Ag_subnode_id_disc.link = OFFSET.create(Agsubnode_s.class, "id_link").toInt(); // id_link is the second + // field in Agsubnode_t + Ag_subnode_id_disc.makef = null; + Ag_subnode_id_disc.freef = null; + Ag_subnode_id_disc.comparf = function(node__c.class, "agsubnodeidcmpf"); + Ag_subnode_id_disc.hashf = null; + Ag_subnode_id_disc.memoryf = function(utils__c.class, "agdictobjmem"); + Ag_subnode_id_disc.eventf = null; - Ag_subnode_seq_disc.setInt("key", 0); - Ag_subnode_seq_disc.setInt("size", 0); - Ag_subnode_seq_disc.setInt("link", OFFSET.create(Agsubnode_s.class, "seq_link").toInt()); // link is the first - // field in - // Agsubnode_t - Ag_subnode_seq_disc.setPtr("makef", null); - Ag_subnode_seq_disc.setPtr("freef", function(node__c.class, "free_subnode")); - Ag_subnode_seq_disc.setPtr("comparf", function(node__c.class, "agsubnodeseqcmpf")); - Ag_subnode_seq_disc.setPtr("hashf", null); - Ag_subnode_seq_disc.setPtr("memoryf", function(utils__c.class, "agdictobjmem")); - Ag_subnode_seq_disc.setPtr("eventf", null); + Ag_subnode_seq_disc.key = 0; + Ag_subnode_seq_disc.size = 0; + Ag_subnode_seq_disc.link = OFFSET.create(Agsubnode_s.class, "seq_link").toInt(); // link is the first + // field in + // Agsubnode_t + Ag_subnode_seq_disc.makef = null; + Ag_subnode_seq_disc.freef = function(node__c.class, "free_subnode"); + Ag_subnode_seq_disc.comparf = function(node__c.class, "agsubnodeseqcmpf"); + Ag_subnode_seq_disc.hashf = null; + Ag_subnode_seq_disc.memoryf = function(utils__c.class, "agdictobjmem"); + Ag_subnode_seq_disc.eventf = null; - Refstrdisc.setInt("key", OFFSET.create(refstr_t.class, "s").toInt()); // *s is the third field in refstr_t - Refstrdisc.setInt("size", -1); - Refstrdisc.setInt("link", 0); - Refstrdisc.setPtr("makef", null); - Refstrdisc.setPtr("freef", function(utils__c.class, "agdictobjfree")); - Refstrdisc.setPtr("comparf", null); - Refstrdisc.setPtr("hashf", null); - Refstrdisc.setPtr("memoryf", function(utils__c.class, "agdictobjmem")); - Refstrdisc.setPtr("eventf", null); + Refstrdisc.key = OFFSET.create(refstr_t.class, "s").toInt(); // *s is the third field in refstr_t + Refstrdisc.size = -1; + Refstrdisc.link = 0; + Refstrdisc.makef = null; + Refstrdisc.freef = function(utils__c.class, "agdictobjfree"); + Refstrdisc.comparf = null; + Refstrdisc.hashf = null; + Refstrdisc.memoryf = function(utils__c.class, "agdictobjmem"); + Refstrdisc.eventf = null; Arrowsynonyms.plus(0).setStruct(create_arrowname_t(null, 0)); @@ -452,16 +456,16 @@ public class Z { Arrowtypes.plus(7).setStruct(createArrowtypes(8, 0.5, function(arrows__c.class, "arrow_type_gap"))); Arrowtypes.plus(8).setStruct(createArrowtypes(0, 0.0, null)); - Center.getStruct("p").setDouble("x", 0); - Center.getStruct("p").setDouble("y", 0); - Center.setDouble("theta", -1); - Center.setPtr("bp", null); - Center.setInt("defined", 0); - Center.setInt("constrained", 0); - Center.setInt("clip", 1); - Center.setInt("dyna", 0); - Center.setInt("order", 0); - Center.setInt("side", 0); + Center.p.x = 0; + Center.p.y = 0; + Center.theta = -1; + Center.bp = null; + Center.defined = 0; + Center.constrained = 0; + Center.clip = 1; + Center.dyna = 0; + Center.order = 0; + Center.side = 0; p_ellipse.setInt("regular", 0); p_ellipse.setInt("peripheries", 1); @@ -484,21 +488,21 @@ public class Z { poly_fns.setPtr("pboxfn", function(shapes__c.class, "poly_path")); poly_fns.setPtr("codefn", function(shapes__c.class, "poly_gencode")); - Ag_mainedge_id_disc.setInt("key", 0); - Ag_mainedge_id_disc.setInt("size", 0); - Ag_mainedge_id_disc.setInt("link", OFFSET.create(Agedge_s.class, "id_link").toInt()); // id_link is the second - // field in Agedge_t - Ag_mainedge_id_disc.setPtr("makef", null); - Ag_mainedge_id_disc.setPtr("freef", null); - Ag_mainedge_id_disc.setPtr("comparf", function(edge__c.class, "agedgeidcmpf")); - Ag_mainedge_id_disc.setPtr("hashf", null); - Ag_mainedge_id_disc.setPtr("memoryf", function(utils__c.class, "agdictobjmem")); - Ag_mainedge_id_disc.setPtr("eventf", null); + Ag_mainedge_id_disc.key = 0; + Ag_mainedge_id_disc.size = 0; + Ag_mainedge_id_disc.link = OFFSET.create(Agedge_s.class, "id_link").toInt(); // id_link is the second + // field in Agedge_t + Ag_mainedge_id_disc.makef = null; + Ag_mainedge_id_disc.freef = null; + Ag_mainedge_id_disc.comparf = function(edge__c.class, "agedgeidcmpf"); + Ag_mainedge_id_disc.hashf = null; + Ag_mainedge_id_disc.memoryf = function(utils__c.class, "agdictobjmem"); + Ag_mainedge_id_disc.eventf = null; - Agdirected.setInt("directed", 1); - Agdirected.setInt("strict", 0); - Agdirected.setInt("no_loop", 0); - Agdirected.setInt("maingraph", 1); + Agdirected.directed = 1; + Agdirected.strict = 0; + Agdirected.no_loop = 0; + Agdirected.maingraph = 1; sinfo.setPtr("swapEnds", function(dotsplines__c.class, "swap_ends_p")); sinfo.setPtr("splineMerge", function(dotsplines__c.class, "spline_merge")); diff --git a/src/smetana/core/__array_of_cstring__.java b/src/smetana/core/__array_of_cstring__.java index f5c2bc41c..4edbd0609 100644 --- a/src/smetana/core/__array_of_cstring__.java +++ b/src/smetana/core/__array_of_cstring__.java @@ -41,14 +41,14 @@ import java.util.List; import smetana.core.amiga.Area; import smetana.core.amiga.BuilderArea; -import smetana.core.amiga.StarStruct; +import smetana.core.amiga.StarStructImpl; public class __array_of_cstring__ implements Area { private final List data; private final int currentPos; - private final int UID = StarStruct.CPT++; + private final int UID = StarStructImpl.CPT++; public String getUID36() { return Integer.toString(UID, 36); diff --git a/src/smetana/core/__array_of_double__.java b/src/smetana/core/__array_of_double__.java index 993abd57b..36ff9ff3e 100644 --- a/src/smetana/core/__array_of_double__.java +++ b/src/smetana/core/__array_of_double__.java @@ -43,13 +43,14 @@ import smetana.core.amiga.Area; import smetana.core.amiga.AreaInt; import smetana.core.amiga.BuilderArea; import smetana.core.amiga.StarStruct; +import smetana.core.amiga.StarStructImpl; public class __array_of_double__ implements Area { private final List data; private final int currentPos; - private final int UID = StarStruct.CPT++; + private final int UID = StarStructImpl.CPT++; public String getUID36() { return Integer.toString(UID, 36); diff --git a/src/smetana/core/__array_of_integer__.java b/src/smetana/core/__array_of_integer__.java index 15be0aae2..61063c701 100644 --- a/src/smetana/core/__array_of_integer__.java +++ b/src/smetana/core/__array_of_integer__.java @@ -43,13 +43,14 @@ import smetana.core.amiga.Area; import smetana.core.amiga.AreaInt; import smetana.core.amiga.BuilderArea; import smetana.core.amiga.StarStruct; +import smetana.core.amiga.StarStructImpl; public class __array_of_integer__ implements Area { private final List data; private final int currentPos; - private final int UID = StarStruct.CPT++; + private final int UID = StarStructImpl.CPT++; public String getUID36() { return Integer.toString(UID, 36); diff --git a/src/smetana/core/__array_of_ptr__.java b/src/smetana/core/__array_of_ptr__.java index ce8c0ee8a..69776e99b 100644 --- a/src/smetana/core/__array_of_ptr__.java +++ b/src/smetana/core/__array_of_ptr__.java @@ -36,191 +36,50 @@ package smetana.core; -import java.util.ArrayList; -import java.util.List; - import smetana.core.amiga.Area; -import smetana.core.amiga.AreaInt; -import smetana.core.amiga.BuilderArea; -import smetana.core.amiga.StarArrayOfPtr; -import smetana.core.amiga.StarStruct; -public class __array_of_ptr__ implements Area { +public interface __array_of_ptr__ extends Area { - private final List data; - private final int currentPos; - private final BuilderArea builder; + public String getUID36(); - private final int UID = StarStruct.CPT++; + public void memcopyFrom(Area source); - public String getUID36() { - return Integer.toString(UID, 36); - } + public void swap(int i, int j); - public void memcopyFrom(Area source) { - __array_of_ptr__ other = (__array_of_ptr__) source; - System.err.println("sizeMe=" + this.data.size()); - System.err.println("sizeOt=" + other.data.size()); + public void realloc(int nb); - throw new UnsupportedOperationException(); - } + public __ptr__ asPtr(); - public void swap(int i, int j) { - Area e1 = data.get(i); - Area e2 = data.get(j); - data.set(i, e2); - data.set(j, e1); - } + public int comparePointerInternal(__array_of_ptr__ other); - @Override - public String toString() { - if (data.get(0) != null) { - return "__array__ " + getUID36() + " " + currentPos + "/" + data.size() + " " + data.get(0).toString(); - } - return "__array__ " + getUID36() + " " + currentPos + "/" + data.size(); - } + public __array_of_ptr__ move(int delta); - public void realloc(int nb) { - while (data.size() < nb + currentPos) { - data.add(builder.createArea()); - } - } + public __array_of_ptr__ plus(int delta); - public __ptr__ asPtr() { - return new StarArrayOfPtr(this); - } + public Area getInternal(int idx); - public int comparePointerInternal(__array_of_ptr__ other) { - if (this.data != other.data) { - throw new IllegalArgumentException(); - } - return this.currentPos - other.currentPos; - } + public void setInternalByIndex(int idx, Area value); - public static __array_of_ptr__ malloc_allocated(final Class cl, int nb) { - return new __array_of_ptr__(nb, new BuilderArea() { - public Area createArea() { - return new StarStruct(cl, null); - } - }); - } + public int getInt(); - public static __array_of_ptr__ malloc_empty(int nb) { - return new __array_of_ptr__(nb, new BuilderArea() { - public Area createArea() { - return null; - } - }); - } + public CString getCString(); - private __array_of_ptr__(List data, int currentPos, BuilderArea builderArea) { - this.data = data; - this.currentPos = currentPos; - this.builder = builderArea; - check(); - } + public __ptr__ getPtr(); - private __array_of_ptr__(int size, BuilderArea builder) { - this.data = new ArrayList(); - this.builder = builder; - this.currentPos = 0; - for (int i = 0; i < size; i++) { - data.add(builder.createArea()); - } - check(); - } + public __struct__ getStruct(); - private void check() { - if (getUID36().equals("194")) { - JUtils.LOG("It's me"); - } - } + public void setInt(int value); - public __array_of_ptr__ move(int delta) { - return new __array_of_ptr__(data, currentPos + delta, builder); - } + public void setCString(CString value); - public __array_of_ptr__ plus(int delta) { - return move(delta); - } + public void setPtr(__ptr__ value); - public Area getInternal(int idx) { - return data.get(idx + currentPos); - } + public void setStruct(__struct__ value); - public void setInternalByIndex(int idx, Area value) { - if (value == this) { - throw new IllegalArgumentException(); - } - if (value instanceof __array_of_ptr__) { - throw new IllegalArgumentException(); - } - data.set(idx + currentPos, value); - } + public double getDouble(String fieldName); - // + public void setDouble(String fieldName, double value); - public int getInt() { - return ((AreaInt) getInternal(0)).getInternal(); - } - - public CString getCString() { - return (CString) getInternal(0); - } - - public __ptr__ getPtr() { - if (getInternal(0) instanceof __struct__) { - return ((__struct__) getInternal(0)).amp(); - } - return (__ptr__) getInternal(0); - } - - public __struct__ getStruct() { - if (getInternal(0) instanceof __ptr__) { - return getPtr().getStruct(); - } - return (__struct__) getInternal(0); - } - - public void setInt(int value) { - ((AreaInt) getInternal(0)).setInternal(value); - } - - public void setCString(CString value) { - setInternalByIndex(0, value); - } - - public void setPtr(__ptr__ value) { - setInternalByIndex(0, (Area) value); - } - - public void setStruct(__struct__ value) { - final Area area = getInternal(0); - if (area instanceof StarStruct) { - ((StarStruct) area).copyDataFrom(value); - } else if (area instanceof StarArrayOfPtr) { - ((StarArrayOfPtr) area).copyDataFrom(value); - } else { - ((__struct__) area).____(value); - } - } - - public double getDouble(String fieldName) { - final Area tmp1 = getInternal(0); - return ((StarStruct) tmp1).getDouble(fieldName); - } - - public void setDouble(String fieldName, double value) { - final Area tmp1 = getInternal(0); - if (tmp1 instanceof __struct__) { - ((__struct__) tmp1).setDouble(fieldName, value); - return; - } - ((StarStruct) tmp1).setDouble(fieldName, value); - } - - public __struct__ getStruct(String fieldName) { - return ((StarStruct) getInternal(0)).getStruct(fieldName); - } + public __struct__ getStruct(String fieldName); } diff --git a/src/smetana/core/__array_of_ptr_impl__.java b/src/smetana/core/__array_of_ptr_impl__.java new file mode 100644 index 000000000..96573797d --- /dev/null +++ b/src/smetana/core/__array_of_ptr_impl__.java @@ -0,0 +1,234 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of Smetana. + * Smetana is a partial translation of Graphviz/Dot sources from C to Java. + * + * (C) Copyright 2009-2017, Arnaud Roques + * + * This translation is distributed under the same Licence as the original C program. + * + * THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC + * LICENSE ("AGREEMENT"). [Eclipse Public License - v 1.0] + * + * ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES + * RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + * + * You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package smetana.core; + +import h.ST_boxf; + +import java.util.ArrayList; +import java.util.List; + +import smetana.core.amiga.Area; +import smetana.core.amiga.AreaInt; +import smetana.core.amiga.BuilderArea; +import smetana.core.amiga.StarArrayOfPtr; +import smetana.core.amiga.StarStruct; +import smetana.core.amiga.StarStructImpl; + +public class __array_of_ptr_impl__ implements __array_of_ptr__ { + + private final List data; + private final int currentPos; + private final BuilderArea builder; + + private final int UID = StarStructImpl.CPT++; + + public String getUID36() { + return Integer.toString(UID, 36); + } + + public void memcopyFrom(Area source) { + __array_of_ptr_impl__ other = (__array_of_ptr_impl__) source; + System.err.println("sizeMe=" + this.data.size()); + System.err.println("sizeOt=" + other.data.size()); + + throw new UnsupportedOperationException(); + } + + public void swap(int i, int j) { + Area e1 = data.get(i); + Area e2 = data.get(j); + data.set(i, e2); + data.set(j, e1); + } + + @Override + public String toString() { + if (data.get(0) != null) { + return "__array__ " + getUID36() + " " + currentPos + "/" + data.size() + " " + data.get(0).toString(); + } + return "__array__ " + getUID36() + " " + currentPos + "/" + data.size(); + } + + public void realloc(int nb) { + while (data.size() < nb + currentPos) { + data.add(builder.createArea()); + } + } + + public __ptr__ asPtr() { + return new StarArrayOfPtr(this); + } + + public int comparePointerInternal(__array_of_ptr__ other2) { + final __array_of_ptr_impl__ other = (__array_of_ptr_impl__) other2; + if (this.data != other.data) { + throw new IllegalArgumentException(); + } + return this.currentPos - other.currentPos; + } + + public static __array_of_ptr__ malloc_allocated(final Class cl, int nb) { + return new __array_of_ptr_impl__(nb, new BuilderArea() { + public Area createArea() { + return JUtils.create(cl, null); + } + }); + } + + public static __array_of_ptr__ malloc_empty(int nb) { + return new __array_of_ptr_impl__(nb, new BuilderArea() { + public Area createArea() { + return null; + } + }); + } + + private __array_of_ptr_impl__(List data, int currentPos, BuilderArea builderArea) { + this.data = data; + this.currentPos = currentPos; + this.builder = builderArea; + check(); + } + + private __array_of_ptr_impl__(int size, BuilderArea builder) { + this.data = new ArrayList(); + this.builder = builder; + this.currentPos = 0; + for (int i = 0; i < size; i++) { + data.add(builder.createArea()); + } + check(); + } + + private void check() { + if (getUID36().equals("194")) { + JUtils.LOG("It's me"); + } + } + + public __array_of_ptr_impl__ move(int delta) { + return new __array_of_ptr_impl__(data, currentPos + delta, builder); + } + + public __array_of_ptr_impl__ plus(int delta) { + return move(delta); + } + + public Area getInternal(int idx) { + return data.get(idx + currentPos); + } + + public void setInternalByIndex(int idx, Area value) { + if (value == this) { + throw new IllegalArgumentException(); + } + if (value instanceof __array_of_ptr_impl__) { + throw new IllegalArgumentException(); + } + data.set(idx + currentPos, value); + } + + // + + public int getInt() { + return ((AreaInt) getInternal(0)).getInternal(); + } + + public CString getCString() { + return (CString) getInternal(0); + } + + public __ptr__ getPtr() { + if (getInternal(0) instanceof __struct__) { + return ((__struct__) getInternal(0)).amp(); + } + return (__ptr__) getInternal(0); + } + + public __struct__ getStruct() { + if (getInternal(0) instanceof __ptr__) { + return getPtr().getStruct(); + } + return (__struct__) getInternal(0); + } + + public void setInt(int value) { + ((AreaInt) getInternal(0)).setInternal(value); + } + + public void setCString(CString value) { + setInternalByIndex(0, value); + } + + public void setPtr(__ptr__ value) { + setInternalByIndex(0, (Area) value); + } + + public void setStruct(__struct__ value) { + final Area area = getInternal(0); + if (area instanceof StarStruct) { + ((StarStruct) area).copyDataFrom(value); + } else if (area instanceof StarArrayOfPtr) { + ((StarArrayOfPtr) area).copyDataFrom(value); + } else { + ((__struct__) area).___(value); + } + } + + public double getDouble(String fieldName) { + final Area tmp1 = getInternal(0); + return ((StarStruct) tmp1).getDouble(fieldName); + } + + public void setDouble(String fieldName, double value) { + final Area tmp1 = getInternal(0); + if (tmp1 instanceof __struct__) { + ((__struct__) tmp1).setDouble(fieldName, value); + return; + } + ((StarStruct) tmp1).setDouble(fieldName, value); + } + + public __struct__ getStruct(String fieldName) { + final StarStruct TMP = (StarStruct) getInternal(0); + if (TMP instanceof ST_boxf) { + return ((ST_boxf) TMP).getStructInternal(fieldName); + } + return TMP.getStruct(fieldName); + } + +} diff --git a/src/smetana/core/__array_of_struct__.java b/src/smetana/core/__array_of_struct__.java index 29dd9f14b..688c88ac6 100644 --- a/src/smetana/core/__array_of_struct__.java +++ b/src/smetana/core/__array_of_struct__.java @@ -43,13 +43,14 @@ import smetana.core.amiga.Area; import smetana.core.amiga.BuilderArea; import smetana.core.amiga.StarArrayOfStruct; import smetana.core.amiga.StarStruct; +import smetana.core.amiga.StarStructImpl; public class __array_of_struct__ implements Area { private final List data; private final int currentPos; - private final int UID = StarStruct.CPT++; + private final int UID = StarStructImpl.CPT++; public String getUID36() { return Integer.toString(UID, 36); @@ -91,7 +92,7 @@ public class __array_of_struct__ implements Area { public static __array_of_struct__ malloc(final Class cl, int nb) { return new __array_of_struct__(nb, new BuilderArea() { public Area createArea() { - return new __struct__(cl); + return JUtils.from(cl); } }); } @@ -156,7 +157,7 @@ public class __array_of_struct__ implements Area { public void setStruct(__struct__ value) { final Area area = getInternal(0); - ((__struct__) area).____(value); + ((__struct__) area).___(value); } public double getDouble(String fieldName) { diff --git a/src/smetana/core/__struct__.java b/src/smetana/core/__struct__.java index fc6f8515b..5ce2d4bac 100644 --- a/src/smetana/core/__struct__.java +++ b/src/smetana/core/__struct__.java @@ -37,145 +37,20 @@ package smetana.core; import smetana.core.amiga.Area; -import smetana.core.amiga.StarArrayOfPtr; -import smetana.core.amiga.StarArrayOfStruct; import smetana.core.amiga.StarStruct; -public class __struct__ implements __c__fields, Area { +public interface __struct__ extends __c__fields, Area { - final private StarStruct data; + public __struct__ copy(); - public __struct__(Class cl) { - this.data = (StarStruct) Memory.malloc(cl); - } + public void ___(__struct__ other); - @Override - public String toString() { - return super.toString() + " " + data.getUID36(); - } + public void ____(__ptr__ other); - public __struct__(StarStruct data) { - this.data = data; - } + public StarStruct amp(); - public __struct__ copy() { - final __struct__ result = new __struct__(data.getRealClass()); - if (result.data.getRealClass() != this.data.getRealClass()) { - throw new IllegalStateException(); - } - result.____(this); - return result; - } - - public static __struct__ from(Class cl) { - return new __struct__(cl); - } - - public void ____(__struct__ other) { - data.copyDataFrom(other); - } - - public void ____(__ptr__ other) { - if (other instanceof StarArrayOfPtr) { - ____(((StarArrayOfPtr) other).getStruct()); - return; - } - if (other instanceof StarStruct) { - memcopyFrom((StarStruct) other); - return; - } - if (other instanceof StarArrayOfStruct) { - StarArrayOfStruct array = (StarArrayOfStruct) other; - memcopyFrom(array.getStruct()); - return; - } - throw new UnsupportedOperationException(); - } - - public void memcopyFrom(Area source) { - data.memcopyFrom(source); - } - - public StarStruct amp() { - return data; - } - - public StarStruct getInternalData() { - return data; - } - - public __ptr__ getPtr(String fieldName) { - return data.getPtr(fieldName); - } - - public __struct__ getStruct(String fieldName) { - return data.getStruct(fieldName); - } - - public boolean getBoolean(String fieldName) { - return data.getBoolean(fieldName); - } - - public double getDouble(String fieldName) { - return data.getDouble(fieldName); - } - - public void setCString(String fieldName, CString value) { - data.setCString(fieldName, value); - } - - - public CString getCString(String fieldName) { - return data.getCString(fieldName); - } - - public int getInt(String fieldName) { - return data.getInt(fieldName); - } - - public __ptr__ setPtr(String fieldName, __ptr__ value) { - return data.setPtr(fieldName, value); - } - - public void setStruct(String fieldName, __struct__ value) { - data.setStruct(fieldName, value); - } - - public void setDouble(String fieldName, double value) { - data.setDouble(fieldName, value); - } - - public void setInt(String fieldName, int value) { - data.setInt(fieldName, value); - } - - public void setBoolean(String fieldName, boolean value) { - data.setBoolean(fieldName, value); - } - - public Object call(String name, Object... args) { - return data.call(name, args); - } - -// public __array__ getArray(String fieldName) { -// return data.getArray(fieldName); -// } - - public __array_of_integer__ getArrayOfInteger(String fieldName) { - throw new UnsupportedOperationException(); - } - - public __array_of_struct__ getArrayOfStruct(String fieldName) { - return data.getArrayOfStruct(fieldName); - } - - public __array_of_ptr__ getArrayOfPtr(String fieldName) { - return data.getArrayOfPtr(fieldName); - } - - public __array_of_cstring__ getArrayOfCString(String fieldName) { - throw new UnsupportedOperationException(); - } + public StarStruct getInternalData(); + public Object call(String name, Object... args); } diff --git a/src/smetana/core/__struct_impl__.java b/src/smetana/core/__struct_impl__.java new file mode 100644 index 000000000..1f6c598a4 --- /dev/null +++ b/src/smetana/core/__struct_impl__.java @@ -0,0 +1,177 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of Smetana. + * Smetana is a partial translation of Graphviz/Dot sources from C to Java. + * + * (C) Copyright 2009-2017, Arnaud Roques + * + * This translation is distributed under the same Licence as the original C program. + * + * THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC + * LICENSE ("AGREEMENT"). [Eclipse Public License - v 1.0] + * + * ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES + * RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + * + * You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package smetana.core; + +import smetana.core.amiga.Area; +import smetana.core.amiga.StarArrayOfPtr; +import smetana.core.amiga.StarArrayOfStruct; +import smetana.core.amiga.StarStruct; + +public class __struct_impl__ implements __struct__ { + + final private StarStruct data; + + public __struct_impl__(Class cl) { + this.data = (StarStruct) Memory.malloc(cl); + } + + @Override + public String toString() { + return super.toString() + " " + data.getUID36(); + } + + public __struct_impl__(StarStruct data) { + this.data = data; + } + + public __struct_impl__ copy() { + final __struct_impl__ result = new __struct_impl__(data.getRealClass()); + if (result.data.getRealClass() != this.data.getRealClass()) { + throw new IllegalStateException(); + } + result.___(this); + return result; + } + + public void ___(__struct__ other) { + data.copyDataFrom(other); + } + + public void ____(__ptr__ other) { + if (other instanceof StarArrayOfPtr) { + ___(((StarArrayOfPtr) other).getStruct()); + return; + } + if (other instanceof StarStruct) { + memcopyFrom((StarStruct) other); + return; + } + if (other instanceof StarArrayOfStruct) { + StarArrayOfStruct array = (StarArrayOfStruct) other; + memcopyFrom(array.getStruct()); + return; + } + throw new UnsupportedOperationException(); + } + + public void memcopyFrom(Area source) { + data.memcopyFrom(source); + } + + public StarStruct amp() { + return data; + } + + public StarStruct getInternalData() { + return data; + } + + public __ptr__ getPtr(String fieldName) { + return data.getPtr(fieldName); + } + + public __struct__ getStruct(String fieldName) { + return data.getStruct(fieldName); + } + + public boolean getBoolean(String fieldName) { + return data.getBoolean(fieldName); + } + + public double getDouble(String fieldName) { + return data.getDouble(fieldName); + } + + public void setCString(String fieldName, CString value) { + data.setCString(fieldName, value); + } + + + public CString getCString(String fieldName) { + return data.getCString(fieldName); + } + + public int getInt(String fieldName) { + return data.getInt(fieldName); + } + + public __ptr__ setPtr(String fieldName, __ptr__ value) { + return data.setPtr(fieldName, value); + } + + public void setStruct(String fieldName, __struct__ value) { + data.setStruct(fieldName, value); + } + + public void setDouble(String fieldName, double value) { + data.setDouble(fieldName, value); + } + + public void setInt(String fieldName, int value) { + data.setInt(fieldName, value); + } + + public void setBoolean(String fieldName, boolean value) { + data.setBoolean(fieldName, value); + } + + public Object call(String name, Object... args) { + return data.call(name, args); + } + +// public __array__ getArray(String fieldName) { +// return data.getArray(fieldName); +// } + + public __array_of_integer__ getArrayOfInteger(String fieldName) { + throw new UnsupportedOperationException(); + } + + public __array_of_struct__ getArrayOfStruct(String fieldName) { + return data.getArrayOfStruct(fieldName); + } + + public __array_of_ptr__ getArrayOfPtr(String fieldName) { + return data.getArrayOfPtr(fieldName); + } + + public __array_of_cstring__ getArrayOfCString(String fieldName) { + throw new UnsupportedOperationException(); + } + + +} diff --git a/src/smetana/core/amiga/AreaInt.java b/src/smetana/core/amiga/AreaInt.java index bb21991ef..9224e1e34 100644 --- a/src/smetana/core/amiga/AreaInt.java +++ b/src/smetana/core/amiga/AreaInt.java @@ -40,7 +40,7 @@ public class AreaInt implements Area { private int data = 0; - private final int UID = StarStruct.CPT++; + private final int UID = StarStructImpl.CPT++; private String getUID36() { return Integer.toString(UID, 36); diff --git a/src/smetana/core/amiga/BucketToAreaFactory.java b/src/smetana/core/amiga/BucketToAreaFactory.java index 7a1dc9da6..9046b885a 100644 --- a/src/smetana/core/amiga/BucketToAreaFactory.java +++ b/src/smetana/core/amiga/BucketToAreaFactory.java @@ -41,7 +41,7 @@ import smetana.core.CType; import smetana.core.JUtils; import smetana.core.__array_of_double__; import smetana.core.__array_of_integer__; -import smetana.core.__array_of_ptr__; +import smetana.core.__array_of_ptr_impl__; import smetana.core.__array_of_struct__; public class BucketToAreaFactory { @@ -102,7 +102,7 @@ public class BucketToAreaFactory { } if (bucket.inlineStruct()) { final Class theClass = bucket.ctype.getTypeClass(); - return new StarStruct(theClass, parent); + return JUtils.create(theClass, parent); } if (bucket.ctype.isArrayOfCString()) { return null; @@ -145,7 +145,7 @@ public class BucketToAreaFactory { JUtils.LOG("element=" + element); final Class theClass = CType.getClassFrom(element); JUtils.LOG("theClass=" + theClass); - return __array_of_ptr__.malloc_empty(arrayLength); + return __array_of_ptr_impl__.malloc_empty(arrayLength); } if (bucket.ctype.getType().matches("\\w+ \\w+\\[\\d+\\]")) { // Array of Struct diff --git a/src/smetana/core/amiga/InternalData.java b/src/smetana/core/amiga/InternalData.java new file mode 100644 index 000000000..dc94cb2ff --- /dev/null +++ b/src/smetana/core/amiga/InternalData.java @@ -0,0 +1,42 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of Smetana. + * Smetana is a partial translation of Graphviz/Dot sources from C to Java. + * + * (C) Copyright 2009-2017, Arnaud Roques + * + * This translation is distributed under the same Licence as the original C program. + * + * THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC + * LICENSE ("AGREEMENT"). [Eclipse Public License - v 1.0] + * + * ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES + * RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + * + * You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package smetana.core.amiga; + +public interface InternalData { + public Area getArea(String name); + +} diff --git a/src/smetana/core/amiga/StarArrayOfPtr.java b/src/smetana/core/amiga/StarArrayOfPtr.java index d1d3f3588..399441c06 100644 --- a/src/smetana/core/amiga/StarArrayOfPtr.java +++ b/src/smetana/core/amiga/StarArrayOfPtr.java @@ -36,6 +36,7 @@ package smetana.core.amiga; +import h.ST_boxf; import smetana.core.AllH; import smetana.core.UnsupportedC; import smetana.core.__array_of_ptr__; @@ -60,7 +61,7 @@ public class StarArrayOfPtr extends UnsupportedC implements Area, AllH { } public void memcopyFrom(Area source) { - throw new UnsupportedOperationException(); + ((StarStruct) array.getInternal(0)).memcopyFrom(source); } public final __array_of_ptr__ getInternalArray() { @@ -143,7 +144,11 @@ public class StarArrayOfPtr extends UnsupportedC implements Area, AllH { } public __struct__ getStruct(String fieldName) { - return ((__ptr__) array.getInternal(0)).getStruct(fieldName); + __ptr__ TMP = (__ptr__) array.getInternal(0); + if (TMP instanceof ST_boxf) { + return ((ST_boxf) TMP).getStructInternal(fieldName); + } + return TMP.getStruct(fieldName); } public void setDouble(String fieldName, double data) { diff --git a/src/smetana/core/amiga/StarStar.java b/src/smetana/core/amiga/StarStar.java index e604f3433..1b1448f99 100644 --- a/src/smetana/core/amiga/StarStar.java +++ b/src/smetana/core/amiga/StarStar.java @@ -38,6 +38,7 @@ package smetana.core.amiga; import smetana.core.UnsupportedC; import smetana.core.__array_of_ptr__; +import smetana.core.__array_of_ptr_impl__; import smetana.core.__ptr__; public class StarStar extends UnsupportedC implements Area { @@ -49,10 +50,7 @@ public class StarStar extends UnsupportedC implements Area { } public static StarStar array_of_array_of_something_empty(final Class cl, int nb) { - // if (allocated) { - // return new StarStar(__array__.malloc(cl, nb)); - // } - return new StarStar(__array_of_ptr__.malloc_empty(nb)); + return new StarStar(__array_of_ptr_impl__.malloc_empty(nb)); } public String toString() { diff --git a/src/smetana/core/amiga/StarStruct.java b/src/smetana/core/amiga/StarStruct.java index b3913afeb..b9b16d3ab 100644 --- a/src/smetana/core/amiga/StarStruct.java +++ b/src/smetana/core/amiga/StarStruct.java @@ -36,23 +36,8 @@ package smetana.core.amiga; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; - import smetana.core.AllH; -import smetana.core.Bucket; -import smetana.core.CFunction; -import smetana.core.CFunctionImpl; -import smetana.core.CObject; import smetana.core.CString; -import smetana.core.JUtils; -import smetana.core.MutableDoublePtr; -import smetana.core.OFFSET; -import smetana.core.StructureDefinition; -import smetana.core.UnsupportedC; import smetana.core.__array_of_cstring__; import smetana.core.__array_of_integer__; import smetana.core.__array_of_ptr__; @@ -60,590 +45,64 @@ import smetana.core.__array_of_struct__; import smetana.core.__ptr__; import smetana.core.__struct__; -public class StarStruct extends UnsupportedC implements Area, AllH { +public interface StarStruct extends Area, AllH, InternalData { - public static int CPT = 0; + public boolean isSameThan(StarStruct other); - private final int UID = CPT++; - private final Map fields; - private final Set inlineFields = new HashSet(); - private final StarStruct parent; - private final Class theClass; + public Class getRealClass(); - public boolean isSameThan(StarStruct other) { - return this.UID == other.UID; - } + public __struct__ getStruct(); - @Override - public String toString() { - return "StarStruct " + getUID36() + " " + theClass + " " + fields.keySet() + " {parent=" + parent + "}"; - } + public String getUID36(); - public static StarStruct malloc(Class cl) { - return new StarStruct(cl, null); - } + public String getDebug(String fieldName); - public Class getRealClass() { - return theClass; - } + public void setInt(String fieldName, int data); - private int getIndexOf(Area searched) { - int i = 0; - for (Area a : fields.values()) { - if (a == searched) { - return i; - } - i++; - } - throw new IllegalArgumentException(); - } + public void setBoolean(String fieldName, boolean data); - private Area getAreaByIndex(int idx) { - int i = 0; - for (Area a : fields.values()) { - if (i == idx) { - return a; - } - i++; - } - throw new IllegalArgumentException(); - } + public void setDouble(String fieldName, double data); - public __struct__ getStruct() { - return new __struct__(this); - } + public int getInt(String fieldName); - public StarStruct(Class theClass, StarStruct parent) { - this.parent = parent; - this.theClass = theClass; - this.fields = new LinkedHashMap(); - JUtils.LOG("Creation Struct " + getUID36()); - if (getUID36().equals("2tg")) { - JUtils.LOG("It's me"); - } - final StructureDefinition structureDefinition = StructureDefinition.from(theClass); - final Map bucketsMap = structureDefinition.getBucketsMap(); + public double getDouble(String fieldName); - JUtils.LOG("FIELDS = " + theClass + " " + bucketsMap.keySet()); - for (Map.Entry ent : bucketsMap.entrySet()) { - // JUtils.LOG("AreaStruct entrie=" + ent.getKey()); - final Bucket bucket = ent.getValue(); - fields.put(bucket.name, BucketToAreaFactory.createArea(bucket, this)); - if (bucket.inlineStruct() && bucket.functionPointer() == false) { - inlineFields.add(bucket.name); - } - } - } + public boolean getBoolean(String fieldName); - public Area getArea(String name) { - if (fields.containsKey(name) == false) { - System.err.println("fields=" + fields.keySet()); - throw new IllegalArgumentException("No such field " + name); - } - final Area result = fields.get(name); - return result; - } + public __ptr__ plus(int pointerMove); - public String getUID36() { - return Integer.toString(UID, 36); - } + public CString getCString(String fieldName); - // __c__ + public __array_of_struct__ getArrayOfStruct(String fieldName); - public String getDebug(String fieldName) { - throw new UnsupportedOperationException(); - } + public __array_of_ptr__ getArrayOfPtr(String fieldName); - public void setInt(String fieldName, int data) { - final AreaInt area = (AreaInt) getArea(fieldName); - area.setInternal(data); - } + public __array_of_cstring__ getArrayOfCString(String fieldName); - public void setBoolean(String fieldName, boolean data) { - final AreaInt area = (AreaInt) getArea(fieldName); - area.setInternal(data ? 1 : 0); - } + public __array_of_integer__ getArrayOfInteger(String fieldName); - public void setDouble(String fieldName, double data) { - // if (fieldName.equals("x") && Math.round(data) == 54) { - // System.err.println("setDoubleTrace 54!!"); - // } - final AreaDouble area = (AreaDouble) getArea(fieldName); - area.setInternal(data); - } + public __struct__ getStruct(String fieldName); - public int getInt(String fieldName) { - final AreaInt area = (AreaInt) getArea(fieldName); - return area.getInternal(); - } + public __ptr__ getPtr(String fieldName); - public double getDouble(String fieldName) { - final AreaDouble area = (AreaDouble) getArea(fieldName); - return area.getInternal(); - } + public void setStruct(String fieldName, __struct__ newData); - public boolean getBoolean(String fieldName) { - final AreaInt area = (AreaInt) getArea(fieldName); - if (area == null) { - return false; - } - return area.getInternal() != 0; - } + public void setCString(String fieldName, CString newData); - // public int getArrayAsInt(String fieldName, int idx) { - // final AreaArray tab = (AreaArray) getArea(fieldName); - // final AreaInt area = (AreaInt) tab.getInternal(idx); - // return area.getInternal(); - // } - // - // public __ptr__ getArray(String fieldName, int idx) { - // Area tab = getArea(fieldName); - // if (tab instanceof AreaArray) { - // final Area area = ((AreaArray) tab).getInternal(idx); - // return (__ptr__) area; - // } - // if (tab instanceof StarStar) { - // final Area area = ((AreaArray) ((StarStar) tab).getArea()).getInternal(idx); - // return (__ptr__) area; - // } - // throw new UnsupportedOperationException(); - // } - // - // public void setArrayAsCString(String fieldName, int idx, CString value) { - // Area area = getArea(fieldName); - // if (area instanceof CObject) { - // area = ((CObject) area).convertToAreaArray(); - // fields.put(fieldName, area); - // } - // final AreaArray tab = (AreaArray) area; - // tab.setInternalByIndex(idx, value); - // } - // - // public CString getArrayAsCString(String fieldName, int idx) { - // final AreaArray tab = (AreaArray) getArea(fieldName); - // return (CString) tab.getInternal(idx); - // } - // - // public void setArrayAsInt(String fieldName, int idx, int value) { - // final AreaArray tab = (AreaArray) getArea(fieldName); - // final AreaInt area = (AreaInt) tab.getInternal(idx); - // area.setInternal(value); - // } - // - // public void setArray(String fieldName, int idx, Object data) { - // JUtils.LOG("---------- set " + fieldName); - // JUtils.LOG("I AM " + this); - // Area area = getArea(fieldName); - // JUtils.LOG("area1 " + area); - // final AreaArray tab; - // if (area instanceof StarStar) { - // tab = (AreaArray) ((StarStar) area).getArea(); - // } else { - // tab = ((AreaArray) area); - // } - // JUtils.LOG("tab " + tab); - // tab.setBracket(idx, data); - // } + public __ptr__ setPtr(String fieldName, __ptr__ newData); - public __ptr__ plus(int pointerMove) { - JUtils.LOG("******************* plus =" + pointerMove); - JUtils.LOG("me=" + this); - if (parent != null) { - int idx = parent.getIndexOf(this); - JUtils.LOG("idx=" + idx); - idx += pointerMove; - final Area result = parent.getAreaByIndex(idx); - JUtils.LOG("result=" + result); - return (__ptr__) result; - } - throw new UnsupportedOperationException(getClass().toString()); - } + public void memcopyFrom(Area source); - public CString getCString(String fieldName) { - return (CString) getArea(fieldName); - } + public void copyDataFrom(__struct__ other); - // public __array__ getArray(String fieldName) { - // Area area = getArea(fieldName); - // if (area instanceof StarArray) { - // area = ((StarArray) area).getInternalArray(); - // } else if (area instanceof StarStar) { - // area = ((StarStar) area).getArea(); - // } - // return (__array__) area; - // } + public void setStruct(__struct__ value); - public __array_of_struct__ getArrayOfStruct(String fieldName) { - Area area = getArea(fieldName); - if (area instanceof StarArrayOfStruct) { - return ((StarArrayOfStruct) area).getInternalArray(); - } - return (__array_of_struct__) area; - } + public void copyDataFrom(__ptr__ arg); - public __array_of_ptr__ getArrayOfPtr(String fieldName) { - Area area = getArea(fieldName); - if (area instanceof StarStar) { - return (__array_of_ptr__) ((StarStar) area).getArea(); - } - if (area instanceof StarArrayOfPtr) { - return (__array_of_ptr__) ((StarArrayOfPtr) area).getInternalArray(); - } - return (__array_of_ptr__) area; - } + public Object call(String fieldName, Object... args); - public __array_of_cstring__ getArrayOfCString(String fieldName) { - Area area = getArea(fieldName); - if (area instanceof StarArrayOfCString) { - return ((StarArrayOfCString) area).getInternalArray(); - } - return (__array_of_cstring__) area; - } + public __ptr__ castTo(Class dest); - public __array_of_integer__ getArrayOfInteger(String fieldName) { - Area area = getArea(fieldName); - if (area instanceof StarArrayOfInteger) { - return ((StarArrayOfInteger) area).getInternalArray(); - } - return (__array_of_integer__) area; - } - - public __struct__ getStruct(String fieldName) { - // if (getArea(fieldName) instanceof __array__) { - // return ((__array__) getArea(fieldName)).getStruct(0); - // } - if (getArea(fieldName) != null && getArea(fieldName) instanceof __ptr__ == false) { - throw new IllegalArgumentException("Issue in getStruct with " + fieldName + " " - + getArea(fieldName).getClass()); - } - final __ptr__ area = (__ptr__) getArea(fieldName); - // if (area instanceof StarArray) { - // final __array__ array = ((StarArray) area).getInternalArray(); - // return new __struct__<__ptr__>((StarStruct) array.getInternal(0)); - // } - if (area instanceof StarStruct == false) { - throw new IllegalStateException(area.getClass().toString()); - } - if (area instanceof StarStruct && this.inlineFields.contains(fieldName) == false) { - throw new IllegalArgumentException(fieldName + " is NOT inline!"); - } - return new __struct__<__ptr__>((StarStruct) area); - } - - public __ptr__ getPtr(String fieldName) { - if (getArea(fieldName) != null && getArea(fieldName) instanceof __ptr__ == false) { - throw new IllegalArgumentException("Issue in getStruct with " + fieldName + " " - + getArea(fieldName).getClass()); - } - final __ptr__ area = (__ptr__) getArea(fieldName); - if (area == null) { - return null; - } - if (area instanceof StarStruct == false && area instanceof CFunctionImpl == false - && area instanceof CString == false && area instanceof StarStar == false - && area instanceof StarArrayOfPtr == false && area instanceof StarArrayOfStruct == false - && area instanceof StarArrayOfInteger == false && area instanceof MutableDoublePtr == false - /* && area instanceof AreaArray == false */) { - throw new IllegalStateException(area.getClass().toString()); - } - - if (area instanceof StarStruct && this.inlineFields.contains(fieldName)) { - throw new IllegalArgumentException(fieldName + " is inline!"); - } - return area; - } - - public void setStruct(String fieldName, __struct__ newData) { - if (newData == null) { - throw new IllegalArgumentException(); - } - if (inlineFields.contains(fieldName) == false) { - throw new UnsupportedOperationException("IMPOSSIBLE2 " + fieldName); - } - final StarStruct existing = (StarStruct) fields.get(fieldName); - if (existing == null) { - throw new UnsupportedOperationException("IMPOSSIBLE3 " + fieldName); - } - existing.copyDataFrom(newData); - } - - public void setCString(String fieldName, CString newData) { - if (newData == null) { - fields.put(fieldName, null); - } else { - fields.put(fieldName, (Area) newData); - ((CString) newData).setMyFather(this); - } - } - - public __ptr__ setPtr(String fieldName, __ptr__ newData) { - if (newData instanceof CFunction) { - fields.put(fieldName, (Area) newData); - return newData; - } - if (inlineFields.contains(fieldName)) { - throw new UnsupportedOperationException("IMPOSSIBLE5 " + fieldName); - } - if (newData == null) { - fields.put(fieldName, null); - return null; - } - if (newData instanceof StarStruct) { - if (inlineFields.contains(fieldName)) { - throw new UnsupportedOperationException("IMPOSSIBLE1"); - } else { - fields.put(fieldName, (Area) newData); - } - return newData; - } - if (newData instanceof CString) { - fields.put(fieldName, (Area) newData); - ((CString) newData).setMyFather(this); - return newData; - } - if (newData instanceof StarArrayOfPtr) { - fields.put(fieldName, (Area) newData); - return newData; - } - if (newData instanceof StarArrayOfStruct) { - fields.put(fieldName, (Area) newData); - return newData; - } - if (newData instanceof StarStar) { - fields.put(fieldName, (Area) newData); - return newData; - } - if (newData instanceof StarArrayOfCString) { - fields.put(fieldName, (Area) newData); - return newData; - } - if (newData instanceof MutableDoublePtr) { - fields.put(fieldName, (Area) newData); - return newData; - } - if (newData instanceof StarArrayOfInteger) { - fields.put(fieldName, (Area) newData); - return newData; - } - // if (newData instanceof AreaArray) { - // fields.put(fieldName, (Area) newData); - // return newData; - // } - throw new UnsupportedOperationException("en cours1 ! " + newData.getClass()); - } - - private Object setOld(String fieldName, Object newData) { - JUtils.LOG("set " + fieldName); - if (fields.containsKey(fieldName) == false) { - throw new IllegalArgumentException(); - } - if (newData == null) { - fields.put(fieldName, null); - return null; - } - final Area field = getArea(fieldName); - if (newData instanceof CFunction) { - fields.put(fieldName, (Area) newData); - return newData; - } - if (newData instanceof CString) { - fields.put(fieldName, (Area) newData); - ((CString) newData).setMyFather(this); - return newData; - } - if (newData instanceof Boolean) { - final AreaInt area = (AreaInt) field; - area.setInternal((Boolean) newData == true ? 1 : 0); - return newData; - } - if (newData instanceof Integer) { - final AreaInt area = (AreaInt) field; - area.setInternal((Integer) newData); - return newData; - } - if (newData instanceof Double) { - final AreaDouble area = (AreaDouble) field; - area.setInternal((Double) newData); - return newData; - } - if (newData instanceof StarStruct) { - StarStruct existing = (StarStruct) fields.get(fieldName); - if (inlineFields.contains(fieldName)) { - System.err.println("I AM " + this); - System.err.println("fieldName=" + fieldName); - System.err.println("existing=" + existing); - existing.copyDataFrom((__ptr__) newData); - } else { - fields.put(fieldName, (Area) newData); - } - return newData; - } - if (newData instanceof __struct__) { - return setPtr(fieldName, ((StarStruct) ((__struct__) newData).getInternalData())); - } - if (newData instanceof CObject) { - fields.put(fieldName, (Area) newData); - return newData; - } - // if (newData instanceof AreaArray) { - // fields.put(fieldName, (Area) newData); - // return newData; - // } - if (newData instanceof StarStar) { - fields.put(fieldName, (Area) newData); - return newData; - } - throw new UnsupportedOperationException(newData.getClass().toString()); - } - - public void memcopyFrom(Area source) { - if (source instanceof StarArrayOfPtr) { - final __array_of_ptr__ array = ((StarArrayOfPtr) source).getInternalArray(); - copyDataFrom((StarStruct) array.getInternal(0)); - } else if (source instanceof __struct__) { - copyDataFrom((__struct__) source); - } else { - copyDataFrom((StarStruct) source); - } - } - - public void copyDataFrom(__struct__ other) { - copyDataFrom(other.getInternalData()); - } - - public void setStruct(__struct__ value) { - copyDataFrom(value); - } - - public void copyDataFrom(__ptr__ arg) { - JUtils.LOG("copyDataFrom I AM " + this); - JUtils.LOG("other=" + arg); - JUtils.LOG("FIELDS=" + fields.keySet()); - if (this.getClass() != arg.getClass()) { - throw new UnsupportedOperationException(getClass().toString()); - } - StarStruct other = (StarStruct) arg; - if (fields.keySet().equals(other.fields.keySet()) == false) { - throw new IllegalStateException(); - } - for (String fieldName : new TreeSet(fields.keySet())) { - Area field = fields.get(fieldName); - final Area otherField = other.getArea(fieldName); - if (field == null && otherField == null) { - continue; - } - if (field == null) { - if (otherField instanceof StarStruct && inlineFields.contains(fieldName) == false) { - fields.put(fieldName, otherField); - } else if (otherField instanceof CString) { - fields.put(fieldName, otherField); - } else if (otherField instanceof StarStar) { - fields.put(fieldName, otherField); - } else if (otherField instanceof StarArrayOfPtr) { - fields.put(fieldName, otherField); - } else if (otherField instanceof CFunction) { - fields.put(fieldName, otherField); - } else if (otherField instanceof StarArrayOfStruct) { - fields.put(fieldName, otherField); - } else { - System.err.println("XX otherField = " + otherField); - throw new UnsupportedOperationException(otherField.getClass().toString()); - } - } else if (field instanceof AreaInt) { - field.memcopyFrom(otherField); - } else if (field instanceof AreaDouble) { - field.memcopyFrom(otherField); - } else if (field instanceof CString) { - field.memcopyFrom(otherField); - } else if (field instanceof StarStar) { - if (otherField == null) { - fields.put(fieldName, null); - } else { - field.memcopyFrom(otherField); - } - } else if (field instanceof StarStruct && inlineFields.contains(fieldName)) { - field.memcopyFrom(otherField); - } else if (field instanceof StarStruct && inlineFields.contains(fieldName) == false) { - fields.put(fieldName, otherField); - } else if (field instanceof StarArrayOfPtr) { - field.memcopyFrom(otherField); - } else { - System.err.println("fieldName=" + fieldName + " " + field); - System.err.println("otherField = " + otherField); - throw new UnsupportedOperationException(field.getClass().toString()); - } - } - } - - public Object call(String fieldName, Object... args) { - final CFunction area = (CFunction) getArea(fieldName); - return area.exe(args); - } - - public __ptr__ castTo(Class dest) { - JUtils.LOG("******************* castTo =" + dest); - JUtils.LOG("me=" + this); - if (theClass == dest) { - return this; - } - if (parent != null && parent.theClass == dest) { - JUtils.LOG("IT's my father!"); - return parent; - } - - final Area first = fields.values().iterator().next(); - JUtils.LOG("first=" + first); - if (first instanceof StarStruct) { - final StarStruct first2 = (StarStruct) first; - JUtils.LOG("first.parent=" + first2.parent); - if (first2.parent != this) { - throw new IllegalStateException(); - } - if (dest == first2.theClass) { - return first2; - } - } - throw new UnsupportedOperationException(); - } - - public Object addVirtualBytes(int virtualBytes) { - JUtils.LOG("#### addVirtualBytes " + virtualBytes); - if (virtualBytes == 0) { - return this; - } - JUtils.LOG("this=" + toString()); - if (virtualBytes < 0) { - final OFFSET offset = OFFSET.fromInt(-virtualBytes); - JUtils.LOG("OFFSET1=" + offset); - if (parent == null) { - throw new UnsupportedOperationException("No father! How to go back?"); - } - JUtils.LOG("father=" + parent); - if (parent.theClass != offset.getTheClass()) { - throw new UnsupportedOperationException("Bad class matching1!"); - } - final Object checking = parent.addVirtualBytes(-virtualBytes); - JUtils.LOG("checking=" + checking); - if (checking != this) { - throw new UnsupportedOperationException("Cheking fail!"); - } - return parent; - } - final OFFSET offset = OFFSET.fromInt(virtualBytes); - JUtils.LOG("OFFSET2=" + offset); - final String field = offset.getField(); - JUtils.LOG("field=" + field); - JUtils.LOG("fields=" + fields.keySet()); - final Area result = fields.get(field); - if (result == null && parent != null) { - return parent.addVirtualBytes(virtualBytes); - } - if (result == null) { - throw new UnsupportedOperationException(); - } - return result; - } - - // __c__ + public Object addVirtualBytes(int virtualBytes); } diff --git a/src/smetana/core/amiga/StarStructImpl.java b/src/smetana/core/amiga/StarStructImpl.java new file mode 100644 index 000000000..44ddc1112 --- /dev/null +++ b/src/smetana/core/amiga/StarStructImpl.java @@ -0,0 +1,534 @@ +/* ======================================================================== + * PlantUML : a free UML diagram generator + * ======================================================================== + * + * Project Info: http://plantuml.com + * + * If you like this project or if you find it useful, you can support us at: + * + * http://plantuml.com/patreon (only 1$ per month!) + * http://plantuml.com/paypal + * + * This file is part of Smetana. + * Smetana is a partial translation of Graphviz/Dot sources from C to Java. + * + * (C) Copyright 2009-2017, Arnaud Roques + * + * This translation is distributed under the same Licence as the original C program. + * + * THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC + * LICENSE ("AGREEMENT"). [Eclipse Public License - v 1.0] + * + * ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES + * RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. + * + * You may obtain a copy of the License at + * + * http://www.eclipse.org/legal/epl-v10.html + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package smetana.core.amiga; + +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; + +import smetana.core.Bucket; +import smetana.core.CFunction; +import smetana.core.CFunctionImpl; +import smetana.core.CString; +import smetana.core.HardcodedStruct; +import smetana.core.JUtils; +import smetana.core.MutableDoublePtr; +import smetana.core.OFFSET; +import smetana.core.StructureDefinition; +import smetana.core.UnsupportedC; +import smetana.core.__array_of_cstring__; +import smetana.core.__array_of_integer__; +import smetana.core.__array_of_ptr__; +import smetana.core.__array_of_struct__; +import smetana.core.__ptr__; +import smetana.core.__struct__; +import smetana.core.__struct_impl__; + +public class StarStructImpl extends UnsupportedC implements StarStruct { + + public static int CPT = 0; + + private final int UID = CPT++; + private final Map fields; + private final Set inlineFields = new HashSet(); + private final StarStruct parent; + private final Class theClass; + + public boolean isSameThan(StarStruct other) { + return this.UID == ((StarStructImpl) other).UID; + } + + @Override + public String toString() { + return "StarStruct " + getUID36() + " " + theClass + " " + fields.keySet() + " {parent=" + parent + "}"; + } + + public Class getRealClass() { + return theClass; + } + + private int getIndexOf(Area searched) { + int i = 0; + for (Area a : fields.values()) { + if (a == searched) { + return i; + } + i++; + } + throw new IllegalArgumentException(); + } + + private Area getAreaByIndex(int idx) { + int i = 0; + for (Area a : fields.values()) { + if (i == idx) { + return a; + } + i++; + } + throw new IllegalArgumentException(); + } + + public __struct__ getStruct() { + return new __struct_impl__(this); + } + + public StarStructImpl(Class theClass, StarStruct parent) { + this.parent = parent; + this.theClass = theClass; + this.fields = new LinkedHashMap(); + JUtils.LOG("Creation Struct " + getUID36()); + if (getUID36().equals("2tg")) { + JUtils.LOG("It's me"); + } + final StructureDefinition structureDefinition = StructureDefinition.from(theClass); + final Map bucketsMap = structureDefinition.getBucketsMap(); + + JUtils.LOG("FIELDS = " + theClass + " " + bucketsMap.keySet()); + for (Map.Entry ent : bucketsMap.entrySet()) { + // JUtils.LOG("AreaStruct entrie=" + ent.getKey()); + final Bucket bucket = ent.getValue(); + fields.put(bucket.name, BucketToAreaFactory.createArea(bucket, this)); + if (bucket.inlineStruct() && bucket.functionPointer() == false) { + inlineFields.add(bucket.name); + } + } + } + + public Area getArea(String name) { + if (fields.containsKey(name) == false) { + System.err.println("fields=" + fields.keySet()); + throw new IllegalArgumentException("No such field " + name); + } + final Area result = fields.get(name); + return result; + } + + public String getUID36() { + return Integer.toString(UID, 36); + } + + // __c__ + + public String getDebug(String fieldName) { + throw new UnsupportedOperationException(); + } + + public void setInt(String fieldName, int data) { + final AreaInt area = (AreaInt) getArea(fieldName); + area.setInternal(data); + } + + public void setBoolean(String fieldName, boolean data) { + final AreaInt area = (AreaInt) getArea(fieldName); + area.setInternal(data ? 1 : 0); + } + + public void setDouble(String fieldName, double data) { + // if (fieldName.equals("x") && Math.round(data) == 54) { + // System.err.println("setDoubleTrace 54!!"); + // } + final AreaDouble area = (AreaDouble) getArea(fieldName); + area.setInternal(data); + } + + public int getInt(String fieldName) { + final AreaInt area = (AreaInt) getArea(fieldName); + return area.getInternal(); + } + + public double getDouble(String fieldName) { + final AreaDouble area = (AreaDouble) getArea(fieldName); + return area.getInternal(); + } + + public boolean getBoolean(String fieldName) { + final AreaInt area = (AreaInt) getArea(fieldName); + if (area == null) { + return false; + } + return area.getInternal() != 0; + } + + public __ptr__ plus(int pointerMove) { + JUtils.LOG("******************* plus =" + pointerMove); + JUtils.LOG("me=" + this); + if (parent != null) { + int idx = ((StarStructImpl) parent).getIndexOf(this); + JUtils.LOG("idx=" + idx); + idx += pointerMove; + final Area result = ((StarStructImpl) parent).getAreaByIndex(idx); + JUtils.LOG("result=" + result); + return (__ptr__) result; + } + throw new UnsupportedOperationException(getClass().toString()); + } + + public CString getCString(String fieldName) { + return (CString) getArea(fieldName); + } + + public __array_of_struct__ getArrayOfStruct(String fieldName) { + Area area = getArea(fieldName); + if (area instanceof StarArrayOfStruct) { + return ((StarArrayOfStruct) area).getInternalArray(); + } + return (__array_of_struct__) area; + } + + public __array_of_ptr__ getArrayOfPtr(String fieldName) { + Area area = getArea(fieldName); + if (area instanceof StarStar) { + return (__array_of_ptr__) ((StarStar) area).getArea(); + } + if (area instanceof StarArrayOfPtr) { + return (__array_of_ptr__) ((StarArrayOfPtr) area).getInternalArray(); + } + return (__array_of_ptr__) area; + } + + public __array_of_cstring__ getArrayOfCString(String fieldName) { + Area area = getArea(fieldName); + if (area instanceof StarArrayOfCString) { + return ((StarArrayOfCString) area).getInternalArray(); + } + return (__array_of_cstring__) area; + } + + public __array_of_integer__ getArrayOfInteger(String fieldName) { + Area area = getArea(fieldName); + if (area instanceof StarArrayOfInteger) { + return ((StarArrayOfInteger) area).getInternalArray(); + } + return (__array_of_integer__) area; + } + + public __struct__ getStruct(String fieldName) { + // if (getArea(fieldName) instanceof __array__) { + // return ((__array__) getArea(fieldName)).getStruct(0); + // } + if (getArea(fieldName) != null && getArea(fieldName) instanceof __ptr__ == false) { + throw new IllegalArgumentException("Issue in getStruct with " + fieldName + " " + + getArea(fieldName).getClass()); + } + final __ptr__ area = (__ptr__) getArea(fieldName); + // if (area instanceof StarArray) { + // final __array__ array = ((StarArray) area).getInternalArray(); + // return new __struct__<__ptr__>((StarStruct) array.getInternal(0)); + // } + if (area instanceof HardcodedStruct) { + return (__struct__) area; + } + if (area instanceof StarStructImpl == false) { + throw new IllegalStateException(fieldName + " " + area.getClass().toString()); + } + if (area instanceof StarStructImpl && this.inlineFields.contains(fieldName) == false) { + throw new IllegalArgumentException(fieldName + " is NOT inline!"); + } + return new __struct_impl__<__ptr__>((StarStructImpl) area); + } + + public __ptr__ getPtr(String fieldName) { + if (getArea(fieldName) != null && getArea(fieldName) instanceof __ptr__ == false) { + throw new IllegalArgumentException("Issue in getStruct with " + fieldName + " " + + getArea(fieldName).getClass()); + } + final __ptr__ area = (__ptr__) getArea(fieldName); + if (area == null) { + return null; + } + if (area instanceof StarStruct == false && area instanceof CFunctionImpl == false + && area instanceof CString == false && area instanceof StarStar == false + && area instanceof StarArrayOfPtr == false && area instanceof StarArrayOfStruct == false + && area instanceof StarArrayOfInteger == false && area instanceof MutableDoublePtr == false + /* && area instanceof AreaArray == false */) { + throw new IllegalStateException(area.getClass().toString()); + } + + if (area instanceof StarStructImpl && this.inlineFields.contains(fieldName)) { + throw new IllegalArgumentException(fieldName + " is inline!"); + } + return area; + } + + public void setStruct(String fieldName, __struct__ newData) { + if (newData == null) { + throw new IllegalArgumentException(); + } + if (inlineFields.contains(fieldName) == false) { + throw new UnsupportedOperationException("IMPOSSIBLE2 " + fieldName); + } + final Area area = fields.get(fieldName); + if (area == null) { + throw new UnsupportedOperationException("IMPOSSIBLE3 " + fieldName); + } + if (area instanceof HardcodedStruct) { + ((HardcodedStruct) area).copyDataFrom(newData); + } else { + final StarStructImpl existing = (StarStructImpl) area; + existing.copyDataFrom(newData); + } + } + + public void setCString(String fieldName, CString newData) { + if (newData == null) { + fields.put(fieldName, null); + } else { + fields.put(fieldName, (Area) newData); + ((CString) newData).setMyFather(this); + } + } + + public __ptr__ setPtr(String fieldName, __ptr__ newData) { + if (newData instanceof CFunction) { + fields.put(fieldName, (Area) newData); + return newData; + } + if (inlineFields.contains(fieldName)) { + throw new UnsupportedOperationException("IMPOSSIBLE5 " + fieldName); + } + if (newData == null) { + fields.put(fieldName, null); + return null; + } + if (newData instanceof StarStruct) { + if (inlineFields.contains(fieldName)) { + throw new UnsupportedOperationException("IMPOSSIBLE1"); + } else { + fields.put(fieldName, (Area) newData); + } + return newData; + } + if (newData instanceof CString) { + fields.put(fieldName, (Area) newData); + ((CString) newData).setMyFather(this); + return newData; + } + if (newData instanceof StarArrayOfPtr) { + fields.put(fieldName, (Area) newData); + return newData; + } + if (newData instanceof StarArrayOfStruct) { + fields.put(fieldName, (Area) newData); + return newData; + } + if (newData instanceof StarStar) { + fields.put(fieldName, (Area) newData); + return newData; + } + if (newData instanceof StarArrayOfCString) { + fields.put(fieldName, (Area) newData); + return newData; + } + if (newData instanceof MutableDoublePtr) { + fields.put(fieldName, (Area) newData); + return newData; + } + if (newData instanceof StarArrayOfInteger) { + fields.put(fieldName, (Area) newData); + return newData; + } + // if (newData instanceof AreaArray) { + // fields.put(fieldName, (Area) newData); + // return newData; + // } + throw new UnsupportedOperationException("en cours1 ! " + newData.getClass()); + } + + public void memcopyFrom(Area source) { + if (source instanceof StarArrayOfPtr) { + final __array_of_ptr__ array = ((StarArrayOfPtr) source).getInternalArray(); + copyDataFrom((StarStructImpl) array.getInternal(0)); + } else if (source instanceof __struct__) { + copyDataFrom((__struct__) source); + } else { + copyDataFrom((StarStructImpl) source); + } + } + + public void copyDataFrom(__struct__ other) { + copyDataFrom(other.getInternalData()); + } + + public void setStruct(__struct__ value) { + copyDataFrom(value); + } + + public void copyDataFrom(__ptr__ arg) { + JUtils.LOG("copyDataFrom I AM " + this); + JUtils.LOG("other=" + arg); + JUtils.LOG("FIELDS=" + fields.keySet()); + if (arg instanceof InternalData) { + copyDataFromInternal((InternalData) arg); + return; + } + if (this.getClass() != arg.getClass()) { + throw new UnsupportedOperationException(getClass().toString()); + } + StarStructImpl other = (StarStructImpl) arg; + if (fields.keySet().equals(other.fields.keySet()) == false) { + throw new IllegalStateException(); + } + copyDataFromInternal(other); + } + + private void copyDataFromInternal(InternalData other) { + for (String fieldName : new TreeSet(fields.keySet())) { + Area field = fields.get(fieldName); + final Area otherField = other.getArea(fieldName); + if (field == null && otherField == null) { + continue; + } + if (field == null) { + if (otherField instanceof StarStructImpl && inlineFields.contains(fieldName) == false) { + fields.put(fieldName, otherField); + } else if (otherField instanceof CString) { + fields.put(fieldName, otherField); + } else if (otherField instanceof StarStar) { + fields.put(fieldName, otherField); + } else if (otherField instanceof StarArrayOfPtr) { + fields.put(fieldName, otherField); + } else if (otherField instanceof CFunction) { + fields.put(fieldName, otherField); + } else if (otherField instanceof StarArrayOfStruct) { + fields.put(fieldName, otherField); + } else { + System.err.println("XX otherField = " + otherField); + throw new UnsupportedOperationException(otherField.getClass().toString()); + } + } else if (field instanceof AreaInt) { + field.memcopyFrom(otherField); + } else if (field instanceof AreaDouble) { + field.memcopyFrom(otherField); + } else if (field instanceof CString) { + field.memcopyFrom(otherField); + } else if (field instanceof StarStar) { + if (otherField == null) { + fields.put(fieldName, null); + } else { + field.memcopyFrom(otherField); + } + } else if (field instanceof StarStructImpl && inlineFields.contains(fieldName)) { + field.memcopyFrom(otherField); + } else if (field instanceof StarStructImpl && inlineFields.contains(fieldName) == false) { + fields.put(fieldName, otherField); + } else if (field instanceof StarArrayOfPtr) { + field.memcopyFrom(otherField); + } else if (field instanceof HardcodedStruct) { + field.memcopyFrom(otherField); + } else { + System.err.println("fieldName=" + fieldName + " " + field); + System.err.println("otherField = " + otherField); + throw new UnsupportedOperationException(field.getClass().toString()); + } + } + } + + public Object call(String fieldName, Object... args) { + final CFunction area = (CFunction) getArea(fieldName); + return area.exe(args); + } + + public __ptr__ castTo(Class dest) { + JUtils.LOG("******************* castTo =" + dest); + JUtils.LOG("me=" + this); + if (theClass == dest) { + return this; + } + if (parent != null && ((StarStructImpl) parent).theClass == dest) { + JUtils.LOG("IT's my father!"); + return parent; + } + + final Area first = fields.values().iterator().next(); + JUtils.LOG("first=" + first); + if (first instanceof StarStructImpl) { + final StarStructImpl first2 = (StarStructImpl) first; + JUtils.LOG("first.parent=" + first2.parent); + if (first2.parent != this) { + throw new IllegalStateException(); + } + if (dest == first2.theClass) { + return first2; + } + } + throw new UnsupportedOperationException(); + } + + public Object addVirtualBytes(int virtualBytes) { + JUtils.LOG("#### addVirtualBytes " + virtualBytes); + if (virtualBytes == 0) { + return this; + } + JUtils.LOG("this=" + toString()); + if (virtualBytes < 0) { + final OFFSET offset = OFFSET.fromInt(-virtualBytes); + JUtils.LOG("OFFSET1=" + offset); + if (parent == null) { + throw new UnsupportedOperationException("No father! How to go back?"); + } + JUtils.LOG("father=" + parent); + if (((StarStructImpl) parent).theClass != offset.getTheClass()) { + throw new UnsupportedOperationException("Bad class matching1!"); + } + final Object checking = parent.addVirtualBytes(-virtualBytes); + JUtils.LOG("checking=" + checking); + if (checking != this) { + throw new UnsupportedOperationException("Cheking fail!"); + } + return parent; + } + final OFFSET offset = OFFSET.fromInt(virtualBytes); + JUtils.LOG("OFFSET2=" + offset); + final String field = offset.getField(); + JUtils.LOG("field=" + field); + JUtils.LOG("fields=" + fields.keySet()); + final Area result = fields.get(field); + if (result == null && parent != null) { + return parent.addVirtualBytes(virtualBytes); + } + if (result == null) { + throw new UnsupportedOperationException(); + } + return result; + } + + // __c__ + +} diff --git a/src/smetana/core/size_t_array_of_something.java b/src/smetana/core/size_t_array_of_something.java index 4605134cf..543abe65e 100644 --- a/src/smetana/core/size_t_array_of_something.java +++ b/src/smetana/core/size_t_array_of_something.java @@ -54,7 +54,7 @@ public class size_t_array_of_something implements size_t { } public __ptr__ malloc() { - return new StarArrayOfPtr(__array_of_ptr__.malloc_allocated(cl, nb)); + return new StarArrayOfPtr(__array_of_ptr_impl__.malloc_allocated(cl, nb)); } public size_t negate() { diff --git a/src/sprites/archimate/motivation-outcome.png b/src/sprites/archimate/motivation-outcome.png new file mode 100644 index 000000000..a7f4bc898 Binary files /dev/null and b/src/sprites/archimate/motivation-outcome.png differ diff --git a/src/sprites/archimate/physical-distribution-network.png b/src/sprites/archimate/physical-distribution-network.png new file mode 100644 index 000000000..b3f934213 Binary files /dev/null and b/src/sprites/archimate/physical-distribution-network.png differ diff --git a/src/sprites/archimate/physical-equipment.png b/src/sprites/archimate/physical-equipment.png new file mode 100644 index 000000000..a4c29ed38 Binary files /dev/null and b/src/sprites/archimate/physical-equipment.png differ diff --git a/src/sprites/archimate/physical-facility.png b/src/sprites/archimate/physical-facility.png new file mode 100644 index 000000000..7f3b9afc3 Binary files /dev/null and b/src/sprites/archimate/physical-facility.png differ diff --git a/src/sprites/archimate/physical-material.png b/src/sprites/archimate/physical-material.png new file mode 100644 index 000000000..6fb3c20d2 Binary files /dev/null and b/src/sprites/archimate/physical-material.png differ diff --git a/src/sprites/archimate/strategy-capability.png b/src/sprites/archimate/strategy-capability.png new file mode 100644 index 000000000..bb3f01cc9 Binary files /dev/null and b/src/sprites/archimate/strategy-capability.png differ diff --git a/src/sprites/archimate/strategy-course-of-action.png b/src/sprites/archimate/strategy-course-of-action.png new file mode 100644 index 000000000..4e5e95a2b Binary files /dev/null and b/src/sprites/archimate/strategy-course-of-action.png differ diff --git a/src/sprites/archimate/strategy-resource.png b/src/sprites/archimate/strategy-resource.png new file mode 100644 index 000000000..a0f11c9c1 Binary files /dev/null and b/src/sprites/archimate/strategy-resource.png differ