aboutsummaryrefslogtreecommitdiff
path: root/src/sharedcore.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/sharedcore.cpp')
-rw-r--r--src/sharedcore.cpp67
1 files changed, 67 insertions, 0 deletions
diff --git a/src/sharedcore.cpp b/src/sharedcore.cpp
index 6333335..24d8972 100644
--- a/src/sharedcore.cpp
+++ b/src/sharedcore.cpp
@@ -7,3 +7,70 @@
7 7
8#include "bu/sharedcore.h" 8#include "bu/sharedcore.h"
9 9
10void hardlog(const char *fmt, ...)
11{
12 va_list ap;
13 va_start( ap, fmt );
14
15 FILE *fh = fopen("sharedcore.log", "ab");
16 vfprintf( fh, fmt, ap );
17 va_end( ap );
18 fclose( fh );
19}
20
21int iDepth = 0;
22
23void fncin( void *base, const char *fn, void *core, int *iRefCount, int params, ... )
24{
25 va_list ap;
26 va_start( ap, params );
27
28 FILE *fh = fopen("sharedcore.log", "ab");
29 fprintf( fh, "%08X: ", base );
30 for( int j = 0; j < iDepth; j++ )
31 fprintf( fh, " " );
32 fprintf( fh, "%s(", fn );
33 for( int j = 0; j < params; j++ )
34 if( j == 0 )
35 fprintf( fh, " %08X", va_arg( ap, void * ) );
36 else
37 fprintf( fh, ", %08X", va_arg( ap, void * ) );
38 if( params > 0 )
39 fprintf( fh, " )");
40 else
41 fprintf( fh, ")");
42
43 fprintf( fh, " [%08X / %08X] (%d)\n", core, iRefCount, rc );
44 va_end( ap );
45 fclose( fh );
46
47 iDepth++;
48}
49
50void fncout( void *base, const char *fn, void *core, int *iRefCount, int params, ... )
51{
52 va_list ap;
53 va_start( ap, params );
54
55 iDepth--;
56
57 FILE *fh = fopen("sharedcore.log", "ab");
58 fprintf( fh, "%08X: ", base );
59 for( int j = 0; j < iDepth; j++ )
60 fprintf( fh, " " );
61 fprintf( fh, "%s(", fn );
62 for( int j = 0; j < params; j++ )
63 if( j == 0 )
64 fprintf( fh, " %08X", va_arg( ap, void * ) );
65 else
66 fprintf( fh, ", %08X", va_arg( ap, void * ) );
67 if( params > 0 )
68 fprintf( fh, " )");
69 else
70 fprintf( fh, ")");
71
72 fprintf( fh, " [%08X / %08X] (%d)\n", core, iRefCount, rc );
73 va_end( ap );
74 fclose( fh );
75}
76