Generate naming arrays for miscelanous attribute enums.
authorZdeněk Šustr <sustr4@cesnet.cz>
Wed, 8 Aug 2012 13:16:20 +0000 (13:16 +0000)
committerZdeněk Šustr <sustr4@cesnet.cz>
Wed, 8 Aug 2012 13:16:20 +0000 (13:16 +0000)
org.glite.lb.common/interface/jobstat.h.T
org.glite.lb.common/src/status.c.T

index dc4201e..6ed2aef 100644 (file)
@@ -68,8 +68,12 @@ extern "C" {
                        gen qq{
 !      EDG_WLL_NUMBER_OF_${un}S        /**< Number of ${n}s */
 };
+                       my $an="edg_wll_Status" . $n . "Names[]";
                        gen qq{
 !\};
+
+extern char     *$an;
+
 };
                }
        }
@@ -172,6 +176,7 @@ typedef struct _edg_wll_JobStat {
 /* starting from bit 10 private flags begins - do not add 1024 and more! */
 
 
+
 /**
  * Initialize empty status structure.
  * Fills in the stucture with NULL's or values with no meaning
index 82e1296..bcdb256 100644 (file)
@@ -36,6 +36,29 @@ static const struct timeval null_timeval = {0,0};
         gen qq{$sep};
 @@@}
 
+
+@@@{
+        for my $n ($status->getAllFieldsOrdered) {
+# XXX: we've got only _common_ in jobStatus, no clash possible
+                my $f = selectField $status $n;
+                if ($f->{codes}) {
+                        my $n = ucfirst getName $f;
+                       printf("\nchar     *edg_wll_Status$n");
+                       printf("Names[] = \{");
+                       my $num = 0;
+                        for (@{$f->{codes}}) {
+                                my $uc = uc $_->{name};
+                                $uc =~ tr/-/_/;
+                               if ( $num != 0 ) { printf (","); }
+                               printf(" \"$uc\"");
+                               $num++;
+                        }
+                        my $un = uc $n;
+                       printf (" };\n");
+                }
+        }
+@@@}
+
 extern void edg_wll_FreeTagList(edg_wll_TagValue *);
 
 void edg_wll_FreeStatus(edg_wll_JobStat *stat)