#include <stdio.h>
#include <string.h>
-#include <alloc.h>
+#include <stdlib.h>
#include "aslink.h"
/*)Module lklist.c
lop = 1;
}
+/* Used for qsort call in lstsym */
+static int _cmpSymByAddr(const void *p1, const void *p2)
+{
+ struct sym **s1 = (struct sym **)(p1);
+ struct sym **s2 = (struct sym **)(p2);
+ int delta = ((*s1)->s_addr + (*s1)->s_axp->a_addr) -
+ ((*s2)->s_addr + (*s2)->s_axp->a_addr);
+
+ /* Sort first by address, then by name. */
+ if (delta)
+ {
+ return delta;
+ }
+ return strcmp((*s1)->s_id,(*s2)->s_id);
+}
+
+
#if NCPS-8
/* NCPS != 8 */
* int j bubble sort update status
* char * ptr pointer to an id string
* int nmsym number of symbols in area
- * addr_t a0 temporary
- * addr_t ai temporary
- * addr_t aj temporary
+ * Addr_T a0 temporary
+ * Addr_T ai temporary
+ * Addr_T aj temporary
* sym * sp pointer to a symbol structure
* sym ** p pointer to an array of
* pointers to symbol structures
struct area *xp;
{
register struct areax *oxp;
- register int i, j;
+ register int i;
+ /* int j; */
register char *ptr;
int nmsym;
- addr_t a0, ai, aj;
+ /* Addr_T a0; */
+ Addr_T ai, aj;
struct sym *sp;
struct sym **p;
int memPage;
fprintf(mfp, "Decimal\n\n");
}
fprintf(mfp, "Area ");
- fprintf(mfp, "Addr Size Decimal Bytes (Attributes)\n");
+ fprintf(mfp, "Addr Size Decimal %s (Attributes)\n",
+ (xp->a_flag & A_BIT)?"Bits ":"Bytes");/* JCF: For BIT print bits...*/
fprintf(mfp, "-------------------------------- ");
fprintf(mfp, "---- ---- ------- ----- ------------\n");
/*
if (xflag == 2) {
fprintf(mfp, " %05u %05u", ai, aj);
}
- fprintf(mfp, " = %6u. bytes ", aj);
+ fprintf(mfp, " = %6u. %s ", aj,
+ (xp->a_flag & A_BIT)?"bits ":"bytes"); /* JCF: For BIT print bits...*/
if (xp->a_flag & A_ABS) {
fprintf(mfp, "(ABS");
} else {
oxp = oxp->a_axp;
}
+#if 0
/*
* Bubble Sort of Addresses in Symbol Table Array
*/
a0 = ai;
}
}
+#else
+ qsort(p, nmsym, sizeof(struct sym *), _cmpSymByAddr);
+#endif
/*
* Symbol Table Output
if (dflag &&
strchr(ptr,'$'))
fprintf(dfp,"L:%s:%X\n",ptr,aj);
+
/* NoICE output of symbol */
if (jflag) DefineNoICE( ptr, aj, memPage );
* int j bubble sort update status
* char * ptr pointer to an id string
* int nmsym number of symbols in area
- * addr_t a0 temporary
- * addr_t ai temporary
- * addr_t aj temporary
+ * Addr_T a0 temporary
+ * Addr_T ai temporary
+ * Addr_T aj temporary
* sym * sp pointer to a symbol structure
* sym ** p pointer to an array of
* pointers to symbol structures
register c, i, j;
register char *ptr;
int nmsym;
- addr_t a0, ai, aj;
+ Addr_T a0, ai, aj;
struct sym *sp;
struct sym **p;
int page;
oxp = oxp->a_axp;
}
+#if 0
/*
* Bubble Sort of Addresses in Symbol Table Array
*/
a0 = ai;
}
}
+#else
+ qsort(p, nmsym, sizeof(struct sym *), _cmpSymByAddr);
+#endif
/*
* Symbol Table Output
* output file.
*
* local variables:
- * addr_t pc current program counter address
+ * Addr_T pc current program counter address
*
* global variables:
* int hilo byte order
* output RST file
* int rtcnt count of data words
* int rtflg[] output the data flag
- * addr_t rtval[] relocated data
+ * Addr_T rtval[] relocated data
* FILE *tfp The file handle to the current
* LST file being scanned
*
lkulist(i)
int i;
{
- addr_t pc;
+ Addr_T pc;
/*
* Exit if listing file is not open
VOID
lkalist(pc)
-addr_t pc;
+Addr_T pc;
{
char str[8];
int i;
VOID
lkglist(pc,v)
-addr_t pc;
+Addr_T pc;
int v;
{
char str[8];