Example #1
0
static obj copy_table_dir( obj src_vec )
{
obj dst_vec, bucket;
UINT_32 mask, j, n;

    n = SIZEOF_PTR(src_vec);
    dst_vec = alloc( n, vector_class );
    for (j=0; j<n; j+=SLOT(1))
    {
        bucket = gvec_read( src_vec, j );
	if (!EQ(bucket,FALSE_OBJ))
	{
	  int n = fx2int( gvec_read( bucket, BUCKET_BITS ) );

	  mask = (~(SLOT(1)-1)) << n;
	    
	  if (j & mask)
	    /*  its a duplicate (shared) bucket, because
	     *  an upper bit (relative to the # bits it represents)
	     *  of its index is non-zero
	     */
	    bucket = gvec_read( dst_vec, (j & ~mask) );
	  else
	    /*  its upper bits are zero, so it is the first occurrence
	     *  of the chain.  hence, copy the chain, too
	     */
	    bucket = copy_bucket_chain( bucket );
	  
	  gvec_write_init_ptr( dst_vec, j, bucket );
	}
	else
	  gvec_write_init_non_ptr( dst_vec, j, FALSE_OBJ );
    }
    return dst_vec;
}
Example #2
0
obj flush_link_data( void )
{
  obj e, v = alloc( SLOT(num_link_data_entries), vector_class );
  struct unit_linkage_data *p;
  unsigned i;

  for (i=num_link_data_entries, p=link_top; p; p=p->next)
    {
      char t1[30], t2[30];

      i--;
      sprintf( t1, "memory:%lu", (unsigned long)p->link_meta_data );
      sprintf( t2, "memory:%lu", (unsigned long)p->link_unit_data );

      e = make3( vector_class,
		 make_string( p->name ),
		 make_string( t1 ),
		 make_string( t2 ) );
      gvec_write_init_ptr( v, SLOT(i), e );
    }

  link_top = NULL;
  num_link_data_entries = 0;

  return v;
}
Example #3
0
static obj slurp_queue( SaveQueue *q )
{
  UINT_32 i, n = q->count;
  struct queue_entry *p;
  obj x;
  
  x = alloc( SLOT(n), vector_class );

  for (i=0, p=q->contents; i<n; i++, p++)
    gvec_write_init_ptr( x, SLOT(i), p->thing );
  return x;
}