All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gen.lib.cgraph.refstr__c Maven / Gradle / Ivy

There is a newer version: 1.2024.8
Show newest version
// THIS FILE HAS BEEN GENERATED BY A PREPROCESSOR.
/* +=======================================================================
 * |
 * |      PlantUML : a free UML diagram generator
 * |
 * +=======================================================================
 *
 * (C) Copyright 2009-2024, Arnaud Roques
 *
 * Project Info:  https://plantuml.com
 *
 * If you like this project or if you find it useful, you can support us at:
 *
 * https://plantuml.com/patreon (only 1$ per month!)
 * https://plantuml.com/liberapay (only 1€ per month!)
 * https://plantuml.com/paypal
 *
 *
 * PlantUML is free software; you can redistribute it and/or modify it
 * under the terms of the MIT License.
 *
 * See http://opensource.org/licenses/MIT
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included
 * in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
 * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 *
 * PlantUML can occasionally display sponsored or advertising messages. Those
 * messages are usually generated on welcome or error images and never on
 * functional diagrams.
 * See https://plantuml.com/professional if you want to remove them
 *
 * Images (whatever their format : PNG, SVG, EPS...) generated by running PlantUML
 * are owned by the author of their corresponding sources code (that is, their
 * textual description in PlantUML language). Those images are not covered by
 * this MIT license.
 *
 * The generated images can then be used without any reference to the MIT license.
 * It is not even necessary to stipulate that they have been generated with PlantUML,
 * although this will be appreciated by the PlantUML team.
 *
 * There is an exception : if the textual description in PlantUML language is also covered
 * by any license, then the generated images are logically covered
 * by the very same license.
 *
 * This is the IGY distribution (Install GraphViz by Yourself).
 * You have to install GraphViz and to setup the GRAPHVIZ_DOT environment variable
 * (see https://plantuml.com/graphviz-dot )
 *
 * Icons provided by OpenIconic :  https://useiconic.com/open
 * Archimate sprites provided by Archi :  http://www.archimatetool.com
 * Stdlib AWS provided by https://github.com/milo-minderbinder/AWS-PlantUML
 * Stdlib Icons provided https://github.com/tupadr3/plantuml-icon-font-sprites
 * ASCIIMathML (c) Peter Jipsen http://www.chapman.edu/~jipsen
 * ASCIIMathML (c) David Lippman http://www.pierce.ctc.edu/dlippman
 * CafeUndZopfli ported by Eugene Klyuchnikov https://github.com/eustas/CafeUndZopfli
 * Brotli (c) by the Brotli Authors https://github.com/google/brotli
 * Themes (c) by Brett Schwarz https://github.com/bschwarz/puml-themes
 * Twemoji (c) by Twitter at https://twemoji.twitter.com/
 *
 */
package gen.lib.cgraph;
import static gen.lib.cgraph.utils__c.agdtdelete;
import static gen.lib.cgraph.utils__c.agdtopen;
import static smetana.core.JUtils.EQ_CSTRING;
import static smetana.core.Macro.dtinsert;
import static smetana.core.Macro.dtsearch;
import static smetana.core.debug.SmetanaDebug.ENTERING;
import static smetana.core.debug.SmetanaDebug.LEAVING;

import gen.annotation.Original;
import gen.annotation.Reviewed;
import h.ST_Agraph_s;
import h.ST_dt_s;
import h.ST_refstr_t;
import smetana.core.ACCESS;
import smetana.core.CStarStar;
import smetana.core.CString;
import smetana.core.Globals;

