mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 13:52:28 +00:00
Add q
keyboard shortcut to printvideo.com (#37)
This commit is contained in:
parent
4e56d89dcd
commit
28135b7a20
7 changed files with 33 additions and 24 deletions
|
@ -663,7 +663,7 @@ ape.macho:
|
||||||
.quad 0 # r13
|
.quad 0 # r13
|
||||||
.quad 0 # r14
|
.quad 0 # r14
|
||||||
.quad 0 # r15
|
.quad 0 # r15
|
||||||
.quad _start_xnu # rip
|
.quad _xnu # rip
|
||||||
.quad 0 # rflags
|
.quad 0 # rflags
|
||||||
.quad 0 # cs
|
.quad 0 # cs
|
||||||
.quad 0 # fs
|
.quad 0 # fs
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
#define COSMOPOLITAN_LIBC_BITS_LIKELY_H_
|
#define COSMOPOLITAN_LIBC_BITS_LIKELY_H_
|
||||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||||
|
|
||||||
#define likely(expr) __builtin_expect(!!(expr), 1)
|
#define LIKELY(expr) __builtin_expect(!!(expr), 1)
|
||||||
#define unlikely(expr) __builtin_expect(!!(expr), 0)
|
#define UNLIKELY(expr) __builtin_expect(!!(expr), 0)
|
||||||
|
|
||||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||||
#endif /* COSMOPOLITAN_LIBC_BITS_LIKELY_H_ */
|
#endif /* COSMOPOLITAN_LIBC_BITS_LIKELY_H_ */
|
||||||
|
|
|
@ -62,7 +62,6 @@ _start: test %rdi,%rdi
|
||||||
/ @param rsp is [n,argv₀..argvₙ₋₁,0,envp₀..,0,auxv₀..,0,..]
|
/ @param rsp is [n,argv₀..argvₙ₋₁,0,envp₀..,0,auxv₀..,0,..]
|
||||||
/ @note FreeBSD is special (see freebsd/lib/csu/amd64/...)
|
/ @note FreeBSD is special (see freebsd/lib/csu/amd64/...)
|
||||||
/ @noreturn
|
/ @noreturn
|
||||||
_start_xnu:
|
_xnu: movb $XNU,__hostos(%rip)
|
||||||
movb $XNU,__hostos(%rip)
|
|
||||||
jmp 0b
|
jmp 0b
|
||||||
.endfn _start_xnu,weak,hidden
|
.endfn _xnu,weak,hidden
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
#include "libc/alg/reverse.h"
|
#include "libc/alg/reverse.h"
|
||||||
#include "libc/bits/bits.h"
|
#include "libc/bits/bits.h"
|
||||||
|
#include "libc/bits/likely.h"
|
||||||
#include "libc/bits/weaken.h"
|
#include "libc/bits/weaken.h"
|
||||||
#include "libc/calls/calls.h"
|
#include "libc/calls/calls.h"
|
||||||
#include "libc/dce.h"
|
#include "libc/dce.h"
|
||||||
|
@ -321,11 +322,11 @@ static size_t __asan_int2str(int64_t i, char *a) {
|
||||||
return 1 + __asan_uint2str(-i, a);
|
return 1 + __asan_uint2str(-i, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
void __asan_poison(uintptr_t p, size_t n, int kind) {
|
flattenout void __asan_poison(uintptr_t p, size_t n, int kind) {
|
||||||
int k;
|
int k;
|
||||||
char *s;
|
char *s;
|
||||||
if (!n) return;
|
if (!n) return;
|
||||||
if (p & 7) {
|
if (UNLIKELY(p & 7)) {
|
||||||
k = MIN(8 - (p & 7), n);
|
k = MIN(8 - (p & 7), n);
|
||||||
s = SHADOW(p);
|
s = SHADOW(p);
|
||||||
if (*s == 0 || *s > (p & 7)) {
|
if (*s == 0 || *s > (p & 7)) {
|
||||||
|
@ -343,11 +344,11 @@ void __asan_poison(uintptr_t p, size_t n, int kind) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void __asan_unpoison(uintptr_t p, size_t n) {
|
flattenout void __asan_unpoison(uintptr_t p, size_t n) {
|
||||||
int k;
|
int k;
|
||||||
char *s;
|
char *s;
|
||||||
if (!n) return;
|
if (!n) return;
|
||||||
if (p & 7) {
|
if (UNLIKELY(p & 7)) {
|
||||||
k = MIN(8 - (p & 7), n);
|
k = MIN(8 - (p & 7), n);
|
||||||
s = SHADOW(p);
|
s = SHADOW(p);
|
||||||
*s = 0;
|
*s = 0;
|
||||||
|
|
|
@ -19,6 +19,5 @@
|
||||||
#include "libc/macros.h"
|
#include "libc/macros.h"
|
||||||
.source __FILE__
|
.source __FILE__
|
||||||
|
|
||||||
_start_xnu:
|
_xnu: ud2
|
||||||
ud2
|
.endfn _xnu,weak
|
||||||
.endfn _start_xnu,weak
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||||
|
#include "libc/bits/likely.h"
|
||||||
#include "libc/unicode/unicode.h"
|
#include "libc/unicode/unicode.h"
|
||||||
|
|
||||||
extern const uint8_t kEastAsianWidth[];
|
extern const uint8_t kEastAsianWidth[];
|
||||||
|
@ -26,15 +27,18 @@ extern const uint32_t kCombiningCharsBits;
|
||||||
/**
|
/**
|
||||||
* Returns cell width of monospace character.
|
* Returns cell width of monospace character.
|
||||||
*/
|
*/
|
||||||
int wcwidth(wchar_t ucs) {
|
int wcwidth(wchar_t c) {
|
||||||
if (ucs == 0) return 0;
|
if (LIKELY(32 <= c && c < 127)) {
|
||||||
if ((0 <= ucs && ucs < 32) || (0x7f <= ucs && ucs < 0xA0)) {
|
return 1;
|
||||||
return -1;
|
} else if (!c) {
|
||||||
} else if ((0 <= ucs && ucs < kCombiningCharsBits) &&
|
|
||||||
!!(kCombiningChars[ucs >> 3] & (1 << (ucs & 7)))) {
|
|
||||||
return 0;
|
return 0;
|
||||||
} else if (0 <= ucs && ucs < kEastAsianWidthBits) {
|
} else if ((0 < c && c < 32) || (0x7f <= c && c < 0xA0)) {
|
||||||
return 1 + !!(kEastAsianWidth[ucs >> 3] & (1 << (ucs & 7)));
|
return -1;
|
||||||
|
} else if ((0 <= c && c < kCombiningCharsBits) &&
|
||||||
|
!!(kCombiningChars[c >> 3] & (1 << (c & 7)))) {
|
||||||
|
return 0;
|
||||||
|
} else if (0 <= c && c < kEastAsianWidthBits) {
|
||||||
|
return 1 + !!(kEastAsianWidth[c >> 3] & (1 << (c & 7)));
|
||||||
} else {
|
} else {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,12 +127,17 @@ Flags & Keyboard Shortcuts:\n\
|
||||||
CTRL+L redraw [keyboard]\n\
|
CTRL+L redraw [keyboard]\n\
|
||||||
CTRL+Z suspend [keyboard]\n\
|
CTRL+Z suspend [keyboard]\n\
|
||||||
CTRL+C exit [keyboard]\n\
|
CTRL+C exit [keyboard]\n\
|
||||||
|
q quit [keyboard]\n\
|
||||||
\n\
|
\n\
|
||||||
Effects Shortcuts:\n\
|
Effects Shortcuts:\n\
|
||||||
\n\
|
\n\
|
||||||
H +Hue ALT+H -Hue\n\
|
S Toggle Swing (TV, PC)\n\
|
||||||
S +Saturation ALT+S -Saturation\n\
|
Y Toggle Black/White Mode\n\
|
||||||
L +Lightness ALT+L -Lightness\n\
|
p Toggle Primaries (BT.601, BT.709)\n\
|
||||||
|
g +Gamma G -Gamma\n\
|
||||||
|
l +Illumination L -Illumination\n\
|
||||||
|
k +LumaKernel K -LumaKernel\n\
|
||||||
|
j +ChromaKernel J -ChromaKernel\n\
|
||||||
CTRL-G {Unsharp,Sharp}\n\
|
CTRL-G {Unsharp,Sharp}\n\
|
||||||
\n\
|
\n\
|
||||||
Environment Variables:\n\
|
Environment Variables:\n\
|
||||||
|
@ -1018,6 +1023,7 @@ static optimizesize void ReadKeyboard(void) {
|
||||||
chromakernel_ = MOD(sgn + chromakernel_, ARRAYLEN(kMagkern));
|
chromakernel_ = MOD(sgn + chromakernel_, ARRAYLEN(kMagkern));
|
||||||
memcpy(g_magkern, kMagkern[chromakernel_], sizeof(kMagkern[0]));
|
memcpy(g_magkern, kMagkern[chromakernel_], sizeof(kMagkern[0]));
|
||||||
break;
|
break;
|
||||||
|
case 'q':
|
||||||
case CTRL('C'):
|
case CTRL('C'):
|
||||||
longjmp(jb_, 1);
|
longjmp(jb_, 1);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue