From: Aleš Křenek Date: Wed, 5 Mar 2008 11:40:36 +0000 (+0000) Subject: generate attr_names[] using order defined in *AttrNames.pl X-Git-Tag: glite-lb-client-interface_R_3_1_1_2~3 X-Git-Url: http://scientific.zcu.cz/git/?a=commitdiff_plain;h=f58bb7a536c68f171d158f8879f93926b8d2f6c7;p=jra1mw.git generate attr_names[] using order defined in *AttrNames.pl --- diff --git a/org.glite.lb.client/Makefile b/org.glite.lb.client/Makefile index d7729c0..748792c 100644 --- a/org.glite.lb.client/Makefile +++ b/org.glite.lb.client/Makefile @@ -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: diff --git a/org.glite.lb.client/src/Event.cpp.T b/org.glite.lb.client/src/Event.cpp.T index e7d0f2e..5b15845 100644 --- a/org.glite.lb.client/src/Event.cpp.T +++ b/org.glite.lb.client/src/Event.cpp.T @@ -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"; } @@@} diff --git a/org.glite.lb.client/src/JobStatus.cpp.T b/org.glite.lb.client/src/JobStatus.cpp.T index 7ffebfe..1ea969d 100644 --- a/org.glite.lb.client/src/JobStatus.cpp.T +++ b/org.glite.lb.client/src/JobStatus.cpp.T @@ -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"; } @@@}