gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog libbase/log.cpp libbase/log.h s...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog libbase/log.cpp libbase/log.h s...
Date: Tue, 08 Aug 2006 10:51:36 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  06/08/08 10:51:36

Modified files:
        .              : ChangeLog 
        libbase        : log.cpp log.h 
        server         : ActionExec.cpp action_buffer.cpp array.cpp 
                         as_environment.cpp button.cpp morph.cpp 
                         styles.cpp 
        server/swf     : ASHandlers.cpp 

Log message:
                * libbase/log.cpp (log_action): don't check getActionDump(),
                  assume callers use IF_VERBOSE_ACTION instead.
                * libbase/log.h: added IF_VERBOSE_ACTION and VERBOSE_ACTION
                  macros (latter is defined by default).
                * server/ActionExec.cpp, server/action_buffer.cpp, 
server/array.cpp,
                  server/as_environment.cpp, server/button.cpp, 
server/morph.cpp,
                  server/styles.cpp, server/swf/ASHandlers.cpp: wrap all 
log_action
                  calls inside IF_VERBOSE_ACTION

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.604&r2=1.605
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/log.cpp?cvsroot=gnash&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/log.h?cvsroot=gnash&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/gnash/server/ActionExec.cpp?cvsroot=gnash&r1=1.22&r2=1.23
http://cvs.savannah.gnu.org/viewcvs/gnash/server/action_buffer.cpp?cvsroot=gnash&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/gnash/server/array.cpp?cvsroot=gnash&r1=1.34&r2=1.35
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_environment.cpp?cvsroot=gnash&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/gnash/server/button.cpp?cvsroot=gnash&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/gnash/server/morph.cpp?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/server/styles.cpp?cvsroot=gnash&r1=1.14&r2=1.15
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/ASHandlers.cpp?cvsroot=gnash&r1=1.47&r2=1.48

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.604
retrieving revision 1.605
diff -u -b -r1.604 -r1.605
--- ChangeLog   8 Aug 2006 10:16:25 -0000       1.604
+++ ChangeLog   8 Aug 2006 10:51:36 -0000       1.605
@@ -1,5 +1,16 @@
 2006-08-08 Sandro Santilli <address@hidden>
 
+       * libbase/log.cpp (log_action): don't check getActionDump(),
+         assume callers use IF_VERBOSE_ACTION instead.
+       * libbase/log.h: added IF_VERBOSE_ACTION and VERBOSE_ACTION
+         macros (latter is defined by default).
+       * server/ActionExec.cpp, server/action_buffer.cpp, server/array.cpp,
+         server/as_environment.cpp, server/button.cpp, server/morph.cpp,
+         server/styles.cpp, server/swf/ASHandlers.cpp: wrap all log_action
+         calls inside IF_VERBOSE_ACTION
+
+2006-08-08 Sandro Santilli <address@hidden>
+
        * server/text.cpp: wrapper log_parse calls in IF_VERBOSE_PARSE.
        * libbase/log.h: fixed IF_VERBOSE_PARSE macro
 

