Compare commits

...

4 Commits
a2r ... protos

Author SHA1 Message Date
David Given
dc6af483a5 Remember to build the drivetypes table. 2024-08-12 17:32:13 +02:00
David Given
9a0b487f4b Remember to build the formats table. 2024-08-12 17:26:28 +02:00
David Given
cac4d1ce86 Encode all the protos in one go (per library), as it's vastly faster. 2024-08-12 12:36:39 +02:00
David Given
7a3a31a929 Merge pull request #759 from davidgiven/a2r
Improve the A2R writer.
2024-07-31 23:45:51 +02:00
7 changed files with 54 additions and 33 deletions

View File

@@ -136,7 +136,7 @@ choices because they can store multiple types of file system.
| [`rolandd20`](doc/disk-rolandd20.md) | Roland D20: 3.5" electronic synthesiser disks | 🦄 | 🦖 | ROLAND |
| [`rx50`](doc/disk-rx50.md) | Digital RX50: 400kB 5.25" 80-track 10-sector SSDD | 🦖 | 🦖 | |
| [`smaky6`](doc/disk-smaky6.md) | Smaky 6: 308kB 5.25" 77-track 16-sector SSDD, hard sectored | 🦖 | | SMAKY6 |
| [`tartu`](doc/disk-tartu.md) | Tartu: The Palivere and variations | 🦄 | | CPMFS |
| [`tartu`](doc/disk-tartu.md) | Tartu: The Palivere and variations | 🦄 | 🦖 | CPMFS |
| [`tids990`](doc/disk-tids990.md) | Texas Instruments DS990: 1126kB 8" DSSD | 🦖 | 🦖 | |
| [`tiki`](doc/disk-tiki.md) | Tiki 100: CP/M | | | CPMFS |
| [`victor9k`](doc/disk-victor9k.md) | Victor 9000 / Sirius One: 1224kB 5.25" DSDD GCR | 🦖 | 🦖 | |

View File

@@ -22,7 +22,7 @@ density, using MFM and with up to 780kB on a double-sided 80 track disk.
<img src="tartu-fdc.jpg" alt="The Tartu FDC with Soviet TTL logic chips."/>
</div>
FluxEngine supports reading Tartu disks with CP/M filesystem access.
FluxEngine supports reading and writing Tartu disks with CP/M filesystem access.
## Options

View File

@@ -1,11 +1,11 @@
from build.ab import Rule, normalrule, Targets
from build.ab import Rule, normalrule, Targets, TargetsMap
from build.c import cxxprogram, HostToolchain
encoders = {}
@Rule
def protoencode(self, name, srcs: Targets, proto, symbol):
def protoencode_single(self, name, srcs: Targets, proto, symbol):
if proto not in encoders:
r = cxxprogram(
name="protoencode_" + proto,
@@ -34,6 +34,27 @@ def protoencode(self, name, srcs: Targets, proto, symbol):
)
@Rule
def protoencode(self, name, proto, srcs: TargetsMap, symbol):
encoded = [
protoencode_single(
name=f"{k}_cc",
srcs=[v],
proto=proto,
symbol=f"{symbol}_{k}_pb",
)
for k, v in srcs.items()
]
normalrule(
replaces=self,
ins=encoded,
outs=[name + ".cc"],
commands=["cat {ins} > {outs}"],
label="CONCAT",
)
cxxprogram(
name="mkdoc",
srcs=["./mkdoc.cc"],

View File

@@ -121,11 +121,12 @@ int main(int argc, const char* argv[])
}
auto data = message.SerializeAsString();
auto name = argv[3];
output << "#include \"lib/globals.h\"\n"
<< "#include \"lib/proto.h\"\n"
<< "#include <string_view>\n"
<< "static const uint8_t rawData[] = {";
<< "static const uint8_t " << name << "_rawData[] = {";
int count = 0;
for (char c : data)
@@ -140,12 +141,12 @@ int main(int argc, const char* argv[])
}
output << "\n};\n";
output << "extern const std::string_view " << argv[3] << "_data;\n";
output << "const std::string_view " << argv[3]
<< "_data = std::string_view((const char*)rawData, " << data.size()
output << "extern const std::string_view " << name << "_data;\n";
output << "const std::string_view " << name
<< "_data = std::string_view((const char*)" << name << "_rawData, " << data.size()
<< ");\n";
output << "extern const ConfigProto " << argv[3] << ";\n";
output << "const ConfigProto " << argv[3] << " = parseConfigBytes("
output << "extern const ConfigProto " << name << ";\n";
output << "const ConfigProto " << name << " = parseConfigBytes("
<< argv[3] << "_data);\n";
return 0;

View File

@@ -52,19 +52,16 @@ normalrule(
label="MKTABLE",
)
encoded = [
protoencode(
name=f"{name}_cc",
srcs=[f"./{name}.textpb"],
proto="ConfigProto",
symbol=f"formats_{name}_pb",
)
for name in formats
]
protoencode(
name="formats_cc",
srcs={name: f"./{name}.textpb" for name in formats},
proto="ConfigProto",
symbol="formats",
)
cxxlibrary(
name="formats",
srcs=[".+table_cc"] + encoded,
srcs=[".+formats_cc", ".+table_cc"],
deps=["+lib", "lib+config_proto_lib"],
)

View File

@@ -9,7 +9,7 @@ drivetypes = [
]
normalrule(
name="drivetypes_cc",
name="drivetypes_table_cc",
ins=[f"./{name}.textpb" for name in drivetypes],
deps=["scripts/mktable.sh"],
outs=["table.cc"],
@@ -21,14 +21,16 @@ normalrule(
label="MKTABLE",
)
encoded = [
protoencode(
name=f"{name}_cc",
srcs=[f"./{name}.textpb"],
proto="ConfigProto",
symbol=f"drivetypes_{name}_pb",
)
for name in drivetypes
]
cxxlibrary(name="drivetypes", srcs=[".+drivetypes_cc"] + encoded, deps=["+lib"])
protoencode(
name="drivetypes_cc",
srcs={name: f"./{name}.textpb" for name in drivetypes},
proto="ConfigProto",
symbol="drivetypes",
)
cxxlibrary(
name="drivetypes",
srcs=[".+drivetypes_cc", ".+drivetypes_table_cc"],
deps=["+lib"],
)

View File

@@ -2,7 +2,7 @@ from build.ab import export
from build.c import cxxprogram
from build.protobuf import proto, protocc
from build.utils import test
from scripts.build import protoencode
from scripts.build import protoencode_single
proto(
@@ -49,7 +49,7 @@ export(
name="proto_test_exe",
srcs=[
"./proto.cc",
protoencode(
protoencode_single(
name="testproto_cc",
srcs=["./testproto.textpb"],
proto="TestProto",