Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [rfa:cli] More c->function.cfunc zapping
@ 2002-02-10 18:47 Andrew Cagney
  2002-02-23 10:39 ` Andrew Cagney
  2002-02-23 10:57 ` Fernando Nasser
  0 siblings, 2 replies; 4+ messages in thread
From: Andrew Cagney @ 2002-02-10 18:47 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 165 bytes --]

Hello,

This patch zaps a few more instances of function.cfunc in the core-code. 
  It isn't elegant but hopefully it is better than the existing code.

Ok?

Andrew

[-- Attachment #2: diffs --]
[-- Type: text/plain, Size: 6738 bytes --]

2002-02-10  Andrew Cagney  <ac131313@redhat.com>

	* cli/cli-decode.c (cmd_cfunc_eq_hack): New function.
	* command.h (cmd_cfunc_eq_hack): Declare.
	* cli/cli-decode.h (cmd_func_eq_hack): Ditto.

	* cli/cli-cmds.h (is_complete_command): Change parameter to a
	``struct cmd_list_element *''.
	* cli/cli-cmds.c (is_complete_command): Update.  Use
	cmd_func_eq_hack.
	* top.c (execute_command): Pass the command to
	is_complete_command.
	* tracepoint.c: Replace function.cfunc with cmd_func_eq_hack.

Index: command.h
===================================================================
RCS file: /cvs/src/src/gdb/command.h,v
retrieving revision 1.22
diff -u -r1.22 command.h
--- command.h	2002/02/05 04:37:21	1.22
+++ command.h	2002/02/11 02:42:55
@@ -292,6 +292,9 @@
 			   void (*sfunc) (char *args, int from_tty,
 					  struct cmd_list_element * c));
 
+/* HACK: Code grubs around in cmd objects to test the sfunc().  */
+extern int cmd_cfunc_eq_hack (struct cmd_list_element *cmd,
+			      void (*cfunc) (char *args, int from_tty));
 
 extern struct cmd_list_element *lookup_cmd (char **,
 					    struct cmd_list_element *, char *,
Index: top.c
===================================================================
RCS file: /cvs/src/src/gdb/top.c,v
retrieving revision 1.56
diff -u -r1.56 top.c
--- top.c	2002/02/10 04:08:42	1.56
+++ top.c	2002/02/11 02:43:12
@@ -684,7 +684,7 @@
          command.  */
       if (arg
 	  && c->type != set_cmd
-	  && !is_complete_command (c->function.cfunc))
+	  && !is_complete_command (c))
 	{
 	  p = arg + strlen (arg) - 1;
 	  while (p >= arg && (*p == ' ' || *p == '\t'))
Index: tracepoint.c
===================================================================
RCS file: /cvs/src/src/gdb/tracepoint.c,v
retrieving revision 1.32
diff -u -r1.32 tracepoint.c
--- tracepoint.c	2002/02/05 04:37:22	1.32
+++ tracepoint.c	2002/02/11 02:43:14
@@ -939,7 +939,7 @@
       return BADLINE;
     }
 
-  if (c->function.cfunc == collect_pseudocommand)
+  if (cmd_cfunc_eq_hack (c, collect_pseudocommand))
     {
       struct agent_expr *aexpr;
       struct agent_reqs areqs;
@@ -1006,7 +1006,7 @@
       while (p && *p++ == ',');
       return GENERIC;
     }
-  else if (c->function.cfunc == while_stepping_pseudocommand)
+  else if (cmd_cfunc_eq_hack (c, while_stepping_pseudocommand))
     {
       char *steparg;		/* in case warning is necessary */
 
@@ -1022,7 +1022,7 @@
 	}
       return STEPPING;
     }
