From 8ff58f810344dbfa2adefec577c9e9bf46706969 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zden=C4=9Bk=20=C5=A0ustr?= Date: Wed, 8 Aug 2012 14:02:38 +0000 Subject: [PATCH] Generate functions to convert string values to enum codes. --- org.glite.lb.common/src/status.c.T | 13 ++++++++++++- org.glite.lb.common/src/xml_parse.c.T | 3 +++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/org.glite.lb.common/src/status.c.T b/org.glite.lb.common/src/status.c.T index bcdb256..61f5af1 100644 --- a/org.glite.lb.common/src/status.c.T +++ b/org.glite.lb.common/src/status.c.T @@ -54,7 +54,18 @@ static const struct timeval null_timeval = {0,0}; $num++; } my $un = uc $n; - printf (" };\n"); + printf (" };\n\n"); + my $fn="enum edg_wll_Stat$n edg_wll_$n" . "StrToCode(const char *in) {"; + gen qq{ +!$fn +! int i; +! +! for (i = 0; i < EDG_WLL_NUMBER_OF_${un}S && strcasecmp(in, edg_wll_Status${n}Names[i]); i++); +! if (i == EDG_WLL_NUMBER_OF_${un}S ) return -1; +! return (enum edg_wll_Stat$n)i; +!\} +}; + } } @@@} diff --git a/org.glite.lb.common/src/xml_parse.c.T b/org.glite.lb.common/src/xml_parse.c.T index ff2e0d1..d8554b7 100644 --- a/org.glite.lb.common/src/xml_parse.c.T +++ b/org.glite.lb.common/src/xml_parse.c.T @@ -2655,6 +2655,9 @@ int edg_wll_JobQueryRecToXML( else edg_wll_add_time_t_to_XMLBody(&pomValue, conditions[row][i].value.t.tv_sec, "lastupdatetime", -1); break; + case EDG_WLL_QUERY_ATTR_JOB_TYPE: + edg_wll_add_int_to_XMLBody(&pomValue, conditions[row][i].value.i, "jobtype", -1); + break; default: free(pomValue); -- 1.8.2.3