ELinks 0.18.0
terminal.h File Reference
#include "config/options.h"
#include "protocol/uri.h"
#include "terminal/event.h"
#include "util/lists.h"
Include dependency graph for terminal.h:

Data Structures

struct  terminal
 This is one of the axis of ELinks' user interaction. More...

Macros

#define do_not_ignore_next_mouse_event(term)

Typedefs

typedef int term_mode_type_T
typedef int term_env_type_T
typedef int term_exec_T

Enumerations

enum  term_mode_type {
  TERM_DUMB = 0 , TERM_VT100 , TERM_LINUX , TERM_KOI8 ,
  TERM_FREEBSD , TERM_FBTERM
}
 The terminal type, meaningful for frames (lines) drawing. More...
enum  term_env_type {
  ENV_CONSOLE = 1 , ENV_XWIN = 2 , ENV_SCREEN = 4 , ENV_OS2VIO = 8 ,
  ENV_BE = 16 , ENV_TWIN = 32 , ENV_WIN32 = 64 , ENV_ANY = ~0
}
 This is a bitmask describing the environment we are living in, terminal-wise. More...
enum  term_redrawing_state { TREDRAW_READY = 0 , TREDRAW_BUSY = 1 , TREDRAW_DELAYED = 2 }
enum  { TERM_FN_TITLE = 1 , TERM_FN_RESIZE = 2 , TERM_FN_TITLE_CODEPAGE = 3 }
 Operations that can be requested with do_terminal_function() in the master and then executed with dispatch_special() in a slave. More...
enum  term_exec { TERM_EXEC_BG = 0 , TERM_EXEC_FG = 1 , TERM_EXEC_NEWWIN = 2 }
 How to execute a program in a terminal. More...

Functions

struct terminalinit_term (int, int)
void destroy_terminal (struct terminal *)
void redraw_terminal (struct terminal *term)
void redraw_terminal_cls (struct terminal *term)
void cls_redraw_all_terminals (void)
struct terminalget_default_terminal (void)
 Get the terminal in which message boxes should be displayed, if there is no specific reason to use some other terminal.
int get_terminal_codepage (const struct terminal *)
 Get the codepage of a terminal.
void redraw_all_terminals (void)
void destroy_all_terminals (void)
void exec_thread (char *, int)
void close_handle (void *)
void clean_temporary_files (void)
long get_number_of_temporary_files (void)
void assert_terminal_ptr_not_dangling (const struct terminal *)
void exec_on_terminal (struct terminal *, const char *, const char *, term_exec_T)
void exec_shell (struct terminal *term)
int set_terminal_title (struct terminal *, char *)
void do_terminal_function (struct terminal *, unsigned char, const char *)
int check_terminal_pipes (void)
void close_terminal_pipes (void)
struct terminalattach_terminal (int in, int out, int ctl, void *info, int len)

Variables

pid_t master_pid
struct terminal list terminals
 We keep track about all the terminals in this list.
const unsigned char frame_dumb []
 Mapping from (enum border_char - 0xB0) to ASCII characters.
struct module terminal_module

Macro Definition Documentation

◆ do_not_ignore_next_mouse_event

#define do_not_ignore_next_mouse_event ( term)
Value:
memset(&(term)->prev_mouse_event, 0, sizeof((term)->prev_mouse_event))

Typedef Documentation

◆ term_env_type_T

typedef int term_env_type_T

◆ term_exec_T

typedef int term_exec_T

◆ term_mode_type_T

typedef int term_mode_type_T

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Operations that can be requested with do_terminal_function() in the master and then executed with dispatch_special() in a slave.

The interlink protocol passes these values as one byte in a null-terminated string, so zero cannot be used.

Enumerator
TERM_FN_TITLE 
TERM_FN_RESIZE 
TERM_FN_TITLE_CODEPAGE 

◆ term_env_type

This is a bitmask describing the environment we are living in, terminal-wise.

We can then conditionally use various features available in such an environment.

Enumerator
ENV_CONSOLE 

This basically means that we can use the text i/o :).

Always set.

ENV_XWIN 

We are running in a xterm-compatible box in some windowing environment.

ENV_SCREEN 

We are running under a screen.