public class refstr__c {



@Original(version="2.38.0", path="lib/cgraph/refstr.c", name="refdict", key="f1nwss2xoaub1hyord232ugoj", definition = "static Dict_t *refdict(Agraph_t * g)")
@Reviewed(when = "10/11/2020")
private static ST_dt_s refdict(final Globals zz, final ST_Agraph_s g) {
ENTERING("f1nwss2xoaub1hyord232ugoj","refdict");
try {
		final CStarStar dictref;
		if (g != null)
			dictref = CStarStar. BUILD(new ACCESS() {
				public ST_dt_s get() {
					return (ST_dt_s) g.clos.strdict;
				}
				public void set(ST_dt_s obj) {
					g.clos.strdict = obj;
				}
			});
		else
			dictref = CStarStar. BUILD(new ACCESS() {
				public ST_dt_s get() {
					return zz.Refdict_default;
				}
				public void set(ST_dt_s obj) {
					zz.Refdict_default = obj;
				}
			});
    if (dictref.star() == null) {
	dictref.star(agdtopen(zz, g, zz.Refstrdisc, zz.Dttree));
	zz.HTML_BIT = 1 << 31;
	zz.CNT_BITS = ~zz.HTML_BIT;
	}
    return dictref.star();
} finally {
LEAVING("f1nwss2xoaub1hyord232ugoj","refdict");
}
}






@Original(version="2.38.0", path="lib/cgraph/refstr.c", name="refsymbind", key="9ts4wqhw2xafdv3tlcilneewq", definition = "static refstr_t *refsymbind(Dict_t * strdict, char *s)")
@Reviewed(when = "10/11/2020")
private static ST_refstr_t refsymbind(Globals zz, ST_dt_s strdict, CString s) {
ENTERING("9ts4wqhw2xafdv3tlcilneewq","refsymbind");
try {
    final ST_refstr_t key = new ST_refstr_t();
    ST_refstr_t r;
    // key.s = s.duplicate());
    key.setString(s);
    r = (ST_refstr_t) dtsearch(zz, strdict, key);
    return r;
} finally {
LEAVING("9ts4wqhw2xafdv3tlcilneewq","refsymbind");
}
}





@Original(version="2.38.0", path="lib/cgraph/refstr.c", name="refstrbind", key="1scntgo71z7c2v15zapiyw59w", definition = "static char *refstrbind(Dict_t * strdict, char *s)")
private static CString refstrbind(Globals zz, ST_dt_s strdict, CString s) {
ENTERING("1scntgo71z7c2v15zapiyw59w","refstrbind");
try {
    ST_refstr_t r;
    r = refsymbind(zz, strdict, s);
    if (r!=null)
	return r.s;
    else
	return null;
} finally {
LEAVING("1scntgo71z7c2v15zapiyw59w","refstrbind");
}
}




@Original(version="2.38.0", path="lib/cgraph/refstr.c", name="agstrbind", key="bb8aqjshw3ecae2lsmhigd0mc", definition = "char *agstrbind(Agraph_t * g, char *s)")
public static CString agstrbind(Globals zz, ST_Agraph_s g, CString s) {
ENTERING("bb8aqjshw3ecae2lsmhigd0mc","agstrbind");
try {
    return refstrbind(zz, refdict(zz, g), s);
} finally {
LEAVING("bb8aqjshw3ecae2lsmhigd0mc","agstrbind");
}
}




@Original(version="2.38.0", path="lib/cgraph/refstr.c", name="agstrdup", key="86oznromwhn9qeym0k7pih73q", definition = "char *agstrdup(Agraph_t * g, char *s)")
@Reviewed(when = "10/11/2020")
public static CString agstrdup(Globals zz, ST_Agraph_s g, CString s) {
ENTERING("86oznromwhn9qeym0k7pih73q","agstrdup");
try {
	ST_refstr_t r;
    ST_dt_s strdict;
    // size_t sz;
    
    if (s == null)
	 return null;
    strdict = refdict(zz, g);
    r = (ST_refstr_t) refsymbind(zz, strdict, s);
    if (r!=null)
	r.refcnt++;
    else {
//	sz = sizeof(ST_refstr_t.class).plus(s.length());
//	if (g!=null)
//	    r = (ST_refstr_t) agalloc(g, sz);
//	else
	    r = new ST_refstr_t();
	r.refcnt = 1;
	r.setString(s.duplicate());
//	strcpy(r->store, s);
//	r->s = r->store;
	dtinsert(zz, strdict, r);
    }
	return r.s;
} finally {
LEAVING("86oznromwhn9qeym0k7pih73q","agstrdup");
}
}



@Original(version="2.38.0", path="lib/cgraph/refstr.c", name="agstrfree", key="enhn1ajfo86a19dgm4b8lduz7", definition = "int agstrfree(Agraph_t * g, char *s)")
public static int agstrfree(Globals zz, ST_Agraph_s g, CString s) {
ENTERING("enhn1ajfo86a19dgm4b8lduz7","agstrfree");
try {
    ST_refstr_t r;
    ST_dt_s strdict;
    if (s == null)
	 return -1;
    strdict = refdict(zz, g);
    r = (ST_refstr_t) refsymbind(zz, strdict, s);
    if (r!=null && (EQ_CSTRING(r.s, s))) {
	r.refcnt--;
	if ((r.refcnt!=0 && zz.CNT_BITS!=0) == false) {
	    agdtdelete(zz, g, strdict, r);
	    /*
	       if (g) agfree(g,r);
	       else free(r);
	     */
	}
    }
    if (r == null)
	return -1;
    return 0;
} finally {
LEAVING("enhn1ajfo86a19dgm4b8lduz7","agstrfree");
}
}



@Reviewed(when = "12/11/2020")
@Original(version="2.38.0", path="lib/cgraph/refstr.c", name="aghtmlstr", key="3em4wzjnpajd5d3igb90l3rml", definition = "int aghtmlstr(char *s)")
public static int aghtmlstr(Globals zz, CString s) {
ENTERING("3em4wzjnpajd5d3igb90l3rml","aghtmlstr");
try {
    ST_refstr_t key;
    if (s == null)
	return 0;
	key = (ST_refstr_t) s.getParent();
    return (key.refcnt & zz.HTML_BIT);
} finally {
LEAVING("3em4wzjnpajd5d3igb90l3rml","aghtmlstr");
}
}



}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy