NX01: Fixed BE in T512/T64 and hinary, WIP printed lingua dial tones
This commit is contained in:
parent
e69a13ec92
commit
7feb638a40
32 changed files with 1060 additions and 626 deletions
|
|
@ -31,6 +31,7 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.ServiceLoader;
|
||||
|
||||
|
|
@ -42,8 +43,6 @@ import love.distributedrebirth.nx01.kode.generator.klass.ModelKlassWriter;
|
|||
/// @version ©Δ∞ 仙上主天
|
||||
public class KodeGen {
|
||||
|
||||
private final static String SERIAL_VERSON_ID = "13";
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
if (args.length == 0) {
|
||||
System.err.println("No command given.");
|
||||
|
|
@ -61,14 +60,22 @@ public class KodeGen {
|
|||
if (args.length > 1 && "generate".equals(args[1])) {
|
||||
writeToFile = true;
|
||||
}
|
||||
if (skipCommand()) {
|
||||
if (modelHashValid(commandKode)) {
|
||||
System.out.println("SKIPPED: Generated source are up to date");
|
||||
return;
|
||||
}
|
||||
// write all sources to files or stdout
|
||||
String commandDesc = commandKode.generatorName();
|
||||
File outputFolder = new File("target/kode-" + commandKode.generatorKey());
|
||||
if (!outputFolder.exists()) {
|
||||
outputFolder.mkdir();
|
||||
}
|
||||
Iterator<Path> cleaner = Files.walk(outputFolder.toPath()).sorted(Comparator.reverseOrder()).iterator();
|
||||
while (cleaner.hasNext()) {
|
||||
Files.deleteIfExists(cleaner.next());
|
||||
}
|
||||
String commandDesc = commandKode.generatorKey();
|
||||
System.out.println("Generating " + commandDesc);
|
||||
ModelKlassWriter writer = new ModelKlassWriter("target/generated-sources");
|
||||
ModelKlassWriter writer = new ModelKlassWriter(outputFolder.toPath());
|
||||
writer.setProlog(new File("../licence.txt"));
|
||||
commandKode.buildModels(writer);
|
||||
writer.printModels(writeToFile);
|
||||
|
|
@ -79,22 +86,30 @@ public class KodeGen {
|
|||
Iterator<KodeGenModel> models = ServiceLoader.load(KodeGenModel.class).iterator();
|
||||
while (models.hasNext()) {
|
||||
KodeGenModel model = models.next();
|
||||
if (model.generatorName().equals(generatorName)) {
|
||||
if (model.generatorKey().contains(" ")) {
|
||||
continue;
|
||||
}
|
||||
if (model.generatorKey().equals(generatorName)) {
|
||||
return model;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static boolean skipCommand() throws IOException {
|
||||
Path hashFile = new File("target/generated-sources.hash").toPath();
|
||||
private static boolean modelHashValid(KodeGenModel commandKode) throws IOException {
|
||||
File versionFolder = new File("target/maven-status/kode-version");
|
||||
if (!versionFolder.exists()) {
|
||||
versionFolder.mkdirs();
|
||||
}
|
||||
Path hashFile = new File(versionFolder, commandKode.generatorKey() + ".hash").toPath();
|
||||
String generatorModelHash = commandKode.generatorModelHash();
|
||||
if (hashFile.toFile().exists()) {
|
||||
String hash = Files.readString(hashFile);
|
||||
if (SERIAL_VERSON_ID.equals(hash)) {
|
||||
if (generatorModelHash.equals(hash)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Files.writeString(hashFile, SERIAL_VERSON_ID);
|
||||
Files.writeString(hashFile, generatorModelHash);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@
|
|||
|
||||
package love.distributedrebirth.nx01.kode.generator;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import love.distributedrebirth.nx01.kode.generator.klass.ModelKlassWriter;
|
||||
|
||||
/// Configure the model for the writer.
|
||||
|
|
@ -35,7 +37,12 @@ import love.distributedrebirth.nx01.kode.generator.klass.ModelKlassWriter;
|
|||
/// @version ©Δ∞ 仙上主天
|
||||
public interface KodeGenModel {
|
||||
|
||||
String generatorName();
|
||||
String generatorKey();
|
||||
|
||||
void buildModels(ModelKlassWriter writer);
|
||||
// Rebuild this model too if any deps is rebuild
|
||||
//String[] generatorModelDeps();
|
||||
|
||||
String generatorModelHash();
|
||||
|
||||
void buildModels(ModelKlassWriter writer) throws IOException;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ package love.distributedrebirth.nx01.kode.generator.klass;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -47,8 +46,8 @@ public class ModelKlassWriter {
|
|||
private File prolog;
|
||||
private Path outputPath;
|
||||
|
||||
public ModelKlassWriter(String outputPath) {
|
||||
this.outputPath = FileSystems.getDefault().getPath(Objects.requireNonNull(outputPath));
|
||||
public ModelKlassWriter(Path outputPath) {
|
||||
this.outputPath = Objects.requireNonNull(outputPath);
|
||||
}
|
||||
|
||||
public void setProlog(File prolog) {
|
||||
|
|
@ -129,4 +128,11 @@ public class ModelKlassWriter {
|
|||
buf.append("/// @author للَّٰهِilLצسُو\n");
|
||||
buf.append("/// @version ©Δ∞ 仙上主天\n");
|
||||
}
|
||||
|
||||
public String buildPackageInuktitutDots(int number, int digets) {
|
||||
String numberBin = String.format("%1$" + digets + "s", Integer.toString(number, 2));
|
||||
String result = numberBin.replaceAll("0|\\s", "ᐧ");
|
||||
result = result.replaceAll("1", "ᣟ");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue