DVBCore  17.9.0
Open Source DVB Engine
 All Data Structures Files Functions Typedefs Macros Pages
dbgmemory.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
3  * Copyright © 2014 Ocean Blue Software Ltd
4  *
5  * This file is part of a DTVKit Software Component
6  * You are permitted to copy, modify or distribute this file subject to the terms
7  * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
8  *
9  * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
10  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
11  * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
12  *
13  * If you or your organisation is not a member of DTVKit then you have access
14  * to this source code outside of the terms of the licence agreement
15  * and you are expected to delete this and any associated files immediately.
16  * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
17  *******************************************************************************/
25 // pre-processor mechanism so multiple inclusions don't cause compilation error
26 #ifndef _DBGMEMORY_H
27 #define _DBGMEMORY_H
28 
29 #ifndef PGW_ENABLED
30 #ifndef _STBHEAP_C
31 // uncomment these #defines for memory write debuging
32 // you would also need to build the required functionality
33 // into the stb library ---> ie. by uncommenting the
34 // relevant #defines in source file stbheap.c
35 //#define DEBUG_MEMCOPY
36 //#define DEBUG_TEST_APPHEAP
37 //#define DEBUG_TEST_STBHEAP
38 #endif
39 #endif
40 
41 // Define macros and function prototypes associated with debug facilities...
42 #ifdef DEBUG_MEMCOPY
43 
44  #include <stdarg.h>
45 
46  #define memcpy(s1, s2, n) STB_MemCopy((s1), (s2), (n))
47 void* STB_MemCopy(void *s1, const void *s2, U16BIT n);
48 
49  #define memmove(s1, s2, n) STB_MemMove((s1), (s2), (n))
50 void* STB_MemMove(void *s1, const void *s2, U16BIT n);
51 
52  #define memset(s, c, n) STB_MemSet((s), (c), (n))
53 void* STB_MemSet(void *s, int c, U16BIT n);
54 
55  #define strcpy(s1, s2) STB_StrCopy((s1), (s2))
56 char* STB_StrCopy(char *s1, const char *s2);
57 
58  #define strncpy(s1, s2, n) STB_StrNCopy((s1), (s2), (n))
59 char* STB_StrNCopy(char *s1, const char *s2, U16BIT n);
60 
61  #define strcat(s1, s2) STB_StrCat((s1), (s2))
62 char* STB_StrCat(char *s1, const char *s2);
63 
64  #define strncat(s1, s2, n) STB_StrNCat((s1), (s2), (n))
65 char* STB_StrNCat(char *s1, const char *s2, U16BIT n);
66 
67  #define vsprintf(s1, fmt, va) STB_VSPrintF((s1), (fmt), (va))
68 int STB_VSPrintF(char *s1, const char *fmt, va_list va);
69 
70  #define sprintf STB_SPrintF
71 int STB_SPrintF(char *s1, const char *fmt, ...);
72 
73  #define snprintf STB_SNPrintF
74 int STB_SNPrintF(char *s1, U16BIT n, const char *fmt, ...);
75 #endif //#ifdef DEBUG_MEMCOPY
76 
77 #ifdef DEBUG_TEST_APPHEAP
78  #define DBG_CHECK_APPHEAP() STB_CheckAppHeap()
79 void STB_CheckAppHeap(void);
80 #else
81  #define DBG_CHECK_APPHEAP()
82 #endif //#ifdef DEBUG_TEST_APPHEAP
83 
84 #ifdef DEBUG_TEST_STBHEAP
85  #define DBG_CHECK_STBHEAP() STB_CheckStbHeap()
86 void STB_CheckStbHeap(void);
87 #else
88  #define DBG_CHECK_STBHEAP()
89 #endif //#ifdef DEBUG_TEST_STBHEAP
90 
91 #endif // _DBGMEMORY_H
92