[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.58 and 1.59

version 1.58, 2005/07/26 00:58:50 version 1.59, 2006/02/08 02:11:19
Line 44 
Line 44 
  * OF THE SOFTWARE HAS BEEN DEVELOPED BY A THIRD PARTY, THE THIRD PARTY   * OF THE SOFTWARE HAS BEEN DEVELOPED BY A THIRD PARTY, THE THIRD PARTY
  * 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/io/ox_asir.c,v 1.57 2004/06/15 00:56:52 noro Exp $   * $OpenXM: OpenXM_contrib2/asir2000/io/ox_asir.c,v 1.58 2005/07/26 00:58:50 noro Exp $
 */  */
 #include "ca.h"  #include "ca.h"
 #include "parse.h"  #include "parse.h"
Line 70  extern JMP_BUF ox_env;
Line 70  extern JMP_BUF ox_env;
 extern MATHCAP my_mathcap;  extern MATHCAP my_mathcap;
   
 extern int little_endian,ox_sock_id;  extern int little_endian,ox_sock_id;
   extern char LastError[];
   extern LIST LastStackTrace;
   
 int ox_sock_id;  int ox_sock_id;
 int lib_ox_need_conv;  int lib_ox_need_conv;
   
 void create_error(ERR *,unsigned int ,char *);  void create_error(ERR *,unsigned int ,char *,LIST trace);
   
 int asir_OperandStackSize;  int asir_OperandStackSize;
 Obj *asir_OperandStack;  Obj *asir_OperandStack;
Line 147  void ox_main(int argc,char **argv) {
Line 149  void ox_main(int argc,char **argv) {
         ERR err;          ERR err;
         unsigned int serial;          unsigned int serial;
         int ret;          int ret;
         extern char LastError[];  
   
         ox_asir_init(argc,argv,"ox_asir");          ox_asir_init(argc,argv,"ox_asir");
         if ( do_message )          if ( do_message )
Line 186  void ox_main(int argc,char **argv) {
Line 187  void ox_main(int argc,char **argv) {
                                         fprintf(stderr," %s\n",name_of_cmd(cmd));                                          fprintf(stderr," %s\n",name_of_cmd(cmd));
                                 if ( ret = SETJMP(main_env) ) {                                  if ( ret = SETJMP(main_env) ) {
                                         if ( ret == 1 ) {                                          if ( ret == 1 ) {
                                                 create_error(&err,serial,LastError);                                                  create_error(&err,serial,LastError,LastStackTrace);
                                                 asir_push_one((Obj)err);                                                  asir_push_one((Obj)err);
                                                 while ( NEXT(asir_infile) )                                                  while ( NEXT(asir_infile) )
                                                         closecurrentinput();                                                          closecurrentinput();
Line 434  void asir_popCMO(unsigned int serial)
Line 435  void asir_popCMO(unsigned int serial)
         if ( valid_as_cmo(obj) )          if ( valid_as_cmo(obj) )
                 ox_send_data(0,obj);                  ox_send_data(0,obj);
         else {          else {
                 create_error(&err,serial,"cannot convert to CMO object");                  create_error(&err,serial,"cannot convert to CMO object",0);
                 ox_send_data(0,err);                  ox_send_data(0,err);
                 asir_push_one(obj);                  asir_push_one(obj);
         }          }
Line 460  void asir_reduce_102(unsigned int serial)
Line 461  void asir_reduce_102(unsigned int serial)
         else if ( !strcmp(opname,"*") )          else if ( !strcmp(opname,"*") )
                 func = arf_mul;                  func = arf_mul;
         if ( !func ) {          if ( !func ) {
                 create_error(&err,serial,"Invalid opration in ox_reduce_102");                  create_error(&err,serial,"Invalid opration in ox_reduce_102",0);
                 asir_push_one(obj);                  asir_push_one(obj);
         } else          } else
                 ox_reduce_102(root,func);                  ox_reduce_102(root,func);
Line 513  void asir_set_rank_102(unsigned int serial)
Line 514  void asir_set_rank_102(unsigned int serial)
         }          }
         if ( !stat ) return;          if ( !stat ) return;
         else {          else {
                 create_error(&err,serial,"Invalid argument(s) in ox_set_rank_102");                  create_error(&err,serial,"Invalid argument(s) in ox_set_rank_102",0);
                 asir_push_one(obj);                  asir_push_one(obj);
         }          }
 }  }
Line 541  void asir_tcp_accept_102(unsigned int serial)
Line 542  void asir_tcp_accept_102(unsigned int serial)
         rank = QTOS((Q)r);          rank = QTOS((Q)r);
         if ( register_102(s,rank,1) < 0 ) {          if ( register_102(s,rank,1) < 0 ) {
                 create_error(&err,serial,                  create_error(&err,serial,
                         "failed to bind or accept in ox_tcp_accept_102");                          "failed to bind or accept in ox_tcp_accept_102",0);
                 asir_push_one((Obj)err);                  asir_push_one((Obj)err);
         }          }
 }  }
Line 573  void asir_tcp_connect_102(unsigned int serial)
Line 574  void asir_tcp_connect_102(unsigned int serial)
         rank = QTOS((Q)r);          rank = QTOS((Q)r);
         if ( register_102(s,rank,1) < 0 ) {          if ( register_102(s,rank,1) < 0 ) {
                 create_error(&err,serial,                  create_error(&err,serial,
                         "failed to connect in ox_tcp_connect_102");                          "failed to connect in ox_tcp_connect_102",0);
                 asir_push_one((Obj)err);                  asir_push_one((Obj)err);
         }          }
 }  }
Line 590  void asir_pushCMOtag(unsigned int serial)
Line 591  void asir_pushCMOtag(unsigned int serial)
                 MKUSINT(ui,tag);                  MKUSINT(ui,tag);
                 asir_push_one((Obj)ui);                  asir_push_one((Obj)ui);
         } else {          } else {
                 create_error(&err,serial,"cannot convert to CMO object");                  create_error(&err,serial,"cannot convert to CMO object",0);
                 asir_push_one((Obj)err);                  asir_push_one((Obj)err);
         }          }
 }  }
