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

This commit is contained in:
Nyall Dawson 2017-06-22 20:50:28 +10:00
parent d63d560eb3
commit 958ca1075c
2 changed files with 8 additions and 2 deletions

View File

@ -223,6 +223,7 @@ sub fix_annotations {
$line =~ s/\bSIP_TRANSFERTHIS\b/\/TransferThis\//; $line =~ s/\bSIP_TRANSFERTHIS\b/\/TransferThis\//;
$line =~ s/SIP_PYNAME\(\s*(\w+)\s*\)/\/PyName=$1\//; $line =~ s/SIP_PYNAME\(\s*(\w+)\s*\)/\/PyName=$1\//;
$line =~ s/SIP_VIRTUALERRORHANDLER\(\s*(\w+)\s*\)/\/VirtualErrorHandler=$1\//;
# combine multiple annotations # combine multiple annotations
# https://regex101.com/r/uvCt4M/3 # https://regex101.com/r/uvCt4M/3
@ -316,14 +317,14 @@ while ($LINE_IDX < $LINE_COUNT){
} }
# do not process SIP code %XXXCode # 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"; $LINE = "%$1$2";
$COMMENT = ''; $COMMENT = '';
dbg_info("do not process SIP code"); dbg_info("do not process SIP code");
while ( $LINE !~ m/^ *% *End/ ){ while ( $LINE !~ m/^ *% *End/ ){
write_output("COD", $LINE."\n"); write_output("COD", $LINE."\n");
$LINE = read_line(); $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*SIP_END(.*)$/%End$1/;
} }
$LINE =~ s/^\s*% End/%End/; $LINE =~ s/^\s*% End/%End/;

View File

@ -152,6 +152,11 @@
*/ */
#define SIP_CONVERT_TO_SUBCLASS_CODE(code) #define SIP_CONVERT_TO_SUBCLASS_CODE(code)
/*
* Virtual error handler (/VirtualErrorHandler/)
*/
#define SIP_VIRTUALERRORHANDLER(name)
/* /*
* Will insert a `%End` directive in sip files * Will insert a `%End` directive in sip files
*/ */