-  else if (c->function.cfunc == end_actions_pseudocommand)
+  else if (cmd_cfunc_eq_hack (c, end_actions_pseudocommand))
     return END;
   else
     {
@@ -1520,7 +1520,7 @@
       if (cmd == 0)
 	error ("Bad action list item: %s", action_exp);
 
-      if (cmd->function.cfunc == collect_pseudocommand)
+      if (cmd_cfunc_eq_hack (cmd, collect_pseudocommand))
 	{
 	  do
 	    {			/* repeat over a comma-separated list */
@@ -1630,11 +1630,11 @@
 	    }
 	  while (action_exp && *action_exp++ == ',');
 	}			/* if */
-      else if (cmd->function.cfunc == while_stepping_pseudocommand)
+      else if (cmd_cfunc_eq_hack (cmd, while_stepping_pseudocommand))
 	{
 	  collect = &stepping_list;
 	}
-      else if (cmd->function.cfunc == end_actions_pseudocommand)
+      else if (cmd_cfunc_eq_hack (cmd, end_actions_pseudocommand))
 	{
 	  if (collect == &stepping_list)	/* end stepping actions */
 	    collect = &tracepoint_list;
@@ -2315,9 +2315,9 @@
 		cmd = lookup_cmd (&actionline, cmdlist, "", -1, 1);
 		if (cmd == 0)
 		  error ("Bad action list item: %s", actionline);
-		if (cmd->function.cfunc == while_stepping_pseudocommand)
+		if (cmd_cfunc_eq_hack (cmd, while_stepping_pseudocommand))
 		  indent = i2;
-		else if (cmd->function.cfunc == end_actions_pseudocommand)
+		else if (cmd_cfunc_eq_hack (cmd, end_actions_pseudocommand))
 		  indent = i1;
 	      }
 	  }
@@ -2534,11 +2534,11 @@
       if (cmd == 0)
 	error ("Bad action list item: %s", action_exp);
 
-      if (cmd->function.cfunc == while_stepping_pseudocommand)
+      if (cmd_cfunc_eq_hack (cmd, while_stepping_pseudocommand))
 	stepping_actions = 1;
-      else if (cmd->function.cfunc == end_actions_pseudocommand)
+      else if (cmd_cfunc_eq_hack (cmd, end_actions_pseudocommand))
 	stepping_actions = 0;
-      else if (cmd->function.cfunc == collect_pseudocommand)
+      else if (cmd_cfunc_eq_hack (cmd, collect_pseudocommand))
 	{
 	  /* Display the collected data.
 	     For the trap frame, display only what was collected at the trap.
Index: cli/cli-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-cmds.c,v
retrieving revision 1.14
diff -u -r1.14 cli-cmds.c
--- cli-cmds.c	2002/02/05 04:37:23	1.14
+++ cli-cmds.c	2002/02/11 02:43:14
@@ -226,9 +226,10 @@
     }
 }
 
-int is_complete_command (void (*func) (char *args, int from_tty))
+int
+is_complete_command (struct cmd_list_element *c)
 {
-  return func == complete_command;
+  return cmd_cfunc_eq_hack (c, complete_command);
 }
 
 /* ARGSUSED */
Index: cli/cli-cmds.h
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-cmds.h,v
retrieving revision 1.2
diff -u -r1.2 cli-cmds.h
--- cli-cmds.h	2001/03/06 08:21:19	1.2
+++ cli-cmds.h	2002/02/11 02:43:14
@@ -105,7 +105,7 @@
 
 void init_cli_cmds (void);
 
-int is_complete_command (void (*func) (char *args, int from_tty));
+int is_complete_command (struct cmd_list_element *cmd);
 
 /* Exported to gdb/main.c */
 
Index: cli/cli-decode.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-decode.c,v
retrieving revision 1.13
diff -u -r1.13 cli-decode.c
--- cli-decode.c	2002/02/05 04:37:23	1.13
+++ cli-decode.c	2002/02/11 02:43:36
@@ -79,6 +79,13 @@
   cmd->function.sfunc = sfunc; /* Ok.  */
 }
 
