My Project
fereadl.c
Go to the documentation of this file.
1/****************************************
2* Computer Algebra System SINGULAR *
3****************************************/
4/*
5* ABSTRACT: input from ttys, simulating fgets
6*/
7
8
9
10
11
12#include "kernel/mod2.h"
13#include "omalloc/omalloc.h"
15
16#ifdef HAVE_FEREAD
17 #include <unistd.h>
18 #include <stdio.h>
19 #include <stdlib.h>
20 #include <sys/time.h>
21 #include <sys/types.h>
22 #include <string.h>
23
24 #if 0
25 #include <pc.h>
26 #else
27 #ifdef SunOS_5
28 /* solaris special, found with v 5.7 */
29 #define _XOPEN_SOURCE_EXTENDED
30 #include "/usr/xpg4/include/term.h"
31 #endif
32 #if 0
33 #ifndef SunOS_5
34 #include <term.h>
35 #endif
36 #elif HAVE_TERMCAP_H
37 #ifndef SunOS_5
38 #include <termcap.h>
39 #endif
40 #endif
41 #if defined(HAVE_TERMIOS_H) && ! defined(TCSANOW)
42 #include <termios.h>
43 #endif
44 #if defined(HAVE_TERM_H) && ! defined(TCSANOW)
45 #include <term.h>
46 #endif
47
48 #endif
49
50
51#ifndef STDIN_FILENO
52 #define STDIN_FILENO 0
53#endif
54#ifndef STDOUT_FILENO
55 #define STDOUT_FILENO 1
56#endif
57
58#define feCTRL(C) ((C) & 0x1F) /* <ctrl> character */
59
60VAR struct termios fe_saved_attributes;
61
66
67VAR FILE * fe_echo; /*the output file for echoed characters*/
68
69#define fe_hist_max 32
73VAR short fe_cursor_pos; /* 0..colmax-1*/
74VAR short fe_cursor_line; /* 0..pagelength-1*/
75
76#ifndef HAVE_ATEXIT
77 int on_exit(void (*f)(int, void *), void *arg);
78 #ifdef HAVE_FEREAD
79 void fe_reset_fe (int i, void *v)
80 #endif
81#else
82 #ifdef HAVE_FEREAD
83 void fe_reset_fe (void)
84 #endif
85#endif
86{
88 {
89 int i;
90 if (fe_is_raw_tty)
91 {
92 tcsetattr (STDIN_FILENO, TCSANOW, &fe_saved_attributes);
94 }
95 if (fe_hist!=NULL)
96 {
97 for(i=fe_hist_max-1;i>=0;i--)
98 {
99 if (fe_hist[i] != NULL) omFree((ADDRESS)fe_hist[i]);
100 }
101 omFreeSize((ADDRESS)fe_hist,fe_hist_max*sizeof(char *));
103 }
104 if (!fe_stdout_is_tty)
105 {
106 fclose(fe_echo);
107 }
108 }
109}
110void fe_temp_reset (void)
111{
112 if (fe_is_raw_tty)
113 {
114 tcsetattr (STDIN_FILENO, TCSANOW, &fe_saved_attributes);
116 }
117}
118void fe_temp_set (void)
119{
120 if(fe_is_raw_tty==0)
121 {
122 struct termios tattr;
123
124 /* Set the funny terminal modes. */
125 tcgetattr (STDIN_FILENO, &tattr);
126 tattr.c_lflag &= ~(ICANON|ECHO); /* Clear ICANON and ECHO. */
127 tattr.c_cc[VMIN] = 1;
128 tattr.c_cc[VTIME] = 0;
129 tcsetattr (STDIN_FILENO, TCSAFLUSH, &tattr);
131 }
132}
133
135static int fe_out_char(int c)
136{
137 fputc(c,fe_echo);
138 return c;
139}
140static void fe_init (void)
141{
143 if ((!fe_use_fgets) && (isatty (STDIN_FILENO)))
144 {
145 /* Make sure stdin is a terminal. */
146 char *term=getenv("TERM");
147
148 /*setup echo*/
149 if(isatty(STDOUT_FILENO))
150 {
152 fe_echo=stdout;
153 }
154 else
155 {
157 char *tty_name=ttyname(fileno(stdin));
158 if (tty_name!=NULL)
159 fe_echo = fopen( tty_name, "w" );
160 else
161 fe_echo = NULL;
162 if (fe_echo==NULL)
163 {
164 fe_echo=stdout;
165 printf("stdin is a tty, but ttyname fails\n");
166 return;
167 }
168 }
169 /* Save the terminal attributes so we can restore them later. */
170 {
171 struct termios tattr;
172 tcgetattr (STDIN_FILENO, &fe_saved_attributes);
173 #ifdef HAVE_FEREAD
174 #ifdef HAVE_ATEXIT
175 atexit(fe_reset_fe);
176 #else
177 on_exit(fe_reset_fe,NULL);
178 #endif
179 #endif
180
181 /* Set the funny terminal modes. */
182 tcgetattr (STDIN_FILENO, &tattr);
183 tattr.c_lflag &= ~(ICANON|ECHO); /* Clear ICANON and ECHO. */
184 tattr.c_cc[VMIN] = 1;
185 tattr.c_cc[VTIME] = 0;
186 tcsetattr (STDIN_FILENO, TCSAFLUSH, &tattr);
187 /*ospeed=cfgetospeed(&tattr);*/
188 }
189 if(term==NULL)
190 {
191 printf("need TERM\n");
192 }
193 else if(tgetent(termcap_buff,term)<=0)
194 {
195 printf("could not access termcap data base\n");
196 }
197 else
198 {
199 #ifndef __CYGWIN__
200 EXTERN_VAR char *BC;
201 EXTERN_VAR char *UP;
202 EXTERN_VAR char PC;
203 #endif
204 /* OB: why this ? HS: char t_buf[128] does not work with glibc2 systems */
205 char *t_buf=(char *)omAlloc(128);
206 /*char t_buf[128];*/
207 char *temp;
208 char** t_buf_ptr= &t_buf;
209 /* Extract information that termcap functions use. */
210 temp = tgetstr ("pc", t_buf_ptr);
211 PC = (temp!=NULL) ? *temp : '\0';
212 BC=tgetstr("le",t_buf_ptr);
213 UP=tgetstr("up",t_buf_ptr);
214
215 /* Extract information we will use */
216 colmax=tgetnum("co");
217 pagelength=tgetnum("li");
219
220 /* init screen */
221 temp = tgetstr ("ti", t_buf_ptr);
222 #if 0
223 if (temp!=NULL) tputs(temp,1,fe_out_char);
224 #endif
225
226 /* printf("TERM=%s, co=%d, li=%d\n",term,colmax,pagelength);*/
227 }
228
231
232 /* setup history */
233 fe_hist=(char **)omAlloc0(fe_hist_max*sizeof(char *));
235 fe_hist_pos=0;
236 }
237 else
238 {
240 fe_echo=stdout;
241 }
242}
243
244/* delete to end of line */
245static void fe_ctrl_k(char *s,int i)
246{
247 int j=i;
248 while(s[j]!='\0')
249 {
250 fputc(' ',fe_echo);
251 j++;
252 }
253 while(j>i)
254 {
255 fputc('\b',fe_echo);
256 j--;
257 }
258}
259
260/* delete the line */
261static void fe_ctrl_u(char *s,int *i)
262{
263 fe_ctrl_k(s,*i);
264 while((*i)>0)
265 {
266 (*i)--;
267 fputc('\b',fe_echo);
268 fputc(' ',fe_echo);
269 fputc('\b',fe_echo);
270 }
271}
272
273/*2
274* add s to the history
275* if s is no the previous one, duplicate it
276*/
277static void fe_add_hist(char *s)
278{
279 if (s[0]!='\0') /* skip empty lines */
280 {
281 /* compare this line*/
282 if (fe_hist_pos!=0)
283 {
284 if ((fe_hist[fe_hist_pos-1]!=NULL)
285 && (strcmp(fe_hist[fe_hist_pos-1],s)==0))
286 return;
287 }
288 else
289 {
290 if ((fe_hist[fe_hist_max-1]!=NULL)
291 && (strcmp(fe_hist[fe_hist_max-1],s)==0))
292 return;
293 }
294 /* normal case: enter a new line */
295 /* first free the slot at position fe_hist_pos */
297 {
299 }
300 /* and store a duplicate */
303 /* increment fe_hist_pos in a circular manner */
304 fe_hist_pos++;
306 }
307}
308
309static void fe_get_hist(char *s, int size, int *pos,int change, int incr)
310{
311 if (change)
312 fe_add_hist(s);
313 do
314 {
315 (*pos)+=incr;
316 if((*pos)>=fe_hist_max) (*pos)-=fe_hist_max;
317 else if((*pos)<0) (*pos)+=fe_hist_max;
318 }
319 while (((*pos)!=0)&&(fe_hist[(*pos)]==NULL));
320 memset(s,0,size);
321 if (fe_hist[(*pos)]!=NULL)
322 {
323 strncpy(s,fe_hist[(*pos)],size-2);
324 }
325}
326
327static int fe_getchar()
328{
329 char c='\0';
330 while (1!=read (STDIN_FILENO, &c, 1));
331 if (c == 033)
332 {
333 /* check for CSI */
334 c='\0';
335 while((-1 == read (STDIN_FILENO, &c, 1)) && (errno == EINTR));
336 if (c == '[')
337 {
338 /* get command character */
339 c='\0';
340 while((-1 == read (STDIN_FILENO, &c, 1)) && (errno == EINTR));
341 switch (c)
342 {
343 case 'D': /* left arrow key */
344 c = feCTRL('B')/*002*/;
345 break;
346 case 'C': /* right arrow key */
347 c = feCTRL('F')/*006*/;
348 break;
349 case 'A': /* up arrow key */
350 c = feCTRL('P')/*020*/;
351 break;
352 case 'B': /* down arrow key */
353 c = feCTRL('N')/*016*/;
354 break;
355 }
356 }
357 }
358 return c;
359}
360
361static void fe_set_cursor(char *s,int i)
362{
363 char tgoto_buf[40];
364 if (0)/*(fe_cursor_pos>1) && (i>0))*/
365 {
366 /*fputs(tgoto(tgetstr("cm",&tgoto_buf),fe_cursor_pos-1,fe_cursor_line),fe_echo);*/
367 tputs(
368 tgoto(tgetstr("cm",(char **)&tgoto_buf),fe_cursor_pos-1,fe_cursor_line),
370 fputc(s[i-1],fe_echo);
371 }
372 else
373 {
374 /*fputs(
375 tgoto(tgetstr("cm",&tgoto_buf),fe_cursor_pos,fe_cursor_line),fe_echo);*/
376 tputs(tgoto(tgetstr("cm",(char **)&tgoto_buf),fe_cursor_pos,fe_cursor_line),
378 }
379 fflush(fe_echo);
380}
381
382char * fe_fgets_stdin_fe(char *pr,char *s, int size)
383{
385 fe_init();
386 if (fe_stdin_is_tty)
387 {
388 int h=fe_hist_pos;
389 int change=0;
390 char c;
391 int i=0;
392
393 if (fe_is_raw_tty==0)
394 {
395 fe_temp_set();
396 }
397
398 fputs(pr,fe_echo); fflush(fe_echo);
399 fe_cursor_pos=strlen(pr); /* prompt */
400
401 memset(s,0,size);
402
403 loop
404 {
405 c=fe_getchar();
406 switch(c)
407 {
408 case feCTRL('M'):
409 case feCTRL('J'):
410 {
411 fd_set fdset;
412 struct timeval tv;
413 int sel;
414
415 fe_add_hist(s);
416 i=strlen(s);
417 if (i<size-1) s[i]='\n';
418 fputc('\n',fe_echo);
419 fflush(fe_echo);
420
421 FD_ZERO (&fdset);
422 FD_SET(STDIN_FILENO, &fdset);
423 tv.tv_sec = 0;
424 tv.tv_usec = 0;
425 do
426 {
427 sel = select (STDIN_FILENO+1,
428#ifdef hpux
429 (int *)fdset.fds_bits,
430#else
431 &fdset,
432#endif
433 NULL, NULL, &tv);
434 } while( (sel == -1) && (errno == EINTR) );
435 if (sel==0)
437 return s;
438 }
439 case feCTRL('H'):
440 case 127: /*delete the character left of the cursor*/
441 {
442 if (i==0) break;
443 i--;
445 if(fe_cursor_pos<0)
446 {
450 }
451 else
452 {
453 fputc('\b',fe_echo);
454 }
455 /* NO BREAK : next: feCTRL('D') */
456 }
457 case feCTRL('D'): /*delete the character under the cursor or eof*/
458 {
459 int j;
460 if ((i==0) &&(s[0]=='\0')) return NULL; /*eof*/
461 if (s[i]!='\0')
462 {
463 j=i;
464 while(s[j]!='\0')
465 {
466 s[j]=s[j+1];
467 fputc(s[j],fe_echo);
468 j++;
469 }
470 fputc(' ',fe_echo);
471 if (fe_cursor_pos+(j-i)>=colmax)
472 {
474 }
475 else
476 {
477 while(j>i)
478 {
479 fputc('\b',fe_echo);
480 j--;
481 }
482 }
483 }
484 change=1;
485 fflush(fe_echo);
486 break;
487 }
488 case feCTRL('A'): /* move the cursor to the beginning of the line */
489 {
490 if (i>=colmax-strlen(pr))
491 {
492 while (i>=colmax-strlen(pr))
493 {
494 i-=colmax;
496 }
497 i=0;
498 fe_cursor_pos=strlen(pr);
500 }
501 else
502 {
503 while(i>0)
504 {
505 i--;
506 fputc('\b',fe_echo);
507 }
508 fe_cursor_pos=strlen(pr);
509 }
510 break;
511 }
512 case feCTRL('E'): /* move the cursor to the end of the line */
513 {
514 while(s[i]!='\0')
515 {
516 fputc(s[i],fe_echo);
517 i++;
520 {
524 }
525 }
526 break;
527 }
528 case feCTRL('B'): /* move the cursor backward one character */
529 {
530 if (i>0)
531 {
532 i--;
533 fputc('\b',fe_echo);
535 if(fe_cursor_pos<0)
536 {
539 }
540 }
541 break;
542 }
543 case feCTRL('F'): /* move the cursor forward one character */
544 {
545 if(s[i]!='\0')
546 {
547 fputc(s[i],fe_echo);
548 i++;
551 {
555 }
556 }
557 break;
558 }
559 case feCTRL('U'): /* delete entire input line */
560 {
561 fe_ctrl_u(s,&i);
562 fe_cursor_pos=strlen(pr);
563 memset(s,0,size);
564 change=1;
565 break;
566 }
567 #if 0
568 case feCTRL('W'): /* test hist. */
569 {
570 int i;
571 PrintS("\nstart hist\n");
572 for(i=0;i<fe_hist_max;i++)
573 {
574 if(fe_hist[i]!=NULL)
575 {
576 Print("%2d ",i);
577 if(i==fe_hist_pos) PrintS("-"); else PrintS(" ");
578 if(i==h) PrintS(">"); else PrintS(" ");
579 PrintS(fe_hist[i]);
580 PrintLn();
581 }
582 }
583 Print("end hist, next_pos=%d\n",fe_hist_pos);
584 break;
585 }
586 #endif
587 case feCTRL('K'): /* delete up to the end of the line */
588 {
589 fe_ctrl_k(s,i);
590 memset(&(s[i]),'\0',size-i);
591 /* s[i]='\0';*/
592 change=1;
593 break;
594 }
595 case feCTRL('L'): /* redraw screen */
596 {
597 char t_buf[40];
598 char *t=t_buf;
600 /*fputs(tgetstr("cl",&t),fe_echo);*/
601 tputs(tgetstr("cl",&t),pagelength,fe_out_char);
602 fflush(fe_echo);
603 fputs(pr,fe_echo);
604 fputs(s,fe_echo);
606 break;
607 }
608 case feCTRL('P'): /* previous line */
609 {
610 fe_ctrl_u(s,&i);
611 fe_get_hist(s,size,&h,change,-1);
612 while(s[i]!='\0')
613 {
614 fputc(s[i],fe_echo);
615 i++;
616 }
617 fe_cursor_pos=strlen(pr)+i/*strlen(s)*/;
618 change=0;
619 break;
620 }
621 case feCTRL('N'): /* next line */
622 {
623 fe_ctrl_u(s,&i);
624 fe_get_hist(s,size,&h,change,1);
625 while(s[i]!='\0')
626 {
627 fputc(s[i],fe_echo);
628 i++;
629 }
630 fe_cursor_pos=strlen(pr)+i/*strlen(s)*/;
631 change=0;
632 break;
633 }
634 default:
635 {
636 if ((c>=' ')&&(c<=126))
637 {
638 fputc (c,fe_echo);
641 {
645 }
646 if (s[i]!='\0')
647 {
648 /* shift by 1 to the right */
649 int j=i;
650 int l;
651 while ((s[j]!='\0')&&(j<size-2)) j++;
652 l=j-i;
653 while (j>i) { s[j]=s[j-1]; j--; }
654 /* display */
655 fwrite(s+i+1,l,1,fe_echo);
656 fflush(fe_echo);
657 /* set cursor */
659 {
660 while(fe_cursor_pos+l>=colmax)
661 {
663 l-=colmax;
664 }
666 }
667 else
668 {
669 while(l>0)
670 {
671 l--;
672 fputc('\b',fe_echo);
673 }
674 }
675 fflush(fe_echo);
676 }
677 if (i<size-1) s[i]=c;
678 i++;
679 change=1;
680 }
681 }
682 } /* switch */
683 fflush(fe_echo);
684 } /* loop */
685 }
686 /*else*/
687 return fgets(s,size,stdin);
688}
689
690//int main (void)
691//{
692// char b[200];
693// char * m_eof;
694//
695// fe_init();
696// while(1)
697// {
698// m_eof=fe_fgets_stdin_fe("> ",b,200);
699// if (!m_eof) break;
700// printf(">>%s<<\n",b);
701// }
702//
703// return 0;
704//}
705#endif
706
707/* ================================================================ */
708#if defined(HAVE_DYN_RL)
709#include <unistd.h>
710#include "kernel/mod_raw.h"
711
712 typedef char **CPPFunction ();
713
714 char *(*fe_filename_completion_function)(); /* 3 */
715 char *(* fe_readline) (); /* 4 */
716 VAR void (*fe_add_history) (); /* 5 */
717 VAR char ** fe_rl_readline_name; /* 6 */
718 VAR char **fe_rl_line_buffer; /* 7 */
719 char **(*fe_completion_matches)(); /* 8 */
721 VAR FILE ** fe_rl_outstream; /* 10 */
722 VAR int (*fe_write_history) (); /* 11 */
723 VAR int (*fe_history_total_bytes) (); /* 12 */
724 VAR void (*fe_using_history) (); /* 13 */
725 VAR int (*fe_read_history) (); /* 14 */
726
728
729char *command_generator (char *text, int state);
730
731/* Attempt to complete on the contents of TEXT. START and END show the
732* region of TEXT that contains the word to complete. We can use the
733* entire line in case we want to do some simple parsing. Return the
734* array of matches, or NULL if there aren't any.
735*/
736char ** singular_completion (char *text, int start, int end)
737{
738 /* If this word is not in a string, then it may be a command
739 to complete. Otherwise it may be the name of a file in the current
740 directory. */
741 char **m;
742 if ((*fe_rl_line_buffer)[start-1]=='"')
744 m=(*fe_completion_matches) (text, command_generator);
745 if (m==NULL)
746 {
747 m=(char **)malloc(2*sizeof(char*));
748 m[0]=(char *)malloc(end-start+2);
749 strncpy(m[0],text,end-start+1);
750 m[1]=NULL;
751 }
752 return m;
753}
754
755
757{
758 int res=0;
759 loop
760 {
761 fe_rl_hdl=dynl_open("libreadline.so");
762 if (fe_rl_hdl==NULL) fe_rl_hdl=dynl_open("libreadline.so.2");
763 if (fe_rl_hdl==NULL) fe_rl_hdl=dynl_open("libreadline.so.3");
764 if (fe_rl_hdl==NULL) fe_rl_hdl=dynl_open("libreadline.so.4");
765 if (fe_rl_hdl==NULL) fe_rl_hdl=dynl_open("libreadline.so.5");
766 if (fe_rl_hdl==NULL) fe_rl_hdl=dynl_open("libreadline.so.6");
767 if (fe_rl_hdl==NULL) fe_rl_hdl=dynl_open("libreadline.so.7");
768 if (fe_rl_hdl==NULL) fe_rl_hdl=dynl_open("libreadline.so.8");
769 if (fe_rl_hdl==NULL) fe_rl_hdl=dynl_open("libreadline.so.9");
770 if (fe_rl_hdl==NULL) { return 1;}
771
773 dynl_sym(fe_rl_hdl, "filename_completion_function");
774 if (fe_filename_completion_function==NULL) { res=3; break; }
775 fe_readline=dynl_sym(fe_rl_hdl,"readline");
776 if (fe_readline==NULL) { res=4; break; }
777 fe_add_history=dynl_sym(fe_rl_hdl,"add_history");
778 if (fe_add_history==NULL) { res=5; break; }
779 fe_rl_readline_name=(char**)dynl_sym(fe_rl_hdl,"rl_readline_name");
780 if (fe_rl_readline_name==NULL) { res=6; break; }
781 fe_rl_line_buffer=(char**)dynl_sym(fe_rl_hdl,"rl_line_buffer");
782 if (fe_rl_line_buffer==NULL) { res=7; break; }
783 fe_completion_matches=dynl_sym(fe_rl_hdl,"completion_matches");
784 if (fe_completion_matches==NULL) { res=8; break; }
786 dynl_sym(fe_rl_hdl,"rl_attempted_completion_function");
788 fe_rl_outstream=(FILE**)dynl_sym(fe_rl_hdl,"rl_outstream");
789 if (fe_rl_outstream==NULL) { res=10; break; }
790 fe_write_history=dynl_sym(fe_rl_hdl,"write_history");
791 if (fe_write_history==NULL) { res=11; break; }
792 fe_history_total_bytes=dynl_sym(fe_rl_hdl,"history_total_bytes");
793 if (fe_history_total_bytes==NULL) { res=12; break; }
794 fe_using_history=dynl_sym(fe_rl_hdl,"using_history");
795 if (fe_using_history==NULL) { res=13; break; }
796 fe_read_history=dynl_sym(fe_rl_hdl,"read_history");
797 if (fe_read_history==NULL) { res=14; break; }
798 break;
799 }
801 if (res!=0) dynl_close(fe_rl_hdl);
802 else
803 {
804 char *p;
805 /* more init stuff: */
806 /* Allow conditional parsing of the ~/.inputrc file. */
807 (*fe_rl_readline_name) = "Singular";
808 /* Tell the completer that we want a crack first. */
809 (*fe_rl_attempted_completion_function) = (CPPFunction *)singular_completion;
810 /* try to read a history */
812 (*fe_using_history)();
813 p = getenv("SINGULARHIST");
815 if (strlen(p) != 0)
816 {
817 (*fe_read_history) (p);
818 }
819 }
820 return res;
821}
822#endif
823
824/* ===================================================================*/
825/* = fe_reset_input_mode (all possibilities) = */
826/* ===================================================================*/
827#if defined(HAVE_READLINE) && !defined(HAVE_FEREAD) && !defined(HAVE_DYN_RL)
828extern int history_total_bytes(void);
829extern int write_history (const char *);
830#endif
832{
833#if defined(HAVE_DYN_RL)
834 char *p = getenv("SINGULARHIST");
836 if ((strlen(p) != 0) && (fe_history_total_bytes != NULL))
837 {
839 (*fe_write_history) (p);
840 }
841#elif defined(HAVE_READLINE) && !defined(HAVE_FEREAD) && !defined(HAVE_DYN_RL)
842 char *p = getenv("SINGULARHIST");
844 if (strlen(p) != 0)
845 {
848 }
849#elif defined(HAVE_FEREAD)
850 #ifndef HAVE_ATEXIT
852 #else
853 fe_reset_fe();
854 #endif
855#endif
856}
857
int BOOLEAN
Definition: auxiliary.h:87
#define TRUE
Definition: auxiliary.h:100
#define FALSE
Definition: auxiliary.h:96
void * ADDRESS
Definition: auxiliary.h:119
int size(const CanonicalForm &f, const Variable &v)
int size ( const CanonicalForm & f, const Variable & v )
Definition: cf_ops.cc:600
void select(const ListCFList &ppi, int length, ListCFList &ppi1, ListCFList &ppi2)
int l
Definition: cfEzgcd.cc:100
int m
Definition: cfEzgcd.cc:128
int i
Definition: cfEzgcd.cc:132
int p
Definition: cfModGcd.cc:4078
FILE * f
Definition: checklibs.c:9
Definition: int_poly.h:33
#define Print
Definition: emacs.cc:80
const CanonicalForm int s
Definition: facAbsFact.cc:51
CanonicalForm res
Definition: facAbsFact.cc:60
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:39
int j
Definition: facHensel.cc:110
char * getenv()
VAR BOOLEAN using_history_called
Definition: feread.cc:106
int history_total_bytes()
int write_history()
#define SINGULARHIST_FILE
Definition: feread.h:20
STATIC_VAR BOOLEAN fe_is_initialized
Definition: fereadl.c:65
char * fe_fgets_stdin_fe(char *pr, char *s, int size)
Definition: fereadl.c:382
char ** CPPFunction()
Definition: fereadl.c:712
VAR struct termios fe_saved_attributes
Definition: fereadl.c:60
static void fe_get_hist(char *s, int size, int *pos, int change, int incr)
Definition: fereadl.c:309
VAR char ** fe_rl_readline_name
Definition: fereadl.c:717
VAR char ** fe_rl_line_buffer
Definition: fereadl.c:718
static int fe_out_char(int c)
Definition: fereadl.c:135
VAR short fe_cursor_line
Definition: fereadl.c:74
VAR BOOLEAN fe_use_fgets
Definition: fereadl.c:64
void fe_reset_fe(void)
Definition: fereadl.c:83
VAR short fe_cursor_pos
Definition: fereadl.c:73
#define feCTRL(C)
Definition: fereadl.c:58
char *(* fe_readline)()
Definition: fereadl.c:715
VAR int(* fe_read_history)()
Definition: fereadl.c:725
VAR void(* fe_add_history)()
Definition: fereadl.c:716
VAR int(* fe_write_history)()
Definition: fereadl.c:722
void fe_reset_input_mode(void)
Definition: fereadl.c:831
VAR char ** fe_hist
Definition: fereadl.c:70
#define fe_hist_max
Definition: fereadl.c:69
static void fe_ctrl_u(char *s, int *i)
Definition: fereadl.c:261
char * command_generator(char *text, int state)
Definition: feread.cc:52
static void fe_ctrl_k(char *s, int i)
Definition: fereadl.c:245
VAR void(* fe_using_history)()
Definition: fereadl.c:724
VAR BOOLEAN fe_is_raw_tty
Definition: fereadl.c:72
void fe_temp_set(void)
Definition: fereadl.c:118
VAR CPPFunction ** fe_rl_attempted_completion_function
Definition: fereadl.c:720
VAR int(* fe_history_total_bytes)()
Definition: fereadl.c:723
char ** singular_completion(char *text, int start, int end)
Definition: fereadl.c:736
VAR FILE * fe_echo
Definition: fereadl.c:67
char **(* fe_completion_matches)()
Definition: fereadl.c:719
VAR void * fe_rl_hdl
Definition: fereadl.c:727
#define STDOUT_FILENO
Definition: fereadl.c:55
STATIC_VAR BOOLEAN fe_stdin_is_tty
Definition: fereadl.c:63
STATIC_VAR BOOLEAN fe_stdout_is_tty
Definition: fereadl.c:62
static void fe_init(void)
Definition: fereadl.c:140
VAR short fe_hist_pos
Definition: fereadl.c:71
STATIC_VAR char termcap_buff[2048]
Definition: fereadl.c:134
char *(* fe_filename_completion_function)()
Definition: fereadl.c:714
VAR FILE ** fe_rl_outstream
Definition: fereadl.c:721
static void fe_set_cursor(char *s, int i)
Definition: fereadl.c:361
static int fe_getchar()
Definition: fereadl.c:327
void fe_temp_reset(void)
Definition: fereadl.c:110
#define STDIN_FILENO
Definition: fereadl.c:52
int fe_init_dyn_rl()
Definition: fereadl.c:756
static void fe_add_hist(char *s)
Definition: fereadl.c:277
#define STATIC_VAR
Definition: globaldefs.h:7
#define EXTERN_VAR
Definition: globaldefs.h:6
#define VAR
Definition: globaldefs.h:5
STATIC_VAR Poly * h
Definition: janet.cc:971
#define ECHO
Definition: libparse.cc:1343
int dynl_close(void *handle)
Definition: mod_raw.cc:170
void * dynl_sym(void *handle, const char *symbol)
Definition: mod_raw.cc:159
void * dynl_open(char *filename)
Definition: mod_raw.cc:142
#define omStrDup(s)
Definition: omAllocDecl.h:263
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define omAlloc(size)
Definition: omAllocDecl.h:210
#define omFree(addr)
Definition: omAllocDecl.h:261
#define omAlloc0(size)
Definition: omAllocDecl.h:211
void omMarkAsStaticAddr(void *addr)
#define NULL
Definition: omList.c:12
void * malloc(size_t size)
Definition: omalloc.c:85
void PrintS(const char *s)
Definition: reporter.cc:284
void PrintLn()
Definition: reporter.cc:310
EXTERN_VAR int pagelength
Definition: reporter.h:17
EXTERN_VAR int colmax
Definition: reporter.h:17
int status read
Definition: si_signals.h:59
#define loop
Definition: structs.h:75