aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorKazu Hirata <kazu@codesourcery.com>2000-08-31 06:11:03 +0000
committerKazu Hirata <kazu@codesourcery.com>2000-08-31 06:11:03 +0000
commitcf39a089d6e4ad6ed14a8329077f01c12b2bf9fd (patch)
treec4e8e473525da25318e3c5181abb00993d1254f2 /gas
parent0359ddd6453523134f3e5061959a269f6cd64af9 (diff)
downloadgdb-cf39a089d6e4ad6ed14a8329077f01c12b2bf9fd.zip
gdb-cf39a089d6e4ad6ed14a8329077f01c12b2bf9fd.tar.gz
gdb-cf39a089d6e4ad6ed14a8329077f01c12b2bf9fd.tar.bz2
2000-08-31 Kazu Hirata <kazu@hxi.com>
* listing.c: Fix formatting.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog4
-rw-r--r--gas/listing.c233
2 files changed, 109 insertions, 128 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index b082781..e6dcb22 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,7 @@
+2000-08-31 Kazu Hirata <kazu@hxi.com>
+
+ * listing.c: Fix formatting.
+
2000-08-29 Kazu Hirata <kazu@hxi.com>
* app.c: Fix a comment typo. Fix formatting.
diff --git a/gas/listing.c b/gas/listing.c
index cecf245..9855228 100644
--- a/gas/listing.c
+++ b/gas/listing.c
@@ -1,5 +1,5 @@
/* listing.c - mainting assembly listings
- Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 1999
+ Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -17,12 +17,10 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GAS; see the file COPYING. If not, write to the Free
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA. */
+02111-1307, USA. */
/*
- Contributed by Steve Chamberlain
- sac@cygnus.com
-
+ Contributed by Steve Chamberlain <sac@cygnus.com>
A listing page looks like:
@@ -57,7 +55,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
If the counter goes below zero, listing is suppressed.
-
Listings are a maintained by read calling various listing_<foo>
functions. What happens most is that the macro NO_LISTING is not
defined (from the Makefile), then the macro LISTING_NEWLINE expands
@@ -121,7 +118,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#define LISTING_LHS_CONT_LINES 4
#endif
-/* This structure remembers which .s were used */
+/* This structure remembers which .s were used. */
typedef struct file_info_struct
{
struct file_info_struct * next;
@@ -133,32 +130,32 @@ typedef struct file_info_struct
file_info_type;
/* This structure rememebrs which line from which file goes into which
- frag */
+ frag. */
struct list_info_struct
{
- /* Frag which this line of source is nearest to */
- fragS * frag;
+ /* Frag which this line of source is nearest to. */
+ fragS *frag;
- /* The actual line in the source file */
+ /* The actual line in the source file. */
unsigned int line;
/* Pointer to the file info struct for the file which this line
- belongs to */
- file_info_type * file;
+ belongs to. */
+ file_info_type *file;
/* The expanded text of any macro that may have been executing. */
- char * line_contents;
+ char *line_contents;
- /* Next in list */
- struct list_info_struct * next;
+ /* Next in list. */
+ struct list_info_struct *next;
/* Pointer to the file info struct for the high level language
- source line that belongs here */
- file_info_type * hll_file;
- /* High level language source line */
+ source line that belongs here. */
+ file_info_type *hll_file;
+ /* High level language source line. */
unsigned int hll_line;
- /* Pointer to any error message associated with this line */
- char * message;
+ /* Pointer to any error message associated with this line. */
+ char *message;
enum
{
@@ -170,7 +167,7 @@ struct list_info_struct
EDICT_NOLIST_NEXT,
EDICT_EJECT
} edict;
- char * edict_arg;
+ char *edict_arg;
/* Nonzero if this line is to be omitted because it contains
debugging information. This can become a flags field if we come
@@ -180,7 +177,6 @@ struct list_info_struct
typedef struct list_info_struct list_info_type;
-
int listing_lhs_width = LISTING_LHS_WIDTH;
int listing_lhs_width_second = LISTING_LHS_WIDTH_SECOND;
int listing_lhs_cont_lines = LISTING_LHS_CONT_LINES;
@@ -209,13 +205,13 @@ static FILE * list_file;
* listing_lhs_cont_lines) \
+ 20)
-static char * data_buffer;
+static char *data_buffer;
/* Prototypes. */
static void listing_message PARAMS ((const char *name, const char *message));
static file_info_type * file_info PARAMS ((const char *file_name));
static void new_frag PARAMS ((void));
-static char * buffer_line PARAMS ((file_info_type *file,
+static char *buffer_line PARAMS ((file_info_type *file,
char *line, unsigned int size));
static void listing_page PARAMS ((list_info_type *list));
static unsigned int calc_hex PARAMS ((list_info_type *list));
@@ -229,7 +225,6 @@ static void print_source PARAMS ((file_info_type *current_file,
static int debugging_pseudo PARAMS ((list_info_type *, const char *));
static void listing_listing PARAMS ((char *name));
-
static void
listing_message (name, message)
const char *name;
@@ -263,7 +258,7 @@ static file_info_type *
file_info (file_name)
const char *file_name;
{
- /* Find an entry with this file name */
+ /* Find an entry with this file name. */
file_info_type *p = file_info_head;
while (p != (file_info_type *) NULL)
@@ -273,7 +268,7 @@ file_info (file_name)
p = p->next;
}
- /* Make new entry */
+ /* Make new entry. */
p = (file_info_type *) xmalloc (sizeof (file_info_type));
p->next = file_info_head;
@@ -287,7 +282,6 @@ file_info (file_name)
return p;
}
-
static void
new_frag ()
{
@@ -334,7 +328,8 @@ listing_newline (ps)
as_where (&file, &line);
if (ps == NULL)
{
- if (line == last_line && !(last_file && file && strcmp (file, last_file)))
+ if (line == last_line
+ && !(last_file && file && strcmp (file, last_file)))
return;
new = (list_info_type *) xmalloc (sizeof (list_info_type));
@@ -346,22 +341,22 @@ listing_newline (ps)
same as the one used by input_scrub_new_file(), if that is
not true, then this code will fail].
- If we are reading from stdin, then we need to save each input line
- here (assuming of course that we actually have a line of input to read),
- so that it can be displayed in the listing that is produced at the end
- of the assembly. */
+ If we are reading from stdin, then we need to save each input
+ line here (assuming of course that we actually have a line of
+ input to read), so that it can be displayed in the listing
+ that is produced at the end of the assembly. */
if (strcmp (file, _("{standard input}")) == 0
&& input_line_pointer != NULL)
{
- char * copy;
+ char *copy;
int len;
int seen_quote = 0;
for (copy = input_line_pointer - 1;
- * copy && (seen_quote
- || (! is_end_of_line [(unsigned char) * copy]));
- copy ++)
- if (* copy == '"' && copy[-1] != '\\')
+ *copy && (seen_quote
+ || (! is_end_of_line [(unsigned char) *copy]));
+ copy++)
+ if (*copy == '"' && copy[-1] != '\\')
seen_quote = ! seen_quote;
len = (copy - input_line_pointer) + 2;
@@ -370,21 +365,21 @@ listing_newline (ps)
if (copy != NULL)
{
- char * src = input_line_pointer - 1;
- char * dest = copy;
-
+ char *src = input_line_pointer - 1;
+ char *dest = copy;
+
while (--len)
{
- unsigned char c = * src ++;
+ unsigned char c = *src++;
/* Omit control characters in the listing. */
if (isascii (c) && ! iscntrl (c))
- * dest ++ = c;
+ *dest++ = c;
}
-
+
*dest = 0;
}
-
+
new->line_contents = copy;
}
else
@@ -398,14 +393,14 @@ listing_newline (ps)
last_line = line;
last_file = file;
-
+
new_frag ();
if (listing_tail)
listing_tail->next = new;
else
head = new;
-
+
listing_tail = new;
new->frag = frag_now;
@@ -417,7 +412,7 @@ listing_newline (ps)
new->hll_file = (file_info_type *) NULL;
new->hll_line = 0;
new->debugging = 0;
-
+
new_frag ();
#ifdef OBJ_ELF
@@ -464,15 +459,13 @@ listing_prev_line ()
new_frag ();
}
-/*
- This function returns the next source line from the file supplied,
- truncated to size. It appends a fake line to the end of each input
- file to make
-*/
+/* This function returns the next source line from the file supplied,
+ truncated to size. It appends a fake line to the end of each input
+ file to make. */
static char *
buffer_line (file, line, size)
- file_info_type * file;
+ file_info_type *file;
char *line;
unsigned int size;
{
@@ -481,7 +474,7 @@ buffer_line (file, line, size)
char *p = line;
- /* If we couldn't open the file, return an empty line */
+ /* If we couldn't open the file, return an empty line. */
if (file->at_end)
return "";
@@ -501,15 +494,16 @@ buffer_line (file, line, size)
file->at_end = 1;
return "";
}
-
+
/* Seek to where we were last time this file was open. */
if (file->pos)
- fseek(last_open_file, file->pos, SEEK_SET);
+ fseek (last_open_file, file->pos, SEEK_SET);
}
c = fgetc (last_open_file);
- size -= 1; /* leave room for null */
+ /* Leave room for null. */
+ size -= 1;
while (c != EOF && c != '\n')
{
@@ -532,23 +526,22 @@ buffer_line (file, line, size)
return line;
}
-
static const char *fn;
static unsigned int eject; /* Eject pending */
static unsigned int page; /* Current page number */
-static char *title; /* current title */
-static char *subtitle; /* current subtitle */
-static unsigned int on_page; /* number of lines printed on current page */
-
+static char *title; /* Current title */
+static char *subtitle; /* Current subtitle */
+static unsigned int on_page; /* Number of lines printed on current page */
static void
listing_page (list)
list_info_type *list;
{
/* Grope around, see if we can see a title or subtitle edict coming up
- soon (we look down 10 lines of the page and see if it's there)*/
- if ((eject || (on_page >= (unsigned int) paper_height)) && paper_height != 0)
+ soon. (we look down 10 lines of the page and see if it's there) */
+ if ((eject || (on_page >= (unsigned int) paper_height))
+ && paper_height != 0)
{
unsigned int c = 10;
int had_title = 0;
@@ -572,7 +565,6 @@ listing_page (list)
c--;
}
-
if (page > 1)
{
fprintf (list_file, "\f");
@@ -586,19 +578,18 @@ listing_page (list)
}
}
-
static unsigned int
calc_hex (list)
- list_info_type * list;
+ list_info_type *list;
{
int data_buffer_size;
list_info_type *first = list;
- unsigned int address = ~ (unsigned int) 0;
+ unsigned int address = ~(unsigned int) 0;
fragS *frag;
fragS *frag_ptr;
unsigned int octet_in_frag;
- /* Find first frag which says it belongs to this line */
+ /* Find first frag which says it belongs to this line. */
frag = list->frag;
while (frag && frag->line != list)
frag = frag->fr_next;
@@ -607,15 +598,15 @@ calc_hex (list)
data_buffer_size = 0;
- /* Dump all the frags which belong to this line */
+ /* Dump all the frags which belong to this line. */
while (frag_ptr != (fragS *) NULL && frag_ptr->line == first)
{
- /* Print as many bytes from the fixed part as is sensible */
+ /* Print as many bytes from the fixed part as is sensible. */
octet_in_frag = 0;
while ((offsetT) octet_in_frag < frag_ptr->fr_fix
&& data_buffer_size < MAX_BYTES - 3)
{
- if (address == ~ (unsigned int) 0)
+ if (address == ~(unsigned int) 0)
{
address = frag_ptr->fr_address / OCTETS_PER_BYTE;
}
@@ -630,12 +621,12 @@ calc_hex (list)
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 */
+ /* Print as many bytes from the variable part as is sensible. */
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)
+ if (address == ~(unsigned int) 0)
{
address = frag_ptr->fr_address / OCTETS_PER_BYTE;
}
@@ -662,11 +653,6 @@ calc_hex (list)
return address;
}
-
-
-
-
-
static void
print_lines (list, lineno, string, address)
list_info_type *list;
@@ -681,21 +667,21 @@ print_lines (list, lineno, string, address)
char *src = data_buffer;
int cur;
- /* Print the stuff on the first line */
+ /* Print the stuff on the first line. */
listing_page (list);
nchars = (LISTING_WORD_SIZE * 2 + 1) * listing_lhs_width;
-
- /* Print the hex for the first line */
- if (address == ~ (unsigned int) 0)
+
+ /* Print the hex for the first line. */
+ if (address == ~(unsigned int) 0)
{
fprintf (list_file, "% 4d ", lineno);
for (idx = 0; idx < nchars; idx++)
fprintf (list_file, " ");
fprintf (list_file, "\t%s\n", string ? string : "");
-
- on_page ++;
-
+
+ on_page++;
+
listing_page (0);
return;
@@ -706,62 +692,61 @@ print_lines (list, lineno, string, address)
else
fprintf (list_file, "% 4d %04x ", lineno, address);
- /* And the data to go along with it */
+ /* And the data to go along with it. */
idx = 0;
cur = 0;
while (src[cur] && idx < nchars)
{
int offset;
offset = cur;
- fprintf (list_file, "%c%c", src[offset], src[offset+1]);
+ fprintf (list_file, "%c%c", src[offset], src[offset + 1]);
cur += 2;
octet_in_word++;
-
+
if (octet_in_word == LISTING_WORD_SIZE)
{
fprintf (list_file, " ");
idx++;
octet_in_word = 0;
}
-
+
idx += 2;
}
-
+
for (; idx < nchars; idx++)
fprintf (list_file, " ");
-
+
fprintf (list_file, "\t%s\n", string ? string : "");
on_page++;
listing_page (list);
-
+
if (list->message)
{
fprintf (list_file, "**** %s\n", list->message);
listing_page (list);
on_page++;
}
-
+
for (lines = 0;
lines < (unsigned int) listing_lhs_cont_lines
&& src[cur];
- lines ++)
+ lines++)
{
- nchars = ((LISTING_WORD_SIZE * 2) + 1)
- * listing_lhs_width_second - 1;
+ nchars = ((LISTING_WORD_SIZE * 2) + 1) * listing_lhs_width_second - 1;
idx = 0;
-
- /* Print any more lines of data, but more compactly */
+
+ /* Print any more lines of data, but more compactly. */
fprintf (list_file, "% 4d ", lineno);
-
+
while (src[cur] && idx < nchars)
{
- int offset;
- offset = cur;
- fprintf (list_file, "%c%c", src[offset], src[offset+1]);
+ int offset;
+ offset = cur;
+ fprintf (list_file, "%c%c", src[offset], src[offset + 1]);
cur += 2;
idx += 2;
octet_in_word++;
-
+
if (octet_in_word == LISTING_WORD_SIZE)
{
fprintf (list_file, " ");
@@ -769,14 +754,13 @@ print_lines (list, lineno, string, address)
octet_in_word = 0;
}
}
-
+
fprintf (list_file, "\n");
- on_page ++;
+ on_page++;
listing_page (list);
}
}
-
static void
list_symbol_table ()
{
@@ -841,7 +825,7 @@ list_symbol_table ()
buf, S_GET_NAME (ptr));
}
- on_page ++;
+ on_page++;
listing_page (0);
}
}
@@ -1008,7 +992,6 @@ listing_listing (name)
list = head->next;
-
while (list)
{
unsigned int list_line;
@@ -1094,7 +1077,7 @@ listing_listing (name)
p = buffer_line (list->file, buffer, width);
if (list->file->linenum < list_line)
- address = ~ (unsigned int) 0;
+ address = ~(unsigned int) 0;
else
address = calc_hex (list);
@@ -1126,7 +1109,7 @@ listing_print (name)
char *name;
{
int using_stdout;
-
+
title = "";
subtitle = "";
@@ -1175,7 +1158,6 @@ listing_print (name)
}
}
-
void
listing_file (name)
const char *name;
@@ -1235,7 +1217,6 @@ listing_list (on)
}
}
-
void
listing_psize (width_only)
int width_only;
@@ -1324,8 +1305,6 @@ listing_title (depth)
}
}
-
-
void
listing_source_line (line)
unsigned int line;
@@ -1346,12 +1325,9 @@ listing_source_file (file)
listing_tail->hll_file = file_info (file);
}
-
-
#else
-
-/* Dummy functions for when compiled without listing enabled */
+/* Dummy functions for when compiled without listing enabled. */
void
listing_flags (ignore)
@@ -1360,21 +1336,21 @@ listing_flags (ignore)
s_ignore (0);
}
-void
+void
listing_list (on)
int on;
{
s_ignore (0);
}
-void
+void
listing_eject (ignore)
int ignore;
{
s_ignore (0);
}
-void
+void
listing_psize (ignore)
int ignore;
{
@@ -1388,7 +1364,7 @@ listing_nopage (ignore)
s_ignore (0);
}
-void
+void
listing_title (depth)
int depth;
{
@@ -1402,20 +1378,21 @@ listing_file (name)
}
-void
+void
listing_newline (name)
char *name;
{
}
-void
+void
listing_source_line (n)
unsigned int n;
{
}
-void
+
+void
listing_source_file (n)
const char *n;
{