<?xml?>
<!--
    GSL/diag - Diagnostic functions object
    
    Copyright (c) 1996-2010 iMatix Corporation

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or (at
    your option) any later version.

    This program is distributed in the hope that it will be useful, but
    WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    General Public License for more details.

    For information on alternative licensing for OEMs, please contact
    iMatix Corporation.
-->

<gxl script = "ggobjt.gsl" filename = "ggdiag" title = "GSL/diag package" >

<extra>
</extra>

<class name = "diag" title = "Diagnostic Functions" register = "1" >

<function name = "used" >
    <description>Shows amount (bytes) of memory allocated.</description>
    <body>
  {
    result-> value. type = TYPE_NUMBER;
    result-> value. n    = mem_used ();

    return 0;
  }
    </body>
</function>

<function name = "allocs" >

    <description>Shows number of memory allocations.</description>
    <body>
  {
    result-> value. type = TYPE_NUMBER;
    result-> value. n    = mem_allocs ();

    return 0;
  }
    </body>
</function>

<function name = "frees" >

    <description>Shows number of memory deallocations. Should equal allocs.</description>
    <body>
  {
    result-> value. type = TYPE_NUMBER;
    result-> value. n    = mem_frees ();

    return 0;
  }
    </body>
</function>

<function name = "display" >
    <description>Writes the contents of the memory allocation list to the specified file.</description>
    <parameter name = "filename" pass = "value" compulsory = "1" />
    <body>
  {
    FILE
        *file;

    file = file_open (string_value (& filename-> value), 'w');
    if (! file)
      {
        strcpy (object_error, strerror (errno));
        return -1;
      }
    mem_display (file);
    file_close (file);

    return 0;
  }
    </body>
</function>

<function name = "checkall" >
    <description>
        Checks all allocated memory blocks for corruption and terminates
       the program if any are found.
    </description>
    <body>
    mem_checkall ();
    </body>
</function>

<function name = "raise" >
    <description>
    Send a signal corresponding to the numeric argument to the gsl process.
    See signal(2) for numeric signal values.
    </description>
    <parameter name = "signal" pass = "value" compulsory = "1" />
    <body>
    raise ((int) number_value (& signal-> value));
    </body>
</function>

<function name = "animate" >
    <description>
        Control GSL finite state machine progress where applicable.
        Use non-zero numeric argument to enable and a zero to disable.
    </description>
    <parameter name = "value" pass = "value" compulsory = "1" />
    <body>
    gsl_thread-> animate = (Bool) number_value (& value-> value);
    </body>
</function>

<function name = "console_set_mode" >
    <description>
    Sets console display mode; the argument can be one of:

    0 - Output text exactly as specified. (Default).
    1 - Prefix text by "yy/mm/dd hh:mm:ss "
    2 - Prefix text by "hh:mm:ss "
    3 - Same as #2 but output is fully flushed
    </description>

    <parameter name = "mode" pass = "value" compulsory = "1" />
    <body>
    console_set_mode ((int) number_value (& mode-> value));
    </body>
</function>

</class>

</gxl>
