[gimp-perl] Make Gimp::Net pass floats as floats.
- From: Ed J <edj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp-perl] Make Gimp::Net pass floats as floats.
- Date: Thu, 29 May 2014 02:03:46 +0000 (UTC)
commit 2920c45e48a5468af2c28bf24878662a4cfc24b2
Author: Ed J <edj src gnome org>
Date: Thu May 29 02:44:59 2014 +0100
Make Gimp::Net pass floats as floats.
Net/Net.xs | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/Net/Net.xs b/Net/Net.xs
index fb65f2c..6acb3a9 100644
--- a/Net/Net.xs
+++ b/Net/Net.xs
@@ -44,6 +44,7 @@ static void destroy_object (SV *sv)
* a num sv* array
* p len cont pv
* i int iv
+ * n double nv
* b stash sv blessed reference
* r simple reference
* h len (key sv)* hash (not yet supported!)
@@ -123,6 +124,10 @@ static void sv2net (int deobjectify, SV *s, SV *sv)
{
sv_catpvf (s,"i%ld:", (long)SvIV(sv));
}
+ else if (SvNOK(sv))
+ {
+ sv_catpvf (s,"n%.20lf:", (double)SvNV(sv));
+ }
else
{
char *str;
@@ -148,6 +153,7 @@ static SV *net2sv (int objectify, char **_s)
unsigned int ui, n;
int i, j;
long l;
+ double d;
char str[64];
switch (*s++)
@@ -156,6 +162,11 @@ static SV *net2sv (int objectify, char **_s)
sv = newSVsv (&PL_sv_undef);
break;
+ case 'n':
+ sscanf (s, "%lf:%n", &d, &n); s += n;
+ sv = newSVnv ((NV)d);
+ break;
+
case 'i':
sscanf (s, "%ld:%n", &l, &n); s += n;
sv = newSViv ((IV)l);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]