| 1 | /* ======================================================================== |
| 2 | * PlantUML : a free UML diagram generator |
| 3 | * ======================================================================== |
| 4 | * |
| 5 | * Project Info: http://plantuml.com |
| 6 | * |
| 7 | * If you like this project or if you find it useful, you can support us at: |
| 8 | * |
| 9 | * http://plantuml.com/patreon (only 1$ per month!) |
| 10 | * http://plantuml.com/paypal |
| 11 | * |
| 12 | * This file is part of Smetana. |
| 13 | * Smetana is a partial translation of Graphviz/Dot sources from C to Java. |
| 14 | * |
| 15 | * (C) Copyright 2009-2020, Arnaud Roques |
| 16 | * |
| 17 | * This translation is distributed under the same Licence as the original C program: |
| 18 | * |
| 19 | ************************************************************************* |
| 20 | * Copyright (c) 2011 AT&T Intellectual Property |
| 21 | * All rights reserved. This program and the accompanying materials |
| 22 | * are made available under the terms of the Eclipse Public License v1.0 |
| 23 | * which accompanies this distribution, and is available at |
| 24 | * http://www.eclipse.org/legal/epl-v10.html |
| 25 | * |
| 26 | * Contributors: See CVS logs. Details at http://www.graphviz.org/ |
| 27 | ************************************************************************* |
| 28 | * |
| 29 | * THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC |
| 30 | * LICENSE ("AGREEMENT"). [Eclipse Public License - v 1.0] |
| 31 | * |
| 32 | * ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES |
| 33 | * RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. |
| 34 | * |
| 35 | * You may obtain a copy of the License at |
| 36 | * |
| 37 | * http://www.eclipse.org/legal/epl-v10.html |
| 38 | * |
| 39 | * Unless required by applicable law or agreed to in writing, software |
| 40 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 41 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 42 | * See the License for the specific language governing permissions and |
| 43 | * limitations under the License. |
| 44 | * |
| 45 | */ |
| 46 | package gen.lib.cdt; |
| 47 | import static gen.lib.cdt.dtdisc__c.dtdisc; |
| 48 | import static smetana.core.JUtils.sizeof; |
| 49 | import static smetana.core.JUtilsDebug.ENTERING; |
| 50 | import static smetana.core.JUtilsDebug.LEAVING; |
| 51 | import static smetana.core.Macro.N; |
| 52 | import h.ST_dt_s; |
| 53 | import h.ST_dtdata_s; |
| 54 | import h.ST_dtdisc_s; |
| 55 | import h.ST_dtmethod_s; |
| 56 | import smetana.core.Memory; |
| 57 | |
| 58 | public class dtopen__c { |
| 59 | //1 9k44uhd5foylaeoekf3llonjq |
| 60 | // extern Dtmethod_t* Dtset |
| 61 | |
| 62 | |
| 63 | //1 1ahfywsmzcpcig2oxm7pt9ihj |
| 64 | // extern Dtmethod_t* Dtbag |
| 65 | |
| 66 | |
| 67 | //1 anhghfj3k7dmkudy2n7rvt31v |
| 68 | // extern Dtmethod_t* Dtoset |
| 69 | |
| 70 | |
| 71 | //1 5l6oj1ux946zjwvir94ykejbc |
| 72 | // extern Dtmethod_t* Dtobag |
| 73 | |
| 74 | |
| 75 | //1 2wtf222ak6cui8cfjnw6w377z |
| 76 | // extern Dtmethod_t* Dtlist |
| 77 | |
| 78 | |
| 79 | //1 d1s1s6ibtcsmst88e3057u9r7 |
| 80 | // extern Dtmethod_t* Dtstack |
| 81 | |
| 82 | |
| 83 | //1 axa7mflo824p6fspjn1rdk0mt |
| 84 | // extern Dtmethod_t* Dtqueue |
| 85 | |
| 86 | |
| 87 | //1 ega812utobm4xx9oa9w9ayij6 |
| 88 | // extern Dtmethod_t* Dtdeque |
| 89 | |
| 90 | |
| 91 | //1 cyfr996ur43045jv1tjbelzmj |
| 92 | // extern Dtmethod_t* Dtorder |
| 93 | |
| 94 | |
| 95 | //1 wlofoiftbjgrrabzb2brkycg |
| 96 | // extern Dtmethod_t* Dttree |
| 97 | |
| 98 | |
| 99 | //1 12bds94t7voj7ulwpcvgf6agr |
| 100 | // extern Dtmethod_t* Dthash |
| 101 | |
| 102 | |
| 103 | //1 9lqknzty480cy7zsubmabkk8h |
| 104 | // extern Dtmethod_t _Dttree |
| 105 | |
| 106 | |
| 107 | //1 bvn6zkbcp8vjdhkccqo1xrkrb |
| 108 | // extern Dtmethod_t _Dthash |
| 109 | |
| 110 | |
| 111 | //1 9lidhtd6nsmmv3e7vjv9e10gw |
| 112 | // extern Dtmethod_t _Dtlist |
| 113 | |
| 114 | |
| 115 | //1 34ujfamjxo7xn89u90oh2k6f8 |
| 116 | // extern Dtmethod_t _Dtqueue |
| 117 | |
| 118 | |
| 119 | //1 3jy4aceckzkdv950h89p4wjc8 |
| 120 | // extern Dtmethod_t _Dtstack |
| 121 | |
| 122 | |
| 123 | //1 emxrtwweklud1b14cstc9z3bb |
| 124 | // static char* Version = |
| 125 | |
| 126 | |
| 127 | |
| 128 | |
| 129 | //3 34nbfbdgwe34hb4vmfr5p6kbh |
| 130 | // Dt_t* dtopen(Dtdisc_t* disc, Dtmethod_t* meth) |
| 131 | public static ST_dt_s dtopen(ST_dtdisc_s disc, ST_dtmethod_s meth) { |
| 132 | ENTERING("34nbfbdgwe34hb4vmfr5p6kbh","dtopen"); |
| 133 | try { |
| 134 | ST_dt_s dt = null; |
| 135 | int e; |
| 136 | ST_dtdata_s data; |
| 137 | if(N(disc) || N(meth)) |
| 138 | return null; |
| 139 | /* allocate space for dictionary */ |
| 140 | if(N(dt = new ST_dt_s())) |
| 141 | return null; |
| 142 | // /* initialize all absolutely private data */ |
| 143 | dt.setPtr("searchf", null); |
| 144 | dt.setPtr("meth", null); |
| 145 | dt.setPtr("disc", null); |
| 146 | dtdisc(dt,disc,0); |
| 147 | dt.setInt("type", 0); |
| 148 | dt.setInt("nview", 0); |
| 149 | dt.setPtr("view", null); |
| 150 | dt.setPtr("walk", null); |
| 151 | dt.setPtr("user", null); |
| 152 | if(disc.eventf!=null) |
| 153 | { /* if shared/persistent dictionary, get existing data */ |
| 154 | throw new UnsupportedOperationException(); |
| 155 | // data = ((Dtdata_t*)0); |
| 156 | // if((e = (*disc->eventf)(dt,1,(void*)(&data),disc)) < 0) |
| 157 | // goto err_open; |
| 158 | // else if(e > 0) |
| 159 | // { if(data) |
| 160 | // { if(data->type&meth->type) |
| 161 | // goto done; |
| 162 | // else goto err_open; |
| 163 | // } |
| 164 | // if(!disc->memoryf) |
| 165 | // goto err_open; |
| 166 | // free((void*)dt); |
| 167 | // if(!(dt = (*disc->memoryf)(0, 0, sizeof(Dt_t), disc)) ) |
| 168 | // return ((Dt_t*)0); |
| 169 | // dt->searchf = ((Dtsearch_f)0); |
| 170 | // dt->meth = ((Dtmethod_t*)0); |
| 171 | // dt->disc = ((Dtdisc_t*)0); |
| 172 | // dtdisc(dt,disc,0); |
| 173 | // dt->type = 1; |
| 174 | // dt->nview = 0; |
| 175 | // dt->view = dt->walk = ((Dt_t*)0); |
| 176 | // } |
| 177 | } |
| 178 | /* allocate sharable data */ |
| 179 | if(N(data = (ST_dtdata_s) (dt.memoryf.exe(dt,null,sizeof(ST_dtdata_s.class),disc)) )) |
| 180 | { err_open: |
| 181 | Memory.free(dt); |
| 182 | return (null); |
| 183 | } |
| 184 | data.type = meth.type; |
| 185 | data.here = null; |
| 186 | data._htab = null; |
| 187 | data.ntab = 0; |
| 188 | data.size = 0; |
| 189 | data.loop = 0; |
| 190 | data.minp = 0; |
| 191 | //done: |
| 192 | dt.data = data; |
| 193 | dt.searchf = meth.searchf; |
| 194 | dt.meth = meth; |
| 195 | if(disc.eventf!=null) |
| 196 | throw new UnsupportedOperationException(); |
| 197 | // (*disc->eventf)(dt, 5, (void*)dt, disc); |
| 198 | return dt; |
| 199 | } finally { |
| 200 | LEAVING("34nbfbdgwe34hb4vmfr5p6kbh","dtopen"); |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | |
| 205 | } |