msg_log.c File Reference


Detailed Description

Maintaining of message log.

Purpose:
Procedures for logging messages into file, and holding them to print on screen.
Comment:
None.
Author:
Tomasz Lis
Date:
25 Apr 2008 - 29 Jul 2008
Copying and copyrights:
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 2 of the License, or (at your option) any later version.

Definition in file msg_log.c.

#include "msg_log.h"
#include "globals.h"

Go to the source code of this file.

Functions

void message_log_vl (const char *format, va_list val)
 Only logs the message, without showing on screen.
void message_log_simp (const char *str)
 Simplified function for message logging.
void message_log (const char *format,...)
 Only logs the message, without showing on screen.
void message_error (const char *format,...)
 Logs the message and prints it into stderr.
short message_is_empty (void)
 Returns if the message buffer is empty.
void message_info (const char *format,...)
 Logs the message and prints it into message buffer.
void message_info_force (const char *format,...)
 Sets the new message even if previous one was marked to be held.
short message_hold_get (void)
 Returns the value of message_hold.
unsigned int message_getcount_get (void)
 Returns the value of message_getcount.
void message_release (void)
 Releases the message buffer, so it can store next message.
char * message_get (void)
 Returns pointer to the buffer with the last message.
char * message_get_prev (void)
 Returns pointer to the buffer with the previous message.
short set_msglog_fname (char *fname)
 Sets message log file name.
void init_messages (void)
 Clears message log variables without freeing memory (drops any pointers).
void free_messages (void)
 Frees memory allocated for messages.

Variables

char * message_prv
char * message
short message_hold
unsigned int message_getcount
char * msgout_fname


Function Documentation

void free_messages ( void   ) 

Frees memory allocated for messages.

The pointers are not cleared.

Examples:
putemple.c, putgems.c, puttrain.c, and viewmap.c.

Definition at line 287 of file msg_log.c.

void init_messages ( void   ) 

Clears message log variables without freeing memory (drops any pointers).

Examples:
putemple.c, putgems.c, puttrain.c, and viewmap.c.

Definition at line 275 of file msg_log.c.

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

char* message_get ( void   ) 

Returns pointer to the buffer with the last message.

Returns:
Returns pointer to the last message string.
Examples:
putemple.c, and puttrain.c.

Definition at line 226 of file msg_log.c.

char* message_get_prev ( void   ) 

Returns pointer to the buffer with the previous message.

Returns:
Returns pointer to the last message string.
Examples:
putemple.c.

Definition at line 236 of file msg_log.c.

unsigned int message_getcount_get ( void   ) 

Returns the value of message_getcount.

This value informs how many times the message_get() was called for the current message.

Returns:
Returns message_get call count.

Definition at line 207 of file msg_log.c.

short message_hold_get ( void   ) 

Returns the value of message_hold.

This value informs if the buffer need to be released before any further logging.

Returns:
Returns message_hold, which true or false.

Definition at line 196 of file msg_log.c.

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

Logs the message and prints it into message buffer.

The message is set into buffer only if message_hold is not set.

Parameters:
format Specifies the string pattern.
... List of arguments used in the pattern.
Examples:
putemple.c, puttrain.c, and viewmap.c.

Definition at line 129 of file msg_log.c.

Referenced by generate_map_bitmap_mapfname(), get_object_with_circle_at(), get_thing_with_circle_at(), and level_verify().

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

Sets the new message even if previous one was marked to be held.

The new message is a standard information - hold is disabled.

Parameters:
format Specifies the string pattern.
... List of arguments used in the pattern.

Definition at line 165 of file msg_log.c.

Referenced by load_mapfile(), load_mapfile_msg(), and save_mapfile().

short message_is_empty ( void   ) 

Returns if the message buffer is empty.

Returns:
Returns true if the message buffer is empty.

Definition at line 117 of file msg_log.c.

Referenced by message_info().

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

void message_log_simp ( const char *  str  ) 

Simplified function for message logging.

Allows writing only single string.

Parameters:
str Specifies the exact to log string.

Definition at line 54 of file msg_log.c.

Referenced by message_error(), message_info(), and message_info_force().

void message_log_vl ( const char *  format,
va_list  val 
)

Only logs the message, without showing on screen.

The va_list version - mainly for internal use.

Parameters:
format Specifies the string pattern.
val List of arguments used in the pattern.

Definition at line 35 of file msg_log.c.

Referenced by message_log().

void message_release ( void   ) 

Releases the message buffer, so it can store next message.

Call to this function is reqired after message_error call, to allow logging further messages.

Examples:
putemple.c, puttrain.c, and viewmap.c.

Definition at line 217 of file msg_log.c.

short set_msglog_fname ( char *  fname  ) 

Sets message log file name.

Rewrites it, then writes header and two last messages.

Parameters:
fname The file name under which log is written.
Returns:
Returns true if the log was created, otherwise false.
Examples:
putemple.c, puttrain.c, and viewmap.c.

Definition at line 247 of file msg_log.c.


Variable Documentation

char* message

unsigned int message_getcount

short message_hold

char* message_prv

char* msgout_fname


Generated on Tue Sep 2 18:51:50 2008 for libAdikted by  doxygen 1.5.6