This is relocation.c in view mode; [Download] [Up]
#include "dis.h" /* * relocation information storage and preparation routines. * * $Log: relocation.c,v $ * Revision 1.4 94/08/22 23:59:08 ediger * corrected a goof in set_sections() * * Revision 1.2 94/08/22 22:31:26 ediger * ditch movmem macro, change a global variable name * * Revision 1.1 94/05/30 23:07:43 ediger * Initial revision * */ static char rcsident[] = "$Id: relocation.c,v 1.4 94/08/22 23:59:08 ediger Exp Locker: ediger $"; struct section *sectiontable[50]; /* note that index of 1 is location 0! */ void sortreltables(char *map) { int sectn; struct section *q; struct relocation_info *r, temp; int i, j; for (sectn = 0; q = sectiontable[sectn]; sectn++) { /* sort into descending order: */ r = (struct relocation_info *)(map + q->reloff); for (i = 0; i < q->nreloc; i++) { for (j = i - 1; j >= 0 && r[j].r_address < r[i].r_address; j--) ; j++; if (j < i) { temp = r[i]; memmove( r + j + 1, r + j, (i - j) * sizeof(struct relocation_info) ); r[j] = temp; } } } } /* has to be global, as set_sections gets called several times */ int giTotalSections = 0; int set_sections(struct segment_command *spSegCmd) { int i; struct section *spSection; spSection = (struct section *) (spSegCmd + 1); for (i = 0; i < spSegCmd->nsects; spSection++, i++) sectiontable[giTotalSections++] = spSection; return giTotalSections; }
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.