Browse Source

Plan 9 from Bell Labs 2007-06-16

David du Colombier 17 years ago
parent
commit
c5732af431

+ 7 - 7
dist/replica/_plan9.db

@@ -20,7 +20,7 @@
 386/bin/9660srv - 775 sys sys 1168402261 104975
 386/bin/aan - 775 sys sys 1179548013 129834
 386/bin/acid - 775 sys sys 1181507261 405141
-386/bin/acme - 775 sys sys 1181507262 430979
+386/bin/acme - 775 sys sys 1181937404 431025
 386/bin/ape - 20000000775 sys sys 1016944144 0
 386/bin/ape/basename - 775 sys sys 1173754547 134719
 386/bin/ape/cc - 775 sys sys 1168402263 70642
@@ -335,7 +335,7 @@
 386/bin/mkdir - 775 sys sys 1168402334 61205
 386/bin/mkpaqfs - 775 sys sys 1178568292 93268
 386/bin/mntgen - 775 sys sys 1179372098 144046
-386/bin/mount - 775 sys sys 1179372098 73326
+386/bin/mount - 775 sys sys 1181877817 73380
 386/bin/ms2html - 775 sys sys 1178568293 102703
 386/bin/mtime - 775 sys sys 1168402336 59376
 386/bin/mug - 775 sys sys 1179372099 176427
@@ -7327,7 +7327,7 @@ sys/man/1/2l - 664 sys sys 1158281887 4376
 sys/man/1/INDEX - 664 sys sys 1178249214 3131
 sys/man/1/INDEX.html - 664 sys sys 1141352366 16517
 sys/man/1/acid - 664 sys sys 1134233059 9730
-sys/man/1/acme - 664 sys sys 1169932614 18550
+sys/man/1/acme - 664 sys sys 1181880498 18540
 sys/man/1/ap - 664 sys sys 1068471657 364
 sys/man/1/ar - 664 sys sys 1079397701 3153
 sys/man/1/ascii - 664 sys sys 1145881662 2726
@@ -9413,7 +9413,7 @@ sys/src/cmd/acme/ecmd.c - 664 sys sys 1111606460 24205
 sys/src/cmd/acme/edit.c - 664 sys sys 1124993578 12019
 sys/src/cmd/acme/edit.h - 664 sys sys 1124993577 2369
 sys/src/cmd/acme/elog.c - 664 sys sys 1111607796 7294
-sys/src/cmd/acme/exec.c - 664 sys sys 1136064450 28267
+sys/src/cmd/acme/exec.c - 664 sys sys 1181880498 28938
 sys/src/cmd/acme/file.c - 664 sys sys 1044626079 5717
 sys/src/cmd/acme/fns.h - 664 sys sys 1107154481 2916
 sys/src/cmd/acme/fsys.c - 664 sys sys 1111171699 13097
@@ -12876,10 +12876,10 @@ sys/src/cmd/pic/boxgen.c - 664 sys sys 944961042 2309
 sys/src/cmd/pic/circgen.c - 664 sys sys 944961042 2678
 sys/src/cmd/pic/for.c - 664 sys sys 944961042 1949
 sys/src/cmd/pic/input.c - 664 sys sys 1136651708 11556
-sys/src/cmd/pic/linegen.c - 664 sys sys 944961042 5392
+sys/src/cmd/pic/linegen.c - 664 sys sys 1181939996 5634
 sys/src/cmd/pic/main.c - 664 sys sys 944961042 6705
 sys/src/cmd/pic/makefile - 664 sys sys 944961042 964
-sys/src/cmd/pic/misc.c - 664 sys sys 985322747 8957
+sys/src/cmd/pic/misc.c - 664 sys sys 1181939986 9002
 sys/src/cmd/pic/mkfile - 664 sys sys 944961042 490
 sys/src/cmd/pic/movegen.c - 664 sys sys 944961042 1566
 sys/src/cmd/pic/pic.h - 664 sys sys 944961042 5568
@@ -15844,4 +15844,4 @@ usr/glenda/lib/profile - 664 glenda glenda 1105128663 890
 usr/glenda/readme.acme - 664 glenda glenda 1019860628 4753
 usr/glenda/readme.rio - 664 glenda glenda 1019860628 6370
 usr/glenda/tmp - 20000000775 glenda glenda 1018802620 0
-386/bin/mount - 775 sys sys 1181877817 73380
+386/bin/pic - 775 sys sys 1181964075 308633

+ 6 - 6
dist/replica/plan9.db

@@ -20,7 +20,7 @@
 386/bin/9660srv - 775 sys sys 1168402261 104975
 386/bin/aan - 775 sys sys 1179548013 129834
 386/bin/acid - 775 sys sys 1181507261 405141
