Tscope5
system.c File Reference

Go to the source code of this file.

Functions

Logging functions

Tscope5 automatically sends information about its status to a logging window and a file called tscope5.log.

With the functions below you control the amount of information that is logged. It is also possible to send your own log messages.

void ts5_log (const unsigned int level, const char *format,...)
int ts5_set_log_level (const unsigned int loglevel)
int ts5_get_log_level ()
void ts5_print_status ()
Error exit

During an experiment lots of unexpected things can happen.

(e.g. you forgot to copy stimulus bitmaps to the experiment computer).

It is a good habit to check for such unexpected events and exit your program safely before an ugly crash happens.

void ts5_fatal (const char *format,...)

Detailed Description

Definition in file system.c.


Function Documentation

void ts5_log ( const unsigned int  level,
const char *  format,
  ... 
)

Send info to a logging window.

Parameters:
levelThe importance of this message (TS5_LOGLEVEL_0 - TS5_LOGLEVEL_6). Smaller values are more important.
formatPrintf-style format string that contains the log message.

The log message is printed in a separate text log window.

Messages with a level above the level specified with ts5_set_log_level are omitted.

Examples:
system2.c.

Definition at line 323 of file system.c.

int ts5_set_log_level ( const unsigned int  loglevel)

Set log level.

Parameters:
loglevelHow much stuff is logged.
Returns:
The previous log level.

This parameter function controls what information is printed to the log window.

There are six possible settings:

  • TS5_LOGLEVEL_0: no debugging info.
  • TS5_LOGLEVEL_1: report when Tscope5 subsystems are loaded.
  • TS5_LOGLEVEL_2: report when memory is allocated/freed.
  • TS5_LOGLEVEL_3: report when response keys are defined.
  • TS5_LOGLEVEL_4: report when parameter are set or queried.
  • TS5_LOGLEVEL_5: report each function call.
  • TS5_LOGLEVEL_6: report internal check and coordinate functions.

If other values are passed to this function the program is aborted.

The default loglevel is TS5_LOGLEVEL_3.

Examples:
system1.c, and system2.c.

Definition at line 374 of file system.c.

int ts5_get_log_level ( )

Get log level.

Returns:
The log level.

Definition at line 403 of file system.c.

void ts5_print_status ( )

Write the status of all Tscope5 subsystem to the log window.

Information is printed about:

  • The display adapter(s) of the computer and the available fullscreen modes.
  • The displays opened by Tscope5.
  • The graphics parameters.
Examples:
system1.c.

Definition at line 423 of file system.c.

void ts5_fatal ( const char *  format,
  ... 
)

Exit safely with an error message.

Parameters:
formatPrintf-style format string that contains the error message.

Closes Tscope5, all subsystems and the log window.

A message box appears with the error message supplied by the user.

This function can be called before Tscope5 is installed.

Examples:
system2.c.

Definition at line 694 of file system.c.