17 #define READLINE_STATIC
28 #if defined(HAVE_DYN_RL)
33 char * (*fe_fgets_stdin)(
const char *pr,
char *
s,
int size)
41 #if defined(HAVE_READLINE) || defined(HAVE_DYN_RL) || defined(HAVE_LIBREADLINE)
44 #define STDOUT_FILENO 1
55 static int list_index, len;
74 if (strncmp (name, text, len) == 0)
83 if (strncmp (name, text, len) == 0)
88 return ((
char *)
NULL);
96 #if (defined(HAVE_READLINE) || defined(HAVE_LIBREADLINE) || defined(HAVE_DYN_RL))
100 #include <sys/types.h>
101 #include <sys/file.h>
102 #include <sys/stat.h>
103 #include <sys/errno.h>
108 typedef char * (*RL_PROC)(
const char*,int);
109 #ifdef READLINE_READLINE_H_OK
110 #include <readline/readline.h>
111 #ifdef HAVE_READLINE_HISTORY_H
112 #include <readline/history.h>
116 #ifdef RL_VERSION_MAJOR
117 #if (RL_VERSION_MAJOR >= 4)
118 #define USE_READLINE4
122 #ifndef USE_READLINE4
123 #define rl_filename_completion_function filename_completion_function
124 #define rl_completion_matches completion_matches
126 #ifndef READLINE_READLINE_H_OK
136 extern char *
readline (
const char *);
144 typedef char * (*PROC)();
160 #if defined(HAVE_DYN_RL)
164 char *(*fe_filename_completion_function)();
165 char *(* fe_readline) (
char *);
169 char **(*fe_completion_matches)(...);
185 #define x_rl_line_buffer (*fe_rl_line_buffer)
186 #define x_rl_completion_matches (*fe_completion_matches)
187 #define x_rl_filename_completion_function (*fe_filename_completion_function)
189 #define x_rl_line_buffer rl_line_buffer
190 #define x_rl_completion_matches rl_completion_matches
191 #define x_rl_filename_completion_function rl_filename_completion_function
196 #undef x_rl_line_buffer
197 #undef x_rl_completion_matches
200 m=(
char **)
malloc(2*
sizeof(
char*));
201 m[0]=(
char *)
malloc(end-start+2);
202 strncpy(m[0],text,end-start+1);
224 for (
int i=l-1;
i>=0;
i--) line[
i]=line[
i]&127;
232 strncpy(s,line,size);
250 #if !defined(HAVE_READLINE) && defined(HAVE_FEREAD)
269 #if defined(HAVE_DYN_RL)
279 line = (*fe_readline) ((
char*)pr);
285 for (
int i=l-1;
i>=0;
i--) line[
i]=line[
i]&127;
289 (*fe_add_history) (line);
293 strncpy(s,line,size);
314 fprintf(stdout,
"%s",pr);
317 char *line=fgets(s,size,stdin);
319 for (
int i=strlen(line)-1;
i>=0;
i--) line[
i]=line[
i]&127;
328 #if (defined(HAVE_READLINE) || defined(HAVE_LIBREADLINE)) && !defined(HAVE_DYN_RL) && !defined(HAVE_FEREAD)
350 char *
p =
getenv(
"SINGULARHIST");
368 Warn(
"dynamic loading failed: %d\n",res);
383 (*fe_using_history)();
384 char *p =
getenv(
"SINGULARHIST");
387 (*fe_read_history) (
p);
404 #if !defined(HAVE_READLINE) && defined(HAVE_FEREAD)
char ** fe_rl_line_buffer
const CanonicalForm int s
char *(* fe_fgets_stdin)(const char *pr, char *s, int size)
void(* fe_add_history)(char *)
char * command_generator(char *text, int state)
CPPFunction * rl_attempted_completion_function
void(* fe_using_history)()
#define x_rl_filename_completion_function
char * fe_fgets(const char *pr, char *s, int size)
char * fe_fgets_dummy(const char *, char *, int)
char * fe_fgets_stdin_fe(const char *pr, char *s, int size)
static char * fe_fgets_stdin_init(const char *pr, char *s, int size)
#define rl_completion_matches
char * readline(const char *)
int history_total_bytes()
char * fe_fgets_stdin_rl(const char *pr, char *s, int size)
char * fe_fgets_stdin_emu(const char *pr, char *s, int size)
char * iiArithGetCmd(int)
void * malloc(size_t size)
char ** singular_completion(char *text, int start, int end)
int(* fe_write_history)()
char name(const Variable &v)
char *(* RL_PROC)(const char *, int)
CPPFunction ** fe_rl_attempted_completion_function
int(* fe_history_total_bytes)()
int(* fe_read_history)(char *)
char * fe_fgets_stdin_drl(const char *pr, char *s, int size)
char ** fe_rl_readline_name
#define x_rl_completion_matches
#define rl_filename_completion_function
char ** RL_CPPFunction(const char *, int, int)