| 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.dtrestore__c.dtrestore; |
| 48 | import static smetana.core.JUtilsDebug.ENTERING; |
| 49 | import static smetana.core.JUtilsDebug.LEAVING; |
| 50 | import h.ST_dt_s; |
| 51 | import h.ST_dtlink_s; |
| 52 | |
| 53 | public class dtsize__c { |
| 54 | //1 9k44uhd5foylaeoekf3llonjq |
| 55 | // extern Dtmethod_t* Dtset |
| 56 | |
| 57 | |
| 58 | //1 1ahfywsmzcpcig2oxm7pt9ihj |
| 59 | // extern Dtmethod_t* Dtbag |
| 60 | |
| 61 | |
| 62 | //1 anhghfj3k7dmkudy2n7rvt31v |
| 63 | // extern Dtmethod_t* Dtoset |
| 64 | |
| 65 | |
| 66 | //1 5l6oj1ux946zjwvir94ykejbc |
| 67 | // extern Dtmethod_t* Dtobag |
| 68 | |
| 69 | |
| 70 | //1 2wtf222ak6cui8cfjnw6w377z |
| 71 | // extern Dtmethod_t* Dtlist |
| 72 | |
| 73 | |
| 74 | //1 d1s1s6ibtcsmst88e3057u9r7 |
| 75 | // extern Dtmethod_t* Dtstack |
| 76 | |
| 77 | |
| 78 | //1 axa7mflo824p6fspjn1rdk0mt |
| 79 | // extern Dtmethod_t* Dtqueue |
| 80 | |
| 81 | |
| 82 | //1 ega812utobm4xx9oa9w9ayij6 |
| 83 | // extern Dtmethod_t* Dtdeque |
| 84 | |
| 85 | |
| 86 | //1 cyfr996ur43045jv1tjbelzmj |
| 87 | // extern Dtmethod_t* Dtorder |
| 88 | |
| 89 | |
| 90 | //1 wlofoiftbjgrrabzb2brkycg |
| 91 | // extern Dtmethod_t* Dttree |
| 92 | |
| 93 | |
| 94 | //1 12bds94t7voj7ulwpcvgf6agr |
| 95 | // extern Dtmethod_t* Dthash |
| 96 | |
| 97 | |
| 98 | //1 9lqknzty480cy7zsubmabkk8h |
| 99 | // extern Dtmethod_t _Dttree |
| 100 | |
| 101 | |
| 102 | //1 bvn6zkbcp8vjdhkccqo1xrkrb |
| 103 | // extern Dtmethod_t _Dthash |
| 104 | |
| 105 | |
| 106 | //1 9lidhtd6nsmmv3e7vjv9e10gw |
| 107 | // extern Dtmethod_t _Dtlist |
| 108 | |
| 109 | |
| 110 | //1 34ujfamjxo7xn89u90oh2k6f8 |
| 111 | // extern Dtmethod_t _Dtqueue |
| 112 | |
| 113 | |
| 114 | //1 3jy4aceckzkdv950h89p4wjc8 |
| 115 | // extern Dtmethod_t _Dtstack |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | //3 6j49zum5hqto1t7fyrz8qjv1u |
| 121 | // static int treecount(register Dtlink_t* e) |
| 122 | public static int treecount(ST_dtlink_s e) { |
| 123 | ENTERING("6j49zum5hqto1t7fyrz8qjv1u","treecount"); |
| 124 | try { |
| 125 | return e!=null ? treecount((ST_dtlink_s) e._left) + treecount((ST_dtlink_s) e.right) + 1 : 0; |
| 126 | } finally { |
| 127 | LEAVING("6j49zum5hqto1t7fyrz8qjv1u","treecount"); |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | |
| 132 | |
| 133 | |
| 134 | //3 bci0ea1fa7egf4aads6gdgvsq |
| 135 | // int dtsize(Dt_t* dt) |
| 136 | public static int dtsize_(ST_dt_s dt) { |
| 137 | ENTERING("bci0ea1fa7egf4aads6gdgvsq","dtsize"); |
| 138 | try { |
| 139 | ST_dtlink_s t; |
| 140 | int size; |
| 141 | if (((dt.data.type&010000)!=0)) dtrestore(dt,null); |
| 142 | if(dt.data.size < 0) /* !(dt->data->type&(DT_SET|DT_BAG)) */ |
| 143 | { if((dt.data.type&(0000004|0000010))!=0) |
| 144 | dt.data.setInt("size", treecount((ST_dtlink_s) dt.data.here)); |
| 145 | else if((dt.data.type&(0000020|0000040|0000100))!=0) |
| 146 | { size=0; |
| 147 | for(t = (ST_dtlink_s) dt.data._head; t!=null; t = (ST_dtlink_s) t.right) |
| 148 | size += 1; |
| 149 | dt.data.setInt("size", size); |
| 150 | } |
| 151 | } |
| 152 | return dt.data.size; |
| 153 | |
| 154 | } finally { |
| 155 | LEAVING("bci0ea1fa7egf4aads6gdgvsq","dtsize"); |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | |
| 160 | } |