From a83e745e73ad16dec6b0cb9fc23eca5539f06601 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20Posp=C3=AD=C5=A1il?= Date: Thu, 14 Jun 2007 14:02:06 +0000 Subject: [PATCH] sync with HEAD, the T code for LogEvent shortcuts synced but kept duplicit in producer.h and uiwrap.c --- .../interface/producer.h.T | 204 +++++++++++++------- org.glite.lb.client/src/uiwrap.c.T | 206 +++++++++++++-------- 2 files changed, 270 insertions(+), 140 deletions(-) diff --git a/org.glite.lb.client-interface/interface/producer.h.T b/org.glite.lb.client-interface/interface/producer.h.T index ee3b3d6..e212747 100644 --- a/org.glite.lb.client-interface/interface/producer.h.T +++ b/org.glite.lb.client-interface/interface/producer.h.T @@ -87,88 +87,164 @@ for my $t (sort { $event->{order}->{$a} <=> $event->{order}->{$b} } /* edg_wll_LogEvent shortcuts */ @@@{ +# this part is common for producer.h and uiwrap.c - keep it always the same (branch_RC31_3) +# - see uiwrap.T in org.glite.lb.client/src/uiwrap.T (HEAD) +# it generates either protoypes (set $PRINTPROTOTYPESONLY to 1) or implementation + +$PRINTPROTOTYPESONLY = 1; +$PRINTDOC = 1; + for my $t (sort { $event->{order}->{$a} <=> $event->{order}->{$b} } $event->getTypes) { my $tu = uc $t; - my $a = "(edg_wll_Context context"; - my $b = "(context,EDG_WLL_EVENT_$tu,EDG_WLL_FORMAT_$tu"; - my $doc = qq{ - * \\param[in,out] context\tcontext to work with, -}; + my $func = "edg_wll_Log$t"; # name of generated function + my $funcproxy = $func . "Proxy"; + my $funcc = $func . "CODETOREPLACE"; # name of generated CODE function + my $funccproxy = $funcc . "Proxy"; + my $p = "edg_wll_Context context"; # parameters of generated function + my $pc = $p; # parameters of generated CODE function + my $q = "context,EDG_WLL_EVENT_$tu,EDG_WLL_FORMAT_$tu"; # parameters for LogEvent called in generated function + my $qc = $q; # parameters for LogEvent called in generated CODE function + my $text = ""; # whole text for generated function + my $textproxy = ""; # whole text for generated CODE function + my $doc = " * \\param[in,out] context\tcontext to work with, \n"; # parameters description for generated function + my $docc = $doc; # parameters description for generated CODE function + + my $decl = "\tint ret;\n"; + my $free = ""; + selectType $event $t; for ($event->getFieldsOrdered) { my $f = selectField $event $_; my $fn = $f->getName; - my $ft; + my $sfn = $fn; + my $ft = "const "; + my $fc = $f->getComment; + if ($ULMasString{$f->{type}}) { + $decl .= "\tchar *s_$fn = ".$f->getType()."ToString($fn);\n"; + $free .= "\tif (s_$fn) free(s_$fn);\n"; + $sfn = "s_$fn"; + } if ($f->{codes}) { -# $ft = "enum edg_wll\_$t" . ucfirst $fn; - $ft = "char *"; +# XXX: obsolete $ft = "enum edg_wll\_$t" . ucfirst $fn; + $ft = $ft . "char *"; + $qc = $qc . ", CODETOREPLACE"; } else { - $ft = $f->getType; + $ft = $ft . $f->getType; + $pc = $pc . ", $ft $fn"; + $qc = $qc . ", $sfn"; + $docc = $docc . " * \\param[in] $fn\t$fc\n"; } - $ft = "const ".$ft; - my $fc = $f->getComment; - $a = $a . ", $ft $fn"; - $b = $b . ", $fn"; + $p = $p . ", $ft $fn"; + $q = $q . ", $sfn"; $doc = $doc . " * \\param[in] $fn\t$fc\n"; } - $a = $a . ")"; - $b = $b . ")"; - gen qq{ + $text = qq{ /** - * \\fn int edg_wll_Log$t$a; - * \\brief simple wrapper around edg_wll_LogEvent for event $t} . $doc . qq{ * \\see edg_wll_LogEvent\(\) - */ + * \\brief $func + * + * $func - simple wrapper around edg_wll_LogEvent for event $t + * }; - gen "\nextern int edg_wll_Log${t}$a;\n"; - gen "\nextern int edg_wll_Log${t}Proxy$a;\n"; -# gen qq{ -#int edg_wll_Log$t$a -#\{ -# return edg_wll_LogEvent$b; -#\}\n -#}; + $textproxy = qq{ +/** + * \\brief $funcproxy + * + * $funcproxy - simple wrapper around edg_wll_LogEventProxy for event $t + * +}; + if ($PRINTDOC) { + $text = $text . $doc . " * \\see edg_wll_LogEvent()\n"; + $textproxy = $textproxy . $doc . "* \\see edg_wll_LogEventProxy()\n" + } + $text = $text . " */\n"; + $textproxy = $textproxy . " */\n"; + if ($PRINTPROTOTYPESONLY) { + $text = $text . "\nextern int $func($p);\n"; + $textproxy = $textproxy . "\nextern int $funcproxy($p);\n"; + } else { + $text = $text . qq{ +int $func($p) +\{ +$decl + ret = edg_wll_LogEvent($q); +$free + return ret; +\} +}; + $textproxy = $textproxy . qq{ +int $funcproxy($p) +\{ +$decl + ret = edg_wll_LogEventProxy($q); +$free + return ret; +\} +}; + } + gen "$text"; + gen "$textproxy"; + + # + # generate also CODE functions: + # for ($event->getFieldsOrdered) { - my $f = selectField $event $_; - my $fn = $f->getName; - my $ft; - if ($f->{codes}) { -# $ft = "enum edg_wll\_$t" . ucfirst $fn; - $ft = "char *"; - } else { - $ft = $f->getType; - } - my $ftreg = $ft; - $ftreg =~ s/\*/\\\*/g; - $ftreg = "const ".$ftreg; - my $fc = $f->getComment; - if ($f->{codes}) { - for (@{$f->{codes}}) { - my $code = uc $_->{name}; - my $c = $a; - my $d = $b; - my $e = $doc; - $c =~ s/, $ftreg $fn//g; - $d =~ s/$fn/"$code"/g; -# FIXME: this documentation line in $e doesn't delete!! - $e =~ s/ \* \\param\[in\] $fn\t$fc\n//g; - gen qq{ + my $f = selectField $event $_; + my $fn = $f->getName; + if ($f->{codes}) { + for (@{$f->{codes}}) { + my $code = uc $_->{name}; + my $funccc = $funcc; $funccc =~ s/CODETOREPLACE/$code/g; + my $funcccproxy = $funccproxy; $funcccproxy =~ s/CODETOREPLACE/$code/g; + my $qcc = $qc; $qcc =~ s/CODETOREPLACE/"$code"/g; + my $textc = qq{ /** - * \\fn int edg_wll_Log$t$code$c; - * \\brief simple wrapper around edg_wll_LogEvent for event $t, $fn $code} . $e . qq{ * \\see edg_wll_LogEvent\(\) - */ + * \\brief $funccc + * + * $funccc - simple wrapper around edg_wll_LogEvent for event $t, $fn $code + * }; - gen "\nextern int edg_wll_Log$t${code}$c;\n"; - gen "\nextern int edg_wll_Log$t${code}Proxy$c;\n"; -# gen qq{ -#int edg_wll_Log$t$code$c -#\{ -# return edg_wll_LogEvent$d; -#\}\n -#}; - } + my $textcproxy = qq{ +/** + * \\brief $funcccproxy + * + * $funcccproxy - simple wrapper around edg_wll_LogEventProxy for event $t, $fn $code + * +}; + if ($PRINTDOC) { + $textc = $textc . $docc . " * \\see edg_wll_LogEvent()\n"; + $textcproxy = $textcproxy . $docc . " * \\see edg_wll_LogEventProxy()\n"; } - } + $textc = $textc . " */\n"; + $textcproxy = $textcproxy . " */\n"; + if ($PRINTPROTOTYPESONLY) { + $textc = $textc . "\nextern int $funccc($pc);\n"; + $textcproxy = $textcproxy . "\nextern int $funcccproxy($pc);\n"; + } else { + $textc = $textc . qq{ +int $funccc($pc) +\{ +$decl + ret = edg_wll_LogEvent($qcc); +$free + return ret; +\} +}; + $textcproxy = $textcproxy . qq{ +int $funcccproxy($pc) +\{ +$decl + ret = edg_wll_LogEventProxy($qcc); +$free + return ret; +\} +}; + } + gen "$textc"; + gen "$textcproxy"; + } # for codes + } # if + } # for getFields } @@@} diff --git a/org.glite.lb.client/src/uiwrap.c.T b/org.glite.lb.client/src/uiwrap.c.T index 8ad66e0..6698727 100644 --- a/org.glite.lb.client/src/uiwrap.c.T +++ b/org.glite.lb.client/src/uiwrap.c.T @@ -8,109 +8,163 @@ #include "glite/lb/producer.h" @@@{ +# this part is common for producer.h and uiwrap.c - keep it always the same (branch_RC31_3) +# - see uiwrap.T in org.glite.lb.client/src/uiwrap.T (HEAD) +# it generates either protoypes (set $PRINTPROTOTYPESONLY to 1) or implementation + +$PRINTPROTOTYPESONLY = 0; +$PRINTDOC = 0; + for my $t (sort { $event->{order}->{$a} <=> $event->{order}->{$b} } $event->getTypes) { my $tu = uc $t; - my $a = "(edg_wll_Context context"; - my $b = "(context,EDG_WLL_EVENT_$tu,EDG_WLL_FORMAT_$tu"; - my $decl = ""; + my $func = "edg_wll_Log$t"; # name of generated function + my $funcproxy = $func . "Proxy"; + my $funcc = $func . "CODETOREPLACE"; # name of generated CODE function + my $funccproxy = $funcc . "Proxy"; + my $p = "edg_wll_Context context"; # parameters of generated function + my $pc = $p; # parameters of generated CODE function + my $q = "context,EDG_WLL_EVENT_$tu,EDG_WLL_FORMAT_$tu"; # parameters for LogEvent called in generated function + my $qc = $q; # parameters for LogEvent called in generated CODE function + my $text = ""; # whole text for generated function + my $textproxy = ""; # whole text for generated CODE function + my $doc = " * \\param[in,out] context\tcontext to work with, \n"; # parameters description for generated function + my $docc = $doc; # parameters description for generated CODE function + + my $decl = "\tint ret;\n"; my $free = ""; - my $doc = qq{ - * \\param context\tcontext to work with, -}; + selectType $event $t; for ($event->getFieldsOrdered) { my $f = selectField $event $_; my $fn = $f->getName; - my $ft; - my $bfn = $fn; - if ($f->{codes}) { -# $ft = "enum edg_wll\_$t" . ucfirst $fn; - $ft = "char *"; - } else { - $ft = $f->getType; - } + my $sfn = $fn; + my $ft = "const "; + my $fc = $f->getComment; if ($ULMasString{$f->{type}}) { $decl .= "\tchar *s_$fn = ".$f->getType()."ToString($fn);\n"; - $free .= "\tfree(s_$fn);\n"; - $bfn = "s_$fn"; + $free .= "\tif (s_$fn) free(s_$fn);\n"; + $sfn = "s_$fn"; } - $ft = "const ".$ft; - my $fc = $f->getComment; - $a = $a . ", $ft $fn"; - $b = $b . ", $bfn"; - $doc = $doc . " * \\param $fn\t$fc\n"; + if ($f->{codes}) { +# XXX: obsolete $ft = "enum edg_wll\_$t" . ucfirst $fn; + $ft = $ft . "char *"; + $qc = $qc . ", CODETOREPLACE"; + } else { + $ft = $ft . $f->getType; + $pc = $pc . ", $ft $fn"; + $qc = $qc . ", $sfn"; + $docc = $docc . " * \\param[in] $fn\t$fc\n"; + } + $p = $p . ", $ft $fn"; + $q = $q . ", $sfn"; + $doc = $doc . " * \\param[in] $fn\t$fc\n"; } - $a = $a . ")"; - $b = $b . ")"; - - gen qq{ -/*! - * \\fn int edg_wll_Log$t$a; - * \\brief simple wrapper around edg_wll_LogEvent for event $t} . $doc . qq{ * \\see edg_wll_LogEvent\(\) - */ + $text = qq{ +/** + * \\brief $func + * + * $func - simple wrapper around edg_wll_LogEvent for event $t + * }; -# gen "\nextern int edg_wll_Log$t$a;\n\n"; - gen qq{ -int edg_wll_Log$t$a + $textproxy = qq{ +/** + * \\brief $funcproxy + * + * $funcproxy - simple wrapper around edg_wll_LogEventProxy for event $t + * +}; + if ($PRINTDOC) { + $text = $text . $doc . " * \\see edg_wll_LogEvent()\n"; + $textproxy = $textproxy . $doc . "* \\see edg_wll_LogEventProxy()\n" + } + $text = $text . " */\n"; + $textproxy = $textproxy . " */\n"; + if ($PRINTPROTOTYPESONLY) { + $text = $text . "\nextern int $func($p);\n"; + $textproxy = $textproxy . "\nextern int $funcproxy($p);\n"; + } else { + $text = $text . qq{ +int $func($p) \{ $decl - return edg_wll_LogEvent$b; -\}\n + ret = edg_wll_LogEvent($q); +$free + return ret; +\} }; - gen qq{ -int edg_wll_Log${t}Proxy$a + $textproxy = $textproxy . qq{ +int $funcproxy($p) \{ $decl - return edg_wll_LogEventProxy$b; -\}\n + ret = edg_wll_LogEventProxy($q); +$free + return ret; +\} }; + } + gen "$text"; + gen "$textproxy"; + + # + # generate also CODE functions: + # for ($event->getFieldsOrdered) { - my $f = selectField $event $_; - my $fn = $f->getName; - my $ft; - if ($f->{codes}) { -# $ft = "enum edg_wll\_$t" . ucfirst $fn; - $ft = "char *"; - } else { - $ft = $f->getType; - } - my $ftreg = $ft; - $ftreg =~ s/\*/\\\*/g; - $ftreg = "const ".$ftreg; - my $fc = $f->getComment; - if ($f->{codes}) { - for (@{$f->{codes}}) { - my $code = uc $_->{name}; - my $c = $a; - my $d = $b; - my $e = $doc; - $c =~ s/, $ftreg $fn//g; - $d =~ s/$fn/"$code"/g; - $e =~ s/ \* \\param $fn\t$fc\n//g; - gen qq{ -/*! - * \\fn int edg_wll_Log$t$code$c; - * \\brief simple wrapper around edg_wll_LogEvent for event $t, $fn $code} . $e . qq{ * \\see edg_wll_LogEvent\(\) - */ + my $f = selectField $event $_; + my $fn = $f->getName; + if ($f->{codes}) { + for (@{$f->{codes}}) { + my $code = uc $_->{name}; + my $funccc = $funcc; $funccc =~ s/CODETOREPLACE/$code/g; + my $funcccproxy = $funccproxy; $funcccproxy =~ s/CODETOREPLACE/$code/g; + my $qcc = $qc; $qcc =~ s/CODETOREPLACE/"$code"/g; + my $textc = qq{ +/** + * \\brief $funccc + * + * $funccc - simple wrapper around edg_wll_LogEvent for event $t, $fn $code + * }; -# gen "\nextern int edg_wll_Log$t$code$c;\n\n"; - gen qq{ -int edg_wll_Log$t$code$c + my $textcproxy = qq{ +/** + * \\brief $funcccproxy + * + * $funcccproxy - simple wrapper around edg_wll_LogEventProxy for event $t, $fn $code + * +}; + if ($PRINTDOC) { + $textc = $textc . $docc . " * \\see edg_wll_LogEvent()\n"; + $textcproxy = $textcproxy . $docc . " * \\see edg_wll_LogEventProxy()\n"; + } + $textc = $textc . " */\n"; + $textcproxy = $textcproxy . " */\n"; + if ($PRINTPROTOTYPESONLY) { + $textc = $textc . "\nextern int $funccc($pc);\n"; + $textcproxy = $textcproxy . "\nextern int $funcccproxy($pc);\n"; + } else { + $textc = $textc . qq{ +int $funccc($pc) \{ $decl - return edg_wll_LogEvent$d; -\}\n + ret = edg_wll_LogEvent($qcc); +$free + return ret; +\} }; - gen qq{ -int edg_wll_Log$t${code}Proxy$c + $textcproxy = $textcproxy . qq{ +int $funcccproxy($pc) \{ $decl - return edg_wll_LogEventProxy$d; -\}\n + ret = edg_wll_LogEventProxy($qcc); +$free + return ret; +\} }; - } } - } + gen "$textc"; + gen "$textcproxy"; + } # for codes + } # if + } # for getFields } @@@} -- 1.8.2.3