bridge/class-master/depend/pari/src/language/es.c
/* read a binary object in file f. Set *ptc to the object "type":
 * BIN_GEN: an anonymous GEN x; return x.
 * NAM_GEN: a named GEN x, with name v; set 'v to x (changevalue) and return x
 * VAR_GEN: a name v; create the (unassigned) variable v and return gnil
 * RELINK_TABLE: a relinking table for gen_relink(), to replace old adresses
 * in * the original session by new incarnations in the current session.
 * H is the current relinking table
 * */
read a binary object in file f. Set *ptc to the object "type":
BIN_GEN: an anonymous GEN x; return x.
NAM_GEN: a named GEN x, with name v; set 'v to x (changevalue) and return x
VAR_GEN: a name v; create the (unassigned) variable v and return gnil
RELINK_TABLE: a relinking table for gen_relink(), to replace old adresses
in * the original session by new incarnations in the current session.
H is the current relinking table
read a binary object in file f . Set * ptc to the object " type " : BIN_GEN : an anonymous GEN x ; return x . NAM_GEN : a named GEN x with name v ; set ' v to x ( changevalue ) and return x VAR_GEN : a name v ; create the ( unassigned ) variable v and return gnil RELINK_TABLE : a relinking table for gen_relink () to replace old adresses in * the original session by new incarnations in the current session . H is the current relinking table
static GEN
readobj(FILE *f, int *ptc, hashtable *H)
{
  int c = fgetc(f);
  GEN x = NULL;
  switch(c)
  {
    case BIN_GEN:
      x = rdGEN(f);
      if (H) gen_relink(x, H);
      break;
    case NAM_GEN:
    case VAR_GEN:
    {
      char *s = rdstr(f);
      if (!s) pari_err(e_MISC,"malformed binary file (no name)");
      if (c == NAM_GEN)
      {
        x = rdGEN(f);
        if (H) gen_relink(x, H);
        err_printf("setting %s\n",s);
        changevalue(varentries[fetch_user_var(s)], x);
      }
      else
      {
        pari_var_create(fetch_entry(s));
        x = gnil;
      }
      break;
    }
    case RELINK_TABLE:
      x = rdGEN(f); break;
    case EOF: break;
    default: pari_err(e_MISC,"unknown code in readobj");
  }
  *ptc = c; return x;
}
static GEN readobj ( FILE * f , int * ptc , hashtable * H ) { int c = fgetc ( f ) ; GEN x = NULL ; switch ( c ) { case BIN_GEN : x = rdGEN ( f ) ; if ( H ) gen_relink ( x , H ) ; break ; case NAM_GEN : case VAR_GEN : { char * s = rdstr ( f ) ; if ( ! s ) pari_err ( e_MISC , " " ) ; if ( c == NAM_GEN ) { x = rdGEN ( f ) ; if ( H ) gen_relink ( x , H ) ; err_printf ( " \n " , s ) ; changevalue ( varentries [ fetch_user_var ( s ) ] , x ) ; } else { pari_var_create ( fetch_entry ( s ) ) ; x = gnil ; } break ; } case RELINK_TABLE : x = rdGEN ( f ) ; break ; case EOF : break ; default : pari_err ( e_MISC , " " ) ; } * ptc = c ; return x ; }
read a binary object in file f. Set *ptc to the object "type":
 BIN_GEN: an anonymous GEN x; return x.
 NAM_GEN: a named GEN x, with name v; set 'v to x (changevalue) and return x
 VAR_GEN: a name v; create the (unassigned) variable v and return gnil
 RELINK_TABLE: a relinking table for gen_relink(), to replace old adresses
 in * the original session by new incarnations in the current session.
read a binary object in file f . Set * ptc to the object " type " : BIN_GEN : an anonymous GEN x ; return x . NAM_GEN : a named GEN x with name v ; set ' v to x ( changevalue ) and return x VAR_GEN : a name v ; create the ( unassigned ) variable v and return gnil RELINK_TABLE : a relinking table for gen_relink () to replace old adresses in * the original session by new incarnations in the current session .