June 2018 Update

This commit is contained in:
Ingy döt Net 2018-06-22 20:57:24 +00:00
parent ba8067c3b7
commit 22f33d4004
5278 changed files with 84726 additions and 14379 deletions

View file

@ -1,43 +1,33 @@
integer i;
file f;
data b;
list l;
record r;
f_affix(f, "/dev/stdin");
f.stdin;
o_text("Enter the blank line terminated story:\n");
while (0 < f_b_line(f, b)) {
l_append(l, b);
while (0 < f.b_line(b)) {
l.append(b);
}
i = 0;
while (i < l_length(l)) {
for (, b in l) {
integer p, q;
text s, t;
b = l_q_data(l, i);
while ((p = b_index(b, '<')) ^ -1) {
q = b_probe(b, p, '>');
while ((p = b.place('<')) ^ -1) {
q = b.probe(p, '>');
if (q ^ -1) {
s = cut(b_string(b), p + 1, q - p - 1);
b_erase(b, p, q);
if (!r_key(r, s)) {
o_text(cat3("Replacement for `", s, ":'\n"));
f_line(f, t);
r_put(r, s, t);
s = bq_string(b, p + 1, q - 1);
b.erase(p, q);
if (!r.key(s)) {
o_("Replacement for `", s, "':\n");
f.line(t);
r.put(s, t);
}
b_paste(b, p, r_query(r, s));
b.paste(p, r[s]);
}
}
i += 1;
}
while (l_length(l)) {
o_text(b_string(l_head(l)));
o_newline();
l_delete(l, 0);
}
l.ucall(o_, 0, "\n");