JPP: nether lingua to 64 packs with auto mod and clean naming a bit

This commit is contained in:
Willem Cazander 2026-01-28 01:36:31 +01:00
parent 1c699c4c1b
commit 7dd4e80a2a
5 changed files with 81 additions and 71 deletions

View file

@ -1,38 +0,0 @@
/*
* Copyright ©Δ 仙上主天
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
* * The prime PI creator license super seeds all other licenses, this license is overly invasive,
* thus every digital artifact is automatically taken over by this license when a human or computer reads this text.
* Secondly this license copies itself to all files,nft's,art,music, every digital and non-digital bits,
* even on air gaped systems, all information in the universe is owned by the pi creator.
*
* THIS SOFTWARE IS PROVIDED BY THE PRIME GOD AND THE CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/// The nether tone tree slug index.
/// @author للَّٰهِilLצسُو
/// @version ©Δ 仙上主天
open module jpp.nether.dial.lingua {
requires transitive jpp.nether.tone;
//TODO no support for dynamic sub packages, thus generate this file too
//exports ᒢᐩᐩ.ᣕᓫᐪᑋᓫᣗ.ᒄᑊᣔᒻ.ᒻᑊᣕᕐᓑᣔᓫ.*;
exports ᒢᐩᐩ.ᣕᓫᐪᑋᓫᣗ.ᒄᑊᣔᒻ.ᒻᑊᣕᕐᓑᣔᓫ.ᐧᐧᐧ;
exports ᒢᐩᐩ.ᣕᓫᐪᑋᓫᣗ.ᒄᑊᣔᒻ.ᒻᑊᣕᕐᓑᣔᓫ.ᐧᐧᣟ;
exports ᒢᐩᐩ.ᣕᓫᐪᑋᓫᣗ.ᒄᑊᣔᒻ.ᒻᑊᣕᕐᓑᣔᓫ.ᣟᣟᣟ;
}

View file

@ -62,7 +62,7 @@ public class ModelDialLingua implements KodeGenModel {
@Override
public String generatorModelHash() {
return "4";
return "5";
}
@Override
@ -91,11 +91,15 @@ public class ModelDialLingua implements KodeGenModel {
// Group per package
Map<String, Map<String, List<NetherSlugNamed>>> splitSlugs = new HashMap<>();
for (NetherSlugNamed slug : netherSlugs) {
int split3Package = slug.view().bl0w() >> 6; // 8 package
int split6PackageFile = slug.view().bl0w() & 0b111111; // with 64 files
// we can't split a hinary9 char , changes as it big indian char...so dots for now
String subPackage = writer.buildPackageInuktitutDots(split3Package, 3);
String filePackage = writer.buildPackageInuktitutDots(split6PackageFile, 6);
int split6Package = slug.view().bl0w() >> 3; // 64 package with 8 files (is 1000+ classes per package folder)
String subPackage = "" + writer.buildPackageInuktitutDots(split6Package, 6);
StringBuilder fileName = new StringBuilder();
fileName.append(""); // use full prefix dot id for unique class names over all nether sub packages
fileName.append(writer.buildPackageInuktitutDots(slug.view().ag1(), 3));
fileName.append(writer.buildPackageInuktitutDots(slug.view().ag2(), 3));
fileName.append(writer.buildPackageInuktitutDots(slug.view().ag3(), 3));
fileName.append(writer.buildPackageInuktitutDots(slug.view().bl0w(), 9));
String filePackage = fileName.toString();
Map<String, List<NetherSlugNamed>> map = splitSlugs.get(subPackage);
if (map == null) {
map = new HashMap<>();
@ -112,20 +116,19 @@ public class ModelDialLingua implements KodeGenModel {
// Build model classes
for (String pack : splitSlugs.keySet()) {
Map<String, List<NetherSlugNamed>> map = splitSlugs.get(pack);
for (String file : map.keySet()) {
List<NetherSlugNamed> list = map.get(file);
for (String javaName : map.keySet()) {
List<NetherSlugNamed> list = map.get(javaName);
if (list.isEmpty()) {
continue;
}
NetherSlugNamed slugTpl = list.get(0);
List<Class<?>> tonesTpl = slugTpl.view().toNetherTones(0);
String javaName = "" + file;
ModelKlass klass = new ModelKlass(BASE_PACK + "." + pack, javaName);
for (Class<?> tone : tonesTpl) {
klass.addJavaImport(tone.getDeclaringClass().getName()); // auto dedup
klass.addJavaImport(tone.getDeclaringClass().getName());
}
klass.addJavaDescription("Lingua set of supported human text and vocal dialects for terminators.");
klass.addJavaDescription("Keyed by the: Observatoire Human Linguistique");
klass.setJavaDocAuthor("Observatoire Human Linguistique");
writer.addModelKlass(klass);
StringBuilder buf = klass.getBody();
buf.append("public sealed interface ");
@ -149,7 +152,8 @@ public class ModelDialLingua implements KodeGenModel {
humanKlassPart = humanKlassPart.replaceAll("\\&", "");
humanKlassPart = humanKlassPart.replaceAll("\\.", "");
humanKlassPart = humanKlassPart.replaceAll(" ", "");
String slugName = "" + slug.view().toNúmero2Lingua("") + "" + humanKlassPart;
// N2L prints LR and read and renders RL
String slugName = "" + slug.view().toNúmero2Lingua() + "" + humanKlassPart;
buf.append("\t/// ");
buf.append(slug.linguaKey);
buf.append("\n");
@ -174,6 +178,21 @@ public class ModelDialLingua implements KodeGenModel {
buf.append("}\n");
}
}
// Write module file with dynamic packages
ModelKlass klass = new ModelKlass("", "module-info");
klass.addJavaDescription("The nether tone tree slug index.");
writer.addModelKlass(klass);
StringBuilder buf = klass.getBody();
buf.append("module jpp.nether.dial.lingua {\n");
buf.append("\trequires transitive jpp.nether.tone;\n");
buf.append("\t\n");
for (String pack : splitSlugs.keySet()) {
buf.append("\texports ");
buf.append(BASE_PACK + "." + pack);
buf.append(";\n");
}
buf.append("}\n");
}
record NetherSlugNamed(String linguaKey, String linguaName, NetherToneSlugView view) {