From 49614d38c9b298488b2cba15bbee48db8d7ec316 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Fri, 5 Jun 2020 00:54:01 +0200 Subject: dcopidlng fixes: + includes may use quotation marks + argument types can contain multiple words + avoid use long, short, int or char type as the argument name + avoid use type as the argument name if the const qualifier is used + use long notation of int types + the arguments can be nameless + return types can have qualifiers + do not warn on inherit of the DCOPObject and TQObject classes + the documentation comment does not have to end on a separate line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko --- dcop/dcopidlng/kalyptusCxxToDcopIDL.pm | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'dcop/dcopidlng/kalyptusCxxToDcopIDL.pm') diff --git a/dcop/dcopidlng/kalyptusCxxToDcopIDL.pm b/dcop/dcopidlng/kalyptusCxxToDcopIDL.pm index 8a2988f06..0d06613e4 100644 --- a/dcop/dcopidlng/kalyptusCxxToDcopIDL.pm +++ b/dcop/dcopidlng/kalyptusCxxToDcopIDL.pm @@ -161,18 +161,33 @@ sub generateMethod($$) $argType =~ s/^\s*(.*?)\s*$/$1/; $argType =~ s//>/g; - $argType =~ s/\s//g; - - $args .= " $argType$arg->{ArgName}\n"; + $argType =~ s/(\W)\s+/$1/g; + $argType =~ s/\s+(\W)/$1/g; + $argType =~ s/\b(signed|unsigned|long|short)$/$1 int/; + + $args .= " "; + $args .= "$argType"; + $args .= "$arg->{ArgName}" if $arg->{ArgName} !~ /^$/; + $args .= "\n"; } my $qual = ""; $qual .= " qual=\"const\"" if $flags =~ "c"; + my $r_isConst = ($returnType =~ s/^\s*const\s*//); + my $r_isRef = ($returnType =~ s/&//); + + my $retTypeAttrs = ""; + $retTypeAttrs .= " qleft=\"const\"" if $r_isConst; + $retTypeAttrs .= " qright=\"&\"" if $r_isRef; + $returnType = "void" unless $returnType; + $returnType =~ s/^\s*(.*?)\s*$/$1/; $returnType =~ s//>/g; - $returnType =~ s/^\s*const\s*//; + $returnType =~ s/(\W)\s+/$1/g; + $returnType =~ s/\s+(\W)/$1/g; + $returnType =~ s/\b(signed|unsigned|long|short)$/$1 int/; my $methodCode = ""; @@ -182,7 +197,7 @@ sub generateMethod($$) if (!$isConstructor) { $methodCode .= " <$tagType$tagAttr$qual>\n"; - $methodCode .= " $returnType\n"; + $methodCode .= " $returnType\n"; $methodCode .= " $name\n"; $methodCode .= "$args"; $methodCode .= " \n"; -- cgit v1.2.1