![]() | ![]() | ![]() | Cuiterm Reference Manual | ![]() |
---|
#include <history.h> enum TerminalStatus; Terminal; Terminal* terminal_new (GtkTextView *text_view); void terminal_apply_tag (Terminal *t, gchar *tag, GtkTextMark *mbegin, GtkTextMark *mend); gint terminal_send_command (Terminal *t, gchar *command, gboolean send); gint terminal_get_token_marks (Terminal *terminal, char *token, GtkTextMark **mbegin, GtkTextMark **mend); int terminal_get_char (Terminal *t, char *buf, int max_size); const gchar* terminal_get_working_directory (Terminal *terminal);
typedef enum { TermUninitialized, TermReady, TermSendingCommand, TermSendingUserEnter, TermExecuting, TermLocked } TerminalStatus;
TermUninitialized | the first prompt did not came yet |
TermReady | the terminal is ready, we have a prompt |
TermSendingCommand | sending a generated command |
TermSendingUserEnter | the user hit the Enter key |
TermExecuting | the terminal is executing a command |
TermLocked |
typedef struct { GtkTextBuffer *text_buffer; GtkTextView *text_view; Background *background; CuiGenerator *command_generator; GtkTextMark *parser_cursor; GtkTextMark *lexer_cursor; GtkTextMark *command_begin_cursor; GtkTextMark *command_end_cursor; /* This is not handled yet*/ gint parsed_chars; GString *command; /* The last command we executed. */ gchar *current_command; /* The command we are editing. */ GNode *parse_tree; GString *cmd; GString *wd; GString *username; GString *hostname; GString *directory; gint prompt_length; gboolean executing; GList *pending_commands; GIOChannel *shell_stream; struct CuiWidget *last_command_window; TerminalStatus status; gint hold_shift; gboolean overwrite; } Terminal;
GtkTextBuffer *text_buffer ; | the GtkTextBuffer holding the text |
GtkTextView *text_view ; | the GtkTextView holding the terminal text |
Background *background ; | the background for this terminal |
CuiGenerator *command_generator ; | the generator for this terminal |
GtkTextMark *parser_cursor ; | FIXME |
GtkTextMark *lexer_cursor ; | the point where the lexer reads the terminal |
GtkTextMark *command_begin_cursor ; | |
GtkTextMark *command_end_cursor ; | |
gint parsed_chars ; | how many characters has been parsed |
GString *command ; | the command the user editing |
gchar *current_command ; | |
GNode *parse_tree ; | the parse tree for the last BASH command |
GString *cmd ; | FIXME |
GString *wd ; | the name of the working directory |
GString *username ; | data from the prompt |
GString *hostname ; | the hostname part of the prompt |
GString *directory ; | the directory part of the prompt |
gint prompt_length ; | the length of the actual prompt in characters |
gboolean executing ; | TRUE while the terminal is executing a command |
GList *pending_commands ; | more commands to execute if ready |
GIOChannel *shell_stream ; | the stream we use to communicate with the shell |
struct CuiWidget *last_command_window ; | the last embedded window |
TerminalStatus status ; | |
gint hold_shift ; | are user press the shift key (in keyboard) |
gboolean overwrite ; |
void terminal_apply_tag (Terminal *t, gchar *tag, GtkTextMark *mbegin, GtkTextMark *mend);
t : | |
tag : | |
mbegin : | |
mend : |
|
gint terminal_send_command (Terminal *t, gchar *command, gboolean send);
Emits a command to the terminal.
t : | |
command : | |
send : | |
Returns : |
|
gint terminal_get_token_marks (Terminal *terminal, char *token, GtkTextMark **mbegin, GtkTextMark **mend);
terminal : | |
token : | |
mbegin : | |
mend : | |
Returns : |
|
int terminal_get_char (Terminal *t, char *buf, int max_size);
t : | |
buf : | |
max_size : | |
Returns : |
|
const gchar* terminal_get_working_directory (Terminal *terminal);
Returns the name of the current working directory from the BASH prompt. The memory area returned should not be tampered.
terminal : | a Terminal |
Returns : | the name of the current working directory |
<<< CuiTerminal | Background >>> |