2f7984f63ec713f3516df7bbe89b11e8fbb3c9cb
[yaffs2.git] / direct / timothy_tests / running_out_of_handles_error / message_buffer.h
1 /*
2  * YAFFS: Yet another Flash File System . A NAND-flash specific file system. 
3  *
4  * Copyright (C) 2002-2010 Aleph One Ltd.
5  *   for Toby Churchill Ltd and Brightstar Engineering
6  *
7  * Created by Timothy Manning <timothy@yaffs.net>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU Lesser General Public License version 2.1 as
11  * published by the Free Software Foundation.
12  *
13  * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL.
14  */
15
16 #ifndef __message_buffer__
17 #define __message_buffer__
18
19 #include <stdio.h>
20 #include <string.h>
21 #define PRINT 1
22 #define NPRINT 0
23 #define APPEND_MESSAGE 1
24 #define DO_NOT_APPEND_MESSAGE 0         
25 #define PRINT_ALL -1                    /*this is used to print all of the messages in a buffer*/
26 #define BUFFER_MESSAGE_LENGTH 60                /*number of char in message*/
27 #define BUFFER_SIZE 50                  /*number of messages in buffer*/
28 #define MESSAGE_LEVEL_ERROR 0
29 #define MESSAGE_LEVEL_BASIC_TASKS 1
30
31 #define LOG_FILE "log.txt"
32 typedef struct buffer_template{
33         char message[BUFFER_SIZE][BUFFER_MESSAGE_LENGTH];
34         int head;
35         int tail;
36         char message_level[BUFFER_SIZE];
37 }buffer; 
38 #include "error_handler.h"              /*include this for the debug level*/
39
40
41 void print_buffer(buffer *p_Buffer,int number_of_messages_to_print);            /*print messages in the buffer*/ 
42 /*wrapper functions for add_to_buffer_root_function*/
43 void add_to_buffer(buffer *p_Buffer, char *message,char message_level,char print);
44 void append_to_buffer(buffer *p_Buffer, char *message,char message_level,char print);
45 void add_int_to_buffer(buffer *p_Buffer, int num,char message_level,char print);
46 void append_int_to_buffer(buffer *p_Buffer, int num,char message_level,char print);
47
48 void add_to_buffer_root_function(buffer *p_Buffer, char *message,char message_level,char append,char print);
49 #endif