[commit] ISO function definitions for sim/h8300/compile.c

Michael Snyder msnyder@redhat.com
Thu Jan 16 19:56:00 GMT 2003


 
-------------- next part --------------
2003-01-16  Michael Snyder  <msnyder@redhat.com>

	* compile.c: Change K&R function definitions to ISO.
	(fetch): Make static, and eliminate unused parameter 'n'.

Index: compile.c
===================================================================
RCS file: /cvs/src/src/sim/h8300/compile.c,v
retrieving revision 1.18
diff -p -r1.18 compile.c
*** compile.c	26 Dec 2002 05:44:46 -0000	1.18
--- compile.c	16 Jan 2003 19:53:06 -0000
*************** int h8300smode = 0;
*** 127,145 ****
  static int memory_size;
  
  static int
! get_now ()
  {
    return time (0);	/* WinXX HAS UNIX like 'time', so why not using it? */
  }
  
  static int
! now_persec ()
  {
    return 1;
  }
  
  static int
! bitfrom (x)
  {
    switch (x & SIZE)
      {
--- 127,145 ----
  static int memory_size;
  
  static int
! get_now (void)
  {
    return time (0);	/* WinXX HAS UNIX like 'time', so why not using it? */
  }
  
  static int
! now_persec (void)
  {
    return 1;
  }
  
  static int
! bitfrom (int x)
  {
    switch (x & SIZE)
      {
*************** bitfrom (x)
*** 155,161 ****
  }
  
  static unsigned int
! lvalue (x, rn)
  {
    switch (x / 4)
      {
--- 155,161 ----
  }
  
  static unsigned int
! lvalue (int x, int rn)
  {
    switch (x / 4)
      {
*************** lvalue (x, rn)
*** 175,185 ****
  }
  
  static unsigned int
! decode (addr, data, dst)
!      int addr;
!      unsigned char *data;
!      decoded_inst *dst;
! 
  {
    int rs = 0;
    int rd = 0;
--- 175,181 ----
  }
  
  static unsigned int
! decode (int addr, unsigned char *data, decoded_inst *dst)
  {
    int rs = 0;
    int rd = 0;
*************** decode (addr, data, dst)
*** 481,487 ****
  }
  
  static void
! compile (pc)
  {
    int idx;
  
--- 477,483 ----
  }
  
  static void
! compile (int pc)
  {
    int idx;
  
*************** static unsigned int *lreg[18];
*** 550,558 ****
  #define SET_MEMORY_B(x,y) \
    (x < memory_size ? (cpu.memory[(x)] = y) : (cpu.eightbit[x & 0xff] = y))
  
! int
! fetch (arg, n)
!      ea_type *arg;
  {
    int rn = arg->reg;
    int abs = arg->literal;
--- 546,553 ----
  #define SET_MEMORY_B(x,y) \
    (x < memory_size ? (cpu.memory[(x)] = y) : (cpu.eightbit[x & 0xff] = y))
  
! static int
! fetch (ea_type *arg)
  {
    int rn = arg->reg;
    int abs = arg->literal;
*************** fetch (arg, n)
*** 634,642 ****
  
  
  static void
! store (arg, n)
!      ea_type *arg;
!      int n;
  {
    int rn = arg->reg;
    int abs = arg->literal;
--- 629,635 ----
  
  
  static void
! store (ea_type *arg, int n)
  {
    int rn = arg->reg;
    int abs = arg->literal;
*************** static union
*** 710,716 ****
  littleendian;
  
  static void
! init_pointers ()
  {
    static int init;
  
--- 703,709 ----
  littleendian;
  
  static void
! init_pointers (void)
  {
    static int init;
  
*************** init_pointers ()
*** 785,795 ****
  }
  
  static void
! control_c (sig, code, scp, addr)
!      int sig;
!      int code;
!      char *scp;
!      char *addr;
  {
    cpu.state = SIM_STATE_STOPPED;
    cpu.exception = SIGINT;
--- 778,784 ----
  }
  
  static void
! control_c (int sig)
  {
    cpu.state = SIM_STATE_STOPPED;
    cpu.exception = SIGINT;
*************** control_c (sig, code, scp, addr)
*** 805,814 ****
  #define I (intMaskBit != 0)
  
  static int
! mop (code, bsize, sign)
!      decoded_inst *code;
!      int bsize;
!      int sign;
  {
    int multiplier;
    int multiplicand;
--- 794,800 ----
  #define I (intMaskBit != 0)
  
  static int
! mop (decoded_inst *code, int bsize, int sign)
  {
    int multiplier;
    int multiplicand;
*************** sim_stop (sd)
*** 969,976 ****
  #define TICK_REGNUM     13
  
  void
! sim_resume (sd, step, siggnal)
!      SIM_DESC sd;
  {
    static int init1;
    int cycles = 0;
--- 955,961 ----
  #define TICK_REGNUM     13
  
  void
! sim_resume (SIM_DESC sd, int step, int siggnal)
  {
    static int init1;
    int cycles = 0;
*************** sim_resume (sd, step, siggnal)
*** 1887,1905 ****
  }
  
  int
! sim_trace (sd)
!      SIM_DESC sd;
  {
    /* FIXME: Unfinished.  */
    abort ();
  }
  
  int
! sim_write (sd, addr, buffer, size)
!      SIM_DESC sd;
!      SIM_ADDR addr;
!      unsigned char *buffer;
!      int size;
  {
    int i;
  
--- 1872,1885 ----
  }
  
  int
! sim_trace (SIM_DESC sd)
  {
    /* FIXME: Unfinished.  */
    abort ();
  }
  
  int
! sim_write (SIM_DESC sd, SIM_ADDR addr, unsigned char *buffer, int size)
  {
    int i;
  
*************** sim_write (sd, addr, buffer, size)
*** 1920,1930 ****
  }
  
  int
! sim_read (sd, addr, buffer, size)
!      SIM_DESC sd;
!      SIM_ADDR addr;
!      unsigned char *buffer;
!      int size;
  {
    init_pointers ();
    if (addr < 0)
--- 1900,1906 ----
  }
  
  int
! sim_read (SIM_DESC sd, SIM_ADDR addr, unsigned char *buffer, int size)
  {
    init_pointers ();
    if (addr < 0)
*************** sim_read (sd, addr, buffer, size)
*** 1938,1948 ****
  
  
  int
! sim_store_register (sd, rn, value, length)
!      SIM_DESC sd;
!      int rn;
!      unsigned char *value;
!      int length;
  {
    int longval;
    int shortval;
--- 1914,1920 ----
  
  
  int
! sim_store_register (SIM_DESC sd, int rn, unsigned char *value, int length)
  {
    int longval;
    int shortval;
*************** sim_store_register (sd, rn, value, lengt
*** 1991,2001 ****
  }
  
  int
! sim_fetch_register (sd, rn, buf, length)
!      SIM_DESC sd;
!      int rn;
!      unsigned char *buf;
!      int length;
  {
    int v;
    int longreg = 0;
--- 1963,1969 ----
  }
  
  int
! sim_fetch_register (SIM_DESC sd, int rn, unsigned char *buf, int length)
  {
    int v;
    int longreg = 0;
*************** sim_fetch_register (sd, rn, buf, length)
*** 2056,2065 ****
  }
  
  void
! sim_stop_reason (sd, reason, sigrc)
!      SIM_DESC sd;
!      enum sim_stop *reason;
!      int *sigrc;
  {
  #if 0 /* FIXME: This should work but we can't use it.
  	 grep for SLEEP above.  */
--- 2024,2030 ----
  }
  
  void
! sim_stop_reason (SIM_DESC sd, enum sim_stop *reason, int *sigrc)
  {
  #if 0 /* FIXME: This should work but we can't use it.
  	 grep for SLEEP above.  */
*************** sim_stop_reason (sd, reason, sigrc)
*** 2079,2092 ****
  /* FIXME: Rename to sim_set_mem_size.  */
  
  void
! sim_size (n)
!      int n;
  {
    /* Memory size is fixed.  */
  }
  
  void
! sim_set_simcache_size (n)
  {
    if (cpu.cache)
      free (cpu.cache);
--- 2044,2056 ----
  /* FIXME: Rename to sim_set_mem_size.  */
  
  void
! sim_size (int n)
  {
    /* Memory size is fixed.  */
  }
  
  void
! sim_set_simcache_size (int n)
  {
    if (cpu.cache)
      free (cpu.cache);
*************** sim_set_simcache_size (n)
*** 2099,2107 ****
  
  
  void
! sim_info (sd, verbose)
!      SIM_DESC sd;
!      int verbose;
  {
    double timetaken = (double) cpu.ticks / (double) now_persec ();
    double virttime = cpu.cycles / 10.0e6;
--- 2063,2069 ----
  
  
  void
! sim_info (SIM_DESC sd, int verbose)
  {
    double timetaken = (double) cpu.ticks / (double) now_persec ();
    double virttime = cpu.cycles / 10.0e6;
*************** sim_info (sd, verbose)
*** 2149,2156 ****
     FLAG is non-zero for the H8/300H.  */
  
  void
! set_h8300h (h_flag, s_flag)
!      int h_flag, s_flag;
  {
    /* FIXME: Much of the code in sim_load can be moved to sim_open.
       This function being replaced by a sim_open:ARGV configuration
--- 2111,2117 ----
     FLAG is non-zero for the H8/300H.  */
  
  void
! set_h8300h (int h_flag, int s_flag)
  {
    /* FIXME: Much of the code in sim_load can be moved to sim_open.
       This function being replaced by a sim_open:ARGV configuration
*************** set_h8300h (h_flag, s_flag)
*** 2160,2170 ****
  }
  
  SIM_DESC
! sim_open (kind, ptr, abfd, argv)
!      SIM_OPEN_KIND kind;
!      struct host_callback_struct *ptr;
!      struct _bfd *abfd;
!      char **argv;
  {
    /* FIXME: Much of the code in sim_load can be moved here.  */
  
--- 2121,2130 ----
  }
  
  SIM_DESC
! sim_open (SIM_OPEN_KIND kind, 
! 	  struct host_callback_struct *ptr, 
! 	  struct _bfd *abfd, 
! 	  char **argv)
  {
    /* FIXME: Much of the code in sim_load can be moved here.  */
  
*************** sim_open (kind, ptr, abfd, argv)
*** 2176,2184 ****
  }
  
  void
! sim_close (sd, quitting)
!      SIM_DESC sd;
!      int quitting;
  {
    /* Nothing to do.  */
  }
--- 2136,2142 ----
  }
  
  void
! sim_close (SIM_DESC sd, int quitting)
  {
    /* Nothing to do.  */
  }
*************** sim_close (sd, quitting)
*** 2186,2196 ****
  /* Called by gdb to load a program into memory.  */
  
  SIM_RC
! sim_load (sd, prog, abfd, from_tty)
!      SIM_DESC sd;
!      char *prog;
!      bfd *abfd;
!      int from_tty;
  {
    bfd *prog_bfd;
  
--- 2144,2150 ----
  /* Called by gdb to load a program into memory.  */
  
  SIM_RC
! sim_load (SIM_DESC sd, char *prog, bfd *abfd, int from_tty)
  {
    bfd *prog_bfd;
  
*************** sim_load (sd, prog, abfd, from_tty)
*** 2272,2282 ****
  }
  
  SIM_RC
! sim_create_inferior (sd, abfd, argv, env)
!      SIM_DESC sd;
!      struct _bfd *abfd;
!      char **argv;
!      char **env;
  {
    if (abfd != NULL)
      cpu.pc = bfd_get_start_address (abfd);
--- 2226,2232 ----
  }
  
  SIM_RC
! sim_create_inferior (SIM_DESC sd, struct _bfd *abfd, char **argv, char **env)
  {
    if (abfd != NULL)
      cpu.pc = bfd_get_start_address (abfd);
*************** sim_create_inferior (sd, abfd, argv, env
*** 2286,2302 ****
  }
  
  void
! sim_do_command (sd, cmd)
!      SIM_DESC sd;
!      char *cmd;
  {
    (*sim_callback->printf_filtered) (sim_callback,
  				    "This simulator does not accept any commands.\n");
  }
  
  void
! sim_set_callbacks (ptr)
!      struct host_callback_struct *ptr;
  {
    sim_callback = ptr;
  }
--- 2236,2249 ----
  }
  
  void
! sim_do_command (SIM_DESC sd, char *cmd)
  {
    (*sim_callback->printf_filtered) (sim_callback,
  				    "This simulator does not accept any commands.\n");
  }
  
  void
! sim_set_callbacks (struct host_callback_struct *ptr)
  {
    sim_callback = ptr;
  }


More information about the Gdb-patches mailing list