<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="Todo.xsl" ?>


<topics>

<topic>
<title>To Add/Fix</title>
<items>


<item status="later">
<issue>
The nested class definitions that give rise to an intermediate
    typedef generated by SWIG itself lead to warnings from the
    compiler about incorrect types.
</issue>
<comment>
  This is because we are referring to the locally defined
    element of the structure with a now equivalent, but differently
    "named", globally defined structure, e.g. A_b rather than the
    inlined definition.
</comment>
</item>

<item status="done">
<issue>
   generateCopyRoutines() failing in case of nested struct definitions.
</issue>
<comment>
     See unnamed.i

    <br/>

      How we can get the SwigType definition for the nested "class"
      so that it can be processed properly?
      It is defined in the scope of the outer structure being defined.
    <br/>
    <br/>
     We have removed the calls to Swig_typemap_attach_parms() in this
     call and things seem to work okay.
     Although, we don't have controls to copy or get a reference to the individual elements.
    <br/>
</comment>
</item>



<item>  
    <issue>Probably need to change the order of the definition of the
    classes
    when one is nested inside the other.</issue>
  <comment> See unnamed.i.   A is defined and references A_b.  Want the
    order of the  definitions reversed.
    <br/>
      Should we process the children first?
  </comment>
</item>



<item status="done">
    <issue>getRClassName() is not working to map int to integer, double
    to numeric.  </issue>
  <comment> See unnamed.h and classDeclaration.
    <br/>
      Do we need to attach the typemaps to the nodes in the struct
    definition?
      Or can we do it in getRClassName() directly.

    <br/>
       Should be calling getRType().
       That works fine for struct.i
    <br/>
        Merged the two schemes to handle the regular and the nested case.
  </comment>
</item>



<item status="later">
  <issue>Check conversion of enums. </issue>
  <comment>Take the basic/core code from the RDCOMClient package.
    <br/>
     All the structure is in place. Just need to connect the dots
  between the RDCOMClient code and the code in the runtime support for
  SWIG.
     No need to change SWIG itself.
</comment>
</item>
  
<item>
  <issue>routines.h is now causing intRef and voidRef to be defined as classes.</issue>
  <comment> These appear to be the return types of the differen function pointers.
</comment>
</item>

