Plan 9 from Bell Labs’s /usr/web/sources/extra/changes/2006/0104

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


Remember rotations across pages.
 [rsc] --rw-rw-r-- M 222375 glenda sys 2152 Jan  4 07:22 sys/src/cmd/page/page.h
	/n/sourcesdump/2006/0104/plan9/sys/src/cmd/page/page.h:42,47 - 
	/n/sourcesdump/2006/0105/plan9/sys/src/cmd/page/page.h:42,48
	  
	  void rot180(Image*);
	  Image *rot90(Image*);
	+ Image *rot270(Image*);
	  Image *resample(Image*, Image*);
	  
	  /* ghostscript interface shared by ps, pdf */
 [rsc] --rw-rw-r-- M 222375 glenda sys 10435 Jan  4 07:22 sys/src/cmd/page/rotate.c
	/n/sourcesdump/2006/0104/plan9/sys/src/cmd/page/rotate.c:245,250 - 
	/n/sourcesdump/2006/0105/plan9/sys/src/cmd/page/rotate.c:245,275
	  	return(tmp);
	  }
	  
	+ /* rotates an image 270 degrees clockwise */
	+ Image *
	+ rot270(Image *im)
	+ {
	+ 	Image *tmp;
	+ 	int i, j, dx, dy;
	+ 
	+ 	dx = Dx(im->r);
	+ 	dy = Dy(im->r);
	+ 	tmp = xallocimage(display, Rect(0, 0, dy, dx), im->chan, 0, DCyan);
	+ 	if(tmp == nil) {
	+ 		fprint(2, "out of memory during rot270: %r\n");
	+ 		wexits("memory");
	+ 	}
	+ 
	+ 	for(i = 0; i < dy; i++) {
	+ 		for(j = 0; j < dx; j++) {
	+ 			drawop(tmp, Rect(i, j, i+1, j+1), im, nil, Pt(dx-(j+1), i), S);
	+ 		}
	+ 	}
	+ 	freeimage(im);
	+ 
	+ 	return(tmp);
	+ }
	+ 
	  /* from resample.c -- resize from → to using interpolation */
	  
	  
 [rsc] --rw-rw-r-- M 222375 glenda sys 22893 Jan  4 07:22 sys/src/cmd/page/view.c
	/n/sourcesdump/2006/0104/plan9/sys/src/cmd/page/view.c:16,22 - 
	/n/sourcesdump/2006/0105/plan9/sys/src/cmd/page/view.c:16,22
	  Document *doc;
	  Image *im;
	  int page;
	- int upside = 0;
	+ int angle = 0;
	  int showbottom = 0;		/* on the next showpage, move the image so the bottom is visible. */
	  
	  Rectangle ulrange;	/* the upper left corner of the image must be in this rectangle */
	/n/sourcesdump/2006/0104/plan9/sys/src/cmd/page/view.c:156,163 - 
	/n/sourcesdump/2006/0105/plan9/sys/src/cmd/page/view.c:156,172
	  		im = tmp;
	  	}
	  
	- 	if(upside)
	+ 	switch(angle){
	+ 	case 90:
	+ 		im = rot90(im);
	+ 		break;
	+ 	case 180:
	  		rot180(im);
	+ 		break;
	+ 	case 270:
	+ 		im = rot270(im);
	+ 		break;
	+ 	}
	  
	  	esetcursor(nil);
	  	if(showbottom){
	/n/sourcesdump/2006/0104/plan9/sys/src/cmd/page/view.c:390,396 - 
	/n/sourcesdump/2006/0105/plan9/sys/src/cmd/page/view.c:399,405
	  				esetcursor(&reading);
	  				rot180(im);
	  				esetcursor(nil);
	- 				upside = !upside;
	+ 				angle = (angle+180) % 360;
	  				redraw(screen);
	  				flushimage(display, 1);
	  				break;
	/n/sourcesdump/2006/0104/plan9/sys/src/cmd/page/view.c:589,594 - 
	/n/sourcesdump/2006/0105/plan9/sys/src/cmd/page/view.c:598,604
	  					esetcursor(&reading);
	  					im = rot90(im);
	  					esetcursor(nil);
	+ 					angle = (angle+90) % 360;
	  					redraw(screen);
	  					flushimage(display, 1);
	  					break;
	/n/sourcesdump/2006/0104/plan9/sys/src/cmd/page/view.c:598,604 - 
	/n/sourcesdump/2006/0105/plan9/sys/src/cmd/page/view.c:608,614
	  					esetcursor(&reading);
	  					rot180(im);
	  					esetcursor(nil);
	- 					upside = !upside;
	+ 					angle = (angle+180) % 360;
	  					redraw(screen);
	  					flushimage(display, 1);
	  					break;

Man page and usage updates.
 [rsc] --rw-rw-r-- M 222375 glenda sys 735 Jan  4 07:37 sys/man/1/freq
	/n/sourcesdump/2006/0104/plan9/sys/man/1/freq:4,10 - 
	/n/sourcesdump/2006/0105/plan9/sys/man/1/freq:4,10
	  .SH SYNOPSIS
	  .B freq
	  [
	- .B -dxocr
	+ .B -cdorx
	  ]
	  [
	  .I file ...
 [rsc] --rw-rw-r-- M 222375 glenda sys 2257 Jan  4 07:37 sys/man/1/grep
	/n/sourcesdump/2006/0104/plan9/sys/man/1/grep:4,12 - 
	/n/sourcesdump/2006/0105/plan9/sys/man/1/grep:4,18
	  .SH SYNOPSIS
	  .B grep
	  [
	- .I option ...
	+ .B -bchiLlnsv
	  ]
	+ [
	+ .B -e
	  .I pattern
	+ [
	+ .B -f
	+ .I patternfile
	+ ]
	  [
	  .I file ...
	  ]
 [rsc] --rw-rw-r-- M 222375 presotto sys 4361 Jan  4 07:37 sys/man/1/gview
	/n/sourcesdump/2006/0104/plan9/sys/man/1/gview:4,17 - 
	/n/sourcesdump/2006/0105/plan9/sys/man/1/gview:4,14
	  .SH SYNOPSIS
	  .B gview
	  [
	- .B -l
	- .I logfile
	+ .B -mp
	  ]
	  [
	- .B -m
	- ]
	- [
	- .B -p
	+ .B -l
	+ .I logfile
	  ]
	  [
	  .I files
 [rsc] --rw-rw-r-- M 222375 glenda sys 2357 Jan  4 07:37 sys/man/1/hoc
	/n/sourcesdump/2006/0104/plan9/sys/man/1/hoc:4,14 - 
	/n/sourcesdump/2006/0105/plan9/sys/man/1/hoc:4,14
	  .SH SYNOPSIS
	  .B hoc
	  [
	- .I file ...
	- ]
	- [
	  .B -e
	  .I expression
	+ ]
	+ [
	+ .I file ...
	  ]
	  .SH DESCRIPTION
	  .I Hoc
 [rsc] --rw-rw-r-- M 222375 glenda sys 6098 Jan  4 07:37 sys/src/cmd/history.c
	/n/sourcesdump/2006/0104/plan9/sys/src/cmd/history.c:12,17 - 
	/n/sourcesdump/2006/0105/plan9/sys/src/cmd/history.c:12,18
	  int	diffb;
	  char*	sflag;
	  
	+ void	usage(void);
	  void	ysearch(char*, char*);
	  long	starttime(char*);
	  void	lastbefore(ulong, char*, char*, char*);
	/n/sourcesdump/2006/0104/plan9/sys/src/cmd/history.c:26,32 - 
	/n/sourcesdump/2006/0105/plan9/sys/src/cmd/history.c:27,33
	  	ndump = nil;
	  	ARGBEGIN {
	  	default:
	- 		goto usage;
	+ 		usage();
	  	case 'v':
	  		verb = 1;
	  		break;
	/n/sourcesdump/2006/0104/plan9/sys/src/cmd/history.c:50,64 - 
	/n/sourcesdump/2006/0105/plan9/sys/src/cmd/history.c:51,69
	  		break;
	  	} ARGEND
	  
	- 	if(argc == 0) {
	- 	usage:
	- 		fprint(2, "usage: history [-bDfuv] [-d 9fsname] [-s yyyymmdd] files\n");
	- 		exits(0);
	- 	}
	+ 	if(argc == 0)
	+ 		usage();
	  
	  	for(i=0; i<argc; i++)
	  		ysearch(argv[i], ndump);
	  	exits(0);
	+ }
	+ 
	+ void
	+ usage(void)
	+ {
	+ 	fprint(2, "usage: history [-bDfuv] [-d dumpfilesystem] [-s yyyymmdd] files\n");
	+ 	exits("usage");
	  }
	  
	  void
 [rsc] --rw-rw-r-- M 222375 glenda sys 1728 Jan  4 07:37 sys/src/cmd/freq.c
	/n/sourcesdump/2006/0104/plan9/sys/src/cmd/freq.c:5,10 - 
	/n/sourcesdump/2006/0105/plan9/sys/src/cmd/freq.c:5,11
	  long	count[1<<16];
	  Biobuf	bout;
	  
	+ void	usage(void);
	  void	freq(int, char*);
	  long	flag;
	  enum
	/n/sourcesdump/2006/0104/plan9/sys/src/cmd/freq.c:24,32 - 
	/n/sourcesdump/2006/0105/plan9/sys/src/cmd/freq.c:25,30
	  	flag = 0;
	  	Binit(&bout, 1, OWRITE);
	  	ARGBEGIN{
	- 	default:
	- 		fprint(2, "freq: unknown option %c\n", ARGC());
	- 		exits("usage");
	  	case 'd':
	  		flag |= Fdec;
	  		break;
	/n/sourcesdump/2006/0104/plan9/sys/src/cmd/freq.c:42,47 - 
	/n/sourcesdump/2006/0105/plan9/sys/src/cmd/freq.c:40,47
	  	case 'r':
	  		flag |= Frune;
	  		break;
	+ 	default:
	+ 		usage();
	  	}ARGEND
	  	if((flag&(Fdec|Fhex|Foct|Fchar)) == 0)
	  		flag |= Fdec | Fhex | Foct | Fchar;
	/n/sourcesdump/2006/0104/plan9/sys/src/cmd/freq.c:52,58 - 
	/n/sourcesdump/2006/0105/plan9/sys/src/cmd/freq.c:52,58
	  	for(i=0; i<argc; i++) {
	  		f = open(argv[i], 0);
	  		if(f < 0) {
	- 			fprint(2, "cannot open %s\n", argv[i]);
	+ 			fprint(2, "open %s: %r\n", argv[i]);
	  			continue;
	  		}
	  		freq(f, argv[i]);
	/n/sourcesdump/2006/0104/plan9/sys/src/cmd/freq.c:59,64 - 
	/n/sourcesdump/2006/0105/plan9/sys/src/cmd/freq.c:59,71
	  		close(f);
	  	}
	  	exits(0);
	+ }
	+ 
	+ void
	+ usage(void)
	+ {
	+ 	fprint(2, "usage: freq [-cdorx] [file ...]\n");
	+ 	exits("usage");
	  }
	  
	  void
 [rsc] --rw-rw-r-- M 222375 glenda sys 4686 Jan  4 07:37 sys/src/cmd/grep/main.c
	/n/sourcesdump/2006/0104/plan9/sys/src/cmd/grep/main.c:1,11 - 
	/n/sourcesdump/2006/0105/plan9/sys/src/cmd/grep/main.c:1,11
	  #define	EXTERN
	  #include	"grep.h"
	  
	- char *validflags = "1bchiLlnsv";
	+ char *validflags = "bchiLlnsv";
	  void
	  usage(void)
	  {
	- 	fprint(2, "usage: grep [-%s] [-f file] [-e expr] [file ...]\n", validflags);
	+ 	fprint(2, "usage: grep [-%s] [-e pattern] [-f patternfile] [file ...]\n", validflags);
	  	exits("usage");
	  }
	  
 [rsc] --rw-rw-r-- M 222375 presotto sys 50883 Jan  4 07:37 sys/src/cmd/gview.c
	/n/sourcesdump/2006/0104/plan9/sys/src/cmd/gview.c:1960,1966 - 
	/n/sourcesdump/2006/0105/plan9/sys/src/cmd/gview.c:1960,1966
	  	int i;
	  	fprintf(stderr,"Usage %s [options] [infile]\n", argv0);
	  	fprintf(stderr,
	- "option ::= -l logfile | -m\n"
	+ "option ::= -l logfile | -m | -p\n"
	  "\n"
	  "Read a polygonal line graph in an ASCII format (one x y pair per line, delimited\n"
	  "by spaces with a label after each polyline), and view it interactively.  Use\n"
	/n/sourcesdump/2006/0104/plan9/sys/src/cmd/gview.c:1968,1973 - 
	/n/sourcesdump/2006/0105/plan9/sys/src/cmd/gview.c:1968,1974
	  "Option -l specifies a file in which to log the coordinates of each point selected.\n"
	  "(Clicking a point with button one selects it and displays its coordinates and\n"
	  "the label of its polylone.)  Option -m allows polylines to be moved and rotated.\n"
	+ "The -p option plots only the vertices of the polygons.\n"
	  "The polyline labels can use the following color names:"
	  	);
	  	for (i=0; clrtab[i].c!=DNofill; i++)
	/n/sourcesdump/2006/0104/plan9/sys/src/cmd/gview.c:1981,1995 - 
	/n/sourcesdump/2006/0105/plan9/sys/src/cmd/gview.c:1982,1999
	  	int e;
	  
	  	ARGBEGIN {
	- 	case 'm': cantmv=0;
	+ 	case 'm':
	+ 		cantmv=0;
	  		break;
	- 	case 'l': logfil = fopen(ARGF(),"w");
	+ 	case 'l':
	+ 		logfil = fopen(ARGF(),"w");
	  		break;
	  	case 'p':
	  		plotdots++;
	  		break;
	- 	default: usage();
	- 	} ARGEND
	+ 	default:
	+ 		usage();
	+ 	} ARGEND;
	  
	  	if(initdraw(0, 0, "gview") < 0)
	  		exits("initdraw");

Fix-up cursor.
 [rsc] --rw-rw-r-- M 222375 glenda sys 12023 Jan  4 14:43 sys/src/9/pc/vganvidia.c
	/n/sourcesdump/2006/0104/plan9/sys/src/9/pc/vganvidia.c:184,190 - 
	/n/sourcesdump/2006/0105/plan9/sys/src/9/pc/vganvidia.c:184,199
	  		p = (void*)((uchar*)scr->mmio + Pramin + 0x1E00 * 4);
	  		break;
	  	default:
	- 		p = (void*)((uchar*)scr->vaddr + scr->storage - 96*1024);
	+ 		/*
	+ 		 * Reset the cursor location, since the kernel may
	+ 		 * have allocated less storage than aux/vga
	+ 		 * expected.
	+ 		 */
	+ 		tmp = scr->storage - 96*1024;
	+ 		p = (void*)((uchar*)scr->vaddr + tmp);
	+ 		vgaxo(Crtx, 0x30, 0x80|(tmp>>17));
	+ 		vgaxo(Crtx, 0x31, (tmp>>11)<<2);
	+ 		vgaxo(Crtx, 0x2F, tmp>>24);
	  		break;
	  	}
	  


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.