[D] Renamed the "dnativeconst" feature to "dmanifestconst".

This should make it clearer that it controls manifest constant generation, not handling of C++ const member functions.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12300 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
David Nadlinger 2010-11-18 10:16:05 +00:00
commit d69d8ff641
6 changed files with 13 additions and 13 deletions

View file

@ -281,9 +281,9 @@ $importtype(AnotherInterface)
<dl> <dl>
<dt><tt>%dnativeconst</tt> and <tt>%dconstvalue(value)</tt></dt> <dt><tt>%dmanifestconst</tt> and <tt>%dconstvalue(value)</tt></dt>
<dd> <dd>
<p>Out of the box, SWIG generates accessor methods for C <tt>#defines</tt> and C++ constants. The <tt>%dnativeconst</tt> directive enables wrapping these constants as D manifest constants (<tt>const</tt> in D1, <tt>enum</tt> in D2).</p> <p>Out of the box, SWIG generates accessor methods for C <tt>#defines</tt> and C++ constants. The <tt>%dmanifestconst</tt> directive enables wrapping these constants as D manifest constants (<tt>const</tt> in D1, <tt>enum</tt> in D2).</p>
<p>For this to work, the C/C++ code for the constant value must directly compile as D code, though. If this is not the case, you can manually override the expression written to the D wrapper using the <tt>%dconstvalue</tt> directive, passing the new value as parameter.</p> <p>For this to work, the C/C++ code for the constant value must directly compile as D code, though. If this is not the case, you can manually override the expression written to the D wrapper using the <tt>%dconstvalue</tt> directive, passing the new value as parameter.</p>
<p>For <tt>enum</tt>s, again <tt>%dconstvalue</tt> can be used to override the value of an enum item if the initializer should not compile in D.</p> <p>For <tt>enum</tt>s, again <tt>%dconstvalue</tt> can be used to override the value of an enum item if the initializer should not compile in D.</p>
</dd> </dd>

View file

@ -4,7 +4,7 @@
/* Force the generated D code to use the C constant values rather than /* Force the generated D code to use the C constant values rather than
retrieving them at runtime. You can also try disabling the feature and retrieving them at runtime. You can also try disabling the feature and
compare the generated code. */ compare the generated code. */
%dnativeconst; %dmanifestconst;
/* A few preprocessor macros */ /* A few preprocessor macros */

View file

@ -34,7 +34,7 @@ const int NUMBER_UNIQUE(thing) = -2; /* resolves to thing28 */
#elif defined(SWIGCSHARP) #elif defined(SWIGCSHARP)
%csconst(1); %csconst(1);
#elif defined(SWIGD) #elif defined(SWIGD)
%dnativeconst; %dmanifestconst;
#else #else
%ignore LINE_NUMBER; %ignore LINE_NUMBER;
%ignore LINE_NUM; %ignore LINE_NUM;

View file

@ -12,8 +12,8 @@
%csconst(1) EN; %csconst(1) EN;
%csconst(1) CHARTEST; %csconst(1) CHARTEST;
#elif SWIGD #elif SWIGD
%dnativeconst EN; %dmanifestconst EN;
%dnativeconst CHARTEST; %dmanifestconst CHARTEST;
#endif #endif
%inline %{ %inline %{

View file

@ -4,7 +4,7 @@
* D-specifiv directives. * D-specifiv directives.
* ----------------------------------------------------------------------------- */ * ----------------------------------------------------------------------------- */
#define %dnativeconst %feature("d:nativeconst") #define %dmanifestconst %feature("d:manifestconst")
#define %dconstvalue(value) %feature("d:constvalue",value) #define %dconstvalue(value) %feature("d:constvalue",value)
#define %dmethodmodifiers %feature("d:methodmodifiers") #define %dmethodmodifiers %feature("d:methodmodifiers")
#define %dstripprefix %feature("d:stripprefix") #define %dstripprefix %feature("d:stripprefix")

View file

@ -864,7 +864,7 @@ public:
String *value = Getattr(n, "feature:d:constvalue"); String *value = Getattr(n, "feature:d:constvalue");
// Note that in D, enum values must be compile-time constants. Thus, // Note that in D, enum values must be compile-time constants. Thus,
// %dnativeconst(0) (getting the enum values at runtime) is not supported. // %dmanifestconst(0) (getting the enum values at runtime) is not supported.
value = value ? value : Getattr(n, "enumvalue"); value = value ? value : Getattr(n, "enumvalue");
if (value) { if (value) {
Printf(proxy_enum_code, " = %s", value); Printf(proxy_enum_code, " = %s", value);
@ -976,7 +976,7 @@ public:
* D::staticmembervariableHandler() * D::staticmembervariableHandler()
* --------------------------------------------------------------------------- */ * --------------------------------------------------------------------------- */
virtual int staticmembervariableHandler(Node *n) { virtual int staticmembervariableHandler(Node *n) {
if (GetFlag(n, "feature:d:nativeconst") != 1) { if (GetFlag(n, "feature:d:manifestconst") != 1) {
Delattr(n, "value"); Delattr(n, "value");
} }
@ -1298,7 +1298,7 @@ public:
* Used for wrapping constants declared by #define or %constant and also for * Used for wrapping constants declared by #define or %constant and also for
* (primitive) static member constants initialised inline. * (primitive) static member constants initialised inline.
* *
* If the %dnativeconst feature is used, the C/C++ constant value is used to * If the %dmanifestconst feature is used, the C/C++ constant value is used to
* initialize a D »const«. If not, a »getter« method is generated which * initialize a D »const«. If not, a »getter« method is generated which
* retrieves the value via a call to the C wrapper. However, if there is a * retrieves the value via a call to the C wrapper. However, if there is a
* %dconstvalue specified, it overrides all other settings. * %dconstvalue specified, it overrides all other settings.
@ -1308,9 +1308,9 @@ public:
if (!addSymbol(symname, n)) if (!addSymbol(symname, n))
return SWIG_ERROR; return SWIG_ERROR;
// The %dnativeconst feature determines if a D const or a getter function is // The %dmanifestconst feature determines if a D manifest constant
// created. // (const/enum) or a getter function is created.
if (GetFlag(n, "feature:d:nativeconst") != 1) { if (GetFlag(n, "feature:d:manifestconst") != 1) {
// Default constant handling will work with any type of C constant. It // Default constant handling will work with any type of C constant. It
// generates a getter function (which is the same as a read only property // generates a getter function (which is the same as a read only property
// in D) which retrieves the value via by calling the C wrapper. // in D) which retrieves the value via by calling the C wrapper.