![]() |
GNU PROLOG with UTF8 support
|
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <ctype.h>
#include <string.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "../EnginePl/gp_config.h"
#include "terminal.h"
#include "ctrl_c.h"
#include "linedit.h"
Data Structures | |
struct | HistCell |
struct | comp_node |
Macros | |
#define | LE_DEFINE_HOOK_MACROS |
#define | TREAT_BUFFERED_CHARS /* treat buffered chars at start (X paste) */ |
#define | NO_DUP_IN_HISTORY /* do not put in history line == the last */ |
#define | IGNORE_QUOTED_PART /* ingore quoted item in bracket matching */ |
#define | GO_HOME PUT_CHAR('\r') |
#define | LINEDIT_VERSION "2.5" |
#define | MAX_HISTORY_LINES 64 |
#define | MAX_SEPARATORS 256 |
#define | NB_TAB_BEFORE_LIST 1 |
#define | DEFAULT_SEPARATORS " ,;:-'\"!@$#^&()-+*/\\[]|<=>`~{}" |
#define | NB_MATCH_LINES_BEFORE_ASK 20 |
#define | OPEN_BRACKET "([{" |
#define | CLOSE_BRACKET ")]}" |
#define | BRACKET_TIMMING 900000 /* in microseconds */ |
#define | NewLn() { PUT_CHAR('\n'); } |
#define | Hist_Inc(n) { if (++(n) >= MAX_HISTORY_LINES) (n) = 0; } |
#define | Hist_Dec(n) { if (--(n) < 0) (n) = MAX_HISTORY_LINES - 1; } |
#define | Hist_First(n) { (n) = Hist_Start_Entry(); } |
#define | Hist_Last(n) { (n) = Hist_End_Entry(); } |
#define | Hist_Start_Entry() (hist_start) |
#define | Hist_End_Entry() (hist_end) |
#define | Hist_Is_Empty() (hist_start == hist_end) |
#define | RE_DISPLAY_LINE(ers) |
#define | L(msg) DISPL_STR(msg); NewLn() |
Typedefs | |
typedef struct comp_node | CompNode |
Functions | |
static int | New_Char (int c, char *str, int size, char **p_pos, char **p_end, char *prompt, int display_prompt) |
static char * | Skip (char *from, char *limit, int res_sep_cmp, int direction) |
static int | Is_A_Separator (char c) |
static int | Search_Bracket (char *brackets, char c) |
static int | Tab_To_Spaces (int p) |
static void | History_Add_Line (char *line, int length) |
static void | History_Update_Line (char *line, int length, int hist_no) |
static int | History_Get_Line (char *str, int hist_no) |
static char * | Completion_Do_Match (char *prefix, int prefix_length, int *rest_length) |
static void | Completion_Print_All (void) |
static void | Display_Help (void) |
char * | Pl_LE_Gets (char *str) |
char * | Pl_LE_FGets (char *str, int size, char *prompt, int display_prompt) |
int | Pl_LE_Get_Prompt_Length (void) |
int | Pl_LE_Get_Current_Position (void) |
void | Pl_LE_Get_Current_Word (char *word) |
char * | Pl_LE_Get_Separators (void) |
char * | Pl_LE_Set_Separators (char *sep_str) |
PlLong | Pl_LE_Get_Ctrl_C_Return_Value (void) |
char * | Pl_LE_Compl_Add_Word (char *word, int word_length) |
char * | Pl_LE_Compl_Del_Word (char *word) |
char * | Pl_LE_Compl_Init_Match (char *prefix, int *nb_match, int *max_lg) |
char * | Pl_LE_Compl_Find_Match (int *is_last) |
CHAR32_T | Pl_LE_Get_Key (int echo, int catch_ctrl_c) |
int | Pl_LE_Printf (char *format,...) |
Variables | |
static char | separators [MAX_SEPARATORS] = DEFAULT_SEPARATORS |
static int | ins_mode = 1 |
static char * | global_str |
static char * | global_pos |
static char * | global_end |
static int | prompt_length |
static PlLong | ctrl_c_ret_val |
static char | clipboard [4096] = "" |
static HistCell | hist_tbl [MAX_HISTORY_LINES] |
static int | hist_start = 0 |
static int | hist_end = 0 |
static CompNode * | comp_start = NULL |
static CompNode * | comp_first_match |
static CompNode * | comp_last_match |
static int | comp_nb_match |
static int | comp_match_max_lg |
static CompNode * | comp_cur_match |
#define BRACKET_TIMMING 900000 /* in microseconds */ |
#define CLOSE_BRACKET ")]}" |
#define DEFAULT_SEPARATORS " ,;:-'\"!@$#^&()-+*/\\[]|<=>`~{}" |
#define GO_HOME PUT_CHAR('\r') |
#define Hist_Dec | ( | n | ) | { if (--(n) < 0) (n) = MAX_HISTORY_LINES - 1; } |
#define Hist_End_Entry | ( | ) | (hist_end) |
#define Hist_First | ( | n | ) | { (n) = Hist_Start_Entry(); } |
#define Hist_Inc | ( | n | ) | { if (++(n) >= MAX_HISTORY_LINES) (n) = 0; } |
#define Hist_Is_Empty | ( | ) | (hist_start == hist_end) |
#define Hist_Last | ( | n | ) | { (n) = Hist_End_Entry(); } |
#define Hist_Start_Entry | ( | ) | (hist_start) |
#define IGNORE_QUOTED_PART /* ingore quoted item in bracket matching */ |
#define L | ( | msg | ) | DISPL_STR(msg); NewLn() |
#define LE_DEFINE_HOOK_MACROS |
#define LINEDIT_VERSION "2.5" |
#define MAX_HISTORY_LINES 64 |
#define MAX_SEPARATORS 256 |
#define NB_MATCH_LINES_BEFORE_ASK 20 |
#define NB_TAB_BEFORE_LIST 1 |
#define NewLn | ( | ) | { PUT_CHAR('\n'); } |
#define NO_DUP_IN_HISTORY /* do not put in history line == the last */ |
#define OPEN_BRACKET "([{" |
#define RE_DISPLAY_LINE | ( | ers | ) |
#define TREAT_BUFFERED_CHARS /* treat buffered chars at start (X paste) */ |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
char* Pl_LE_Compl_Add_Word | ( | char * | word, |
int | word_length | ||
) |
char* Pl_LE_Compl_Del_Word | ( | char * | word | ) |
char* Pl_LE_Compl_Find_Match | ( | int * | is_last | ) |
char* Pl_LE_Compl_Init_Match | ( | char * | prefix, |
int * | nb_match, | ||
int * | max_lg | ||
) |
char* Pl_LE_FGets | ( | char * | str, |
int | size, | ||
char * | prompt, | ||
int | display_prompt | ||
) |
PlLong Pl_LE_Get_Ctrl_C_Return_Value | ( | void | ) |
int Pl_LE_Get_Current_Position | ( | void | ) |
void Pl_LE_Get_Current_Word | ( | char * | word | ) |
CHAR32_T Pl_LE_Get_Key | ( | int | echo, |
int | catch_ctrl_c | ||
) |
int Pl_LE_Get_Prompt_Length | ( | void | ) |
char* Pl_LE_Get_Separators | ( | void | ) |
char* Pl_LE_Gets | ( | char * | str | ) |
int Pl_LE_Printf | ( | char * | format, |
... | |||
) |
char* Pl_LE_Set_Separators | ( | char * | sep_str | ) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |