1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
/*
* Copyright (C) 2007-2008 Xagasoft, All rights reserved.
*
* This file is part of the libbu++ library and is released under the
* terms of the license contained in the file LICENSE.
*/
#include "bu/sharedcore.h"
void hardlog(const char *fmt, ...)
{
va_list ap;
va_start( ap, fmt );
FILE *fh = fopen("sharedcore.log", "ab");
vfprintf( fh, fmt, ap );
va_end( ap );
fclose( fh );
}
int iDepth = 0;
void fncin( void *base, const char *fn, void *core, int *iRefCount, int params, ... )
{
va_list ap;
va_start( ap, params );
FILE *fh = fopen("sharedcore.log", "ab");
fprintf( fh, "%08X: ", base );
for( int j = 0; j < iDepth; j++ )
fprintf( fh, " " );
fprintf( fh, "%s(", fn );
for( int j = 0; j < params; j++ )
if( j == 0 )
fprintf( fh, " %08X", va_arg( ap, void * ) );
else
fprintf( fh, ", %08X", va_arg( ap, void * ) );
if( params > 0 )
fprintf( fh, " )");
else
fprintf( fh, ")");
fprintf( fh, " [%08X / %08X] (%d)\n", core, iRefCount, rc );
va_end( ap );
fclose( fh );
iDepth++;
}
void fncout( void *base, const char *fn, void *core, int *iRefCount, int params, ... )
{
va_list ap;
va_start( ap, params );
iDepth--;
FILE *fh = fopen("sharedcore.log", "ab");
fprintf( fh, "%08X: ", base );
for( int j = 0; j < iDepth; j++ )
fprintf( fh, " " );
fprintf( fh, "%s(", fn );
for( int j = 0; j < params; j++ )
if( j == 0 )
fprintf( fh, " %08X", va_arg( ap, void * ) );
else
fprintf( fh, ", %08X", va_arg( ap, void * ) );
if( params > 0 )
fprintf( fh, " )");
else
fprintf( fh, ")");
fprintf( fh, " [%08X / %08X] (%d)\n", core, iRefCount, rc );
va_end( ap );
fclose( fh );
}
|