9front - general discussion about 9front
 help / color / mirror / Atom feed
From: Grimmware <oholiab@grimmwa.re>
To: 9front@9front.org
Subject: [9front] [PATCH] Correct acid's rune size to 4 bytes
Date: Wed, 29 Nov 2023 10:47:42 +0000	[thread overview]
Message-ID: <e7e8f06b-0907-4b23-b67b-50dd9cc90979@app.fastmail.com> (raw)

Correctly display runes that utilize the higher bits and correctly render rune strings with the \R format

---
diff c6af55fef7800d6a151f05a25ab19feb29abb9aa ea9dfc8d6c6d3ecfb6cfa16ac37db9cccd12adf7
--- a/sys/doc/acid.ms
+++ b/sys/doc/acid.ms
@@ -285,9 +285,9 @@
 Interpret the addressed bytes as UTF characters
 and print successive characters until a zero byte is reached.
 .IP \f(CWr\fP
-Print a two-byte integer as a rune.
+Print a four-byte integer as a rune.
 .IP \f(CWR\fP
-Print successive two-byte integers as runes
+Print successive four-byte integers as runes
 until a zero rune is reached.
 .IP \f(CWi\fP
 Print as machine instructions.
--- a/sys/src/cmd/acid/exec.c
+++ b/sys/src/cmd/acid/exec.c
@@ -264,7 +264,6 @@
 	case 'u':
 	case 'o':
 	case 'q':
-	case 'r':
 		r->type = TINT;
 		ret = get2(m, addr, &sval);
 		if (ret < 0)
@@ -286,6 +285,7 @@
 	case 'U':
 	case 'O':
 	case 'Q':
+	case 'r':
 		r->type = TINT;
 		ret = get4(m, addr, &lval);
 		if (ret < 0)
@@ -318,11 +318,11 @@
 		break;
 	case 'R':
 		r->type = TSTRING;
-		for(i = 0; i < sizeof(buf)-2; i += 2) {
-			ret = get1(m, addr, (uchar*)&buf[i], 2);
+		for(i = 0; i < sizeof(buf)-sizeof(Rune); i += sizeof(Rune)) {
+			ret = get1(m, addr, (uchar*)&buf[i], sizeof(Rune));
 			if (ret < 0)
 				error("indir: %r");
-			addr += 2;
+			addr += sizeof(Rune);
 			if(buf[i] == 0 && buf[i+1] == 0)
 				break;
 		}

             reply	other threads:[~2023-11-29 10:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-29 10:47 Grimmware [this message]
2023-11-29 19:13 ` cinap_lenrek
2023-12-01 12:32   ` Grimmware
2023-12-01 16:37     ` cinap_lenrek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e7e8f06b-0907-4b23-b67b-50dd9cc90979@app.fastmail.com \
    --to=oholiab@grimmwa.re \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).