From 56476d656af4a44203b7933ebbbf18f7a4307009 Mon Sep 17 00:00:00 2001 From: "gergely.erdelyi" Date: Sun, 29 Mar 2009 16:55:31 +0000 Subject: [PATCH] %feature("compactdefaultargs") is now global Added support for void * + len input/output buffers (many netnodes function use it) --- swig/bytes.i | 3 --- swig/expr.i | 2 -- swig/idaapi.i | 12 ++++++++++++ swig/search.i | 6 ------ swig/srarea.i | 2 -- swig/struct.i | 2 -- 6 files changed, 12 insertions(+), 15 deletions(-) diff --git a/swig/bytes.i b/swig/bytes.i index cdedb7a..26e086e 100644 --- a/swig/bytes.i +++ b/swig/bytes.i @@ -1,6 +1,3 @@ -// Make put_many_bytes and patch_many_bytes work -%apply (char *STRING, int LENGTH) { (const void *buf, size_t size) }; - // Make get_any_cmt() work %apply unsigned char *OUTPUT { color_t *cmttype }; diff --git a/swig/expr.i b/swig/expr.i index d11fbae..d5a1c9b 100644 --- a/swig/expr.i +++ b/swig/expr.i @@ -66,8 +66,6 @@ bool calc_idc_expr_wrap(ea_t where,const char *line, idc_value_t *rv, char *errb } %} -//%feature("compactdefaultargs") CompileLine; - %ignore CompileLine(const char *line, char *errbuf, size_t errbufsize, uval_t (idaapi*_getname)(const char *name)=NULL); %rename (CompileLine) CompileLine_wrap; diff --git a/swig/idaapi.i b/swig/idaapi.i index 02f7d1b..ce3e8a1 100644 --- a/swig/idaapi.i +++ b/swig/idaapi.i @@ -77,7 +77,16 @@ typedef long long longlong; // Convert all of these %cstring_output_maxstr_none(char *buf, size_t bufsize); +%binary_output_or_none(void *buf, size_t bufsize); +// Accept single Python string for const void * + size input arguments +// For example: put_many_bytes() and patch_many_bytes() +%apply (char *STRING, int LENGTH) { (const void *buf, size_t size) }; +%apply (char *STRING, int LENGTH) { (const void *buf, size_t len) }; +%apply (char *STRING, int LENGTH) { (const void *value, size_t length) }; +%apply (char *STRING, int LENGTH) { (const void *dataptr,size_t len) }; + +// Create wrapper classes for basic type arrays %array_class(uchar, uchar_array); %array_class(tid_t, tid_array); %array_class(ea_t, ea_array); @@ -88,6 +97,9 @@ typedef long long longlong; %pointer_class(sval_t, sval_pointer); %pointer_class(sel_t, sel_pointer); +// Do not create separate wrappers for default arguments +%feature("compactdefaultargs"); + %include "ida.i" %include "idd.i" %include "idp.i" diff --git a/swig/search.i b/swig/search.i index c428ad1..9e064e1 100644 --- a/swig/search.i +++ b/swig/search.i @@ -1,11 +1,5 @@ %apply int * OUTPUT { int *opnum }; -// Do not generate overloaded versions for default arguments -%feature("compactdefaultargs") find_error; -%feature("compactdefaultargs") find_notype; -%feature("compactdefaultargs") find_void; -%feature("compactdefaultargs") find_imm; - // FIXME: search() should be checked and enabled %ignore search; %ignore user2bin; diff --git a/swig/srarea.i b/swig/srarea.i index 1465553..4f62a8d 100644 --- a/swig/srarea.i +++ b/swig/srarea.i @@ -16,6 +16,4 @@ #define R_fs 33 #define R_gs 34 -%feature("compactdefaultargs") splitSRarea1; - %include "srarea.hpp" diff --git a/swig/struct.i b/swig/struct.i index 7b07ebf..8624119 100644 --- a/swig/struct.i +++ b/swig/struct.i @@ -5,8 +5,6 @@ %ignore sync_from_struc; -%feature("compactdefaultargs") add_struc; - %include "struct.hpp" // Add a get_member() member function to struc_t. // This helps to access the members array in the class.