Browse Source

Cleanups.

tags/non-daw-v1.1.0
Jonathan Moore Liles 17 years ago
parent
commit
2a67c132f4
4 changed files with 35 additions and 41 deletions
  1. +2
    -2
      Timeline/Log_Entry.C
  2. +1
    -1
      Timeline/Log_Entry.H
  3. +31
    -37
      Timeline/Loggable.C
  4. +1
    -1
      Timeline/Loggable.H

+ 2
- 2
Timeline/Log_Entry.C View File

@@ -209,7 +209,7 @@ Log_Entry::grow ( )
_sa = (char**)realloc( _sa, sizeof( char * ) * (_i + 2) );
_sa[ _i + 1 ] = NULL;
}
\
int
Log_Entry::size ( void ) const
{
@@ -217,7 +217,7 @@ Log_Entry::size ( void ) const
}

void
Log_Entry::get ( int n, const char **name, const char **value )
Log_Entry::get ( int n, const char **name, const char **value ) const
{
*name = _sa[ n ];
*value = *name + strlen( *name ) + 1;


+ 1
- 1
Timeline/Log_Entry.H View File

@@ -64,7 +64,7 @@ public:

int size ( void ) const;

void get ( int n, const char **name, const char **value );
void get ( int n, const char **name, const char **value ) const;
char **sa ( void );

/* #define ADD ( type, format, exp ) \ */


+ 31
- 37
Timeline/Loggable.C View File

@@ -462,17 +462,33 @@ Loggable::flush ( void )
}

void
Loggable::log_print( char **o, char **n ) const
Loggable::log_print( const Log_Entry *o, const Log_Entry *n ) const
{
if ( ! _fp )
return;

if ( n )
for ( ; *n; n++ )
log( "%s %s%s", *n, *n + strlen( *n ) + 1, *(n + 1) ? " " : "" );
for ( int i = 0; i < n->size(); ++i )
{
const char *s, *v;

n->get( i, &s, &v );

log( "%s %s%s", s, v, n->size() == i + 1 ? "" : " " );
}

if ( o && *o )
if ( o && o->size() )
{
if ( n ) log( " << " );
for ( ; *o; o++ )
log( "%s %s%s", *o, *o + strlen( *o ) + 1, *(o + 1) ? " " : "" );

for ( int i = 0; i < o->size(); ++i )
{
const char *s, *v;

o->get( i, &s, &v );

log( "%s %s%s", s, o->size() == i + 1 ? "" : " " );
}
}

log( "\n" );
@@ -498,24 +514,21 @@ Loggable::log_end ( void )
if ( --_nest > 0 )
return;

Log_Entry *_new_state;
Log_Entry *new_state;

{
_new_state = new Log_Entry;
new_state = new Log_Entry;

get( *_new_state );
}
get( *new_state );

if ( *_old_state != *_new_state )
if ( *_old_state != *new_state )
{
// indent();
log( "%s 0x%X set ", class_name(), _id );

log_print( _old_state->sa(), _new_state->sa() );
log_print( _old_state, new_state );
}

if ( _new_state )
delete _new_state;
if ( new_state )
delete new_state;

if ( _old_state )
delete _old_state;
@@ -529,32 +542,13 @@ Loggable::log_end ( void )
void
Loggable::log_create ( void ) const
{
// indent();

/* if ( Loggable::_level ) */
/* { */
/* /\* defer until the block ends--this is really only required for capturing... *\/ */



/* } */

log( "%s 0x%X create ", class_name(), _id );

char **sa;

Log_Entry e;

get( e );

sa = e.sa();

if ( sa )
{
log_print( NULL, sa );
}
else
log( "\n" );
log_print( NULL, &e );

if ( Loggable::_level == 0 )
Loggable::flush();
@@ -573,7 +567,7 @@ Loggable::log_destroy ( void ) const

get( e );

log_print( NULL, e.sa() );
log_print( NULL, &e );

if ( Loggable::_level == 0 )
Loggable::flush();


+ 1
- 1
Timeline/Loggable.H View File

@@ -100,7 +100,7 @@ private:
}
}

void log_print( char **o, char **n ) const;
void log_print( const Log_Entry *o, const Log_Entry *n ) const;
static void log ( const char *fmt, ... );

static void flush ( void );


Loading…
Cancel
Save