src/stdlib/generic.c
/*=================================================
 * copy_generic_value -- copy from src to gen
 * This routine addrefs object, and delrefs it at destruction
 *===============================================*/
- copy from src to gen
This routine addrefs object, and delrefs it at destruction
- copy from src to gen This routine addrefs object and delrefs it at destruction
void
copy_generic_value (GENERIC *gen, const GENERIC * src)
{
	if (src == gen)
		return;
	switch(src->selector) {
	case GENERIC_NULL: clear_generic(gen); break;
	case GENERIC_INT: set_generic_int(gen, src->data.ival); break;
	case GENERIC_FLOAT: set_generic_float(gen, *src->data.fval); break;
	case GENERIC_STRING: set_generic_string(gen, src->data.sval); break;
	case GENERIC_STRING_SHARED: set_generic_string(gen, src->data.sval); break;
	case GENERIC_VPTR: set_generic_vptr(gen, src->data.vptr); break;
	case GENERIC_OBJECT: set_generic_object(gen, src->data.oval); break;
	default: ASSERT(0); break;
	}
}
void copy_generic_value ( GENERIC * gen , const GENERIC * src ) { if ( src == gen ) return ; switch ( src -> selector ) { case GENERIC_NULL : clear_generic ( gen ) ; break ; case GENERIC_INT : set_generic_int ( gen , src -> data . ival ) ; break ; case GENERIC_FLOAT : set_generic_float ( gen , * src -> data . fval ) ; break ; case GENERIC_STRING : set_generic_string ( gen , src -> data . sval ) ; break ; case GENERIC_STRING_SHARED : set_generic_string ( gen , src -> data . sval ) ; break ; case GENERIC_VPTR : set_generic_vptr ( gen , src -> data . vptr ) ; break ; case GENERIC_OBJECT : set_generic_object ( gen , src -> data . oval ) ; break ; default : ASSERT ( 0 ) ; break ; } }
copy_generic_value -- copy from src to gen
 This routine addrefs object, and delrefs it at destruction
copy_generic_value -- copy from src to gen This routine addrefs object and delrefs it at destruction
/* check for self-assignment */ /* every case of select either calls clear_generic, 
	or a set call which calls clear_generic */ /* set new value */