[gjs/cairo] [jsapi-utils] Add support for doubles



commit bdfc48c6661853173c3dd9181b89dcb6eecddb1a
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

 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..229547c 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 unsigned integer";
+                } 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]