|
From: Jose M. <ho...@us...> - 2004-12-02 20:30:07
|
Update of /cvsroot/ganc/ganc/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24745/src Modified Files: Makefile.am display.c display_gtk.c display_text.c main.c Log Message: First commit after a looooooooooong time, don't quite remember what has changed. Just syncing CVS with local copy Index: display.c =================================================================== RCS file: /cvsroot/ganc/ganc/src/display.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** display.c 8 Mar 2004 21:25:47 -0000 1.6 --- display.c 2 Dec 2004 20:29:54 -0000 1.7 *************** *** 119,122 **** --- 119,143 ---- // + // + // + void TravelEntryHistory (int direction) + { + char *line, *line2=NULL; + + line= GetInputLine (); + if (line==NULL) return; // display modes that don't support history (text) + if (direction==HISTORY_PREVIOUS) { + line2= PreviousHistory (line); + } else if (direction==HISTORY_NEXT) { + line2= NextHistory (line); + } + free (line); + if (line2!=NULL) { + SetInputLine (line2); + } + } + + + // // Extracts position of sublines (indicated by ';' character) // Returns array with positions of ';' characters, i.e. ends of sublines *************** *** 186,190 **** // check line is not empty ! if (LineIsEmpty (line)) return; // add current line to history --- 207,214 ---- // check line is not empty ! if (LineIsEmpty (line)) { ! free (line); ! return; ! } // add current line to history Index: display_text.c =================================================================== RCS file: /cvsroot/ganc/ganc/src/display_text.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** display_text.c 4 Mar 2004 00:41:54 -0000 1.4 --- display_text.c 2 Dec 2004 20:29:54 -0000 1.5 *************** *** 27,30 **** --- 27,33 ---- ***********************************************************************/ static int terminate=0; + static char *line; + static int line_ready; + *************** *** 34,39 **** --- 37,51 ---- void StartTextDisplay (void) { + line= (char *) malloc (MAX_LINE_SIZE + 1); + while (!terminate) { + line_ready= 0; PrintPrompt (); + + // read line + fgets (line, MAX_LINE_SIZE, stdin); + line[strlen (line) - 1]= '\0'; // eliminate end of line '\n' + + line_ready= 1; ExpressionReady (); } *************** *** 44,56 **** // // - void TravelEntryHistory (int direction) - { - /* nothing can be done for text displays */ - } - - - // - // - // void LimitNumberEntries (void) { --- 56,59 ---- *************** *** 61,76 **** // // Returns text in input line // char *GetInputLine (void) { ! char *line; ! ! line= (char *) malloc (MAX_LINE_SIZE + 1); ! fgets (line, MAX_LINE_SIZE, stdin); ! ! // eliminate end of line '\n' ! line[strlen (line) - 1]= '\0'; ! return line; } --- 64,76 ---- // // Returns text in input line + // returns NULL if line is not ready (text mode doesn't support history) // char *GetInputLine (void) { ! char *l=NULL; ! if (line_ready) l= strdup (line); ! ! return l; } Index: main.c =================================================================== RCS file: /cvsroot/ganc/ganc/src/main.c,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** main.c 4 Mar 2004 00:41:54 -0000 1.12 --- main.c 2 Dec 2004 20:29:54 -0000 1.13 *************** *** 181,185 **** #else /* not BUILD_GUI */ ! StartTextDisplay (); #endif /* not BUILD_GUI */ --- 181,186 ---- #else /* not BUILD_GUI */ ! //StartTextDisplay (); ! StartCursesDisplay (); #endif /* not BUILD_GUI */ Index: Makefile.am =================================================================== RCS file: /cvsroot/ganc/ganc/src/Makefile.am,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Makefile.am 4 Mar 2004 00:41:54 -0000 1.6 --- Makefile.am 2 Dec 2004 20:29:54 -0000 1.7 *************** *** 13,17 **** GUIHDR = callbacks.h interface.h support.h else ! GUISRC = display_text.c GUIHDR = endif --- 13,17 ---- GUIHDR = callbacks.h interface.h support.h else ! GUISRC = display_curses.c #display_text.c GUIHDR = endif *************** *** 21,25 **** variables.c display.c commands.c $(GUISRC) ! ganc_LDADD = @LIBS@ @PACKAGE_LIBS@ EXTRA_DIST = include $(GUIHDR) --- 21,25 ---- variables.c display.c commands.c $(GUISRC) ! ganc_LDADD = @LIBS@ @PACKAGE_LIBS@ -lncurses EXTRA_DIST = include $(GUIHDR) Index: display_gtk.c =================================================================== RCS file: /cvsroot/ganc/ganc/src/display_gtk.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** display_gtk.c 4 Mar 2004 00:41:54 -0000 1.1 --- display_gtk.c 2 Dec 2004 20:29:54 -0000 1.2 *************** *** 167,190 **** // // - void TravelEntryHistory (int direction) - { - char *line, *line2=NULL; - - line= GetInputLine (); - if (direction==HISTORY_PREVIOUS) { - line2= PreviousHistory (line); - } else if (direction==HISTORY_NEXT) { - line2= NextHistory (line); - } - free (line); - if (line2!=NULL) { - SetInputLine (line2); - } - } - - - // - // - // void LimitNumberEntries (void) { --- 167,170 ---- |