From a24d2753ec83aef824b70ed2014f054cf7916ec3 Mon Sep 17 00:00:00 2001 From: "gergely.erdelyi" Date: Sat, 12 Apr 2008 08:45:01 +0000 Subject: [PATCH] expr.i: Fixed Compile* function to return proper error messages --- swig/expr.i | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/swig/expr.i b/swig/expr.i index ffcba0f..3e55780 100644 --- a/swig/expr.i +++ b/swig/expr.i @@ -24,8 +24,34 @@ %ignore find_builtin_idc_func; %ignore idc_lx; - %cstring_output_maxstr_none(char *errbuf, size_t errbufsize); + +/* Compile* functions return false when error so the return */ +/* value must be negated for the error string to be returned */ +%rename (CompileEx) CompileEx_wrap; +%inline %{ +bool CompileEx_wrap(const char *file, bool del_macros, + char *errbuf, size_t errbufsize) +{ + return !CompileEx(file, del_macros, errbuf, errbufsize); +} +%} + +%rename (Compile) Compile_wrap; +%inline %{ +bool Compile_wrap(const char *file, char *errbuf, size_t errbufsize) +{ + return !Compile(file, errbuf, errbufsize); +} +%} + +%rename (CompileLine) CompileLine_wrap; +%inline %{ +bool CompileLine_wrap(const char *line, char *errbuf, size_t errbufsize) +{ + return !CompileLine(line, errbuf, errbufsize); +} +%} + %include "expr.hpp" -