2002-11-21 Andrew Cagney <ac131313@redhat.com>
* Makefile.in: Update copyright. IGEN contributed to the FSF.
* filter.c, filter.h, filter_host.c, filter_host.h: Ditto.
* gen-engine.c, gen-engine.h, gen-icache.c, gen-icache.h: Ditto.
* gen-idecode.c, gen-idecode.h, gen-itable.c: Ditto.
* gen-itable.h, gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h, gen.c: Ditto.
* gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:09:40 +08:00
|
|
|
/* The IGEN simulator generator for GDB, the GNU Debugger.
|
1999-04-16 09:35:26 +08:00
|
|
|
|
2022-01-01 22:56:03 +08:00
|
|
|
Copyright 2002-2022 Free Software Foundation, Inc.
|
1999-04-16 09:35:26 +08:00
|
|
|
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* Makefile.in: Update copyright. IGEN contributed to the FSF.
* filter.c, filter.h, filter_host.c, filter_host.h: Ditto.
* gen-engine.c, gen-engine.h, gen-icache.c, gen-icache.h: Ditto.
* gen-idecode.c, gen-idecode.h, gen-itable.c: Ditto.
* gen-itable.h, gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h, gen.c: Ditto.
* gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:09:40 +08:00
|
|
|
Contributed by Andrew Cagney.
|
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2007-08-24 22:30:15 +08:00
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* Makefile.in: Update copyright. IGEN contributed to the FSF.
* filter.c, filter.h, filter_host.c, filter_host.h: Ditto.
* gen-engine.c, gen-engine.h, gen-icache.c, gen-icache.h: Ditto.
* gen-idecode.c, gen-idecode.h, gen-itable.c: Ditto.
* gen-itable.h, gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h, gen.c: Ditto.
* gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:09:40 +08:00
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
2007-08-24 22:30:15 +08:00
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
1999-04-16 09:35:26 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
|
|
|
|
#include "misc.h"
|
|
|
|
#include "lf.h"
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:20:49 +08:00
|
|
|
struct _lf
|
|
|
|
{
|
1999-04-16 09:35:26 +08:00
|
|
|
FILE *stream;
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:20:49 +08:00
|
|
|
int line_nr; /* nr complete lines written, curr line is line_nr+1 */
|
1999-04-16 09:35:26 +08:00
|
|
|
int indent;
|
|
|
|
int line_blank;
|
|
|
|
const char *name;
|
|
|
|
const char *program;
|
|
|
|
lf_file_references references;
|
|
|
|
lf_file_type type;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
lf *
|
|
|
|
lf_open (char *name,
|
|
|
|
char *real_name,
|
|
|
|
lf_file_references references,
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:20:49 +08:00
|
|
|
lf_file_type type, const char *program)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
/* create a file object */
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:20:49 +08:00
|
|
|
lf *new_lf = ZALLOC (lf);
|
1999-04-16 09:35:26 +08:00
|
|
|
ASSERT (new_lf != NULL);
|
|
|
|
new_lf->references = references;
|
|
|
|
new_lf->type = type;
|
|
|
|
new_lf->name = (real_name == NULL ? name : real_name);
|
|
|
|
new_lf->program = program;
|
|
|
|
/* attach to stdout if pipe */
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:20:49 +08:00
|
|
|
if (!strcmp (name, "-"))
|
|
|
|
{
|
|
|
|
new_lf->stream = stdout;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* create a new file */
|
|
|
|
new_lf->stream = fopen (name, "w");
|
|
|
|
if (new_lf->stream == NULL)
|
|
|
|
{
|
|
|
|
perror (name);
|
|
|
|
exit (1);
|
|
|
|
}
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
|
|
|
return new_lf;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-07-03 00:10:49 +08:00
|
|
|
lf_file_type
|
|
|
|
lf_get_file_type (const lf *file)
|
|
|
|
{
|
|
|
|
return file->type;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-04-16 09:35:26 +08:00
|
|
|
void
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:20:49 +08:00
|
|
|
lf_close (lf *file)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:20:49 +08:00
|
|
|
if (file->stream != stdout)
|
|
|
|
{
|
|
|
|
if (fclose (file->stream))
|
|
|
|
{
|
|
|
|
perror ("lf_close.fclose");
|
|
|
|
exit (1);
|
|
|
|
}
|
|
|
|
free (file);
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:20:49 +08:00
|
|
|
lf_putchr (lf *file, const char chr)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
int nr = 0;
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:20:49 +08:00
|
|
|
if (chr == '\n')
|
|
|
|
{
|
|
|
|
file->line_nr += 1;
|
|
|
|
file->line_blank = 1;
|
|
|
|
}
|
|
|
|
else if (file->line_blank)
|
|
|
|
{
|
|
|
|
int pad;
|
|
|
|
for (pad = file->indent; pad > 0; pad--)
|
|
|
|
putc (' ', file->stream);
|
|
|
|
nr += file->indent;
|
|
|
|
file->line_blank = 0;
|
|
|
|
}
|
|
|
|
putc (chr, file->stream);
|
1999-04-16 09:35:26 +08:00
|
|
|
nr += 1;
|
|
|
|
return nr;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:20:49 +08:00
|
|
|
lf_write (lf *file, const char *string, int strlen_string)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
int nr = 0;
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < strlen_string; i++)
|
|
|
|
nr += lf_putchr (file, string[i]);
|
|
|
|
return nr;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:20:49 +08:00
|
|
|
lf_indent_suppress (lf *file)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
file->line_blank = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:20:49 +08:00
|
|
|
lf_putstr (lf *file, const char *string)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
int nr = 0;
|
|
|
|
const char *chp;
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:20:49 +08:00
|
|
|
if (string != NULL)
|
|
|
|
{
|
|
|
|
for (chp = string; *chp != '\0'; chp++)
|
|
|
|
{
|
|
|
|
nr += lf_putchr (file, *chp);
|
|
|
|
}
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
|
|
|
return nr;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:20:49 +08:00
|
|
|
do_lf_putunsigned (lf *file, unsigned u)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
int nr = 0;
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:20:49 +08:00
|
|
|
if (u > 0)
|
|
|
|
{
|
|
|
|
nr += do_lf_putunsigned (file, u / 10);
|
|
|
|
nr += lf_putchr (file, (u % 10) + '0');
|
|
|
|
}
|
1999-04-16 09:35:26 +08:00
|
|
|
return nr;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:20:49 +08:00
|
|
|
lf_putint (lf *file, int decimal)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
int nr = 0;
|
|
|
|
if (decimal == 0)
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:20:49 +08:00
|
|
|
nr += lf_putchr (file, '0');
|
|
|
|
else if (decimal < 0)
|
|
|
|
{
|
|
|
|
nr += lf_putchr (file, '-');
|
|
|
|
nr += do_lf_putunsigned (file, -decimal);
|
|
|
|
}
|
|
|
|
else if (decimal > 0)
|
|
|
|
{
|
|
|
|
nr += do_lf_putunsigned (file, decimal);
|
|
|
|
}
|
1999-04-16 09:35:26 +08:00
|
|
|
else
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:20:49 +08:00
|
|
|
ASSERT (0);
|
1999-04-16 09:35:26 +08:00
|
|
|
return nr;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:20:49 +08:00
|
|
|
lf_printf (lf *file, const char *fmt, ...)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
int nr = 0;
|
|
|
|
char buf[1024];
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
va_start (ap, fmt);
|
|
|
|
vsprintf (buf, fmt, ap);
|
|
|
|
/* FIXME - this is really stuffed but so is vsprintf() on a sun! */
|
|
|
|
ASSERT (strlen (buf) < sizeof (buf));
|
|
|
|
nr += lf_putstr (file, buf);
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:20:49 +08:00
|
|
|
va_end (ap);
|
1999-04-16 09:35:26 +08:00
|
|
|
return nr;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:20:49 +08:00
|
|
|
lf_print__line_ref (lf *file, line_ref *line)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
return lf_print__external_ref (file, line->line_nr, line->file_name);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:20:49 +08:00
|
|
|
lf_print__external_ref (lf *file, int line_nr, const char *file_name)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
int nr = 0;
|
|
|
|
switch (file->references)
|
|
|
|
{
|
|
|
|
case lf_include_references:
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:20:49 +08:00
|
|
|
lf_indent_suppress (file);
|
1999-04-16 09:35:26 +08:00
|
|
|
nr += lf_putstr (file, "#line ");
|
|
|
|
nr += lf_putint (file, line_nr);
|
|
|
|
nr += lf_putstr (file, " \"");
|
|
|
|
nr += lf_putstr (file, file_name);
|
|
|
|
nr += lf_putstr (file, "\"\n");
|
|
|
|
break;
|
|
|
|
case lf_omit_references:
|
|
|
|
nr += lf_putstr (file, "/* ");
|
|
|
|
nr += lf_putstr (file, file_name);
|
|
|
|
nr += lf_putstr (file, ":");
|
|
|
|
nr += lf_putint (file, line_nr);
|
|
|
|
nr += lf_putstr (file, "*/\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return nr;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
lf_print__internal_ref (lf *file)
|
|
|
|
{
|
|
|
|
int nr = 0;
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:20:49 +08:00
|
|
|
nr += lf_print__external_ref (file, file->line_nr + 2, file->name);
|
1999-04-16 09:35:26 +08:00
|
|
|
/* line_nr == last_line, want to number from next */
|
|
|
|
return nr;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
lf_indent (lf *file, int delta)
|
|
|
|
{
|
|
|
|
file->indent += delta;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
lf_print__gnu_copyleft (lf *file)
|
|
|
|
{
|
|
|
|
int nr = 0;
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:20:49 +08:00
|
|
|
switch (file->type)
|
|
|
|
{
|
|
|
|
case lf_is_c:
|
|
|
|
case lf_is_h:
|
|
|
|
nr += lf_printf (file, "\
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* Makefile.in: Update copyright. IGEN contributed to the FSF.
* filter.c, filter.h, filter_host.c, filter_host.h: Ditto.
* gen-engine.c, gen-engine.h, gen-icache.c, gen-icache.h: Ditto.
* gen-idecode.c, gen-idecode.h, gen-itable.c: Ditto.
* gen-itable.h, gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h, gen.c: Ditto.
* gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:09:40 +08:00
|
|
|
/* This file is part of GDB.\n\
|
2002-06-04 00:04:31 +08:00
|
|
|
\n\
|
2007-08-28 08:09:36 +08:00
|
|
|
Copyright 2002, 2007 Free Software Foundation, Inc.\n\
|
2002-06-04 00:04:31 +08:00
|
|
|
\n\
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* Makefile.in: Update copyright. IGEN contributed to the FSF.
* filter.c, filter.h, filter_host.c, filter_host.h: Ditto.
* gen-engine.c, gen-engine.h, gen-icache.c, gen-icache.h: Ditto.
* gen-idecode.c, gen-idecode.h, gen-itable.c: Ditto.
* gen-itable.h, gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h, gen.c: Ditto.
* gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:09:40 +08:00
|
|
|
This program is free software; you can redistribute it and/or modify\n\
|
|
|
|
it under the terms of the GNU General Public License as published by\n\
|
2007-08-28 08:09:36 +08:00
|
|
|
the Free Software Foundation; either version 3 of the License, or\n\
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* Makefile.in: Update copyright. IGEN contributed to the FSF.
* filter.c, filter.h, filter_host.c, filter_host.h: Ditto.
* gen-engine.c, gen-engine.h, gen-icache.c, gen-icache.h: Ditto.
* gen-idecode.c, gen-idecode.h, gen-itable.c: Ditto.
* gen-itable.h, gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h, gen.c: Ditto.
* gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:09:40 +08:00
|
|
|
(at your option) any later version.\n\
|
2002-06-04 00:04:31 +08:00
|
|
|
\n\
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* Makefile.in: Update copyright. IGEN contributed to the FSF.
* filter.c, filter.h, filter_host.c, filter_host.h: Ditto.
* gen-engine.c, gen-engine.h, gen-icache.c, gen-icache.h: Ditto.
* gen-idecode.c, gen-idecode.h, gen-itable.c: Ditto.
* gen-itable.h, gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h, gen.c: Ditto.
* gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:09:40 +08:00
|
|
|
This program is distributed in the hope that it will be useful,\n\
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
|
|
|
|
GNU General Public License for more details.\n\
|
2007-08-28 08:09:36 +08:00
|
|
|
\n\
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* Makefile.in: Update copyright. IGEN contributed to the FSF.
* filter.c, filter.h, filter_host.c, filter_host.h: Ditto.
* gen-engine.c, gen-engine.h, gen-icache.c, gen-icache.h: Ditto.
* gen-idecode.c, gen-idecode.h, gen-itable.c: Ditto.
* gen-itable.h, gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h, gen.c: Ditto.
* gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:09:40 +08:00
|
|
|
You should have received a copy of the GNU General Public License\n\
|
2007-08-28 08:09:36 +08:00
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.\n\
|
2002-06-04 00:04:31 +08:00
|
|
|
\n\
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* Makefile.in: Update copyright. IGEN contributed to the FSF.
* filter.c, filter.h, filter_host.c, filter_host.h: Ditto.
* gen-engine.c, gen-engine.h, gen-icache.c, gen-icache.h: Ditto.
* gen-idecode.c, gen-idecode.h, gen-itable.c: Ditto.
* gen-itable.h, gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h, gen.c: Ditto.
* gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:09:40 +08:00
|
|
|
--\n\
|
2002-06-04 00:04:31 +08:00
|
|
|
\n\
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* Makefile.in: Update copyright. IGEN contributed to the FSF.
* filter.c, filter.h, filter_host.c, filter_host.h: Ditto.
* gen-engine.c, gen-engine.h, gen-icache.c, gen-icache.h: Ditto.
* gen-idecode.c, gen-idecode.h, gen-itable.c: Ditto.
* gen-itable.h, gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h, gen.c: Ditto.
* gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:09:40 +08:00
|
|
|
This file was generated by the program %s */\n\
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:20:49 +08:00
|
|
|
", filter_filename (file->program));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ASSERT (0);
|
|
|
|
break;
|
|
|
|
}
|
1999-04-16 09:35:26 +08:00
|
|
|
return nr;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:20:49 +08:00
|
|
|
lf_putbin (lf *file, int decimal, int width)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
int nr = 0;
|
|
|
|
int bit;
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:20:49 +08:00
|
|
|
ASSERT (width > 0);
|
|
|
|
for (bit = 1 << (width - 1); bit != 0; bit >>= 1)
|
|
|
|
{
|
|
|
|
if (decimal & bit)
|
|
|
|
nr += lf_putchr (file, '1');
|
|
|
|
else
|
|
|
|
nr += lf_putchr (file, '0');
|
|
|
|
}
|
1999-04-16 09:35:26 +08:00
|
|
|
return nr;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:20:49 +08:00
|
|
|
lf_print__this_file_is_empty (lf *file, const char *reason)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
int nr = 0;
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:20:49 +08:00
|
|
|
switch (file->type)
|
|
|
|
{
|
|
|
|
case lf_is_c:
|
|
|
|
case lf_is_h:
|
|
|
|
nr += lf_printf (file,
|
|
|
|
"/* This generated file (%s) is intentionally left blank",
|
|
|
|
file->name);
|
|
|
|
if (reason != NULL)
|
|
|
|
nr += lf_printf (file, " - %s", reason);
|
|
|
|
nr += lf_printf (file, " */\n");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ERROR ("Bad switch");
|
|
|
|
}
|
1999-04-16 09:35:26 +08:00
|
|
|
return nr;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:20:49 +08:00
|
|
|
lf_print__ucase_filename (lf *file)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
int nr = 0;
|
|
|
|
const char *chp = file->name;
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:20:49 +08:00
|
|
|
while (*chp != '\0')
|
|
|
|
{
|
|
|
|
char ch = *chp;
|
|
|
|
if (islower (ch))
|
|
|
|
{
|
|
|
|
nr += lf_putchr (file, toupper (ch));
|
|
|
|
}
|
|
|
|
else if (ch == '.')
|
|
|
|
nr += lf_putchr (file, '_');
|
|
|
|
else
|
|
|
|
nr += lf_putchr (file, ch);
|
|
|
|
chp++;
|
1999-04-16 09:35:26 +08:00
|
|
|
}
|
|
|
|
return nr;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:20:49 +08:00
|
|
|
lf_print__file_start (lf *file)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
int nr = 0;
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:20:49 +08:00
|
|
|
switch (file->type)
|
|
|
|
{
|
|
|
|
case lf_is_h:
|
|
|
|
case lf_is_c:
|
|
|
|
nr += lf_print__gnu_copyleft (file);
|
|
|
|
nr += lf_printf (file, "\n");
|
|
|
|
nr += lf_printf (file, "#ifndef ");
|
|
|
|
nr += lf_print__ucase_filename (file);
|
|
|
|
nr += lf_printf (file, "\n");
|
|
|
|
nr += lf_printf (file, "#define ");
|
|
|
|
nr += lf_print__ucase_filename (file);
|
|
|
|
nr += lf_printf (file, "\n");
|
|
|
|
nr += lf_printf (file, "\n");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ASSERT (0);
|
|
|
|
}
|
1999-04-16 09:35:26 +08:00
|
|
|
return nr;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:20:49 +08:00
|
|
|
lf_print__file_finish (lf *file)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
int nr = 0;
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:20:49 +08:00
|
|
|
switch (file->type)
|
|
|
|
{
|
|
|
|
case lf_is_h:
|
|
|
|
case lf_is_c:
|
|
|
|
nr += lf_printf (file, "\n");
|
|
|
|
nr += lf_printf (file, "#endif /* _");
|
|
|
|
nr += lf_print__ucase_filename (file);
|
|
|
|
nr += lf_printf (file, "_*/\n");
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ASSERT (0);
|
|
|
|
}
|
1999-04-16 09:35:26 +08:00
|
|
|
return nr;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
lf_print__function_type (lf *file,
|
|
|
|
const char *type,
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:20:49 +08:00
|
|
|
const char *prefix, const char *trailing_space)
|
1999-04-16 09:35:26 +08:00
|
|
|
{
|
|
|
|
int nr = 0;
|
|
|
|
nr += lf_printf (file, "%s\\\n(%s)", prefix, type);
|
|
|
|
if (trailing_space != NULL)
|
|
|
|
nr += lf_printf (file, "%s", trailing_space);
|
|
|
|
return nr;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
lf_print__function_type_function (lf *file,
|
2002-11-21 Andrew Cagney <ac131313@redhat.com>
* filter.c: Re-indent.
* filter.h, filter_host.h, gen-engine.c, gen-engine.h: Ditto.
* gen-icache.c, gen-icache.h, gen-idecode.c: Ditto.
* gen-idecode.h, gen-itable.c, gen-itable.h: Ditto.
* gen-model.c, gen-model.h, gen-semantics.c: Ditto.
* gen-semantics.h, gen-support.c, gen-support.h: Ditto.
* gen.c, gen.h, igen.c, igen.h, ld-cache.c, ld-cache.h: Ditto.
* ld-decode.c, ld-decode.h, ld-insn.c, ld-insn.h, lf.c: Ditto.
* lf.h, misc.c, misc.h, table.c, table.h: Ditto.
2002-11-22 12:20:49 +08:00
|
|
|
print_function * print_type,
|
1999-04-16 09:35:26 +08:00
|
|
|
const char *prefix,
|
|
|
|
const char *trailing_space)
|
|
|
|
{
|
|
|
|
int nr = 0;
|
|
|
|
nr += lf_printf (file, "%s\\\n(", prefix);
|
|
|
|
nr += print_type (file);
|
|
|
|
nr += lf_printf (file, ")");
|
|
|
|
if (trailing_space != NULL)
|
|
|
|
nr += lf_printf (file, "%s", trailing_space);
|
|
|
|
return nr;
|
|
|
|
}
|