Skip to content

Commit

Permalink
Fixes to lists so an empty constructor is not needed + reenable debug…
Browse files Browse the repository at this point in the history
…ging

git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@208 d0cd1f9f-072b-0410-8dd7-cf729c803f20
  • Loading branch information
theraysmith committed Dec 30, 2008
1 parent 51ed033 commit de46248
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 35 deletions.
2 changes: 1 addition & 1 deletion ccutil/errcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const ERRCODE ASSERT_FAILED = "Assert failed";

#define ASSERT_HOST(x) if (!(x)) \
{ \
ASSERT_FAILED.error(#x,TESSLOG,"in file %s, line %d", \
ASSERT_FAILED.error(#x,ABORT,"in file %s, line %d", \
__FILE__,__LINE__); \
}

Expand Down
2 changes: 1 addition & 1 deletion ccutil/lsterr.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const ERRCODE DONT_CONSTRUCT_LIST_BY_COPY =
const ERRCODE DONT_ASSIGN_LISTS = "Can't assign to lists";
const ERRCODE SERIALISE_LINKS = "Attempted to (de)serialise a link element";

#ifdef _DEBUG
#ifndef NDEBUG

const ERRCODE NO_LIST = "Iterator not set to a list";
const ERRCODE NULL_OBJECT = "List found this = NULL!";
Expand Down
66 changes: 33 additions & 33 deletions ccutil/serialis.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,38 +58,38 @@ Replace <parm> with "<parm>". <parm> may be an arbitrary number of tokens

#define QUOTE_IT( parm ) #parm

#define make_serialise( CLASSNAME ) \
\
NEWDELETE2(CLASSNAME) \
\
void serialise( \
FILE* f) \
{ \
CLASSNAME* shallow_copy; \
\
shallow_copy = (CLASSNAME*) alloc_struct( sizeof( *this ) ); \
memmove( shallow_copy, this, sizeof( *this ) ); \
\
shallow_copy->prep_serialise(); \
if (fwrite( (char*) shallow_copy, sizeof( *shallow_copy ), 1, f ) != 1)\
WRITEFAILED.error( QUOTE_IT( CLASSNAME::serialise ), \
ABORT, NULL ); \
\
free_struct( shallow_copy, sizeof( *this ) ); \
this->dump( f ); \
} \
\
static CLASSNAME* de_serialise( \
FILE* f) \
{ \
CLASSNAME* restored; \
\
restored = (CLASSNAME*) alloc_struct( sizeof( CLASSNAME ) ); \
if (fread( (char*) restored, sizeof( CLASSNAME ), 1, f ) != 1) \
READFAILED.error( QUOTE_IT( CLASSNAME::de_serialise ), \
ABORT, NULL ); \
\
restored->de_dump( f ); \
return restored; \
#define make_serialise( CLASSNAME ) \
\
NEWDELETE2(CLASSNAME) \
\
void serialise( \
FILE* f) \
{ \
CLASSNAME* shallow_copy; \
\
shallow_copy = (CLASSNAME*) alloc_struct( sizeof( *this ) ); \
memmove( shallow_copy, this, sizeof( *this ) ); \
\
shallow_copy->prep_serialise(); \
if (fwrite( (char*) shallow_copy, sizeof( *shallow_copy ), 1, f ) != 1) \
WRITEFAILED.error( QUOTE_IT( CLASSNAME::serialise ), \
ABORT, NULL ); \
\
free_struct( shallow_copy, sizeof( *this ) ); \
this->dump( f ); \
} \
\
static CLASSNAME* de_serialise( \
FILE* f) \
{ \
CLASSNAME* restored; \
\
restored = (CLASSNAME*) alloc_struct( sizeof( CLASSNAME ) ); \
if (fread( (char*) restored, sizeof( CLASSNAME ), 1, f ) != 1) \
READFAILED.error( QUOTE_IT( CLASSNAME::de_serialise ), \
ABORT, NULL ); \
\
restored->de_dump( f ); \
return restored; \
}
#endif

0 comments on commit de46248

Please sign in to comment.