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

Diff for /OpenXM_contrib2/asir2000/io/ox_asir.c between version 1.3 and 1.7

version 1.3, 2000/01/18 05:55:07 version 1.7, 2000/02/09 00:37:21
Line 1 
Line 1 
 /* $OpenXM: OpenXM_contrib2/asir2000/io/ox_asir.c,v 1.2 1999/12/22 07:01:39 noro Exp $ */  /* $OpenXM: OpenXM_contrib2/asir2000/io/ox_asir.c,v 1.6 2000/02/08 04:47:11 noro Exp $ */
 #include "ca.h"  #include "ca.h"
 #include "parse.h"  #include "parse.h"
   #include "signal.h"
 #include "ox.h"  #include "ox.h"
 #include "version.h"  #include "version.h"
   #if PARI
   #include "genpari.h"
   #endif
   
 void ox_usr1_handler();  void ox_usr1_handler();
   
   
 extern jmp_buf environnement;  extern jmp_buf environnement;
   
 extern int do_message;  extern int do_message;
Line 456  static void asir_executeFunction(int serial)
Line 461  static void asir_executeFunction(int serial)
         char *path;          char *path;
         USINT ui;          USINT ui;
         ERR err;          ERR err;
           Obj arg;
         static char buf[BUFSIZ];          static char buf[BUFSIZ];
   
         func = ((STRING)asir_pop_one())->body;          arg = asir_pop_one();
         argc = (int)(((USINT)asir_pop_one())->body);          if ( !arg || OID(arg) != O_STR ) {
                   sprintf(buf,"executeFunction : invalid function name");
                   goto error;
           } else
                   func = ((STRING)arg)->body;
   
           arg = asir_pop_one();
           if ( !arg || OID(arg) != O_USINT ) {
                   sprintf(buf,"executeFunction : invalid argc");
                   goto error;
           } else
                   argc = (int)(((USINT)arg)->body);
   
         for ( n = 0; argc; argc-- ) {          for ( n = 0; argc; argc-- ) {
                 NEXTNODE(n,n1);                  NEXTNODE(n,n1);
                 BDY(n1) = (pointer)asir_pop_one();                  BDY(n1) = (pointer)asir_pop_one();
Line 491  static void asir_executeFunction(int serial)
Line 508  static void asir_executeFunction(int serial)
                         searchf(usrf,func,&f);                          searchf(usrf,func,&f);
                 if ( !f ) {                  if ( !f ) {
                         sprintf(buf,"executeFunction : the function %s not found",func);                          sprintf(buf,"executeFunction : the function %s not found",func);
                         create_error(&err,serial,buf);                          goto error;
                         result = (Obj)err;  
                 } else {                  } else {
                         result = (Obj)bevalf(f,n);                          result = (Obj)bevalf(f,n);
                 }                  }
         }          }
         asir_push_one(result);          asir_push_one(result);
           return;
   
   error:
           create_error(&err,serial,buf);
           result = (Obj)err;
           asir_push_one(result);
 }  }
   
 static void asir_end_flush()  static void asir_end_flush()
Line 549  static void ox_asir_init(int argc,char **argv)
Line 571  static void ox_asir_init(int argc,char **argv)
         char *getenv();          char *getenv();
         static ox_asir_initialized = 0;          static ox_asir_initialized = 0;
         FILE *ifp;          FILE *ifp;
           char *homedir;
           char *ptr;
   
 #if !defined(VISUAL) && !MPI  #if !defined(VISUAL) && !MPI
         do_server_in_X11 = 1; /* XXX */          do_server_in_X11 = 1; /* XXX */
Line 587  static void ox_asir_init(int argc,char **argv)
Line 611  static void ox_asir_init(int argc,char **argv)
 #if defined(UINIT)  #if defined(UINIT)
         reg_sysf();          reg_sysf();
 #endif  #endif
   /* if ASIR_CONFIG is set, execute it; else execute .asirrc */
           if ( ptr = getenv("ASIR_CONFIG") )
                   strcpy(ifname,ptr);
           else {
 #if defined(THINK_C)  #if defined(THINK_C)
         sprintf(ifname,"asirrc");                  sprintf(ifname,"asirrc");
 #else  #else
         sprintf(ifname,"%s/.asirrc",getenv("HOME"));                  homedir = getenv("HOME");
                   if ( !homedir ) {
                           char rootname[BUFSIZ];
   
                           get_rootdir(rootname,sizeof(rootname));
                           homedir = rootname;
                   }
                   sprintf(ifname,"%s/.asirrc",homedir);
 #endif  #endif
           }
         if ( do_asirrc && (ifp = fopen(ifname,"r")) ) {          if ( do_asirrc && (ifp = fopen(ifname,"r")) ) {
                 input_init(ifp,ifname);                  input_init(ifp,ifname);
                 if ( !setjmp(env) ) {                  if ( !setjmp(env) ) {
Line 683  int asir_ox_pop_cmo(void *cmo, int limit)
Line 719  int asir_ox_pop_cmo(void *cmo, int limit)
   
 void asir_ox_push_cmd(unsigned int cmd)  void asir_ox_push_cmd(unsigned int cmd)
 {  {
         asir_do_cmd(cmd,0);          int ret;
           ERR err;
           extern char LastError[];
   
           if ( ret = setjmp(env) ) {
                   if ( ret == 1 ) {
                           create_error(&err,0,LastError); /* XXX */
                           asir_push_one((Obj)err);
                   }
           } else
                   asir_do_cmd(cmd,0);
 }  }
   
 /*  /*

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.7

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