ENV_OS2VIO 

We are running in a OS/2 VIO terminal.

ENV_BE 

BeOS text terminal.

ENV_TWIN 

We live in a TWIN text-mode windowing environment.

ENV_WIN32 

Microsoft Windows cmdline thing.

ENV_ANY 

Match all terminal environments.

◆ term_exec

enum term_exec

How to execute a program in a terminal.

These values are used in the interlink protocol and must fit in one byte.

Enumerator
TERM_EXEC_BG 

Execute in the background.

ELinks keeps using the terminal and the program should not use it.

TERM_EXEC_FG 

Execute in the foreground.

The program may use the terminal. ELinks will redraw when the program exits.

TERM_EXEC_NEWWIN 

Execute in the background and in a new process group.

◆ term_mode_type

The terminal type, meaningful for frames (lines) drawing.

Enumerator
TERM_DUMB 
TERM_VT100 
TERM_LINUX 
TERM_KOI8 
TERM_FREEBSD 
TERM_FBTERM 

◆ term_redrawing_state

Enumerator
TREDRAW_READY 

Can redraw.

TREDRAW_BUSY 

Redrawing already in progress.

TREDRAW_DELAYED 

Do not redraw for now.

Function Documentation

◆ assert_terminal_ptr_not_dangling()

void assert_terminal_ptr_not_dangling ( const struct terminal * suspect)

◆ attach_terminal()

struct terminal * attach_terminal ( int in,
int out,
int ctl,
void * info,
int len )

◆ check_terminal_pipes()

int check_terminal_pipes ( void )

◆ clean_temporary_files()

void clean_temporary_files ( void )

◆ close_handle()

void close_handle ( void * h)

◆ close_terminal_pipes()

void close_terminal_pipes ( void )

◆ cls_redraw_all_terminals()

void cls_redraw_all_terminals ( void )

◆ destroy_all_terminals()

void destroy_all_terminals ( void )

◆ destroy_terminal()

void destroy_terminal ( struct terminal * term)

◆ do_terminal_function()

void do_terminal_function ( struct terminal * term,
unsigned char code,
const char * data )

◆ exec_on_terminal()

void exec_on_terminal ( struct terminal * term,
const char * path,
const char * delete_,
term_exec_T fg )

◆ exec_shell()

void exec_shell ( struct terminal * term)

◆ exec_thread()

void exec_thread ( char * path,
int p )

◆ get_default_terminal()

struct terminal * get_default_terminal ( void )

Get the terminal in which message boxes should be displayed, if there is no specific reason to use some other terminal.

This returns NULL if all terminals have been closed. (ELinks keeps running anyway if ui.sessions.keep_session_active is true.)

◆ get_number_of_temporary_files()

long get_number_of_temporary_files ( void )

◆ get_terminal_codepage()

int get_terminal_codepage ( const struct terminal * term)

Get the codepage of a terminal.

The UTF-8 I/O option does not affect this.

Todo
Perhaps cache the value in struct terminal?
Bug
Bug 1064: If the charset has been set as "System", this should apply the locale environment variables of the slave ELinks process, not those of the master ELinks process that parsed the configuration file. That is why the parameter points to struct terminal and not merely to its option tree (term->spec).
See also
get_translation_table(), get_cp_mime_name()

◆ init_term()

struct terminal * init_term ( int fdin,
int fdout )

◆ redraw_all_terminals()

void redraw_all_terminals ( void )

◆ redraw_terminal()

void redraw_terminal ( struct terminal * term)

◆ redraw_terminal_cls()

void redraw_terminal_cls ( struct terminal * term)

◆ set_terminal_title()

int set_terminal_title ( struct terminal * term,
char * title )
Returns
negative on error; zero or positive on success.

Variable Documentation

◆ frame_dumb

const unsigned char frame_dumb[]
extern

Mapping from (enum border_char - 0xB0) to ASCII characters.

◆ master_pid

pid_t master_pid
extern

◆ terminal_module

struct module terminal_module
extern

◆ terminals

struct terminal list terminals
extern

We keep track about all the terminals in this list.

The list is sorted so that terminals.next is the terminal from which ELinks most recently got an event. But please call get_default_terminal() for that.