+int
+cmd_cfunc_eq_hack (struct cmd_list_element *cmd,
+		   void (*cfunc) (char *args, int from_tty))
+{
+  return cmd->func == do_cfunc && cmd->function.cfunc == cfunc;
+}
+
 
 /* Add element named NAME.
    CLASS is the top level category into which commands are broken down
Index: cli/cli-decode.h
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-decode.h,v
retrieving revision 1.7
diff -u -r1.7 cli-decode.h
--- cli-decode.h	2002/02/05 04:37:23	1.7
+++ cli-decode.h	2002/02/11 02:43:37
@@ -286,6 +286,9 @@
 			   void (*sfunc) (char *args, int from_tty,
 					  struct cmd_list_element * c));
 
+/* HACK: Code grubs around in cmd objects to test the sfunc().  */
+extern int cmd_cfunc_eq_hack (struct cmd_list_element *cmd,
+			      void (*cfunc) (char *args, int from_tty));
 
 extern struct cmd_list_element *lookup_cmd (char **,
 					    struct cmd_list_element *, char *,

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [rfa:cli] More c->function.cfunc zapping
  2002-02-10 18:47 [rfa:cli] More c->function.cfunc zapping Andrew Cagney
@ 2002-02-23 10:39 ` Andrew Cagney
  2002-02-23 10:57 ` Fernando Nasser
  1 sibling, 0 replies; 4+ messages in thread
From: Andrew Cagney @ 2002-02-23 10:39 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches

> Hello,
> 
> This patch zaps a few more instances of function.cfunc in the core-code.  It isn't elegant but hopefully it is better than the existing code.
> 
> Ok?
> 
> Andrew


> 2002-02-10  Andrew Cagney  <ac131313@redhat.com>
> 
> * cli/cli-decode.c (cmd_cfunc_eq_hack): New function.
> 	* command.h (cmd_cfunc_eq_hack): Declare.
> 	* cli/cli-decode.h (cmd_func_eq_hack): Ditto.
> 
> 	* cli/cli-cmds.h (is_complete_command): Change parameter to a
> 	``struct cmd_list_element *''.
> 	* cli/cli-cmds.c (is_complete_command): Update.  Use
> 	cmd_func_eq_hack.
> 	* top.c (execute_command): Pass the command to
> 	is_complete_command.
> 	* tracepoint.c: Replace function.cfunc with cmd_func_eq_hack.
> 
> Index: command.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/command.h,v
> retrieving revision 1.22
> diff -u -r1.22 command.h
> --- command.h	2002/02/05 04:37:21	1.22
> +++ command.h	2002/02/11 02:42:55
> @@ -292,6 +292,9 @@
>  			   void (*sfunc) (char *args, int from_tty,
>  					  struct cmd_list_element * c));
>  
> +/* HACK: Code grubs around in cmd objects to test the sfunc().  */
> +extern int cmd_cfunc_eq_hack (struct cmd_list_element *cmd,
> +			      void (*cfunc) (char *args, int from_tty));
>  
>  extern struct cmd_list_element *lookup_cmd (char **,
>  					    struct cmd_list_element *, char *,
> Index: top.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/top.c,v
> retrieving revision 1.56
> diff -u -r1.56 top.c
> --- top.c	2002/02/10 04:08:42	1.56
> +++ top.c	2002/02/11 02:43:12
> @@ -684,7 +684,7 @@
>           command.  */
>        if (arg
>  	  && c->type != set_cmd
> -	  && !is_complete_command (c->function.cfunc))
> +	  && !is_complete_command (c))
>  	{
>  	  p = arg + strlen (arg) - 1;
>  	  while (p >= arg && (*p == ' ' || *p == '\t'))
> Index: tracepoint.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/tracepoint.c,v
> retrieving revision 1.32
> diff -u -r1.32 tracepoint.c
> --- tracepoint.c	2002/02/05 04:37:22	1.32
> +++ tracepoint.c	2002/02/11 02:43:14
> @@ -939,7 +939,7 @@
>        return BADLINE;
>      }
>  
> -  if (c->function.cfunc == collect_pseudocommand)
> +  if (cmd_cfunc_eq_hack (c, collect_pseudocommand))
>      {
>        struct agent_expr *aexpr;
>        struct agent_reqs areqs;
> @@ -1006,7 +1006,7 @@
>        while (p && *p++ == ',');
>        return GENERIC;
>      }
> -  else if (c->function.cfunc == while_stepping_pseudocommand)
> +  else if (cmd_cfunc_eq_hack (c, while_stepping_pseudocommand))
>      {
>        char *steparg;		/* in case warning is necessary */
>  
> @@ -1022,7 +1022,7 @@
>  	}
>        return STEPPING;
>      }
> -  else if (c->function.cfunc == end_actions_pseudocommand)
> +  else if (cmd_cfunc_eq_hack (c, end_actions_pseudocommand))
>      return END;
>    else
>      {
> @@ -1520,7 +1520,7 @@
>        if (cmd == 0)
>  	error ("Bad action list item: %s", action_exp);
>  
> -      if (cmd->function.cfunc == collect_pseudocommand)
> +      if (cmd_cfunc_eq_hack (cmd, collect_pseudocommand))
>  	{
>  	  do
>  	    {			/* repeat over a comma-separated list */
> @@ -1630,11 +1630,11 @@
>  	    }
>  	  while (action_exp && *action_exp++ == ',');
>  	}			/* if */
> -      else if (cmd->function.cfunc == while_stepping_pseudocommand)
> +      else if (cmd_cfunc_eq_hack (cmd, while_stepping_pseudocommand))
>  	{
>  	  collect = &stepping_list;
>  	}
> -      else if (cmd->function.cfunc == end_actions_pseudocommand)
> +      else if (cmd_cfunc_eq_hack (cmd, end_actions_pseudocommand))
>  	{
>  	  if (collect == &stepping_list)	/* end stepping actions */
>  	    collect = &tracepoint_list;
> @@ -2315,9 +2315,9 @@
>  		cmd = lookup_cmd (&actionline, cmdlist, "", -1, 1);
>  		if (cmd == 0)
>  		  error ("Bad action list item: %s", actionline);
> -		if (cmd->function.cfunc == while_stepping_pseudocommand)
> +		if (cmd_cfunc_eq_hack (cmd, while_stepping_pseudocommand))
>  		  indent = i2;
> -		else if (cmd->function.cfunc == end_actions_pseudocommand)
> +		else if (cmd_cfunc_eq_hack (cmd, end_actions_pseudocommand))
>  		  indent = i1;
>  	      }
>  	  }
> @@ -2534,11 +2534,11 @@
>        if (cmd == 0)
>  	error ("Bad action list item: %s", action_exp);
>  
> -      if (cmd->function.cfunc == while_stepping_pseudocommand)
> +      if (cmd_cfunc_eq_hack (cmd, while_stepping_pseudocommand))
>  	stepping_actions = 1;
> -      else if (cmd->function.cfunc == end_actions_pseudocommand)
> +      else if (cmd_cfunc_eq_hack (cmd, end_actions_pseudocommand))
>  	stepping_actions = 0;
> -      else if (cmd->function.cfunc == collect_pseudocommand)
> +      else if (cmd_cfunc_eq_hack (cmd, collect_pseudocommand))
>  	{
>  	  /* Display the collected data.
>  	     For the trap frame, display only what was collected at the trap.
> Index: cli/cli-cmds.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/cli/cli-cmds.c,v
> retrieving revision 1.14
> diff -u -r1.14 cli-cmds.c
> --- cli-cmds.c	2002/02/05 04:37:23	1.14
> +++ cli-cmds.c	2002/02/11 02:43:14
> @@ -226,9 +226,10 @@
>      }
>  }
>  
> -int is_complete_command (void (*func) (char *args, int from_tty))
> +int
> +is_complete_command (struct cmd_list_element *c)
>  {
> -  return func == complete_command;
> +  return cmd_cfunc_eq_hack (c, complete_command);
>  }
>  
>  /* ARGSUSED */
> Index: cli/cli-cmds.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/cli/cli-cmds.h,v
> retrieving revision 1.2
> diff -u -r1.2 cli-cmds.h
> --- cli-cmds.h	2001/03/06 08:21:19	1.2
> +++ cli-cmds.h	2002/02/11 02:43:14
> @@ -105,7 +105,7 @@
>  
>  void init_cli_cmds (void);
>  
> -int is_complete_command (void (*func) (char *args, int from_tty));
> +int is_complete_command (struct cmd_list_element *cmd);
>  
>  /* Exported to gdb/main.c */
>  
> Index: cli/cli-decode.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/cli/cli-decode.c,v
> retrieving revision 1.13
> diff -u -r1.13 cli-decode.c
> --- cli-decode.c	2002/02/05 04:37:23	1.13
> +++ cli-decode.c	2002/02/11 02:43:36
> @@ -79,6 +79,13 @@
>    cmd->function.sfunc = sfunc; /* Ok.  */
>  }
>  
> +int
> +cmd_cfunc_eq_hack (struct cmd_list_element *cmd,
> +		   void (*cfunc) (char *args, int from_tty))
> +{
> +  return cmd->func == do_cfunc && cmd->function.cfunc == cfunc;
> +}
> +
>  
>  /* Add element named NAME.
>     CLASS is the top level category into which commands are broken down
> Index: cli/cli-decode.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/cli/cli-decode.h,v
> retrieving revision 1.7
> diff -u -r1.7 cli-decode.h
> --- cli-decode.h	2002/02/05 04:37:23	1.7
> +++ cli-decode.h	2002/02/11 02:43:37
> @@ -286,6 +286,9 @@
>  			   void (*sfunc) (char *args, int from_tty,
>  					  struct cmd_list_element * c));
>  
> +/* HACK: Code grubs around in cmd objects to test the sfunc().  */
> +extern int cmd_cfunc_eq_hack (struct cmd_list_element *cmd,
> +			      void (*cfunc) (char *args, int from_tty));
>  
>  extern struct cmd_list_element *lookup_cmd (char **,
>  					    struct cmd_list_element *, char *,
> 



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [rfa:cli] More c->function.cfunc zapping
  2002-02-10 18:47 [rfa:cli] More c->function.cfunc zapping Andrew Cagney
  2002-02-23 10:39 ` Andrew Cagney
@ 2002-02-23 10:57 ` Fernando Nasser
  2002-02-23 11:05   ` Andrew Cagney
  1 sibling, 1 reply; 4+ messages in thread
From: Fernando Nasser @ 2002-02-23 10:57 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches

Andrew Cagney wrote:
> 
> Hello,
> 
> This patch zaps a few more instances of function.cfunc in the core-code.
>   It isn't elegant but hopefully it is better than the existing code.
> 
> Ok?
> 

This a follow-up from your previous changes, right? They became
"obvious"
I guess.

I would prefer that you call

cmd_cfunc_eq_hack  ->   cmd_cfunc_eq

and note that it is a hack in a comment, FIXME or whatever though.

Thanks for the clean-ups.

Fernando 


> Andrew
> 
>   ------------------------------------------------------------------------
> 2002-02-10  Andrew Cagney  <ac131313@redhat.com>
> 
>         * cli/cli-decode.c (cmd_cfunc_eq_hack): New function.
>         * command.h (cmd_cfunc_eq_hack): Declare.
>         * cli/cli-decode.h (cmd_func_eq_hack): Ditto.
> 
>         * cli/cli-cmds.h (is_complete_command): Change parameter to a
>         ``struct cmd_list_element *''.
>         * cli/cli-cmds.c (is_complete_command): Update.  Use
>         cmd_func_eq_hack.
>         * top.c (execute_command): Pass the command to
>         is_complete_command.
>         * tracepoint.c: Replace function.cfunc with cmd_func_eq_hack.
> 
> Index: command.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/command.h,v
> retrieving revision 1.22
> diff -u -r1.22 command.h
> --- command.h   2002/02/05 04:37:21     1.22
> +++ command.h   2002/02/11 02:42:55
> @@ -292,6 +292,9 @@
>                            void (*sfunc) (char *args, int from_tty,
>                                           struct cmd_list_element * c));
> 
> +/* HACK: Code grubs around in cmd objects to test the sfunc().  */
> +extern int cmd_cfunc_eq_hack (struct cmd_list_element *cmd,
> +                             void (*cfunc) (char *args, int from_tty));
> 
>  extern struct cmd_list_element *lookup_cmd (char **,
>                                             struct cmd_list_element *, char *,
> Index: top.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/top.c,v
> retrieving revision 1.56
> diff -u -r1.56 top.c
> --- top.c       2002/02/10 04:08:42     1.56
> +++ top.c       2002/02/11 02:43:12
> @@ -684,7 +684,7 @@
>           command.  */
>        if (arg
>           && c->type != set_cmd
> -         && !is_complete_command (c->function.cfunc))
> +         && !is_complete_command (c))
>         {
>           p = arg + strlen (arg) - 1;
>           while (p >= arg && (*p == ' ' || *p == '\t'))
> Index: tracepoint.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/tracepoint.c,v
> retrieving revision 1.32
> diff -u -r1.32 tracepoint.c
> --- tracepoint.c        2002/02/05 04:37:22     1.32
> +++ tracepoint.c        2002/02/11 02:43:14
> @@ -939,7 +939,7 @@
>        return BADLINE;
>      }
> 
> -  if (c->function.cfunc == collect_pseudocommand)
> +  if (cmd_cfunc_eq_hack (c, collect_pseudocommand))
>      {
>        struct agent_expr *aexpr;
>        struct agent_reqs areqs;
> @@ -1006,7 +1006,7 @@
>        while (p && *p++ == ',');
>        return GENERIC;
>      }
> -  else if (c->function.cfunc == while_stepping_pseudocommand)
> +  else if (cmd_cfunc_eq_hack (c, while_stepping_pseudocommand))
>      {
>        char *steparg;           /* in case warning is necessary */
> 
> @@ -1022,7 +1022,7 @@
>         }
>        return STEPPING;
>      }
> -  else if (c->function.cfunc == end_actions_pseudocommand)
> +  else if (cmd_cfunc_eq_hack (c, end_actions_pseudocommand))
>      return END;
>    else
>      {
> @@ -1520,7 +1520,7 @@
>        if (cmd == 0)
>         error ("Bad action list item: %s", action_exp);
> 
> -      if (cmd->function.cfunc == collect_pseudocommand)
> +      if (cmd_cfunc_eq_hack (cmd, collect_pseudocommand))
>         {
>           do
>             {                   /* repeat over a comma-separated list */
> @@ -1630,11 +1630,11 @@
>             }
>           while (action_exp && *action_exp++ == ',');
>         }                       /* if */
> -      else if (cmd->function.cfunc == while_stepping_pseudocommand)
> +      else if (cmd_cfunc_eq_hack (cmd, while_stepping_pseudocommand))
>         {
>           collect = &stepping_list;
>         }
> -      else if (cmd->function.cfunc == end_actions_pseudocommand)
> +      else if (cmd_cfunc_eq_hack (cmd, end_actions_pseudocommand))
>         {
>           if (collect == &stepping_list)        /* end stepping actions */
>             collect = &tracepoint_list;
> @@ -2315,9 +2315,9 @@
>                 cmd = lookup_cmd (&actionline, cmdlist, "", -1, 1);
>                 if (cmd == 0)
>                   error ("Bad action list item: %s", actionline);
> -               if (cmd->function.cfunc == while_stepping_pseudocommand)
> +               if (cmd_cfunc_eq_hack (cmd, while_stepping_pseudocommand))
>                   indent = i2;
> -               else if (cmd->function.cfunc == end_actions_pseudocommand)
> +               else if (cmd_cfunc_eq_hack (cmd, end_actions_pseudocommand))
>                   indent = i1;
>               }
>           }
> @@ -2534,11 +2534,11 @@
>        if (cmd == 0)
>         error ("Bad action list item: %s", action_exp);
> 
> -      if (cmd->function.cfunc == while_stepping_pseudocommand)
> +      if (cmd_cfunc_eq_hack (cmd, while_stepping_pseudocommand))
>         stepping_actions = 1;
> -      else if (cmd->function.cfunc == end_actions_pseudocommand)
> +      else if (cmd_cfunc_eq_hack (cmd, end_actions_pseudocommand))
>         stepping_actions = 0;
> -      else if (cmd->function.cfunc == collect_pseudocommand)
> +      else if (cmd_cfunc_eq_hack (cmd, collect_pseudocommand))
>         {
>           /* Display the collected data.
>              For the trap frame, display only what was collected at the trap.
> Index: cli/cli-cmds.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/cli/cli-cmds.c,v
> retrieving revision 1.14
> diff -u -r1.14 cli-cmds.c
> --- cli-cmds.c  2002/02/05 04:37:23     1.14
> +++ cli-cmds.c  2002/02/11 02:43:14
> @@ -226,9 +226,10 @@
>      }
>  }
> 
> -int is_complete_command (void (*func) (char *args, int from_tty))
> +int
> +is_complete_command (struct cmd_list_element *c)
>  {
> -  return func == complete_command;
> +  return cmd_cfunc_eq_hack (c, complete_command);
>  }
> 
>  /* ARGSUSED */
> Index: cli/cli-cmds.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/cli/cli-cmds.h,v
> retrieving revision 1.2
> diff -u -r1.2 cli-cmds.h
> --- cli-cmds.h  2001/03/06 08:21:19     1.2
> +++ cli-cmds.h  2002/02/11 02:43:14
> @@ -105,7 +105,7 @@
> 
>  void init_cli_cmds (void);
> 
> -int is_complete_command (void (*func) (char *args, int from_tty));
> +int is_complete_command (struct cmd_list_element *cmd);
> 
>  /* Exported to gdb/main.c */
> 
> Index: cli/cli-decode.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/cli/cli-decode.c,v
> retrieving revision 1.13
> diff -u -r1.13 cli-decode.c
> --- cli-decode.c        2002/02/05 04:37:23     1.13
> +++ cli-decode.c        2002/02/11 02:43:36
> @@ -79,6 +79,13 @@
>    cmd->function.sfunc = sfunc; /* Ok.  */
>  }
> 
> +int
> +cmd_cfunc_eq_hack (struct cmd_list_element *cmd,
> +                  void (*cfunc) (char *args, int from_tty))
> +{
> +  return cmd->func == do_cfunc && cmd->function.cfunc == cfunc;
> +}
> +
> 
>  /* Add element named NAME.
>     CLASS is the top level category into which commands are broken down
> Index: cli/cli-decode.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/cli/cli-decode.h,v
> retrieving revision 1.7
> diff -u -r1.7 cli-decode.h
> --- cli-decode.h        2002/02/05 04:37:23     1.7
> +++ cli-decode.h        2002/02/11 02:43:37
> @@ -286,6 +286,9 @@
>                            void (*sfunc) (char *args, int from_tty,
>                                           struct cmd_list_element * c));
> 
> +/* HACK: Code grubs around in cmd objects to test the sfunc().  */
> +extern int cmd_cfunc_eq_hack (struct cmd_list_element *cmd,
> +                             void (*cfunc) (char *args, int from_tty));
> 
>  extern struct cmd_list_element *lookup_cmd (char **,
>                                             struct cmd_list_element *, char *,

-- 
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [rfa:cli] More c->function.cfunc zapping
  2002-02-23 10:57 ` Fernando Nasser
@ 2002-02-23 11:05   ` Andrew Cagney
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Cagney @ 2002-02-23 11:05 UTC (permalink / raw)
  To: Fernando Nasser; +Cc: gdb-patches

> I would prefer that you call
> 
> cmd_cfunc_eq_hack  -> cmd_cfunc_eq

Done.  That is why I wasn't committing it as obvious.

Andrew




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-02-23 19:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-10 18:47 [rfa:cli] More c->function.cfunc zapping Andrew Cagney
2002-02-23 10:39 ` Andrew Cagney
2002-02-23 10:57 ` Fernando Nasser
2002-02-23 11:05   ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox