This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[commit] Adjustments to Ada i18n changes and messages


Following up on comments from my last patch, I have modified some error
messages in Ada files to make for (I hope) easier translation, 
incidentally fixing some little grammatical problems (present also 
in c-exp.y and possibly elsewhere).

Eli wrote:

> > -          error (_("Attempt to index or call something other than an \
> > -array or function"));
> > +          error (_("Attempt to index or call something other than an "
> > +		   "array or function"));
> 
> Does xgettext support strings broken between 2 lines?

I was mistaken in my previous response.  xgettext has no problem with this
at all; no change was needed.

There was also a small error in the previous ChangeLog entry (there is no
ada-tasks.c file).

Paul Hilfinger


ChangeLog:

2006-01-12  Paul N. Hilfinger <hilfinger@adacore.com>

	* ada-exp.y (yyerror): Change message to ignore the argument, avoiding
	translation problems.
	* ada-lang.c (ada_value_struct_elt): Change interface and handling
	of errors to avoid translation problem (and less than optimal error
	messages).
	(ada_value_tag, ada_tag_name_1, ada_tag_name_2,	ada_evaluate_subexp):
	Use new interface to ada_value_struct_elt.
	* ada_lang.h (ada_value_struct_elt): Update declaration to new 
	interface.
	
	* ChangeLog: remove reference to ada-tasks.c from entry of
	2006-01-07.
	
Index: gdb/ada-exp.y
===================================================================
RCS file: /cvs/src/src/gdb/ada-exp.y,v
retrieving revision 1.18
diff -u -p -r1.18 ada-exp.y
--- gdb/ada-exp.y	8 Jan 2006 07:19:39 -0000	1.18
+++ gdb/ada-exp.y	12 Jan 2006 08:34:54 -0000
@@ -768,7 +768,7 @@ ada_parse (void)
 void
 yyerror (char *msg)
 {
-  error (_("A %s in expression, near `%s'."), (msg ? msg : _("error")), lexptr);
+  error (_("Error in expression, near `%s'."), lexptr);
 }
 
 /* The operator name corresponding to operator symbol STRING (adds
Index: gdb/ada-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/ada-lang.c,v
retrieving revision 1.83
diff -u -p -r1.83 ada-lang.c
--- gdb/ada-lang.c	8 Jan 2006 07:19:39 -0000	1.83
+++ gdb/ada-lang.c	12 Jan 2006 08:34:55 -0000
@@ -5220,7 +5220,7 @@ ada_tag_type (struct value *val)
 struct value *
 ada_value_tag (struct value *val)
 {
-  return ada_value_struct_elt (val, "_tag", "record");
+  return ada_value_struct_elt (val, "_tag", 0);
 }
 
 /* The value of the tag on the object of type TYPE whose contents are
@@ -5279,10 +5279,10 @@ ada_tag_name_1 (void *args0)
   char *p;
   struct value *val;
   args->name = NULL;
-  val = ada_value_struct_elt (args->tag, "tsd", NULL);
+  val = ada_value_struct_elt (args->tag, "tsd", 1);
   if (val == NULL)
     return ada_tag_name_2 (args);
-  val = ada_value_struct_elt (val, "expanded_name", NULL);
+  val = ada_value_struct_elt (val, "expanded_name", 1);
   if (val == NULL)
     return 0;
   read_memory_string (value_as_address (val), name, sizeof (name) - 1);
@@ -5317,7 +5317,7 @@ ada_tag_name_2 (struct tag_args *args)
   val = value_ind (value_add (valp, value_from_longest (builtin_type_int, -1)));
   if (val == NULL)
     return 0;
-  val = ada_value_struct_elt (val, "expanded_name", NULL);
+  val = ada_value_struct_elt (val, "expanded_name", 1);
   if (val == NULL)
     return 0;
   read_memory_string (value_as_address (val), name, sizeof (name) - 1);
@@ -5823,14 +5823,11 @@ ada_index_struct_field_1 (int *index_p, 
    and (recursively) among all members of any wrapper members
    (e.g., '_parent').
 
-   ERR is a name (for use in error messages) that identifies the class
-   of entity that ARG is supposed to be.  ERR may be null, indicating
-   that on error, the function simply returns NULL, and does not
-   throw an error.  (FIXME: True only if ARG is a pointer or reference
-   at the moment). */
+   If NO_ERR, then simply return NULL in case of error, rather than 
+   calling error.  */
 
 struct value *
