- probe_dump.cc: import_file(argv[1], cell_size),cell_size 可走 argv[2],默认 8 - r8_test.cc: 两处直接写 scopes[0][...] 改成 set_cell_size(8)。bef8310 起 scopes 默认是空 vector(不再预置全局帧),旧写法是空 vector 上的 scopes[0], 实测 segfault;tape 用例块里新建的 r8asm 也要自己播种(.xor 展开读 scopes[0]["_CELL_SIZE"],否则 map::at 抛) - 新增 tools/cellsize_probe.cc: 测 CELL_SIZE 的播种时序(未播种时 CELL_SIZE 是 indeterminate、scopes 为空) 验收:build.sh 后端 29 断言全绿;stdmac_matrix.py 627 例 0 失败;asm/test.r8asm tape 与 2469c3a 版本 md5 一致(264296f5…)、VM 输出 127 11 1 139 0 / 127 11 11 / 127 11 127 / 127 11 116 / 127 1 128 0
17 lines
510 B
C++
17 lines
510 B
C++
#include "r8asm/r8asm.hh"
|
|
#include <iostream>
|
|
|
|
// 探针驱动:把任意 .r8asm 文件汇编成 ROT-8 tape 打到 stdout。
|
|
// 必须在 r8asm_rev 仓库根目录运行(文件内的 %include "asm/..." 是相对 cwd 的路径)。
|
|
int main(int argc, char **argv) {
|
|
if (argc < 2) {
|
|
std::cerr << "usage: probe_dump <file.r8asm>\n";
|
|
return (1);
|
|
}
|
|
r8asm a;
|
|
size_t cell_size = (argc >= 3) ? std::stoul(argv[2]) : 8;
|
|
a.import_file(argv[1], cell_size);
|
|
std::cout << a.export_rot8();
|
|
return (0);
|
|
}
|