[BACK]Return to main.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / asir2000 / parse

Diff for /OpenXM_contrib2/asir2000/parse/main.c between version 1.30 and 1.31

version 1.30, 2006/02/27 00:20:08 version 1.31, 2006/09/25 04:57:55
Line 45 
Line 45 
  * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,   * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,
  * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE.   * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE.
  *   *
  * $OpenXM: OpenXM_contrib2/asir2000/parse/main.c,v 1.29 2006/02/25 06:33:31 noro Exp $   * $OpenXM: OpenXM_contrib2/asir2000/parse/main.c,v 1.30 2006/02/27 00:20:08 noro Exp $
 */  */
 #include "ca.h"  #include "ca.h"
 #include "parse.h"  #include "parse.h"
Line 76  double get_current_time();
Line 76  double get_current_time();
 void init_socket();  void init_socket();
 void recover();  void recover();
 void set_stacksize();  void set_stacksize();
   void batch_loop();
   
 extern int mpi_nprocs,mpi_myid;  extern int mpi_nprocs,mpi_myid;
   extern int do_batch;
   
 #if defined(VISUAL_LIB)  #if defined(VISUAL_LIB)
 void Main(int argc,char *argv[])  void Main(int argc,char *argv[])
Line 160  main(int argc,char *argv[])
Line 162  main(int argc,char *argv[])
 #if defined(PARI)  #if defined(PARI)
     risa_pari_init();      risa_pari_init();
 #endif  #endif
         if (!do_quiet) {          if (!do_batch && !do_quiet) {
                 copyright();                  copyright();
         }          }
         output_init();          output_init();
Line 209  main(int argc,char *argv[])
Line 211  main(int argc,char *argv[])
                 if ( !SETJMP(main_env) )                  if ( !SETJMP(main_env) )
                         execasirfile(ifname);                          execasirfile(ifname);
         }          }
           if ( do_batch )
                   batch_loop();
   
         prompt();          prompt();
         while ( 1 ) {          while ( 1 ) {
Line 254  void set_stacksize()
Line 258  void set_stacksize()
                 setrlimit(RLIMIT_STACK,&rlim);                  setrlimit(RLIMIT_STACK,&rlim);
         }          }
 #endif  #endif
   }
   
   void batch_loop()
   {
           char *inbuf;
           int i,c,size;
   
           input_init(0,"string");
   
           size = 2;
           inbuf = (char *)malloc(size);
           while ( 1 ) {
                   for ( i = 0; ; i++ ) {
                           c = getchar();
                           if ( c == '0xff' ) {
                                   inbuf[i] = 0;
                                   break;
                           } else
                                   inbuf[i] = c;
                           if ( i == size-1 ) {
                                   size *= 2;
                                   inbuf = realloc(inbuf,size);
                           }
                   }
                   execute_string(inbuf);
           }
   }
   
   /* a function for batch-loop mode */
   
   extern char *parse_strp;
   
   int execute_string(char *cmd)
   {
           SNODE snode;
           pointer val;
   #if defined(PARI)
           recover(0);
           /* environement is defined in libpari.a */
   # if !(PARI_VERSION_CODE > 131588 )
           if ( setjmp(environnement) ) {
                   avma = top; recover(1);
                   resetenv("");
           }
   # endif
   #endif
           parse_strp = cmd;
           asir_infile->ln = 1;
           if ( mainparse(&snode) ) {
                   return -1;
           }
           val = evalstat(snode);
           if ( NEXT(asir_infile) ) {
                   while ( NEXT(asir_infile) ) {
                           if ( mainparse(&snode) ) {
                                   return -1;
                           }
                           nextbp = 0;
                           val = evalstat(snode);
                   }
           }
           printexpr(CO,val);
           return 0;
 }  }

Legend:
Removed from v.1.30  
changed lines
  Added in v.1.31

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>