gdb/testsuite/gdb.base/stap-probe: Minor clean-up
[deliverable/binutils-gdb.git] / opcodes / z8kgen.c
index df7279142556c6d3962d42b4800af96fc45bf244..b72fcffa35721c2c40856bb889c60d53b45efff0 100644 (file)
@@ -1,26 +1,26 @@
-/* Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2020 Free Software Foundation, Inc.
 
-   This file is part of GNU Binutils.
+   This file is part of the GNU opcodes library.
 
-   This program is free software; you can redistribute it and/or modify
+   This library is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
+   the Free Software Foundation; either version 3, or (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.
+   It 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
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-   USA.  */
+   along with this file; see the file COPYING.  If not, write to the
+   Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
-/* This program generates z8k-opc.h.  Compile with -fwritable-strings.  */
+/* This program generates z8k-opc.h.  */
 
-#include <stdio.h>
 #include "sysdep.h"
+#include <stdio.h>
 #include "libiberty.h"
 
 #define BYTE_INFO_LEN 10
@@ -32,11 +32,12 @@ struct op
   char type;
   char *bits;
   char *name;
-  char *flavor;
+  /* Unique number for stable sorting.  */
+  int id;
 };
 
 #define iswhite(x) ((x) == ' ' || (x) == '\t')
-struct op opt[] =
+static struct op opt[] =
 {
   {"------", 2,  8, "0011 0110 0000 0000", "bpt", 0},   /* Breakpoint used by the simulator.  */
   {"------", 10, 8, "0000 1111 0000 1100", "brk", 0},   /* Breakpoint used by real hardware.
@@ -265,8 +266,8 @@ struct op opt[] =
   {"------", 7, 8, "0010 0000 ssN0 dddd", "ldb rbd,@rs", 0},
   {"------", 9, 8, "0110 0000 0000 dddd address_src", "ldb rbd,address_src", 0},
   {"------", 10, 8, "0110 0000 ssN0 dddd address_src", "ldb rbd,address_src(rs)", 0},
-  {"------", 7, 8, "0010 0000 0000 dddd imm8 imm8", "ldb rbd,imm8", 0},
   {"------", 5, 8, "1100 dddd imm8", "ldb rbd,imm8", 0},
+  {"------", 7, 8, "0010 0000 0000 dddd imm8 imm8", "ldb rbd,imm8", 0},
   {"------", 3, 8, "1010 0000 ssss dddd", "ldb rbd,rbs", 0},
   {"------", 14, 8, "0011 0000 ssN0 dddd imm16", "ldb rbd,rs(imm16)", 0},
   {"------", 14, 8, "0111 0000 ssN0 dddd 0000 xxxx 0000 0000", "ldb rbd,rs(rx)", 0},
@@ -512,15 +513,14 @@ struct op opt[] =
   {"-ZS---", 17, 32, "0101 1100 ddN0 1000 address_dst", "testl address_dst(rd)", 0},
   {"-ZS---", 13, 32, "1001 1100 dddd 1000", "testl rrd", 0},
 
-  {"-ZSV--", 25, 8, "1011 1000 ddN0 1000 0000 aaaa ssN0 0000", "trdb @rd,@rs,rba", 0},
-  {"-ZSV--", 25, 8, "1011 1000 ddN0 1100 0000 aaaa ssN0 0000", "trdrb @rd,@rs,rba", 0},
-  {"-ZSV--", 25, 8, "1011 1000 ddN0 0000 0000 rrrr ssN0 0000", "trib @rd,@rs,rbr", 0},
-  {"-ZSV--", 25, 8, "1011 1000 ddN0 0100 0000 rrrr ssN0 0000", "trirb @rd,@rs,rbr", 0},
-  {"-ZSV--", 25, 8, "1011 1000 aaN0 1010 0000 rrrr bbN0 0000", "trtdb @ra,@rb,rbr", 0},
-  {"-ZSV--", 25, 8, "1011 1000 aaN0 1110 0000 rrrr bbN0 1110", "trtdrb @ra,@rb,rbr", 0},
-  {"-ZSV--", 25, 8, "1011 1000 aaN0 0010 0000 rrrr bbN0 0000", "trtib @ra,@rb,rbr", 0},
-  {"-ZSV--", 25, 8, "1011 1000 aaN0 0110 0000 rrrr bbN0 1110", "trtirb @ra,@rb,rbr", 0},
-  {"-ZSV--", 25, 8, "1011 1000 aaN0 1010 0000 rrrr bbN0 0000", "trtrb @ra,@rb,rbr", 0},
+  {"---V--", 25, 8, "1011 1000 ddN0 1000 0000 rrrr ssN0 0000", "trdb @rd,@rs,rr", 0},
+  {"---V--", 25, 8, "1011 1000 ddN0 1100 0000 rrrr ssN0 0000", "trdrb @rd,@rs,rr", 0},
+  {"---V--", 25, 8, "1011 1000 ddN0 0000 0000 rrrr ssN0 0000", "trib @rd,@rs,rr", 0},
+  {"---V--", 25, 8, "1011 1000 ddN0 0100 0000 rrrr ssN0 0000", "trirb @rd,@rs,rr", 0},
+  {"-Z-V--", 25, 8, "1011 1000 aaN0 1010 0000 rrrr bbN0 0000", "trtdb @ra,@rb,rr", 0},
+  {"-Z-V--", 25, 8, "1011 1000 aaN0 1110 0000 rrrr bbN0 1110", "trtdrb @ra,@rb,rr", 0},
+  {"-Z-V--", 25, 8, "1011 1000 aaN0 0010 0000 rrrr bbN0 0000", "trtib @ra,@rb,rr", 0},
+  {"-Z-V--", 25, 8, "1011 1000 aaN0 0110 0000 rrrr bbN0 1110", "trtirb @ra,@rb,rr", 0},
 
   {"--S---", 11, 16, "0000 1101 ddN0 0110", "tset @rd", 0},
   {"--S---", 14, 16, "0100 1101 0000 0110 address_dst", "tset address_dst", 0},
@@ -547,12 +547,11 @@ struct op opt[] =
   {"------", 7, 32, "1000 1100 dddd 0001", "ldctlb rbd,ctrl", 0},
   {"CZSVDH", 7, 32, "1000 1100 ssss 1001", "ldctlb ctrl,rbs", 0},
 
-  {"*", 4, 8, "1000 1000 ssss dddd", "xorb rbd,rbs", 0},
   {"*", 0, 0, 0, 0, 0}
 };
 
 static int
-count ()
+count (void)
 {
   struct op *p = opt;
   int r = 0;
@@ -567,11 +566,14 @@ count ()
 }
 
 static int
-func (a, b)
-     struct op *a;
-     struct op *b;
+func (const void *p1, const void *p2)
 {
-  return strcmp ((a)->name, (b)->name);
+  const struct op *a = p1;
+  const struct op *b = p2;
+  int ret = strcmp (a->name, b->name);
+  if (ret != 0)
+    return ret;
+  return a->id > b->id ? 1 : -1;
 }
 
 
@@ -588,7 +590,7 @@ struct tok_struct
   int length;
 };
 
-struct tok_struct args[] =
+static struct tok_struct args[] =
 {
   {"address_src(rs)", "CLASS_X+(ARG_RS)",},
   {"address_dst(rd)", "CLASS_X+(ARG_RD)",},
@@ -649,7 +651,7 @@ struct tok_struct args[] =
   {0, 0}
 };
 
-struct tok_struct toks[] =
+static struct tok_struct toks[] =
 {
   {"0000", "CLASS_BIT+0", 1},
   {"0001", "CLASS_BIT+1", 1},
@@ -728,11 +730,8 @@ struct tok_struct toks[] =
   {0, 0}
 };
 
-char *
-translate (table, x, length)
-     struct tok_struct *table;
-     char *x;
-     int *length;
+static char *
+translate (struct tok_struct *table, char *x, int *length)
 {
 
   int found;
@@ -760,9 +759,7 @@ translate (table, x, length)
 }
 
 static void
-chewbits (bits, length)
-     char *bits;
-     int *length;
+chewbits (char *bits, int *length)
 {
   int n = 0;
 
@@ -788,8 +785,7 @@ chewbits (bits, length)
 }
 
 static int
-chewname (name)
-     char **name;
+chewname (char **name)
 {
   char *n;
   int nargs = 0;
@@ -829,11 +825,12 @@ chewname (name)
   return nargs;
 }
 
-static void
-sub (x, c)
-     char *x;
-     char c;
+static char *
+sub (char *x, char c)
 {
+  /* Create copy.  */
+  char *ret = xstrdup (x);
+  x = ret;
   while (*x)
     {
       if (x[0] == c && x[1] == c &&
@@ -844,6 +841,7 @@ sub (x, c)
        }
       x++;
     }
+  return ret;
 }
 
 
