33 lines
577 B
Text
33 lines
577 B
Text
file f;
|
|
data b;
|
|
list l;
|
|
record r;
|
|
|
|
f.stdin;
|
|
|
|
o_text("Enter the blank line terminated story:\n");
|
|
|
|
while (0 < f.b_line(b)) {
|
|
l.append(b);
|
|
}
|
|
|
|
for (, b in l) {
|
|
integer p, q;
|
|
text s, t;
|
|
|
|
while ((p = b.place('<')) ^ -1) {
|
|
q = b.probe(p, '>');
|
|
if (q ^ -1) {
|
|
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(p, r[s]);
|
|
}
|
|
}
|
|
}
|
|
|
|
l.ucall(o_, 0, "\n");
|