[cig-commits] commit: merge

Mercurial hg at geodynamics.org
Mon Feb 1 15:33:02 PST 2010


changeset:   738:6e1e047e6868
branch:      pcu_rejig
parent:      737:bd21742a2f76
parent:      735:214a8dcdc095
user:        JulianGiordani
date:        Mon Dec 14 17:25:12 2009 +1100
description:
merge


diff -r bd21742a2f76 -r 6e1e047e6868 Base/Automation/tests/CallGraphSuite.c
--- a/Base/Automation/tests/CallGraphSuite.c	Mon Dec 14 17:20:37 2009 +1100
+++ b/Base/Automation/tests/CallGraphSuite.c	Mon Dec 14 17:25:12 2009 +1100
@@ -161,10 +161,8 @@ void CallGraphSuite_TestTableRealloc( Ca
       /* Use "i" as a unique string (unique pointer value)... don't try to print! */
       Stg_CallGraph_Push( cg3, TestFunc1, (Name)ii );
    }
-   pcu_check_true( 
-      cg3->_tableCount == count && 
-      cg3->_tableSize == (size * 2) );
-   
+   pcu_check_true( cg3->_tableCount == count && cg3->_tableSize == (size * 2) ); 
+
    Stg_Class_Delete(  cg3 );
 }
 
diff -r bd21742a2f76 -r 6e1e047e6868 Base/IO/src/Journal.c
--- a/Base/IO/src/Journal.c	Mon Dec 14 17:20:37 2009 +1100
+++ b/Base/IO/src/Journal.c	Mon Dec 14 17:25:12 2009 +1100
@@ -394,6 +394,7 @@ void Journal_RegisterTypedStream( Stream
 	/* check exists and update */
 	Stg_ObjectList_Append( stJournal->_typedStreams, typedStream );
 }
