/* listing.c - mainting assembly listings
- Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 1998
+ Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 1999
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
int seen_quote = 0;
for (copy = input_line_pointer - 1;
- * copy && (seen_quote || (! is_end_of_line [* copy]));
+ * copy && (seen_quote
+ || (! is_end_of_line [(unsigned char) * copy]));
copy ++)
- if (* copy == '"' && copy[-1] != '\')
+ if (* copy == '"' && copy[-1] != '\\')
seen_quote = ! seen_quote;
len = (copy - input_line_pointer) + 2;
while (--len)
{
- char c = * src ++;
+ unsigned char c = * src ++;
/* Omit control characters in the listing. */
if (isascii (c) && ! iscntrl (c))
unsigned int address = ~ (unsigned int) 0;
fragS *frag;
fragS *frag_ptr;
- unsigned int byte_in_frag;
+ unsigned int octet_in_frag;
/* Find first frag which says it belongs to this line */
frag = list->frag;
while (frag_ptr != (fragS *) NULL && frag_ptr->line == first)
{
/* Print as many bytes from the fixed part as is sensible */
- byte_in_frag = 0;
- while ((offsetT) byte_in_frag < frag_ptr->fr_fix
+ octet_in_frag = 0;
+ while ((offsetT) octet_in_frag < frag_ptr->fr_fix
&& data_buffer_size < MAX_BYTES - 3)
{
if (address == ~ (unsigned int) 0)
{
- address = frag_ptr->fr_address;
+ address = frag_ptr->fr_address / OCTETS_PER_BYTE;
}
sprintf (data_buffer + data_buffer_size,
"%02X",
- (frag_ptr->fr_literal[byte_in_frag]) & 0xff);
+ (frag_ptr->fr_literal[octet_in_frag]) & 0xff);
data_buffer_size += 2;
- byte_in_frag++;
+ octet_in_frag++;
}
{
- unsigned int var_rep_max = byte_in_frag;
- unsigned int var_rep_idx = byte_in_frag;
+ unsigned int var_rep_max = octet_in_frag;
+ unsigned int var_rep_idx = octet_in_frag;
/* Print as many bytes from the variable part as is sensible */
- while (((offsetT) byte_in_frag
- < frag_ptr->fr_fix + frag_ptr->fr_var * frag_ptr->fr_offset)
+ while (((offsetT) octet_in_frag
+ < (frag_ptr->fr_fix + frag_ptr->fr_var * frag_ptr->fr_offset))
&& data_buffer_size < MAX_BYTES - 3)
{
if (address == ~ (unsigned int) 0)
{
- address = frag_ptr->fr_address;
+ address = frag_ptr->fr_address / OCTETS_PER_BYTE;
}
sprintf (data_buffer + data_buffer_size,
"%02X",
data_buffer_size += 2;
var_rep_idx++;
- byte_in_frag++;
+ octet_in_frag++;
if ((offsetT) var_rep_idx >= frag_ptr->fr_fix + frag_ptr->fr_var)
var_rep_idx = var_rep_max;
unsigned int idx;
unsigned int nchars;
unsigned int lines;
- unsigned int byte_in_word = 0;
+ unsigned int octet_in_word = 0;
char *src = data_buffer;
+ int end = strlen(src);
+ int cur;
/* Print the stuff on the first line */
listing_page (list);
/* And the data to go along with it */
idx = 0;
-
- while (*src && idx < nchars)
+ cur = 0;
+ while (src[cur] && idx < nchars)
{
- fprintf (list_file, "%c%c", src[0], src[1]);
- src += 2;
- byte_in_word++;
+ int offset;
+#if TARGET_BYTES_BIG_ENDIAN != 0
+ offset = cur;
+ fprintf (list_file, "%c%c", src[offset], src[offset+1]);
+#else
+ offset = (cur & ~(LISTING_WORD_SIZE * 2 - 1))
+ + (LISTING_WORD_SIZE - octet_in_word - 1) * 2;
+ if (offset < end)
+ fprintf (list_file, "%c%c", src[offset], src[offset+1]);
+#endif
+ cur += 2;
+ octet_in_word++;
- if (byte_in_word == LISTING_WORD_SIZE)
+ if (octet_in_word == LISTING_WORD_SIZE)
{
fprintf (list_file, " ");
idx++;
- byte_in_word = 0;
+ octet_in_word = 0;
}
idx += 2;
for (lines = 0;
lines < (unsigned int) listing_lhs_cont_lines
- && *src;
+ && src[cur];
lines ++)
{
nchars = ((LISTING_WORD_SIZE * 2) + 1)
/* Print any more lines of data, but more compactly */
fprintf (list_file, "% 4d ", lineno);
- while (*src && idx < nchars)
+ while (src[cur] && idx < nchars)
{
- fprintf (list_file, "%c%c", src[0], src[1]);
- src += 2;
+ int offset;
+#if TARGET_BYTES_BIG_ENDIAN != 0
+ offset = cur;
+ fprintf (list_file, "%c%c", src[offset], src[offset+1]);
+#else
+ offset = (cur & ~(LISTING_WORD_SIZE * 2 - 1))
+ + (LISTING_WORD_SIZE - octet_in_word - 1) * 2;
+ if (offset < end)
+ fprintf (list_file, "%c%c", src[offset], src[offset+1]);
+#endif
+ cur += 2;
idx += 2;
- byte_in_word++;
+ octet_in_word++;
- if (byte_in_word == LISTING_WORD_SIZE)
+ if (octet_in_word == LISTING_WORD_SIZE)
{
fprintf (list_file, " ");
idx++;
- byte_in_word = 0;
+ octet_in_word = 0;
}
}
{
#ifdef BFD_ASSEMBLER
/* Don't report section symbols. They are not interesting. */
- if (ptr->bsym->flags & BSF_SECTION_SYM)
+ if (symbol_section_p (ptr))
continue;
#endif
if (S_GET_NAME (ptr))
got_some = 1;
}
- if (ptr->sy_frag && ptr->sy_frag->line)
+ if (symbol_get_frag (ptr) && symbol_get_frag (ptr)->line)
{
fprintf (list_file, "%20s:%-5d %s:%s %s\n",
- ptr->sy_frag->line->file->filename,
- ptr->sy_frag->line->line,
+ symbol_get_frag (ptr)->line->file->filename,
+ symbol_get_frag (ptr)->line->line,
segment_name (S_GET_SEGMENT (ptr)),
buf, S_GET_NAME (ptr));
}
static void
listing_listing (name)
- char *name;
+ char *name ATTRIBUTE_UNUSED;
{
list_info_type *list = head;
file_info_type *current_hll_file = (file_info_type *) NULL;
while (list)
{
- int list_line;
+ unsigned int list_line;
width = listing_rhs_width > paper_width ? paper_width :
listing_rhs_width;
void
listing_eject (ignore)
- int ignore;
+ int ignore ATTRIBUTE_UNUSED;
{
if (listing)
listing_tail->edict = EDICT_EJECT;
void
listing_flags (ignore)
- int ignore;
+ int ignore ATTRIBUTE_UNUSED;
{
while ((*input_line_pointer++) && (*input_line_pointer != '\n'))
input_line_pointer++;
void
listing_nopage (ignore)
- int ignore;
+ int ignore ATTRIBUTE_UNUSED;
{
paper_height = 0;
}