Line 637  void asir_setName(unsigned int serial)
Line 638  void asir_setName(unsigned int serial)
         parse_strp = (char *)ALLOCA(n);          parse_strp = (char *)ALLOCA(n);
         sprintf(parse_strp,"%s%s",name,dummy);          sprintf(parse_strp,"%s%s",name,dummy);
         if ( mainparse(&snode) ) {          if ( mainparse(&snode) ) {
                 create_error(&err,serial,"cannot set to variable");                  create_error(&err,serial,"cannot set to variable",0);
                 asir_push_one((Obj)err);                  asir_push_one((Obj)err);
         } else {          } else {
                 FA1((FNODE)FA0(snode)) = (pointer)mkfnode(1,I_FORMULA,asir_pop_one());                  FA1((FNODE)FA0(snode)) = (pointer)mkfnode(1,I_FORMULA,asir_pop_one());
Line 659  void asir_evalName(unsigned int serial)
Line 660  void asir_evalName(unsigned int serial)
         parse_strp = (char *)ALLOCA(n);          parse_strp = (char *)ALLOCA(n);
         sprintf(parse_strp,"%s;",name);          sprintf(parse_strp,"%s;",name);
         if ( mainparse(&snode) ) {          if ( mainparse(&snode) ) {
                 create_error(&err,serial,"no such variable");                  create_error(&err,serial,"no such variable",0);
                 val = (pointer)err;                  val = (pointer)err;
         } else          } else
                 val = evalstat(snode);                  val = evalstat(snode);
Line 754  static void asir_executeFunction(int serial)
Line 755  static void asir_executeFunction(int serial)
         if ( n )          if ( n )
                 NEXT(n1) = 0;                  NEXT(n1) = 0;
   
   #if 0
         if ( !strcmp(func,"load") ) {          if ( !strcmp(func,"load") ) {
                 fname = (STRING)BDY(n);                  fname = (STRING)BDY(n);
                 if ( OID(fname) == O_STR ) {                  if ( OID(fname) == O_STR ) {
Line 768  static void asir_executeFunction(int serial)
Line 770  static void asir_executeFunction(int serial)
                 }                  }
                 result = 0;                  result = 0;
         } else {          } else {
   #endif
                 searchf(noargsysf,func,&f);                  searchf(noargsysf,func,&f);
                 if ( !f )                  if ( !f )
                         searchf(sysf,func,&f);                          searchf(sysf,func,&f);
Line 781  static void asir_executeFunction(int serial)
Line 784  static void asir_executeFunction(int serial)
                 } else {                  } else {
                         result = (Obj)bevalf(f,n);                          result = (Obj)bevalf(f,n);
                 }                  }
   #if 0
         }          }
   #endif
         asir_push_one(result);          asir_push_one(result);
         return;          return;
   
 error:  error:
         create_error(&err,serial,buf);          create_error(&err,serial,buf,0);
         result = (Obj)err;          result = (Obj)err;
         asir_push_one(result);          asir_push_one(result);
 }  }
