]> sourceware.org Git - cgen.git/commitdiff
Fix parseing functions to return an error message if the parse failed
authorNick Clifton <nickc@redhat.com>
Fri, 3 Mar 2006 15:57:44 +0000 (15:57 +0000)
committerNick Clifton <nickc@redhat.com>
Fri, 3 Mar 2006 15:57:44 +0000 (15:57 +0000)
ChangeLog
cpu/xc16x.opc

index e792cae314723f92a96f91748f214c7379213a3d..2856b2dac20c7fc4ae5f43643fa3c4cbb671ae9d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-03-03 Shrirang Khisti <shrirangk@kpitcummins.com)
+
+       * cpu/xc16x.opc (parse_hash): Return NULL if the input was parsed
+       or an error message otherwise.
+       (parse_dot, parse_pof, parse_pag, parse_sof, parse_seg): Likewise.
+       Fix up comments to correctly describe the functions.
+
 2006-02-17  Shrirang Khisti  <shrirangk@kpitcummins.com>
             Anil Paranjape   <anilp1@kpitcummins.com>
             Shilin Shakti    <shilins@kpitcummins.com>
index 8d0d29595563f642264b4666989b5479812bc09f..29eaff3f44b8b8b04fe829237f50baaa032dec98 100644 (file)
@@ -59,8 +59,11 @@ parse_hash (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
            long *valuep ATTRIBUTE_UNUSED)
 {
   if (**strp == '#')
-    ++*strp;
-  return NULL;
+    {
+      ++*strp;
+      return NULL;
+    }
+  return _("Missing '#' prefix");
 }
 
 /* Handle '.' prefixes (i.e. skip over them).  */
@@ -72,11 +75,14 @@ parse_dot (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
           long *valuep ATTRIBUTE_UNUSED)
 {
   if (**strp == '.')
-    ++*strp;
-  return NULL;
+    {
+      ++*strp;
+      return NULL;
+    }
+  return _("Missing '.' prefix");
 }
 
-/* Handle '.' prefixes (i.e. skip over them).  */
+/* Handle 'pof:' prefixes (i.e. skip over them).  */
 
 static const char *
 parse_pof (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
@@ -84,12 +90,15 @@ parse_pof (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
           int opindex ATTRIBUTE_UNUSED,
           long *valuep ATTRIBUTE_UNUSED)
 {
-  if (!strncasecmp (*strp, "pof:", 4))
-    *strp += 4;
-  return NULL;
+  if (strncasecmp (*strp, "pof:", 4) == 0)
+    {
+      *strp += 4;
+      return NULL;
+    }
+  return _("Missing 'pof:' prefix");  
 }
 
-/* Handle '.' prefixes (i.e. skip over them).  */
+/* Handle 'pag:' prefixes (i.e. skip over them).  */
 
 static const char *
 parse_pag (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
@@ -97,33 +106,44 @@ parse_pag (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
           int opindex ATTRIBUTE_UNUSED,
           long *valuep ATTRIBUTE_UNUSED)
 {
-  if (!strncasecmp (*strp, "pag:", 4))
-    *strp += 4;
-  return NULL;
+  if (strncasecmp (*strp, "pag:", 4) == 0)
+    {
+      *strp += 4;
+      return NULL;
+    }
+  return _("Missing 'pag:' prefix");
 }
 
 /* Handle 'sof' prefixes (i.e. skip over them).  */
+
 static const char *
 parse_sof (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
           const char **strp,
           int opindex ATTRIBUTE_UNUSED,
           long *valuep ATTRIBUTE_UNUSED)
 {
-  if (!strncasecmp (*strp, "sof:", 4))
-    *strp += 4;
-  return NULL;
+  if (strncasecmp (*strp, "sof:", 4) == 0)
+    {
+      *strp += 4;
+      return NULL;
+    }
+  return _("Missing 'sof:' prefix");
 }
 
 /* Handle 'seg' prefixes (i.e. skip over them).  */
+
 static const char *
 parse_seg (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
           const char **strp,
           int opindex ATTRIBUTE_UNUSED,
           long *valuep ATTRIBUTE_UNUSED)
 {
-  if (!strncasecmp (*strp, "seg:", 4))
-    *strp += 4;
-  return NULL;
+  if (strncasecmp (*strp, "seg:", 4) == 0)
+    {
+      *strp += 4;
+      return NULL;
+    }
+  return _("Missing 'seg:' prefix");
 }
 /* -- */
 \f
@@ -141,7 +161,7 @@ parse_seg (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
     }                                                          \
   while (0)
 
-/* Handle '.' prefixes as operands.  */
+/* Print a 'pof:' prefix to an operand.  */
 
 static void
 print_pof (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
@@ -153,7 +173,7 @@ print_pof (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 {
 }
 
-/* Handle '.' prefixes as operands.  */
+/* Print a 'pag:' prefix to an operand.  */
 
 static void
 print_pag (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
@@ -165,7 +185,7 @@ print_pag (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
 {
 }
 
-/* Handle '.' prefixes as operands.  */
+/* Print a 'sof:' prefix to an operand.  */
 
 static void
 print_sof (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
@@ -180,7 +200,7 @@ print_sof (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
   info->fprintf_func (info->stream, "sof:");
 }
 
-/* Handle '.' prefixes as operands.  */
+/* Print a 'seg:' prefix to an operand.  */
 
 static void
 print_seg (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
@@ -195,7 +215,7 @@ print_seg (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
   info->fprintf_func (info->stream, "seg:");
 }
 
-/* Handle '#' prefixes as operands.  */
+/* Print a '#' prefix to an operand.  */
 
 static void
 print_hash (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
@@ -210,7 +230,7 @@ print_hash (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
   info->fprintf_func (info->stream, "#");
 }
 
-/* Handle '.' prefixes as operands.  */
+/* Print a '.' prefix to an operand.  */
 
 static void
 print_dot (CGEN_CPU_DESC cd ATTRIBUTE_UNUSED,
This page took 0.035221 seconds and 5 git commands to generate.