Debian Codegraph @

src/gen/lib/common/memory__c.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 gen.lib.common;
47 import static smetana.core.JUtils.memset;
48 import static smetana.core.JUtilsDebug.ENTERING;
49 import static smetana.core.JUtilsDebug.LEAVING;
50 import static smetana.core.Macro.UNSUPPORTED;
51 import smetana.core.CString;
52 import smetana.core.__ptr__;
53 import smetana.core.size_t;
54
55 public class memory__c {
56
57
58 //3 6hfkgng9qf75cucpojc4r8x6w
59 // void *zmalloc(size_t nbytes)
60 public static __ptr__ zmalloc(size_t nbytes) {
61 ENTERING("6hfkgng9qf75cucpojc4r8x6w","zmalloc");
62 try {
63 __ptr__ rv;
64 if (nbytes.isZero())
65 return null;
66 rv = gmalloc(nbytes);
67 memset(rv, 0, nbytes);
68 return rv;
69 } finally {
70 LEAVING("6hfkgng9qf75cucpojc4r8x6w","zmalloc");
71 }
72 }
73
74
75
76
77 //3 dn6c3bthm7yuhtrxx3o2je19z
78 // void *zrealloc(void *ptr, size_t size, size_t elt, size_t osize)
79 public static Object zrealloc(Object... arg) {
80 UNSUPPORTED("50do65rl7k8poomk5tdkjw6k2"); // void *zrealloc(void *ptr, size_t size, size_t elt, size_t osize)
81 UNSUPPORTED("erg9i1970wdri39osu8hx2a6e"); // {
82 UNSUPPORTED("2esc94j9py77lfd4f23nk7w5x"); // void *p = realloc(ptr, size * elt);
83 UNSUPPORTED("e13q5hvkbkekp23xt0oxo1nsb"); // if (p == NULL && size) {
84 UNSUPPORTED("4t1y5iinm4310lkpvbal1spve"); // fprintf(stderr, "out of memory\n");
85 UNSUPPORTED("68kasxgknec72r19lohbk6n3q"); // return p;
86 UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); // }
87 UNSUPPORTED("2wr2qtb30ktteuohi1vgzxugz"); // if (osize < size)
88 UNSUPPORTED("egt7kitgze0mw7g867jd7p6cq"); // memset((char *) p + (osize * elt), '\0', (size - osize) * elt);
89 UNSUPPORTED("91xduilalb406jjyw2g1i07th"); // return p;
90 UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }
91
92 throw new UnsupportedOperationException();
93 }
94
95
96
97
98 public static CString gmalloc(int nbytes) {
99 return new CString(nbytes);
100 }
101 //3 4mfikqpmxyxrke46i5xakatmc
102 //void *gmalloc(size_t nbytes)
103 public static __ptr__ gmalloc(size_t nbytes) {
104 ENTERING("4mfikqpmxyxrke46i5xakatmc","gmalloc");
105 try {
106 __ptr__ rv;
107 if (nbytes.isZero())
108 return null;
109 rv = (__ptr__) nbytes.malloc();
110 if (rv == null) {
111 System.err.println("out of memory");
112 }
113 return rv;
114 } finally {
115 LEAVING("4mfikqpmxyxrke46i5xakatmc","gmalloc");
116 }
117 }
118
119
120
121
122 //3 1ed55yig6d18nhtbyqlf37jik
123 // void *grealloc(void *ptr, size_t size)
124 public static __ptr__ grealloc(__ptr__ ptr, size_t size) {
125 ENTERING("1ed55yig6d18nhtbyqlf37jik","grealloc");
126 try {
127 __ptr__ p = (__ptr__) size.realloc(ptr);
128 return p;
129 } finally {
130 LEAVING("1ed55yig6d18nhtbyqlf37jik","grealloc");
131 }
132 }
133
134
135 }