diff --git a/Doc/Manual/Contents.html b/Doc/Manual/Contents.html index c534e37cf..fb04ae01c 100644 --- a/Doc/Manual/Contents.html +++ b/Doc/Manual/Contents.html @@ -161,7 +161,7 @@
  • Array members
  • Structure data members
  • C constructors and destructors -
  • Adding member functions to C structures +
  • Adding member functions to C structures
  • Nested structures
  • Other things to note about structure wrapping @@ -278,10 +278,11 @@
  • Using %newobject to release memory
  • cstring.i -
  • C++ Library +
  • STL/C++ Library
  • Utility Libraries
  • Living with Java Directors
  • Odds and ends @@ -1028,71 +1030,18 @@
  • Preliminaries -
  • Building Ruby Extensions under Windows 95/NT - -
  • The Ruby-to-C/C++ Mapping - -
  • Input and output parameters -
  • Simple exception handling
  • Typemaps -
  • Operator overloading - -
  • Advanced Topics - @@ -1162,7 +1111,46 @@ -

    29 Extending SWIG

    +

    29 SWIG and Lua

    + + +
    + +
    + + +

    30 Extending SWIG

    diff --git a/Doc/Manual/Extending.html b/Doc/Manual/Extending.html index 069621b96..e7a7bc21d 100644 --- a/Doc/Manual/Extending.html +++ b/Doc/Manual/Extending.html @@ -6,7 +6,7 @@ -

    29 Extending SWIG

    +

    30 Extending SWIG

      @@ -75,7 +75,7 @@ Caution: This chapter is being rewritten! (11/25/01)

      -

      29.1 Introduction

      +

      30.1 Introduction

      @@ -91,7 +91,7 @@ Also, this chapter is not meant to be a hand-holding tutorial. As a starting po you should probably look at one of SWIG's existing modules.

      -

      29.2 Prerequisites

      +

      30.2 Prerequisites

      @@ -121,7 +121,7 @@ obvious, but almost all SWIG directives as well as the low-level generation of wrapper code are driven by C++ datatypes.

      -

      29.3 The Big Picture

      +

      30.3 The Big Picture

      @@ -158,7 +158,7 @@ role in making the system work. For example, both typemaps and declaration anno based on pattern matching and interact heavily with the underlying type system.

      -

      29.4 Execution Model

      +

      30.4 Execution Model

      @@ -203,7 +203,7 @@ stage of compilation. The next few sections briefly describe some of these stages.

      -

      29.4.1 Preprocessing

      +

      30.4.1 Preprocessing

      @@ -283,7 +283,7 @@ been expanded as well as everything else that goes into the low-level construction of the wrapper code.

      -

      29.4.2 Parsing

      +

      30.4.2 Parsing

      @@ -384,7 +384,7 @@ returning a foo and taking types a and b as arguments).

      -

      29.4.3 Parse Trees

      +

      30.4.3 Parse Trees

      @@ -636,7 +636,7 @@ $ swig -c++ -python -dump_tree example.i

    -

    29.4.4 Attribute namespaces

    +

    30.4.4 Attribute namespaces

    @@ -655,7 +655,7 @@ that matches the name of the target language. For example, python:foo perl:foo.

    -

    29.4.5 Symbol Tables

    +

    30.4.5 Symbol Tables

    @@ -743,7 +743,7 @@ example.i:5. Previous declaration is foo_i(int )

    -

    29.4.6 The %feature directive

    +

    30.4.6 The %feature directive

    @@ -799,7 +799,7 @@ For example, the exception code above is simply stored without any modifications.

    -

    29.4.7 Code Generation

    +

    30.4.7 Code Generation

    @@ -921,7 +921,7 @@ public : The role of these functions is described shortly.

    -

    29.4.8 SWIG and XML

    +

    30.4.8 SWIG and XML

    @@ -934,7 +934,7 @@ internal data structures, it may be useful keep XML in the back of your mind as a model.

    -

    29.5 Primitive Data Structures

    +

    30.5 Primitive Data Structures

    @@ -980,7 +980,7 @@ typedef Hash Typetab; -

    29.5.1 Strings

    +

    30.5.1 Strings

    @@ -1121,7 +1121,7 @@ Returns the number of replacements made (if any). -

    29.5.2 Hashes

    +

    30.5.2 Hashes

    @@ -1198,7 +1198,7 @@ Returns the list of hash table keys. -

    29.5.3 Lists

    +

    30.5.3 Lists

    @@ -1287,7 +1287,7 @@ If t is not a standard object, it is assumed to be a char * and is used to create a String object. -

    29.5.4 Common operations

    +

    30.5.4 Common operations

    The following operations are applicable to all datatypes. @@ -1342,7 +1342,7 @@ objects and report errors. Gets the line number associated with x. -

    29.5.5 Iterating over Lists and Hashes

    +

    30.5.5 Iterating over Lists and Hashes

    To iterate over the elements of a list or a hash table, the following functions are used: @@ -1387,7 +1387,7 @@ for (j = First(j); j.item; j= Next(j)) { -

    29.5.6 I/O

    +

    30.5.6 I/O

    Special I/O functions are used for all internal I/O. These operations @@ -1523,7 +1523,7 @@ Similarly, the preprocessor and parser all operate on string-files. -

    29.6 Navigating and manipulating parse trees

    +

    30.6 Navigating and manipulating parse trees

    Parse trees are built as collections of hash tables. Each node is a hash table in which @@ -1657,7 +1657,7 @@ Deletes a node from the parse tree. Deletion reconnects siblings and properly u the parent so that sibling nodes are unaffected. -

    29.7 Working with attributes

    +

    30.7 Working with attributes

    @@ -1774,7 +1774,7 @@ the attribute is optional. Swig_restore() must always be called after function. -

    29.8 Type system

    +

    30.8 Type system

    @@ -1783,7 +1783,7 @@ pointers, references, and pointers to members. A detailed discussion of type theory is impossible here. However, let's cover the highlights.

    -

    29.8.1 String encoding of types

    +

    30.8.1 String encoding of types

    @@ -1884,7 +1884,7 @@ make the final type, the two parts are just joined together using string concatenation.

    -

    29.8.2 Type construction

    +

    30.8.2 Type construction

    @@ -1953,7 +1953,7 @@ Returns nth array dimension of ty.

    -Sets nth array dimensions of ty to rep. +Sets nth array dimensions of ty to rep.

    @@ -2053,7 +2053,7 @@ Returns the prefix of a type. For example, if ty is ty is unmodified. -

    29.8.3 Type tests

    +

    30.8.3 Type tests

    @@ -2140,7 +2140,7 @@ Checks if ty is a varargs type. Checks if ty is a templatized type. -

    29.8.4 Typedef and inheritance

    +

    30.8.4 Typedef and inheritance

    @@ -2242,7 +2242,7 @@ Fully reduces ty according to typedef rules. Resulting datatype will consist only of primitive typenames. -

    29.8.5 Lvalues

    +

    30.8.5 Lvalues

    @@ -2279,7 +2279,7 @@ Literal y; // type = 'Literal', ltype='p.char' -

    29.8.6 Output functions

    +

    30.8.6 Output functions

    @@ -2341,7 +2341,7 @@ SWIG, but is most commonly associated with type-descriptor objects that appear in wrappers (e.g., SWIGTYPE_p_double). -

    29.9 Parameters

    +

    30.9 Parameters

    @@ -2440,7 +2440,7 @@ included. Used to emit prototypes. Returns the number of required (non-optional) arguments in p. -

    29.10 Writing a Language Module

    +

    30.10 Writing a Language Module

    @@ -2451,7 +2451,7 @@ describes the creation of a minimal Python module. You should be able to extra this to other languages.

    -

    29.10.1 Execution model

    +

    30.10.1 Execution model

    @@ -2461,7 +2461,7 @@ the parsing of command line options, all aspects of code generation are controll different methods of the Language that must be defined by your module.

    -

    29.10.2 Starting out

    +

    30.10.2 Starting out

    @@ -2574,7 +2574,7 @@ that activates your module. For example, swig -python foo.i. The messages from your new module should appear.

    -

    29.10.3 Command line options

    +

    30.10.3 Command line options

    @@ -2633,7 +2633,7 @@ to mark the option as valid. If you forget to do this, SWIG will terminate wit unrecognized command line option error.

    -

    29.10.4 Configuration and preprocessing

    +

    30.10.4 Configuration and preprocessing

    @@ -2682,7 +2682,7 @@ an implementation file python.cxx and a configuration file python.swg.

    -

    29.10.5 Entry point to code generation

    +

    30.10.5 Entry point to code generation

    @@ -2740,13 +2740,13 @@ int Python::top(Node *n) { -

    29.10.6 Module I/O and wrapper skeleton

    +

    30.10.6 Module I/O and wrapper skeleton

    -

    29.10.7 Low-level code generators

    +

    30.10.7 Low-level code generators

    -

    29.10.8 Configuration files

    +

    30.10.8 Configuration files

    @@ -2901,7 +2901,7 @@ to handle some of these configuration tasks, but that point is now long past. If you are interested in working on that, feel free to raise the issue in the context of a next-generation clean-slate SWIG. -

    29.10.9 Runtime support

    +

    30.10.9 Runtime support

    @@ -2910,7 +2910,7 @@ Discuss the kinds of functions typically needed for SWIG runtime support (e.g. the SWIG files that implement those functions.

    -

    29.10.10 Standard library files

    +

    30.10.10 Standard library files

    @@ -2924,7 +2924,7 @@ Discuss the standard library files that most language modules provide, e.g.

  • stl.i
  • -

    29.10.11 Examples and test cases

    +

    30.10.11 Examples and test cases

    @@ -2951,7 +2951,7 @@ during this process, see the section on configuration files.

    -

    29.10.12 Documentation

    +

    30.10.12 Documentation

    @@ -2983,13 +2983,13 @@ Some topics that you'll want to be sure to address include: if available. -

    29.11 Typemaps

    +

    30.11 Typemaps

    -

    29.11.1 Proxy classes

    +

    30.11.1 Proxy classes

    -

    29.12 Guide to parse tree nodes

    +

    30.12 Guide to parse tree nodes

    diff --git a/Doc/Manual/Java.html b/Doc/Manual/Java.html index 0bcc7f68f..f06cbc609 100644 --- a/Doc/Manual/Java.html +++ b/Doc/Manual/Java.html @@ -6004,7 +6004,9 @@ This example contains some useful functionality which you may want in your code.

  • It also has a function which effectively implements a cast from the type of the proxy/type wrapper class to a void pointer. This is necessary for passing a proxy class or a type wrapper class to a function that takes a void pointer. -

    Struct pointer to pointer

    +

    19.9.10 Struct pointer to pointer

    + +

    Pointers to pointers are often used as output parameters in C factory type functions. These are a bit more tricky to handle. @@ -6103,7 +6105,7 @@ The following interface file code should be placed before SWIG parses the above // Typemaps for Butler ** as a parameter output type %typemap(in) Butler ** (Butler *ppButler = 0) %{ - $1 = &ppButler; + $1 = &ppButler; %} %typemap(argout) Butler ** { // Give Java proxy the C pointer (of newly created object) diff --git a/Doc/Manual/Library.html b/Doc/Manual/Library.html index 9742c160e..60caa600f 100644 --- a/Doc/Manual/Library.html +++ b/Doc/Manual/Library.html @@ -29,6 +29,7 @@

  • Utility Libraries -
  • details on the Lua class interface +
  • Details on the Lua binding

    + +

    Note: in Lua, only the equals, less than, and less than equals operators are defined. The other operators (!=,>,>=) are achieved by using a logical not applied to the results of other operators. +

    The following operators cannot be overloaded (mainly because they are not supported in Lua)

    • ++ and --
    • +=,-=,*= etc
    • % operator (you have to use math.mod)
    • assignment operator
    • all bitwise/logical operations
    -

    SWIG also accepts the __str__() member function which converts an object to a string. This function should return a const char*, preferably to static memory. This will be used for the print() and tostring() functions in Lua. Assuming the complex class has a function

    +SWIG also accepts the __str__() member function which converts an object to a string. This function should return a const char*, preferably to static memory. This will be used for the print() and tostring() functions in Lua. Assuming the complex class has a function +

    const char* __str__()
     {
             static char buffer[255];
    @@ -688,7 +726,9 @@ The following operators cannot be overloaded (mainly because they are not suppor
     }
     

    -Then this will support the following code in Lua

    +Then this will support the following code in Lua
    +

    +
     > c = Complex(3,4)
     > d = Complex(7,8)
     > e = c + d
    @@ -700,6 +740,7 @@ Complex(10,12)
     

    It is also possible to overload the operator[], but currently this cannot be automatically performed. To overload the operator[] you need to provide two functions, __getitem__() and __setitem__() +

    class Complex
     {
             //....
    @@ -707,15 +748,16 @@ It is also possible to overload the operator[], but currently this cann
             void __setitem__(int i,double d); // i is the index, d is the data
     };
     
    -

    +

    29.3.12 Class extension with %extend

    One of the more interesting features of SWIG is that it can extend structures and classes with new methods. In the previous section, the Complex class would have benefited greatly from an __str__() method as well as some repairs to the operator overloading. It can also be used to add additional functions to the class if they are needed. +

    Take the original Complex class -

    +

    class Complex {
     private:
       double rpart, ipart;
    @@ -733,7 +775,9 @@ public:
     };
     

    -Now we extend it with some new code

    %extend Complex {
    +Now we extend it with some new code
    +

    +
    %extend Complex {
        const char *__str__() {
            static char tmp[1024];
            sprintf(tmp,"Complex(%g,%g)", self->re(),self->im());
    @@ -745,7 +789,7 @@ Now we extend it with some new code 
    %extend Complex {
     

    Now, in Lua -

    +

     > c = Complex(3,4)
     > d = Complex(7,8)
    @@ -759,13 +803,13 @@ true
     

    Extend works with both C and C++ code, on classes and structs. It does not modify the underlying object in any way---the extensions only show up in the Lua interface. The only item to take note of is the code has to use the 'self' instead of 'this', and that you cannot access protected/private members of the code (as you are not officially part of the class). -

    +

    29.3.13 C++ templates

    C++ templates don't present a huge problem for SWIG. However, in order to create wrappers, you have to tell SWIG to create wrappers for a particular template instantiation. To do this, you use the template directive. For example: -

    +

    %module example
     %{
     #include "pair.h"
    @@ -786,7 +830,7 @@ struct pair {
     

    In Lua: -

    +

     > p = example.pairii(3,4)
     > print(p.first,p.second)
    @@ -794,13 +838,13 @@ In Lua:
     

    Obviously, there is more to template wrapping than shown in this example. More details can be found in the SWIG and C++ chapter. Some more complicated examples will appear later. -

    +

    29.3.14 C++ Smart Pointers

    In certain C++ programs, it is common to use classes that have been wrapped by so-called "smart pointers." Generally, this involves the use of a template class that implements operator->() like this: -

    +

    template<class T> class SmartPtr {
        ...
        T *operator->();
    @@ -809,7 +853,7 @@ Obviously, there is more to template wrapping than shown in this example. More d
     

    Then, if you have a class like this, -

    +

    class Foo {
     public:
          int x;
    @@ -818,7 +862,7 @@ public:
     

    A smart pointer would be used in C++ as follows: -

    +

    SmartPtr<Foo> p = CreateFoo();   // Created somehow (not shown)
     ...
     p->x = 3;                        // Foo::x
    @@ -826,7 +870,7 @@ int y = p->bar();                // Foo::bar
     

    To wrap this, simply tell SWIG about the SmartPtr class and the low-level Foo object. Make sure you instantiate SmartPtr using template if necessary. For example: -

    +

    %module example
     ...
     %template(SmartPtrFoo) SmartPtr<Foo>;
    @@ -834,7 +878,7 @@ To wrap this, simply tell SWIG about the SmartPtr class and the low-level Foo ob
     

    Now, in Lua, everything should just "work": -

    +

     > p = example.CreateFoo()          -- Create a smart-pointer somehow
     > p.x = 3                          -- Foo::x
    @@ -842,36 +886,39 @@ Now, in Lua, everything should just "work":
     

    If you ever need to access the underlying pointer returned by operator->() itself, simply use the __deref__() method. For example: -

    +

     > f = p:__deref__()     -- Returns underlying Foo *
     
    -

    +

    29.4 Details on the Lua binding

    In the previous section, a high-level view of Lua wrapping was presented. Obviously a lot of stuff happens behind the scenes to make this happen. This section will explain some of the low-level details on how this is achieved. +

    If you just want to use SWIG and don't care how it works, then stop reading here. This is going into the guts of the code and how it works. Its mainly for people who need to know whats going on within the code. -

    +

    +

    29.4.1 Binding global data into the module.

    Assuming that you had some global data that you wanted to share between C and Lua. How does SWIG do it? -

    +

    %module example;
     extern double Foo;
     

    SWIG will effectively generate the pair of functions

    void Foo_set(double);
     double Foo_get();
    +

    At initialisation time, it will then add to the interpreter a table called 'example', which represents the module. It will then add all its functions to the module. But it also adds a metatable to this table, which has two functions (__index and __newindex) as well as two tables (.get and .set) The following Lua code will show these hidden features. -

    +

     > print(example)
     table: 003F8F90
    @@ -888,8 +935,10 @@ Foo     function: 003FAFD8
     

    The .get and .set tables are lookups connecting the variable name 'Foo' to the accessor/mutator functions (Foo_set,Foo_get) +

    The Lua equivalent of the code for the __index and __newindex looks a bit like this +

     function __index(mod,name)
             local g=getmetatable(mod)['.get'] -- gets the table
    @@ -910,16 +959,20 @@ end
     

    That way when you call 'a=example.Foo', the interpreter looks at the table 'example' sees that there is no field 'Foo' and calls __index. This will in turn check in '.get' table and find the existence of 'Foo' and then return the value of the C function call 'Foo_get()'. Similarly for the code 'example.Foo=10', the interpreter will check the table, then call the __newindex which will then check the '.set' table and call the C function 'Foo_set(10)'. -

    +

    29.4.2 Userdata and Metatables

    As mentioned earlier, classes and structures, are all held as pointer, using the Lua 'userdata' structure. This structure is actually a pointer to a C structure 'swig_lua_userdata', which contains the pointer to the data, a pointer to the swig_type_info (an internal SWIG struct) and a flag which marks if the object is to be disposed of when the interpreter no longer needs it. The actual accessing of the object is done via the metatable attached to this userdata. +

    The metatable is a Lua 5.0 feature (which is also why SWIG cannot wrap Lua 4.0). Its a table which holds a list of functions, operators and attributes. This is what gives the userdata the feeling that it is a real object and not just a hunk of memory. +

    -Given a class

    %module excpp;
    +Given a class
    +

    +
    %module excpp;
     
     class Point
     {
    @@ -932,9 +985,10 @@ public:
     

    SWIG will create a module excpp, with all the various function inside. However to allow the intuitive use of the userdata is also creates up a set of metatables. As seen in the above section on global variables, use of the metatables allows for wrappers to be used intuitively. To save effort, the code creates one metatable per class and stores it inside Lua's registry. Then when an new object is instantiated, the metatable is found in the registry and the userdata associated to the metatable. Currently derived classes make a complete copy of the base classes table and then add on their own additional function. +

    Some of the internals can be seen by looking at a classes metatable. -

    +

     > p=excpp.Point()
     > print(p)
    @@ -951,8 +1005,11 @@ __index function: 003FB698
     

    The '.type' attribute is the string which is returned from a call to swig_type(). The '.get' and '.set' tables work in a similar manner to the modules, the main difference is the '.fn' table which also holds all the member functions. (The '__gc' function is the classes destructor function) +

    -The Lua equivalent of the code for enabling functions looks a little like this

    +The Lua equivalent of the code for enabling functions looks a little like this
    +

    +
     function __index(obj,name)
             local m=getmetatable(obj) -- gets the metatable
             if not m then return nil end
    @@ -973,22 +1030,27 @@ end
     

    So when 'p:Print()' is called, the __index looks on the object metatable for a 'Print' attribute, then looks for a 'Print' function. When it finds the function, it returns the function, and then interpreter can call 'Point_Print(p)' +

    In theory, you can play with this usertable & add new features, but remember that it is a shared table between all instances of one class, and you could very easily corrupt the functions in all the instances. +

    Note: Both the opaque structures (like the FILE*) and normal wrappered classes/structs use the same 'swig_lua_userdata' structure. Though the opaque structures has do not have a metatable attached, or any information on how to dispose of them when the interpreter has finished with them. +

    Note: Operator overloads are basically done in the same way, by adding functions such as '__add' & '__call' to the classes metatable. The current implementation is a bit rough as it will add any member function beginning with '__' into the metatable too, assuming its an operator overload. -

    +

    29.4.3 Memory management

    Lua is very helpful with the memory management. The 'swig_lua_userdata' is fully managed by the interpreter itself. This means that neither the C code nor the Lua code can damage it. Once a piece of userdata has no references to it, it is not instantly collected, but will be collected when Lua deems is necessary. (You can force collection by calling the Lua function collectgarbage()). Once the userdata is about to be free'ed, the interpreter will check the userdata for a metatable and for a function '__gc'. If this exists this is called. For all complete types (ie normal wrappered classes & structs) this should exist. The '__gc' function will check the 'swig_lua_userdata' to check for the 'own' field and if this is true (which is will be for all owned data's) it will then call the destructor on the pointer. +

    It is currently not recommended to edit this field or add some user code, to change the behaviour. Though for those who wish to try, here is where to look. +

    -Is is also currently not possible to change the ownership flag on the data (unlike most other scripting languages, Lua does not permit access to the data from within the interpreter) -

    +It is also currently not possible to change the ownership flag on the data (unlike most other scripting languages, Lua does not permit access to the data from within the interpreter) +

    diff --git a/Doc/Manual/Ruby.html b/Doc/Manual/Ruby.html index 7a29a291d..ac70999b5 100644 --- a/Doc/Manual/Ruby.html +++ b/Doc/Manual/Ruby.html @@ -14,342 +14,35 @@ -

    27 SWIG and Ruby

    - - +

    27 SWIG and Ruby

    - -
    - - + + +

    This chapter describes SWIG's support of Ruby.

    -

    27.1 Preliminaries

    +

    27.1 Preliminaries

    @@ -373,7 +66,7 @@ has a basic understanding of Ruby.

    -

    27.1.1 Running SWIG

    +

    27.1.1 Running SWIG

    @@ -438,9 +131,10 @@ can run Ruby to find out. For example:

    -
    $ ruby -e 'puts $:.join("\n")'
    /usr/local/lib/ruby/site_ruby/1.6 /usr/local/lib/ruby/site_ruby/1.6/i686-linux /usr/local/lib/ruby/site_ruby /usr/local/lib/ruby/1.6 /usr/local/lib/ruby/1.6/i686-linux .
    - - +
    +$ ruby -e 'puts $:.join("\n")'
    /usr/local/lib/ruby/site_ruby/1.6 /usr/local/lib/ruby/site_ruby/1.6/i686-linux +/usr/local/lib/ruby/site_ruby /usr/local/lib/ruby/1.6 /usr/local/lib/ruby/1.6/i686-linux . +
    @@ -848,7 +542,7 @@ in your SWIG interface files to Ruby constructs.

    -

    27.3.1 Modules

    +

    27.1.2 Modules

    @@ -973,7 +667,7 @@ with any of Ruby's built-in names.

    -

    27.3.2 Functions

    +

    27.1.3 Functions

    @@ -1089,7 +783,7 @@ disabled using %mutable.

    -

    27.3.4 Constants

    +

    27.1.4 Constants

    @@ -1120,7 +814,7 @@ values, e.g.

    -

    27.3.5 Pointers

    +

    27.1.5 Pointers

    @@ -1160,7 +854,7 @@ object.

    -

    27.3.6 Structures

    +

    27.1.6 Structures

    @@ -1295,7 +989,7 @@ generates accessor functions such as this:

    -

    27.3.7 C++ classes

    +

    27.1.7 C++ classes

    @@ -2261,7 +1955,7 @@ Ruby.

    -

    27.6 Typemaps

    +

    27.2 Typemaps

    @@ -2717,7 +2411,7 @@ for VALUE

    pointer to array storage
    -

    27.6.4.4 Exceptions

    +

    27.2.0.1 Exceptions

    @@ -2838,7 +2532,7 @@ interpreted as with printf().

    -

    27.6.4.5 Iterators

    +

    27.2.0.2 Iterators

    diff --git a/Doc/Manual/SWIGPlus.html b/Doc/Manual/SWIGPlus.html index 3dd136473..fd00b1983 100644 --- a/Doc/Manual/SWIGPlus.html +++ b/Doc/Manual/SWIGPlus.html @@ -777,7 +777,7 @@ SWIG is unable to support kwargs when wrapping overloaded methods, so the defaul

    SWIG wraps class members that are public following the C++ conventions, i.e., by explicit public declaration or by the use of - the directive. In general, anything specified in a + the using directive. In general, anything specified in a private or protected section will be ignored, although the internal code generator sometimes looks at the contents of the private and protected sections so that it can properly generate code for default