Xdebug()
[Function]
(1) When we run SED in dubug mode, we can not see the values of temp variables in Watch panel,  Now Xdebug() function to solves this problem;
(2) Sometimes we need to adjust variables to change the model/level to what we want, but it will be quite inconvenient to run the script again and again.  Xdebug()function allows you to change the values of any parameters or variables when the program is still running.
(3) If you want to know the changes of parameters in the past, you can look over the debugging log with Xdebug() function.  You can also look up Xdebug.log that is generated automatically in the script folder.


                      XICE (X±ù¿é)
                      2012.1.20
#include "Xdebug.c";  //First of all, you need to add this line to your code to implement following functions.

Please copy the following files to your [GStudio8\samples] folder to run these sample scripts.
Xdebug.c
sample_1.c
sample_2.c
sample_3.c
void Xdebug( STRING* Str )
void Xdebug( STRING* Str, var Var )
void Xdebug( STRING* Str, VECTOR* vec )
void Xdebug( STRING* Str, STRING* VarStr )
[Function]: Output the record from Xdebug.log panel to a file named "Xdebug.log" in your main script folder;
[Return]: <null>;
Str  : Reference String;
Var / vec / VarStr : type of the variables;
function test()
{
   var a = 0;

   STRING* b = str_create("Hello, world!");

   VECTOR c;
   vec_set( c, vector(2,55,22));

   Xdebug( "[function test] a", a );
   Xdebug( "[function test] b", b );
   Xdebug( "[function test] c", &c );

   while(1)
   {
       wait(1);
   }
}
void Xdebug( var id, STRING* Str, var Var )
void Xdebug( var id, STRING* Str, VECTOR* vec )
void Xdebug( var id, STRING* Str, STRING* VarStr )
[Function]: add a line of debug text(on the top left corner)
[Return]: <null>;
id   : vairable id, please make sure each id is unique! Id number start with 0, and has no maximum limit.
Str  : Prompting string;
Var / vec / VarStr : type of variables

function test()
{
   var a = 0;

   STRING* b = str_create("Hello, world!");

   VECTOR c;
   vec_set( c, vector(2,55,22));
 
   while(1)
   {
        Xdebug( 0, "[function test] a = ", a );
        Xdebug( 1, "[function test] b = ", b );
        Xdebug( 2, "[function test] c = ", &c );

        a+=0.2*time_step;
        wait(1);
    }
}

var Xdebug( var id, STRING* Str, var vMin, var vMax, var Value )
[Function]: add a slide-bar(on the top mid)
[Return]: the value of slide-bar;
id    : vairable id, please make sure each id is unique! Range is 0~100
Str   : Prompting string;
vMin  : minimum value
vMax  : maximum value
Value : initial value;
void Xdebug_Set( var id, var Value )
[Function]: modify and adjust the value of slide-bar
[Return]: <null>
id    : vairable id, please make sure each id is unique! Range is 0~100
Value : the value is changed to
action test()
{
   while(1)
   {
        my.pan = Xdebug( 0, "¡¾player's pan angle¡¿",  0, 360, my.pan);
        my.tilt = Xdebug( 1, "¡¾player's tilt angle¡¿",   -90,90, my.tilt);
        my.roll = Xdebug( 2, "¡¾player's roll angle¡¿",   0, 360, my.roll);
        Xdebug_Set( 2, 295.70 );
        wait(1);
    }
}
 

vMin     slide variables     vMax   Str
¡¡