/* Kluge!!  +1 to fix rounding diff between layout and rendering 
                                                   otherwise we can get -1 coords in output */
@Unused
@Doc("Init 'record' node")
@Reviewed(when = "02/12/2020")
@Original(version="2.38.0", path="lib/common/shapes.c", name="record_init", key="h2lcuthzwljbcjwdeidw1jiv", definition="static void record_init(node_t * n)")
public static void record_init(ST_Agnode_s n) {
ENTERING("h2lcuthzwljbcjwdeidw1jiv","record_init");
try {
	ST_field_t info;
	final ST_pointf ul = new ST_pointf(), sz = new ST_pointf();
    boolean flip;
    int len;
    CString textbuf;		/* temp buffer for storing labels */
	int sides = BOTTOM | RIGHT | TOP | LEFT;
	/* Always use rankdir to determine how records are laid out */
	flip = NOT(GD_realflip(agraphof(n)));
	Z.z().reclblp = ND_label(n).text;
    len = strlen(Z.z().reclblp);
    /* For some forgotten reason, an empty label is parsed into a space, so
     * we need at least two bytes in textbuf.
     */
     len = MAX(len, 1);
     textbuf = CString.gmalloc(len + 1);
    if (N(info = parse_reclbl(n, flip, NOT(0), textbuf))) {
UNSUPPORTED("7iezaksu9hyxhmv3r4cp4o529"); // 	agerr(AGERR, "bad label format %s\n", ND_label(n)->text);
UNSUPPORTED("8f1id7rqm71svssnxbjo0uwcu"); // 	reclblp = "\\N";
UNSUPPORTED("2wv3zfqhq53941rwk4vu9p9th"); // 	info = parse_reclbl(n, flip, NOT(0), textbuf);
    }
    Memory.free(textbuf);
    size_reclbl(n, info);
    sz.x = POINTS(ND_width(n));;
    sz.y = POINTS(ND_height(n));
    if (mapbool(late_string(n, Z.z().N_fixed, new CString("false")))) {
UNSUPPORTED("8iu51xbtntpdf5sc00g91djym"); // 	if ((sz.x < info->size.x) || (sz.y < info->size.y)) {
UNSUPPORTED("4vs5u30jzsrn6fpjd327xjf7r"); // /* should check that the record really won't fit, e.g., there may be no text.
UNSUPPORTED("7k6yytek9nu1ihxix2880667g"); // 			agerr(AGWARN, "node '%s' size may be too small\n", agnameof(n));
UNSUPPORTED("bnetqzovnscxile7ao44kc0qd"); // */
UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); // 	}
    } else {
	sz.x = MAX(info.size.x, sz.x);
	sz.y = MAX(info.size.y, sz.y);
    }
    resize_reclbl(info, sz, mapbool(late_string(n, Z.z().N_nojustify, new CString("false"))));
    ul.___(pointfof(-sz.x / 2., sz.y / 2.));	/* FIXME - is this still true:    suspected to introduce ronding error - see Kluge below */
    pos_reclbl(info, ul, sides);
    ND_width(n, PS2INCH(info.size.x));
    ND_height(n, PS2INCH(info.size.y + 1));	/* Kluge!!  +1 to fix rounding diff between layout and rendering 
						   otherwise we can get -1 coords in output */
    ND_shape_info(n, info);
} finally {
LEAVING("h2lcuthzwljbcjwdeidw1jiv","poly_init");
}
}
pos_reclbl(info, ul, sides);
ND_width(n, PS2INCH(info.size.x));
ND_height(n, PS2INCH(info.size.y + 1)); /* Kluge!! +1 to fix rounding diff between layout and rendering
otherwise we can get -1 coords in output */
ND_shape_info(n, info);
} finally {
UNSUPPORTED("bnetqzovnscxile7ao44kc0qd"); // */
UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); // }
} else {
sz.x = MAX(info.size.x, sz.x);
sz.y = MAX(info.size.y, sz.y);
}
resize_reclbl(info, sz, mapbool(late_string(n, Z.z().N_nojustify, new CString("false"))));
ul.___(pointfof(-sz.x / 2., sz.y / 2.)); /* FIXME - is this still true: suspected to introduce ronding error - see Kluge below */
pos_reclbl(info, ul, sides);
ND_width(n, PS2INCH(info.size.x));
ND_height(n, PS2INCH(info.size.y + 1)); /* Kluge!! +1 to fix rounding diff between layout and rendering
otherwise we can get -1 coords in output */
ND_shape_info(n, info);
} finally {
LEAVING("h2lcuthzwljbcjwdeidw1jiv","poly_init");
}
}
UNSUPPORTED("2wv3zfqhq53941rwk4vu9p9th"); // info = parse_reclbl(n, flip, NOT(0), textbuf);
}
Memory.free(textbuf);
size_reclbl(n, info);
sz.x = POINTS(ND_width(n));;
sz.y = POINTS(ND_height(n));
if (mapbool(late_string(n, Z.z().N_fixed, new CString("false")))) {
UNSUPPORTED("8iu51xbtntpdf5sc00g91djym"); // if ((sz.x < info->size.x) || (sz.y < info->size.y)) {
UNSUPPORTED("4vs5u30jzsrn6fpjd327xjf7r"); // /* should check that the record really won't fit, e.g., there may be no text.
UNSUPPORTED("7k6yytek9nu1ihxix2880667g"); // agerr(AGWARN, "node '%s' size may be too small\n", agnameof(n));
UNSUPPORTED("bnetqzovnscxile7ao44kc0qd"); // */
UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); // }
} else {
sz.x = MAX(info.size.x, sz.x);
sz.y = MAX(info.size.y, sz.y);
}
resize_reclbl(info, sz, mapbool(late_string(n, Z.z().N_nojustify, new CString("false"))));
ul.___(pointfof(-sz.x / 2., sz.y / 2.)); /* FIXME - is this still true: suspected to introduce ronding error - see Kluge below */
pos_reclbl(info, ul, sides);
ND_width(n, PS2INCH(info.size.x));
ND_height(n, PS2INCH(info.size.y + 1)); /* Kluge!! +1 to fix rounding diff between layout and rendering
otherwise we can get -1 coords in output */
ND_shape_info(n, info);
} finally {
LEAVING("h2lcuthzwljbcjwdeidw1jiv","poly_init");
}
}