<item>  
  <issue>Separate the set and get accessor functions so that the general
      accessor $ and $&amp;- can work on the correct versions. </issue>
  <comment> Done.
    <br/>
      Still need to separate accessors to fields and those of methods
      so can have a proper [[ operator.
    <br/>
      This is the writing of the accessorFuns.
      See OutputMemberReferenceMethod. 
</comment>
</item>

<item>
     <issue>Why are we defining setMethod()s for all accessors. </issue>
  <comment> All to do with if overname is defined. Need to "refine" this.
 </comment>
</item>

<item  status="later">
  <issue> We should use sym:name for the routines to support %rename directives.</issue>
  <comment>
  </comment>
</item>

<item>
  <issue> Why is typedefHandler not invoked when typedef a union inline,
      i.e.
        typedef union {
           ...
        } U;?
</issue>
  <comment> It needs the name, i.e.  union _U { .... } before it will call
      typedefHandler.
      <br/>
      Is there a way we can easily identify these.

<br/>
    classDeclaration may have all the information to indicate that
    we should call typedefHandler() ourselves.
    unnamed is set, storage is typedef and tdname is set to U.
      
  </comment>      
</item>
  
<item>
  <issue> Need to consolidate all the places we get the name of a new
       class and where we strip the "struct " away. There are currently
       7 instances of the word "struct" in the code.
  </issue>
  <comment>
      getRTypeName and getRClassName should be somewhat more related.
      defineArrayAccessors should use one of these.

  </comment>
</item>

</items>

</topic>




<topic>
<title>Unions</title>

<items>
<item>  
  <issue> Unions.</issue>
  <comment> Mostly same as structs and the code works as is. Test!

      Can't really do the copy thing to and from R since
      we don't know which field is active.
      Need a hint.
  </comment>    
</item>

<item>
  
  <issue>If we inline the definition for the union in union.h (via the
  define), we don't get a class definition in R for the structure A.
     </issue>
  <comment>
  </comment>
</item>

<item>
  
  <issue> Empty class name for union slot.</issue>
  <comment> union.i when we turn off the inlining.
  <br/>
       Fixed now, but with added code in that location (~ 1680).
       Uses getRClassName.
      <br/>
        But the result is a class that is never defined - U.
        Should we return URef and define that or should we
        define a class in R for representing a union U.
   </comment>
</item>

<item>
  
  <issue> Crash of SWIG in union.i when we inline the union definition within the struct.</issue>
  <comment>

       This happens in classDeclaration().  The value of c in the for
       loop which is an insert nodeType gives rise to an elType of
       NULL.  If we don't try to process this, the SWIG just generates
       accessors to the elements of the union as
         &lt;container name&gt;_&lt;field name of
       union&gt;_&lt;union's field name&gt;,
      e.g.
         A_u_i and A_u_d
<br/>
       So we no longer process this.
    <br/>
        It would be nice to be able to recognize this and make
        suitable adjustments to the $ or [[ methods for the
        structure, and possibly the names of the accessor functions.
  </comment>
</item>

<item>
  <issue> Allow unions to be copied by reference, and only reference.</issue>
  <comment>
  </comment>
</item>

<item>
  
  <issue> getting a field from a structure has a copy argument
       that is not used. Either use it or remove it. See union.i</issue>
  <comment>
  </comment>
</item>

<item>
  
  <issue>R_swig_copy_ARef_to_R is not being generated in union.i</issue>
  <comment> It is generated if the union is not being defined inline, i.e. if
     INLINE_UNION is 0 or not defined.
    </comment>
</item>


    
  
<item>
 
  <issue> Are we generating classses for typedefs?</issue>
  <comment> e.g. see simpleStruct and the typedef for
        typedef B C;
  </comment>
</item>

<item>  
  <issue> Add finalizers via typemaps and via an R function to access
       the C code.</issue>
  <comment> Can always do this directly. No real extra machinery necessary,
       at present, I think.
</comment>
</item>

</items>

</topic>

<topic>
<title>Copying and <b>.copy</b></title>

<items>
<item>
    
  <issue>Make certain the copy argument is used in the code.</issue>
  <comment> see unnamed.i and getA().
</comment>
</item>


<item>
 
  <issue> Make the .copy use  the enumeration SCopyReferences and
      have 3 different  levels of copying
       none, copy, or DEEP.
   Change the default for .copy = FALSE to DEEP or TRUE
       when we are dealing with return an array (not a reference)
       for a variable.
</issue>
  <comment>
  </comment>
</item>

<item>
  
  <issue> Extra arguments to routines to control whether the result is
       copied or passed by reference.
      <br/>
 Deep and shallow copies of a struct, etc.
   Add extra arguments to R function and C routines.      

  <br/>
     Use the C code when possible - we have both R and C implementations.

<br/>
    Are we using the copyToR/copyToC code created in generateCopyRoutines().
    </issue>
  <comment>
      If the result is a struct or pointer to a struct.  If it
      is a struct copy means return as is. Otherwise,  make a
      reference to it and leave it around. (Have to prerserve
      the C object.)
      If it is a pointer, copy means deep copy. Otherwise,
      pass back reference.

        
    <br/>
   <ul>
    <li>  Want to check that the class is defined in R.</li>
    <li>  Get the right default value for the new target object.</li>
    <li>  Check the source type is not "opaque".</li>
   </ul>
  </comment>
</item>

<item>

  
  <issue> Get the name for R_swig_copy_BarRef_to_C right.
       Should it have a Ref or not.
      </issue>
  <comment> simpleArray.i and Bar is an example
</comment>
</item>

<item>  
  
  <issue> Deal with the VIRTUAL class in R for the class definition ExternalReference.</issue>
  <comment> If the VIRTUAL is there, we lose the ref slot in the derived
      types!
</comment>
</item>
  
  <item>
  
  <issue> The bars_set in simpleArray.i.</issue>
  <comment>  Works for list(BarRef, BarRef)
       See simpleArray_tests.S
      <br/>
         Like to get to work for list(Bar, Bar), etc.
</comment>
  </item>

<item>
  
  <issue> Mechanism for turning an *Ref into an *Array</issue>
  <comment> Basically, we just don't know the length. So it has to be
      provided explicitly/manually.
<br/>
   Create classes for this (both base Array class and
     generated classes specific to the different types)
     and provide constructor methods.  (as() won't work
     as we need to add the length.)
      
  </comment>
</item>

<item>
  <issue>  Deal with the const's in the cddb code and the warnings from the compiler.</issue>
  <comment>
  </comment>
</item>

<item>
  <issue> Add an opaque directive to declare that a struct, union or
       class
      should not be processed at the element level and no interface
      should be generated to access these elements. Rather, deal only
      with references/pointers.
  </issue>
  <comment>
       Add an "opaque" directive to treat a struct as being "opaque",
      i.e. so we don't generate the set and get methods for the
      elements and the copy routines.

      <br/>
Can add something like
<pre>
   %feature("opaque", "yes")  getARef ;      
</pre>
   to a .i file to indicate that the feature opaque should have a
      value yes for the routine getARef.
   <br/>
    If we do this for 
<pre>
   %feature("opaque", "yes")  struct B ;      
</pre>
   it doesn't show up on the node for classDeclaration.
   Nor its parent node.
      <br/>
  The problem is that we have a syntax error in the .i file
      because of this.
  <br/>
  If I put a typedef there rather than struct B {... }
  and refer to the typedef, then all is well.

      <br/>
  Appears that  if we drop the struct in struct C, all is well.
   But what if we have something actually typed as C,
      i.e. struct C and a regular  C (via an existing typedef).
  </comment>
  </item>


<item>
  <issue> Finish off the processing of the opaque directive for structs.      </issue>
  <comment> Now ignoring member accessor function generation.
  <br/>
       Don't support the full copy if there is no representation.
  </comment>
</item>
      
<item>  
  <issue> How do we get 5.4.2 of SWIG Basics to work for us and get
       around the "assignment to read-only value" coming from assigning
       a value to a struct.</issue>
  <comment>
      Is this still an issue?
  </comment>
</item>

  <linerule/>
<item>  
  <issue> Make certain the classes, etc. in defineArrayAccessors go into
      the NAMESPACE as necessary.</issue>
  <comment> Also the methods for $, [[, etc.
  </comment>
</item>


<item>
  <issue>Remove the Is() function from rrun.swg</issue>
  <comment>
  </comment>
</item>


<item>
  <issue> If the R/ directory exists, add R code to there.</issue>
  <comment> If man directory exists, add .Rd files there.
       And src/
<br/>
       Make this portable.
    <br/>
       Find out what support SWIG has for this.
</comment>
</item>


<item>  
  <issue> Run time checks for pointers using the EXTPTR tag.</issue>
  <comment>  Mostly done in the regular runtime material from rrun.swg.
       See how we can leverage SWIG's own runtime mechanism.
</comment>
</item>


<item>  
  <issue> See if we can find a way to do the vmaxget/set for the PROTECTs.</issue>
  <comment>
  </comment>
</item>
      
<item>  
  <issue> see if there is a convenient way to differentiate between
       primitive types and structures/classes/etc/ for SWIGTYPE.
    </issue>
  <comment>
  </comment>
</item>
      
<item>
  <issue> Output a log file of what was done, what warnings and what
       errors we encountered.</issue>
  <comment>
  </comment>
</item>

<item>  
  <issue> Define methods for SWIGFunction class.</issue>
  <comment> i.e. help and print methods.
      </comment>
</item>
    

<item>  
  <issue> scoerce{in,out} maps.  Documentation.</issue>
  <comment> typemap for coercing the result in R to a particular value,
       i.e. postprocessing. 
  </comment>
</item>

<item>  
  <issue> Keywords such as next, while, for, and things like c() or t().</issue>
  <comment>
  </comment>
</item>

<item>  
  <issue> Create Rd files.</issue>
  <comment> Read the "internal" ones from a file or directive.
  <br/>
     Or more appropriately, dymamic help.
  </comment>
</item>

<item>
  <issue> Look into dynamic variables for setting and getting C-level variables.</issue>
  <comment>
  </comment>
</item>
    
<item>  
  <issue> Put the name on the OUTPUT argument.</issue>
  <comment>  Can't really - they are all called OUTPUT.
    <br/>
      Is there a way to add features?
      Try to find a way so that when we use gcc and translation units
      we will know the names.
  </comment>
</item>

</items>
</topic>

<topic>
<title>Function Pointers</title>

<items>
  <item>
    <issue>Check the number of arguments in the function pointer. It is
    coming out as 0 in the S code that does the assertion.</issue>
  <comment>
  </comment>
  </item>
  
<item>
    <issue>Make certain to pop the function of the stack.</issue>
  <comment> It is hard to know if we can do this without analyzing
    the code.  It is not clear if the routine we pass it to
    stores it or uses it and will never access it again.

    <br/>
        We do pop. That's the problem. The setMessageHandler()
      in routine.h means we only get one call.
    </comment>
</item>


<item>
  <issue> For function pointers, if we have an scoerceout
       for any of the parameters or an scoercein
       for the return type, create a local
       function that is called first that does these and
       then calls the user-supplied function.</issue>
  <comment>  e.g. from routine.h, we would want to end up with
<pre>
         do_op =
           function(a, b, op) {
              ...
              if(is.function(op)) {
                 userFunc = op
                 op = function(a, b) {
                    ans = userFunc(a, b)
                    as.numeric(ans)
                 }
              }
               ...      
           }
</pre>            
</comment>
</item>


<item>
  <issue> Work on the cddb_log to make the function pointer stuff robust.
  </issue>      
  <comment> Types for declaration of arguments now using SwigType_str()
       so turn into real C types.
      <br/>
       Works. Code in ~/Projects/libcddb-1.2.0 with an extra argument
      to take user defined data. Fix and pass back a patch.
 </comment>
</item>
</items>
</topic>

<topic>
<title>C++</title>

<items>  

<item>
  <issue>Exceptions.</issue>
  <comment>
  </comment>
</item>


<item>
    <issue>Look at the -fvirtual option to avoid generating replicates of
    methods for derived classes.  See SWIGDocumentation.html</issue>
  <comment>
  </comment>
</item>

<item>  
  <issue>Explore casting. </issue>
  <comment>  At the C++ level, it still calls virtual methods as we would
      expect.
  </comment>
</item>

<item>  
  <issue>Add static variables to the accessors for an instance of a class</issue>
  <comment> e.g. For the class Abc in cplusplus.h, make total be available
       through the $ operator.
    <br/>
       Would mean that we need to handle the case that it takes no
     self/this argument.
  </comment>
</item>
  
<item>
  <issue> Add accessor for static fields in C++ class.</issue>
  <comment> Really want to do this as something like  Abc::field
     where Abc is the class and field is a dynamic accessor.
     Wait until we have class-level slots in S4.
  </comment>
</item>

<item>
    <issue>Check abstractClass.i and the generated code to see if we get
    constructor routines for the virtual class.</issue>
  <comment> We automatically get no constructor, but we do get a delete
       method for Abstract.
    <br/>
      The attribute "abstract" is set on the class node. (Doesn't
     print nicely.)  The attribute is a List.
  </comment>
</item>


<item>  
  <issue> watch for virtual classes when dealing with
      generating constructors, copying functions, etc.</issue>

  <comment>
  </comment>
</item>

<item>  
    <issue>Overloading for C++. Figure out the best way to deal with it
        in the R interface.</issue>
  <comment>
  </comment>
</item>
  
<item>
  <issue> For C++ classes, add the collection methods for the $ and also the [[.</issue>
  <comment>
      Done by adding a memberfunctionHandler() method to the class R
       and setting a flag to say we are in the state of processing a
      member function. Then, the resulting call to functionWrapper()
      ends up adding to the class_member_functions list/hashtable.
      It adds the function name and the definition of the function.
      We can then add this to the $ operator for that class.
      <br/>
      Overloading will cause us some additional problems.
  </comment>
</item>

<item>  
  <issue> Support overloading of C++ methods.</issue>
  <comment>
  </comment>
</item>

    
<item>  
  <issue> add .cxx to the list of supported extensions in R.</issue>
  <comment>
  </comment>
</item>

<item>
  <issue> Enhance and test with C++.</issue>
  <comment>
      <ul>
	<li> overloading of methods</li>
	<li> allow </li>
      </ul>
  </comment>
</item>

<item>
  <issue> Default arguments for S functions corresponding to C++ routines with default arguments.</issue>
  <comment>
  </comment>
</item>

</items>
</topic>

<linerule/>


<topic>
<title>Examples</title>
<items>

<item>
  <issue>  Examples:  cddb.i, suffix trees, image files, network data
  (e.g. libpcap).</issue>
  <comment>  Higher level: apply methods for looping over a disc.
  </comment>
</item>

</items>
</topic>

<topic>
<title>S/Runtime Code</title>

<items>

<item>  
  <issue> defineEnumeration</issue>
  <comment> see srun.swg.</comment>
</item>

<item>
  <issue> ExternalReference</issue>
  <comment> see srun.swg
  </comment>
</item>

<item>
  <issue> typechecking for S references.</issue>
  <comment> see srun.swg.
    </comment>
</item>

</items>
</topic>

<topic>
<title>Check</title>

<items>

<item>  
  <issue> Check the redirects are sufficient.</issue>
  <comment>  <font color="red">Check the wrapper one</font>
  </comment>
</item>

<item>
  <issue> Add to usage/help for the module.</issue>
  <comment>
  </comment>
</item>

<item>
  <issue> More typemap checking for the output arguments.</issue>
  <comment>
  </comment>
</item>
  
<item>
  <issue>Add more to the rtype typemap as necessary</issue>
  <comment>
  </comment>
</item>

<item>
    <issue>What's happening with enums.</issue>
  <comment> Seem okay.
  </comment>
</item>
  
<item>
    <issue>Check on the NAMESPACE output.</issue> 
  <comment>
  </comment>
</item>

</items>
</topic>

<topic>
<title>Future</title>

<items>

<item>
  <issue>Decide how to implement inheritance in C++ at the S level</issue>
<comment> Should we do it via S4 callNextMethod() or by including the
  information directly.
   We have some tricks for this in defining local S4 methods,
    i.e. a MethodList to chose from that is restricted to a limited scope.
</comment>
</item>

<item>
<issue> Handle the inheritance issue if B extends A and shares a method
    foo().  Then, if we call B_foo() with an A, it should be okay.
    (The correct methods will be called in the C++ code.)
 </issue>
 <comment>
 </comment>
</item>


<item>
<issue> Use this to generate the registration table for an existing R package.</issue>
<comment>
</comment>
</item>

<item>
<issue>  Allow an OOP class extend a C++ class via functions as methods.</issue>
<comment>
</comment>
</item>


</items>
</topic>


<linerule/>

<topic>
<title>Done</title>

<items>

<item>  
  <issue> The accessor functions $ and $&lt;- for C++ classes need to
       defer to base classes as necessary. </issue>
  <comment> Should we do this via S4 callNextMethod()
       or should we do it directly by matching the name
       to those of the base classes, and those in turn.
</comment>
</item>


<item>  
    <issue>Inheritance for C++. If a method m() is defined in a derived class
    B of a class A, have the $ operator call that of A to get the
    appropriate inheritance.</issue>
  <comment>  Add this.
    <br/>
       Will it actually make any difference in that at the C++-level,
       we will get the right thing at run-time?

    <br/>
      It will matter for the $ operator as we won't see all the classes.

</comment>
</item>

<item>  
    <issue>Check cplusplus example with static field total enabled. </issue>
  <comment>  Need to define this in its own file, cplusplus.cpp.
</comment>
</item>


<item>
    <issue>Need to handle the case where class B extends class A and we have
      references to them and the external pointer test
       says that we were expecting an instance of ARef.
       Need to be able to allow this.
      </issue>
  <comment> We can defer to the S class system, checking in the S code.
      If so, then add
          is(x, 'ARef')
       or
          x = as(x, 'ARef')

    <br/>
      If we do this, we want to see if the object extends
       the appropriate base class.
<br/>
       We can do this in the resolveExternalRef.
    
    <br/>
      Added a C++Reference class.
      And now  R_SWIG_resolveExternalRef() calls
      R_SWIG_checkInherits()   to see if the inheritance is appropriate.
    <br/>
      Uses extends().
</comment>
</item>


<item>
  <issue> Class/static methods in C++ classes.</issue>
  <comment>
    <ul>
      <li>Have to change the names for S (s_Abc::total)
          <br/>
            Done.</li>
      <li>Add S function.
      <br/>
         Now appears in the code.
        </li>
   </ul>
   </comment>
</item>
   

<item>  
   <issue>Is the accessor method $ and $&lt;- generated for structs and unions.</issue>
  <comment>  Should be.
    <br/>
       Yes.
</comment>
</item>


<item>
  <issue>Make certain setClass() uses the base class. </issue>
  <comment> i.e. if B extends A in C++, then have BRef extend ARef.
<br/>
      See classDeclaration().
</comment>
</item>
  
<item>  
  <issue> Ending up with "struct ARef" rather than ARef for name of S class that extends ExternalReference.</issue>
  <comment> in union.i
      <br/>
        Happening in processType.

      <br/>
        Filter the struct from the base type in getRTypeName().
</comment>
</item>
      

<item>  
  <issue> Two definitions for Union - URef</issue>
  <comment> See union.i
  </comment>
</item>


<item>  
  <issue> Make certain to output the #ifdef __cplusplus extern "C" {
  #endif
      at the hed of runtime only after the runtime directive, or
      alternatively when we first output our first drop of
      code to f_runtime.
  </issue>
  <comment>
       Just adjust the Swig_register_filebyname for "runtime" to go to
       f_wrapper which is emitted before f_runtime.
  </comment>
</item>

<item>  
  <issue>
<pre>
dyn.load("simpleStruct.so"); source("simpleStruct_wrap.S")      
a = new_A()      
copyToR(a)
Error in getClass("intRefRef") : "intRefRef" is not a defined class      
</pre>
  </issue>

  <comment>
      Need  to define this when we see it in the membervariableHandler.
<br/>
     Done
      <br/>
       But now we have to get rid of the errors in the
      R_swig_copy_ARef_to_C
      for the char ** and int **.

      <br/>
        We were pushing the SwigType_push() twice now.
      Need to make certain it is done once and only once.
  </comment>
</item>
  

<item>  
  <issue> Add the scoercein and scheck for the value in the [&lt;- array methods.</issue>
  <comment>
  </comment>
</item>


<item>  
  <issue> new and delete for structs.</issue>
  <comment> And the correct methods for these.
    e.g. create, delete/destroy  generics with methods for these
  types.
      <br/>
        createNativeObject(name)
        releaseNativeObject().
      
      <br/>
     Add a finalizer when we call new.
  </comment>
</item>

      
<item>  
  <issue> Explore different ways to deal with the .copy argument in the C
  code for struct A [2] in the simpleArray.i code.</issue>
  <comment>
       Could deal with a single loop here and put the copy
      within the body to figure out what to do to generate the
      individual element.

<pre>
<![CDATA[      
  int i, n = $1_dim0;
  if(LOGICAL(s_copy)[0]) {
     $result = createSWIGRArray("$R_classArray", n);
  } else
     $result = NEW_LIST(n)      

  PROTECT($result); __r_nprotect++;
  for(i = 0; i < n; i++) {
     SEXP tmp;
     if(LOGICAL(s_copy)[0]) 
        tmp = R_swg_copy_$R_class_to_R($1 + i);
     else {
        tmp = SWIG_MakePtr((void*) ($1 + i), "$R_class", 0)
     }
     SET_VECTOR_ELT($result, i, tmp);
  }
]]>      
</pre>      
   <br/>
    Need to put copy support into all the rest of the relevant
      typemap entries.
  </comment>
</item>
  
<item>  
  <issue> .copy argument for variable setting code in R</issue>
  <comment>  Added BUT NOT USED/IMPLEMENTED. See addCopyParameter()
       Checks if it is a reference.
      <br/>
        Want something more discerning.
  <br/>
       Delegating this to typemaps may be leaving it to
      a place where we have less precise information,
      i.e. just SWIGTYPE .
  </comment>      
</item>

  
<item>  
  <issue> Arrays and pointers generally.</issue>
  <comment>
      Need to know the length.
      For fixed length e.g. int x[20] find out how to do that. $1_dim0.
      For unknown length, need idioms in the typemap.

   <br/>
      Array reference classes.

    <br/>
       Define methods for [ and [&lt;-.  Use the set_item method in SWIG.
       Define a SWIGArray class and create ones that extend this.
  </comment>
</item>
  

<item>  
  <issue> Define classes for R for, e.g.   double[]
           struct A[].</issue>
  <comment>
       Need to generate item accessors.
       Does SWIG have anything for this ?
      <br/>
       Basics work. Can set struct Bar in
      simpleArray.i.
      <br/>
      Can't do primitives quite yet.
       <br/>
        Works now.
  </comment>
</item>

<item>  
  <issue> simpleArray_test.S has problems for intRef not being defined
       in   arr = x()
   </issue>
  <comment>
  </comment>
</item>
  
<item>  
  <issue> Fill in R_SWIG_create_SWIG_R_Array.</issue>
  <comment> Currently, just returning a basic list.
       Works now to get the base type array.
      <br/>
       Need to define new array classes in R
       and also item accessors.
  </comment>
</item>

<item>  
  <issue> When setting a method for accessing a <b>variable</b>, e.g. ui,
       need to differentiate between set and get. Add an "ANY".
  </issue>
  <comment>
      Also, make certain it is generic using if(!isGeneric('')) setGeneric(....)
  <br/>
     Where is this? I think  it is no longer relevant.
<br/>
     Use obj$field rather than field(obj)

       <br/>
     If we want the latter, generate it.
  </comment>
</item>
  

<item>  
  <issue> For classes (structs and C++ classes)</issue>
  <comment>
    <ul>
      <issue> Deal with "struct Bar" in the typemap when we want BarRef
     <br/>
        Should we use the  SWIGTYPE_... via the descriptor.
      </issue>

      <issue>Generate the representation </issue>

      <issue>Implement the R_SWIG_copy routines.
      <br/>
          The type conversion of the data types.
         <br/>
           Make certain to avoid circular references
           i.e. a struct that contains a field that is an instance of
           the same struct. Can't really happen. Just have to find
           the pointer.
      <br/>
          Get the replacement of the conversion of the to R field.
      </issue>
   
    </ul>
  </comment>
</item>
  
  
<item>
  <issue>Sort out the simpleArray for struct Bar.</issue>
  <comment>
      scoercein code needs to refer to Bar not BarRef.
      May need a new type in the replacement/substitution,
      $R_base
  </comment>
</item>

  
<item>  
  <issue> Get the type declarations for structs correct in the swig_copy_$1_to_{R,C}.</issue>
  <comment> Getting closer. Need to ensure consistency.
       Collection of tests needed to ensure that these are mapping to
       the right things.
       Look at the tests in the SWIG directories.

      <br/>
        CHECK these eventhough this is in the Done.
   </comment>
</item>
  
<item>
  <issue> Put attributes on the functions giving the
       argument and return types as S types.
  </issue>

  <comment> These can be used to do reflectance in R,
      e.g. generating class definitions for
       opaque data structures that have
        ..._get_[field name] methods.
<br/>
      Deal with enumeration values.
      <br/>
      Need to handle the  case of non-primitives.
      Expand $R_class. Working now.
      <br/>
     Have to find the correct node for which to do the lookup_new.
      Working now.
      <br/>

    Maybe WANT TO USE A DIFFERENT FORMAT, e.g. SwigType_manglestr()
  </comment>
</item>


<item>      
  <issue> Get the handling of char * in the copy_$1_to_R and to_C
       to work the same way as they do in the regular typemap use.
      i.e. in the copy of structs to and from R.
       They are appearing as char, without the pointer.
  </issue>
  <comment>
       The issue may be that we are dealing with member elements
       in the structure that appear from their type as if they/it
       is just the base type.
       See basic.i for an example.
    
       Are the typemaps being attached as they are in the functions,
       e.g.
        Swig_typemap_attach_parms("in", l, f);

      <br/>

        Use  SwigType_push() to form the full type.
  </comment>
</item>

<item>  
  <issue> Classes for the function pointers.</issue>
  <comment>
      Added CRoutinePointer to the available base classes.

      <br/>
     Add a prototype to give the inputTypes and return Type.
<br/>
Document as a feature.
  </comment>
</item>

<item>
  <issue> Differentiate between typedef and original in name if possible</issue>
  <comment> cddb_conn_t and cddb_conn_s where the latter is a struct and
      the _t is the typedef.
    <br/>
      Don't resolve the typedef.
<br/>
      SwigType_manglestr() was doing the typedef_resolve.
      <br/>
      We can use SwigType_split() (a handy routine to know of)
      and then work that way.
       Now seems to be working.
  </comment>
</item>
  
<item>  
  <issue> Ensure enums are defined, and working</issue>
  <comment> Use cddb_query to generate an error.
    <br/>
        Perhaps don't call defineEnumeration, but just
       do the setClass and assign() ourselves.

      <br/>
       Okay now. Make certain that the Value is attached to the end in
      the rules in r.swg when creating an EnumerationValue.
       Otherwise the class is not found.
  </comment>
</item>

  
<item>  
  <issue> Make the .values be split across lines in the definition of an enumeration </issue>
  <comment> Avoid blowing the limit on the size of a line the parser can handle.
  <br/>
    Fine now.
  </comment>
</item>

<item>
  <issue> R Functions as arguments when we expect a pointer to a routine.</issue>
  <comment> Callbacks.
      <br/>
      See perl and python.

    <br/>
        Generate proxy routine to convert values to S and pass them
     to the function.
     
<p>    
    Need to make the S function that knows to use the specially
    generated C routine. 
    And this has to be conditional on getting the
    name of a routine, a NativeSymbolInfo, or an R function.
</p>
   </comment>
</item>


  
<item>
  <issue> Get the right attributes on the parameters and type in the
      function pointer.</issue>

  <comment>  Possibly need to build our own node.
        Just needed to add the lname attribute.
      <br/>
      And to use the base of the swig type for the return type
      rather than the entire node which contained the entire
      function pointer and not the return value.
  </comment>
</item>
  
<item>  
  <issue> Added a copyToC( Ref, Ref) </issue>
  <comment> This allows copyToC(new_A(), new_A())
        so that we never need to bring the structs back to
        R.
  </comment>
</item>

  
<item>  
  <issue> Get simpleStruct to work from S.</issue>
  <comment>  copyToR() and the other parts seem to work.
    <br/>
        Need more interesting struct with references


   Allow people to put code into the spackageinitroutine.
  <br/>
        Use %insert("sinitroutine").
  </comment>
</item>

<item>
    <issue>Default argument for obj in copyToC</issue>
  <comment>  
   Generate code for NAMESPACE file.
  <br/>  Mostly done. Added useDynLib</comment>
</item>

<item>
  <issue> Add options to control the output</issue>
  <comment> e.g. whether to emit the initialization routine for
    registration,
    <br/>
      Can also have a directive to insert additional code in there.
      Have to be careful about declarations.
  </comment>
</item>

<item>
  <issue> Typechecking typemaps.</issue>
  <comment> Checking for NAs, etc.
    <br/>
      See scheck typemap. Now included in the inputs.
   </comment>
</item>

<item>  
  <issue> Map the names of the C primitives such as double, int, bool,
  long, etc. to R data types so that they can be used in the
      class  representations for defining structs, unions, classes
       in S4.

      <br/>
       Use the "rtype"  typemap and getRType() checks that.

   </issue>
</item>
  
<item>
  <issue> Add the case that there are output arguments but that there is
       no return, it is void.</issue>
  <comment>
  </comment>
</item>


<item>
  <issue> Handle INOUT arguments.</issue>
  <comment> Do we get them almost for free from OUT arguments?
<br/>
     Pretty much. Just have to add typemaps.
</comment>
</item>

<item>
  <issue> Multiple return values.</issue>
  <comment> i.e. output arguments.
        Return list(.result = regular return value,
                    argName.M = value,
                    argName.N = value)
<br/>
       How do we get SWIG to recognize them.
       int *OUTPUT.
        Make the output.i in inst/examples/ work.
<br/>
   Works.  Need to handle case of void return type.
   And lots more typemap entries.
  </comment>
</item>
  
<item>
  <issue> Add usage output for the r module.</issue>
  <comment> i.e. help for the module.
      <br/>
       Keep adding to it.
  </comment>
</item>


<item>
  <issue> No need to save the answer in the R function from the .Call()
     if there is no conversion afterwards. So avoid the
          ans = .Call(....)
          ans
      step and use just .Call(....)
      to do the return in one step, avoiding the assignment.
      (No compiler to help us out :-))
   </issue>
  <comment>
  </comment>
</item>

<item>
  <issue> Figure out how to get the replacements for the copy struct routines.</issue>
  <comment>
       Swig_typemap_lookup_new()'s 3rd argument allows us to specify
        the name of the replacement that we want.
    <br/>


      Alternatively, we culd delegate the copying to R, i.e.
      returning a reference but want the deep copy
      means just call copyToR(ref) and that uses the get accessors for
      each of the fields.
      Similarly, if we want to pass an R object of class StructBar
      say to something  that wants an struct Bar * (or event struct
      Bar), then create one, and copy the entries using the set
      accessors.
      <br/>
       Now implemented as copyToR and copyToC.
     <br/>
  </comment>
</item>

<item>    
  <issue> For variableWrapper(), if it is constant, just make
       the get function the same as the name() function,
       e.g.  PiSquared = PiSquared_get
       and don't bother defining a new one.      
  </issue>
  <comment>
  </comment>
</item>

<item>
  <issue> Syntax error for _MyULong variable name in MyULong_set in primitives.h</issue>
  <comment>  Need to put s_ rather than just _ to avoid the conflict with
        the C variable as R doesn't want a variable name to start with '_'.
  </comment>
</item>


<item>
  <issue> Get the name of the header file right.</issue>
  <comment> And make it available to the directives.
    <br/>
     Can avoid this if we just use strings rather than files and then
     Dump() at the end in the correct order.
    <br/>
      Done. Now we don't generate the header or the class file.
    </comment>
</item>

<item>
  <issue> Output a header file giving the declarations of what we generate.</issue>
  <comment> Need this as we refer to routines before they are declared.
    <br/>
        s_header in C code.  Accessible in directives via %insert("header").
  <br/>
       <font color="red">Get the name right.</font>
  </comment>
</item>

<item>
  <issue> Add the runtime S code to the sfile.</issue>
  <comment> Use the %Rruntime "filename" directive.</comment>
</item>
    

<item>
  <issue> For an enumeration value being returned, call
       makeEnumerationValue() but give it the definition of the
       enumeration in the call, i.e. a global variable that gives
       {name, value} pairs for each element.  
  </issue>

  <comment> This  would avoid having to lookup the definition in R.
       <br/>
       This is an efficiency issue so low priority.
  
  </comment>
</item>


<item>
  <issue> Add information about the name (via $1_name in the "in"
       typemap),  position (index = $argnum) of the argument and
       the routine being called when reporting error messages about, e.g.
       NULL pointers or incorrect tags for externalptrs.
  </issue>
  <comment> Can't get the name of the routine from the typemap but when we
       raise an exception, it will be in the error message.
       Also, we can get that information from some compilers.
  </comment>
</item>
  
<item>
  <issue> In variable setting routines, need a different name for the parameter.</issue>
  <comment> Should we change the names of the arguments regardless to s_&lt;name&gt;...
  
<br/>
      If no name is given, make one up in a consistent manner - s_arg&lt;n&gt;.

<br/>
    If we makeup names ourselves, does this conflict with the
    information in the typemaps and what is substituted in $1_...
  </comment>
</item>

<item>
  <issue> Enumeration that is not typedef'ed, but is named should be handled.</issue>
  <comment> Enum without a typedef are processed in constantWrapper.
   and typdef..
    <br/>
        We are using the name now rather than the typedef name
  (tdname).
      Perhaps define it for both, or allow a vector of names for the
  enum.
         defineEnumeration(c("Sex", "Gender"))
       How this is handled - i.e. via aliases or not - is
         up to us later on.  
  </comment>
</item>

<item>  
  <issue> Why are the unsigned int not being used from the typemap "scoercein".</issue>
  <comment>  2 words. But still should work.... See java.swg.
    <br/>
       Was working. But there was no name on the parameter, just its type!
    </comment>
</item>


<item>
  <issue> Insert Rdefines.h into the wrapper code.</issue>
  <comment>  Where is the only issue.
       <br/>
         Do it in the rrun.swg? When does this get pulled in?
       <br/>
        Via the %runtime in r.swg!
  </comment>
</item>

<item>    
  <issue> Get the literal material to be included in the file into the file.</issue>
  <comment> Make certain all the redirections/Swig_register_byfilename()
       are done.
   </comment>
</item>


<item>
  <issue> vmaxget and set around the .Call routines.</issue>
  <comment>
  </comment>
</item>

<item>
  <issue>
  <br/> Allow the result of the .Call() to be stored and converted to
       a different R object.
      e.g. GtkWidget and getting its classes.
    <br/>
      See the scoerceout maps.
  </issue>
</item>


<item>
  <issue> Output the command line information into the generate S file(s).</issue>
  <comment>
  </comment>
</item>

<item>
  <issue> Fix the "Unknown target 'runtime' for %insert directive".</issue>
  <comment> Done  now. Needed to redirect "runtime" output to /dev/null.
  </comment>
</item>

<item>
  <issue> For the constants, move the conversion code to the configuration files.</issue>
  <comment> i.e. out of the C++ code.
  </comment>      
</item>


<item>
  <issue> Figure out the naming scheme to use for struct Bar, Bar, etc.</issue>
  <comment>
      The value of the mangle field may work - struct ABC and typdef

    struct ABC S both map to "_ABC".
    Similarly, both have a descriptor SWIGTYPE_ABC.
    We probably want S extends (SWIGTYPE)_ABC or to have a 
    virtual class as a parent, e.g. _ABC and StructABC and S as
    derived classes.

     How does Perl, Python, Java do it?
    <br/>
      Build it ourselves. SWIG does this so there may not be any
       magical one-liner.
  </comment>
</item>
      


</items>
</topic>


</topics>