-ada_value_struct_elt (struct value *arg, char *name, char *err)
+ada_value_struct_elt (struct value *arg, char *name, int no_err)
 {
   struct type *t, *t1;
   struct value *v;
@@ -5841,12 +5838,7 @@ ada_value_struct_elt (struct value *arg,
     {
       t1 = TYPE_TARGET_TYPE (t);
       if (t1 == NULL)
-        {
-          if (err == NULL)
-            return NULL;
-          else
-            error (_("Bad value type in a %s."), err);
-        }
+	goto BadValue;
       t1 = ada_check_typedef (t1);
       if (TYPE_CODE (t1) == TYPE_CODE_PTR)
         {
@@ -5859,12 +5851,7 @@ ada_value_struct_elt (struct value *arg,
     {
       t1 = TYPE_TARGET_TYPE (t);
       if (t1 == NULL)
-        {
-          if (err == NULL)
-            return NULL;
-          else
-            error (_("Bad value type in a %s."), err);
-        }
+	goto BadValue;
       t1 = ada_check_typedef (t1);
       if (TYPE_CODE (t1) == TYPE_CODE_PTR)
         {
@@ -5876,13 +5863,7 @@ ada_value_struct_elt (struct value *arg,
     }
 
   if (TYPE_CODE (t1) != TYPE_CODE_STRUCT && TYPE_CODE (t1) != TYPE_CODE_UNION)
-    {
-      if (err == NULL)
-        return NULL;
-      else
-        error (_("Attempt to extract a component of a value that is not a %s."),
-               err);
-    }
+    goto BadValue;
 
   if (t1 == t)
     v = ada_search_struct_field (name, arg, 0, t);
@@ -5918,10 +5899,16 @@ ada_value_struct_elt (struct value *arg,
         }
     }
 
-  if (v == NULL && err != NULL)
+  if (v != NULL || no_err)
+    return v;
+  else
     error (_("There is no member named %s."), name);
 
-  return v;
+ BadValue:
+  if (no_err)
+    return NULL;
+  else
+    error (_("Attempt to extract a component of a value that is not a record."));
 }
 
 /* Given a type TYPE, look up the type of the component of type named NAME.
@@ -8585,7 +8572,7 @@ ada_evaluate_subexp (struct type *expect
         return
           ada_to_fixed_value (unwrap_value
                               (ada_value_struct_elt
-                               (arg1, &exp->elts[pc + 2].string, _("record"))));
+                               (arg1, &exp->elts[pc + 2].string, 0)));
     case OP_TYPE:
       /* The value is not supposed to be used.  This is here to make it
          easier to accommodate expressions that contain types.  */
Index: gdb/ada-lang.h
===================================================================
RCS file: /cvs/src/src/gdb/ada-lang.h,v
retrieving revision 1.22
diff -u -p -r1.22 ada-lang.h
--- gdb/ada-lang.h	2 Jan 2006 09:46:34 -0000	1.22
+++ gdb/ada-lang.h	12 Jan 2006 08:34:55 -0000
@@ -363,7 +363,7 @@ extern int ada_in_variant (LONGEST, stru
 
 extern char *ada_variant_discrim_name (struct type *);
 
-extern struct value *ada_value_struct_elt (struct value *, char *, char *);
+extern struct value *ada_value_struct_elt (struct value *, char *, int);
 
 extern int ada_is_aligner_type (struct type *);
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]