seed r345 - trunk/libseed



Author: racarr
Date: Tue Nov 25 06:30:23 2008
New Revision: 345
URL: http://svn.gnome.org/viewvc/seed?rev=345&view=rev

Log:
More global context get-rid-of-ness.


Modified:
   trunk/libseed/seed-builtins.c
   trunk/libseed/seed-engine.c
   trunk/libseed/seed-exceptions.c
   trunk/libseed/seed-exceptions.h
   trunk/libseed/seed-gtype.c
   trunk/libseed/seed-signals.c
   trunk/libseed/seed-structs.c
   trunk/libseed/seed-types.c
   trunk/libseed/seed.h

Modified: trunk/libseed/seed-builtins.c
==============================================================================
--- trunk/libseed/seed-builtins.c	(original)
+++ trunk/libseed/seed-builtins.c	Tue Nov 25 06:30:23 2008
@@ -48,7 +48,7 @@
 		gchar *mes =
 			g_strdup_printf("Seed.include expected 1 argument, "
 							"got %d", argumentCount);
-		seed_make_exception(exception, "ArgumentError", mes);
+		seed_make_exception(ctx, exception, "ArgumentError", mes);
 		g_free(mes);
 		return JSValueMakeNull(ctx);
 	}
@@ -59,7 +59,7 @@
 	if (!buffer)
 	{
 		gchar *mes = g_strdup_printf("File not found: %s.\n", import_file);
-		seed_make_exception(exception, "FileNotFound", mes);
+		seed_make_exception(ctx, exception, "FileNotFound", mes);
 		g_free(mes);
 		return JSValueMakeNull(ctx);
 	}
@@ -98,7 +98,7 @@
 		gchar *mes =
 			g_strdup_printf("Seed.print Expected 1 argument," " got %d",
 							argumentCount);
-		seed_make_exception(exception, "ArgumentError", mes);
+		seed_make_exception(ctx, exception, "ArgumentError", mes);
 		g_free(mes);
 		return JSValueMakeNull(ctx);
 	}
@@ -130,7 +130,7 @@
 		gchar *mes =
 			g_strdup_printf("Seed.readline Expected 1 argument, "
 							"got %d", argumentCount);
-		seed_make_exception(exception, "ArgumentError", mes);
+		seed_make_exception(ctx, exception, "ArgumentError", mes);
 		g_free(mes);
 		return JSValueMakeNull(ctx);
 	}
@@ -167,7 +167,7 @@
 		gchar *mes =
 			g_strdup_printf("Seed.prototype Expected 1 argument, "
 							"got %d", argumentCount);
-		seed_make_exception(exception, "ArgumentError", mes);
+		seed_make_exception(ctx, exception, "ArgumentError", mes);
 		g_free(mes);
 		return JSValueMakeNull(ctx);
 	}
@@ -217,7 +217,7 @@
 		gchar *mes =
 			g_strdup_printf("Seed.introspection Expected 1 argument, "
 							"got %d", argumentCount);
-		seed_make_exception(exception, "ArgumentError", mes);
+		seed_make_exception(ctx, exception, "ArgumentError", mes);
 		g_free(mes);
 		return JSValueMakeNull(ctx);
 	}
@@ -283,7 +283,7 @@
 		gchar *mes = g_strdup_printf("Seed.check_syntax expected"
 									 "0 argument, got %d",
 									 argumentCount);
-		seed_make_exception(exception, "ArgumentError", mes);
+		seed_make_exception(ctx, exception, "ArgumentError", mes);
 		g_free(mes);
 	}
 	return JSValueMakeNull(ctx);
@@ -326,7 +326,7 @@
 		gchar *mes =
 			g_strdup_printf("Seed.setTimeout expected 2 arguments, "
 							"got %d", argumentCount);
-		seed_make_exception(exception, "ArgumentError", mes);
+		seed_make_exception(ctx, exception, "ArgumentError", mes);
 		g_free(mes);
 		return JSValueMakeBoolean(ctx, 0);
 	}
@@ -360,7 +360,7 @@
 		gchar *mes =
 			g_strdup_printf("Seed.closure expected 1 or 2" "arguments, got %d",
 							argumentCount);