-386/bin/acme - 775 sys sys 1181507262 430979
+386/bin/acme - 775 sys sys 1181937404 431025
 386/bin/ape - 20000000775 sys sys 1016944144 0
 386/bin/ape/basename - 775 sys sys 1173754547 134719
 386/bin/ape/cc - 775 sys sys 1168402263 70642
@@ -365,7 +365,7 @@
 386/bin/passwd - 775 sys sys 1168402344 84333
 386/bin/pbd - 775 sys sys 1085077087 4661
 386/bin/pcc - 775 sys sys 1168402344 68241
-386/bin/pic - 775 sys sys 1176520490 307917
+386/bin/pic - 775 sys sys 1181964075 308633
 386/bin/pipefile - 775 sys sys 1148500683 39431
 386/bin/plot - 775 sys sys 1179372101 222763
 386/bin/plumb - 775 sys sys 1176520491 69487
@@ -7327,7 +7327,7 @@ sys/man/1/2l - 664 sys sys 1158281887 4376
 sys/man/1/INDEX - 664 sys sys 1178249214 3131
 sys/man/1/INDEX.html - 664 sys sys 1141352366 16517
 sys/man/1/acid - 664 sys sys 1134233059 9730
-sys/man/1/acme - 664 sys sys 1169932614 18550
+sys/man/1/acme - 664 sys sys 1181880498 18540
 sys/man/1/ap - 664 sys sys 1068471657 364
 sys/man/1/ar - 664 sys sys 1079397701 3153
 sys/man/1/ascii - 664 sys sys 1145881662 2726
@@ -9413,7 +9413,7 @@ sys/src/cmd/acme/ecmd.c - 664 sys sys 1111606460 24205
 sys/src/cmd/acme/edit.c - 664 sys sys 1124993578 12019
 sys/src/cmd/acme/edit.h - 664 sys sys 1124993577 2369
 sys/src/cmd/acme/elog.c - 664 sys sys 1111607796 7294
-sys/src/cmd/acme/exec.c - 664 sys sys 1136064450 28267
+sys/src/cmd/acme/exec.c - 664 sys sys 1181880498 28938
 sys/src/cmd/acme/file.c - 664 sys sys 1044626079 5717
 sys/src/cmd/acme/fns.h - 664 sys sys 1107154481 2916
 sys/src/cmd/acme/fsys.c - 664 sys sys 1111171699 13097
@@ -12876,10 +12876,10 @@ sys/src/cmd/pic/boxgen.c - 664 sys sys 944961042 2309
 sys/src/cmd/pic/circgen.c - 664 sys sys 944961042 2678
 sys/src/cmd/pic/for.c - 664 sys sys 944961042 1949
 sys/src/cmd/pic/input.c - 664 sys sys 1136651708 11556
-sys/src/cmd/pic/linegen.c - 664 sys sys 944961042 5392
+sys/src/cmd/pic/linegen.c - 664 sys sys 1181939996 5634
 sys/src/cmd/pic/main.c - 664 sys sys 944961042 6705
 sys/src/cmd/pic/makefile - 664 sys sys 944961042 964
-sys/src/cmd/pic/misc.c - 664 sys sys 985322747 8957
+sys/src/cmd/pic/misc.c - 664 sys sys 1181939986 9002
 sys/src/cmd/pic/mkfile - 664 sys sys 944961042 490
 sys/src/cmd/pic/movegen.c - 664 sys sys 944961042 1566
 sys/src/cmd/pic/pic.h - 664 sys sys 944961042 5568

+ 6 - 0
dist/replica/plan9.log

@@ -49257,3 +49257,9 @@
 1181851223 0 c 386/bin/aux/listen - 775 sys sys 1181851031 107720
 1181851223 1 c 386/bin/fossil/fossil - 775 sys sys 1181851033 363780
 1181878222 0 c 386/bin/mount - 775 sys sys 1181877817 73380
+1181881823 0 c sys/man/1/acme - 664 sys sys 1181880498 18540
+1181881823 1 c sys/src/cmd/acme/exec.c - 664 sys sys 1181880498 28938
+1181937623 0 c 386/bin/acme - 775 sys sys 1181937404 431025
+1181941223 0 c sys/src/cmd/pic/linegen.c - 664 sys sys 1181939996 5634
+1181941223 1 c sys/src/cmd/pic/misc.c - 664 sys sys 1181939986 9002
+1181964623 0 c 386/bin/pic - 775 sys sys 1181964075 308633

+ 1 - 1
sys/man/1/acme

@@ -366,7 +366,7 @@ set the mode for the current window;
 .B ON
 and
 .B OFF
-set the mode for the current window and all future windows.
+set the mode for all existing and future windows.
 .TP
 .B Kill
 Send a

+ 37 - 16
sys/src/cmd/acme/exec.c

@@ -13,6 +13,22 @@
 
 Buffer	snarfbuf;
 
