19#define READLINE_STATIC
27#if defined(HAVE_DYN_RL)
32char * (*fe_fgets_stdin)(
const char *pr,
char *
s,
int size)
40#if defined(HAVE_READLINE) || defined(HAVE_DYN_RL) || defined(HAVE_LIBREADLINE)
43#define STDOUT_FILENO 1
73 if (strncmp (
name, text, len) == 0)
82 if (strncmp (
name, text, len) == 0)
87 return ((
char *)
NULL);
95#if (defined(HAVE_READLINE) || defined(HAVE_LIBREADLINE) || defined(HAVE_DYN_RL))
107 typedef char * (*RL_PROC)(
const char*,int);
108 #ifdef READLINE_READLINE_H_OK
109 #include <readline/readline.h>
110 #ifdef HAVE_READLINE_HISTORY_H
111 #include <readline/history.h>
115 #ifdef RL_VERSION_MAJOR
116 #if (RL_VERSION_MAJOR >= 4)
117 #define USE_READLINE4
121 #ifndef USE_READLINE4
122 #define rl_filename_completion_function filename_completion_function
123 #define rl_completion_matches completion_matches
125 #ifndef READLINE_READLINE_H_OK
143 typedef char * (*PROC)();
159#if defined(HAVE_DYN_RL)
163 char *(*fe_filename_completion_function)();
164 char *(* fe_readline) (
char *);
168 char **(*fe_completion_matches)(...);
184 #define x_rl_line_buffer (*fe_rl_line_buffer)
185 #define x_rl_completion_matches (*fe_completion_matches)
186 #define x_rl_filename_completion_function (*fe_filename_completion_function)
188 #define x_rl_line_buffer rl_line_buffer
189 #define x_rl_completion_matches rl_completion_matches
190 #define x_rl_filename_completion_function rl_filename_completion_function
195#undef x_rl_line_buffer
196#undef x_rl_completion_matches
199 m=(
char **)
malloc(2*
sizeof(
char*));
200 m[0]=(
char *)
malloc(end-start+2);
201 strncpy(
m[0],text,end-start+1);
223 for (
int i=
l-1;
i>=0;
i--) line[
i]=line[
i]&127;
231 strncpy(
s,line,
size);
249#if !defined(HAVE_READLINE) && defined(HAVE_FEREAD)
268#if defined(HAVE_DYN_RL)
278 line = (*fe_readline) ((
char*)pr);
284 for (
int i=
l-1;
i>=0;
i--) line[
i]=line[
i]&127;
288 (*fe_add_history) (line);
292 strncpy(
s,line,
size);
317 char *line=fgets(
s,
size,stdin);
320 for (
int i=strlen(line)-1;
i>=0;
i--) line[
i]=line[
i]&127;
328 case EBADF:
return NULL;
329 case EINTR:
return strcpy(
s,
"\n");
333 fprintf(stderr,
"fgets() failed with errno %d\n%s\n",errsv,strerror(errsv));
346#if (defined(HAVE_READLINE) || defined(HAVE_LIBREADLINE)) && !defined(HAVE_DYN_RL) && !defined(HAVE_FEREAD)
362 char *fn=ttyname(fileno(stdin));
368 if(isatty(fileno(stdin)))
373 char *
p =
getenv(
"SINGULARHIST");
399 Warn(
"dynamic loading failed: %d\n",
res);
414 (*fe_using_history)();
416 char *
p =
getenv(
"SINGULARHIST");
419 (*fe_read_history) (
p);
428 char *fn=ttyname(fileno(stdin));
441 #if !defined(HAVE_READLINE) && defined(HAVE_FEREAD)
const CanonicalForm int s
EXTERN_VAR CPPFunction * rl_attempted_completion_function
EXTERN_VAR FILE * rl_outstream
VAR BOOLEAN using_history_called
VAR char ** fe_rl_readline_name
VAR char ** fe_rl_line_buffer
#define x_rl_filename_completion_function
VAR int(* fe_read_history)(char *)
char ** RL_CPPFunction(const char *, int, int)
char * fe_fgets_dummy(const char *, char *, int)
VAR int(* fe_write_history)()
#define x_rl_completion_matches
char * command_generator(char *text, int state)
char *(* fe_fgets_stdin)(const char *pr, char *s, int size)
static char * fe_fgets_stdin_init(const char *pr, char *s, int size)
VAR void(* fe_using_history)()
VAR CPPFunction ** fe_rl_attempted_completion_function
char *(* RL_PROC)(const char *, int)
VAR int(* fe_history_total_bytes)()
char * readline(const char *)
#define rl_completion_matches
char ** singular_completion(char *text, int start, int end)
char * fe_fgets(const char *pr, char *s, int size)
EXTERN_VAR char * rl_line_buffer
#define rl_filename_completion_function
int history_total_bytes()
VAR void(* fe_add_history)(char *)
EXTERN_VAR char * rl_readline_name
char * iiArithGetCmd(int)
char * fe_fgets_stdin_rl(const char *pr, char *s, int size)
char * fe_fgets_stdin_drl(const char *pr, char *s, int size)
char * fe_fgets_stdin_emu(const char *pr, char *s, int size)
char * fe_fgets_stdin_fe(const char *pr, char *s, int size)
VAR FILE ** fe_rl_outstream
#define SINGULARHIST_FILE
int name
New type name for int.