From 15eb91f21764fe77dde68fb327360e7f85bf9714 Mon Sep 17 00:00:00 2001 From: Pete Date: Thu, 2 Nov 2023 10:56:44 -0700 Subject: [PATCH 1/9] Make the wm/memory display more readable by converting uniformly. --- appl/wm/memory.b | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/appl/wm/memory.b b/appl/wm/memory.b index 6bbfa68b..77221a8f 100644 --- a/appl/wm/memory.b +++ b/appl/wm/memory.b @@ -109,9 +109,9 @@ realinit(ctxt: ref Draw->Context) maxx+x, a[i].y + 8); cmd(t, s); - s = sys->sprint(".c itemconfigure %s -text '%s", a[i].tagsz, string a[i].size); + s = sys->sprint(".c itemconfigure %s -text '%s", a[i].tagsz, sizestr(a[i].size)); cmd(t, s); - s = sys->sprint(".c itemconfigure %s -text '%d", a[i].tagiu, a[i].allocs-a[i].frees); + s = sys->sprint(".c itemconfigure %s -text '%s", a[i].tagiu, sizestr(a[i].allocs-a[i].frees)); cmd(t, s); } cmd(t, "update"); @@ -163,7 +163,7 @@ initdraw(n: int): int sizestr(n: int): string { - if ((n / 1024) % 1024 == 0) + if ((n / 1024) % 1024 == 0 || n > (100 * 1024 * 1024)) return string (n / (1024 * 1024)) + "M"; return string (n / 1024) + "K"; } From 88c1166f7634acfdadc735025e2df374fd25e04e Mon Sep 17 00:00:00 2001 From: Pete Date: Thu, 2 Nov 2023 10:51:27 -0700 Subject: [PATCH 2/9] Add a few newer file types to httpd.suff. In particular, not serving .css as text/css was confusing to some browsers. squash --- appl/svc/httpd/httpd.suff | 3 +++ services/httpd/httpd.suff | 3 +++ 2 files changed, 6 insertions(+) diff --git a/appl/svc/httpd/httpd.suff b/appl/svc/httpd/httpd.suff index dbc599d2..110e4726 100644 --- a/appl/svc/httpd/httpd.suff +++ b/appl/svc/httpd/httpd.suff @@ -15,6 +15,7 @@ .bcpio application x-bcpio - # [Mosaic] .bib text plain - # BibTex input .c text plain - # C program +.css text css - # CSS .c++ text plain - # C++ program .cc text plain - # [Mosaic] .cdf application x-netcdf - @@ -76,6 +77,7 @@ .rfr text plain - # refer .rgb image x-rgb - # [Mosaic] .roff application x-troff - # [Mosaic] +.rss application rss+xml - # RSS feeds .rtf application rtf - # [Mosaic] .rtx text richtext - # MIME richtext [Mosaic] .sh application x-shar - @@ -83,6 +85,7 @@ .snd audio basic - .sv4cpio application x-sv4cpio - # [Mosaic] .sv4crc application x-sv4crc - # [Mosaic] +.svg image svg+xml - # SVG images .t application x-troff - # [Mosaic] .tar application x-tar - # [Mosaic] .taz application x-tar x-compress diff --git a/services/httpd/httpd.suff b/services/httpd/httpd.suff index dbc599d2..110e4726 100644 --- a/services/httpd/httpd.suff +++ b/services/httpd/httpd.suff @@ -15,6 +15,7 @@ .bcpio application x-bcpio - # [Mosaic] .bib text plain - # BibTex input .c text plain - # C program +.css text css - # CSS .c++ text plain - # C++ program .cc text plain - # [Mosaic] .cdf application x-netcdf - @@ -76,6 +77,7 @@ .rfr text plain - # refer .rgb image x-rgb - # [Mosaic] .roff application x-troff - # [Mosaic] +.rss application rss+xml - # RSS feeds .rtf application rtf - # [Mosaic] .rtx text richtext - # MIME richtext [Mosaic] .sh application x-shar - @@ -83,6 +85,7 @@ .snd audio basic - .sv4cpio application x-sv4cpio - # [Mosaic] .sv4crc application x-sv4crc - # [Mosaic] +.svg image svg+xml - # SVG images .t application x-troff - # [Mosaic] .tar application x-tar - # [Mosaic] .taz application x-tar x-compress From 46b21f56c443752954208d8b75b1a6f0154cd86a Mon Sep 17 00:00:00 2001 From: Pete Date: Thu, 2 Nov 2023 10:50:35 -0700 Subject: [PATCH 3/9] Fix a bug in directory listings in httpd. --- appl/svc/httpd/httpd.b | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/appl/svc/httpd/httpd.b b/appl/svc/httpd/httpd.b index db570a74..d2f5f5e5 100644 --- a/appl/svc/httpd/httpd.b +++ b/appl/svc/httpd/httpd.b @@ -506,8 +506,10 @@ senddir(g: ref Private_info,vers,uri: string, fd: ref FD, mydir: ref Dir) g.bout.puts("\n"); for(i := 0; i < n; i++){ (typ, enc) := classify(a[i]); - g.bout.puts(sys->sprint("", - myname, a[i].name, a[i].name)); + #g.bout.puts(sys->sprint("", + # myname, a[i].name, a[i].name)); + g.bout.puts(sys->sprint("", + a[i].name, a[i].name)); if(typ != nil){ if(typ.generic!=nil) g.bout.puts(sys->sprint("
%s
%s
%s%s", typ.generic)); From 483e583533c6b66ed0117a6ca16b9426f5af1b70 Mon Sep 17 00:00:00 2001 From: Pete Date: Tue, 16 Apr 2024 18:40:48 -0700 Subject: [PATCH 4/9] Remove the commented-out buggy lines. --- appl/svc/httpd/httpd.b | 2 -- 1 file changed, 2 deletions(-) diff --git a/appl/svc/httpd/httpd.b b/appl/svc/httpd/httpd.b index d2f5f5e5..20d48f10 100644 --- a/appl/svc/httpd/httpd.b +++ b/appl/svc/httpd/httpd.b @@ -506,8 +506,6 @@ senddir(g: ref Private_info,vers,uri: string, fd: ref FD, mydir: ref Dir) g.bout.puts("\n"); for(i := 0; i < n; i++){ (typ, enc) := classify(a[i]); - #g.bout.puts(sys->sprint("", - # myname, a[i].name, a[i].name)); g.bout.puts(sys->sprint("", a[i].name, a[i].name)); if(typ != nil){ From a70e38715ba2780f681610d16cfd77968b68204c Mon Sep 17 00:00:00 2001 From: Pete Date: Thu, 2 Nov 2023 10:50:01 -0700 Subject: [PATCH 5/9] Add Roman miles (romanmile) to /lib/units. --- lib/units | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/units b/lib/units index 106fc0f9..4195db90 100644 --- a/lib/units +++ b/lib/units @@ -595,3 +595,4 @@ weymass 252 lb Xunit 1.00202e-13 m k 1.38047e-16 erg/°K foal 9223372036854775807 +romanmile 1620 yard From d009da489695985c33857ae93f53fd4c7ed3a4e8 Mon Sep 17 00:00:00 2001 From: Pete Date: Thu, 2 Nov 2023 10:47:39 -0700 Subject: [PATCH 6/9] Fix a crash in libdraw; I think this came from qrstuv. --- libdraw/font.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libdraw/font.c b/libdraw/font.c index f51804d2..849bb289 100644 --- a/libdraw/font.c +++ b/libdraw/font.c @@ -355,6 +355,8 @@ fontresize(Font *f, int wid, int ncache, int depth) d = f->display; if(depth <= 0) depth = 1; + if(wid == 0) + wid = 1; new = allocimage(d, Rect(0, 0, ncache*wid, f->height), CHAN1(CGrey, depth), 0, 0); if(new == nil){ From 1a52b16d6bcacccb04d55cf57f963806c9ac8861 Mon Sep 17 00:00:00 2001 From: Pete Date: Thu, 2 Nov 2023 10:35:33 -0700 Subject: [PATCH 7/9] A patch from ipn.caerwyn.net to use RGB24 by default for image display. Gets rid of all the dithering. --- appl/wm/view.b | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/appl/wm/view.b b/appl/wm/view.b index c96ef87d..8e847e55 100644 --- a/appl/wm/view.b +++ b/appl/wm/view.b @@ -178,13 +178,42 @@ readimages(file: string, errdiff: int) : (array of ref Image, array of ref Image # if transparency is enabled, errdiff==1 is probably a mistake, # but there's no easy solution. - (ims[i], err2) = imageremap->remap(ai[i], display, errdiff); + (ims[i], err2) = remap(ai[i], display, errdiff); if(ims[i] == nil) return(nil, nil, err2); } return (ims, masks, nil); } +remap(raw: ref RImagefile->Rawimage, display: ref Draw->Display, errdiff: int): (ref Draw->Image, string) +{ + case raw.chandesc { + RImagefile->CRGB => + r := chanstopix(raw.chans, raw.r.dx(), raw.r.dy()); + im := display.newimage(raw.r, Draw->RGB24, 0, Draw->White); + im.writepixels(im.r, r); + return (im, ""); + * => + return imageremap->remap(raw, display, errdiff); + } +} + +chanstopix(chans : array of array of byte, width, height: int): array of byte +{ + r := chans[0]; + g := chans[1]; + b := chans[2]; + + rgb := array [3*len r] of byte; + bix := 0; + for (i := 0; i < len r ; i++) { + rgb[bix++] = b[i]; + rgb[bix++] = g[i]; + rgb[bix++] = r[i]; + } + return rgb; +} + viewcfg := array[] of { "panel .p", "menu .m", @@ -212,7 +241,7 @@ timer(dt: int, ticks, pidc: chan of int) view(ctxt: ref Context, ims, masks: array of ref Image, file: string) { file = lastcomponent(file); - (t, titlechan) := tkclient->toplevel(ctxt, "", "view: "+file, Tkclient->Hide); + (t, titlechan) := tkclient->toplevel(ctxt, "", "view: "+file, Tkclient->Appl); cmd := chan of string; tk->namechan(t, cmd, "cmd"); From b4c47959cc65867cea813d3853feddddf58f2421 Mon Sep 17 00:00:00 2001 From: Pete Date: Thu, 2 Nov 2023 10:33:09 -0700 Subject: [PATCH 8/9] Assume UTF-8 from the X11 clipboard. This stops a lot of error spew from libxwhichever: almost everything's UTF-8, Plan 9 won. --- emu/port/win-x11a.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/emu/port/win-x11a.c b/emu/port/win-x11a.c index bbc65761..0fc38450 100644 --- a/emu/port/win-x11a.c +++ b/emu/port/win-x11a.c @@ -969,7 +969,7 @@ xinitscreen(int xsize, int ysize, ulong reqchan, ulong *chan, int *d) } clipboard = XInternAtom(xmcon, "CLIPBOARD", False); - utf8string = XInternAtom(xmcon, "UTF8_STRING", False); + utf8string = XInternAtom(xmcon, "UTF8_STRING", True); targets = XInternAtom(xmcon, "TARGETS", False); text = XInternAtom(xmcon, "TEXT", False); compoundtext = XInternAtom(xmcon, "COMPOUND_TEXT", False); @@ -1523,7 +1523,7 @@ _xgetsnarf(XDisplay *xd) */ prop = 1; XChangeProperty(xd, xdrawable, prop, XA_STRING, 8, PropModeReplace, (uchar*)"", 0); - XConvertSelection(xd, clipboard, XA_STRING, prop, xdrawable, CurrentTime); + XConvertSelection(xd, clipboard, utf8string, prop, xdrawable, CurrentTime); XFlush(xd); lastlen = 0; for(i=0; i<10 || (lastlen!=0 && i<30); i++){ From 1bf9388ccb3bd33b5825ee20ec6824b17508f045 Mon Sep 17 00:00:00 2001 From: Pete Date: Thu, 2 Nov 2023 10:30:53 -0700 Subject: [PATCH 9/9] Don't force JIT on charon. This keeps charon from failing to load img.b on systems where JIT is disabled. I suspect this is another holdover from when Inferno ran on systems that were tiny in the 90s. --- appl/charon/mkfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appl/charon/mkfile b/appl/charon/mkfile index 6345f815..05ac5cb6 100644 --- a/appl/charon/mkfile +++ b/appl/charon/mkfile @@ -86,7 +86,7 @@ $ROOT/dis/charon.dis: charon.dis charon.dis: $MODULES $SYS_MODULES img.dis: img.b $MODULE $SYS_MODULE - limbo $LIMBOFLAGS -c -gw img.b + limbo $LIMBOFLAGS -gw img.b nuke:V: rm -f $ROOT/dis/charon.dis
%s
%s