system.c File Reference

Definitions of system functions. More...

Go to the source code of this file.


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,...)
 Send info to a logging window. More...
int ts5_set_log_level (const unsigned int loglevel)
 Set log level. More...
int ts5_get_log_level ()
 Get log level. More...
void ts5_print_status ()
 Write the status of all Tscope5 subsystem to the log window. More...
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,...)
 Exit safely with an error message. More...

Detailed Description

Definitions of system functions.

Definition in file system.c.

Function Documentation

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

Send info to a logging window.

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.

system02.c, and timer02.c.

Definition at line 45 of file system.c.

int ts5_set_log_level ( const unsigned int  loglevel)

Set log level.

loglevelHow much stuff is logged.
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 buttons 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.

audio04.c, cedrusbox02.c, parport02.c, parport03.c, serialport02.c, serialport03.c, and system02.c.

Definition at line 98 of file system.c.

int ts5_get_log_level ( )

Get log level.

The log level.

Definition at line 128 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.

Definition at line 148 of file system.c.

void ts5_fatal ( const char *  format,

Exit safely with an error message.

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.

cedrusbox01.c, config_serialport.c, joystick01.c, parport01.c, and system02.c.

Definition at line 533 of file system.c.