Index: libbase/log.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/log.cpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- libbase/log.cpp     8 Aug 2006 09:50:54 -0000       1.17
+++ libbase/log.cpp     8 Aug 2006 10:51:36 -0000       1.18
@@ -195,10 +195,12 @@
 void
 log_action(const char* fmt, ...)
 {
+#if 0 // callers shoudl always use IF_VERBOSE_ACTION
     if ( ! dbglogfile.getActionDump() )
     {
         return;
     }
+#endif
 
     va_list ap;
     char tmp[BUFFER_SIZE];

Index: libbase/log.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/log.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- libbase/log.h       8 Aug 2006 10:14:21 -0000       1.12
+++ libbase/log.h       8 Aug 2006 10:51:36 -0000       1.13
@@ -188,12 +188,21 @@
 // Undefine this to completely remove parse debugging at compile-time
 #define VERBOSE_PARSE 1
 
+// Undefine this to completely remove action debugging at compile-time
+#define VERBOSE_ACTION 1
+
 #ifdef VERBOSE_PARSE
 #define IF_VERBOSE_PARSE(x) do { if ( dbglogfile.getParserDump() ) { x; } } 
while (0);
 #else
 #define IF_VERBOSE_PARSE(x)
 #endif
 
+#ifdef VERBOSE_ACTION
+#define IF_VERBOSE_ACTION(x) do { if ( dbglogfile.getActionDump() ) { x; } } 
while (0);
+#else
+#define IF_VERBOSE_ACTION(x)
+#endif
+
 extern LogFile dbglogfile;
 
 struct __Host_Function_Report__ {

Index: server/ActionExec.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/ActionExec.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- server/ActionExec.cpp       7 Aug 2006 20:43:38 -0000       1.22
+++ server/ActionExec.cpp       8 Aug 2006 10:51:36 -0000       1.23
@@ -130,14 +130,14 @@
     //UNUSED(original_target);         // Avoid warnings.
 
 #if DEBUG_STACK
-       if (dbglogfile.getActionDump()) {
+       IF_VERBOSE_ACTION (
                log_action("at ActionExec operator() start, pc=%zd, 
stop_pc=%zd, code.size=%zd.", pc, stop_pc, code.size());
                stringstream ss;
                env.dump_stack(ss);
                env.dump_global_registers(ss);
                env.dump_local_registers(ss);
                log_action("%s", ss.str().c_str());
-       }
+       );
 #endif
 
     while (pc<stop_pc)
@@ -153,10 +153,10 @@
        // Get the opcode.
        uint8_t action_id = code[pc];
 
-       if (dbglogfile.getActionDump()) {
+       IF_VERBOSE_ACTION (
                log_action("\nEX:\t");
                code.log_disasm(pc);
-       }
+       );
 
        // Set default next_pc offset, control flow action handlers
        // will be able to reset it. 
@@ -180,14 +180,14 @@
        ash.execute((action_type)action_id, *this);
 
 #if DEBUG_STACK
-       if (dbglogfile.getActionDump()) {
+       IF_VERBOSE_ACTION (
                log_action( " PC is now %zd.", pc);
                stringstream ss;
                env.dump_stack(ss);
                env.dump_global_registers(ss);
                env.dump_local_registers(ss);
                log_action("%s", ss.str().c_str());
-       }
+       );
 #endif
 
        // Control flow actions will change the PC (next_pc)

Index: server/action_buffer.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/action_buffer.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- server/action_buffer.cpp    6 Aug 2006 02:00:54 -0000       1.12
+++ server/action_buffer.cpp    8 Aug 2006 10:51:36 -0000       1.13
@@ -105,15 +105,6 @@
            }
        }
 
-#if 0 // don't log while reading, do it while executing instead
-      // (actions are interpreted at that time, anyway)
-       dbglogfile.setStamp(false);
-       log_action("PC index: %d:\t", pc);
-       if (dbglogfile.getActionDump()) {
-           log_disasm(instruction_start);
-       }
-#endif
-       
        if (action_id == SWF::ACTION_END)
        {
            // end of action buffer.

Index: server/array.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/array.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -b -r1.34 -r1.35
--- server/array.cpp    27 Jul 2006 01:47:11 -0000      1.34
+++ server/array.cpp    8 Aug 2006 10:51:36 -0000       1.35
@@ -150,7 +150,7 @@
        as_object(getArrayInterface()), // pass Array inheritance
        elements(0)
 {
-    log_action("%s : %p\n", __FUNCTION__, (void*)this);
+    //log_action("%s : %p\n", __FUNCTION__, (void*)this);
 }
 
 as_array_object::as_array_object(const as_array_object& other)
@@ -158,7 +158,7 @@
        as_object(other),
        elements(other.elements)
 {
-    log_action("%s : %p\n", __FUNCTION__, (void*)this);
+    //log_action("%s : %p\n", __FUNCTION__, (void*)this);
 }
 
 int
@@ -198,7 +198,7 @@
        // If the array is empty, report an error and return undefined!
        if (elements.size() <= 0)
        {
-           log_action("ERROR: tried to pop element from back of empty 
array!\n");
+           log_warning("tried to pop element from back of empty array, 
returning undef!\n");
                return as_value(); // undefined
        }
 
@@ -214,7 +214,7 @@
        // If the array is empty, report an error and return undefined!
        if (elements.size() <= 0)
        {
-               log_action("ERROR: tried to shift element from front of empty 
array!\n");
+               log_warning("tried to shift element from front of empty array, 
returning undef!\n");
                return as_value(); // undefined
        }
 
@@ -342,7 +342,7 @@
 {
        if ( name == "length" ) 
        {
-               log_action("assigning to Array.length unsupported");
+               log_warning("Attempt to assign to Array.length - ignored");
                return;
        }
 
@@ -502,21 +502,6 @@
        fn.result->set_undefined();
 }
 
-// Callback to report array length
-#if 0 // replaced by get_member override
-static void
-array_length(const fn_call& fn)
-{
-       assert(dynamic_cast<as_array_object*>(fn.this_ptr));
-       as_array_object* array = \
-               static_cast<as_array_object*>(fn.this_ptr);
-
-       log_action("calling array length, result:%d\n",array->size());
-
-       fn.result->set_int(array->size());
-}
-#endif
-
 // Callback to push values to the back of an array
 static void
 array_push(const fn_call& fn)
@@ -525,7 +510,9 @@
        as_array_object* array = \
                static_cast<as_array_object*>(fn.this_ptr);
 
+               IF_VERBOSE_ACTION (
        log_action("calling array push, pushing %d values onto back of 
array\n",fn.nargs);
+               );
 
        for (int i=0;i<fn.nargs;i++)
                array->push(fn.arg(i));
@@ -541,7 +528,9 @@
        as_array_object* array = \
                static_cast<as_array_object*>(fn.this_ptr);
 
+               IF_VERBOSE_ACTION (
        log_action("calling array unshift, pushing %d values onto front of 
array\n",fn.nargs);
+               );
 
        for (int i=fn.nargs-1;i>=0;i--)
                array->unshift(fn.arg(i));
@@ -559,7 +548,10 @@
 
        // Get our index, log, then return result
        (*fn.result) = array->pop();
+
+               IF_VERBOSE_ACTION (
        log_action("calling array pop, result:%s, new array 
size:%d\n",fn.result->to_string(),array->size());
+               );
 }
 
 // Callback to pop a value from the front of an array
@@ -572,7 +564,10 @@
 
        // Get our index, log, then return result
        (*fn.result) = array->shift();
+
+               IF_VERBOSE_ACTION (
        log_action("calling array shift, result:%s, new array 
size:%d\n",fn.result->to_string(),array->size());
+               );
 }
 
 // Callback to reverse the position of the elements in an array
@@ -587,7 +582,9 @@
 
        fn.result->set_as_object(array);
 
+               IF_VERBOSE_ACTION (
        log_action("called array reverse, result:%s, new array 
size:%d\n",fn.result->to_string(),array->size());
+               );
        
 }
 
@@ -613,9 +610,6 @@
 static void
 array_to_string(const fn_call& fn)
 {
-       log_action("array_to_string called, nargs = %d, "
-                       "this_ptr = %p",
-                       fn.nargs, (void*)fn.this_ptr);
 
        assert(dynamic_cast<as_array_object*>(fn.this_ptr));
        as_array_object* array = \
@@ -623,7 +617,13 @@
 
        std::string ret = array->toString();
 
+               IF_VERBOSE_ACTION
+               (
+       log_action("array_to_string called, nargs = %d, "
+                       "this_ptr = %p",
+                       fn.nargs, (void*)fn.this_ptr);
        log_action("to_string result is: %s", ret.c_str());
+               );
 
        fn.result->set_string(ret.c_str());
 }
@@ -674,8 +674,8 @@
 
        if (fn.nargs > 2)
        {
-               log_action("ERROR: More than 2 arguments sent to slice, and I 
don't know what to do with them!\n");
-               log_action("ERROR: Ignoring them as we continue...\n");
+               log_error("More than 2 arguments sent to slice, and I don't 
know what to do with them!\n"
+                       "Ignoring them as we continue...\n");
        }
 
        // They passed no arguments: simply duplicate the array
@@ -696,7 +696,8 @@
        // if it's still negative, this is a problem
        if (startindex < 0 || (unsigned int)startindex > array->size())
        {
-               log_action("ERROR: bad startindex sent to array_slice! 
startindex: %s, Length: %d",
+               log_error("Bad startindex sent to array_slice! startindex: %s, 
Length: %d. "
+                       "Ignoring call.",
                        fn.arg(0).to_string(),array->size());
                return;                         
        }
@@ -711,7 +712,8 @@
                endindex++;
                if (endindex < 0)
                {
-                       log_action("ERROR: bad endindex sent to array_slice! 
endindex: %s, length: %d",
+                       log_error("bad endindex sent to array_slice! endindex: 
%s, length: %d"
+                               "Ignoring call.",
                                fn.arg(1).to_string(),array->size());
                        return;                         
                }
@@ -736,7 +738,9 @@
 void
 array_new(const fn_call& fn)
 {
+       IF_VERBOSE_ACTION (
        log_action("array_new called, nargs = %d", fn.nargs);
+       );
 
        //smart_ptr<as_array_object>    ao = new as_array_object;
        as_array_object* ao = new as_array_object;
@@ -769,7 +773,9 @@
                }
        }
 
+       IF_VERBOSE_ACTION (
                log_action("array_new setting object %p in result", (void*)ao);
+       );
 
        //fn.result->set_as_object(ao.get_ptr());
        fn.result->set_as_object(ao);

Index: server/as_environment.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_environment.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- server/as_environment.cpp   3 Aug 2006 16:48:11 -0000       1.14
+++ server/as_environment.cpp   8 Aug 2006 10:51:36 -0000       1.15
@@ -132,8 +132,10 @@
     }
     
     // Fallback.
+       IF_VERBOSE_ACTION (
     log_action("get_variable_raw(\"%s\" failed, returning UNDEFINED.",
               varname.c_str());
+       );
 
     return as_value();
 }
@@ -153,8 +155,10 @@
     const as_value& val,
     const std::vector<with_stack_entry>& with_stack)
 {
+       IF_VERBOSE_ACTION (
     log_action("-------------- %s = %s",
               varname.c_str(), val.to_string());
+       );
 
     // Path lookup rigamarole.
     character* target = m_target;

Index: server/button.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/button.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- server/button.cpp   6 Aug 2006 02:00:54 -0000       1.23
+++ server/button.cpp   8 Aug 2006 10:51:36 -0000       1.24
@@ -927,8 +927,11 @@
                        m_conditions = in->read_u16();
                }
 
-               // Read actions.
+               IF_VERBOSE_ACTION (
                log_action("-- actions in button\n"); // @@ need more info 
about which actions
+               );
+
+               // Read actions.
                action_buffer*  a = new action_buffer;
                a->read(in);
                m_actions.push_back(a);

Index: server/morph.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/morph.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- server/morph.cpp    7 Jun 2006 03:03:21 -0000       1.4
+++ server/morph.cpp    8 Aug 2006 10:51:36 -0000       1.5
@@ -34,8 +34,12 @@
        void shape_morph_def::display(character *inst)
        {
                float ratio = inst->m_ratio;
+
+               IF_VERBOSE_ACTION (
                log_action("smd: displaying %d at ratio %g\n",
                                          inst->m_id, ratio);
+               );
+
                matrix mat = inst->get_world_matrix();
                cxform cx = inst->get_world_cxform();
 
@@ -55,8 +59,10 @@
                                                      float ratio)
                const
        {
+               IF_VERBOSE_ACTION (
                log_action("smd: tesselating at ratio %g\n",
                                          ratio);
+               );
                
                // XXX sharing
                tesselate::begin_shape(accepter, error_tolerance);

Index: server/styles.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/styles.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- server/styles.cpp   8 Aug 2006 09:50:54 -0000       1.14
+++ server/styles.cpp   8 Aug 2006 10:51:36 -0000       1.15
@@ -169,9 +169,9 @@
         // TWIPS-to-texcoords matrix.
         m_bitmap_matrix.set_inverse(m);
 
-        if (dbglogfile.getActionDump()) {
+        IF_VERBOSE_PARSE(
             m_bitmap_matrix.print();
-        }
+        );
     }
     else
     {

Index: server/swf/ASHandlers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/swf/ASHandlers.cpp,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -b -r1.47 -r1.48
--- server/swf/ASHandlers.cpp   7 Aug 2006 21:06:55 -0000       1.47
+++ server/swf/ASHandlers.cpp   8 Aug 2006 10:51:36 -0000       1.48
@@ -109,7 +109,10 @@
 
     if (constructor.get_type() == as_value::C_FUNCTION)
     {
+               IF_VERBOSE_ACTION (
         log_action("Constructor is a C_FUNCTION");
+               );
+
         // C function is responsible for creating the new object and setting 
members.
         fn_call call(&new_obj, NULL, &env, nargs, first_arg_index);
 
@@ -120,21 +123,32 @@
     {
         // This function is being used as a constructor; make sure
         // it has a prototype object.
+               IF_VERBOSE_ACTION (
         log_action("Constructor is an AS_FUNCTION");
+               );
         
         // a built-in class takes care of assigning a prototype
        // TODO: change this
-        if ( ctor_as_func->isBuiltin() ) {
+        if ( ctor_as_func->isBuiltin() )
+       {
+
+               IF_VERBOSE_ACTION (
             log_action("it's a built-in class");
+               );
+
             fn_call call(&new_obj, NULL, &env, nargs, first_arg_index);
             (*ctor_as_func)(call);
-        } else {
+        }
+       else
+       {
             // Set up the prototype.
             as_value   proto;
             bool func_has_prototype = ctor_as_func->get_member("prototype", 
&proto);
             assert(func_has_prototype);
             
+               IF_VERBOSE_ACTION (
             log_action("constructor prototype is %s", proto.to_string());
+               );
             
             // Create an empty object, with a ref to the constructor's 
prototype.
             smart_ptr<as_object> new_obj_ptr(new as_object(proto.to_object()));
@@ -634,7 +648,9 @@
        size_t url_len = strlen(url)+1;
        const char* target = code.read_string(pc+3+url_len);
 
+               IF_VERBOSE_ACTION (
        log_action("GetUrl: target=%s url=%s", target, url);
+               );
 
        CommonGetUrl(env, target, url, 0u);
 }
@@ -717,9 +733,11 @@
                  
        if (new_target == NULL)
        {
+               IF_VERBOSE_ACTION (
                log_action("ERROR: Couldn't find movie \"%s\" "
                        "to set target to! Not setting target at all...",
                        (const char *)target_name);
+               );
        }
        else
        {
@@ -905,6 +923,7 @@
 SWFHandlers::ActionGetVariable(ActionExec& thread)
 {
 //    GNASH_REPORT_FUNCTION;
+
     as_environment& env = thread.env;
     ensure_stack(env, 1); // variable name
 
@@ -913,6 +932,9 @@
     
     as_value variable = env.get_variable(var_string);
     env.push(variable);
+
+       IF_VERBOSE_ACTION
+       (
     if (variable.to_object() == NULL) {
         log_action("-- get var: %s=%s",
                    var_string.c_str(),
@@ -923,6 +945,7 @@
                    variable.to_tu_string().c_str(),
                    (void*)variable.to_object());
     }
+       );
 }
 
 void
@@ -936,7 +959,10 @@
        ensure_stack(env, 2); 
 
        env.set_variable(env.top(1).to_tu_string(), env.top(0));
+
+               IF_VERBOSE_ACTION (
        log_action("-- set var: %s", env.top(1).to_string());
+               );
 
        env.drop(2);
 }
@@ -971,7 +997,7 @@
     
        if (new_target == NULL)
        {
-               log_action("ERROR: "
+               log_warning(
                        " Couldn't find movie \"%s\" to set target to!"
                        " Not setting target at all...",
                        target_name.c_str());
@@ -1193,9 +1219,11 @@
        // Invalid args!
        if (!super || ! instance)
        {
+               IF_VERBOSE_ACTION (
                log_action("-- %s instance_of %s (invalid args?)",
                        env.top(1).to_string(),
                        env.top(0).to_string());
+               );
 
                env.drop(1);
                env.top(0) = as_value(); 
@@ -1359,13 +1387,17 @@
        int16_t length = code.read_int16(pc+1);
        assert( length >= 0 );
 
+               IF_VERBOSE_ACTION (
        log_action("-------------- push len=%d", length);
+               );
 
        //---------------
        size_t i = pc;
        while (i - pc < static_cast<size_t>(length)) {
              uint8_t type = code[3 + i];
+               IF_VERBOSE_ACTION (
                log_action("-------------- push type=%d", type);
+               );
              i++;
              if (type == 0) {
                  // string
@@ -1373,40 +1405,52 @@
                  i += strlen(str) + 1;
                  env.push(str);
                  
+               IF_VERBOSE_ACTION (
                  log_action("-------------- pushed '%s'", str);
+               );
              } else if (type == 1) {
                
                  float f = code.read_float_little(i+3);
                  i += 4;
                  env.push(f);
+               IF_VERBOSE_ACTION (
                  log_action("-------------- pushed '%g'", f);
+               );
              } else if (type == 2) {
                  as_value nullvalue;
                  nullvalue.set_null();
                  env.push(nullvalue);  
                  
+               IF_VERBOSE_ACTION (
                  log_action("-------------- pushed NULL");
+               );
              } else if (type == 3) {
                  env.push(as_value());
                  
+               IF_VERBOSE_ACTION (
                  log_action("-------------- pushed UNDEFINED");
+               );
              } else if (type == 4) {
                  // contents of register
                  uint8_t reg = code[3 + i];
                  ++i;
                  if ( thread.isFunction2() ) {
                      env.push(env.local_register(reg));
+               IF_VERBOSE_ACTION (
                      log_action("-------------- pushed local register[%d] = 
'%s'",
                                  reg,
                                  env.top(0).to_string());
+               );
                  } else if (reg >= 4) {
                      env.push(as_value());
                      log_error("push register[%d] -- register out of bounds!", 
reg);
                  } else {
                      env.push(env.global_register(reg));
+               IF_VERBOSE_ACTION (
                      log_action("-------------- pushed global register[%d] = 
'%s'",
                                  reg,
                                  env.top(0).to_string());
+               );
                  }
                  
              } else if (type == 5) {
@@ -1415,14 +1459,18 @@
 //                       log_msg("bool(%d)", bool_val);
                  env.push(bool_val);
                  
+               IF_VERBOSE_ACTION (
                  log_action("-------------- pushed %s",
                             (bool_val ? "true" : "false"));
+               );
              } else if (type == 6) {
                  double d = code.read_double_wacky(i+3);
                  i += 8;
                  env.push(d);
                  
+               IF_VERBOSE_ACTION (
                  log_action("-------------- pushed double %g", d);
+               );
              } else if (type == 7) {
                  // int32
                  int32_t val = code.read_int32(i+3);
@@ -1430,32 +1478,45 @@
                  
                  env.push(val);
                  
+               IF_VERBOSE_ACTION (
                  log_action("-------------- pushed int32 %d",val);
+               );
+
              } else if (type == 8) {
                  int id = code[3 + i];
                  i++;
                  if ( id < (int) code.dictionary_size() ) {
                      env.push( code.dictionary_get(id) );
                      
+               IF_VERBOSE_ACTION (
                      log_action("-------------- pushed '%s'",
                                 code.dictionary_get(id));
+               );
+
                  } else {
                      log_error("dict_lookup(%d) is out of bounds!", id);
                      env.push(0);
+               IF_VERBOSE_ACTION (
                      log_action("-------------- pushed 0");
+               );
+
                  }
              } else if (type == 9) {
                  int   id = code.read_int16(i+3);
                  i += 2;
                  if ( id < (int) code.dictionary_size() ) {
                      env.push( code.dictionary_get(id) );
+               IF_VERBOSE_ACTION (
                      log_action("-------------- pushed '%s'",
                                code.dictionary_get(id) );
+               );
                  } else {
                      log_error("dict_lookup(%d) is out of bounds!", id);
                      env.push(0);
                      
+               IF_VERBOSE_ACTION (
                      log_action("-------------- pushed 0");
+               );
                  }
              }
        }
@@ -1853,11 +1914,13 @@
 
     ensure_stack(env, 2); // classname, nargs
 
-//    doActionNew(env, with_stack);
-
     as_value   classname = env.pop();
+
+       IF_VERBOSE_ACTION (
     log_action("---new object: %s",
                classname.to_tu_string().c_str());
+       );
+
     int        nargs = (int) env.pop().to_number();
 
     ensure_stack(env, nargs); // previous 2 entries popped
@@ -1870,10 +1933,6 @@
     env.drop(nargs);
     env.push(new_obj);
 
-#if 0
-    log_msg("new object at %p", new_obj.to_object());
-#endif
-    
 }
 
 void
@@ -2036,7 +2095,9 @@
                        const char* val = it->first.c_str();
 
                        env.push(as_value(val));
+                       IF_VERBOSE_ACTION (
                        log_action("---enumerate - push: %s", val);
+                       );
                }
         
        }
@@ -2063,7 +2124,9 @@
                        const char* val = it->first.c_str();
 
                        env.push(as_value(val));
+                       IF_VERBOSE_ACTION (
                        log_action("---enumerate - push: %s", val);
+                       );
                }
             
        };
@@ -2087,7 +2150,10 @@
        // The end of the enumeration, don't set top(0) *before*
        // fetching the as_object* obj above or it will get lost
        env.top(0).set_null();
+
+       IF_VERBOSE_ACTION (
        log_action("---enumerate - push: NULL");
+       );
 
        if ( ! obj )
        {
@@ -2209,8 +2275,10 @@
         return;
     }
     
+       IF_VERBOSE_ACTION (
     log_action(" ActionGetMember: target: %s (object %p)",
                target.to_string(), (void*)obj);
+       );
     
     // Special case: String has a member "length"
     // @@ FIXME: we shouldn't have all this "special" cases --strk;
@@ -2222,9 +2290,11 @@
             env.top(1).set_undefined();
         }
         
+       IF_VERBOSE_ACTION (
         log_action("-- get_member %s=%s",
                    member_name.to_tu_string().c_str(),
                    env.top(1).to_tu_string().c_str());
+       );
     }
     env.drop(1);
     
@@ -2239,19 +2309,30 @@
     ensure_stack(env, 3); // value, member, object
 
     as_object* obj = env.top(2).to_object();
-    if (obj) {
+
+
+       if (obj)
+       {
         obj->set_member(env.top(1).to_tu_string(), env.top(0));
+               IF_VERBOSE_ACTION (
         log_action("-- set_member %s.%s=%s",
                    env.top(2).to_tu_string().c_str(),
                    env.top(1).to_tu_string().c_str(),
                    env.top(0).to_tu_string().c_str());
-    } else {
+               );
+       }
+       else
+       {
+               IF_VERBOSE_ACTION (
         // Invalid object, can't set.
         log_action("-- set_member %s.%s=%s on invalid object!",
                    env.top(2).to_tu_string().c_str(),
                    env.top(1).to_tu_string().c_str(),
                    env.top(0).to_tu_string().c_str());
+               );
     }
+
+
     env.drop(3);
 }
 
@@ -2290,19 +2371,22 @@
 
     // Get name of the method
     const tu_string &method_name = env.top(0).to_tu_string();
-    log_action(" method name: %s", method_name.c_str());
 
     // Get an object
     as_value& obj_value = env.top(1);
     as_object *obj = obj_value.to_object();
-    log_action(" method object: %p", (void*)obj);
 
     // Get number of arguments
     int nargs = static_cast<int>(env.top(2).to_number());
-    log_action(" method nargs: %d", nargs);
 
     ensure_stack(env, 3+nargs); // actual args
 
+       IF_VERBOSE_ACTION (
+    log_action(" method name: %s", method_name.c_str());
+    log_action(" method object: %p", (void*)obj);
+    log_action(" method nargs: %d", nargs);
+       );
+
 
     if (!obj) {
         log_error("call_method invoked in something that "
@@ -2403,11 +2487,11 @@
 
     // Invalid args!
     if (!super || ! instance) {
-        //IF_VERBOSE_ACTION(
+        IF_VERBOSE_ACTION(
         log_action("-- %s instance_of %s (invalid args?)",
                 env.top(1).to_string(),
                 env.top(0).to_string());
-        //);
+        );
 
         env.drop(1);
         env.top(0) = as_value(false); 
@@ -2434,7 +2518,10 @@
        // The end of the enumeration, don't set top(0) *before*
        // fetching the as_object* obj above or it will get lost
        env.top(0).set_null(); 
+
+       IF_VERBOSE_ACTION (
        log_action("---enumerate - push: NULL");
+       );
 
        if ( ! obj )
        {
@@ -2667,8 +2754,10 @@
        size_t pc = thread.pc;
        size_t next_pc = thread.next_pc;
 
+       IF_VERBOSE_ACTION (
        log_action("-------------- with block start: stack size is %zu",
                with_stack.size());
+       );
 
        if (with_stack.size() < 8)
        {
@@ -2777,16 +2866,20 @@
        {
                env.local_register(reg) = env.top(0);
                      
+               IF_VERBOSE_ACTION (
                log_action("-------------- local register[%d] = '%s'",
                        reg, env.top(0).to_string());
+               );
 
        }
        else if (reg < 4)
        {
                env.global_register(reg) = env.top(0);
                      
+               IF_VERBOSE_ACTION (
                log_action("-------------- global register[%d] = '%s'",
                        reg, env.top(0).to_string() );
+               );
 
        }
        else




reply via email to

[Prev in Thread] Current Thread [Next in Thread]