#include "kernel/mod2.h"
#include "omalloc/omalloc.h"
#include "kernel/oswrapper/feread.h"
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <sys/types.h>
#include <string.h>
#include "kernel/mod_raw.h"
Go to the source code of this file.
|
void | fe_reset_fe (void) |
|
void | fe_temp_reset (void) |
|
void | fe_temp_set (void) |
|
static int | fe_out_char (int c) |
|
static void | fe_init (void) |
|
static void | fe_ctrl_k (char *s, int i) |
|
static void | fe_ctrl_u (char *s, int *i) |
|
static void | fe_add_hist (char *s) |
|
static void | fe_get_hist (char *s, int size, int *pos, int change, int incr) |
|
static int | fe_getchar () |
|
static void | fe_set_cursor (char *s, int i) |
|
char * | fe_fgets_stdin_fe (char *pr, char *s, int size) |
|
char * | command_generator (char *text, int state) |
|
char ** | singular_completion (char *text, int start, int end) |
|
int | fe_init_dyn_rl () |
|
void | fe_reset_input_mode (void) |
|
◆ fe_hist_max
◆ feCTRL
◆ STDIN_FILENO
◆ STDOUT_FILENO
◆ CPPFunction
◆ command_generator()
Definition at line 52 of file feread.cc.
53{
57
58
59
60
61 if (state==0)
62 {
66 }
67
68
70 {
72
75 }
76 if (len>1)
77 {
79 {
84 }
85 }
86
87 return ((
char *)
NULL);
88}
char name(const Variable &v)
char * iiArithGetCmd(int)
◆ fe_add_hist()
Definition at line 277 of file fereadl.c.
278{
280 {
281
283 {
286 return;
287 }
288 else
289 {
292 return;
293 }
294
295
297 {
299 }
300
303
306 }
307}
const CanonicalForm int s
#define omMarkAsStaticAddr(A)
◆ fe_ctrl_k()
Definition at line 245 of file fereadl.c.
246{
249 {
252 }
254 {
257 }
258}
◆ fe_ctrl_u()
Definition at line 261 of file fereadl.c.
262{
265 {
266 (*i)--;
270 }
271}
static void fe_ctrl_k(char *s, int i)
◆ fe_fgets_stdin_fe()
Definition at line 382 of file fereadl.c.
383{
387 {
390 char c;
392
394 {
396 }
397
400
402
404 {
406 switch(c)
407 {
410 {
414
420
425 do
426 {
429 (
int *)
fdset.fds_bits,
430#else
438 }
441 {
446 {
450 }
451 else
452 {
454 }
455
456 }
458 {
460 if ((
i==0) &&(
s[0]==
'\0'))
return NULL;
462 {
465 {
469 }
472 {
474 }
475 else
476 {
478 {
481 }
482 }
483 }
486 break;
487 }
489 {
491 {
493 {
496 }
500 }
501 else
502 {
504 {
507 }
509 }
510 break;
511 }
513 {
515 {
520 {
524 }
525 }
526 break;
527 }
529 {
531 {
536 {
539 }
540 }
541 break;
542 }
544 {
546 {
551 {
555 }
556 }
557 break;
558 }
560 {
565 break;
566 }
567 #if 0
569 {
573 {
575 {
581 }
582 }
584 break;
585 }
586 #endif
588 {
591
593 break;
594 }
596 {
600
606 break;
607 }
609 {
613 {
616 }
619 break;
620 }
622 {
626 {
629 }
632 break;
633 }
634 default:
635 {
636 if ((c>=' ')&&(c<=126))
637 {
641 {
645 }
647 {
648
651 while ((
s[
j]!=
'\0')&&(
j<
size-2))
j++;
653 while (
j>
i) {
s[
j]=
s[
j-1];
j--; }
654
657
659 {
661 {
664 }
666 }
667 else
668 {
670 {
673 }
674 }
676 }
680 }
681 }
682 }
684 }
685 }
686
688}
void select(const ListCFList &ppi, int length, ListCFList &ppi1, ListCFList &ppi2)
STATIC_VAR BOOLEAN fe_is_initialized
static void fe_get_hist(char *s, int size, int *pos, int change, int incr)
static int fe_out_char(int c)
static void fe_ctrl_u(char *s, int *i)
VAR BOOLEAN fe_is_raw_tty
STATIC_VAR BOOLEAN fe_stdin_is_tty
static void fe_init(void)
static void fe_set_cursor(char *s, int i)
static void fe_add_hist(char *s)
void PrintS(const char *s)
EXTERN_VAR int pagelength
◆ fe_get_hist()
Definition at line 309 of file fereadl.c.
310{
313 do
314 {
318 }
322 {
324 }
325}
◆ fe_getchar()
Definition at line 327 of file fereadl.c.
328{
329 char c='\0';
331 if (c == 033)
332 {
333
334 c='\0';
336 if (c == '[')
337 {
338
339 c='\0';
341 switch (c)
342 {
343 case 'D':
345 break;
346 case 'C':
348 break;
349 case 'A':
351 break;
352 case 'B':
354 break;
355 }
356 }
357 }
358 return c;
359}
◆ fe_init()
Definition at line 140 of file fereadl.c.
141{
144 {
145
147
148
150 {
153 }
154 else
155 {
160 else
163 {
165 printf(
"stdin is a tty, but ttyname fails\n");
166 return;
167 }
168 }
169
170 {
173 #ifdef HAVE_FEREAD
174 #ifdef HAVE_ATEXIT
176 #else
178 #endif
179 #endif
180
181
187
188 }
190 {
192 }
194 {
195 printf(
"could not access termcap data base\n");
196 }
197 else
198 {
199 #ifndef __CYGWIN__
203 #endif
204
206
209
214
215
219
220
222 #if 0
224 #endif
225
226
227 }
228
231
232
236 }
237 else
238 {
241 }
242}
VAR struct termios fe_saved_attributes
STATIC_VAR BOOLEAN fe_stdout_is_tty
STATIC_VAR char termcap_buff[2048]
◆ fe_init_dyn_rl()
Definition at line 756 of file fereadl.c.
757{
760 {
771
798 break;
799 }
802 else
803 {
805
806
807 (*fe_rl_readline_name) = "Singular";
808
810
812 (*fe_using_history)();
816 {
817 (*fe_read_history) (
p);
818 }
819 }
821}
VAR BOOLEAN using_history_called
#define SINGULARHIST_FILE
VAR char ** fe_rl_readline_name
VAR char ** fe_rl_line_buffer
VAR int(* fe_read_history)()
VAR void(* fe_add_history)()
VAR int(* fe_write_history)()
VAR void(* fe_using_history)()
VAR CPPFunction ** fe_rl_attempted_completion_function
VAR int(* fe_history_total_bytes)()
char ** singular_completion(char *text, int start, int end)
char **(* fe_completion_matches)()
char *(* fe_filename_completion_function)()
VAR FILE ** fe_rl_outstream
int dynl_close(void *handle)
void * dynl_sym(void *handle, const char *symbol)
void * dynl_open(char *filename)
◆ fe_out_char()
◆ fe_reset_fe()
Definition at line 83 of file fereadl.c.
86{
88 {
91 {
94 }
96 {
98 {
100 }
103 }
105 {
107 }
108 }
109}
#define omFreeSize(addr, size)
◆ fe_reset_input_mode()
Definition at line 831 of file fereadl.c.
832{
833#if defined(HAVE_DYN_RL)
834 char *
p =
getenv(
"SINGULARHIST");
837 {
839 (*fe_write_history) (
p);
840 }
841#elif defined(HAVE_READLINE) && !defined(HAVE_FEREAD) && !defined(HAVE_DYN_RL)
842 char *
p =
getenv(
"SINGULARHIST");
845 {
848 }
849#elif defined(HAVE_FEREAD)
850 #ifndef HAVE_ATEXIT
852 #else
854 #endif
855#endif
856}
int history_total_bytes()
◆ fe_set_cursor()
Definition at line 361 of file fereadl.c.
362{
364 if (0)
365 {
366
371 }
372 else
373 {
374
375
378 }
380}
◆ fe_temp_reset()
◆ fe_temp_set()
Definition at line 118 of file fereadl.c.
119{
121 {
123
124
131 }
132}
◆ singular_completion()
Definition at line 736 of file fereadl.c.
737{
738
739
740
746 {
747 m=(
char **)
malloc(2*
sizeof(
char*));
748 m[0]=(
char *)
malloc(end-start+2);
751 }
753}
char * command_generator(char *text, int state)
◆ fe_add_history
◆ fe_completion_matches
char **(* fe_completion_matches) () |
( |
| ) |
|
◆ fe_cursor_line
◆ fe_cursor_pos
◆ fe_echo
◆ fe_filename_completion_function
char *(* fe_filename_completion_function) () |
( |
| ) |
|
◆ fe_hist
◆ fe_hist_pos
◆ fe_history_total_bytes
VAR int(* fe_history_total_bytes) () |
( |
| ) |
|
◆ fe_is_initialized
◆ fe_is_raw_tty
◆ fe_read_history
VAR int(* fe_read_history) () |
( |
| ) |
|
◆ fe_readline
char *(* fe_readline) () |
( |
| ) |
|
◆ fe_rl_attempted_completion_function
◆ fe_rl_hdl
◆ fe_rl_line_buffer
◆ fe_rl_outstream
◆ fe_rl_readline_name
◆ fe_saved_attributes
◆ fe_stdin_is_tty
◆ fe_stdout_is_tty
◆ fe_use_fgets
◆ fe_using_history
VAR void(* fe_using_history) () |
( |
| ) |
|
◆ fe_write_history
VAR int(* fe_write_history) () |
( |
| ) |
|
◆ termcap_buff