public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* RFA: document Value.__init__ (Was: Python API questions and use cases)
       [not found]           ` <AANLkTi=JBFao0sFtB+yKesANUqGWKLxX40St782jS1zN@mail.gmail.com>
@ 2010-09-21 21:56             ` Tom Tromey
  2010-09-21 22:49               ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2010-09-21 21:56 UTC (permalink / raw)
  To: Joel Borggrén-Franck; +Cc: André Pönitz, gdb-patches

>>>>> "Joel" == Joel Borggrén-Franck <joel.borggren.franck@gmail.com> writes:

Joel>  I can't find documentation for the constructor André showed me:
Joel> gdb.Value(addr).

Here is a patch to document this constructor.

Ok?

Tom

2010-09-21  Tom Tromey  <tromey@redhat.com>

	* gdb.texinfo (Values From Inferior): Mention Value.__init__.

Index: gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.764
diff -u -r1.764 gdb.texinfo
--- gdb.texinfo	15 Sep 2010 19:31:59 -0000	1.764
+++ gdb.texinfo	21 Sep 2010 20:05:54 -0000
@@ -20774,6 +20774,22 @@
 The following methods are provided:
 
 @table @code
+@defmethod Value __init__ @var{val}
+Many Python values can be converted directly to a @code{gdb.Value} via
+this object initializer.  Specifically, Python booleans are converted
+to boolean type from the current language; Python integers are
+converted to the C @code{long} type for the current architecture;
+Python longs are converted to the C @code{long long} type for the
+current architecture; Python floats are converted to the C
+@code{double} type for the current architecture; and Python strings
+are converted to target strings, using the current target encoding.
+
+@code{val} can also be a @code{gdb.Value}, in which case a copy of the
+value is returned, or a @code{gdb.LazyString} (@pxref{Lazy Strings In
+Python}), in which case the lazy string's @code{value} method is
+called, and its result is returned.
+@end defmethod
+
 @defmethod Value cast type
 Return a new instance of @code{gdb.Value} that is the result of
 casting this instance to the type described by @var{type}, which must

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: RFA: document Value.__init__ (Was: Python API questions and use cases)
  2010-09-21 21:56             ` RFA: document Value.__init__ (Was: Python API questions and use cases) Tom Tromey
@ 2010-09-21 22:49               ` Eli Zaretskii
  2010-09-21 22:50                 ` RFA: document Value.__init__ Tom Tromey
  0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2010-09-21 22:49 UTC (permalink / raw)
  To: Tom Tromey; +Cc: joel.borggren.franck, andre.poenitz, gdb-patches

> From: Tom Tromey <tromey@redhat.com>
> Cc: =?utf-8?B?QW5kcsOpIFDDtm5pdHo=?= <andre.poenitz@nokia.com>,        gdb-patches@sourceware.org
> Date: Tue, 21 Sep 2010 14:06:06 -0600
> 
> >>>>> "Joel" == Joel Borggrén-Franck <joel.borggren.franck@gmail.com> writes:
> 
> Joel>  I can't find documentation for the constructor André showed me:
> Joel> gdb.Value(addr).
> 
> Here is a patch to document this constructor.
> 
> Ok?

OK, but the long list of conversions in the first paragraph could use
a @table, I think.

Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: RFA: document Value.__init__
  2010-09-21 22:49               ` Eli Zaretskii
@ 2010-09-21 22:50                 ` Tom Tromey
  2010-09-22 16:17                   ` Eli Zaretskii
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2010-09-21 22:50 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: joel.borggren.franck, andre.poenitz, gdb-patches

Eli> OK, but the long list of conversions in the first paragraph could use
Eli> a @table, I think.

How about this?

Tom

2010-09-21  Tom Tromey  <tromey@redhat.com>

	* gdb.texinfo (Values From Inferior): Mention Value.__init__.

Index: gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.764
diff -u -r1.764 gdb.texinfo
--- gdb.texinfo	15 Sep 2010 19:31:59 -0000	1.764
+++ gdb.texinfo	21 Sep 2010 21:54:48 -0000
@@ -20774,6 +20774,41 @@
 The following methods are provided:
 
 @table @code
+@defmethod Value __init__ @var{val}
+Many Python values can be converted directly to a @code{gdb.Value} via
+this object initializer.  Specifically:
+
+@table @asis
+@item Python boolean
+A Python boolean is converted to the boolean type from the current
+language.
+
+@item Python integer
+A Python integer is converted to the C @code{long} type for the
+current architecture.
+
+@item Python long
+A Python long is converted to the C @code{long long} type for the
+current architecture.
+
+@item Python float
+A Python float is converted to the C @code{double} type for the
+current architecture.
+
+@item Python string
+A Python string is converted to a target string, using the current
+target encoding.
+
+@item @code{gdb.Value}
+If @code{val} is a @code{gdb.Value}, then a copy of the value is made.
+
+@item @code{gdb.LazyString}
+If @code{val} is a @code{gdb.LazyString} (@pxref{Lazy Strings In
+Python}), then the lazy string's @code{value} method is called, and
+its result is used.
+@end table
+@end defmethod
+
 @defmethod Value cast type
 Return a new instance of @code{gdb.Value} that is the result of
 casting this instance to the type described by @var{type}, which must

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: RFA: document Value.__init__
  2010-09-21 22:50                 ` RFA: document Value.__init__ Tom Tromey
@ 2010-09-22 16:17                   ` Eli Zaretskii
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2010-09-22 16:17 UTC (permalink / raw)
  To: Tom Tromey; +Cc: joel.borggren.franck, andre.poenitz, gdb-patches

> From: Tom Tromey <tromey@redhat.com>
> Cc: joel.borggren.franck@gmail.com, andre.poenitz@nokia.com,
>         gdb-patches@sourceware.org
> Date: Tue, 21 Sep 2010 15:56:17 -0600
> 
> Eli> OK, but the long list of conversions in the first paragraph could use
> Eli> a @table, I think.
> 
> How about this?

That's fine.  Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-09-22  7:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <AANLkTim24XZssayO6-wvf9WoywRauqXRbUdQi5LjyO9F@mail.gmail.com>
     [not found] ` <m3iq26x548.fsf@fleche.redhat.com>
     [not found]   ` <AANLkTi=cBL9Cwu5NeX5yVupXwDbam0j3_gXFPGs0WXgz@mail.gmail.com>
     [not found]     ` <201009161148.37670.andre.poenitz@nokia.com>
     [not found]       ` <AANLkTinqU_uKORndRP7A8Ouy406TOb6WKz8y1eiOHDGP@mail.gmail.com>
     [not found]         ` <m3wrqlpkpd.fsf@fleche.redhat.com>
     [not found]           ` <AANLkTi=JBFao0sFtB+yKesANUqGWKLxX40St782jS1zN@mail.gmail.com>
2010-09-21 21:56             ` RFA: document Value.__init__ (Was: Python API questions and use cases) Tom Tromey
2010-09-21 22:49               ` Eli Zaretskii
2010-09-21 22:50                 ` RFA: document Value.__init__ Tom Tromey
2010-09-22 16:17                   ` Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).