mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 03:27:39 +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 # r14
|
||||
.quad 0 # r15
|
||||
.quad _start_xnu # rip
|
||||
.quad _xnu # rip
|
||||
.quad 0 # rflags
|
||||
.quad 0 # cs
|
||||
.quad 0 # fs
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#define COSMOPOLITAN_LIBC_BITS_LIKELY_H_
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
|
||||
#define likely(expr) __builtin_expect(!!(expr), 1)
|
||||
#define unlikely(expr) __builtin_expect(!!(expr), 0)
|
||||
#define LIKELY(expr) __builtin_expect(!!(expr), 1)
|
||||
#define UNLIKELY(expr) __builtin_expect(!!(expr), 0)
|
||||
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
#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,..]
|
||||
/ @note FreeBSD is special (see freebsd/lib/csu/amd64/...)
|
||||
/ @noreturn
|
||||
_start_xnu:
|
||||
movb $XNU,__hostos(%rip)
|
||||
_xnu: movb $XNU,__hostos(%rip)
|
||||
jmp 0b
|
||||
.endfn _start_xnu,weak,hidden
|
||||
.endfn _xnu,weak,hidden
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/alg/reverse.h"
|
||||
#include "libc/bits/bits.h"
|
||||
#include "libc/bits/likely.h"
|
||||
#include "libc/bits/weaken.h"
|
||||
#include "libc/calls/calls.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);
|
||||
}
|
||||
|
||||
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;
|
||||
char *s;
|
||||
if (!n) return;
|
||||
if (p & 7) {
|
||||
if (UNLIKELY(p & 7)) {
|
||||
k = MIN(8 - (p & 7), n);
|
||||
s = SHADOW(p);
|
||||
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;
|
||||
char *s;
|
||||
if (!n) return;
|
||||
if (p & 7) {
|
||||
if (UNLIKELY(p & 7)) {
|
||||
k = MIN(8 - (p & 7), n);
|
||||
s = SHADOW(p);
|
||||
*s = 0;
|
||||
|
|
|
@ -19,6 +19,5 @@
|
|||
#include "libc/macros.h"
|
||||
.source __FILE__
|
||||
|
||||
_start_xnu:
|
||||
ud2
|
||||
.endfn _start_xnu,weak
|
||||
_xnu: ud2
|
||||
.endfn _xnu,weak
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/bits/likely.h"
|
||||
#include "libc/unicode/unicode.h"
|
||||
|
||||
extern const uint8_t kEastAsianWidth[];
|
||||
|
@ -26,15 +27,18 @@ extern const uint32_t kCombiningCharsBits;
|
|||
/**
|
||||
* Returns cell width of monospace character.
|
||||
*/
|
||||
int wcwidth(wchar_t ucs) {
|
||||
if (ucs == 0) return 0;
|
||||
if ((0 <= ucs && ucs < 32) || (0x7f <= ucs && ucs < 0xA0)) {
|
||||
return -1;
|
||||
} else if ((0 <= ucs && ucs < kCombiningCharsBits) &&
|
||||
!!(kCombiningChars[ucs >> 3] & (1 << (ucs & 7)))) {
|
||||
int wcwidth(wchar_t c) {
|
||||
if (LIKELY(32 <= c && c < 127)) {
|
||||
return 1;
|
||||
} else if (!c) {
|
||||
return 0;
|
||||
} else if (0 <= ucs && ucs < kEastAsianWidthBits) {
|
||||
return 1 + !!(kEastAsianWidth[ucs >> 3] & (1 << (ucs & 7)));
|
||||
} else if ((0 < c && c < 32) || (0x7f <= c && c < 0xA0)) {
|
||||
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 {
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -127,12 +127,17 @@ Flags & Keyboard Shortcuts:\n\
|
|||
CTRL+L redraw [keyboard]\n\
|
||||
CTRL+Z suspend [keyboard]\n\
|
||||
CTRL+C exit [keyboard]\n\
|
||||
q quit [keyboard]\n\
|
||||
\n\
|
||||
Effects Shortcuts:\n\
|
||||
\n\
|
||||
H +Hue ALT+H -Hue\n\
|
||||
S +Saturation ALT+S -Saturation\n\
|
||||
L +Lightness ALT+L -Lightness\n\
|
||||
S Toggle Swing (TV, PC)\n\
|
||||
Y Toggle Black/White Mode\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\
|
||||
\n\
|
||||
Environment Variables:\n\
|
||||
|
@ -1018,6 +1023,7 @@ static optimizesize void ReadKeyboard(void) {
|
|||
chromakernel_ = MOD(sgn + chromakernel_, ARRAYLEN(kMagkern));
|
||||
memcpy(g_magkern, kMagkern[chromakernel_], sizeof(kMagkern[0]));
|
||||
break;
|
||||
case 'q':
|
||||
case CTRL('C'):
|
||||
longjmp(jb_, 1);
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue