From f8e9bc1c721a0802b2260f48ced72c7e04d7b1ef Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Sun, 23 Apr 2023 11:02:52 -0300 Subject: Towards a smaller encoding for charsets in code --- lpprint.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'lpprint.c') diff --git a/lpprint.c b/lpprint.c index 1b5c488..ed52328 100644 --- a/lpprint.c +++ b/lpprint.c @@ -33,6 +33,18 @@ void printcharset (const byte *st) { } +static void printIcharset (const Instruction *inst, const byte *buff) { + byte cs[CHARSETSIZE]; + int i; + loopset(j, cs[j] = 0); + for (i = 0; i < CHARSETSIZE << 3; i++) { + if (charinset(inst, buff, i)) + setchar(cs, i); + } + printcharset(cs); +} + + static const char *capkind (int kind) { const char *const modes[] = { "close", "position", "constant", "backref", @@ -83,15 +95,15 @@ void printinst (const Instruction *op, const Instruction *p) { break; } case ISet: { - printcharset((p+1)->buff); + printIcharset(p, (p+1)->buff); break; } case ITestSet: { - printcharset((p+2)->buff); printjmp(op, p); + printIcharset(p, (p+2)->buff); printjmp(op, p); break; } case ISpan: { - printcharset((p+1)->buff); + printIcharset(p, (p+1)->buff); break; } case IOpenCall: { -- cgit v1.2.3-55-g6feb