+/*
+ * These functions get called as:
+ *
+ *	fn(et, t, argt, flag1, flag1, flag2, s, n);
+ *
+ * Where the arguments are:
+ *
+ *	et: the Text* in which the executing event (click) occurred
+ *	t: the Text* containing the current selection (Edit, Cut, Snarf, Paste)
+ *	argt: the Text* containing the argument for a 2-1 click.
+ *	e->flag1: from Exectab entry
+ * 	e->flag2: from Exectab entry
+ *	s: the command line remainder (e.g., "x" if executing "Dump x")
+ *	n: length of s  (s is *not* NUL-terminated)
+ */
+
 void	del(Text*, Text*, Text*, int, int, Rune*, int);
 void	delcol(Text*, Text*, Text*, int, int, Rune*, int);
 void	dump(Text*, Text*, Text*, int, int, Rune*, int);
@@ -660,19 +676,25 @@ cut(Text *et, Text *t, Text*, int dosnarf, int docut, Rune*, int)
 	uint q0, q1, n, locked, c;
 	Rune *r;
 
-	/* use current window if snarfing and its selection is non-null */
-	if(et!=nil && dosnarf && et->w!=nil && t==nil){
+	/*
+	 * if not executing a mouse chord (et != t) and snarfing (dosnarf)
+	 * and executed Cut or Snarf in window tag (et->w != nil),
+	 * then use the window body selection or the tag selection
+	 * or do nothing at all.
+	 */
+	if(et!=t && dosnarf && et->w!=nil){
 		if(et->w->body.q1>et->w->body.q0){
 			t = &et->w->body;
 			if(docut)
 				filemark(t->file);	/* seq has been incremented by execute */
 		}else if(et->w->tag.q1>et->w->tag.q0)
 			t = &et->w->tag;
+		else
+			t = nil;
 	}
-	if(t == nil){
-		/* can only happen if seltext == nil */
+	if(t == nil)	/* no selection */
 		return;
-	}
+
 	locked = FALSE;
 	if(t->w!=nil && et->w!=t->w){
 		locked = TRUE;
@@ -1047,6 +1069,12 @@ indentval(Rune *s, int n)
 	return runestrncmp(s, L"on", n) == 0;
 }
 
+static void
+fixindent(Window *w, void*)
+{
+	w->autoindent = globalautoindent;
+}
+
 void
 indent(Text *et, Text*, Text *argt, int, int, Rune *arg, int narg)
 {
@@ -1066,17 +1094,10 @@ indent(Text *et, Text*, Text *argt, int, int, Rune *arg, int narg)
 		if(a != arg)
 			autoindent = indentval(arg, narg-na);
 	}
-	if(w != nil){
-		switch(autoindent){
-		case Ion:
-		case Ioff:
-			w->autoindent = autoindent;
-			break;
-		case IGlobal:
-			w->autoindent = globalautoindent;
-			break;
-		}
-	}
+	if(autoindent == IGlobal)
+		allwindows(fixindent, nil);
+	else if(w != nil && autoindent >= 0)
+		w->autoindent = autoindent;
 }
 
 void

+ 8 - 0
sys/src/cmd/pic/linegen.c

@@ -1,4 +1,6 @@
 #include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
 #include <math.h>
 #include "pic.h"
 #include "y.tab.h"
@@ -93,6 +95,8 @@ obj *linegen(int type)
 				dx[ndxy] = dy[ndxy] = some = 0;
 			}
 			ppos = attr[i].a_val.o;
+			if (ppos == NULL)
+				ERROR "no tag defined for `to'" FATAL;
 			dx[ndxy] = ppos->o_x - nx;
 			dy[ndxy] = ppos->o_y - ny;
 			some++;
@@ -105,6 +109,8 @@ obj *linegen(int type)
 				dx[ndxy] = dy[ndxy] = some = 0;
 			}
 			ppos = ap->a_val.o;
+			if (ppos == NULL)
+				ERROR "no tag defined for `by'" FATAL;
 			dx[ndxy] = ppos->o_x;
 			dy[ndxy] = ppos->o_y;
 			some++;
@@ -120,6 +126,8 @@ obj *linegen(int type)
 		case FROM:
 		case AT:
 			ppos = ap->a_val.o;
+			if (ppos == NULL)
+				ERROR "no tag defined for `from' or `at'" FATAL;
 			nx = curx = ppos->o_x;
 			ny = cury = ppos->o_y;
 			break;

+ 2 - 0
sys/src/cmd/pic/misc.c

@@ -207,6 +207,8 @@ int whatpos(obj *p, int corner, double *px, double *py)	/* what is the position
 {
 	double x, y, x1, y1;
 
+	if (p == NULL)
+		ERROR "null object" FATAL;
 	dprintf("whatpos %o %d %d\n", p, p->o_type, corner);
 	x = p->o_x;
 	y = p->o_y;