STATIC void putName( type_rec *tr, name_handle name_hdl ) { const char *name; uint_8 *p; uint_16 len; name = NameGet( name_hdl ); if( name == NULL ) { len = 0; } else { len = strlen( name ); } p = getTrData( tr, len + 2 ); p[0] = MS_BCL_STRING; p[1] = len; memcpy( p + 2, name, len ); }
STATIC int writePubdef( obj_rec *objr, pobj_state *state ) { int is32; OBJ_WFILE *out; const char *name; size_t name_len; pubdef_data *pubdata; pubdef_data *pubstop; /**/myassert( objr != NULL ); /**/myassert( objr->command == CMD_PUBDEF || objr->command == CMD_STATIC_PUBDEF ); /**/myassert( state != NULL ); /**/myassert( state->pass == POBJ_WRITE_PASS ); is32 = objr->is_32 || objr->is_phar; if( is32 ) { objr->command |= 1; } out = state->file_out; ObjWBegRec( out, objr->command ); writeBase( objr, out ); pubdata = objr->d.pubdef.pubs; if( pubdata != NULL ) { pubstop = pubdata + objr->d.pubdef.num_pubs; while( pubdata < pubstop ) { name = NameGet( pubdata->name ); name_len = strlen( name ); if( name_len > 255 ) name_len = 255; ObjWrite8( out, (uint_8)name_len ); ObjWrite( out, (uint_8 *)name, (uint_16)name_len ); if( is32 ) { ObjWrite32( out, pubdata->offset ); } else { ObjWrite16( out, (uint_16)pubdata->offset ); } ObjWriteIndex( out, pubdata->type.idx ); ++pubdata; } } ObjWEndRec( out ); return( 0 ); }