Changeset e860fa in git
- Timestamp:
- Apr 30, 2005, 4:41:31 PM (18 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
- Children:
- f45ec2ef6f63ae01a2bba579ec15408dab628fdc
- Parents:
- f5de432da81d07da14eedd6b7b34d0d515772c5f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/feread.cc
rf5de43 re860fa 2 2 * Computer Algebra System SINGULAR * 3 3 ****************************************/ 4 /* $Id: feread.cc,v 1. 3 2005-01-13 15:22:24Singular Exp $ */4 /* $Id: feread.cc,v 1.4 2005-04-30 14:41:31 Singular Exp $ */ 5 5 /* 6 6 * ABSTRACT: input from ttys, simulating fgets … … 50 50 /* = static/dymanic readline = */ 51 51 /* ===================================================================*/ 52 #if defined(HAVE_READLINE) || defined(HAVE_DYN_RL) 52 #if defined(HAVE_READLINE) || defined(HAVE_DYN_RL) || defined(HAVE_LIBREADLINE) 53 53 54 54 #include "../Singular/ipshell.h" … … 95 95 /* ===================================================================*/ 96 96 /* some procedure are shared with "dynamic readline" */ 97 #if defined(HAVE_READLINE) && !defined(HAVE_FEREAD)97 #if (defined(HAVE_READLINE) || defined(HAVE_LIBREADLINE) || defined(HAVE_DYN_RL)) && !defined(HAVE_FEREAD) 98 98 #include <unistd.h> 99 99 #include <stdio.h> … … 157 157 * array of matches, or NULL if there aren't any. 158 158 */ 159 #if defined(HAVE_DYN_RL) 160 extern "C" 161 { 162 int fe_init_dyn_rl(); 163 char *(*fe_filename_completion_function)(); /* 3 */ 164 char *(* fe_readline) (); /* 4 */ 165 void (*fe_add_history) (); /* 5 */ 166 char ** fe_rl_readline_name; /* 6 */ 167 char **fe_rl_line_buffer; /* 7 */ 168 char **(*fe_completion_matches)(); /* 8 */ 169 CPPFunction **fe_rl_attempted_completion_function; /* 9 */ 170 FILE ** fe_rl_outstream; /* 10 */ 171 int (*fe_write_history) (); /* 11 */ 172 int (*fe_history_total_bytes) (); /* 12 */ 173 void (*fe_using_history) (); /* 13 */ 174 int (*fe_read_history) (); /* 14 */ 175 176 } 177 #endif 159 178 char ** singular_completion (char *text, int start, int end) 160 179 { … … 162 181 to complete. Otherwise it may be the name of a file in the current 163 182 directory. */ 164 if (rl_line_buffer[start-1]=='"') 165 return rl_completion_matches (text, (RL_PROC)rl_filename_completion_function); 166 char **m=rl_completion_matches (text, (RL_PROC)command_generator); 183 #ifdef HAVE_DYN_RL 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) 187 #else 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 191 #endif 192 if (x_rl_line_buffer[start-1]=='"') 193 return x_rl_completion_matches (text, (RL_PROC)x_rl_filename_completion_function); 194 char **m=x_rl_completion_matches (text, (RL_PROC)command_generator); 195 #undef x_rl_line_buffer 196 #undef x_rl_completion_matches 167 197 if (m==NULL) 168 198 { … … 175 205 } 176 206 207 #ifndef HAVE_DYN_RL 177 208 char * fe_fgets_stdin_rl(char *pr,char *s, int size) 178 209 { … … 209 240 } 210 241 #endif 242 #endif 211 243 212 244 /* ===================================================================*/ … … 233 265 /* some procedure are shared with "static readline" */ 234 266 #if defined(HAVE_DYN_RL) 235 extern "C"236 {237 extern void * fe_rl_hdl;238 extern char ** fe_rl_readline_name;239 char * fe_fgets_stdin_rl(char *pr,char *s, int size);240 int fe_init_dyn_rl();241 extern FILE ** fe_rl_outstream;242 void (*fe_add_history)(char *);243 char * (*fe_readline)(char *);244 }245 246 267 char * fe_fgets_stdin_drl(char *pr,char *s, int size) 247 268 { … … 297 318 static char * fe_fgets_stdin_init(char *pr,char *s, int size) 298 319 { 299 #if defined(HAVE_READLINE) && !defined(HAVE_FEREAD)320 #if (defined(HAVE_READLINE) || defined(HAVE_LIBREADLINE)) && !defined(HAVE_DYN_RL) && !defined(HAVE_FEREAD) 300 321 /* Allow conditional parsing of the ~/.inputrc file. */ 301 322 rl_readline_name = "Singular"; … … 345 366 return fe_fgets_stdin(pr,s,size); 346 367 } 368 else /* could load libreadline: */ 369 { 370 /* Allow conditional parsing of the ~/.inputrc file. */ 371 *fe_rl_readline_name = "Singular"; 372 /* Tell the completer that we want a crack first. */ 373 *fe_rl_attempted_completion_function = (CPPFunction *)singular_completion; 374 /* try to read a history */ 375 (*fe_using_history)(); 376 char *p = getenv("SINGULARHIST"); 377 if (p != NULL) 378 { 379 (*fe_read_history) (p); 380 } 381 } 347 382 348 383 /* set the output stream */
Note: See TracChangeset
for help on using the changeset viewer.