Thu Jul 6 12:54:27 1995 Ian Lance Taylor <ian@cygnus.com>
+ * listing.c (struct file_info_struct): Rename end_pending field to
+ at_end.
+ (file_info): Initialize at_end, not end_pending.
+ (buffer_line): If at_end set, just return immediately. Don't
+ worry about end_pending cases. Set at_end when EOF is read.
+ (print_source): Check at_end, not end_pending.
+ (listing_listing): Likewise.
+
* config/tc-alpha.h (alpha_do_align): Don't declare.
(md_do_align): Don't define.
(tc_frob_label): Define.
int linenum;
FILE *file;
struct file_info_struct *next;
- int end_pending;
+ int at_end;
}
file_info_type;
p->filename = xmalloc ((unsigned long) strlen (file_name) + 1);
strcpy (p->filename, file_name);
p->linenum = 0;
- p->end_pending = 0;
+ p->at_end = 0;
p->file = fopen (p->filename, "r");
if (p->file)
list_info_type *new;
as_where (&file, &line);
- if (line != last_line || last_file && file && strcmp(file, last_file))
+ if (line != last_line || (last_file && file && strcmp(file, last_file)))
{
last_line = line;
last_file = file;
char *p = line;
/* If we couldn't open the file, return an empty line */
- if (file->file == (FILE *) NULL)
+ if (file->file == (FILE *) NULL || file->at_end)
{
return "";
}
if (file->linenum == 0)
rewind (file->file);
- if (file->end_pending == 10)
- {
- *p++ = '\n';
-#if 1
- fseek (file->file, 0, 0);
- file->linenum = 0;
-#else
- file->linenum = 9999999;
-#endif
- file->end_pending = 0;
- }
c = fgetc (file->file);
-
size -= 1; /* leave room for null */
while (c != EOF && c != '\n')
}
if (c == EOF)
{
- file->end_pending++;
+ file->at_end = 1;
*p++ = '.';
*p++ = '.';
*p++ = '.';
sprintf (buf, "%08lx", (unsigned long) val);
else if (sizeof (val) <= sizeof (unsigned long))
{
- sprintf (fmt, "%%0%dlx", sizeof (val) * 2);
+ sprintf (fmt, "%%0%lulx",
+ (unsigned long) (sizeof (val) * 2));
sprintf (buf, fmt, (unsigned long) val);
}
#if defined (BFD64)
if (current_file->file)
{
while (current_file->linenum < list->hll_line
- && current_file->end_pending == 0)
+ && !current_file->at_end)
{
char *p = buffer_line (current_file, buffer, width);
printf ("%4d:%-13s **** %s\n", current_file->linenum, current_file->filename, p);
while (list->file->file
&& list->file->linenum < list->line
- && !list->file->end_pending)
+ && !list->file->at_end)
{
p = buffer_line (list->file, buffer, width);
{
while (list->file->file
&& list->file->linenum < list->line
- && !list->file->end_pending)
+ && !list->file->at_end)
p = buffer_line (list->file, buffer, width);
}