swig/Lib
Marcelo Matus 0881d3c861 Add simple PySwigObject to handle the C/C++ instance pointers,
instead of using PyCObject or plain strings.

The new PySwigObject is even safer than PyCObject, and
more friendly than plain strings:

now you can do

  print a.this
  <Swig Object at _00691608_p_A>

  print str(a.this)
  _00691608_p_A

  print long(a.this)
  135686400

  print "%s 0x%x" % (a.this, a.this)
  _00691608_p_A 0x8166900


the last one is very useful when debugging the C/C++ side, since
is the pointer value you will usually get from the debugger.

Also, if you have some old code that uses the string representation
"_00691608_p_A", you can use it now again by calling str(ptr), or
maybe nothing special by just calling PyString_AsString(..).

This change is mainly for nostalgic swig users that miss the
string representation, but also allows to say again

  if a.this == b.this:
    return "a is b"

and well, since the change were really simple, maybe in the future
we will be able to do

    next = a.this + 1

or add native python iteration over native C/C++ arrays, ie, no
need to create/copy new tuples when returning and array or vector.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6759 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-11-19 20:40:20 +00:00
..
allegrocl Replace hardcoded type specifiers by typemap-based type specifier lookup. 2004-08-23 15:28:58 +00:00
chicken allow to include the swig runtime code into external user libraries 2004-11-18 00:37:33 +00:00
csharp forgotten checkin to remove some warnings on VC++ 2004-11-11 21:50:54 +00:00
guile allow to include the swig runtime code into external user libraries 2004-11-18 00:37:33 +00:00
java size_t fix 2004-11-01 21:12:01 +00:00
modula3 size_t fix 2004-11-01 21:12:01 +00:00
mzscheme allow to include the swig runtime code into external user libraries 2004-11-18 00:37:33 +00:00
ocaml allow to include the swig runtime code into external user libraries 2004-11-18 01:00:38 +00:00
perl5 allow to include the swig runtime code into external user libraries 2004-11-18 00:37:33 +00:00
php4 allow to include the swig runtime code into external user libraries 2004-11-18 00:37:33 +00:00
pike remove inclusion of precommon.swg 2004-11-18 05:56:38 +00:00
python Add simple PySwigObject to handle the C/C++ instance pointers, 2004-11-19 20:40:20 +00:00
ruby allow to include the swig runtime code into external user libraries 2004-11-18 00:37:33 +00:00
std add #include <cwchar> 2004-11-02 17:08:15 +00:00
tcl allow to include the swig runtime code into external user libraries 2004-11-18 00:37:33 +00:00
xml This file is deprecated - superceded by the pointer.i library. Bye bye! 2003-09-23 20:38:46 +00:00
_std_deque.i The great merge 2002-11-30 22:01:28 +00:00
allkw.swg added ocaml keywords 2003-12-12 07:12:42 +00:00
carrays.i fix #if __cplusplus problem 2004-10-06 16:51:22 +00:00
cdata.i mods to use "default" typemap instead of default arguments for new default argument wrapping approach 2004-10-04 20:08:25 +00:00
cmalloc.i mods to use "default" typemap instead of default arguments for new default argument wrapping approach 2004-10-04 20:08:25 +00:00
common.swg allow to include the swig runtime code into external user libraries 2004-11-18 00:37:33 +00:00
constraints.i The great merge 2002-11-30 22:01:28 +00:00
cpointer.i fix #if __cplusplus problem 2004-10-06 16:51:22 +00:00
cstring.i The great merge 2002-11-30 22:01:28 +00:00
exception.i fix comment to work with old C compilers 2004-10-06 17:34:51 +00:00
linkruntime.c allow to include the swig runtime code into external user libraries 2004-11-18 00:37:33 +00:00
math.i The great merge 2002-11-30 22:01:28 +00:00
pointer.i The great merge 2002-11-30 22:01:28 +00:00
std_deque.i The great merge 2002-11-30 22:01:28 +00:00
stl.i Typemap for size_t applied to std::size_t 2003-08-17 11:52:31 +00:00
swig.swg add typemaps for vars +two dimensional arrays 2004-11-15 20:55:20 +00:00
swigrun.i *** empty log message *** 2003-11-20 02:49:12 +00:00
swigrun.swg Add simple PySwigObject to handle the C/C++ instance pointers, 2004-11-19 20:40:20 +00:00