cmd/ww: main.ww FOLD 0 — drop dead cstrstartswith, isidentbyte &&/char-lits (capstone prep)

Byte-id-neutral mechanical prep in the ww driver:
- delete dead helper cstrstartswith (zero call sites)
- isidentbyte: 3 nested if(x){if(y){ -> if(x && y) collapses
- char-lit subs in comparison context: isidentbyte bounds,
  locateimport ':', basenameoff '/'

Regenerated main.combined.ww.
This commit is contained in:
2026-06-03 02:17:48 +09:00
parent ff333ce62d
commit cc62f3f8bb
2 changed files with 14 additions and 34 deletions

View File

@@ -2895,16 +2895,6 @@ fn cstreqlit(a: *u8, lit: str) bool = {
return a[n] == 0u8;
};
// startswith — does a have b as a prefix?
fn cstrstartswith(a: *u8, b: *u8) bool = {
let i: u64 = 0u64;
for (b[i] != 0u8) {
if (a[i] != b[i]) { return false; };
i += 1u64;
};
return true;
};
// memcpy
fn bytecpy(dst: *u8, src: *u8, n: u64) void = {
let i: u64 = 0u64;
@@ -3145,7 +3135,7 @@ fn locateimport(dirs: *u8, name: *u8, namelen: u64,
for (p < total) {
let q: u64 = p;
for (q < total) {
if (dirs[q] == 58u8) { break; }; // ':'
if (dirs[q] == ':') { break; };
q += 1u64;
};
let seglen: u64 = q - p;
@@ -3314,11 +3304,11 @@ fn slurp(pathcs: *u8) (*u8, u64) = {
};
fn isidentbyte(c: u8) bool = {
if (c >= 97u8) { if (c <= 122u8) { return true; }; }; // a..z
if (c >= 65u8) { if (c <= 90u8) { return true; }; }; // A..Z
if (c >= 48u8) { if (c <= 57u8) { return true; }; }; // 0..9
if (c == 95u8) { return true; }; // _
if (c == 46u8) { return true; }; // .
if (c >= 'a' && c <= 'z') { return true; };
if (c >= 'A' && c <= 'Z') { return true; };
if (c >= '0' && c <= '9') { return true; };
if (c == '_') { return true; };
if (c == '.') { return true; };
return false;
};
@@ -3811,7 +3801,7 @@ fn basenameoff(p: *u8, plen: u64) u64 = {
let start: u64 = 0u64;
let i: u64 = 0u64;
for (i < plen) {
if (p[i] == 47u8) { start = i + 1u64; }; // '/'
if (p[i] == '/') { start = i + 1u64; };
i += 1u64;
};
return start;

View File

@@ -61,16 +61,6 @@ fn cstreqlit(a: *u8, lit: str) bool = {
return a[n] == 0u8;
};
// startswith — does a have b as a prefix?
fn cstrstartswith(a: *u8, b: *u8) bool = {
let i: u64 = 0u64;
for (b[i] != 0u8) {
if (a[i] != b[i]) { return false; };
i += 1u64;
};
return true;
};
// memcpy
fn bytecpy(dst: *u8, src: *u8, n: u64) void = {
let i: u64 = 0u64;
@@ -311,7 +301,7 @@ fn locateimport(dirs: *u8, name: *u8, namelen: u64,
for (p < total) {
let q: u64 = p;
for (q < total) {
if (dirs[q] == 58u8) { break; }; // ':'
if (dirs[q] == ':') { break; };
q += 1u64;
};
let seglen: u64 = q - p;
@@ -480,11 +470,11 @@ fn slurp(pathcs: *u8) (*u8, u64) = {
};
fn isidentbyte(c: u8) bool = {
if (c >= 97u8) { if (c <= 122u8) { return true; }; }; // a..z
if (c >= 65u8) { if (c <= 90u8) { return true; }; }; // A..Z
if (c >= 48u8) { if (c <= 57u8) { return true; }; }; // 0..9
if (c == 95u8) { return true; }; // _
if (c == 46u8) { return true; }; // .
if (c >= 'a' && c <= 'z') { return true; };
if (c >= 'A' && c <= 'Z') { return true; };
if (c >= '0' && c <= '9') { return true; };
if (c == '_') { return true; };
if (c == '.') { return true; };
return false;
};
@@ -977,7 +967,7 @@ fn basenameoff(p: *u8, plen: u64) u64 = {
let start: u64 = 0u64;
let i: u64 = 0u64;
for (i < plen) {
if (p[i] == 47u8) { start = i + 1u64; }; // '/'
if (p[i] == '/') { start = i + 1u64; };
i += 1u64;
};
return start;