GNU PROLOG with UTF8 support
Data Structures | Macros | Typedefs | Functions | Variables
linedit.c File Reference
#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"
Include dependency graph for linedit.c:

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 CompNodecomp_start = NULL
 
static CompNodecomp_first_match
 
static CompNodecomp_last_match
 
static int comp_nb_match
 
static int comp_match_max_lg
 
static CompNodecomp_cur_match
 

Macro Definition Documentation

#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)
Value:
do { \
if (prompt && display_prompt) \
DISPL_STR(prompt); \
DISPL(end - str, str); \
ERASE(ers); \
if (prompt && display_prompt) \
DISPL_STR(prompt); \
DISPL(pos - str, str); \
} while(0)
#define GO_HOME
Definition: linedit.c:84
#define TREAT_BUFFERED_CHARS   /* treat buffered chars at start (X paste) */

Typedef Documentation

typedef struct comp_node CompNode

Function Documentation

static char * Completion_Do_Match ( char *  prefix,
int  prefix_length,
int *  rest_length 
)
static

Here is the caller graph for this function:

static void Completion_Print_All ( void  )
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void Display_Help ( void  )
static

Here is the caller graph for this function:

static void History_Add_Line ( char *  line,
int  length 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static int History_Get_Line ( char *  str,
int  hist_no 
)
static

Here is the caller graph for this function:

static void History_Update_Line ( char *  line,
int  length,
int  hist_no 
)
static

Here is the caller graph for this function:

static int Is_A_Separator ( char  c)
static

Here is the caller graph for this function:

static int New_Char ( int  c,
char *  str,
int  size,
char **  p_pos,
char **  p_end,
char *  prompt,
int  display_prompt 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

char* Pl_LE_Compl_Add_Word ( char *  word,
int  word_length 
)

Here is the caller graph for this function:

char* Pl_LE_Compl_Del_Word ( char *  word)
char* Pl_LE_Compl_Find_Match ( int *  is_last)

Here is the caller graph for this function:

char* Pl_LE_Compl_Init_Match ( char *  prefix,
int *  nb_match,
int *  max_lg 
)

Here is the call graph for this function:

Here is the caller graph for this function:

char* Pl_LE_FGets ( char *  str,
int  size,
char *  prompt,
int  display_prompt 
)

Here is the call graph for this function:

Here is the caller graph for this function:

PlLong Pl_LE_Get_Ctrl_C_Return_Value ( void  )

Here is the caller graph for this function:

int Pl_LE_Get_Current_Position ( void  )

Here is the caller graph for this function:

void Pl_LE_Get_Current_Word ( char *  word)

Here is the call graph for this function:

Here is the caller graph for this function:

CHAR32_T Pl_LE_Get_Key ( int  echo,
int  catch_ctrl_c 
)

Here is the call graph for this function:

Here is the caller graph for this function:

int Pl_LE_Get_Prompt_Length ( void  )

Here is the caller graph for this function:

char* Pl_LE_Get_Separators ( void  )

Here is the caller graph for this function:

char* Pl_LE_Gets ( char *  str)

Here is the call graph for this function:

Here is the caller graph for this function:

int Pl_LE_Printf ( char *  format,
  ... 
)

Here is the call graph for this function:

char* Pl_LE_Set_Separators ( char *  sep_str)
static int Search_Bracket ( char *  brackets,
char  c 
)
static

Here is the caller graph for this function:

static char * Skip ( char *  from,
char *  limit,
int  res_sep_cmp,
int  direction 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static int Tab_To_Spaces ( int  p)
static

Here is the caller graph for this function:

Variable Documentation

char clipboard[4096] = ""
static
CompNode* comp_cur_match
static
CompNode* comp_first_match
static
CompNode* comp_last_match
static
int comp_match_max_lg
static
int comp_nb_match
static
CompNode* comp_start = NULL
static
PlLong ctrl_c_ret_val
static
char* global_end
static
char* global_pos
static
char* global_str
static
int hist_end = 0
static
int hist_start = 0
static
HistCell hist_tbl[MAX_HISTORY_LINES]
static
int ins_mode = 1
static
int prompt_length
static
char separators[MAX_SEPARATORS] = DEFAULT_SEPARATORS
static