mirror of
https://github.com/octoleo/plantuml.git
synced 2024-11-25 22:37:33 +00:00
refactor: improve smetana support for JSON
This commit is contained in:
parent
7447766553
commit
e53a679331
@ -48,6 +48,7 @@ import java.util.Map.Entry;
|
|||||||
import net.sourceforge.plantuml.FileFormatOption;
|
import net.sourceforge.plantuml.FileFormatOption;
|
||||||
import net.sourceforge.plantuml.StringUtils;
|
import net.sourceforge.plantuml.StringUtils;
|
||||||
import net.sourceforge.plantuml.UmlDiagram;
|
import net.sourceforge.plantuml.UmlDiagram;
|
||||||
|
import net.sourceforge.plantuml.abel.CucaNote;
|
||||||
import net.sourceforge.plantuml.abel.Entity;
|
import net.sourceforge.plantuml.abel.Entity;
|
||||||
import net.sourceforge.plantuml.abel.GroupType;
|
import net.sourceforge.plantuml.abel.GroupType;
|
||||||
import net.sourceforge.plantuml.abel.LeafType;
|
import net.sourceforge.plantuml.abel.LeafType;
|
||||||
@ -108,6 +109,7 @@ import net.sourceforge.plantuml.klimt.font.StringBounder;
|
|||||||
import net.sourceforge.plantuml.klimt.geom.HorizontalAlignment;
|
import net.sourceforge.plantuml.klimt.geom.HorizontalAlignment;
|
||||||
import net.sourceforge.plantuml.klimt.geom.MinMax;
|
import net.sourceforge.plantuml.klimt.geom.MinMax;
|
||||||
import net.sourceforge.plantuml.klimt.geom.RectangleArea;
|
import net.sourceforge.plantuml.klimt.geom.RectangleArea;
|
||||||
|
import net.sourceforge.plantuml.klimt.geom.VerticalAlignment;
|
||||||
import net.sourceforge.plantuml.klimt.geom.XDimension2D;
|
import net.sourceforge.plantuml.klimt.geom.XDimension2D;
|
||||||
import net.sourceforge.plantuml.klimt.geom.XPoint2D;
|
import net.sourceforge.plantuml.klimt.geom.XPoint2D;
|
||||||
import net.sourceforge.plantuml.klimt.shape.AbstractTextBlock;
|
import net.sourceforge.plantuml.klimt.shape.AbstractTextBlock;
|
||||||
@ -121,6 +123,7 @@ import net.sourceforge.plantuml.style.ISkinParam;
|
|||||||
import net.sourceforge.plantuml.style.PName;
|
import net.sourceforge.plantuml.style.PName;
|
||||||
import net.sourceforge.plantuml.style.SName;
|
import net.sourceforge.plantuml.style.SName;
|
||||||
import net.sourceforge.plantuml.style.Style;
|
import net.sourceforge.plantuml.style.Style;
|
||||||
|
import net.sourceforge.plantuml.style.StyleSignatureBasic;
|
||||||
import net.sourceforge.plantuml.svek.Bibliotekon;
|
import net.sourceforge.plantuml.svek.Bibliotekon;
|
||||||
import net.sourceforge.plantuml.svek.Cluster;
|
import net.sourceforge.plantuml.svek.Cluster;
|
||||||
import net.sourceforge.plantuml.svek.ClusterDecoration;
|
import net.sourceforge.plantuml.svek.ClusterDecoration;
|
||||||
@ -130,6 +133,8 @@ import net.sourceforge.plantuml.svek.GeneralImageBuilder;
|
|||||||
import net.sourceforge.plantuml.svek.GraphvizCrash;
|
import net.sourceforge.plantuml.svek.GraphvizCrash;
|
||||||
import net.sourceforge.plantuml.svek.IEntityImage;
|
import net.sourceforge.plantuml.svek.IEntityImage;
|
||||||
import net.sourceforge.plantuml.svek.PackageStyle;
|
import net.sourceforge.plantuml.svek.PackageStyle;
|
||||||
|
import net.sourceforge.plantuml.svek.image.EntityImageNoteLink;
|
||||||
|
import net.sourceforge.plantuml.utils.Position;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Some notes:
|
* Some notes:
|
||||||
@ -160,18 +165,40 @@ public class CucaDiagramFileMakerElk implements CucaDiagramFileMaker {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private TextBlock getLabel(Link link) {
|
// Duplicate from CucaDiagramFileMakerSmetana
|
||||||
if (Display.isNull(link.getLabel())) {
|
private Style getStyle() {
|
||||||
return null;
|
return StyleSignatureBasic
|
||||||
}
|
.of(SName.root, SName.element, diagram.getUmlDiagramType().getStyleName(), SName.arrow)
|
||||||
final ISkinParam skinParam = diagram.getSkinParam();
|
.getMergedStyle(diagram.getSkinParam().getCurrentStyleBuilder());
|
||||||
final FontConfiguration labelFont = FontConfiguration.create(skinParam, FontParam.ARROW, null);
|
}
|
||||||
final TextBlock label = link.getLabel().create(labelFont,
|
|
||||||
skinParam.getDefaultTextAlignment(HorizontalAlignment.CENTER), skinParam);
|
private TextBlock getLabel(Link link) {
|
||||||
if (TextBlockUtils.isEmpty(label, stringBounder))
|
ISkinParam skinParam = diagram.getSkinParam();
|
||||||
return null;
|
final double marginLabel = 1; // startUid.equals(endUid) ? 6 : 1;
|
||||||
|
final Style style = getStyle();
|
||||||
|
|
||||||
|
final FontConfiguration labelFont = style.getFontConfiguration(skinParam.getIHtmlColorSet());
|
||||||
|
TextBlock labelOnly = link.getLabel().create(labelFont,
|
||||||
|
skinParam.getDefaultTextAlignment(HorizontalAlignment.CENTER), skinParam);
|
||||||
|
|
||||||
|
final CucaNote note = link.getNote();
|
||||||
|
if (note == null) {
|
||||||
|
if (TextBlockUtils.isEmpty(labelOnly, stringBounder) == false)
|
||||||
|
labelOnly = TextBlockUtils.withMargin(labelOnly, marginLabel, marginLabel);
|
||||||
|
return labelOnly;
|
||||||
|
}
|
||||||
|
final TextBlock noteOnly = new EntityImageNoteLink(note.getDisplay(), note.getColors(), skinParam,
|
||||||
|
link.getStyleBuilder());
|
||||||
|
|
||||||
|
if (note.getPosition() == Position.LEFT)
|
||||||
|
return TextBlockUtils.mergeLR(noteOnly, labelOnly, VerticalAlignment.CENTER);
|
||||||
|
else if (note.getPosition() == Position.RIGHT)
|
||||||
|
return TextBlockUtils.mergeLR(labelOnly, noteOnly, VerticalAlignment.CENTER);
|
||||||
|
else if (note.getPosition() == Position.TOP)
|
||||||
|
return TextBlockUtils.mergeTB(noteOnly, labelOnly, HorizontalAlignment.CENTER);
|
||||||
|
else
|
||||||
|
return TextBlockUtils.mergeTB(labelOnly, noteOnly, HorizontalAlignment.CENTER);
|
||||||
|
|
||||||
return label;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private TextBlock getQuantifier(Link link, int n) {
|
private TextBlock getQuantifier(Link link, int n) {
|
||||||
|
@ -127,8 +127,9 @@ public class SmetanaForJson {
|
|||||||
|
|
||||||
private ST_Agnode_s manageOneNode(Globals zz, JsonValue current, List<Highlighted> highlighted) {
|
private ST_Agnode_s manageOneNode(Globals zz, JsonValue current, List<Highlighted> highlighted) {
|
||||||
final TextBlockJson block = new TextBlockJson(skinParam, current, highlighted);
|
final TextBlockJson block = new TextBlockJson(skinParam, current, highlighted);
|
||||||
final ST_Agnode_s node1 = createNode(zz, block.calculateDimension(stringBounder), block.size(),
|
final ST_Agnode_s node1 = createNode(zz, block.calculateDimension(stringBounder), current.isArray(),
|
||||||
current.isArray(), (int) block.getWidthColA(stringBounder), (int) block.getWidthColB(stringBounder));
|
block.getWidthColA(stringBounder), block.getWidthColB(stringBounder),
|
||||||
|
block.getAllHeights(stringBounder));
|
||||||
nodes.add(new InternalNode(block, node1));
|
nodes.add(new InternalNode(block, node1));
|
||||||
final List<JsonValue> children = block.children();
|
final List<JsonValue> children = block.children();
|
||||||
final List<String> keys = block.keys();
|
final List<String> keys = block.keys();
|
||||||
@ -222,16 +223,15 @@ public class SmetanaForJson {
|
|||||||
agsafeset(zz, edge, new CString("arrowhead"), new CString("normal"), new CString(""));
|
agsafeset(zz, edge, new CString("arrowhead"), new CString("normal"), new CString(""));
|
||||||
agsafeset(zz, edge, new CString("tailport"), new CString("P" + num), new CString(""));
|
agsafeset(zz, edge, new CString("tailport"), new CString("P" + num), new CString(""));
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
// StringBuilder sb = new StringBuilder();
|
||||||
sb.append("N" + a0.UID + " -> N" + a1.UID + " [tailport=\"P" + num + "\", arrowsize=.75]");
|
// sb.append("N" + a0.UID + " -> N" + a1.UID + " [tailport=\"P" + num + "\", arrowsize=.75]");
|
||||||
if (NUM == 0 && printFirst)
|
// System.err.println(sb);
|
||||||
System.err.println(sb);
|
|
||||||
|
|
||||||
return edge;
|
return edge;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ST_Agnode_s createNode(Globals zz, XDimension2D dim, int size, boolean isArray, int colAwidth,
|
private ST_Agnode_s createNode(Globals zz, XDimension2D dim, boolean isArray, double colAwidth, double colBwidth,
|
||||||
int colBwidth) {
|
double lineHeights[]) {
|
||||||
final String width = "" + (dim.getWidth() / 72);
|
final String width = "" + (dim.getWidth() / 72);
|
||||||
final String height = "" + (dim.getHeight() / 72);
|
final String height = "" + (dim.getHeight() / 72);
|
||||||
|
|
||||||
@ -243,25 +243,45 @@ public class SmetanaForJson {
|
|||||||
agsafeset(zz, node, new CString("height"), new CString("" + width), new CString(""));
|
agsafeset(zz, node, new CString("height"), new CString("" + width), new CString(""));
|
||||||
agsafeset(zz, node, new CString("width"), new CString("" + height), new CString(""));
|
agsafeset(zz, node, new CString("width"), new CString("" + height), new CString(""));
|
||||||
|
|
||||||
final int lineHeight = 0;
|
final int size = lineHeights.length;
|
||||||
final String dotLabel = getDotLabel(size, isArray, colAwidth - 8, colBwidth - 8, lineHeight);
|
final String dotLabel;
|
||||||
|
if (isArray)
|
||||||
|
dotLabel = getDotLabelArray(colAwidth - 8, colBwidth - 8, lineHeights);
|
||||||
|
else
|
||||||
|
dotLabel = getDotLabelMap(colAwidth - 8, colBwidth - 8, lineHeights);
|
||||||
|
|
||||||
if (size > 0)
|
if (size > 0)
|
||||||
agsafeset(zz, node, new CString("label"), new CString(dotLabel), new CString(""));
|
agsafeset(zz, node, new CString("label"), new CString(dotLabel), new CString(""));
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
// StringBuilder sb = new StringBuilder();
|
||||||
sb.append("N" + node.UID + " [");
|
// sb.append("N" + node.UID + " [");
|
||||||
sb.append("shape=record, height=" + width + ", width=" + height + ", label=\"" + dotLabel.replace('x', '.')
|
// sb.append("shape=record, height=" + width + ", width=" + height + ", label=\"" + dotLabel.replace('x', '.')
|
||||||
+ "\"]");
|
// + "\"]");
|
||||||
if (NUM == 0 && printFirst)
|
// System.err.println(sb);
|
||||||
System.err.println(sb);
|
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getDotLabel(int size, boolean isArray, int widthA, int widthB, int height) {
|
private String getDotLabelArray(double widthA, double widthB, double[] lineHeights) {
|
||||||
|
final int size = lineHeights.length;
|
||||||
|
final double height = 0;
|
||||||
final StringBuilder sb = new StringBuilder("");
|
final StringBuilder sb = new StringBuilder("");
|
||||||
if (isArray == false)
|
|
||||||
sb.append("{_dim_" + height + "_" + widthA + "_|{");
|
for (int i = 0; i < size; i++) {
|
||||||
|
sb.append("<P" + i + ">");
|
||||||
|
sb.append("_dim_" + height + "_" + widthA + "_");
|
||||||
|
if (i < size - 1)
|
||||||
|
sb.append("|");
|
||||||
|
}
|
||||||
|
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getDotLabelMap(double widthA, double widthB, double[] lineHeights) {
|
||||||
|
final int size = lineHeights.length;
|
||||||
|
final double height = 0;
|
||||||
|
final StringBuilder sb = new StringBuilder("");
|
||||||
|
sb.append("{_dim_" + height + "_" + widthA + "_|{");
|
||||||
|
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
sb.append("<P" + i + ">");
|
sb.append("<P" + i + ">");
|
||||||
@ -269,8 +289,7 @@ public class SmetanaForJson {
|
|||||||
if (i < size - 1)
|
if (i < size - 1)
|
||||||
sb.append("|");
|
sb.append("|");
|
||||||
}
|
}
|
||||||
if (isArray == false)
|
sb.append("}}");
|
||||||
sb.append("}}");
|
|
||||||
|
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ import net.sourceforge.plantuml.yaml.Highlighted;
|
|||||||
|
|
||||||
//See TextBlockMap
|
//See TextBlockMap
|
||||||
public class TextBlockJson extends AbstractTextBlock {
|
public class TextBlockJson extends AbstractTextBlock {
|
||||||
// ::remove folder when __HAXE__
|
// ::remove folder when __HAXE__
|
||||||
|
|
||||||
private final List<Line> lines = new ArrayList<>();
|
private final List<Line> lines = new ArrayList<>();
|
||||||
|
|
||||||
@ -323,6 +323,14 @@ public class TextBlockJson extends AbstractTextBlock {
|
|||||||
return height;
|
return height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double[] getAllHeights(StringBounder stringBounder) {
|
||||||
|
final double result[] = new double[lines.size()];
|
||||||
|
for (int i = 0; i < lines.size(); i++)
|
||||||
|
result[i] = lines.get(i).getHeightOfRow(stringBounder);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
private TextBlock getTextBlock(Style style, String key) {
|
private TextBlock getTextBlock(Style style, String key) {
|
||||||
final Display display = Display.getWithNewlines(key);
|
final Display display = Display.getWithNewlines(key);
|
||||||
final FontConfiguration fontConfiguration = style.getFontConfiguration(skinParam.getIHtmlColorSet());
|
final FontConfiguration fontConfiguration = style.getFontConfiguration(skinParam.getIHtmlColorSet());
|
||||||
|
@ -62,6 +62,7 @@ import h.ST_GVC_s;
|
|||||||
import net.sourceforge.plantuml.FileFormatOption;
|
import net.sourceforge.plantuml.FileFormatOption;
|
||||||
import net.sourceforge.plantuml.StringUtils;
|
import net.sourceforge.plantuml.StringUtils;
|
||||||
import net.sourceforge.plantuml.UmlDiagram;
|
import net.sourceforge.plantuml.UmlDiagram;
|
||||||
|
import net.sourceforge.plantuml.abel.CucaNote;
|
||||||
import net.sourceforge.plantuml.abel.Entity;
|
import net.sourceforge.plantuml.abel.Entity;
|
||||||
import net.sourceforge.plantuml.abel.GroupType;
|
import net.sourceforge.plantuml.abel.GroupType;
|
||||||
import net.sourceforge.plantuml.abel.LeafType;
|
import net.sourceforge.plantuml.abel.LeafType;
|
||||||
@ -79,6 +80,7 @@ import net.sourceforge.plantuml.klimt.font.StringBounder;
|
|||||||
import net.sourceforge.plantuml.klimt.geom.HorizontalAlignment;
|
import net.sourceforge.plantuml.klimt.geom.HorizontalAlignment;
|
||||||
import net.sourceforge.plantuml.klimt.geom.MinMaxMutable;
|
import net.sourceforge.plantuml.klimt.geom.MinMaxMutable;
|
||||||
import net.sourceforge.plantuml.klimt.geom.Rankdir;
|
import net.sourceforge.plantuml.klimt.geom.Rankdir;
|
||||||
|
import net.sourceforge.plantuml.klimt.geom.VerticalAlignment;
|
||||||
import net.sourceforge.plantuml.klimt.geom.XDimension2D;
|
import net.sourceforge.plantuml.klimt.geom.XDimension2D;
|
||||||
import net.sourceforge.plantuml.klimt.geom.XPoint2D;
|
import net.sourceforge.plantuml.klimt.geom.XPoint2D;
|
||||||
import net.sourceforge.plantuml.klimt.shape.AbstractTextBlock;
|
import net.sourceforge.plantuml.klimt.shape.AbstractTextBlock;
|
||||||
@ -98,6 +100,8 @@ import net.sourceforge.plantuml.svek.GeneralImageBuilder;
|
|||||||
import net.sourceforge.plantuml.svek.GraphvizCrash;
|
import net.sourceforge.plantuml.svek.GraphvizCrash;
|
||||||
import net.sourceforge.plantuml.svek.IEntityImage;
|
import net.sourceforge.plantuml.svek.IEntityImage;
|
||||||
import net.sourceforge.plantuml.svek.SvekNode;
|
import net.sourceforge.plantuml.svek.SvekNode;
|
||||||
|
import net.sourceforge.plantuml.svek.image.EntityImageNoteLink;
|
||||||
|
import net.sourceforge.plantuml.utils.Position;
|
||||||
import smetana.core.CString;
|
import smetana.core.CString;
|
||||||
import smetana.core.Globals;
|
import smetana.core.Globals;
|
||||||
import smetana.core.JUtils;
|
import smetana.core.JUtils;
|
||||||
@ -461,16 +465,32 @@ public class CucaDiagramFileMakerSmetana implements CucaDiagramFileMaker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private TextBlock getLabel(Link link) {
|
private TextBlock getLabel(Link link) {
|
||||||
final double marginLabel = 1; // startUid.equals(endUid) ? 6 : 1;
|
|
||||||
ISkinParam skinParam = diagram.getSkinParam();
|
ISkinParam skinParam = diagram.getSkinParam();
|
||||||
|
final double marginLabel = 1; // startUid.equals(endUid) ? 6 : 1;
|
||||||
final Style style = getStyle();
|
final Style style = getStyle();
|
||||||
final FontConfiguration labelFont = style.getFontConfiguration(skinParam.getIHtmlColorSet());
|
|
||||||
final TextBlock label = link.getLabel().create(labelFont,
|
|
||||||
skinParam.getDefaultTextAlignment(HorizontalAlignment.CENTER), skinParam);
|
|
||||||
if (TextBlockUtils.isEmpty(label, stringBounder))
|
|
||||||
return label;
|
|
||||||
|
|
||||||
return TextBlockUtils.withMargin(label, marginLabel, marginLabel);
|
final FontConfiguration labelFont = style.getFontConfiguration(skinParam.getIHtmlColorSet());
|
||||||
|
TextBlock labelOnly = link.getLabel().create(labelFont,
|
||||||
|
skinParam.getDefaultTextAlignment(HorizontalAlignment.CENTER), skinParam);
|
||||||
|
|
||||||
|
final CucaNote note = link.getNote();
|
||||||
|
if (note == null) {
|
||||||
|
if (TextBlockUtils.isEmpty(labelOnly, stringBounder) == false)
|
||||||
|
labelOnly = TextBlockUtils.withMargin(labelOnly, marginLabel, marginLabel);
|
||||||
|
return labelOnly;
|
||||||
|
}
|
||||||
|
final TextBlock noteOnly = new EntityImageNoteLink(note.getDisplay(), note.getColors(), skinParam,
|
||||||
|
link.getStyleBuilder());
|
||||||
|
|
||||||
|
if (note.getPosition() == Position.LEFT)
|
||||||
|
return TextBlockUtils.mergeLR(noteOnly, labelOnly, VerticalAlignment.CENTER);
|
||||||
|
else if (note.getPosition() == Position.RIGHT)
|
||||||
|
return TextBlockUtils.mergeLR(labelOnly, noteOnly, VerticalAlignment.CENTER);
|
||||||
|
else if (note.getPosition() == Position.TOP)
|
||||||
|
return TextBlockUtils.mergeTB(noteOnly, labelOnly, HorizontalAlignment.CENTER);
|
||||||
|
else
|
||||||
|
return TextBlockUtils.mergeTB(labelOnly, noteOnly, HorizontalAlignment.CENTER);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private TextBlock getQuantifier(Link link, int n) {
|
private TextBlock getQuantifier(Link link, int n) {
|
||||||
|
@ -46,7 +46,7 @@ import java.util.StringTokenizer;
|
|||||||
import net.sourceforge.plantuml.stereo.StereotypeDecoration;
|
import net.sourceforge.plantuml.stereo.StereotypeDecoration;
|
||||||
|
|
||||||
public class FromSkinparamToStyle {
|
public class FromSkinparamToStyle {
|
||||||
// ::remove file when __HAXE__
|
// ::remove file when __HAXE__
|
||||||
|
|
||||||
static class Data {
|
static class Data {
|
||||||
final private SName[] styleNames;
|
final private SName[] styleNames;
|
||||||
@ -181,8 +181,17 @@ public class FromSkinparamToStyle {
|
|||||||
|
|
||||||
addConvert("classBackgroundColor", PName.BackGroundColor, SName.element, SName.class_);
|
addConvert("classBackgroundColor", PName.BackGroundColor, SName.element, SName.class_);
|
||||||
addConvert("classBorderColor", PName.LineColor, SName.element, SName.class_);
|
addConvert("classBorderColor", PName.LineColor, SName.element, SName.class_);
|
||||||
addConFont("class", SName.element, SName.class_);
|
|
||||||
addConFont("classAttribute", SName.element, SName.class_);
|
addConvert("classFontSize", PName.FontSize, SName.element, SName.class_, SName.header);
|
||||||
|
addConvert("classFontStyle", PName.FontStyle, SName.element, SName.class_, SName.header);
|
||||||
|
addConvert("classFontColor", PName.FontColor, SName.element, SName.class_, SName.header);
|
||||||
|
addConvert("classFontName", PName.FontName, SName.element, SName.class_, SName.header);
|
||||||
|
|
||||||
|
addConvert("classAttributeFontSize", PName.FontSize, SName.element, SName.class_);
|
||||||
|
addConvert("classAttributeFontStyle", PName.FontStyle, SName.element, SName.class_);
|
||||||
|
addConvert("classAttributeFontColor", PName.FontColor, SName.element, SName.class_);
|
||||||
|
addConvert("classAttributeFontName", PName.FontName, SName.element, SName.class_);
|
||||||
|
|
||||||
addConvert("classBorderThickness", PName.LineThickness, SName.element, SName.class_);
|
addConvert("classBorderThickness", PName.LineThickness, SName.element, SName.class_);
|
||||||
addConvert("classHeaderBackgroundColor", PName.BackGroundColor, SName.element, SName.class_, SName.header);
|
addConvert("classHeaderBackgroundColor", PName.BackGroundColor, SName.element, SName.class_, SName.header);
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ import h.ST_textlabel_t;
|
|||||||
import smetana.core.debug.SmetanaDebug;
|
import smetana.core.debug.SmetanaDebug;
|
||||||
|
|
||||||
final public class Macro {
|
final public class Macro {
|
||||||
// ::remove folder when __HAXE__
|
// ::remove folder when __HAXE__
|
||||||
|
|
||||||
public static void UNSURE_ABOUT(String comment) {
|
public static void UNSURE_ABOUT(String comment) {
|
||||||
System.err.println("UNSURE_ABOUT: " + comment);
|
System.err.println("UNSURE_ABOUT: " + comment);
|
||||||
@ -1290,19 +1290,16 @@ final public class Macro {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void hackInitDimensionFromLabel(ST_pointf size, String label) {
|
public static void hackInitDimensionFromLabel(ST_pointf size, String label) {
|
||||||
if (label.matches("_dim_\\d+_\\d+_")) {
|
final Pattern p = Pattern.compile("_dim_([.\\d]+)_([\\d.]+)_");
|
||||||
Pattern p = Pattern.compile("_dim_(\\d+)_(\\d+)_");
|
final Matcher m = p.matcher(label);
|
||||||
Matcher m = p.matcher(label);
|
if (m.matches()) {
|
||||||
if (m.matches() == false) {
|
final double ww = Double.parseDouble(m.group(1));
|
||||||
throw new IllegalStateException();
|
final double hh = Double.parseDouble(m.group(2));
|
||||||
}
|
|
||||||
int ww = Integer.parseInt(m.group(1));
|
|
||||||
int hh = Integer.parseInt(m.group(2));
|
|
||||||
size.x = ww;
|
size.x = ww;
|
||||||
size.y = hh;
|
size.y = hh;
|
||||||
JUtils.LOG2("Hacking dimension to width=" + ww + " height=" + hh);
|
JUtils.LOG2("Hacking dimension to width=" + ww + " height=" + hh);
|
||||||
// } else {
|
} else {
|
||||||
// throw new IllegalArgumentException(label);
|
JUtils.LOG2("Strange label " + label);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1671,7 +1668,8 @@ final public class Macro {
|
|||||||
return (__ptr__) o.getTheField(ky);
|
return (__ptr__) o.getTheField(ky);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int _DTCMP(Globals zz, ST_dt_s dt, __ptr__ k1, __ptr__ k2, final ST_dtdisc_s dc, CFunction cmpf, int sz) {
|
public static int _DTCMP(Globals zz, ST_dt_s dt, __ptr__ k1, __ptr__ k2, final ST_dtdisc_s dc, CFunction cmpf,
|
||||||
|
int sz) {
|
||||||
return cmpf != null ? (Integer) ((CFunction) cmpf).exe(zz, dt, k1, k2, dc)
|
return cmpf != null ? (Integer) ((CFunction) cmpf).exe(zz, dt, k1, k2, dc)
|
||||||
: (sz <= 0 ? strcmp((CString) k1, (CString) k2) : UNSUPPORTED_INT("memcmp(ok,nk,sz)"));
|
: (sz <= 0 ? strcmp((CString) k1, (CString) k2) : UNSUPPORTED_INT("memcmp(ok,nk,sz)"));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user