summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2020-06-05 00:54:01 +0200
committerSlávek Banko <slavek.banko@axis.cz>2020-06-07 14:49:00 +0200
commit49614d38c9b298488b2cba15bbee48db8d7ec316 (patch)
tree155a546fe7b84d071a314dba5786cc19575ca548
parentef23612c5643909edcad8665fadd82583501a602 (diff)
downloadtdelibs-49614d38c9b298488b2cba15bbee48db8d7ec316.tar.gz
tdelibs-49614d38c9b298488b2cba15bbee48db8d7ec316.zip
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 Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
-rw-r--r--dcop/dcopidlng/kalyptus18
-rw-r--r--dcop/dcopidlng/kalyptusCxxToDcopIDL.pm25
-rw-r--r--dcop/dcopidlng/kdocAstUtil.pm8
-rw-r--r--dcop/dcopidlng/kdocParseDoc.pm12
4 files changed, 41 insertions, 22 deletions
diff --git a/dcop/dcopidlng/kalyptus b/dcop/dcopidlng/kalyptus
index bde755236..2706a90f9 100644
--- a/dcop/dcopidlng/kalyptus
+++ b/dcop/dcopidlng/kalyptus
@@ -439,7 +439,7 @@ LOOP:
|| $p =~ /^\s*KDOM_/
);
- push @includes_list, $1 if $p =~ /^#include\s+<?(.*?)>?\s*$/;
+ push @includes_list, $1 if $p =~ /^#include\s+[<"]?(.*?)[>"]?\s*$/;
# remove all preprocessor macros
if( $p =~ /^\s*#\s*(\w+)/ ) {
@@ -1521,16 +1521,22 @@ sub makeParamList($$$)
# Separate arg type from arg name, if the latter is specified
if ( $arg =~ /(.*)\s+([\w_]+)\s*$/ || $arg =~ /(.*)\(\s*\*\s([\w_]+)\)\s*\((.*)\)\s*$/ ) {
- if ( defined $3 ) { # function pointer
- $argType = $1."(*)($3)";
- $argName = $2;
+ if ( $1 eq "const" || $2 eq "long" || $2 eq "short" || $2 eq "int" || $2 eq "char" ) {
+ # const qualifier or long notation of numeric type
+ # without argument name
+ $argType = "$1 $2";
} else {
$argType = $1;
$argName = $2;
}
- } else { # unnamed arg - or enum value
+ if ( defined $3 ) {
+ # function pointer
+ $argType .= "(*)($3)";
+ }
+ } else {
+ # unnamed arg - or enum value
$argType = $arg if (!$isEnum);
- $argName = $arg if ($isEnum);
+ $argName = $arg if ($isEnum);
}
$argId++;
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/</&lt;/g;
$argType =~ s/>/&gt;/g;
- $argType =~ s/\s//g;
-
- $args .= " <ARG><TYPE$typeAttrs>$argType</TYPE><NAME>$arg->{ArgName}</NAME></ARG>\n";
+ $argType =~ s/(\W)\s+/$1/g;
+ $argType =~ s/\s+(\W)/$1/g;
+ $argType =~ s/\b(signed|unsigned|long|short)$/$1 int/;
+
+ $args .= " ";
+ $args .= "<ARG><TYPE$typeAttrs>$argType</TYPE>";
+ $args .= "<NAME>$arg->{ArgName}</NAME>" if $arg->{ArgName} !~ /^$/;
+ $args .= "</ARG>\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=\"&amp;\"" if $r_isRef;
+
$returnType = "void" unless $returnType;
+ $returnType =~ s/^\s*(.*?)\s*$/$1/;
$returnType =~ s/</&lt;/g;
$returnType =~ s/>/&gt;/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 .= " <TYPE>$returnType</TYPE>\n";
+ $methodCode .= " <TYPE$retTypeAttrs>$returnType</TYPE>\n";
$methodCode .= " <NAME>$name</NAME>\n";
$methodCode .= "$args";
$methodCode .= " </$tagType>\n";
diff --git a/dcop/dcopidlng/kdocAstUtil.pm b/dcop/dcopidlng/kdocAstUtil.pm
index f31f2b365..6abb59a25 100644
--- a/dcop/dcopidlng/kdocAstUtil.pm
+++ b/dcop/dcopidlng/kdocAstUtil.pm
@@ -152,10 +152,12 @@ ANITER:
if( !defined $ref ) {
# ancestor undefined
- warn "warning: ", $node->{astNodeName},
- " inherits unknown class '",
+ if( $in->{astNodeName} ne "DCOPObject"
+ && $in->{astNodeName} ne "TQObject" ) {
+ warn "warning: ", $node->{astNodeName},
+ " inherits unknown class '",
$in->{astNodeName},"'\n";
-
+ }
$parent->AddPropList( 'InBy', $node );
}
else {
diff --git a/dcop/dcopidlng/kdocParseDoc.pm b/dcop/dcopidlng/kdocParseDoc.pm
index e5f19d50c..fa34f5f30 100644
--- a/dcop/dcopidlng/kdocParseDoc.pm
+++ b/dcop/dcopidlng/kdocParseDoc.pm
@@ -60,15 +60,15 @@ PARSELOOP:
next if !defined $text;
$text =~ s#^\s*\*(?!\/)##;
+ if ( $text =~ m#\*/# ) {
+ $finished = 1;
+ $text = $`;
+ }
# if ( $text =~ /^\s*<\/pre>/i ) {
# flushProp();
# $inbounded = 0;
# }
if( $inbounded ) {
- if ( $text =~ m#\*/# ) {
- $finished = 1;
- $text = $`;
- }
$buffer .= $text;
next PARSELOOP;
}
@@ -162,10 +162,6 @@ PARSELOOP:
docProp( "LibDoc" );
}
else {
- if ( $text =~ m#\*/# ) {
- $finished = 1;
- $text = $`;
- }
$buffer .= $text;
}
}