Changeset 51 in libcf for trunk/test/debug.c
- Timestamp:
- 04/02/13 10:23:52 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/debug.c
r35 r51 7 7 #include "cf_debug.h" 8 8 9 CF_Debug_Ctx gDebugCtx; 9 #include <string.h> 10 10 11 11 void callee (void) { 12 CF_Debug_CallStack callstack; 13 14 CF_DEBUG_CALLSTACK_PUSH (gDebugCtx); 15 CF_DEBUG_CALLSTACK_POP (gDebugCtx, &callstack); 12 CF_DEBUG_BEGIN_FUNCTION; 13 14 CF_Debug_PrintCallStack (stdout); 15 16 CF_DEBUG_END_FUNCTION; 16 17 } 17 18 18 19 int main (void) { 19 int fd = 0; 20 gDebugCtx = CF_Debug_CreateCtx (); 20 char data[] = 21 "【 曲名 : 사랑하고 있는데 】\n" 22 "《 歌 : Kylee 》\n" 23 "『 절원의 템페스트 OP2 Theme 』\n"; 21 24 22 CF_DEBUG_ CALLSTACK_PUSH (gDebugCtx);25 CF_DEBUG_BEGIN_FUNCTION; 23 26 24 CF_DEBUG_ TRACE (gDebugCtx, "print tracemessage with context to stderr\n");27 CF_DEBUG_PRINT (stderr, "print message with context to stderr\n"); 25 28 26 fd = CF_File_Create ("debug.txt"); 27 if (fd < 0) { 28 CF_DEBUG_PRINT (stderr, "error ...\n"); 29 // error 30 } 31 CF_Debug_SetOutputFD (gDebugCtx, fd); 29 CF_DEBUG_PRINT_BIN (stdout, (unsigned char *) data, (int) sizeof (data), "hehehehe\n"); 32 30 33 CF_DEBUG_TRACE (gDebugCtx, "print trace message with context to debug.txt\n");31 callee (); 34 32 35 CF_DEBUG_CALLSTACK_POP (gDebugCtx, NULL); 36 37 CF_Debug_DestroyCtx (gDebugCtx); 33 CF_DEBUG_END_FUNCTION; 38 34 39 35 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.