merge
commit
2c3e60d95b
|
@ -21,23 +21,65 @@ typedef unsigned int uint32_t;
|
|||
typedef unsigned long long uint64_t;
|
||||
typedef unsigned long long uintmax_t;
|
||||
|
||||
typedef int8_t int_fast8_t;
|
||||
typedef int16_t int_fast16_t;
|
||||
typedef int32_t int_fast32_t;
|
||||
typedef int64_t int_fast64_t;
|
||||
;
|
||||
typedef int8_t int_least8_t;
|
||||
typedef int16_t int_least16_t;
|
||||
typedef int32_t int_least32_t;
|
||||
typedef int64_t int_least64_t;
|
||||
|
||||
typedef uint8_t uint_fast8_t;
|
||||
typedef uint16_t uint_fast16_t;
|
||||
typedef uint32_t uint_fast32_t;
|
||||
typedef uint64_t uint_fast64_t;
|
||||
|
||||
typedef uint8_t uint_least8_t;
|
||||
typedef uint16_t uint_least16_t;
|
||||
typedef uint32_t uint_least32_t;
|
||||
typedef uint64_t uint_least64_t;
|
||||
|
||||
typedef _intptr_t intptr_t;
|
||||
typedef _uintptr_t uintptr_t;
|
||||
|
||||
#define INT8_MIN 0x80
|
||||
#define INT16_MIN 0x8000
|
||||
#define INT32_MIN 0x80000000
|
||||
#define INT64_MIN 0x8000000000000000LL
|
||||
#define INT8_MIN ((int8_t)0x80)
|
||||
#define INT16_MIN ((int16_t)0x8000)
|
||||
#define INT32_MIN ((int32_t)0x80000000)
|
||||
#define INT64_MIN ((int64_t)0x8000000000000000LL)
|
||||
#define INTMAX_MIN INT64_MIN
|
||||
|
||||
#define UINT8_MIN 0
|
||||
#define UINT16_MIN 0
|
||||
#define UINT32_MIN 0
|
||||
#define UINT64_MIN 0
|
||||
#define UINTMAX_MIN UINT64_MIN
|
||||
|
||||
#define INT_FAST8_MIN INT8_MIN
|
||||
#define INT_FAST16_MIN INT16_MIN
|
||||
#define INT_FAST32_MIN INT32_MIN
|
||||
#define INT_FAST64_MIN INT64_MIN
|
||||
|
||||
#define UINT_FAST8_MIN UINT8_MIN
|
||||
#define UINT_FAST16_MIN UINT16_MIN
|
||||
#define UINT_FAST32_MIN UINT32_MIN
|
||||
#define UINT_FAST64_MIN UINT64_MIN
|
||||
|
||||
#define INT_LEAST8_MIN INT8_MIN
|
||||
#define INT_LEAST16_MIN INT16_MIN
|
||||
#define INT_LEAST32_MIN INT32_MIN
|
||||
#define INT_LEAST64_MIN INT64_MIN
|
||||
|
||||
#define UINT_LEAST8_MIN UINT8_MIN
|
||||
#define UINT_LEAST16_MIN UINT16_MIN
|
||||
#define UINT_LEAST32_MIN UINT32_MIN
|
||||
#define UINT_LEAST64_MIN UINT64_MIN
|
||||
|
||||
#define INT8_MAX 0x7f
|
||||
#define INT16_MAX 0x7fff
|
||||
#define INT32_MAX 0x7fffffff
|
||||
#define INT64_MAX 0x7fffffffffffffffULL
|
||||
#define INT64_MAX 0x7fffffffffffffffLL
|
||||
#define INTMAX_MAX INT64_MAX
|
||||
|
||||
#define UINT8_MAX 0xff
|
||||
|
@ -46,6 +88,26 @@ typedef _uintptr_t uintptr_t;
|
|||
#define UINT64_MAX 0xffffffffffffffffULL
|
||||
#define UINTMAX_MAX UINT64_MAX
|
||||
|
||||
#define INT_FAST8_MAX INT8_MAX
|
||||
#define INT_FAST16_MAX INT16_MAX
|
||||
#define INT_FAST32_MAX INT32_MAX
|
||||
#define INT_FAST64_MAX INT64_MAX
|
||||
|
||||
#define UINT_FAST8_MAX UINT8_MAX
|
||||
#define UINT_FAST16_MAX UINT16_MAX
|
||||
#define UINT_FAST32_MAX UINT32_MAX
|
||||
#define UINT_FAST64_MAX UINT64_MAX
|
||||
|
||||
#define INT_LEAST8_MAX INT8_MAX
|
||||
#define INT_LEAST16_MAX INT16_MAX
|
||||
#define INT_LEAST32_MAX INT32_MAX
|
||||
#define INT_LEAST64_MAX INT64_MAX
|
||||
|
||||
#define UINT_LEAST8_MAX UINT8_MAX
|
||||
#define UINT_LEAST16_MAX UINT16_MAX
|
||||
#define UINT_LEAST32_MAX UINT32_MAX
|
||||
#define UINT_LEAST64_MAX UINT64_MAX
|
||||
|
||||
/*
|
||||
* Right now, all of our size_t types are 32 bit, even on
|
||||
* 64 bit architectures.
|
||||
|
|
|
@ -71,7 +71,7 @@ The description of positional argument list is taken from
|
|||
An example of the script generated:
|
||||
.IP
|
||||
.EX
|
||||
% flagfmt='e:example,x,a:arg with args'
|
||||
% flagfmt='e:example, x, a:arg with args'
|
||||
% aux/getflags -exa arg list positional stuff
|
||||
example=()
|
||||
flagx=()
|
||||
|
@ -87,7 +87,7 @@ Parse the arguments for
|
|||
.IR leak (1):
|
||||
.IP
|
||||
.EX
|
||||
flagfmt='b:showbmp,s:acidfmt,f binary,r res,x width'
|
||||
flagfmt='b:showbmp, s:acidfmt, f binary, r res, x width'
|
||||
args='name | pid list'
|
||||
if(! ifs=() eval `{aux/getflags $*} || ~ $#* 0){
|
||||
aux/usage
|
||||
|
|
|
@ -868,7 +868,8 @@ textcommit(Text *t, int tofile)
|
|||
|
||||
static Text *clicktext;
|
||||
static uint clickmsec;
|
||||
static int clickcount;
|
||||
static int clickcount;
|
||||
static Point clickpt;
|
||||
static Text *selecttext;
|
||||
static uint selectq;
|
||||
|
||||
|
@ -927,9 +928,12 @@ textselect(Text *t)
|
|||
b = mouse->buttons;
|
||||
q0 = t->q0;
|
||||
q1 = t->q1;
|
||||
dx = abs(clickpt.x - mouse->xy.x);
|
||||
dy = abs(clickpt.y - mouse->xy.y);
|
||||
clickpt = mouse->xy;
|
||||
selectq = t->org+frcharofpt(t, mouse->xy);
|
||||
clickcount++;
|
||||
if(mouse->msec-clickmsec >= 500 || selecttext != t || clickcount > 3)
|
||||
if(mouse->msec-clickmsec >= 500 || selecttext != t || clickcount > 3 || dx > 3 || dy > 3)
|
||||
clickcount = 0;
|
||||
if(clickcount >= 1 && selecttext==t && mouse->msec-clickmsec < 500){
|
||||
textstretchsel(t, selectq, &q0, &q1, clickcount);
|
||||
|
|
|
@ -9,18 +9,39 @@ usage(void)
|
|||
exits(0);
|
||||
}
|
||||
|
||||
char*
|
||||
skipspace(char *p)
|
||||
{
|
||||
while(isspace(*p))
|
||||
p++;
|
||||
return p;
|
||||
}
|
||||
|
||||
char*
|
||||
nextarg(char *p)
|
||||
{
|
||||
char *s;
|
||||
|
||||
s = strchr(p, ',');
|
||||
if(s == nil)
|
||||
return p+strlen(p); /* to \0 */
|
||||
while(*s == ',' || isspace(*s))
|
||||
s++;
|
||||
return s;
|
||||
}
|
||||
|
||||
char*
|
||||
findarg(char *flags, Rune r)
|
||||
{
|
||||
char *p;
|
||||
Rune rr;
|
||||
|
||||
for(p=flags; p!=(char*)1; p=strchr(p, ',')+1){
|
||||
|
||||
for(p=skipspace(flags); *p; p=nextarg(p)){
|
||||
chartorune(&rr, p);
|
||||
if(rr == r)
|
||||
return p;
|
||||
}
|
||||
return nil;
|
||||
return nil;
|
||||
}
|
||||
|
||||
char*
|
||||
|
@ -44,10 +65,8 @@ countargs(char *p)
|
|||
int n;
|
||||
|
||||
n = 1;
|
||||
while(*p == ' ')
|
||||
p++;
|
||||
for(; *p && *p != ','; p++)
|
||||
if(*p == ' ' && *(p-1) != ' ')
|
||||
for(p=skipspace(p); *p && *p != ','; p++)
|
||||
if(isspace(*p) && !isspace(*(p-1)))
|
||||
n++;
|
||||
return n;
|
||||
}
|
||||
|
@ -71,7 +90,7 @@ main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
fmtfdinit(&fmt, 1, buf, sizeof buf);
|
||||
for(p=flags; p!=(char*)1 && *p != 0; p=strchr(p, ',')+1){
|
||||
for(p=skipspace(flags); *p; p=nextarg(p)){
|
||||
s = e = nil;
|
||||
if(p[1] == ':'){
|
||||
s = p + 2;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include <u.h>
|
||||
#include <libc.h>
|
||||
#include <ctype.h>
|
||||
|
||||
void
|
||||
main(void)
|
||||
|
@ -30,9 +31,11 @@ main(void)
|
|||
if(flags[0]){
|
||||
single = 0;
|
||||
for(p=flags; *p; ){
|
||||
while(isspace(*p))
|
||||
p++;
|
||||
p += chartorune(&r, p);
|
||||
if(*p == ':')
|
||||
while(*p != '\0' && *p != ',' && *p != ' ')
|
||||
while(*p && *p != ',' && !isspace(*p))
|
||||
p++;
|
||||
if(*p == ',' || *p == 0){
|
||||
if(!single){
|
||||
|
@ -44,7 +47,7 @@ main(void)
|
|||
p++;
|
||||
continue;
|
||||
}
|
||||
while(*p == ' ')
|
||||
while(isspace(*p))
|
||||
p++;
|
||||
if(single){
|
||||
fmtprint(&fmt, "]");
|
||||
|
|
|
@ -962,6 +962,7 @@ wdelete(Window *w, uint q0, uint q1)
|
|||
|
||||
static Window *clickwin;
|
||||
static uint clickmsec;
|
||||
static Point clickpt;
|
||||
static uint clickcount;
|
||||
static Window *selectwin;
|
||||
static uint selectq;
|
||||
|
@ -1018,9 +1019,12 @@ wselect(Window *w)
|
|||
b = w->mc.buttons;
|
||||
q0 = w->q0;
|
||||
q1 = w->q1;
|
||||
dx = abs(clickpt.x - w->mc.xy.x);
|
||||
dy = abs(clickpt.y - w->mc.xy.y);
|
||||
clickpt = w->mc.xy;
|
||||
selectq = w->org+frcharofpt(w, w->mc.xy);
|
||||
clickcount++;
|
||||
if(w->mc.msec-clickmsec >= 500 || clickwin != w || clickcount > 3)
|
||||
if(w->mc.msec-clickmsec >= 500 || clickwin != w || clickcount > 3 || dx > 3 || dy > 3)
|
||||
clickcount = 0;
|
||||
if(clickwin == w && clickcount >= 1 && w->mc.msec-clickmsec < 500){
|
||||
mode = (clickcount > 2) ? 2 : clickcount;
|
||||
|
|
Loading…
Reference in New Issue