+
 Stream* Journal_GetTypedStream( const Type type )
 {
 	Stream* typedStream = NULL;
@@ -412,6 +413,7 @@ Stream* Journal_GetTypedStream( const Ty
 	
 	return typedStream;
 }
+
 Stream* Journal_GetNamedStream( Stream* typedStream, const Name name )
 {
 	Stream* currentStream ;
@@ -447,9 +449,9 @@ Stream* Journal_Register( const Type typ
 	typedStream = Journal_GetTypedStream( type );
 	namedStream = Journal_GetNamedStream( typedStream, name );	
 	
-
 	return namedStream;
 }
+
 Stream* Journal_Register2( const Type streamType, const Type componentType, const Name componentName ) {
 	Stream* componentStream;
 	Stream* instanceStream;
@@ -487,6 +489,14 @@ void Journal_Enable_TypedStream( const T
 {
 	Stream* typedStream = Journal_GetTypedStream( type );
 	Stream_Enable( typedStream, enable );
+}
+
+void Journal_Enable_AllTypedStream( Bool enable )
+{
+	Journal_Enable_TypedStream( Info_Type, enable );
+	Journal_Enable_TypedStream( Debug_Type, enable );
+	Journal_Enable_TypedStream( Dump_Type, enable );
+	Journal_Enable_TypedStream( Error_Type, enable );
 }
 
 void Journal_Enable_NamedStream( const Type type, const Name name, Bool enable )
diff -r bd21742a2f76 -r 6e1e047e6868 Base/IO/src/Journal.h
--- a/Base/IO/src/Journal.h	Mon Dec 14 17:20:37 2009 +1100
+++ b/Base/IO/src/Journal.h	Mon Dec 14 17:25:12 2009 +1100
@@ -148,10 +148,11 @@
 	 ** If the argument is NULL, no operation is performed. */
 	void Journal_DeregisterFile( JournalFile* file ); 
 
-
-
 	/** Enables/Disables the specified typed stream. */
 	void Journal_Enable_TypedStream( const Type type, Bool enable );
+
+	/** Enables/Disables all defined typed streams */
+	void Journal_Enable_AllTypedStream( Bool enable );
 
 	/** Enables/Disables the given named stream.
 	 **
@@ -160,11 +161,8 @@
 	 **/
 	void Journal_Enable_NamedStream( const Type type, const Name name, Bool enable );
 
-
 	/** Prints a summary of the status of each stream in Journal */
 	void Journal_PrintConcise();
-
-
 
 	/** Performs a printf() with the given stream. */
 	int Journal_Printf( void* _stream, const char* const fmt, ... );
diff -r bd21742a2f76 -r 6e1e047e6868 Base/IO/src/Stream.c
--- a/Base/IO/src/Stream.c	Mon Dec 14 17:20:37 2009 +1100
+++ b/Base/IO/src/Stream.c	Mon Dec 14 17:25:12 2009 +1100
@@ -314,6 +314,7 @@ SizeT Stream_Write( Stream *stream, void
 	}
 	return result;
 }
+
 Bool Stream_Dump( Stream *stream, void *data )
 {
 	Bool result;
@@ -354,6 +355,39 @@ Bool Stream_RedirectFile( Stream* stream
 	return Stream_SetFile( stream, file );
 }
 
+Bool Stream_RedirectAllToFile( const char* const fileName ) {
+	char* infoStreamFilename;
+	char* debugStreamFilename;
+	char* dumpStreamFilename;
+	char* errorStreamFilename;
+
+	Stg_asprintf( &infoStreamFilename, "%s.info", fileName );
+	Stg_asprintf( &debugStreamFilename, "%s.debug", fileName );
+	Stg_asprintf( &dumpStreamFilename, "%s.dump", fileName );
+	Stg_asprintf( &errorStreamFilename, "%s.error", fileName );
+
+	if( Stream_RedirectFile( Journal_GetTypedStream( Info_Type ), infoStreamFilename ) &&
+		Stream_RedirectFile( Journal_GetTypedStream( Debug_Type ), debugStreamFilename ) &&
+		Stream_RedirectFile( Journal_GetTypedStream( Dump_Type ), dumpStreamFilename ) &&
+		Stream_RedirectFile( Journal_GetTypedStream( Error_Type ), errorStreamFilename ) ) {
+		
+		Stream_ClearCustomFormatters( Journal_GetTypedStream( Info_Type ) );
+		Stream_ClearCustomFormatters( Journal_GetTypedStream( Debug_Type ) );
+		Stream_ClearCustomFormatters( Journal_GetTypedStream( Dump_Type ) );
+		Stream_ClearCustomFormatters( Journal_GetTypedStream( Error_Type ) );
+
+		return True;
+	}
+	else
+		return False;
+}
+
+void Stream_PurgeAllRedirectedFiles( void ) {
+	Stream_CloseAndFreeFile( Journal_GetTypedStream( Info_Type ) );
+	Stream_CloseAndFreeFile( Journal_GetTypedStream( Debug_Type ) );
+	Stream_CloseAndFreeFile( Journal_GetTypedStream( Dump_Type ) );
+	Stream_CloseAndFreeFile( Journal_GetTypedStream( Error_Type ) );
+}
 
 Bool Stream_RedirectFileBranch( Stream* stream, const char* const fileName ) {
 	JournalFile* file;
diff -r bd21742a2f76 -r 6e1e047e6868 Base/IO/src/Stream.h
--- a/Base/IO/src/Stream.h	Mon Dec 14 17:20:37 2009 +1100
+++ b/Base/IO/src/Stream.h	Mon Dec 14 17:25:12 2009 +1100
@@ -147,6 +147,13 @@
 	    Defaults CFile for now. TODO for next io commit */
 	Bool Stream_RedirectFile( Stream* stream, const char* const fileName );
 
+	/** Opens a registers a file for all the stream if not already opened and assigns it for output
+	    Defaults CFile for now. TODO for next io commit */
+	Bool Stream_RedirectAllToFile( const char* const fileName );
+
+	/** Purges all redirected stream files */
+	void Stream_PurgeAllRedirectedFiles( void );
+
 	/** Opens a registers a file for this stream if not already opened and assigns it for output for whole branch */
 	Bool Stream_RedirectFileBranch( Stream* stream, const char* const fileName );
 



More information about the CIG-COMMITS mailing list