Skip to content
Permalink
Browse files

[sipify] Add support for specifying VirtualErrorHandlers to use for a…

… function
  • Loading branch information
nyalldawson committed Jun 23, 2017
1 parent d63d560 commit 958ca1075c98bad28e54a06ad5a119f975f0188c
Showing with 8 additions and 2 deletions.
  1. +3 −2 scripts/sipify.pl
  2. +5 −0 src/core/qgis_sip.h
@@ -223,6 +223,7 @@ sub fix_annotations {
$line =~ s/\bSIP_TRANSFERTHIS\b/\/TransferThis\//;

$line =~ s/SIP_PYNAME\(\s*(\w+)\s*\)/\/PyName=$1\//;
$line =~ s/SIP_VIRTUALERRORHANDLER\(\s*(\w+)\s*\)/\/VirtualErrorHandler=$1\//;

# combine multiple annotations
# https://regex101.com/r/uvCt4M/3
@@ -316,14 +317,14 @@ sub detect_comment_block{
}

# do not process SIP code %XXXCode
if ( $SIP_RUN == 1 && $LINE =~ m/^ *% *(MappedType|Type(?:Header)?Code|Module(?:Header)?Code|Convert(?:From|To)(?:Type|SubClass)Code|MethodCode)(.*)?$/ ){
if ( $SIP_RUN == 1 && $LINE =~ m/^ *% *(VirtualErrorHandler|MappedType|Type(?:Header)?Code|Module(?:Header)?Code|Convert(?:From|To)(?:Type|SubClass)Code|MethodCode)(.*)?$/ ){
$LINE = "%$1$2";
$COMMENT = '';
dbg_info("do not process SIP code");
while ( $LINE !~ m/^ *% *End/ ){
write_output("COD", $LINE."\n");
$LINE = read_line();
$LINE =~ s/^ *% *(MappedType|Type(?:Header)?Code|Module(?:Header)?Code|Convert(?:From|To)(?:Type|SubClass)Code|MethodCode)(.*)?$/%$1$2/;
$LINE =~ s/^ *% *(VirtualErrorHandler|MappedType|Type(?:Header)?Code|Module(?:Header)?Code|Convert(?:From|To)(?:Type|SubClass)Code|MethodCode)(.*)?$/%$1$2/;
$LINE =~ s/^\s*SIP_END(.*)$/%End$1/;
}
$LINE =~ s/^\s*% End/%End/;
@@ -152,6 +152,11 @@
*/
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)

/*
* Virtual error handler (/VirtualErrorHandler/)
*/
#define SIP_VIRTUALERRORHANDLER(name)

/*
* Will insert a `%End` directive in sip files
*/

0 comments on commit 958ca10

Please sign in to comment.
You can’t perform that action at this time.