Debian Codegraph @

src/h/ST_dtlink_s.java

raw symbols SCIP
1 /* ========================================================================
2 * PlantUML : a free UML diagram generator
3 * ========================================================================
4 *
5 * Project Info: http://plantuml.com
6 *
7 * If you like this project or if you find it useful, you can support us at:
8 *
9 * http://plantuml.com/patreon (only 1$ per month!)
10 * http://plantuml.com/paypal
11 *
12 * This file is part of Smetana.
13 * Smetana is a partial translation of Graphviz/Dot sources from C to Java.
14 *
15 * (C) Copyright 2009-2020, Arnaud Roques
16 *
17 * This translation is distributed under the same Licence as the original C program:
18 *
19 *************************************************************************
20 * Copyright (c) 2011 AT&T Intellectual Property
21 * All rights reserved. This program and the accompanying materials
22 * are made available under the terms of the Eclipse Public License v1.0
23 * which accompanies this distribution, and is available at
24 * http://www.eclipse.org/legal/epl-v10.html
25 *
26 * Contributors: See CVS logs. Details at http://www.graphviz.org/
27 *************************************************************************
28 *
29 * THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC
30 * LICENSE ("AGREEMENT"). [Eclipse Public License - v 1.0]
31 *
32 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES
33 * RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
34 *
35 * You may obtain a copy of the License at
36 *
37 * http://www.eclipse.org/legal/epl-v10.html
38 *
39 * Unless required by applicable law or agreed to in writing, software
40 * distributed under the License is distributed on an "AS IS" BASIS,
41 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
42 * See the License for the specific language governing permissions and
43 * limitations under the License.
44 *
45 */
46 package h;
47
48 import smetana.core.OFFSET;
49 import smetana.core.UnsupportedStructAndPtr;
50 import smetana.core.__ptr__;
51 import smetana.core.__struct__;
52 import smetana.core.amiga.StarStruct;
53
54 public class ST_dtlink_s extends UnsupportedStructAndPtr implements WithParent {
55
56 public ST_dtlink_s right;
57 public ST_dtlink_s _left;
58 private final StarStruct parent;
59
60 @Override
61 public void copyDataFrom(__struct__ other) {
62 ST_dtlink_s this2 = (ST_dtlink_s) other;
63 this.right = this2.right;
64 this._left = this2._left;
65 }
66
67 public ST_dtlink_s() {
68 this(null);
69 }
70
71 public ST_dtlink_s(StarStruct parent) {
72 this.parent = parent;
73 }
74
75 public StarStruct getParent() {
76 return parent;
77 }
78
79 // @Override
80 // public __ptr__ castTo(Class dest) {
81 // if (dest == ST_dtlink_s.class) {
82 // // return amp();
83 // return this;
84 // }
85 // if (dest == _dthold_s.class) {
86 // return new LinkTo_dthold_s();
87 // }
88 // return super.castTo(dest);
89 // }
90
91 @Override
92 public __ptr__ castTo(Class dest) {
93 if (dest == ST_dtlink_s.class) {
94 return this;
95 }
96 // if (dest == refstr_t.class && getParent() instanceof ST_refstr_t) {
97 // return (ST_refstr_t) getParent();
98 // }
99 if (dest == ST_dthold_s.class && getParent() instanceof ST_dthold_s) {
100 // System.err.println("ITSME");
101 // System.err.println("getParent()=" + getParent());
102 return (ST_dthold_s) getParent();
103
104 }
105 System.err.println("dest=" + dest);
106 return super.castTo(dest);
107 }
108
109 public ST_dthold_s castTo_ST_dthold_s() {
110 if (getParent() instanceof ST_dthold_s) {
111 return (ST_dthold_s) getParent();
112 }
113 throw new UnsupportedOperationException();
114 }
115
116 class LinkTo_dthold_s extends UnsupportedStructAndPtr {
117
118 }
119
120 class LinkTo_Obj extends UnsupportedStructAndPtr {
121
122 }
123
124 @Override
125 public Object addVirtualBytes(int virtualBytes) {
126 if (virtualBytes == 0) {
127 return this;
128 }
129 if (virtualBytes < 0) {
130 final OFFSET offset = OFFSET.fromInt(-virtualBytes);
131 if (offset.toString().equals("h.ST_Agsubnode_s::id_link")) {
132 return ((ST_Agsubnode_s) parent).from_id_link(ST_dtlink_s.this);
133 }
134 if (offset.toString().equals("h.ST_Agsubnode_s::seq_link")) {
135 return ((ST_Agsubnode_s) parent).from_seq_link(ST_dtlink_s.this);
136 }
137 if (offset.toString().equals("h.ST_Agsym_s::link")) {
138 return ((ST_Agsym_s) parent).from_link(ST_dtlink_s.this);
139 }
140 if (offset.toString().equals("h.ST_Agedge_s::seq_link")) {
141 return ((ST_Agedge_s) parent).from_seq_link(ST_dtlink_s.this);
142 }
143 if (offset.toString().equals("h.ST_Agedge_s::id_link")) {
144 return ((ST_Agedge_s) parent).from_id_link(ST_dtlink_s.this);
145 }
146 if (offset.toString().equals("h.ST_Agraph_s::link")) {
147 return ((ST_Agraph_s) parent).from_link(ST_dtlink_s.this);
148 }
149 System.err.println("virtualBytes=" + virtualBytes);
150 System.err.println("offset=" + offset);
151 return super.addVirtualBytes(virtualBytes);
152 }
153 final OFFSET offset = OFFSET.fromInt(virtualBytes);
154 if (offset.toString().equals("h.ST_refstr_t::s") && parent instanceof ST_refstr_t) {
155 return ((ST_refstr_t) parent).to_s(ST_dtlink_s.this);
156
157 }
158 System.err.println("virtualBytes=" + virtualBytes);
159 System.err.println("offset=" + offset);
160 return super.addVirtualBytes(virtualBytes);
161 }
162
163 // @Override
164 // public __ptr__ setPtr(String fieldName, __ptr__ newData) {
165 // if (fieldName.equals("hl._left")) {
166 // this._left = (ST_dtlink_s) newData;
167 // return _left;
168 // }
169 // if (fieldName.equals("right")) {
170 // this.right = (ST_dtlink_s) newData;
171 // return right;
172 // }
173 // return super.setPtr(fieldName, newData);
174 // }
175
176 // @Override
177 // public __ptr__ getPtr(String fieldName) {
178 // // if (fieldName.equals("hl._left")) {
179 // // return _left;
180 // // }
181 // if (fieldName.equals("right")) {
182 // return right;
183 // }
184 // return super.getPtr(fieldName);
185 // }
186
187 // public interface ST_dtlink_s extends __ptr__ {
188 // public static List<String> DEFINITION = Arrays.asList(
189 // "struct _dtlink_s",
190 // "{",
191 // "Dtlink_t* right",
192 // "union",
193 // "{",
194 // "unsigned int _hash",
195 // "Dtlink_t* _left",
196 // "}",
197 // "hl",
198 // "}");
199 }
200
201 // struct _dtlink_s
202 // { Dtlink_t* right; /* right child */
203 // union
204 // { unsigned int _hash; /* hash value */
205 // Dtlink_t* _left; /* left child */
206 // } hl;
207 // };