[BACK]Return to ox_pari.c CVS log [TXT][DIR] Up to [local] / OpenXM / src / ox_pari

Diff for /OpenXM/src/ox_pari/ox_pari.c between version 1.21 and 1.24

version 1.21, 2020/11/10 01:11:38 version 1.24, 2022/03/28 09:21:56
Line 1 
Line 1 
 /*  $OpenXM: OpenXM/src/ox_pari/ox_pari.c,v 1.20 2020/08/26 06:03:31 noro Exp $  */  /*  $OpenXM: OpenXM/src/ox_pari/ox_pari.c,v 1.23 2021/03/25 07:03:21 noro Exp $  */
   
 #include <signal.h>  #include <signal.h>
 #include "ox_pari.h"  #include "ox_pari.h"
Line 34  void init_pari()
Line 34  void init_pari()
 {  {
   pari_init(paristack,2);    pari_init(paristack,2);
   mp_set_memory_functions(GC_malloc,gc_realloc,gc_free);    mp_set_memory_functions(GC_malloc,gc_realloc,gc_free);
     gmp_check();
 }  }
   
 int initialize_stack()  int initialize_stack()
Line 184  int sm_executeFunction()
Line 185  int sm_executeFunction()
     init_pari();      init_pari();
     return 0;      return 0;
   }    }
     if ( !strcmp(func->s,"pari_setprec") ) {
       long n,prec;
   
       n = cmo_to_int(av[0]);
       setrealprecision(n,&prec);
       return 0;
     }
   parif =search_parif(func->s);    parif =search_parif(func->s);
   if ( !parif ) {    if ( !parif ) {
     sprintf(buf,"%s : not implemented",func->s);      sprintf(buf,"%s : not implemented",func->s);
Line 268  int receive_and_execute_sm_command()
Line 276  int receive_and_execute_sm_command()
     exit(0);      exit(0);
     break;      break;
   default:    default:
     printf("receive_and_execute_sm_command : code=%d\n",code);fflush(stdout);      ox_printf("receive_and_execute_sm_command : code=%d\n",code);
     break;      break;
   }    }
   return 0;    return 0;
Line 281  int receive()
Line 289  int receive()
   tag = receive_ox_tag(fd_rw);    tag = receive_ox_tag(fd_rw);
   switch(tag) {    switch(tag) {
   case OX_DATA:    case OX_DATA:
     printf("receive : ox_data %d\n",tag);fflush(stdout);      ox_printf("receive : ox_data %d\n",tag);
     push(receive_cmo(fd_rw));      push(receive_cmo(fd_rw));
     break;      break;
   case OX_COMMAND:    case OX_COMMAND:
     printf("receive : ox_command %d\n",tag);fflush(stdout);      ox_printf("receive : ox_command %d\n",tag);
     receive_and_execute_sm_command();      receive_and_execute_sm_command();
     break;      break;
   default:    default:
     printf("receive : tag=%d\n",tag);fflush(stdout);      ox_printf("receive : tag=%d\n",tag);
   }    }
   return 0;    return 0;
 }  }
Line 309  void usr1_handler(int sig)
Line 317  void usr1_handler(int sig)
 #endif  #endif
 }  }
   
   #if defined(USE_OXPARI_LOG)
   #define LOGFILE "/tmp/oxpari.log"
   #endif
   
 int main()  int main()
 {  {
 #if defined(ANDROID)  #if defined(ANDROID)
Line 316  int main()
Line 328  int main()
 #else  #else
   if ( sigsetjmp(ox_env,~0) ) {    if ( sigsetjmp(ox_env,~0) ) {
 #endif  #endif
     fprintf(stderr,"resetting libpari and sending OX_SYNC_BALL...");      ox_printf("resetting libpari and sending OX_SYNC_BALL...");
     init_pari();      init_pari();
     initialize_stack();      initialize_stack();
     send_ox_tag(fd_rw,OX_SYNC_BALL);      send_ox_tag(fd_rw,OX_SYNC_BALL);
     fprintf(stderr,"done\n");      ox_printf("done\n");
   } else {    } else {
     init_gc();      init_gc();
     ox_stderr_init(stderr);  
   #if defined(LOGFILE)
       ox_stderr_init(fopen(LOGFILE,"a"));
   #endif
     init_pari();      init_pari();
     initialize_stack();      initialize_stack();
   
     fprintf(stderr,"ox_pari\n");      ox_printf("ox_pari\n");
   
     fd_rw = oxf_open(3);      fd_rw = oxf_open(3);
     oxf_determine_byteorder_server(fd_rw);      oxf_determine_byteorder_server(fd_rw);

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.24

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