-		seed_make_exception(exception, "ArgumentError", mes);
+		seed_make_exception(ctx, exception, "ArgumentError", mes);
 		g_free(mes);
 		return JSValueMakeNull(ctx);
 	}
@@ -400,7 +400,7 @@
 							" 2 arguments, got %d",
 							argumentCount);
 
-		seed_make_exception(exception, "ArgumentError", mes);
+		seed_make_exception(ctx, exception, "ArgumentError", mes);
 		g_free(mes);
 
 		return JSValueMakeNull(ctx);

Modified: trunk/libseed/seed-engine.c
==============================================================================
--- trunk/libseed/seed-engine.c	(original)
+++ trunk/libseed/seed-engine.c	Tue Nov 25 06:30:23 2008
@@ -63,7 +63,7 @@
 	{
 		if (!JSValueIsObject(ctx, arguments[0]))
 		{
-			seed_make_exception(exception, "ArgmuentError",
+			seed_make_exception(ctx, exception, "ArgmuentError",
 								"Constructor expects object as argument");
 			return (JSObjectRef) JSValueMakeNull(ctx);		
 		}
@@ -105,7 +105,7 @@
 	{
 		gchar *mes = g_strdup_printf("Constructor expects"
 									 " 1 argument, got %d", argumentCount);
-		seed_make_exception(exception, "ArgumentError", mes);
+		seed_make_exception(ctx, exception, "ArgumentError", mes);
 		g_free(mes);
 
 		return (JSObjectRef) JSValueMakeNull(ctx);
@@ -115,7 +115,7 @@
 	{
 		if (!JSValueIsObject(ctx, arguments[0]))
 		{
-			seed_make_exception(exception, "ArgmuentError",
+			seed_make_exception(ctx, exception, "ArgmuentError",
 								"Constructor expects object as argument");
 			g_type_class_unref(oclass);
 			return (JSObjectRef) JSValueMakeNull(ctx);
@@ -146,7 +146,7 @@
 			gchar *mes =
 				g_strdup_printf("Invalid property for construction: %s",
 								prop_name);
-			seed_make_exception(exception, "PropertyError", mes);
+			seed_make_exception(ctx, exception, "PropertyError", mes);
 
 			g_free(mes);
 			g_free(params);
@@ -212,7 +212,7 @@
 	{
 		gchar *mes = g_strdup_printf("GObject equals comparison expected"
 									 " 1 argument, got %d", argumentCount);
-		seed_make_exception(exception, "ArgumentError", mes);
+		seed_make_exception(ctx, exception, "ArgumentError", mes);
 		g_free(mes);
 
 		return JSValueMakeNull(ctx);
@@ -302,7 +302,7 @@
 					("Unable to make argument %d for" " function: %s. \n",
 					 i + 1,
 					 g_base_info_get_name((GIBaseInfo *) info));
-				seed_make_exception(exception, "ArgumentError", mes);
+				seed_make_exception(ctx, exception, "ArgumentError", mes);
 
 				g_free(mes);
 				g_base_info_unref((GIBaseInfo *) type_info);
@@ -781,7 +781,7 @@
 	g_object_set_property(obj, cproperty_name, &gval);
 	if (glib_message != 0)
 	{
-		seed_make_exception(exception, "PropertyError", glib_message);
+		seed_make_exception(context, exception, "PropertyError", glib_message);
 
 		return FALSE;
 	}
@@ -835,7 +835,7 @@
 
 	if (argumentCount == 0)
 	{
-		seed_make_exception(exception,
+		seed_make_exception(ctx, exception,
 							"ArgumentError",
 							"Seed.import_namespace"
 							" expected 1 or 2 arguments, got 0");

Modified: trunk/libseed/seed-exceptions.c
==============================================================================
--- trunk/libseed/seed-exceptions.c	(original)
+++ trunk/libseed/seed-exceptions.c	Tue Nov 25 06:30:23 2008
@@ -22,8 +22,10 @@
 #include "seed-private.h"
 
 void
-seed_make_exception(JSValueRef * exception,
-					const gchar * name, const gchar * message)
+seed_make_exception(JSContextRef ctx,
+					JSValueRef * exception,
+					const gchar * name, 
+					const gchar * message)
 {
 	JSStringRef js_name = 0;
 	JSStringRef js_message = 0;
@@ -36,15 +38,15 @@
 	if (name)
 	{
 		js_name = JSStringCreateWithUTF8CString(name);
-		js_name_ref = JSValueMakeString(eng->context, js_name);
+		js_name_ref = JSValueMakeString(ctx, js_name);
 	}
 	if (message)
 	{
 		js_message = JSStringCreateWithUTF8CString(message);
-		js_message_ref = JSValueMakeString(eng->context, js_message);
+		js_message_ref = JSValueMakeString(ctx, js_message);
 	}
 
-	exception_obj = JSObjectMake(eng->context, 0, NULL);
+	exception_obj = JSObjectMake(ctx, 0, NULL);
 	seed_object_set_property(exception_obj, "message", js_message_ref);
 	seed_object_set_property(exception_obj, "name", js_name_ref);
 
@@ -72,7 +74,10 @@
 			g_string_truncate(string, i - 1);
 
 	}
-	seed_make_exception(exception, string->str, error->message);
+	seed_make_exception(eng->context, 
+						exception,
+						string->str,
+						error->message);
 
 	g_string_free(string, TRUE);
 }

Modified: trunk/libseed/seed-exceptions.h
==============================================================================
--- trunk/libseed/seed-exceptions.h	(original)
+++ trunk/libseed/seed-exceptions.h	Tue Nov 25 06:30:23 2008
@@ -23,7 +23,7 @@
 
 #include "seed-private.h"
 
-void seed_make_exception(JSValueRef * exception,
+void seed_make_exception(JSContextRef ctx, JSValueRef * exception,
 						 const gchar * name, const gchar * message);
 
 void seed_make_exception_from_gerror(JSValueRef * exception, GError * e);

Modified: trunk/libseed/seed-gtype.c
==============================================================================
--- trunk/libseed/seed-gtype.c	(original)
+++ trunk/libseed/seed-gtype.c	Tue Nov 25 06:30:23 2008
@@ -214,7 +214,7 @@
 		gchar *mes =
 			g_strdup_printf("Property installation expected 1 argument",
 							" got %d \n", argumentCount);
-		seed_make_exception(exception, "ArgumentError", mes);
+		seed_make_exception(ctx, exception, "ArgumentError", mes);
 		g_free(mes);
 
 		return JSValueMakeNull(ctx);
@@ -224,7 +224,7 @@
 		// Might need to check if JSValueIsObject? Who knows with WebKit.
 		!JSValueIsObjectOfClass(ctx, arguments[0], seed_struct_class))
 	{
-		seed_make_exception(exception, "ArgumentError",
+		seed_make_exception(ctx, exception, "ArgumentError",
 							"Property installation expected a "
 							"GParamSpec as argument");
 		return JSValueMakeNull(ctx);
@@ -266,14 +266,14 @@
 	{
 		gchar *mes = g_strdup_printf("Signal constructor expected 1 argument",
 									 " got %d \n", argumentCount);
-		seed_make_exception(exception, "ArgumentError", mes);
+		seed_make_exception(ctx, exception, "ArgumentError", mes);
 		g_free(mes);
 		return (JSObjectRef) JSValueMakeNull(ctx);
 	}
 	if (JSValueIsNull(ctx, arguments[0]) ||
 		!JSValueIsObject(ctx, arguments[0]))
 	{
-		seed_make_exception(exception, "ArgumentError",
+		seed_make_exception(ctx, exception, "ArgumentError",
 							"Signal constructor expected object"
 							" as first argument");
 		return (JSObjectRef) JSValueMakeNull(ctx);
@@ -287,7 +287,7 @@
 	if (JSValueIsNull(ctx, jsname) ||
 		!JSValueIsString(ctx, jsname))
 	{
-		seed_make_exception(exception, "ArgumentError",
+		seed_make_exception(ctx, exception, "ArgumentError",
 							"Signal definition needs name property");
 		return (JSObjectRef) JSValueMakeNull(ctx);
 	}
@@ -544,13 +544,13 @@
 			g_strdup_printf("GType constructor expected 1 "
 							"argument, got %d \n",
 							argumentCount);
-		seed_make_exception(exception, "ArgumentError", mes);
+		seed_make_exception(ctx, exception, "ArgumentError", mes);
 		g_free(mes);
 		return (JSObjectRef) JSValueMakeNull(ctx);
 	}
 	if (!JSValueIsObject(ctx, arguments[0]))
 	{
-		seed_make_exception(exception, "ArgumentError",
+		seed_make_exception(ctx, exception, "ArgumentError",
 							"GType constructor expected a"
 							"class definition object. Got a nonobject");
 
@@ -566,7 +566,7 @@
 	new_name = seed_value_to_string(name, exception);
 	if (!JSValueIsNumber(ctx, parent_ref))
 	{
-		seed_make_exception(exception, "TypeError",
+		seed_make_exception(ctx, exception, "TypeError",
 							"GType constructor expected" " GType for parent");
 
 		return (JSObjectRef) JSValueMakeNull(ctx);

Modified: trunk/libseed/seed-signals.c
==============================================================================
--- trunk/libseed/seed-signals.c	(original)
+++ trunk/libseed/seed-signals.c	Tue Nov 25 06:30:23 2008
@@ -142,7 +142,7 @@
 		gchar *mes = g_strdup_printf("Signal connection expected"
 									 " 2 or 3 arguments. Got "
 									 "%d", argumentCount);
-		seed_make_exception(exception, "ArgumentError", mes);
+		seed_make_exception(ctx, exception, "ArgumentError", mes);
 
 		g_free(mes);
 		return JSValueMakeNull(ctx);
@@ -287,7 +287,7 @@
 									 g_type_name(query.itype),
 									 query.n_params,
 									 argumentCount);
-		seed_make_exception(exception, "ArgumentError", mes);
+		seed_make_exception(ctx, exception, "ArgumentError", mes);
 		g_free(mes);
 		return JSValueMakeNull(ctx);
 	}
@@ -333,7 +333,7 @@
 		gchar *mes = g_strdup_printf("Signal connection expected"
 									 " 1, 2, or 3 arguments. Got "
 									 "%d", argumentCount);
-		seed_make_exception(exception, "ArgumentError", mes);
+		seed_make_exception(ctx, exception, "ArgumentError", mes);
 
 		g_free(mes);
 		return JSValueMakeNull(ctx);

Modified: trunk/libseed/seed-structs.c
==============================================================================
--- trunk/libseed/seed-structs.c	(original)
+++ trunk/libseed/seed-structs.c	Tue Nov 25 06:30:23 2008
@@ -541,7 +541,7 @@
 			gchar *mes =
 				g_strdup_printf("Invalid property for construction: %s",
 								prop_name);
-			seed_make_exception(exception, "PropertyError", mes);
+			seed_make_exception(eng->context, exception, "PropertyError", mes);
 			
 			g_free(mes);
 			

Modified: trunk/libseed/seed-types.c
==============================================================================
--- trunk/libseed/seed-types.c	(original)
+++ trunk/libseed/seed-types.c	Tue Nov 25 06:30:23 2008
@@ -826,7 +826,7 @@
 	{
 		if (!JSValueIsNull(eng->context, val))
 		{
-			seed_make_exception(exception, "ConversionError",
+			seed_make_exception(eng->context, exception, "ConversionError",
 								"Can not convert Javascript value to boolean");
 			return 0;
 		}
@@ -848,7 +848,7 @@
 	{
 		if (!JSValueIsNull(eng->context, val))
 		{
-			seed_make_exception(exception, "ConversionError",
+			seed_make_exception(eng->context, exception, "ConversionError",
 								"Can not convert Javascript value to"
 								" boolean");
 		}
@@ -868,7 +868,7 @@
 	if (!JSValueIsNumber(eng->context, val))
 	{
 		if (!JSValueIsNull(eng->context, val))
-			seed_make_exception(exception, "ConversionError",
+			seed_make_exception(eng->context, exception, "ConversionError",
 								"Can not convert Javascript value to" " int");
 		return 0;
 	}
@@ -888,7 +888,7 @@
 	if (!JSValueIsNumber(eng->context, val))
 	{
 		if (!JSValueIsNull(eng->context, val))
-			seed_make_exception(exception, "ConversionError",
+			seed_make_exception(eng->context, exception, "ConversionError",
 								"Can not convert Javascript value to" " gchar");
 		return 0;
 	}
@@ -897,7 +897,7 @@
 
 	if (cv < G_MININT8 || cv > G_MAXINT8)
 	{
-		seed_make_exception(exception, "ConversionError",
+		seed_make_exception(eng->context, exception, "ConversionError",
 							"Javascript number out of range of gchar");
 		return 0;
 	}
@@ -917,7 +917,7 @@
 	if (!JSValueIsNumber(eng->context, val))
 	{
 		if (!JSValueIsNull(eng->context, val))
-			seed_make_exception(exception, "ConversionError",
+			seed_make_exception(eng->context, exception, "ConversionError",
 								"Can not convert Javascript value to"
 								" guchar");
 		return 0;
@@ -927,7 +927,7 @@
 
 	if (cv > G_MAXUINT8)
 	{
-		seed_make_exception(exception, "ConversionError",
+		seed_make_exception(eng->context, exception, "ConversionError",
 							"Javascript number out of range of guchar");
 		return 0;
 	}
@@ -945,7 +945,7 @@
 	if (!JSValueIsNumber(eng->context, val))
 	{
 		if (!JSValueIsNull(eng->context, val))
-			seed_make_exception(exception, "ConversionError",
+			seed_make_exception(eng->context, exception, "ConversionError",
 								"Can not convert Javascript value to" " long");
 		return 0;
 	}
@@ -963,7 +963,7 @@
 	if (!JSValueIsNumber(eng->context, val))
 	{
 		if (!JSValueIsNull(eng->context, val))
-			seed_make_exception(exception, "ConversionError",
+			seed_make_exception(eng->context, exception, "ConversionError",
 								"Can not convert Javascript value to" " ulong");
 
 		return 0;
@@ -982,7 +982,7 @@
 	if (!JSValueIsNumber(eng->context, val))
 	{
 		if (!JSValueIsNull(eng->context, val))
-			seed_make_exception(exception, "ConversionError",
+			seed_make_exception(eng->context, exception, "ConversionError",
 								"Can not convert Javascript value to"
 								" gint64");
 
@@ -1002,7 +1002,7 @@
 	if (!JSValueIsNumber(eng->context, val))
 	{
 		if (!JSValueIsNull(eng->context, val))
-			seed_make_exception(exception, "ConversionError",
+			seed_make_exception(eng->context, exception, "ConversionError",
 								"Can not convert Javascript value to"
 								" guint64");
 
@@ -1022,7 +1022,7 @@
 	if (!JSValueIsNumber(eng->context, val))
 	{
 		if (!JSValueIsNull(eng->context, val))
-			seed_make_exception(exception, "ConversionError",
+			seed_make_exception(eng->context, exception, "ConversionError",
 								"Can not convert Javascript value to"
 								" gfloat");
 		return 0;
@@ -1041,7 +1041,7 @@
 	if (!JSValueIsNumber(eng->context, val))
 	{
 		if (!JSValueIsNull(eng->context, val))
-			seed_make_exception(exception, "ConversionError",
+			seed_make_exception(eng->context, exception, "ConversionError",
 								"Can not convert Javascript value to"
 								" double");
 		return 0;
@@ -1121,7 +1121,7 @@
 		return 0;
 	if (!seed_value_is_gobject(val))
 	{
-		seed_make_exception(exception, "ConversionError",
+		seed_make_exception(eng->context, exception, "ConversionError",
 							"Attempt to convert from"
 							" non GObject to GObject");
 		return NULL;

Modified: trunk/libseed/seed.h
==============================================================================
--- trunk/libseed/seed.h	(original)
+++ trunk/libseed/seed.h	Tue Nov 25 06:30:23 2008
@@ -55,7 +55,8 @@
 SeedScript *seed_make_script(const gchar * s, const gchar * source_url,
 							 gint line_number);
 SeedException seed_script_exception(SeedScript * s);
-SeedException seed_make_exception(gchar * name, gchar * message);
+void seed_make_exception(SeedContext ctx, SeedException e, 
+						 gchar * name, gchar * message);
 gchar *seed_exception_get_name(SeedException e);
 gchar *seed_exception_get_message(SeedException e);
 guint seed_exception_get_line(SeedException e);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]