[svn-r19330] Description:
Bring r19109:19328 from trunk to revise_chunks branch.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, w/threadsafe, in production mode
Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode
Mac OS X/32 10.6.4 (amazon) in debug mode
Mac OS X/32 10.6.4 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Mac OS X/32 10.6.4 (amazon) w/parallel, in debug mode
This commit is contained in:
@@ -21,76 +21,6 @@
|
||||
|
||||
/* global variables */
|
||||
int g_nTasks = 1;
|
||||
unsigned char g_Parallel = 0; /*0 for serial, 1 for parallel */
|
||||
char outBuff[OUTBUFF_SIZE];
|
||||
int outBuffOffset;
|
||||
FILE* overflow_file = NULL;
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: parallel_print
|
||||
*
|
||||
* Purpose: wrapper for printf for use in parallel mode.
|
||||
*
|
||||
* Programmer: Leon Arber
|
||||
*
|
||||
* Date: December 1, 2004
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
void parallel_print(const char* format, ...)
|
||||
{
|
||||
int bytes_written;
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, format);
|
||||
|
||||
if(!g_Parallel)
|
||||
vprintf(format, ap);
|
||||
else
|
||||
{
|
||||
|
||||
if(overflow_file == NULL) /*no overflow has occurred yet */
|
||||
{
|
||||
#if 0
|
||||
printf("calling HDvsnprintf: OUTBUFF_SIZE=%ld, outBuffOffset=%ld, ", (long)OUTBUFF_SIZE, (long)outBuffOffset);
|
||||
#endif
|
||||
bytes_written = HDvsnprintf(outBuff+outBuffOffset, OUTBUFF_SIZE-outBuffOffset, format, ap);
|
||||
#if 0
|
||||
printf("bytes_written=%ld\n", (long)bytes_written);
|
||||
#endif
|
||||
va_end(ap);
|
||||
va_start(ap, format);
|
||||
|
||||
#if 0
|
||||
printf("Result: bytes_written=%ld, OUTBUFF_SIZE-outBuffOffset=%ld\n", (long)bytes_written, (long)OUTBUFF_SIZE-outBuffOffset);
|
||||
#endif
|
||||
|
||||
if ((bytes_written < 0) ||
|
||||
#ifdef H5_VSNPRINTF_WORKS
|
||||
(bytes_written >= (OUTBUFF_SIZE-outBuffOffset))
|
||||
#else
|
||||
((bytes_written+1) == (OUTBUFF_SIZE-outBuffOffset))
|
||||
#endif
|
||||
)
|
||||
{
|
||||
/* Terminate the outbuff at the end of the previous output */
|
||||
outBuff[outBuffOffset] = '\0';
|
||||
|
||||
overflow_file = HDtmpfile();
|
||||
if(overflow_file == NULL)
|
||||
fprintf(stderr, "warning: could not create overflow file. Output may be truncated.\n");
|
||||
else
|
||||
bytes_written = HDvfprintf(overflow_file, format, ap);
|
||||
}
|
||||
else
|
||||
outBuffOffset += bytes_written;
|
||||
}
|
||||
else
|
||||
bytes_written = HDvfprintf(overflow_file, format, ap);
|
||||
|
||||
}
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: print_dimensions
|
||||
|
||||
Reference in New Issue
Block a user