mirror of https://github.com/swig/swig
Note the LENGTH STRING typemap changes and tidy up
This commit is contained in:
parent
cb68446ece
commit
7c478b5e17
|
@ -7,6 +7,9 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
|
|||
Version 4.4.0 (in progress)
|
||||
===========================
|
||||
|
||||
2025-07-28: erezgeva
|
||||
#2937 Add missing support for (size_t LENGTH, char *STRING) multi-argument typemaps.
|
||||
|
||||
2025-07-23: jim-easterbrook
|
||||
[Python] #3218 Added weakref support to builtin wrappers.
|
||||
|
||||
|
|
|
@ -940,7 +940,7 @@ The <tt>(char *STRING, int LENGTH)</tt> multi-argument typemap is also available
|
|||
</p>
|
||||
|
||||
<p>
|
||||
We also support passing parameters in reverse order
|
||||
SWIG also supports passing these parameters but in reverse order, for example:
|
||||
</p>
|
||||
|
||||
<div class="code">
|
||||
|
@ -953,7 +953,7 @@ size_t parity(size_t len, char *str, size_t initial);
|
|||
|
||||
<p>
|
||||
The usage from target language will be identical.
|
||||
In the wrapper function, the passed string will be expanded to a length parameter and pointer.
|
||||
In the wrapper function, the supplied string will be expanded to a length parameter and pointer.
|
||||
</p>
|
||||
|
||||
<H3><a name="Library_nn11">12.3.3 Using %newobject to release memory</a></H3>
|
||||
|
|
|
@ -1142,8 +1142,7 @@ SWIGEXPORT char *SWIGSTDCALL SWIG_csharp_string_str(SWIG_csharp_string *p) {
|
|||
%typemap(imtype) (const char *STRING, size_t LENGTH) "global::System.IntPtr"
|
||||
%typemap(csin) (const char *STRING, size_t LENGTH) "$modulePINVOKE.SWIGStringWithLengthHelper.SWIG_csharp_string_to_c($csinput)"
|
||||
%typemap(in, canthrow=1, fragment="SWIG_csharp_string") (const char *STRING, size_t LENGTH) {
|
||||
SWIG_csharp_string *p;
|
||||
p = (SWIG_csharp_string *)$input;
|
||||
SWIG_csharp_string *p = (SWIG_csharp_string *)$input;
|
||||
if (p) {
|
||||
$1 = ($1_ltype)p->str;
|
||||
$2 = ($2_ltype)p->size; /* We use number of bytes */
|
||||
|
@ -1153,8 +1152,7 @@ SWIGEXPORT char *SWIGSTDCALL SWIG_csharp_string_str(SWIG_csharp_string *p) {
|
|||
}
|
||||
}
|
||||
%typemap(freearg, fragment="SWIG_csharp_string") (const char *STRING, size_t LENGTH) {
|
||||
SWIG_csharp_string *p;
|
||||
p = (SWIG_csharp_string *)$input;
|
||||
SWIG_csharp_string *p = (SWIG_csharp_string *)$input;
|
||||
if (p) {
|
||||
free(p->str);
|
||||
free(p);
|
||||
|
@ -1184,8 +1182,7 @@ SWIGEXPORT char *SWIGSTDCALL SWIG_csharp_string_str(SWIG_csharp_string *p) {
|
|||
%typemap(imtype) (size_t LENGTH, const char *STRING) "global::System.IntPtr"
|
||||
%typemap(csin) (size_t LENGTH, const char *STRING) "$modulePINVOKE.SWIGStringWithLengthHelper.SWIG_csharp_string_to_c($csinput)"
|
||||
%typemap(in, canthrow=1, fragment="SWIG_csharp_string") (size_t LENGTH, const char *STRING) {
|
||||
SWIG_csharp_string *p;
|
||||
p = (SWIG_csharp_string *)$input;
|
||||
SWIG_csharp_string *p = (SWIG_csharp_string *)$input;
|
||||
if (p) {
|
||||
$2 = ($2_ltype)p->str;
|
||||
$1 = ($1_ltype)p->size; /* We use number of bytes */
|
||||
|
@ -1194,16 +1191,13 @@ SWIGEXPORT char *SWIGSTDCALL SWIG_csharp_string_str(SWIG_csharp_string *p) {
|
|||
$2 = 0;
|
||||
}
|
||||
}
|
||||
%typemap(freearg, fragment="SWIG_csharp_string") (size_t LENGTH, const char *STRING) %{
|
||||
{
|
||||
SWIG_csharp_string *p;
|
||||
p = (SWIG_csharp_string *)$input;
|
||||
%typemap(freearg, fragment="SWIG_csharp_string") (size_t LENGTH, const char *STRING) {
|
||||
SWIG_csharp_string *p = (SWIG_csharp_string *)$input;
|
||||
if (p) {
|
||||
free(p->str);
|
||||
free(p);
|
||||
}
|
||||
}
|
||||
%}
|
||||
%typemap(directorin) (size_t LENGTH, const char *STRING) %{
|
||||
if ($2 && $1 > 0) {
|
||||
$input = malloc(sizeof(SWIG_csharp_string));
|
||||
|
|
Loading…
Reference in New Issue