#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include "automaton.h"
#include "internal.h"
#include "unixsig.h"
#include "render.h"
#include "in.h"
Go to the source code of this file.
|
void | sigwinch_handler (int signo) |
|
int | ncinput_shovel (inputctx *ictx, const void *buf, int len) |
|
int | init_inputlayer (tinfo *ti, FILE *infp, int lmargin, int tmargin, int rmargin, int bmargin, ncsharedstats *stats, unsigned drain, int linesigs_enabled) |
|
int | stop_inputlayer (tinfo *ti) |
|
int | inputready_fd (const inputctx *ictx) |
|
uint32_t | notcurses_get (notcurses *nc, const struct timespec *absdl, ncinput *ni) |
|
int | notcurses_getvec (notcurses *n, const struct timespec *absdl, ncinput *ni, int vcount) |
|
uint32_t | ncdirect_get (ncdirect *n, const struct timespec *absdl, ncinput *ni) |
|
int | get_cursor_location (inputctx *ictx, const char *u7, unsigned *y, unsigned *x) |
|
int | notcurses_linesigs_disable (notcurses *nc) |
|
int | notcurses_linesigs_enable (notcurses *n) |
|
struct initial_responses * | inputlayer_get_responses (inputctx *ictx) |
|
◆ cursorloc
◆ inputctx
◆ ipipe
Definition at line 46 of file in.c.
◆ get_cursor_location()
int get_cursor_location |
( |
inputctx * |
ictx, |
|
|
const char * |
u7, |
|
|
unsigned * |
y, |
|
|
unsigned * |
x |
|
) |
| |
Definition at line 2785 of file in.c.
2785 {
2786 pthread_mutex_lock(&ictx->
clock);
2787 while(ictx->
cvalid == 0){
2789 if(tty_emit(u7, ictx->
ti->
ttyfd)){
2790 pthread_mutex_unlock(&ictx->
clock);
2791 return -1;
2792 }
2794 }
2795 pthread_cond_wait(&ictx->
ccond, &ictx->
clock);
2796 }
2800 }
2804 }
2807 }
2808 pthread_mutex_unlock(&ictx->
clock);
2809 return 0;
2810}
◆ init_inputlayer()
int init_inputlayer |
( |
tinfo * |
ti, |
|
|
FILE * |
infp, |
|
|
int |
lmargin, |
|
|
int |
tmargin, |
|
|
int |
rmargin, |
|
|
int |
bmargin, |
|
|
ncsharedstats * |
stats, |
|
|
unsigned |
drain, |
|
|
int |
linesigs_enabled |
|
) |
| |
Definition at line 2627 of file in.c.
2629 {
2630 inputctx* ictx = create_inputctx(ti, infp, lmargin, tmargin, rmargin,
2631 bmargin, stats, drain, linesigs_enabled);
2633 return -1;
2634 }
2635 if(pthread_create(&ictx->
tid,
NULL, input_thread, ictx)){
2636 free_inputctx(ictx);
2637 return -1;
2638 }
2640 loginfo(
"spun up input thread");
2641 return 0;
2642}
◆ inputlayer_get_responses()
Definition at line 2896 of file in.c.
2896 {
2898 pthread_mutex_lock(&ictx->
ilock);
2900 pthread_cond_wait(&ictx->
icond, &ictx->
ilock);
2901 }
2904 pthread_mutex_unlock(&ictx->
ilock);
2906 logpanic(
"aborting after automaton construction failure");
2909 }
2910 return iresp;
2911}
#define logpanic(fmt,...)
◆ inputready_fd()
int inputready_fd |
( |
const inputctx * |
ictx | ) |
|
Definition at line 2661 of file in.c.
2661 {
2662#ifndef __MINGW32__
2664#else
2665 (void)ictx;
2666 logerror(
"readiness descriptor unavailable on windows");
2667 return -1;
2668#endif
2669}
#define logerror(fmt,...)
◆ ncdirect_get()
uint32_t ncdirect_get |
( |
ncdirect * |
n, |
|
|
const struct timespec * |
absdl, |
|
|
ncinput * |
ni |
|
) |
| |
Definition at line 2773 of file in.c.
2773 {
2776 return -1;
2777 }
2778 uint32_t
r = internal_get(
n->tcache.ictx, absdl, ni);
2781 }
2783}
◆ ncinput_shovel()
int ncinput_shovel |
( |
inputctx * |
ictx, |
|
|
const void * |
buf, |
|
|
int |
len |
|
) |
| |
Definition at line 2463 of file in.c.
2463 {
2464 process_melange(ictx, buf, &
len);
2467 inc_input_errors(ictx);
2468 }
2469 return 0;
2470}
API int API int const nccell unsigned len
◆ notcurses_get()
uint32_t notcurses_get |
( |
notcurses * |
nc, |
|
|
const struct timespec * |
absdl, |
|
|
ncinput * |
ni |
|
) |
| |
Definition at line 2751 of file in.c.
2751 {
2752 uint32_t ret = internal_get(nc->
tcache.
ictx, absdl, ni);
2753 return ret;
2754}
◆ notcurses_getvec()
int notcurses_getvec |
( |
notcurses * |
n, |
|
|
const struct timespec * |
absdl, |
|
|
ncinput * |
ni, |
|
|
int |
vcount |
|
) |
| |
Definition at line 2757 of file in.c.
2758 {
2759 for(
int v = 0 ;
v < vcount ; ++
v){
2761 if(u == (uint32_t)-1){
2763 return -1;
2764 }
2766 }else if(u == 0){
2768 }
2769 }
2770 return vcount;
2771}
uint32_t notcurses_get(notcurses *nc, const struct timespec *absdl, ncinput *ni)
struct ncvisual_options v
◆ notcurses_linesigs_disable()
int notcurses_linesigs_disable |
( |
notcurses * |
nc | ) |
|
Definition at line 2850 of file in.c.
2850 {
2851 return linesigs_disable(&nc->
tcache);
2852}
◆ notcurses_linesigs_enable()
int notcurses_linesigs_enable |
( |
notcurses * |
n | ) |
|
Definition at line 2892 of file in.c.
2892 {
2893 return linesigs_enable(&
n->tcache);
2894}
◆ sigwinch_handler()
void sigwinch_handler |
( |
int |
signo | ) |
|
Definition at line 31 of file in.c.
31 {
32 if(signo == SIGWINCH){
33 resize_seen = signo;
35 }else if(signo == SIGCONT){
36 cont_seen = signo;
38 }
39}
sig_atomic_t sigcont_seen_for_render
◆ stop_inputlayer()
int stop_inputlayer |
( |
tinfo * |
ti | ) |
|
Definition at line 2644 of file in.c.
2644 {
2645 int ret = 0;
2646 if(ti){
2647
2648#ifndef __MINGW32__
2650 loginfo(
"tearing down input thread");
2651 ret |= cancel_and_join(
"input", ti->
ictx->
tid,
NULL);
2653 free_inputctx(ti->
ictx);
2655 }
2656#endif
2657 }
2658 return ret;
2659}
int set_fd_nonblocking(int fd, unsigned state, unsigned *oldstate)
unsigned stdio_blocking_save