@@ -851,8 +849,7 @@ sub (x, c)
 #define D(x) ((x) == '1' || (x) =='0')
 #define M(y) (strncmp(y,x,4)==0)
 static void
-printmangled (x)
-     char *x;
+printmangled (char *x)
 {
   return;
   while (*x)
@@ -886,8 +883,7 @@ printmangled (x)
 
 /*#define WORK_TYPE*/
 static void
-print_type (n)
-     struct op *n;
+print_type (struct op *n)
 {
 #ifdef WORK_TYPE
   while (*s && !iswhite (*s))
@@ -913,17 +909,22 @@ print_type (n)
 }
 
 static void
-internal ()
+internal (void)
 {
   int c = count ();
-  struct op *new = (struct op *) xmalloc (sizeof (struct op) * c);
+  int id;
+  struct op *new_op = xmalloc (sizeof (struct op) * (c + 1));
   struct op *p = opt;
-  memcpy (new, p, c * sizeof (struct op));
+  memcpy (new_op, p, (c + 1) * sizeof (struct op));
+
+  /* Assign unique id.  */
+  for (id = 0; id < c; id++)
+    new_op[id].id = id;
 
   /* Sort all names in table alphabetically.  */
-  qsort (new, c, sizeof (struct op), func);
+  qsort (new_op, c, sizeof (struct op), func);
 
-  p = new;
+  p = new_op;
   while (p->flags && p->flags[0] != '*')
   {
     /* If there are any @rs, sub the ssss into a ssn0, (rs), (ssn0).  */
@@ -944,15 +945,15 @@ internal ()
          /* Skip the r and sub the string.  */
          s++;
          c = s[1];
-         sub (p->bits, c);
+         p->bits = sub (p->bits, c);
        }
        if (s[0] == '(' && s[3] == ')')
        {
-         sub (p->bits, s[2]);
+         p->bits = sub (p->bits, s[2]);
        }
        if (s[0] == '(')
        {
-         sub (p->bits, s[-1]);
+         p->bits = sub (p->bits, s[-1]);
        }
 
        s++;
@@ -966,140 +967,163 @@ internal ()
 }
 
 static void
-gas ()
+gas (void)
 {
   int c = count ();
+  int id;
   struct op *p = opt;
   int idx = -1;
   char *oldname = "";
-  struct op *new = (struct op *) xmalloc (sizeof (struct op) * c);
+  struct op *new_op = xmalloc (sizeof (struct op) * (c + 1));
 
-  memcpy (new, p, c * sizeof (struct op));
+  memcpy (new_op, p, (c + 1) * sizeof (struct op));
+
+  /* Assign unique id.  */
+  for (id = 0; id < c; id++)
+    new_op[id].id = id;
 
   /* Sort all names in table alphabetically.  */
-  qsort (new, c, sizeof (struct op), func);
+  qsort (new_op, c, sizeof (struct op), func);
 
   printf ("/* DO NOT EDIT!  -*- buffer-read-only: t -*-\n");
   printf ("   This file is automatically generated by z8kgen.  */\n\n");
-
-  printf ("#define ARG_MASK 0x0f\n");
-
-  printf ("#define ARG_SRC 0x01\n");
-  printf ("#define ARG_DST 0x02\n");
-
-  printf ("#define ARG_RS 0x01\n");
-  printf ("#define ARG_RD 0x02\n");
-  printf ("#define ARG_RA 0x03\n");
-  printf ("#define ARG_RB 0x04\n");
-  printf ("#define ARG_RR 0x05\n");
-  printf ("#define ARG_RX 0x06\n");
-
-  printf ("#define ARG_IMM4 0x01\n");
-  printf ("#define ARG_IMM8 0x02\n");
-  printf ("#define ARG_IMM16 0x03\n");
-  printf ("#define ARG_IMM32 0x04\n");
-  printf ("#define ARG_IMMN 0x05\n");
-  printf ("#define ARG_IMMNMINUS1 0x05\n");
-  printf ("#define ARG_IMM_1 0x06\n");
-  printf ("#define ARG_IMM_2 0x07\n");
-  printf ("#define ARG_DISP16 0x08\n");
-  printf ("#define ARG_NIM8 0x09\n");
-  printf ("#define ARG_IMM2 0x0a\n");
-  printf ("#define ARG_IMM1OR2 0x0b\n");
-
-  printf ("#define ARG_DISP12 0x0b\n");
-  printf ("#define ARG_NIM4 0x0c\n");
-  printf ("#define ARG_DISP8 0x0c\n");
-  printf ("#define ARG_IMM4M1 0x0d\n");
-
-  printf ("#define CLASS_X 0x10\n");
-  printf ("#define CLASS_BA 0x20\n");
-  printf ("#define CLASS_DA 0x30\n");
-  printf ("#define CLASS_BX 0x40\n");
-  printf ("#define CLASS_DISP 0x50\n");
-  printf ("#define CLASS_IMM 0x60\n");
-  printf ("#define CLASS_CC 0x70\n");
-  printf ("#define CLASS_CTRL 0x80\n");
-  printf ("#define CLASS_IGNORE 0x90\n");
-  printf ("#define CLASS_ADDRESS 0xd0\n");
-  printf ("#define CLASS_0CCC 0xe0\n");
-  printf ("#define CLASS_1CCC 0xf0\n");
-  printf ("#define CLASS_0DISP7 0x100\n");
-  printf ("#define CLASS_1DISP7 0x200\n");
-  printf ("#define CLASS_01II 0x300\n");
-  printf ("#define CLASS_00II 0x400\n");
-  printf ("#define CLASS_BIT 0x500\n");
-  printf ("#define CLASS_FLAGS 0x600\n");
-  printf ("#define CLASS_IR 0x700\n");
+  printf ("/* Copyright (C) 2007-2020 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 file; see the file COPYING.  If not, write to the\n\
+   Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston,\n\
+   MA 02110-1301, USA.  */\n\n");
+
+  printf ("#define ARG_MASK         0x0f\n");
+
+  printf ("#define ARG_SRC          0x01\n");
+  printf ("#define ARG_DST          0x02\n");
+
+  printf ("#define ARG_RS           0x01\n");
+  printf ("#define ARG_RD           0x02\n");
+  printf ("#define ARG_RA           0x03\n");
+  printf ("#define ARG_RB           0x04\n");
+  printf ("#define ARG_RR           0x05\n");
+  printf ("#define ARG_RX           0x06\n");
+
+  printf ("#define ARG_IMM4         0x01\n");
+  printf ("#define ARG_IMM8         0x02\n");
+  printf ("#define ARG_IMM16        0x03\n");
+  printf ("#define ARG_IMM32        0x04\n");
+  printf ("#define ARG_IMMN         0x05\n");
+  printf ("#define ARG_IMMNMINUS1   0x05\n");
+  printf ("#define ARG_IMM_1        0x06\n");
+  printf ("#define ARG_IMM_2        0x07\n");
+  printf ("#define ARG_DISP16       0x08\n");
+  printf ("#define ARG_NIM8         0x09\n");
+  printf ("#define ARG_IMM2         0x0a\n");
+  printf ("#define ARG_IMM1OR2      0x0b\n");
+
+  printf ("#define ARG_DISP12       0x0b\n");
+  printf ("#define ARG_NIM4         0x0c\n");
+  printf ("#define ARG_DISP8        0x0c\n");
+  printf ("#define ARG_IMM4M1       0x0d\n");
+
+  printf ("#define CLASS_X          0x10\n");
+  printf ("#define CLASS_BA         0x20\n");
+  printf ("#define CLASS_DA         0x30\n");
+  printf ("#define CLASS_BX         0x40\n");
+  printf ("#define CLASS_DISP       0x50\n");
+  printf ("#define CLASS_IMM        0x60\n");
+  printf ("#define CLASS_CC         0x70\n");
+  printf ("#define CLASS_CTRL       0x80\n");
+  printf ("#define CLASS_IGNORE     0x90\n");
+  printf ("#define CLASS_ADDRESS    0xd0\n");
+  printf ("#define CLASS_0CCC       0xe0\n");
+  printf ("#define CLASS_1CCC       0xf0\n");
+  printf ("#define CLASS_0DISP7    0x100\n");
+  printf ("#define CLASS_1DISP7    0x200\n");
+  printf ("#define CLASS_01II      0x300\n");
+  printf ("#define CLASS_00II      0x400\n");
+  printf ("#define CLASS_BIT       0x500\n");
+  printf ("#define CLASS_FLAGS     0x600\n");
+  printf ("#define CLASS_IR        0x700\n");
   printf ("#define CLASS_IRO       0x800\n");
   printf ("#define CLASS_DISP8     0x900\n");
 
   printf ("#define CLASS_BIT_1OR2  0xa00\n");
-  printf ("#define CLASS_REG 0x7000\n");
-  printf ("#define CLASS_REG_BYTE 0x2000\n");
-  printf ("#define CLASS_REG_WORD 0x3000\n");
-  printf ("#define CLASS_REG_QUAD 0x4000\n");
-  printf ("#define CLASS_REG_LONG 0x5000\n");
-  printf ("#define CLASS_REGN0 0x8000\n");
-  printf ("#define CLASS_PR 0x10000\n");
+  printf ("#define CLASS_REG       0x7000\n");
+  printf ("#define CLASS_REG_BYTE  0x2000\n");
+  printf ("#define CLASS_REG_WORD  0x3000\n");
+  printf ("#define CLASS_REG_QUAD  0x4000\n");
+  printf ("#define CLASS_REG_LONG  0x5000\n");
+  printf ("#define CLASS_REGN0     0x8000\n");
+  printf ("#define CLASS_PR       0x10000\n");
   printf ("#define CLASS_MASK     0x1fff0\n");
 
-  printf ("#define OPC_adc 0\n");
-  printf ("#define OPC_adcb 1\n");
-  printf ("#define OPC_add 2\n");
-  printf ("#define OPC_addb 3\n");
-  printf ("#define OPC_addl 4\n");
-  printf ("#define OPC_and 5\n");
-  printf ("#define OPC_andb 6\n");
-  printf ("#define OPC_bit 7\n");
-  printf ("#define OPC_bitb 8\n");
-  printf ("#define OPC_call 9\n");
-  printf ("#define OPC_calr 10\n");
-  printf ("#define OPC_clr 11\n");
-  printf ("#define OPC_clrb 12\n");
-  printf ("#define OPC_com 13\n");
-  printf ("#define OPC_comb 14\n");
-  printf ("#define OPC_comflg 15\n");
-  printf ("#define OPC_cp 16\n");
-  printf ("#define OPC_cpb 17\n");
-  printf ("#define OPC_cpd 18\n");
-  printf ("#define OPC_cpdb 19\n");
-  printf ("#define OPC_cpdr 20\n");
-  printf ("#define OPC_cpdrb 21\n");
-  printf ("#define OPC_cpi 22\n");
-  printf ("#define OPC_cpib 23\n");
-  printf ("#define OPC_cpir 24\n");
-  printf ("#define OPC_cpirb 25\n");
-  printf ("#define OPC_cpl 26\n");
-  printf ("#define OPC_cpsd 27\n");
-  printf ("#define OPC_cpsdb 28\n");
-  printf ("#define OPC_cpsdr 29\n");
-  printf ("#define OPC_cpsdrb 30\n");
-  printf ("#define OPC_cpsi 31\n");
-  printf ("#define OPC_cpsib 32\n");
-  printf ("#define OPC_cpsir 33\n");
-  printf ("#define OPC_cpsirb 34\n");
-  printf ("#define OPC_dab 35\n");
-  printf ("#define OPC_dbjnz 36\n");
-  printf ("#define OPC_dec 37\n");
-  printf ("#define OPC_decb 38\n");
-  printf ("#define OPC_di 39\n");
-  printf ("#define OPC_div 40\n");
-  printf ("#define OPC_divl 41\n");
-  printf ("#define OPC_djnz 42\n");
-  printf ("#define OPC_ei 43\n");
-  printf ("#define OPC_ex 44\n");
-  printf ("#define OPC_exb 45\n");
-  printf ("#define OPC_exts 46\n");
-  printf ("#define OPC_extsb 47\n");
-  printf ("#define OPC_extsl 48\n");
-  printf ("#define OPC_halt 49\n");
-  printf ("#define OPC_in 50\n");
-  printf ("#define OPC_inb 51\n");
-  printf ("#define OPC_inc 52\n");
-  printf ("#define OPC_incb 53\n");
-  printf ("#define OPC_ind 54\n");
-  printf ("#define OPC_indb 55\n");
+  printf ("#define OPC_adc      0\n");
+  printf ("#define OPC_adcb     1\n");
+  printf ("#define OPC_add      2\n");
+  printf ("#define OPC_addb     3\n");
+  printf ("#define OPC_addl     4\n");
+  printf ("#define OPC_and      5\n");
+  printf ("#define OPC_andb     6\n");
+  printf ("#define OPC_bit      7\n");
+  printf ("#define OPC_bitb     8\n");
+  printf ("#define OPC_call     9\n");
+  printf ("#define OPC_calr    10\n");
+  printf ("#define OPC_clr     11\n");
+  printf ("#define OPC_clrb    12\n");
+  printf ("#define OPC_com     13\n");
+  printf ("#define OPC_comb    14\n");
+  printf ("#define OPC_comflg  15\n");
+  printf ("#define OPC_cp      16\n");
+  printf ("#define OPC_cpb     17\n");
+  printf ("#define OPC_cpd     18\n");
+  printf ("#define OPC_cpdb    19\n");
+  printf ("#define OPC_cpdr    20\n");
+  printf ("#define OPC_cpdrb   21\n");
+  printf ("#define OPC_cpi     22\n");
+  printf ("#define OPC_cpib    23\n");
+  printf ("#define OPC_cpir    24\n");
+  printf ("#define OPC_cpirb   25\n");
+  printf ("#define OPC_cpl     26\n");
+  printf ("#define OPC_cpsd    27\n");
+  printf ("#define OPC_cpsdb   28\n");
+  printf ("#define OPC_cpsdr   29\n");
+  printf ("#define OPC_cpsdrb  30\n");
+  printf ("#define OPC_cpsi    31\n");
+  printf ("#define OPC_cpsib   32\n");
+  printf ("#define OPC_cpsir   33\n");
+  printf ("#define OPC_cpsirb  34\n");
+  printf ("#define OPC_dab     35\n");
+  printf ("#define OPC_dbjnz   36\n");
+  printf ("#define OPC_dec     37\n");
+  printf ("#define OPC_decb    38\n");
+  printf ("#define OPC_di      39\n");
+  printf ("#define OPC_div     40\n");
+  printf ("#define OPC_divl    41\n");
+  printf ("#define OPC_djnz    42\n");
+  printf ("#define OPC_ei      43\n");
+  printf ("#define OPC_ex      44\n");
+  printf ("#define OPC_exb     45\n");
+  printf ("#define OPC_exts    46\n");
+  printf ("#define OPC_extsb   47\n");
+  printf ("#define OPC_extsl   48\n");
+  printf ("#define OPC_halt    49\n");
+  printf ("#define OPC_in      50\n");
+  printf ("#define OPC_inb     51\n");
+  printf ("#define OPC_inc     52\n");
+  printf ("#define OPC_incb    53\n");
+  printf ("#define OPC_ind     54\n");
+  printf ("#define OPC_indb    55\n");
   printf ("#define OPC_indr    56\n");
   printf ("#define OPC_indrb   57\n");
   printf ("#define OPC_ini     58\n");
@@ -1263,29 +1287,29 @@ gas ()
   printf ("#endif\n");
   printf ("  const char *name;\n");
   printf ("  unsigned char opcode;\n");
-  printf ("  void (*func) PARAMS ((void));\n");
+  printf ("  void (*func) (void);\n");
   printf ("  unsigned int arg_info[4];\n");
   printf ("  unsigned int byte_info[%d];\n", BYTE_INFO_LEN);
-  printf ("  int noperands;\n");
-  printf ("  int length;\n");
-  printf ("  int idx;\n");
+  printf ("  unsigned int noperands;\n");
+  printf ("  unsigned int length;\n");
+  printf ("  unsigned int idx;\n");
   printf ("} opcode_entry_type;\n\n");
   printf ("#ifdef DEFINE_TABLE\n");
   printf ("const opcode_entry_type z8k_table[] = {\n");
 
-  while (new->flags && new->flags[0])
+  while (new_op->flags && new_op->flags[0] != '*')
     {
       int nargs;
       int length;
 
-      printf ("\n/* %s *** %s */\n", new->bits, new->name);
+      printf ("\n/* %s *** %s */\n", new_op->bits, new_op->name);
       printf ("{\n");
 
       printf ("#ifdef NICENAMES\n");
-      printf ("\"%s\",%d,%d,", new->name, new->type, new->cycles);
+      printf ("\"%s\",%d,%d,", new_op->name, new_op->type, new_op->cycles);
       {
        int answer = 0;
-       char *p = new->flags;
+       char *p = new_op->flags;
 
        while (*p)
          {
@@ -1300,20 +1324,20 @@ gas ()
 
       printf ("#endif\n");
 
-      nargs = chewname (&new->name);
+      nargs = chewname (&new_op->name);
 
       printf ("\n\t");
-      chewbits (new->bits, &length);
+      chewbits (new_op->bits, &length);
       length /= 2;
       if (length & 1)
        abort();
 
-      if (strcmp (oldname, new->name) != 0)
+      if (strcmp (oldname, new_op->name) != 0)
        idx++;
       printf (",%d,%d,%d", nargs, length, idx);
-      oldname = new->name;
+      oldname = new_op->name;
       printf ("},\n");
-      new++;
+      new_op++;
     }
   printf ("\n/* end marker */\n");
   printf ("{\n#ifdef NICENAMES\nNULL,0,0,\n0,\n#endif\n");
@@ -1322,9 +1346,7 @@ gas ()
 }
 
 int
-main (ac, av)
-     int ac;
-     char **av;
+main (int ac, char **av)
 {
   struct op *p = opt;
 
This page took 0.053737 seconds and 4 git commands to generate.