Skip to content

Commit

Permalink
[sipify] Add support for specifying VirtualErrorHandlers to use for a…
Browse files Browse the repository at this point in the history
… function
  • Loading branch information
nyalldawson committed Jun 23, 2017
1 parent d63d560 commit 958ca10
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 3 additions & 2 deletions scripts/sipify.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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/;
Expand Down
5 changes: 5 additions & 0 deletions src/core/qgis_sip.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

0 comments on commit 958ca10

Please sign in to comment.