[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
parent 03aefbc6e9
commit d69d8ff641
6 changed files with 13 additions and 13 deletions

View File

@ -281,9 +281,9 @@ $importtype(AnotherInterface)
<dl>
<dt><tt>%dnativeconst</tt> and <tt>%dconstvalue(value)</tt></dt>
<dt><tt>%dmanifestconst</tt> and <tt>%dconstvalue(value)</tt></dt>
<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 <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>

View File

@ -4,7 +4,7 @@
/* 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
compare the generated code. */
%dnativeconst;
%dmanifestconst;
/* A few preprocessor macros */

View File

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

View File

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

View File

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

View File

@ -864,7 +864,7 @@ public:
String *value = Getattr(n, "feature:d:constvalue");
// 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");
if (value) {
Printf(proxy_enum_code, " = %s", value);
@ -976,7 +976,7 @@ public:
* D::staticmembervariableHandler()
* --------------------------------------------------------------------------- */
virtual int staticmembervariableHandler(Node *n) {
if (GetFlag(n, "feature:d:nativeconst") != 1) {
if (GetFlag(n, "feature:d:manifestconst") != 1) {
Delattr(n, "value");
}
@ -1298,7 +1298,7 @@ public:
* Used for wrapping constants declared by #define or %constant and also for
* (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
* retrieves the value via a call to the C wrapper. However, if there is a
* %dconstvalue specified, it overrides all other settings.
@ -1308,9 +1308,9 @@ public:
if (!addSymbol(symname, n))
return SWIG_ERROR;
// The %dnativeconst feature determines if a D const or a getter function is
// created.
if (GetFlag(n, "feature:d:nativeconst") != 1) {
// The %dmanifestconst feature determines if a D manifest constant
// (const/enum) or a getter function is created.
if (GetFlag(n, "feature:d:manifestconst") != 1) {
// 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
// in D) which retrieves the value via by calling the C wrapper.