diff --git a/CHANGES.current b/CHANGES.current index 68f7daa54..35b0f7ee2 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -7,6 +7,25 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/ Version 4.1.0 (in progress) =========================== +2022-06-04: sethrj + Enhance $typemap to support typemap attributes. + + $typemap(method:attribute, typepattern) + + For example: + + %typemap(cstype, out="object") XClass "XClass" + %typemap(cscode) BarClass %{ + $typemap(cstype:out, XClass) bar() { + return null; + } + + which expands to + + object bar() { + return null; + } + 2022-05-30: wsfulton [C#, D] Add new special variable expansion: $imfuncname. Expands to the function name called in the intermediary class. diff --git a/Doc/Manual/Contents.html b/Doc/Manual/Contents.html index dfa9f6101..6f48360fd 100644 --- a/Doc/Manual/Contents.html +++ b/Doc/Manual/Contents.html @@ -524,6 +524,7 @@
  • Special variables and typemap attributes
  • Special variables combined with special variable macros diff --git a/Doc/Manual/Typemaps.html b/Doc/Manual/Typemaps.html index 614c446e7..28f9d51ad 100644 --- a/Doc/Manual/Typemaps.html +++ b/Doc/Manual/Typemaps.html @@ -48,6 +48,7 @@
  • Special variables and typemap attributes
  • Special variables combined with special variable macros @@ -2457,13 +2458,40 @@ The result is the following expansion +

    14.4.4.3 $typemap(method:attribute, typepattern)

    + +

    -The first argument, the typemap method, can look up the attribute of a -typemap by appending a colon and the keyword. For example, -$typemap(directorin:descriptor, $type) would be replaced by "D" if type is a double. +An enhanced version of $typemap provides access to typemap attributes by +appending a colon and the attribute name after the method name. In the example below, +"cstype" is the typemap method and "out" is the typemap attribute.

    + +
    +
    +%typemap(cstype, out="object") XClass "XClass"
    +%typemap(cscode) BarClass %{
    +  $typemap(cstype:out, XClass) bar()
    +  {
    +    return null;
    +  }
    +
    +

    -New in SWIG 4.1. +which expands to +

    +
    +
    +  object bar()
    +  {
    +    return null;
    +  }
    +
    +
    + +

    +Compatibility note: Support for typemap attributes in $typemap +was introduced in SWIG-4.1.0.

    14.4.5 Special variables and typemap attributes