Commit graph

4 commits

Author SHA1 Message Date
Marcelo Matus
19613c8909 fix hex pointer conversion
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7022 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-03-02 17:55:13 +00:00
Marcelo Matus
32d5addaa6 fix hex pointer conversion
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7021 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-03-02 17:52:34 +00:00
Marcelo Matus
25e1e7932a adding more cases
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6814 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-12-01 01:17:56 +00:00
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