generate attr_names[] using order defined in *AttrNames.pl
authorAleš Křenek <ljocha@ics.muni.cz>
Wed, 5 Mar 2008 11:40:36 +0000 (11:40 +0000)
committerAleš Křenek <ljocha@ics.muni.cz>
Wed, 5 Mar 2008 11:40:36 +0000 (11:40 +0000)
org.glite.lb.client/Makefile
org.glite.lb.client/src/Event.cpp.T
org.glite.lb.client/src/JobStatus.cpp.T

index d7729c0..748792c 100644 (file)
@@ -300,6 +300,13 @@ stage:  compile ${FAKELIB} ${FAKETHRLIB}
        $(MAKE) install PREFIX=${stagedir}
        ${INSTALL} -m 644 ${FAKELIB} ${FAKETHRLIB} ${stagedir}/lib
 
+Event.cpp: EventAttrNames.pl
+
+JobStatus.cpp: StatusAttrNames.pl
+
+EventAttrNames.pl StatusAttrNames.pl:
+       ln -s ${stagedir}/share/${lbprefix}/at3/$@ $@
+
 dist: distsrc distbin
 
 distsrc:
@@ -345,6 +352,7 @@ clean:
        rm -rf *.o *.lo .libs lib* *.c *.cpp producer_test
        rm -rf ${LIB} ${THRLIB} ${TOOLS} logevent ${PLUSLIB} ${THRPLUSLIB} ${MAN_GZ} ${MAN8_GZ}
        rm -rf ${EXAMPLES} ${EXAMPLES_CL} ${EXAMPLES_CL_THR} ${sh_PROGS}
+       rm -f EventAttrNames.pl StatusAttrNames.pl
 
 
 check_version:
index e7d0f2e..5b15845 100644 (file)
@@ -24,6 +24,9 @@ EWL_BEGIN_NAMESPACE;
 #define CLASS_PREFIX "glite::lb::Event::"
 
 @@@{
+
+require 'EventAttrNames.pl';
+
 sub typeswitch {
        my $ftype = shift;
        my $resc = shift;
@@ -297,7 +300,7 @@ Event::getValJobId(Attr attr) const
 
 
 static std::string const names[Event::TYPE_MAX] = {
-  "undefined",
+       "undefined",
 @@@{
   for (sort { $event->{order}->{$a} <=> $event->{order}->{$b} }
         $event->getTypes)
@@ -318,11 +321,14 @@ Event::name(void) const
 }
 
 
-/* FIXME: this will not work with the current frozen assignment of constants in Event.h */
 static 
 std::string const attr_names[Event::ATTR_MAX] = {
 @@@{
-       for (sort {$a cmp $b} getAllFields $event) {
+#      for (sort {$a cmp $b} getAllFields $event) {
+#              gen "\t\"$_\",\n";
+#      }
+       for (@main::EventAttrNames) {
+               $_ = lc $_;
                gen "\t\"$_\",\n";
        }
 @@@}
index 7ffebfe..1ea969d 100644 (file)
@@ -16,6 +16,9 @@ EWL_BEGIN_NAMESPACE;
 #define CLASS_PREFIX "glite::lb::JobStatus::"
 
 @@@{
+
+require 'StatusAttrNames.pl';
+
 sub typeswitch {
         my ($ftype,$ctype,$resc) = @_;
         local $_;
@@ -405,10 +408,11 @@ JobStatus::getValJobStatusList(Attr attr) const
 }
 
 
-/* FIXME: this will not work with the current frozen assignment of constants in JobStatus.h */
 static std::string const attr_names[JobStatus::ATTR_MAX] = {
 @@@{
-       for (sort {$a cmp $b} getAllFields $status) {
+#      for (sort {$a cmp $b} getAllFields $status) {
+       for (@main::StatusAttrNames) {
+               $_ = lc $_;
                gen "\t\"$_\",\n";
        }
 @@@}