OK, turing.

<- leave blank

Thu Feb 27 14:26:59 EST 2020

diff -r 06ecc74a64fb sys/src/libregexp/regexec.c
--- a/sys/src/libregexp/regexec.c Sun Feb 23 20:33:27 2020 +0000
+++ b/sys/src/libregexp/regexec.c Thu Feb 27 14:26:58 2020 -0500
@@ -10,14 +10,15 @@
 };

 int
-regexec(Reprog *p, char *str, Resub *sem, int msize)
+regexecfn(Reprog *p, char *str, int (*more)(void*, char*, int), void *ctx, Resub
*sem, int msize)
 {
	RethreadQ lists[2], *clist, *nlist, *tmp;
	Rethread *t, *next, *pool, *avail;
	Reinst *ci;
	Rune r;
- char *sp, *ep, endc;
- int i, matchgen, gen;
+ char *sp, *ep, *buf, endc;
+ int i, matchgen, gen, n;
+ vlong o;

	memset(p->threads, 0, sizeof(Rethread)*p->nthr);
	if(msize > NSUBEXPM)
@@ -39,9 +40,11 @@
	gen = matchgen = 0;

	sp = str;
+ buf = nil;
	ep = nil;
	endc = '\0';
- if(sem != nil && msize > 0) {
+ o = 0;
+ if(more == nil && sem != nil && msize > 0) {
		if(sem->sp != nil)
			sp = sem->sp;
		if(sem->ep != nil && *sem->ep != '\0') {
@@ -50,9 +53,28 @@
			*sem->ep = '\0';
		}
	}
+ if(more != nil){
+ if((buf = malloc(BUFSZ + 1)) == nil)
+ regerror("out of memory");
+ buf[0] = 0;
+ sp = buf;
+ if(sem != nil && msize > 0){
+ sem->so = 0;
+ sem->eo = 0;
+ }
+ }

- for(r = L'☺'; r != L'\0'; sp += i) {
+ for(r = L'☺'; r != L'\0'; sp += i, o += i) {
+Gotmore:
		i = chartorune(&r, sp);
+ if(r == 0 && more != nil){
+ n = more(ctx, buf, BUFSZ);
+ if(n > 0){
+ sp = buf;
+ sp[n] = 0;
+ goto Gotmore;
+ }
+ }
		gen++;
		if(matchgen == 0) {
			if(avail == nil) {
@@ -110,7 +132,7 @@
			}
			goto Done;
		case OBOL:
- if(sp == str || sp[-1] == '\n') {
+ if(o == 0 || sp[-1] == '\n') {
				ci++;
				goto Again;
			}
@@ -141,8 +163,12 @@
			ci = ci->a;
			goto Again;
		case OSAVE:
- if(ci->sub < msize)
- t->sem[ci->sub].sp = sp;
+ if(ci->sub < msize){
+ if(more != nil)
+ t->sem[ci->sub].so = o;
+ else
+ t->sem[ci->sub].sp = sp;
+ }
			ci++;
			goto Again;
		case OUNSAVE:
@@ -150,12 +176,19 @@
				matchgen = t->gen;
				if(sem != nil && msize > 0) {
					memcpy(sem, t->sem,
					sizeof(Resub)*msize);
- sem->ep = sp;
+ if(more != nil)
+ sem->eo = o;
+ else
+ sem->ep = sp;
				}
				goto Done;
			}
- if(ci->sub < msize)
- t->sem[ci->sub].ep = sp;
+ if(ci->sub < msize){
+ if(more != nil)
+ t->sem[ci->sub].eo = o;
+ else
+ t->sem[ci->sub].ep = sp;
+ }
			ci++;
			goto Again;
		Done:
@@ -182,5 +215,19 @@
	}
	if(ep != nil)
		*ep = endc;
+ if(more != nil)
+ free(buf);
	return matchgen > 0 ? 1 : 0;
 }
+
+int
+regexec(Reprog *p, char *str, Resub *sem, int msize)
+{
+ return regexecfn(p, str, nil, nil, sem, msize);
+}
+
+int
+regexecrd(Reprog *p, int (*more)(void*, char*, int), void *ctx, Resub *sem, int
msize)
+{
+ return regexecfn(p, nil, more, ctx, sem, msize);
+}
diff -r 06ecc74a64fb sys/src/libregexp/regimpl.h
--- a/sys/src/libregexp/regimpl.h Sun Feb 23 20:33:27 2020 +0000
+++ b/sys/src/libregexp/regimpl.h Thu Feb 27 14:26:58 2020 -0500
@@ -24,6 +24,7 @@
	TSUB,

	NSUBEXPM = 32,
+ BUFSZ = 4096,
 };

 typedef struct Parselex Parselex;


Thu Feb 27 11:42:43 EST 2020
$ sudo psi2log -m 2
Starting psi2log
target: SYSTEM_WIDE
interval: 2 sec
mode: 2
============================================
 cpu | memory | io |
----- | ----------- | ----------- |
 some | some full | some full | interval
----- | ----- ----- | ----- ----- | --------
  0.2 | 0.0 0.0 | 0.0 0.0 | 2.008
  1.1 | 0.0 0.0 | 0.7 0.7 | 2.064
  0.5 | 0.0 0.0 | 0.1 0.1 | 2.003
 10.7 | 0.0 0.0 | 0.0 0.0 | 2.001
 10.3 | 0.0 0.0 | 0.0 0.0 | 2.002
 10.8 | 0.0 0.0 | 0.0 0.0 | 2.005
  8.4 | 0.0 0.0 | 1.0 1.0 | 2.002
  6.3 | 0.0 0.0 | 0.0 0.0 | 2.065
  3.0 | 0.0 0.0 | 0.2 0.2 | 2.002
  6.0 | 0.0 0.0 | 0.0 0.0 | 2.06
  0.2 | 0.0 0.0 | 0.0 0.0 | 2.003
  0.5 | 0.0 0.0 | 0.0 0.0 | 2.005
  0.4 | 0.0 0.0 | 0.2 0.2 | 2.002
  0.3 | 0.0 0.0 | 0.0 0.0 | 2.007
  0.6 | 0.0 0.0 | 0.0 0.0 | 2.003
  0.6 | 0.0 0.0 | 0.0 0.0 | 2.006
  0.7 | 0.0 0.0 | 1.5 1.4 | 2.002
...
  0.2 | 0.0 0.0 | 20.7 20.6 | 2.007
  0.2 | 0.9 0.9 | 2.1 2.1 | 2.011
  1.1 | 3.3 3.2 | 3.8 3.7 | 2.005
  1.1 | 17.3 16.8 | 50.0 49.2 | 2.006
  1.1 | 2.2 2.1 | 58.7 58.2 | 2.002
  1.0 | 10.1 9.9 | 59.9 59.3 | 2.003
  0.8 | 17.9 17.6 | 61.0 60.4 | 2.001
  0.7 | 27.8 27.3 | 56.6 56.1 | 2.006
  0.9 | 72.1 69.8 | 92.8 90.0 | 2.002
  3.1 | 48.7 41.7 | 84.2 74.6 | 2.007
  1.2 | 34.8 33.3 | 75.6 73.0 | 2.009
  1.4 | 35.0 33.4 | 86.6 81.7 | 2.006
  5.8 | 36.4 30.7 | 78.9 68.0 | 2.003
 11.8 | 59.5 42.0 | 90.0 64.9 | 2.007
  0.6 | 29.1 28.6 | 72.2 70.5 | 2.003
  0.7 | 34.3 32.3 | 82.2 79.0 | 2.007
  2.2 | 26.3 22.2 | 60.7 55.0 | 2.006
  1.1 | 38.6 34.8 | 75.7 70.4 | 2.003
  1.2 | 15.2 14.2 | 78.8 77.1 | 2.002
  3.1 | 36.9 33.9 | 63.7 59.0 | 2.003
  0.9 | 0.9 0.9 | 1.4 1.3 | 2.009
  0.1 | 0.0 0.0 | 0.0 0.0 | 2.007
  2.1 | 13.7 12.5 | 39.3 37.6 | 2.002
  5.2 | 30.8 19.8 | 99.8 76.8 | 2.002
  2.4 | 14.1 11.3 | 76.5 67.4 | 2.007
  1.0 | 43.2 41.2 | 97.3 94.1 | 2.004
  0.6 | 43.3 42.1 | 86.3 82.7 | 2.002
  1.6 | 14.3 12.7 | 89.7 82.7 | 2.003
  4.6 | 16.1 5.3 | 36.2 20.5 | 2.003
  2.4 | 2.6 2.0 | 6.4 5.2 | 2.001


https://imgur.com/a/MlcHFmQ


Thu Feb 27 10:38:49 EST 2020
Мебельный щит из сосны, бука, дуба, ясеня http://mebelny-shit.ru/ от
производителя!  Современное оборудование, объемы производства до 200 м3 готовой
продукции в месяц.  Так же производим тетивы, подступенки, разворотные площадки,
поручень, балясины.  Организуем доставку в любой регион России, РБ, KZ

Thu Feb 27 09:38:37 EST 2020
Кризис?  Антикризис ему в бок!
https://cloud.mail.ru/public/4X9H/QEzAu45Mo

Thu Feb 27 02:29:45 EST 2020
diff -r 22109b5daced sys/src/cmd/cc/cc.h
--- a/sys/src/cmd/cc/cc.h Wed Feb 26 21:45:00 2020 -0800
+++ b/sys/src/cmd/cc/cc.h Wed Feb 26 23:29:43 2020 -0800
@@ -691,6 +691,7 @@
 void typeext(Type*, Node*);
 void typeext1(Type*, Node*);
 int side(Node*);
+int zpconst(Node*);
 int vconst(Node*);
 int log2(uvlong);
 int vlog(Node*);
diff -r 22109b5daced sys/src/cmd/cc/com.c
--- a/sys/src/cmd/cc/com.c Wed Feb 26 21:45:00 2020 -0800
+++ b/sys/src/cmd/cc/com.c Wed Feb 26 23:29:43 2020 -0800
@@ -341,11 +341,13 @@
		o |= tcom(r->left);
		if(o | tcom(r->right))
			goto bad;
- if(r->right->type->etype == TIND && vconst(r->left) == 0) {
+ if(r->right->type->etype == TIND && zpconst(r->left)) {
+ r->type = r->right->type;
			r->left->type = r->right->type;
			r->left->vconst = 0;
		}
- if(r->left->type->etype == TIND && vconst(r->right) == 0) {
+ if(r->left->type->etype == TIND && zpconst(r->right)) {
+ r->type = r->left->type;
			r->right->type = r->left->type;
			r->right->vconst = 0;
		}
diff -r 22109b5daced sys/src/cmd/cc/sub.c
--- a/sys/src/cmd/cc/sub.c Wed Feb 26 21:45:00 2020 -0800
+++ b/sys/src/cmd/cc/sub.c Wed Feb 26 23:29:43 2020 -0800
@@ -1026,6 +1026,21 @@
 }

 int
+zpconst(Node *n)
+{
+ while(n->op == OCAST){
+ if(n->type == T)
+ break;
+ if(n->type->etype != TIND)
+ break;
+ if(n->type->link->etype != TVOID)
+ break;
+ n = n->left;
+ }
+ return vconst(n) == 0;
+}
+
+int
 vconst(Node *n)
 {
	int i;


Thu Feb 27 02:29:32 EST 2020
diff -r 22109b5daced sys/src/cmd/cc/cc.h
--- a/sys/src/cmd/cc/cc.h Wed Feb 26 21:45:00 2020 -0800
+++ b/sys/src/cmd/cc/cc.h Wed Feb 26 23:29:31 2020 -0800
@@ -691,6 +691,7 @@
 void typeext(Type*, Node*);
 void typeext1(Type*, Node*);
 int side(Node*);
+int zpconst(Node*);
 int vconst(Node*);
 int log2(uvlong);
 int vlog(Node*);
diff -r 22109b5daced sys/src/cmd/cc/com.c
--- a/sys/src/cmd/cc/com.c Wed Feb 26 21:45:00 2020 -0800
+++ b/sys/src/cmd/cc/com.c Wed Feb 26 23:29:31 2020 -0800
@@ -341,11 +341,13 @@
		o |= tcom(r->left);
		if(o | tcom(r->right))
			goto bad;
- if(r->right->type->etype == TIND && vconst(r->left) == 0) {
+ if(r->right->type->etype == TIND && zpconst(r->left)) {
+ r->type = r->right->type;
			r->left->type = r->right->type;
			r->left->vconst = 0;
		}
- if(r->left->type->etype == TIND && vconst(r->right) == 0) {
+ if(r->left->type->etype == TIND && zpconst(r->right)) {
+ r->type = r->left->type;
			r->right->type = r->left->type;
			r->right->vconst = 0;
		}
diff -r 22109b5daced sys/src/cmd/cc/sub.c
--- a/sys/src/cmd/cc/sub.c Wed Feb 26 21:45:00 2020 -0800
+++ b/sys/src/cmd/cc/sub.c Wed Feb 26 23:29:31 2020 -0800
@@ -1026,6 +1026,21 @@
 }

 int
+zpconst(Node *n)
+{
+ while(n->op == OCAST){
+ if(n->type == T)
+ break;
+ if(n->type->etype != TIND)
+ break;
+ if(n->type->link->etype != TVOID)
+ break;
+ n = n->left;
+ }
+ return vconst(n) == 0;
+}
+
+int
 vconst(Node *n)
 {
	int i;


Thu Feb 27 02:16:23 EST 2020
diff -r 22109b5daced sys/src/cmd/cc/com.c
--- a/sys/src/cmd/cc/com.c Wed Feb 26 21:45:00 2020 -0800
+++ b/sys/src/cmd/cc/com.c Wed Feb 26 23:16:23 2020 -0800
@@ -342,10 +342,12 @@
		if(o | tcom(r->right))
			goto bad;
		if(r->right->type->etype == TIND && vconst(r->left) ==
		0) {
+ r->type = r->right->type;
			r->left->type = r->right->type;
			r->left->vconst = 0;
		}
		if(r->left->type->etype == TIND && vconst(r->right) ==
		0) {
+ r->type = r->left->type;
			r->right->type = r->left->type;
			r->right->vconst = 0;
		}
diff -r 22109b5daced sys/src/cmd/cc/sub.c
--- a/sys/src/cmd/cc/sub.c Wed Feb 26 21:45:00 2020 -0800
+++ b/sys/src/cmd/cc/sub.c Wed Feb 26 23:16:23 2020 -0800
@@ -1032,6 +1032,13 @@

	if(n == Z)
		goto no;
+ while(n->op == OCAST){
+ if(n->type->etype != TIND)
+ break;
+ if(n->type->link->etype != TVOID)
+ break;
+ n = n->left;
+ }
	if(n->op != OCONST)
		goto no;
	if(n->type == T)


Wed Feb 26 01:30:33 EST 2020
Proposal for rethink of git branching: Patches.

A patch is a series of commits, like a branch.
Unlike a branch, it has a lifecycle.  A patch
is created, reviewed and modified, and then
landed.

To start work:

	git/begin my-change

This creates a new patch, which is represented
as a branch.

		  my-change
		    v
	o---o---o---o
		    ^
		   head

Then, edit your code, and commit as normal:


	git/commit

Which gives the following branch

			my-change
			   v
		       o---o
		     /
	o---o---o---o
		    ^
		   head

If you want to create a new patch, you can do
it off master, or you can do it off an existing
patch:

	git/begin other-change

And then write your code and commit it:


			my-change other-change
			   v v
			      o--------o
			    /
		       o---o
		     /
	o---o---o---o
		    ^
		   head

If you switch back to my-change, and commit,
then other-change gets automatically moved
so that it is based off of the my-change patch:

			my-change other-change
			   v v
				     o----o
				    /
		       o---o---o---o
		     /
	o---o---o---o
		    ^
		   head

When you want to send out my-change for reviewm,
you use something like git/submit:

	git/submit 9front@9front.org

Which sends an email.  Get your reviews, make some
more changes in response (if needed), and then
land it:

	git/land my-change

This will move your commits from my-change on to
master, delete the branch, and automatically rebase
other-change on top of it:

				     other-change
					  v
				     o----o
				    /
	o---o---o---o--o---o---o---o

		    ^
		   head


Tue Feb 25 18:31:51 EST 2020
src/pt2_diskop.c: In function 'findFirst':
src/pt2_diskop.c:166:29: error: 'struct dirent' has no member named 'd_type'; did
you mean 'd_name'?
  searchRec->isDir = (fData->d_type == DT_DIR) ? true : false;
			     ^~~~~~
			     d_name
src/pt2_diskop.c:166:39: error: 'DT_DIR' undeclared (first use in this function);
did you mean 'DIR'?
  searchRec->isDir = (fData->d_type == DT_DIR) ? true : false;
				       ^~~~~~
				       DIR
src/pt2_diskop.c:166:39: note: each undeclared identifier is reported only once
for each function it appears in
src/pt2_diskop.c:168:13: error: 'struct dirent' has no member named 'd_type'; did
you mean 'd_name'?
  if (fData->d_type == DT_UNKNOWN || fData->d_type == DT_LNK)
	     ^~~~~~
	     d_name
src/pt2_diskop.c:168:23: error: 'DT_UNKNOWN' undeclared (first use in this
function); did you mean 'SDLK_UNKNOWN'?
  if (fData->d_type == DT_UNKNOWN || fData->d_type == DT_LNK)
		       ^~~~~~~~~~
		       SDLK_UNKNOWN
src/pt2_diskop.c:168:44: error: 'struct dirent' has no member named 'd_type'; did
you mean 'd_name'?
  if (fData->d_type == DT_UNKNOWN || fData->d_type == DT_LNK)
					    ^~~~~~
					    d_name
src/pt2_diskop.c:168:54: error: 'DT_LNK' undeclared (first use in this function);
did you mean 'M_LN2'?
  if (fData->d_type == DT_UNKNOWN || fData->d_type == DT_LNK)
						      ^~~~~~
						      M_LN2
src/pt2_diskop.c: In function 'findNext':
src/pt2_diskop.c:243:29: error: 'struct dirent' has no member named 'd_type'; did
you mean 'd_name'?
  searchRec->isDir = (fData->d_type == DT_DIR) ? true : false;
			     ^~~~~~
			     d_name
src/pt2_diskop.c:243:39: error: 'DT_DIR' undeclared (first use in this function);
did you mean 'DIR'?
  searchRec->isDir = (fData->d_type == DT_DIR) ? true : false;
				       ^~~~~~
				       DIR
src/pt2_diskop.c:245:13: error: 'struct dirent' has no member named 'd_type'; did
you mean 'd_name'?
  if (fData->d_type == DT_UNKNOWN || fData->d_type == DT_LNK)
	     ^~~~~~
	     d_name
src/pt2_diskop.c:245:23: error: 'DT_UNKNOWN' undeclared (first use in this
function); did you mean 'SDLK_UNKNOWN'?
  if (fData->d_type == DT_UNKNOWN || fData->d_type == DT_LNK)
		       ^~~~~~~~~~
		       SDLK_UNKNOWN
src/pt2_diskop.c:245:44: error: 'struct dirent' has no member named 'd_type'; did
you mean 'd_name'?
  if (fData->d_type == DT_UNKNOWN || fData->d_type == DT_LNK)
					    ^~~~~~
					    d_name
src/pt2_diskop.c:245:54: error: 'DT_LNK' undeclared (first use in this function);
did you mean 'M_LN2'?
  if (fData->d_type == DT_UNKNOWN || fData->d_type == DT_LNK)
						      ^~~~~~
						      M_LN2

Tue Feb 25 18:31:12 EST 2020
 error: 'struct dirent' has no member named 'd_type'; did you mean 'd_name'?
  searchRec->isDir = (fData->d_type == DT_DIR) ? true : false;
			     ^~~~~~
			     d_name

Sun Feb 23 19:16:07 EST 2020
#!/bin/rc -e
# Usage: $0 <paths> -- <cmd>

paths=()
while(!  ~ $#* 0 && ! ~ $1 --) {
	paths=($paths $1)
	shift
}
shift
cmd=$*

if(~ $#paths 0 || ~ $#cmd 0) {
	echo Usage: $0 '<paths> -- <cmd>' >[1=2]
	exit badargs
}

oldsum=''
while() {
	newsum=`{walk -f $paths | xargs cat | sum | awk '{print $1}'}
	if(!  ~ $newsum $oldsum) {
		oldsum=$newsum
		echo '####' `{date | awk '{print $4}'} $cmd
		eval $cmd
	}
	sleep 2
}


next