[gjs] [jsapi-utils] Add support for doubles
- From: Johan Dahlin <johan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] [jsapi-utils] Add support for doubles
- Date: Thu, 18 Feb 2010 00:07:26 +0000 (UTC)
commit ecf79ffc8e2b82034a961bfe1d8f471ca824e76d
Author: Johan Dahlin <johan gnome org>
Date: Wed Feb 17 21:50:34 2010 -0200
[jsapi-utils] Add support for doubles
Add support for doubles using the 'f' specifier
https://bugzilla.gnome.org/show_bug.cgi?id=610320
gjs/jsapi-util.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/gjs/jsapi-util.c b/gjs/jsapi-util.c
index ff268d6..9b58d90 100644
--- a/gjs/jsapi-util.c
+++ b/gjs/jsapi-util.c
@@ -1190,6 +1190,17 @@ gjs_parse_args (JSContext *context,
}
}
break;
+ case 'f': {
+ double num;
+ if (!JS_ValueToNumber(context, js_value, &num)) {
+ /* Our error message is going to be more useful */
+ JS_ClearPendingException(context);
+ arg_error_message = "Couldn't convert to double";
+ } else {
+ *((double*) arg_location) = num;
+ }
+ }
+ break;
default:
g_assert_not_reached ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]