2007-09-06 H.J. Lu <hongjiu.lu@intel.com>
* i386-gen.c (table): Moved ... (main): Here. Call process_copyright to output copyright. (process_copyright): New. (process_i386_opcodes): Take FILE *table. (process_i386_registers): Likewise.
This commit is contained in:
parent
34edb9ad07
commit
72ffa0fba1
|
@ -1,3 +1,11 @@
|
||||||
|
2007-09-06 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
|
* i386-gen.c (table): Moved ...
|
||||||
|
(main): Here. Call process_copyright to output copyright.
|
||||||
|
(process_copyright): New.
|
||||||
|
(process_i386_opcodes): Take FILE *table.
|
||||||
|
(process_i386_registers): Likewise.
|
||||||
|
|
||||||
2007-09-06 H.J. Lu <hongjiu.lu@intel.com>
|
2007-09-06 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
* i386-gen.c (table): New.
|
* i386-gen.c (table): New.
|
||||||
|
|
|
@ -33,9 +33,6 @@
|
||||||
static const char *program_name = NULL;
|
static const char *program_name = NULL;
|
||||||
static int debug = 0;
|
static int debug = 0;
|
||||||
|
|
||||||
/* File of i386 opcode and register tables. */
|
|
||||||
static FILE *table;
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fail (const char *message, ...)
|
fail (const char *message, ...)
|
||||||
{
|
{
|
||||||
|
@ -48,6 +45,30 @@ fail (const char *message, ...)
|
||||||
xexit (1);
|
xexit (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
process_copyright (FILE *fp)
|
||||||
|
{
|
||||||
|
fprintf (fp, "/* This file is automatically generated by i386-gen. Do not edit! */\n\
|
||||||
|
/* Copyright 2007 Free Software Foundation, Inc.\n\
|
||||||
|
\n\
|
||||||
|
This file is part of the GNU opcodes library.\n\
|
||||||
|
\n\
|
||||||
|
This library 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\
|
||||||
|
the Free Software Foundation; either version 3, or (at your option)\n\
|
||||||
|
any later version.\n\
|
||||||
|
\n\
|
||||||
|
It is distributed in the hope that it will be useful, but WITHOUT\n\
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\n\
|
||||||
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public\n\
|
||||||
|
License for more details.\n\
|
||||||
|
\n\
|
||||||
|
You should have received a copy of the GNU General Public License\n\
|
||||||
|
along with this program; if not, write to the Free Software\n\
|
||||||
|
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,\n\
|
||||||
|
MA 02110-1301, USA. */\n");
|
||||||
|
}
|
||||||
|
|
||||||
/* Remove leading white spaces. */
|
/* Remove leading white spaces. */
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
|
@ -99,7 +120,7 @@ next_field (char *str, char **next)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
process_i386_opcodes (void)
|
process_i386_opcodes (FILE *table)
|
||||||
{
|
{
|
||||||
FILE *fp = fopen ("i386-opc.tbl", "r");
|
FILE *fp = fopen ("i386-opc.tbl", "r");
|
||||||
char buf[2048];
|
char buf[2048];
|
||||||
|
@ -255,7 +276,7 @@ process_i386_opcodes (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
process_i386_registers (void)
|
process_i386_registers (FILE *table)
|
||||||
{
|
{
|
||||||
FILE *fp = fopen ("i386-reg.tbl", "r");
|
FILE *fp = fopen ("i386-reg.tbl", "r");
|
||||||
char buf[2048];
|
char buf[2048];
|
||||||
|
@ -362,6 +383,7 @@ main (int argc, char **argv)
|
||||||
extern int chdir (char *);
|
extern int chdir (char *);
|
||||||
char *srcdir = NULL;
|
char *srcdir = NULL;
|
||||||
int c;
|
int c;
|
||||||
|
FILE *table;
|
||||||
|
|
||||||
program_name = *argv;
|
program_name = *argv;
|
||||||
xmalloc_set_program_name (program_name);
|
xmalloc_set_program_name (program_name);
|
||||||
|
@ -399,28 +421,10 @@ main (int argc, char **argv)
|
||||||
if (table == NULL)
|
if (table == NULL)
|
||||||
fail (_("can't create i386-tbl.h, errno = %s\n"), strerror (errno));
|
fail (_("can't create i386-tbl.h, errno = %s\n"), strerror (errno));
|
||||||
|
|
||||||
fprintf (table, "/* This file is automatically generated by i386-gen. Do not edit! */\n\
|
process_copyright (table);
|
||||||
/* Copyright 2007 Free Software Foundation, Inc.\n\
|
|
||||||
\n\
|
|
||||||
This file is part of the GNU opcodes library.\n\
|
|
||||||
\n\
|
|
||||||
This library 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\
|
|
||||||
the Free Software Foundation; either version 3, or (at your option)\n\
|
|
||||||
any later version.\n\
|
|
||||||
\n\
|
|
||||||
It is distributed in the hope that it will be useful, but WITHOUT\n\
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\n\
|
|
||||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public\n\
|
|
||||||
License for more details.\n\
|
|
||||||
\n\
|
|
||||||
You should have received a copy of the GNU General Public License\n\
|
|
||||||
along with this program; if not, write to the Free Software\n\
|
|
||||||
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,\n\
|
|
||||||
MA 02110-1301, USA. */\n");
|
|
||||||
|
|
||||||
process_i386_opcodes ();
|
process_i386_opcodes (table);
|
||||||
process_i386_registers ();
|
process_i386_registers (table);
|
||||||
|
|
||||||
fclose (table);
|
fclose (table);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue