mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-12 11:10:07 +00:00
Merge branch '9fans:master' into htmlfmt
This commit is contained in:
commit
dc2c2bc392
14 changed files with 60 additions and 38 deletions
|
@ -37,7 +37,6 @@ for details on using Git.
|
|||
Status
|
||||
------
|
||||
|
||||
[![Build Status](https://travis-ci.org/9fans/plan9port.svg?branch=master)](https://travis-ci.org/9fans/plan9port)
|
||||
[![Coverity Scan Build Status](https://scan.coverity.com/projects/plan-9-from-user-space/badge.svg)](https://scan.coverity.com/projects/plan-9-from-user-space)
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef _REGEXP9_H_
|
||||
#define _REGEXP9_H_ 1
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef AUTOLIB
|
||||
|
@ -61,7 +61,7 @@ struct Reinst{
|
|||
*/
|
||||
struct Reprog{
|
||||
Reinst *startinst; /* start pc */
|
||||
Reclass class[16]; /* .data */
|
||||
Reclass class[128]; /* .data */
|
||||
Reinst firstinst[5]; /* .text */
|
||||
};
|
||||
|
||||
|
|
|
@ -169,7 +169,7 @@ The only way to write multithreaded programs is to use the
|
|||
library.
|
||||
.MR Rfork (3)
|
||||
exists but is not as capable as on Plan 9.
|
||||
There are many unfortunate by necessary preprocessor
|
||||
There are many unfortunate but necessary preprocessor
|
||||
diversions to make Plan 9 and Unix libraries coexist.
|
||||
See
|
||||
.MR intro (3)
|
||||
|
|
|
@ -254,7 +254,7 @@ port of the rule set or the entire rule set will be skipped.
|
|||
.B client
|
||||
If no application has the port open, the arguments to a
|
||||
.B plumb
|
||||
.B start
|
||||
.B client
|
||||
rule specify a shell program to run in response to the message.
|
||||
The message will be held, with the supposition that the program
|
||||
will eventually open the port to retrieve it.
|
||||
|
|
|
@ -28,7 +28,7 @@ enum
|
|||
enum
|
||||
{
|
||||
Blockincr = 256,
|
||||
Maxblock = 8*1024,
|
||||
Maxblock = 32*1024,
|
||||
NRange = 10,
|
||||
Infinity = 0x7FFFFFFF /* huge value for regexp address */
|
||||
};
|
||||
|
|
|
@ -319,7 +319,7 @@ rowdump(Row *row, char *file)
|
|||
int i, j, fd, m, n, start, dumped;
|
||||
uint q0, q1;
|
||||
Biobuf *b;
|
||||
char *buf, *a, *fontname;
|
||||
char *buf, *a, *fontname, *fontfmt, *fontnamelo, *fontnamehi;
|
||||
Rune *r;
|
||||
Column *c;
|
||||
Window *w, *w1;
|
||||
|
@ -394,9 +394,17 @@ rowdump(Row *row, char *file)
|
|||
if(w1->nopen[QWevent])
|
||||
goto Continue2;
|
||||
}
|
||||
fontname = "";
|
||||
if(t->reffont->f != font)
|
||||
fontname = t->reffont->f->name;
|
||||
fontfmt = "%s";
|
||||
fontnamelo = "";
|
||||
fontnamehi = nil;
|
||||
if(t->reffont->f != font){
|
||||
fontnamelo = t->reffont->f->lodpi->name;
|
||||
if(t->reffont->f->hidpi != nil){
|
||||
fontfmt = "%s,%s";
|
||||
fontnamehi = t->reffont->f->hidpi->name;
|
||||
}
|
||||
}
|
||||
fontname = smprint(fontfmt, fontnamelo, fontnamehi);
|
||||
if(t->file->nname)
|
||||
a = runetobyte(t->file->name, t->file->nname);
|
||||
else
|
||||
|
@ -428,6 +436,7 @@ rowdump(Row *row, char *file)
|
|||
100.0*(w->r.min.y-c->r.min.y)/Dy(c->r),
|
||||
w->body.file->b.nc, fontname);
|
||||
}
|
||||
free(fontname);
|
||||
free(a);
|
||||
winctlprint(w, buf, 0);
|
||||
Bwrite(b, buf, strlen(buf));
|
||||
|
|
|
@ -601,12 +601,12 @@ rpc_resizewindow(Client *c, Rectangle r)
|
|||
|
||||
- (void)scrollWheel:(NSEvent*)e
|
||||
{
|
||||
NSInteger s;
|
||||
CGFloat s;
|
||||
|
||||
s = [e scrollingDeltaY];
|
||||
if(s > 0)
|
||||
if(s > 0.0f)
|
||||
[self sendmouse:8];
|
||||
else if (s < 0)
|
||||
else if (s < 0.0f)
|
||||
[self sendmouse:16];
|
||||
}
|
||||
|
||||
|
|
|
@ -96,11 +96,11 @@ threadmain(int argc, char **argv)
|
|||
{
|
||||
Document *doc;
|
||||
Biobuf *b;
|
||||
char *basename = argv[0];
|
||||
enum { Ninput = 16 };
|
||||
uchar buf[Ninput+1];
|
||||
int readstdin;
|
||||
int readstdin, haveppi;
|
||||
|
||||
haveppi = 0;
|
||||
ARGBEGIN{
|
||||
/* "temporary" debugging options */
|
||||
case 'P':
|
||||
|
@ -128,13 +128,14 @@ threadmain(int argc, char **argv)
|
|||
reverse = 1;
|
||||
break;
|
||||
case 'p':
|
||||
haveppi = 1;
|
||||
ppi = atoi(EARGF(usage()));
|
||||
break;
|
||||
case 'b':
|
||||
truetoboundingbox = 1;
|
||||
break;
|
||||
case 'w':
|
||||
fprint(2, "%s: -w has only the effect of -R X11 systems\n", basename);
|
||||
fprint(2, "warning: page -w only supported on x11 systems\n");
|
||||
resizing = 1;
|
||||
break;
|
||||
case 'i':
|
||||
|
@ -199,6 +200,13 @@ threadmain(int argc, char **argv)
|
|||
}else
|
||||
b = nil;
|
||||
|
||||
if(initdraw(0, 0, "page") < 0){
|
||||
fprint(2, "page: initdraw failed: %r\n");
|
||||
wexits("initdraw");
|
||||
}
|
||||
display->locking = 1;
|
||||
ppi = scalesize(display, ppi);
|
||||
|
||||
buf[Ninput] = '\0';
|
||||
if(imagemode)
|
||||
doc = initgfx(nil, 0, nil, nil, 0);
|
||||
|
@ -217,7 +225,7 @@ threadmain(int argc, char **argv)
|
|||
else if(strncmp((char*)buf, "x T ", 4) == 0)
|
||||
doc = inittroff(b, argc, argv, buf, Ninput);
|
||||
else {
|
||||
if(ppi != 100) {
|
||||
if(haveppi) {
|
||||
fprint(2, "page: you can't specify -p with graphic files\n");
|
||||
wexits("-p and graphics");
|
||||
}
|
||||
|
@ -237,12 +245,6 @@ threadmain(int argc, char **argv)
|
|||
if(reverse == -1) /* neither cmdline nor ps reader set it */
|
||||
reverse = 0;
|
||||
|
||||
if(initdraw(0, 0, "page") < 0){
|
||||
fprint(2, "page: initdraw failed: %r\n");
|
||||
wexits("initdraw");
|
||||
}
|
||||
display->locking = 1;
|
||||
|
||||
truecolor = screen->depth > 8;
|
||||
viewer(doc);
|
||||
wexits(0);
|
||||
|
|
|
@ -38,11 +38,11 @@ verbis(int obj, Plumbmsg *m, Rule *r)
|
|||
}
|
||||
|
||||
static void
|
||||
setvar(Resub rs[10], char *match[10])
|
||||
setvar(Resub rs[NMATCHSUBEXP], char *match[NMATCHSUBEXP])
|
||||
{
|
||||
int i, n;
|
||||
|
||||
for(i=0; i<10; i++){
|
||||
for(i=0; i<NMATCHSUBEXP; i++){
|
||||
free(match[i]);
|
||||
match[i] = nil;
|
||||
if(rs[i].s.sp != nil){
|
||||
|
@ -55,7 +55,7 @@ setvar(Resub rs[10], char *match[10])
|
|||
}
|
||||
|
||||
int
|
||||
clickmatch(Reprog *re, char *text, Resub rs[10], int click)
|
||||
clickmatch(Reprog *re, char *text, Resub rs[NMATCHSUBEXP], int click)
|
||||
{
|
||||
char *clickp;
|
||||
int i, w;
|
||||
|
@ -66,8 +66,8 @@ clickmatch(Reprog *re, char *text, Resub rs[10], int click)
|
|||
w = chartorune(&r, text+i);
|
||||
clickp = text+i;
|
||||
for(i=0; i<=click; i++){
|
||||
memset(rs, 0, 10*sizeof(Resub));
|
||||
if(regexec(re, text+i, rs, 10))
|
||||
memset(rs, 0, NMATCHSUBEXP*sizeof(Resub));
|
||||
if(regexec(re, text+i, rs, NMATCHSUBEXP))
|
||||
if(rs[0].s.sp<=clickp && clickp<=rs[0].e.ep)
|
||||
return 1;
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ clickmatch(Reprog *re, char *text, Resub rs[10], int click)
|
|||
int
|
||||
verbmatches(int obj, Plumbmsg *m, Rule *r, Exec *e)
|
||||
{
|
||||
Resub rs[10];
|
||||
Resub rs[NMATCHSUBEXP];
|
||||
char *clickval, *alltext;
|
||||
int p0, p1, ntext;
|
||||
|
||||
|
@ -122,7 +122,8 @@ verbmatches(int obj, Plumbmsg *m, Rule *r, Exec *e)
|
|||
/* must match full text */
|
||||
if(ntext < 0)
|
||||
ntext = strlen(alltext);
|
||||
if(!regexec(r->regex, alltext, rs, 10) || rs[0].s.sp!=alltext || rs[0].e.ep!=alltext+ntext)
|
||||
if(!regexec(r->regex, alltext, rs, NMATCHSUBEXP)
|
||||
|| rs[0].s.sp!=alltext || rs[0].e.ep!=alltext+ntext)
|
||||
break;
|
||||
setvar(rs, e->match);
|
||||
return 1;
|
||||
|
@ -300,7 +301,7 @@ freeexec(Exec *exec)
|
|||
return;
|
||||
free(exec->dir);
|
||||
free(exec->file);
|
||||
for(i=0; i<10; i++)
|
||||
for(i=0; i<NMATCHSUBEXP; i++)
|
||||
free(exec->match[i]);
|
||||
free(exec);
|
||||
}
|
||||
|
|
|
@ -52,10 +52,15 @@ struct Ruleset
|
|||
char *port;
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
NMATCHSUBEXP = 100 /* bounded by ../../libregexp/regcomp.h:/NSUBEXP */
|
||||
};
|
||||
|
||||
struct Exec
|
||||
{
|
||||
Plumbmsg *msg;
|
||||
char *match[10];
|
||||
char *match[NMATCHSUBEXP];
|
||||
int p0; /* begin and end of match */
|
||||
int p1;
|
||||
int clearclick; /* click was expanded; remove attribute */
|
||||
|
|
|
@ -258,11 +258,17 @@ char*
|
|||
dollar(Exec *e, char *s, int *namelen)
|
||||
{
|
||||
int n;
|
||||
ulong m;
|
||||
char *t;
|
||||
static char *abuf;
|
||||
|
||||
*namelen = 1;
|
||||
if(e!=nil && '0'<=s[0] && s[0]<='9')
|
||||
return nonnil(e->match[s[0]-'0']);
|
||||
if(e!=nil && '0'<=s[0] && s[0]<='9'){
|
||||
m = strtoul(s, &t, 10);
|
||||
*namelen = t-s;
|
||||
if(t==s || m>=NMATCHSUBEXP)
|
||||
return "";
|
||||
return nonnil(e->match[m]);
|
||||
}
|
||||
|
||||
n = scanvarname(s)-s;
|
||||
*namelen = n;
|
||||
|
|
|
@ -122,7 +122,7 @@ scalesubfont(Subfont *f, int scale)
|
|||
f->height *= scale;
|
||||
f->ascent *= scale;
|
||||
|
||||
for(j=0; j<f->n; j++) {
|
||||
for(j=0; j<=f->n; j++) {
|
||||
f->info[j].x *= scale;
|
||||
f->info[j].top *= scale;
|
||||
f->info[j].bottom *= scale;
|
||||
|
|
|
@ -52,7 +52,7 @@ frinittick(Frame *f)
|
|||
/* background color */
|
||||
draw(f->tick, f->tick->r, f->cols[BACK], nil, ZP);
|
||||
/* vertical line */
|
||||
draw(f->tick, Rect(f->tickscale*(FRTICKW/2), 0, f->tickscale*(FRTICKW/2+1), ft->height), f->display->black, nil, ZP);
|
||||
draw(f->tick, Rect(f->tickscale*(FRTICKW/2), 0, f->tickscale*(FRTICKW/2+1), ft->height), f->cols[TEXT], nil, ZP);
|
||||
/* box on each end */
|
||||
draw(f->tick, Rect(0, 0, f->tickscale*FRTICKW, f->tickscale*FRTICKW), f->cols[TEXT], nil, ZP);
|
||||
draw(f->tick, Rect(0, ft->height-f->tickscale*FRTICKW, f->tickscale*FRTICKW, ft->height), f->cols[TEXT], nil, ZP);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
typedef unsigned char uchar;
|
||||
#define nelem(x) (sizeof(x)/sizeof((x)[0]))
|
||||
|
||||
#define NSUBEXP 32
|
||||
#define NSUBEXP 128
|
||||
typedef struct Resublist Resublist;
|
||||
struct Resublist
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue