@@ -99,7 +99,7 @@ sub remove_constructor_or_body {
99
99
|| $line =~ m / SIP_SKIP\s *(?!;)\s *(\/\/ .*)?$ / ){
100
100
dbg_info(" remove constructor definition, function bodies, member initializing list" );
101
101
my $newline = " $1$2$3$4$5 ;" ;
102
- if ($line !~ m / {.*}(\s *SIP_\w +)? \s *(\/\/ .*)?$ / ){
102
+ if ($line !~ m / {.*}(\s *SIP_\w +)* \s *(\/\/ .*)?$ / ){
103
103
dbg_info(" go for multiline" );
104
104
$line = $lines [$line_idx ];
105
105
$line_idx ++;
@@ -554,6 +554,7 @@ sub remove_constructor_or_body {
554
554
# remove export macro from struct definition
555
555
$line =~ s / ^(\s *struct )\w +_EXPORT (.+)$/ $1$2 / ;
556
556
557
+ # printed annotations
557
558
$line =~ s /\b SIP_FACTORY\b / \/ Factory\/ / ;
558
559
$line =~ s /\b SIP_OUT\b / \/ Out\/ / g ;
559
560
$line =~ s /\b SIP_IN\b / \/ In\/ / g ;
@@ -565,11 +566,16 @@ sub remove_constructor_or_body {
565
566
$line =~ s /\b SIP_RELEASEGIL\b / \/ ReleaseGIL\/ / ;
566
567
$line =~ s /\b SIP_ARRAY\b / \/ Array\/ / ;
567
568
$line =~ s /\b SIP_ARRAYSIZE\b / \/ ArraySize\/ / ;
568
-
569
569
$line =~ s / SIP_PYNAME\(\s *(\w +)\s *\) / \/ PyName=$1 \/ / ;
570
+
571
+ # combine multiple annotations
572
+ dbg_info(" combine multiple annotations -- works only for 2" );
573
+ # https://regex101.com/r/uvCt4M/1
574
+ $line =~ s /\/ (\w +(=\w +)?)\/\s *\/ (\w +(=\w +)?)\/\s *;(\s *(\/\/ .*)?)$/ \/ $1 ,$3 \/ $5 ;/ ;
575
+
576
+ # unprinted annotations
570
577
$line =~ s / (\w +)(\< (?>[^<>]|(?2))*\> )?\s +SIP_PYARGTYPE\(\s *\' ?([^()']+)(\(\s *(?:[^()]++|(?2))*\s *\) )?\' ?\s *\) / $3 / g ;
571
578
$line =~ s / =\s +[^=]*?\s +SIP_PYARGDEFAULT\(\s *\' ?([^()']+)(\(\s *(?:[^()]++|(?2))*\s *\) )?\' ?\s *\) / = $1 / g ;
572
-
573
579
# remove argument
574
580
if ($line =~ m / SIP_PYARGREMOVE/ ){
575
581
if ( $MULTILINE_DEFINITION == 1 ){
@@ -588,7 +594,6 @@ sub remove_constructor_or_body {
588
594
# see https://regex101.com/r/5iNptO/4
589
595
$line =~ s / (?<coma>, +)?(const )?(\w +)(\< (?>[^<>]|(?4))*\> )? [\w &*]+ SIP_PYARGREMOVE( = [^()]*(\(\s *(?:[^()]++|(?6))*\s *\) )?)?(?(<coma>)|,?)// g ;
590
596
}
591
-
592
597
$line =~ s / SIP_FORCE// ;
593
598
594
599
# fix astyle placing space after % character
0 commit comments