[seed] Add SEED_DEBUG_IMPORTER and some debugging statements



commit 868ccb7ec9c567c2cc322eff5a9d4c596ca7daf3
Author: Robert Carr <racarr mireia (none)>
Date:   Sun Apr 12 17:38:53 2009 -0400

    Add SEED_DEBUG_IMPORTER and some debugging statements
---
 libseed/seed-debug.h    |    3 ++-
 libseed/seed-engine.c   |    3 ++-
 libseed/seed-importer.c |    9 +++++++++
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/libseed/seed-debug.h b/libseed/seed-debug.h
index 742f0c2..d9bd286 100644
--- a/libseed/seed-debug.h
+++ b/libseed/seed-debug.h
@@ -36,7 +36,8 @@ typedef enum
   SEED_DEBUG_INVOCATION = 1 << 5,
   SEED_DEBUG_SIGNAL = 1 << 6,
   SEED_DEBUG_STRUCTS = 1 << 7,
-  SEED_DEBUG_GTYPE = 1 << 8
+  SEED_DEBUG_GTYPE = 1 << 8,
+  SEED_DEBUG_IMPORTER = 1 << 9
 } SeedDebugFlag;
 
 #ifdef SEED_ENABLE_DEBUG
diff --git a/libseed/seed-engine.c b/libseed/seed-engine.c
index 589f7cd..09494f0 100644
--- a/libseed/seed-engine.c
+++ b/libseed/seed-engine.c
@@ -50,7 +50,8 @@ static const GDebugKey seed_debug_keys[] = {
   {"invocation", SEED_DEBUG_INVOCATION},
   {"structs", SEED_DEBUG_STRUCTS},
   {"construction", SEED_DEBUG_CONSTRUCTION},
-  {"gtype", SEED_DEBUG_GTYPE}
+  {"gtype", SEED_DEBUG_GTYPE},
+  {"importer", SEED_DEBUG_IMPORTER}
 };
 #endif /* SEED_ENABLE_DEBUG */
 
diff --git a/libseed/seed-importer.c b/libseed/seed-importer.c
index cd069d0..9f0f88e 100644
--- a/libseed/seed-importer.c
+++ b/libseed/seed-importer.c
@@ -428,6 +428,8 @@ seed_importer_handle_native_module (JSContextRef ctx,
   JSObjectRef module_obj;
   SeedModuleInitCallback init;
   gchar *file_path = g_strconcat (dir, "/", file, NULL);
+  
+  SEED_NOTE (IMPORTER, "Trying native module: %s", file_path);
 
   if (module_obj = g_hash_table_lookup (file_imports, file_path))
     {
@@ -453,6 +455,7 @@ seed_importer_handle_native_module (JSContextRef ctx,
   g_module_symbol (module, "seed_module_init", (gpointer *) &init);
   module_obj = (*init) (eng);
   g_hash_table_insert (file_imports, file_path, module_obj);
+  SEED_NOTE (IMPORTER, "Loaded native module");
   
   g_free (file_path);
       
@@ -471,9 +474,11 @@ seed_importer_handle_file (JSContextRef ctx,
   gchar *contents, *walk, *file_path;
   
   file_path = g_strconcat (dir, "/", file, NULL);
+  SEED_NOTE (IMPORTER, "Trying to import file: %s", file_path);
   
   if (global = g_hash_table_lookup (file_imports, file_path))
     {
+      SEED_NOTE (IMPORTER, "Using existing global");
       g_free (file_path);
       return global;
     }
@@ -482,6 +487,7 @@ seed_importer_handle_file (JSContextRef ctx,
     {
       if (g_file_test (file_path, G_FILE_TEST_IS_DIR))
 	{
+	  SEED_NOTE (IMPORTER, "File is directory");
 	  return JSObjectMake (ctx, importer_dir_class, file_path);
 	}
       return NULL;
@@ -512,6 +518,9 @@ seed_importer_handle_file (JSContextRef ctx,
 
 
   g_hash_table_insert (file_imports, file_path, global);
+  // Does leak...but it's a debug statement.
+  SEED_NOTE (IMPORTER, "Evaluated file, exception: %s", 
+	     *exception ? seed_exception_to_string (ctx, *exception) : "(null)");
   
   JSGlobalContextRelease ((JSGlobalContextRef) nctx);
   



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