eadddb712a4c7f7ac477180fb09a8de884888138
[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 typedef struct buffer_template{
31         char message[BUFFER_SIZE][BUFFER_MESSAGE_LENGTH];
32         int head;
33         int tail;
34         char message_level[BUFFER_SIZE];
35 }buffer; 
36 #include "error_handler.h"              /*include this for the debug level*/
37
38
39 void print_buffer(buffer *p_Buffer,int number_of_messages_to_print);            /*print messages in the buffer*/ 
40 /*wrapper functions for add_to_buffer_root_function*/
41 void add_to_buffer(buffer *p_Buffer, char *message,char message_level,char print);
42 void append_to_buffer(buffer *p_Buffer, char *message,char message_level,char print);
43
44 void add_to_buffer_root_function(buffer *p_Buffer, char *message,char message_level,char append,char print);
45 #endif