bridge/class-master/depend/pari/src/language/es.c
/* read all objects in f. If f contains BIN_GEN that would be silently ignored
 * [i.e f contains more than one objet, not all of them 'named GENs'], return
 * them all in a vector and set 'vector'. */
read all objects in f. If f contains BIN_GEN that would be silently ignored
[i.e f contains more than one objet, not all of them 'named GENs'], return
them all in a vector and set 'vector'.
read all objects in f . If f contains BIN_GEN that would be silently ignored [ i . e f contains more than one objet not all of them ' named GENs ' ] return them all in a vector and set ' vector ' .
GEN
readbin(const char *name, FILE *f, int *vector)
{
  pari_sp av = avma;
  hashtable *H = NULL;
  pari_stack s_obj;
  GEN obj, x, y;
  int cy;
  if (vector) *vector = 0;
  if (!check_magic(name,f)) return NULL;
  pari_stack_init(&s_obj, sizeof(GEN), (void**)&obj);
  pari_stack_pushp(&s_obj, (void*) (evaltyp(t_VEC)|evallg(1)));
  x = gnil;
  while ((y = readobj(f, &cy, H)))
  {
    x = y;
    switch(cy)
    {
      case BIN_GEN:
        pari_stack_pushp(&s_obj, (void*)y); break;
      case RELINK_TABLE:
        if (H) hash_destroy(H);
        H = hash_from_link(gel(y,1),gel(y,2), 0);
    }
  }
  if (H) hash_destroy(H);
  switch(s_obj.n) 
  {
    case 1: break; 
    case 2: x = gel(obj,1); break; 
    default: 
      setlg(obj, s_obj.n);
      if (DEBUGLEVEL)
        pari_warn(warner,"%ld unnamed objects read. Returning then in a vector",
                  s_obj.n - 1);
      x = gerepilecopy(av, obj);
      if (vector) *vector = 1;
  }
  pari_stack_delete(&s_obj);
  return x;
}
GEN readbin ( const char * name , FILE * f , int * vector ) { pari_sp av = avma ; hashtable * H = NULL ; pari_stack s_obj ; GEN obj , x , y ; int cy ; if ( vector ) * vector = 0 ; if ( ! check_magic ( name , f ) ) return NULL ; pari_stack_init ( & s_obj , sizeof ( GEN ) , ( void * * ) & obj ) ; pari_stack_pushp ( & s_obj , ( void * ) ( evaltyp ( t_VEC ) | evallg ( 1 ) ) ) ; x = gnil ; while ( ( y = readobj ( f , & cy , H ) ) ) { x = y ; switch ( cy ) { case BIN_GEN : pari_stack_pushp ( & s_obj , ( void * ) y ) ; break ; case RELINK_TABLE : if ( H ) hash_destroy ( H ) ; H = hash_from_link ( gel ( y , 1 ) , gel ( y , 2 ) , 0 ) ; } } if ( H ) hash_destroy ( H ) ; switch ( s_obj . n ) { case 1 : break ; case 2 : x = gel ( obj , 1 ) ; break ; default : setlg ( obj , s_obj . n ) ; if ( DEBUGLEVEL ) pari_warn ( warner , " " , s_obj . n - 1 ) ; x = gerepilecopy ( av , obj ) ; if ( vector ) * vector = 1 ; } pari_stack_delete ( & s_obj ) ; return x ; }
read all objects in f. If f contains BIN_GEN that would be silently ignored
 [i.e f contains more than one objet, not all of them 'named GENs'], return
 them all in a vector and set 'vector'.
read all objects in f . If f contains BIN_GEN that would be silently ignored [ i . e f contains more than one objet not all of them ' named GENs ' ] return them all in a vector and set ' vector ' .
/* HACK: push codeword so as to be able to treat s_obj.data as a t_VEC */ /* >= 1 */ /* nothing but the codeword */ /* read a single BIN_GEN */ /* more than one BIN_GEN */