Line 845  void ox_asir_init(int argc,char **argv,char *servernam
Line 850  void ox_asir_init(int argc,char **argv,char *servernam
 {  {
         char ifname[BUFSIZ];          char ifname[BUFSIZ];
         extern int GC_dont_gc;          extern int GC_dont_gc;
         extern int read_exec_file;  
         extern int do_asirrc;          extern int do_asirrc;
         extern int do_server_in_X11;          extern int do_server_in_X11;
         extern char displayname[];          extern char displayname[];
Line 906  void ox_asir_init(int argc,char **argv,char *servernam
Line 910  void ox_asir_init(int argc,char **argv,char *servernam
                 }                  }
                 sprintf(ifname,"%s/.asirrc",homedir);                  sprintf(ifname,"%s/.asirrc",homedir);
         }          }
   
           /* the bottom of the input stack */
           input_init(0,"string");
   
         if ( do_asirrc && (ifp = fopen(ifname,"r")) ) {          if ( do_asirrc && (ifp = fopen(ifname,"r")) ) {
                 input_init(ifp,ifname);  
                 if ( !SETJMP(main_env) ) {  
                         read_exec_file = 1;  
                         read_eval_loop();  
                         read_exec_file = 0;  
                 }  
                 fclose(ifp);                  fclose(ifp);
                   execasirfile(ifname);
         }          }
         input_init(0,"string");  
 /* XXX Windows compatibility */  /* XXX Windows compatibility */
         ox_io_init();          ox_io_init();
         create_my_mathcap(servername);          create_my_mathcap(servername);
Line 1009  int asir_ox_pop_cmo(void *cmo, int limit)
Line 1012  int asir_ox_pop_cmo(void *cmo, int limit)
         obj = asir_pop_one();          obj = asir_pop_one();
         if ( !valid_as_cmo(obj) ) {          if ( !valid_as_cmo(obj) ) {
                 asir_push_one(obj);                  asir_push_one(obj);
                 create_error(&err,0,"The object at the stack top is invalid as a CMO.");                  create_error(&err,0,"The object at the stack top is invalid as a CMO.",0);
                 obj = (Obj)err;                  obj = (Obj)err;
         }          }
         len = count_as_cmo(obj);          len = count_as_cmo(obj);
Line 1058  void asir_ox_push_cmd(int cmd)
Line 1061  void asir_ox_push_cmd(int cmd)
         if ( ret = SETJMP(main_env) ) {          if ( ret = SETJMP(main_env) ) {
                 asir_reset_handler();                  asir_reset_handler();
                 if ( ret == 1 ) {                  if ( ret == 1 ) {
                         create_error(&err,0,LastError); /* XXX */                          create_error(&err,0,LastError,LastStackTrace); /* XXX */
                         asir_push_one((Obj)err);                          asir_push_one((Obj)err);
                 }                  }
         } else {          } else {
Line 1085  void asir_ox_execute_string(char *s)
Line 1088  void asir_ox_execute_string(char *s)
         if ( ret = SETJMP(main_env) ) {          if ( ret = SETJMP(main_env) ) {
                 asir_reset_handler();                  asir_reset_handler();
                 if ( ret == 1 ) {                  if ( ret == 1 ) {
                         create_error(&err,0,LastError); /* XXX */                          create_error(&err,0,LastError,LastStackTrace); /* XXX */
                         asir_push_one((Obj)err);                          asir_push_one((Obj)err);
                 }                  }
         } else {          } else {
Line 1140  int asir_ox_init(int byteorder)
Line 1143  int asir_ox_init(int byteorder)
         int tmp;          int tmp;
         char ifname[BUFSIZ];          char ifname[BUFSIZ];
         extern int GC_dont_gc;          extern int GC_dont_gc;
         extern int read_exec_file;  
         extern int do_asirrc;          extern int do_asirrc;
         extern int do_server_in_X11;          extern int do_server_in_X11;
         char *getenv();          char *getenv();
Line 1180  int asir_ox_init(int byteorder)
Line 1182  int asir_ox_init(int byteorder)
         sprintf(ifname,"%s/.asirrc",getenv("HOME"));          sprintf(ifname,"%s/.asirrc",getenv("HOME"));
         if ( do_asirrc && (ifp = fopen(ifname,"r")) ) {          if ( do_asirrc && (ifp = fopen(ifname,"r")) ) {
                 input_init(ifp,ifname);                  input_init(ifp,ifname);
                 if ( !SETJMP(main_env) ) {                  if ( !SETJMP(asir_infile->jmpbuf) ) {
                         read_exec_file = 1;                          asir_infile->ready_for_longjmp;
                         read_eval_loop();                          read_eval_loop();
                         read_exec_file = 0;  
                 }                  }
                 fclose(ifp);                  fclose(ifp);
         }          }

Legend:
Removed from v.1.58  
changed lines
  Added in v.1.59

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