Added the cake slice window to the overview page

This commit is contained in:
Willem Cazander 2025-01-18 02:21:41 +01:00
parent e26a4e2a5e
commit 2f482e2439
3 changed files with 42 additions and 9 deletions

View file

@ -54,7 +54,7 @@ public class FCDocSegmentWriterCake implements FCDocSegmentWriter {
}; };
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.DESCRIPTION_NODE,targetClasses={TDocCake.class}) @ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.DESCRIPTION_NODE,targetClasses={TDocCake.class})
public void writeSchemaViewSummary(ApiDocWriteEvent<ApiDocNode> event) throws SAXException, IOException { public void writeSchemaViewSummary(ApiDocWriteEvent<ApiDocNode> event) throws IOException {
ApiDocContentWriter writer = event.getWriter(); ApiDocContentWriter writer = event.getWriter();
writer.printCharacters("Four corner is 18 bit text encoding for 144 bit computers."); writer.printCharacters("Four corner is 18 bit text encoding for 144 bit computers.");
writer.printTagStartEnd(Tag.br); writer.printTagStartEnd(Tag.br);

View file

@ -41,7 +41,6 @@ import org.x4o.o2o.tdoc.dom.ApiDocConcept;
import org.x4o.o2o.tdoc.dom.ApiDocNode; import org.x4o.o2o.tdoc.dom.ApiDocNode;
import org.x4o.o2o.tdoc.dom.ApiDocNodeBody; import org.x4o.o2o.tdoc.dom.ApiDocNodeBody;
import org.x4o.o2o.tdoc.dom.ApiDocWriteEvent; import org.x4o.o2o.tdoc.dom.ApiDocWriteEvent;
import org.xml.sax.SAXException;
/** /**
* Cake doc segment slice writer. * Cake doc segment slice writer.
@ -52,7 +51,7 @@ import org.xml.sax.SAXException;
public class FCDocSegmentWriterCakeSlice implements FCDocSegmentWriter { public class FCDocSegmentWriterCakeSlice implements FCDocSegmentWriter {
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY, targetClasses={FourCornerDotCake.class}, nodeBodyOrders=20) @ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY, targetClasses={FourCornerDotCake.class}, nodeBodyOrders=20)
public void writeDefaultSummary(ApiDocWriteEvent<ApiDocNode> event) throws SAXException, IOException { public void writeDefaultSummary(ApiDocWriteEvent<ApiDocNode> event) throws IOException {
// NOTE: copyed from defaultWriteSummary as that only called with zero summaries // NOTE: copyed from defaultWriteSummary as that only called with zero summaries
ApiDocContentWriter writer = event.getWriter(); ApiDocContentWriter writer = event.getWriter();
ApiDocNode parent = event.getEventObject(); ApiDocNode parent = event.getEventObject();
@ -75,7 +74,7 @@ public class FCDocSegmentWriterCakeSlice implements FCDocSegmentWriter {
} }
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY, targetClasses={FourCornerDotCake.class}, nodeBodyOrders=10) @ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY, targetClasses={FourCornerDotCake.class}, nodeBodyOrders=10)
public void writeSchemaViewSummary(ApiDocWriteEvent<ApiDocNode> event) throws SAXException, IOException { public void writeMuffinSummary(ApiDocWriteEvent<ApiDocNode> event) throws IOException {
ApiDocContentWriter writer = event.getWriter(); ApiDocContentWriter writer = event.getWriter();
FourCornerDotCake slice = (FourCornerDotCake)event.getEventObject().getUserData(); FourCornerDotCake slice = (FourCornerDotCake)event.getEventObject().getUserData();
if (slice.getStart() >= FourCornerDotCake.__MIND_THE_GAP8.getStart()) { if (slice.getStart() >= FourCornerDotCake.__MIND_THE_GAP8.getStart()) {
@ -109,7 +108,7 @@ public class FCDocSegmentWriterCakeSlice implements FCDocSegmentWriter {
return; return;
} }
if (FourCornerDotCake.FC_CDC1604_P6.equals(slice)) { if (FourCornerDotCake.FC_CDC1604_P6.equals(slice)) {
try (ContentCloseable table = writer.docTable(FourCornerDotCake.FC_CDC1604_P6.nameSpec(), null, ApiDocContentCss.overviewSummary)) { try (ContentCloseable table = writer.docTable("Cake Points", null, ApiDocContentCss.overviewSummary)) {
writeTableBoxHeaderNumeric(writer, 17); writeTableBoxHeaderNumeric(writer, 17);
writeCDC(writer, 0x00); writeCDC(writer, 0x00);
writeCDC(writer, 0x10); writeCDC(writer, 0x10);
@ -121,9 +120,22 @@ public class FCDocSegmentWriterCakeSlice implements FCDocSegmentWriter {
} }
private void writeP7xSlice(ApiDocContentWriter writer, FourCornerDotCake slice, Function<Integer, Integer> conv) throws IOException { private void writeP7xSlice(ApiDocContentWriter writer, FourCornerDotCake slice, Function<Integer, Integer> conv) throws IOException {
try (ContentCloseable table = writer.docTable(slice.nameSpec(), null, ApiDocContentCss.overviewSummary)) { try (ContentCloseable table = writer.docTable("Cake Points", null, ApiDocContentCss.overviewSummary)) {
writeTableBoxHeaderNumeric(writer, 28, true); writeTableBoxHeaderNumeric(writer, 28, true);
writeP7x(writer, slice, conv); writeP7x(writer, slice, conv);
} }
} }
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY, targetClasses={FourCornerDotCake.class}, nodeBodyOrders=1)
public void writeCakeSliceDetails(ApiDocWriteEvent<ApiDocNode> event) throws IOException {
ApiDocContentWriter writer = event.getWriter();
FourCornerDotCake slice = (FourCornerDotCake)event.getEventObject().getUserData();
try (ContentCloseable table = writer.docTable("Cake Slice", null, ApiDocContentCss.overviewSummary)) {
writer.docTableHeader("Information", "Value");
writer.docTableRow("Start index", String.format("0x%06X", slice.getStart()));
writer.docTableRow("Stop index", String.format("0x%06X", slice.getStop()));
writer.docTableRow("Size", Integer.toString(slice.getLength()));
writer.docTableRow("External word", Boolean.toString(slice.isExternWord()));
}
}
} }

View file

@ -23,15 +23,16 @@
package org.x4o.fc18.cake2.fcdoc; package org.x4o.fc18.cake2.fcdoc;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays;
import org.x4o.fc18.cake2.FourCornerX00PetitVidePoints; import org.x4o.fc18.cake2.FourCornerX00PetitVidePoints;
import org.x4o.o2o.io.ContentWriterHtml.Tag;
import org.x4o.o2o.tdoc.ApiDocContentCss; import org.x4o.o2o.tdoc.ApiDocContentCss;
import org.x4o.o2o.tdoc.ApiDocContentWriter; import org.x4o.o2o.tdoc.ApiDocContentWriter;
import org.x4o.o2o.tdoc.ApiDocNodeWriterMethod; import org.x4o.o2o.tdoc.ApiDocNodeWriterMethod;
import org.x4o.o2o.tdoc.dom.ApiDocNode; import org.x4o.o2o.tdoc.dom.ApiDocNode;
import org.x4o.o2o.tdoc.dom.ApiDocNodeBody; import org.x4o.o2o.tdoc.dom.ApiDocNodeBody;
import org.x4o.o2o.tdoc.dom.ApiDocWriteEvent; import org.x4o.o2o.tdoc.dom.ApiDocWriteEvent;
import org.xml.sax.SAXException;
/** /**
* Cake doc word writer. * Cake doc word writer.
@ -42,7 +43,7 @@ import org.xml.sax.SAXException;
public class FCDocSegmentWriterCakeWord implements FCDocSegmentWriter { public class FCDocSegmentWriterCakeWord implements FCDocSegmentWriter {
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY,targetClasses={TDocCakeWord.class}) @ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.SUMMARY,targetClasses={TDocCakeWord.class})
public void writeSchemaViewSummary(ApiDocWriteEvent<ApiDocNode> event) throws SAXException, IOException { public void writeCakeWordSummary(ApiDocWriteEvent<ApiDocNode> event) throws IOException {
ApiDocContentWriter writer = event.getWriter(); ApiDocContentWriter writer = event.getWriter();
TDocCakeWord word = (TDocCakeWord)event.getEventObject().getUserData(); TDocCakeWord word = (TDocCakeWord)event.getEventObject().getUserData();
FourCornerX00PetitVidePoints[] videPoints = word.getSlice().getVidePoints(); FourCornerX00PetitVidePoints[] videPoints = word.getSlice().getVidePoints();
@ -67,7 +68,7 @@ public class FCDocSegmentWriterCakeWord implements FCDocSegmentWriter {
writer.docTableEnd(); writer.docTableEnd();
} }
private void writeSequence(ApiDocContentWriter writer, String system, int[] sequence) throws SAXException, IOException { private void writeSequence(ApiDocContentWriter writer, String system, int[] sequence) throws IOException {
StringBuilder buf = new StringBuilder(); StringBuilder buf = new StringBuilder();
for (int i = 0; i < sequence.length; i++) { for (int i = 0; i < sequence.length; i++) {
int seq = sequence[i]; int seq = sequence[i];
@ -79,4 +80,24 @@ public class FCDocSegmentWriterCakeWord implements FCDocSegmentWriter {
} }
writer.docTableRow(system, buf.toString()); writer.docTableRow(system, buf.toString());
} }
@ApiDocNodeWriterMethod(nodeBody=ApiDocNodeBody.DETAIL,targetClasses={TDocCakeWord.class})
public void writeCakeWordDetail(ApiDocWriteEvent<ApiDocNode> event) throws IOException {
ApiDocContentWriter writer = event.getWriter();
TDocCakeWord word = (TDocCakeWord)event.getEventObject().getUserData();
FourCornerX00PetitVidePoints[] videPoints = word.getSlice().getVidePoints();
if (videPoints.length == 0) {
return;
}
FourCornerX00PetitVidePoints letter = videPoints[word.getOffset()];
if (!letter.isX21()) {
return;
}
StringBuilder buf = new StringBuilder();
Arrays.stream(letter.toX21().codePoints()).forEach(v -> buf.appendCodePoint(v));
writer.printTagStart(Tag.pre);
writer.printCharacters(buf.toString());
writer.printTagEnd(Tag.pre);
}
} }