18 #define READLINE_STATIC 29 #if defined(HAVE_DYN_RL) 34 char * (*fe_fgets_stdin)(
const char *pr,
char *
s,
int size)
42 #if defined(HAVE_READLINE) || defined(HAVE_DYN_RL) || defined(HAVE_LIBREADLINE) 45 #define STDOUT_FILENO 1 56 static int list_index, len;
75 if (strncmp (name, text, len) == 0)
84 if (strncmp (name, text, len) == 0)
89 return ((
char *)
NULL);
97 #if (defined(HAVE_READLINE) || defined(HAVE_LIBREADLINE) || defined(HAVE_DYN_RL)) 101 #include <sys/types.h> 102 #include <sys/file.h> 103 #include <sys/stat.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);
318 char *line=fgets(s,size,stdin);
321 for (
int i=strlen(line)-1;
i>=0;
i--) line[
i]=line[
i]&127;
329 case EBADF:
return NULL;
330 case EINTR:
return strcpy(s,
"\n");
334 fprintf(stderr,
"fgets() failed with errno %d\n%s\n",errsv,strerror(errsv));
347 #if (defined(HAVE_READLINE) || defined(HAVE_LIBREADLINE)) && !defined(HAVE_DYN_RL) && !defined(HAVE_FEREAD) 363 char *fn=ttyname(fileno(stdin));
368 if(isatty(fileno(stdin)))
372 char *
p =
getenv(
"SINGULARHIST");
396 Warn(
"dynamic loading failed: %d\n",res);
411 (*fe_using_history)();
412 char *
p =
getenv(
"SINGULARHIST");
415 (*fe_read_history) (
p);
424 char *fn=ttyname(fileno(stdin));
437 #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 name(const Variable &v)
char ** singular_completion(char *text, int start, int end)
int(* fe_write_history)()
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)