diff --git a/src/API/binary_c_API_excluded_features.h b/src/API/binary_c_API_excluded_features.h
index a0d2c31148aad11abc83aec9bf7dc4450d4c735b..9d88640b9c511abb59903e4f6d62b0b6b3b7eb5b 100644
--- a/src/API/binary_c_API_excluded_features.h
+++ b/src/API/binary_c_API_excluded_features.h
@@ -19,7 +19,6 @@
/* other features you will not want */
//#undef RANDOM_SYSTEMS
-//#undef BUFFERED_STACK
//#undef FILE_LOG
#undef RANDOM_SEED_LOG
diff --git a/src/API/binary_c_API_prototypes.h b/src/API/binary_c_API_prototypes.h
index 113e9263c4bd67c8445f9cdbd1a5fce616b07fa5..d0a20b30c019ec6e685f705209f9b181f9eb6d1f 100644
--- a/src/API/binary_c_API_prototypes.h
+++ b/src/API/binary_c_API_prototypes.h
@@ -38,6 +38,9 @@ void binary_c_API_function binary_c_buffer_info(struct libbinary_c_stardata_t *
char ** const buffer,
size_t * size);
+void binary_c_API_function binary_c_error_buffer(struct stardata_t * RESTRICT const stardata,
+ char ** const error_buffer);
+
void binary_c_API_function binary_c_buffer_empty_buffer(struct stardata_t * RESTRICT const stardata);
/*
diff --git a/src/API/binary_c_buffer_info.c b/src/API/binary_c_buffer_info.c
index e76729566f06c4355097bd26bcea1041d945808f..30f965a5fb16f48ddc420e06312db76661b4a601 100644
--- a/src/API/binary_c_buffer_info.c
+++ b/src/API/binary_c_buffer_info.c
@@ -6,8 +6,8 @@ void binary_c_API_function binary_c_buffer_info(struct stardata_t * RESTRICT con
size_t * const size)
{
/*
- * API function to access the binary_c buffer
+ * API function to access the binary_c raw_buffer
*/
- buffer_info(stardata,buffer,size);
+ buffer_info(stardata,buffer,size,NULL);
}
#endif
diff --git a/src/API/binary_c_error_buffer.c b/src/API/binary_c_error_buffer.c
new file mode 100644
index 0000000000000000000000000000000000000000..e7f6d1656e841cd7b5ccfd69d3498b872c0cd27b
--- /dev/null
+++ b/src/API/binary_c_error_buffer.c
@@ -0,0 +1,24 @@
+#include "../binary_c.h"
+#ifdef BINARY_C_API
+
+void binary_c_API_function binary_c_error_buffer(struct stardata_t * RESTRICT const stardata,
+ char ** const error_buffer)
+{
+ /*
+ * API function to access the binary_c error_buffer
+ *
+ * If stardata->tmpstore->error_buffer is set,
+ * set error_buffer to it, otherwise NULL.
+ */
+ if(stardata != NULL &&
+ stardata->tmpstore != NULL &&
+ stardata->tmpstore->error_buffer_set == TRUE)
+ {
+ buffer_info(stardata,NULL,NULL,error_buffer);
+ }
+ else
+ {
+ *error_buffer = NULL;
+ }
+}
+#endif
diff --git a/src/API/binary_c_evolve_for_dt.c b/src/API/binary_c_evolve_for_dt.c
index 0efde4e7ea3f1f48b6977286ff222fc0f63588c3..b0c3cbf2e89fa522a0e2f7b65fcd7a1727e7c7ae 100644
--- a/src/API/binary_c_evolve_for_dt.c
+++ b/src/API/binary_c_evolve_for_dt.c
@@ -91,9 +91,9 @@ int binary_c_API_function binary_c_evolve_for_dt(struct stardata_t * const stard
/* Debugging */
{
- char * buffer;
+ char * buffer, * error_buffer;
size_t size;
- buffer_info(stardata,&buffer,&size);
+ buffer_info(stardata,&buffer,&size,&error_buffer);
APIDebug("API :: post iterate t=%g, buffer = %p , buffer_size = %zu\n",
stardata->model.time,
diff --git a/src/binary_c_code_options.h b/src/binary_c_code_options.h
index a74317f7e656bc6a6480409d38856777f8402031..1c6dc1ba506669ac51e80c58346338c5900d4396 100644
--- a/src/binary_c_code_options.h
+++ b/src/binary_c_code_options.h
@@ -660,26 +660,12 @@ void Print_trace(void);
#endif
-/*
- * An advanced stack for output.
- * This stack includes compression, should you require it.
- * It is considered experimental.
- */
-//#define BUFFERED_STACK
/* _printf is always to stdout */
#define _printf(...) fprintf(stdout,__VA_ARGS__)
-#if defined BUFFERED_STACK && !defined __NATIVE_PRINTF__
-#define OUTPUT_TO_STREAM 0
-#define OUTPUT_TO_BUFFER 1
-#define STREAM_BUFFER_LINELENGTH 10000
-#define BUFFER_STRING_SIZE 10000
-#define printf(...) binary_c_stack_printf(stardata,__VA_ARGS__)
-#else
/* normal printf */
#define printf(...) printf(__VA_ARGS__)
-#endif
/* capture fflush? */
//#define fflush(...) binary_c_flush(__VA_ARGS__)
@@ -764,12 +750,13 @@ void Print_trace(void);
*
* NB The size of the buffer must be more than
* MAX_BUFFERED_STRING_LENGTH.
- *
- * The BUFFERED_PRINTF_ERROR_BUFFER_SIZE is added
- * to allow error strings to be printed even when the
- * buffer is full.
*/
#define BUFFERED_PRINTF_MAX_BUFFER_SIZE ((size_t)(1024*1024*250))
+
+
+/*
+ * Size of the error buffer.
+ */
#define BUFFERED_PRINTF_ERROR_BUFFER_SIZE ((size_t)(1024))
/*
diff --git a/src/binary_c_debug.h b/src/binary_c_debug.h
index 9a0afcbb587a2a6f4bf8ed770f70ead32bd565f2..71a1068ed2386c1f44e4cf357f18eaed44cc7350 100644
--- a/src/binary_c_debug.h
+++ b/src/binary_c_debug.h
@@ -100,7 +100,7 @@
* this is not shown.
*/
-#define Debug_show_expression " stardata=%p ",stardata
+#define Debug_show_expression " "
//#undef Debug_show_expression
diff --git a/src/binary_c_function_macros.h b/src/binary_c_function_macros.h
index fbe8ec7ec1871a99238bd03c92d86eea156c2a79..6a68a0efce9283c7139a47d1be6965d357d8b680 100644
--- a/src/binary_c_function_macros.h
+++ b/src/binary_c_function_macros.h
@@ -743,7 +743,15 @@
PRINTFN_DESLASHOOP)(__VA_ARGS__)
-#ifdef BUFFERED_STACK
+#define Clear_error_buffer \
+ if(stardata!=NULL && \
+ stardata->tmpstore != NULL && \
+ stardata->tmpstore->error_buffer != NULL) \
+ { \
+ clear_error_buffer(stardata); \
+ }
+
+
#define Clear_printf_buffer \
if(likely(stardata!=NULL && \
stardata->preferences!=NULL && \
@@ -751,10 +759,8 @@
{ \
clear_printf_buffer(stardata); \
}
-#else
-#define Clear_printf_buffer /*do_nothing*/
-#endif
+
/*
* Wrapper for nancheck
*/
@@ -1081,12 +1087,10 @@
*/
#define Save_buffering_state \
int __buf = stardata->preferences->internal_buffering; \
- int __comp = stardata->preferences->internal_buffering_compression; \
int __batchmode = stardata->preferences->batchmode;
#define Restore_buffering_state \
stardata->preferences->internal_buffering = __buf; \
- stardata->preferences->internal_buffering_compression = __comp; \
stardata->preferences->batchmode = __batchmode;
diff --git a/src/binary_c_parameters.h b/src/binary_c_parameters.h
index dc81aca1c7aa616766b5f3ddd29608df1f1b7005..ef93466ad75e5a9b7e3bb1ccbc633722f5349162 100644
--- a/src/binary_c_parameters.h
+++ b/src/binary_c_parameters.h
@@ -1316,7 +1316,7 @@
/************************************************************
* 2019 treatment of circumstellar and circumbinary discs
************************************************************/
-#define DISCS
+//#define DISCS
#ifdef DISCS
diff --git a/src/binary_c_structures.h b/src/binary_c_structures.h
index 89e8cc0d64403c85777a627b504d7842c71c1001..fe4f0c4c63f032a6b9031a8c0d8cd57623e36511 100644
--- a/src/binary_c_structures.h
+++ b/src/binary_c_structures.h
@@ -320,22 +320,18 @@ struct tmpstore_t {
Stellar_type Aligned stellar_timescales_cache_stellar_type[Align(STELLAR_TIMESCALES_CACHE_SIZE)];
#endif
- char Aligned * raw_buffer;
+ char Aligned * raw_buffer;
+ char Aligned * error_buffer;
#ifdef BATCHMODE
char Aligned * batchstring;
char Aligned * batchstring2;
char Aligned ** batchargs;
#endif//BATCHMOD
-#ifdef BUFFERED_STACK
- char * (*stream_buffer);
-#endif//BUFFERED_STACK
#ifdef WTTS_LOG
FILE *fp_sys;
FILE *fp_star[2];
#endif//WTTS_LOG
-
-
#ifdef NUCSYN
#ifdef NUCSYN_STRIP_AND_MIX
@@ -373,6 +369,7 @@ struct tmpstore_t {
#ifdef LOG_SUPERNOVAE
Boolean sn_header_printed;
#endif//LOG_SUPERNOVAE
+ Boolean error_buffer_set;
};
@@ -395,11 +392,6 @@ struct preferences_t {
...);
void (*custom_output_function)(struct stardata_t * stardata);
-
-#ifdef BUFFERED_STACK
- FILE * __restrict__ output_stream;
-#endif//BUFFERED_STACK
-
#ifdef BINT
char * BINT_dir;
#endif//BINT
@@ -797,10 +789,6 @@ struct preferences_t {
Stellar_type initial_stellar_type1;
Stellar_type initial_stellar_type2;
-#ifdef BUFFERED_STACK
- int output_type;
- int stream_buffer_stacksize;
-#endif//BUFFERED_STACK
int nelemans_n_comenvs;
#ifdef DISCS
@@ -945,7 +933,6 @@ struct preferences_t {
#endif//NUCSYN
int internal_buffering;
- int internal_buffering_compression;
#ifdef GALACTIC_MODEL
int galactic_model;
diff --git a/src/buffering/binary_c_printf.c b/src/buffering/binary_c_printf.c
deleted file mode 100644
index f5121705e0db89901db2034910fd567d9802c4d9..0000000000000000000000000000000000000000
--- a/src/buffering/binary_c_printf.c
+++ /dev/null
@@ -1,68 +0,0 @@
-#include "../binary_c.h"
-
-#ifdef BUFFERED_STACK
-
-/*
- * wrapper for printf so we can redirect it wherever we like, e.g.
- * to an array
- *
- * NB please do not use printf or Dprint in here.
- */
-#include "printf_stack.h"
-
-int binary_c_stack_printf(struct stardata_t * const stardata,
- __const char *__restrict__ const format, ...)
-{
- va_list args;
- va_start(args,format);
- int ret; // return value
-
- if(stardata && format==NULL)
- {
- while(buffer_stack_pop(stardata,NULL)){}
- Safe_free(Stream_buffer);
- return 0; // nominal return value
- }
-
-#ifdef PRINTF_DEBUG
- fprintf(stderr,"print %d override format='%s' global=%p stackpos=%d buffer pointer=%p\n",
- stardata->preferences->output_type,
- format,
- stardata,
- Stack_size,
- Stream_buffer);
-#endif
-
- if(stardata!=NULL &&
- stardata->preferences != NULL)
- {
- // todo :
- // use case statement
- // implement internal buffering
- if(stardata->preferences->output_type==OUTPUT_TO_STREAM)
- {
- /* custom stream output */
- ret=vfprintf(stardata->preferences->output_stream,format,args);
- }
- else if(stardata->preferences->output_type==OUTPUT_TO_BUFFER)
- {
- /* push string onto the buffer stack */
- ret = buffer_stack_push(stardata,format,args);
- }
- else
- {
- /* er.... */
- ret = 0;
- }
- }
- else
- {
- /* always output to stdout if no stardata struct is available */
- ret=vfprintf(stdout,format,args);
- }
- va_end(args);
- return ret;
-}
-
-
-#endif // BUFFERED_STACK
diff --git a/src/buffering/buffer_empty_buffer.c b/src/buffering/buffer_empty_buffer.c
index a94843753e2e052fc96f8d871be1df7c647fdc8a..d92d7c467272bf34c91186368665230923acda11 100644
--- a/src/buffering/buffer_empty_buffer.c
+++ b/src/buffering/buffer_empty_buffer.c
@@ -5,6 +5,7 @@ void buffer_empty_buffer(struct stardata_t * RESTRICT const stardata)
if(stardata && stardata->tmpstore)
{
Safe_free(stardata->tmpstore->raw_buffer);
+ Safe_free(stardata->tmpstore->error_buffer);
stardata->tmpstore->raw_buffer_size = 0;
}
}
diff --git a/src/buffering/buffer_info.c b/src/buffering/buffer_info.c
index 294c31f75d5bf83eddfff26f9fadf05dedc078c3..4afd781141c2ee8a39bd3ff167be7dd82186f28b 100644
--- a/src/buffering/buffer_info.c
+++ b/src/buffering/buffer_info.c
@@ -2,11 +2,44 @@
void buffer_info(const struct stardata_t * RESTRICT const stardata,
char ** const buffer,
- size_t * const size)
+ size_t * const size,
+ char ** const error_buffer
+ )
{
/*
- * Return the buffer location and size for external access
+ * Set the buffer location and size for external access
*/
- *buffer = stardata->tmpstore->raw_buffer;
- *size = stardata->tmpstore->raw_buffer_size;
+ if(buffer != NULL)
+ {
+ *buffer = NULL;
+ }
+ if(size != NULL)
+ {
+ *size = 0;
+ }
+ if(error_buffer != NULL)
+ {
+ *error_buffer = NULL;
+ }
+
+ if(stardata != NULL &&
+ stardata->tmpstore != NULL)
+ {
+ if(buffer != NULL)
+ {
+ *buffer = stardata->tmpstore->raw_buffer;
+ }
+ if(size != NULL)
+ {
+ *size = stardata->tmpstore->raw_buffer_size;
+ }
+
+ /*
+ * Ditto for the error buffer
+ */
+ if(error_buffer != NULL)
+ {
+ *error_buffer = stardata->tmpstore->error_buffer;
+ }
+ }
}
diff --git a/src/buffering/buffer_stack_len.c b/src/buffering/buffer_stack_len.c
deleted file mode 100644
index c6f876c47316b2ca68b76d106a38ce7996f16755..0000000000000000000000000000000000000000
--- a/src/buffering/buffer_stack_len.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include "../binary_c.h"
-
-#ifdef BUFFERED_STACK
-#include "printf_stack.h"
-
-int Pure_function buffer_stack_len(const struct stardata_t * RESTRICT const stardata)
-{
- return Stack_size;
-}
-#endif // BUFFERED_STACK
diff --git a/src/buffering/buffer_stack_pop.c b/src/buffering/buffer_stack_pop.c
deleted file mode 100644
index e30e79d3616650b1ca7288797deb9c60d21b8104..0000000000000000000000000000000000000000
--- a/src/buffering/buffer_stack_pop.c
+++ /dev/null
@@ -1,68 +0,0 @@
-#include "../binary_c.h"
-
-#ifdef BUFFERED_STACK
-#include "printf_stack.h"
-
-int buffer_stack_pop(struct stardata_t * const stardata,
- char * const c)
-{
- if(!stardata) return 0;
- int ret = 0;
- int modewas = stardata->preferences->output_type;
- stardata->preferences->output_type=0;
-
-#ifdef PRINTF_DEBUG
- fprintf(stderr,"buffer_stack_pop c=%p\n",c);
-#endif
-
- if(stardata && Stack_size==0) return 0;
-
- if(c!=NULL)
- {
- /* copy the first string on the buffer to *c */
- strlcpy(c,*Stream_buffer,STREAM_BUFFER_LINELENGTH);
-
-#ifdef PRINTF_DEBUG
- fprintf(stderr,"copied into c '%s'\n",c);
-#endif
- }
-
- /* free it */
-#ifdef PRINTF_DEBUG
- fprintf(stderr,"Try to free top of stream buffer %p (string '%s')\n",*Stream_buffer,*Stream_buffer);
-#endif
- if(stardata) Safe_free(*Stream_buffer);
-#ifdef PRINTF_DEBUG
- fprintf(stderr,"freed top of stream buffer\n");
-#endif
- /* shift all the strings down (could probably do this with a memmove) */
- int i;
- for(i=1;i<stardata->preferences->stream_buffer_stacksize;i++)
- {
- *(Stream_buffer + i-1) = *(Stream_buffer + i);
- }
-#ifdef PRINTF_DEBUG
- fprintf(stderr,"Moved all\n");
-#endif
- /* reduce the cache size */
- Stack_size--;
-#ifdef PRINTF_DEBUG
- fprintf(stderr,"stack now of size %d\n",Stack_size);
-#endif
- /* restore output mode */
- stardata->preferences->output_type=modewas;
-
- if(stardata->preferences->stream_buffer_stacksize==0)
- {
- /* stack empty : free memory */
- free_buffer_stack(stardata);
- ret = 0;
- }
- else
- {
- /* return 1 : success */
- ret = 1;
- }
- return ret;
-}
-#endif // BUFFERED_STACK
diff --git a/src/buffering/buffer_stack_push.c b/src/buffering/buffer_stack_push.c
deleted file mode 100644
index a6515ae4d95440cc5e7e4d8cfe3f42d3bb2b6a75..0000000000000000000000000000000000000000
--- a/src/buffering/buffer_stack_push.c
+++ /dev/null
@@ -1,69 +0,0 @@
-#include "../binary_c.h"
-
-#ifdef BUFFERED_STACK
-#include "printf_stack.h"
-#define PRINTF_DEBUG
-int buffer_stack_push(struct stardata_t * const stardata,
- const char *__restrict__ const format,
- va_list args)
-{
- int ret;
-#ifdef PRINTF_DEBUG
- fprintf(stderr,"STACK PUSH, was size %d\n",Stack_size);
- if(Stack_size>0)
- {
- fprintf(stderr,"PREVIOUS \"%s\"\n",Previous_stack_string);
- }
-#endif
-
- if((Stack_size>0) && (strrchr(Previous_stack_string, '\n')==NULL))
- {
- /* previous string has no newline : append */
- size_t n = (size_t)STREAM_BUFFER_LINELENGTH - strlen(Previous_stack_string);
- char *c = Previous_stack_string+strlen(Previous_stack_string);
- ret = vsnprintf(c,n,format,args);
-#ifdef PRINTF_DEBUG
- fprintf(stderr,"Appended %s\n",Previous_stack_string);
-#endif
- }
- else
- {
- /* new entry */
-
- /* lengthen the stream buffer stack */
- Stream_buffer = Realloc(Stream_buffer,sizeof(char *)*(Stack_size+1));
- if(Stream_buffer==NULL)
- {
- fprintf(stderr,"Could not access stream buffer pointer (it's NULL!)\n");
- ret = 0;
- }
-
-#ifdef PRINTF_DEBUG
- fprintf(stderr,"realloced buffer at p=%p\n",Stream_buffer);
-#endif
- /* allocate space for the string */
- Next_stack_string = Malloc(Stack_string_size);
- if(Next_stack_string == NULL)
- {
- fprintf(stderr,"Could not allocate space for Next stack string\n");
- ret = 0;
- }
-
-#ifdef PRINTF_DEBUG
- fprintf(stderr,"New buffer entry : Allocated string space at p=%p\n",Next_stack_string);
-#endif
-
- /* set string in the stack */
- ret=vsnprintf(Next_stack_string,STREAM_BUFFER_LINELENGTH,format,args);
-
-#ifdef PRINTF_DEBUG
- fprintf(stderr,"Set in buffer at %d = '%s'\n",Stack_size,Next_stack_string);
-#endif
- Stack_size ++;
- }
-
- return ret;
-}
-
-
-#endif // BUFFERED_STACK
diff --git a/src/buffering/buffered_printf.c b/src/buffering/buffered_printf.c
index cdfbdc88f32459857015acb059ea45d84e6239d8..37de93182c4422ef92c9dc9e11d38d852bf55396 100644
--- a/src/buffering/buffered_printf.c
+++ b/src/buffering/buffered_printf.c
@@ -1,20 +1,32 @@
#define _GNU_SOURCE
#include "../binary_c.h"
+#include "buffering_macros.h"
-#undef BUFFERED_STRING_OVERRUN_WARNINGS
-#define BUFFERED_STRING_OVERRUN_WARNINGS
-#undef BUFFERED_PRINTF_MAX_BUFFER_SIZE
-#define BUFFERED_PRINTF_MAX_BUFFER_SIZE ((size_t)(1024*1))
+/*
+ * testing settings
+ */
+/*
+ #undef BUFFERED_STRING_OVERRUN_WARNINGS
+ #define BUFFERED_STRING_OVERRUN_WARNINGS
+ #undef BUFFERED_PRINTF_MAX_BUFFER_SIZE
+ #define BUFFERED_PRINTF_MAX_BUFFER_SIZE ((size_t)(1024*2))
+*/
-size_t __deslash(char * string);
+static size_t __deslash(char * const string);
+static void __buffered_printf_error(struct tmpstore_t * t,
+ const char * const format,
+ ...);
/*
* Send some output into the buffer.
*
+ * Returns the number of characters put into the buffer,
+ * or <=0 on error.
+ *
* Note: in case of error, do NOT call Exit_binary_c
* because that will call this function which results
- * in a loop. Instead, use the small amount of the buffer
- * which is allocated for errors.
+ * in a loop. Instead, use the error buffer and return
+ * an error code (<=0, see buffered_printf_macros.h).
*
* There are several things we do:
*
@@ -26,6 +38,16 @@ size_t __deslash(char * string);
* This is the big buffer which is eventually output
* e.g. through the API. This has maximum size
* BUFFERED_PRINTF_MAX_BUFFER_SIZE.
+ *
+ * Third, we copy the buffer_string into the raw_buffer.
+ *
+ * If there is a failure, e.g. the raw_buffer is full,
+ * return the appropriate error code and set the error_buffer.
+ *
+ * If we cannot set the error_buffer, output a message to stderr.
+ *
+ * If we cannot do that, we cannot do much and it's up to you
+ * to fix things.
*/
int Gnu_format_args(3,4) buffered_printf(
@@ -38,248 +60,268 @@ int Gnu_format_args(3,4) buffered_printf(
va_list args;
va_start(args,format);
- if(stardata &&
- stardata->tmpstore)
+ /* alias tmpstore often */
+ struct tmpstore_t * RESTRICT const t =
+ stardata != NULL ? stardata->tmpstore : NULL;
+
+ if(t != NULL)
{
- struct tmpstore_t * RESTRICT const t = stardata->tmpstore;
/*
- * Make the string
+ * Allocate memory for the error_buffer if it
+ * is not already allocated
*/
- char * string;
- size_t dn = (size_t)(
- sizeof(char)*
- (size_t)vasprintf(&string,
- format,
- args)
- );
+ if(unlikely(stardata->tmpstore->error_buffer == NULL))
+ {
+ stardata->tmpstore->error_buffer =
+ Malloc(sizeof(char)*BUFFERED_PRINTF_ERROR_BUFFER_SIZE);
+ }
- if(dn == -1)
+ /*
+ * We cannot set the error buffer : output
+ * to stderr and just return.
+ */
+ if(stardata->tmpstore->error_buffer == NULL)
{
- /*
- * asprintf error, e.g. memory allocation failed.
- */
- //buffered_printf_error_handler(stardata);
- retval = 0;
+ fprintf(stderr,
+ "stardata->tmpstore->error_buffer could not be allocated in buffered_printf().\n");
+ return BUFFERED_PRINTF_ERROR_BUFFER_ALLOC_ERROR;
}
else
{
+
/*
- * We made the output string, now process it
+ * Make the string based on the format string
+ * and args passed in.
*/
- if(unlikely(deslash == TRUE))
+ char * string;
+ size_t dn = (size_t)(
+ sizeof(char)*
+ (size_t)vasprintf(&string,
+ format,
+ args)
+ );
+
+ if(dn == -1)
{
/*
- * convert _slash_ to /
+ * asprintf error
*/
- dn = __deslash(string);
+ retval = BUFFERED_PRINTF_ASPRINTF_ERROR;
+ __buffered_printf_error(t,
+ "SYSTEM_ERROR failed to asprintf string in buffered_printf()\n");
}
-
- /*
- fprintf(stdout,
- "BUFPRINT %uz (%uz to %uz) \"%s\" (stardata %p prefs %p internal_buffering %d)\n",
- dn,
- t->raw_buffer_size,
- t->raw_buffer_size+dn,
- string,
- stardata,
- stardata->preferences,
- stardata->preferences->internal_buffering
- );
- fflush(NULL);
- */
- if(likely(stardata &&
- stardata->preferences) &&
- stardata->preferences->internal_buffering)
+ else
{
- /*
- * data should be buffered here, then dumped
- * elsewhere (e.g. at the end of evolution)
- */
-
/*
- * If a buffer already exists, and it ends in \n\0,
- * reduce the buffer size by 1 to overwrite the NULL
- * char at the end.
+ * We made the output string
+ *
+ * Perhaps deslash it...
*/
- if(t->raw_buffer != NULL &&
- t->raw_buffer_size >2 &&
- t->raw_buffer[t->raw_buffer_size-1] == '\0' &&
- t->raw_buffer[t->raw_buffer_size-2] == '\n')
+ if(unlikely(deslash == TRUE))
{
- t->raw_buffer_size--;
+ /*
+ * convert _slash_ to /
+ */
+ dn = __deslash(string);
}
/*
- * If final char in the new string is a newline, require a NULL
- * after it just in case this is the end
- */
- const size_t lastn = Max(0,dn - 1);
- const Boolean require_null = string[lastn] == '\n';
+ fprintf(stdout,
+ "BUFPRINT %uz (%uz to %uz) \"%s\" (stardata %p prefs %p internal_buffering %d)\n",
+ dn,
+ t->raw_buffer_size,
+ t->raw_buffer_size+dn,
+ string,
+ stardata,
+ stardata->preferences,
+ stardata->preferences->internal_buffering
+ );
+ fflush(NULL);
+ */
- // TODO CHECK THIS
- //if(require_null==TRUE && dn<MAX_BUFFERED_STRING_LENGTH) dn++;
/*
- * Calculate the size of the buffer
+ * Now check the raw_buffer: do we need to
+ * make it larger?
*/
- const size_t new_buffer_size = t->raw_buffer_size + (size_t)(dn + 1);
-
- /*
- * Calculate the size of what needs to be allocated
- */
- const size_t new_alloc_size = new_buffer_size > t->raw_buffer_alloced ?
- Max(new_buffer_size+1,
- (size_t)(BUFFERED_PRINTF_INCREASE_RATIO * t->raw_buffer_alloced)) :
- t->raw_buffer_alloced;
-
- fprintf(stderr,"new_alloc_size %zu vs %zu\n",new_alloc_size,BUFFERED_PRINTF_MAX_BUFFER_SIZE);
-
- if(new_alloc_size < BUFFERED_PRINTF_MAX_BUFFER_SIZE - BUFFERED_PRINTF_ERROR_BUFFER_SIZE)
+ if(dn > 0 &&
+ likely(stardata != NULL &&
+ stardata->preferences != NULL) &&
+ stardata->preferences->internal_buffering > 0)
{
+ /*
+ * data should be buffered here, then dumped
+ * elsewhere (e.g. at the end of evolution)
+ */
+
/*
- * Allocate more memory for the buffer
+ * If a buffer already exists, and it ends in \n\0,
+ * reduce the buffer size by 1 to overwrite the NULL
+ * char at the end with the string.
*/
- fprintf(stderr,"new alloc size too small\n");
- if(new_alloc_size > t->raw_buffer_alloced)
+ if(t->raw_buffer_size > 2 &&
+ t->raw_buffer[t->raw_buffer_size-1] == '\0'
+ && t->raw_buffer[t->raw_buffer_size-2] == '\n')
{
- t->raw_buffer = t->raw_buffer==NULL ?
- Malloc(dn+1) :
- Realloc(t->raw_buffer,new_alloc_size);
-#ifdef BUFFER_MEMORY_DEBUGGING
- fprintf(stderr,//BUFFER_MEMORY_DEBUGGING_STREAM,
- "Realloc %6.2f %s\n", \
- Mem_size_string_deciam(new_alloc_size));
-
-#endif
+ t->raw_buffer_size--;
}
-
- if(t != NULL &&
- t->raw_buffer != NULL)
- {
- t->raw_buffer_alloced = new_alloc_size;
+
+ /*
+ * If final char in the new string is a newline, require a NULL
+ * after it just in case this is the end
+ */
+ const size_t lastn = Max(0,dn - 1);
+ const Boolean require_null = string[lastn] == '\n';
- /* put string in the buffer */
- memcpy(t->raw_buffer + t->raw_buffer_size,string,dn);
- t->raw_buffer_size += dn;
+ if(require_null==TRUE) dn++;
- /* make trailing byte NULL if trailing byte is \n */
- if(require_null)
- {
- t->raw_buffer[t->raw_buffer_size-1]='\0';
- }
-
- /* return number of characters processed */
- retval = (int)(dn/sizeof(char));
- }
- else
- {
- printf("error\n");fflush(NULL);
- dn = BUFFERED_PRINTF_ERROR_BUFFER_SIZE;
-
- const size_t new_buffer_size = t->raw_buffer_size + (size_t)(dn + 1);
+ /*
+ * Calculate the size of the new buffer
+ */
+ const size_t new_buffer_size = t->raw_buffer_size + (size_t)(dn + 1);
+
+ /*
+ * Calculate the size of what needs to be allocated
+ */
+ const size_t new_alloc_size =
+ new_buffer_size > t->raw_buffer_alloced ?
+ /* require more memory */
+ Max(new_buffer_size+1,
+ (size_t)(BUFFERED_PRINTF_INCREASE_RATIO * t->raw_buffer_alloced)) :
+
+ /* previous size was enough */
+ t->raw_buffer_alloced;
+
+ /*
+ printf("new alloc size %zu vs MAX %zu vs alloced %zu (dn = %zu)\n",
+ new_alloc_size,
+ BUFFERED_PRINTF_MAX_BUFFER_SIZE,
+ t->raw_buffer_alloced,
+ dn);
+ */
+ if(new_alloc_size < BUFFERED_PRINTF_MAX_BUFFER_SIZE)
+ {
/*
- * THIS CANNOT BE RIGHT: new_alloc_size is used twice!
+ * Required size is less than the max buffer size.
+ *
+ * Allocate memory for the buffer if more
+ * is required.
+ *
+ * Note: we assume a generic error unless
+ * we succeed.
*/
- size_t new_alloc_size = new_buffer_size > t->raw_buffer_alloced ?
- Max(new_buffer_size,
- (size_t)((size_t)BUFFERED_PRINTF_INCREASE_RATIO * t->raw_buffer_alloced + BUFFERED_PRINTF_ERROR_BUFFER_SIZE)) :
- t->raw_buffer_alloced;
- new_alloc_size++;
+ retval = BUFFERED_PRINTF_GENERIC_ERROR;
- printf("cf new_alloc_size %zu to alloced %zu\n",
- new_alloc_size,
- t->raw_buffer_alloced);
-
if(new_alloc_size > t->raw_buffer_alloced)
{
- t->raw_buffer = t->raw_buffer==NULL ?
- Malloc(dn+1) :
+ t->raw_buffer =
+ t->raw_buffer == NULL ?
+ Malloc(new_alloc_size) :
Realloc(t->raw_buffer,new_alloc_size);
+#ifdef BUFFER_MEMORY_DEBUGGING
+ fprintf(stderr,
+ "Realloc %6.2f %s\n", \
+ Mem_size_string_deciam(new_alloc_size));
+#endif
+
+ if(t->raw_buffer == NULL)
+ {
+ /*
+ * Alloc failed
+ */
+ retval = BUFFERED_PRINTF_ALLOC_ERROR;
+ __buffered_printf_error(t,
+ "SYSTEM_ERROR Malloc/Realloc failed, out of memory? tmpstore = %p\n");
+ }
}
+ /*
+ * Copy the string to the raw_buffer if we can
+ */
if(t != NULL &&
t->raw_buffer != NULL)
{
+ /*
+ * Alloc success: update buffer size
+ */
t->raw_buffer_alloced = new_alloc_size;
- }
-
- retval = 0;
- }
- }
- else
- {
- fprintf(stderr,"Cannot output\n");
- /*
- * We cannot output : this means we have filled the
- * buffer.
- * Return an error (so we count the failed stars)
- * but also end evolution by setting time to the max time.
- */
- stardata->model.time = stardata->model.max_evolution_time;
-
- dn = BUFFERED_PRINTF_ERROR_BUFFER_SIZE;
- size_t new_alloc_size = new_buffer_size > t->raw_buffer_alloced ?
- Max(new_buffer_size,
- (size_t)((size_t)BUFFERED_PRINTF_INCREASE_RATIO * t->raw_buffer_alloced)) :
- t->raw_buffer_alloced;
+ /* put string in the buffer */
+ memcpy(t->raw_buffer + t->raw_buffer_size,
+ string,
+ dn);
- if(new_alloc_size > t->raw_buffer_alloced)
- {
- t->raw_buffer = t->raw_buffer==NULL ?
- Malloc(dn+1) : Realloc(t->raw_buffer,new_alloc_size);
- }
+ t->raw_buffer_size += dn;
- if(t != NULL &&
- t->raw_buffer != NULL)
- {
- t->raw_buffer_alloced = new_alloc_size;
+ /* make trailing byte NULL if trailing byte is \n */
+ if(require_null)
+ {
+ t->raw_buffer[t->raw_buffer_size-1]='\0';
+ }
+
+ /* return number of characters processed */
+ retval = (int)(dn/sizeof(char));
+ }
}
-
- if(t)
+ else
{
- fprintf(stderr,
- "error snprintf %zu\n",
- BUFFERED_PRINTF_ERROR_BUFFER_SIZE-1);
- snprintf(
- string,
- BUFFERED_PRINTF_ERROR_BUFFER_SIZE-1,
- "SYSTEM_ERROR Cannot Printf because buffer has been exceeded (want %zu bytes, max is %zu)\n",
- new_alloc_size,
- BUFFERED_PRINTF_MAX_BUFFER_SIZE);
- memcpy(t->raw_buffer + t->raw_buffer_size,
- string,
- dn);
- t->raw_buffer_size += dn;
+ /*
+ * We cannot output :
+ * this means we have filled the buffer.
+ */
+ retval = BUFFERED_PRINTF_FULL_ERROR;
+ __buffered_printf_error(t,
+ "SYSTEM_ERROR Cannot Printf because buffer has been exceeded (want %zu bytes, max is %zu)\n",
+ new_alloc_size,
+ BUFFERED_PRINTF_MAX_BUFFER_SIZE);
}
- retval = 0;;
}
- }
- else
- /* no buffering: just write directly to stdout */
- {
- fwrite((char *)string,(int)(dn/sizeof(char)),1,stdout);
+ else
+ /*
+ * no buffering: just write directly to stdout
+ */
+ {
+ fwrite((char *)string,(int)(dn/sizeof(char)),1,stdout);
+
+ /* return number of characters processed */
+ retval = (int)(dn/sizeof(char));
+ }
+ }
- /* return number of characters processed */
- retval = (int)(dn/sizeof(char));
- }
- }
-
+ Safe_free(string);
+ }
}
else
{
- retval = 0;
+ terminate_evolution(stardata);
+ retval = BUFFERED_PRINTF_STARDATA_ERROR;
}
va_end(args);
+
+ if(Buffered_printf_error(retval))
+ {
+ __buffered_printf_error(
+ stardata->tmpstore,
+ "SYSTEM_ERROR buffered_printf uncaught problem %d \"%s\" : time = %g\n",
+ retval,
+ Buffered_printf_error_string(retval),
+ stardata->model.time
+ );
+ terminate_evolution(stardata);
+ }
+
return retval;
}
-size_t __deslash(char * string)
+static size_t __deslash(char * const string)
{
+ /*
+ * convert _slash_ to / in string
+ */
char * match = strstr(string,"_slash_");
const size_t s = strlen(string);
while(match != NULL)
@@ -298,3 +340,47 @@ size_t __deslash(char * string)
}
return strlen(string);
}
+
+static void __buffered_printf_error(struct tmpstore_t * t,
+ const char * const format,
+ ...)
+{
+ /*
+ * There was an error in buffered_printf...
+ */
+ va_list args;
+ va_start(args,format);
+ if(t != NULL &&
+ t->error_buffer != NULL)
+ {
+ /*
+ * Send error string to the error_buffer
+ */
+ if(vsnprintf(t->error_buffer,
+ BUFFERED_PRINTF_ERROR_BUFFER_SIZE,
+ format,
+ args) >= BUFFERED_PRINTF_ERROR_BUFFER_SIZE)
+ {
+ /*
+ * Truncated error string : warn through stderr
+ */
+ fprintf(stderr,
+ "Error was truncated : ");
+ vfprintf(stderr,
+ format,
+ args);
+ }
+ t->error_buffer_set = TRUE;
+ }
+ else
+ {
+ /*
+ * Everything failed : output to stderr
+ * and hope someone is watching
+ */
+ vfprintf(stderr,
+ format,
+ args);
+ }
+ va_end(args);
+}
diff --git a/src/buffering/buffering_macros.h b/src/buffering/buffering_macros.h
new file mode 100644
index 0000000000000000000000000000000000000000..1cc335d93170c04fc14bdcc28e9dfb93a3e6c084
--- /dev/null
+++ b/src/buffering/buffering_macros.h
@@ -0,0 +1,33 @@
+#pragma once
+#ifndef BUFFERING_MACROS_H
+#define BUFFERING_MACROS_H
+
+/*
+ * buffered_printf error codes
+ */
+#define BUFFERED_PRINTF_GENERIC_ERROR 0
+#define BUFFERED_PRINTF_ASPRINTF_ERROR -1
+#define BUFFERED_PRINTF_ALLOC_ERROR -2
+#define BUFFERED_PRINTF_FULL_ERROR -3
+#define BUFFERED_PRINTF_STARDATA_ERROR -4
+#define BUFFERED_PRINTF_ERROR_BUFFER_ALLOC_ERROR -5
+
+/*
+ * Error string
+ */
+#define Buffered_printf_error_string(N) \
+ ( \
+ (N) == BUFFERED_PRINTF_GENERIC_ERROR ? "Generic" : \
+ (N) == BUFFERED_PRINTF_ASPRINTF_ERROR ? "asprintf" : \
+ (N) == BUFFERED_PRINTF_ALLOC_ERROR ? "alloc" : \
+ (N) == BUFFERED_PRINTF_FULL_ERROR ? "full" : \
+ (N) == BUFFERED_PRINTF_STARDATA_ERROR ? "stardata" : \
+ "unknown" \
+ )
+
+/*
+ * Macro to return true on error
+ */
+#define Buffered_printf_error(N) ((N)<=0)
+
+#endif//BUFFERING_MACROS_H
diff --git a/src/buffering/buffering_prototypes.h b/src/buffering/buffering_prototypes.h
index dc90a868502013ba2e0c2d15fb21e0fd19e6db26..3bf4caa0f66978ae9e6565941957631f6ca7b155 100644
--- a/src/buffering/buffering_prototypes.h
+++ b/src/buffering/buffering_prototypes.h
@@ -10,7 +10,8 @@ int buffered_printf(struct stardata_t * RESTRICT const stardata,
...) Gnu_format_args(3,4);
void buffer_info(const struct stardata_t * RESTRICT const stardata,
char ** const buffer,
- size_t * const size);
+ size_t * const size,
+ char ** const error_buffer);
void buffer_empty_buffer(struct stardata_t * RESTRICT const stardata);
void buffer_dump_to_stderr(const struct stardata_t * RESTRICT const stardata);
@@ -23,18 +24,8 @@ void binary_c_fail_fprintf(struct stardata_t * RESTRICT const stardata,
const char * RESTRICT const format,
...) Gnu_format_args(4,5) No_return;
-#ifdef BUFFERED_STACK
void clear_printf_buffer(struct stardata_t * RESTRICT const stardata);
-int binary_c_stack_printf(struct stardata_t * const stardata,
- __const char *__restrict__ const format, ...)
- Gnu_format_args(2,3);
-int Pure_function buffer_stack_len(const struct stardata_t * const stardata);
-int buffer_stack_pop(struct stardata_t * const stardata,
- char * const c);
-void free_buffer_stack(struct stardata_t * const stardata);
-int buffer_stack_push(struct stardata_t * const stardata,
- const char *__restrict__ const format,
- va_list args);
-#endif // BUFFERED_STACK
+void clear_error_buffer(struct stardata_t * RESTRICT const stardata);
+
#endif // BUFFERING_PROTOTYPES_H
diff --git a/src/buffering/clear_error_buffer.c b/src/buffering/clear_error_buffer.c
new file mode 100644
index 0000000000000000000000000000000000000000..2c874f1e8981ef5eccddfe24bcd7ebf4ed6b33fa
--- /dev/null
+++ b/src/buffering/clear_error_buffer.c
@@ -0,0 +1,18 @@
+#include "../binary_c.h"
+
+/*
+ * Dump the error buffer to stderr
+ */
+void clear_error_buffer(struct stardata_t * RESTRICT const stardata)
+{
+ if(stardata->tmpstore != NULL)
+ {
+ if(stardata->tmpstore->error_buffer != NULL)
+ {
+ fprintf(stderr,
+ "%s\n",
+ (char *)stardata->tmpstore->error_buffer);
+ Safe_free(stardata->tmpstore->error_buffer);
+ }
+ }
+}
diff --git a/src/buffering/clear_printf_buffer.c b/src/buffering/clear_printf_buffer.c
index 8f2c6c9cbeca7a0c970a77803813557dedf8ff9b..500432597823ce4c1f2fa8979a940b711742450f 100644
--- a/src/buffering/clear_printf_buffer.c
+++ b/src/buffering/clear_printf_buffer.c
@@ -1,51 +1,20 @@
#include "../binary_c.h"
//#include "./miniz.h"
-#ifdef BUFFERED_STACK
+
void clear_printf_buffer(struct stardata_t * RESTRICT const stardata)
{
-
- /*
- * Output and clear any stored printf buffer.
- * Does NOT fflush stdout.
- */
-
- if(stardata->tmpstore->raw_buffer_size>0)
+ if(stardata->tmpstore != NULL)
{
- if(stardata->preferences->internal_buffering_compression==0)
+ if(stardata->tmpstore->raw_buffer_size>0)
{
- /* no compression : just dump the buffer */
- printf("BUFU %d\n",(int)stardata->tmpstore->raw_buffer_size);
- fwrite((char *)stardata->tmpstore->raw_buffer,(int)stardata->tmpstore->raw_buffer_size,1,stdout);
- }
- else
- {
- /* require some compression */
- mz_ulong dest_len = compressBound(stardata->tmpstore->raw_buffer_size);
- unsigned char *dest = Malloc((size_t)dest_len);
- int i = compress2(dest,
- &dest_len,
- (const unsigned char*)stardata->tmpstore->raw_buffer,
- (mz_ulong)stardata->tmpstore->raw_buffer_size,
- stardata->preferences->internal_buffering_compression);
-
- if(i==0)
- {
- /* dump the buffer */
- printf("BUFC %d\n",(int)dest_len);
- fwrite((char *)dest,(int)dest_len,1,stdout);
- }
- else
- {
- fprintf(stderr,"ERROR failed to flush compressed printf buffer\n");
- }
- Safe_free(dest);
- }
+ fwrite(
+ (char *)stardata->tmpstore->raw_buffer,
+ (int)stardata->tmpstore->raw_buffer_size,
+ 1,
+ stdout);
+ }
+ Safe_free(stardata->tmpstore->raw_buffer);
+ stardata->tmpstore->raw_buffer_size = 0;
}
-
- /* free buffer memory */
- Safe_free(stardata->tmpstore->raw_buffer);
- stardata->tmpstore->raw_buffer_size = 0;
}
-#endif //BUFFERED_STACK
-
diff --git a/src/buffering/free_buffer_stack.c b/src/buffering/free_buffer_stack.c
deleted file mode 100644
index e9588cf233d4fafe4f04983a28f8f457caa49f4d..0000000000000000000000000000000000000000
--- a/src/buffering/free_buffer_stack.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include "../binary_c.h"
-
-#ifdef BUFFERED_STACK
-#include "printf_stack.h"
-
-void free_buffer_stack(struct stardata_t * const stardata)
-{
- /* clean up the whole buffer stack */
-#ifdef PRINTF_DEBUG
- fprintf(stderr,"Free buffer stack\n");
-#endif
- Safe_free(Stream_buffer);
-}
-
-#endif // BUFFERED_STACK
diff --git a/src/buffering/printf_stack.h b/src/buffering/printf_stack.h
deleted file mode 100644
index 6daa56ee8799545f9f487eb9cbb1c53ad2f27c44..0000000000000000000000000000000000000000
--- a/src/buffering/printf_stack.h
+++ /dev/null
@@ -1,19 +0,0 @@
-#pragma once
-#ifndef PRINTF_STACK_H
-#define PRINTF_STACK_H
-
-#define Stream_buffer stardata->tmpstore->stream_buffer
-
-#define Stack_string_size (sizeof(char)*STREAM_BUFFER_LINELENGTH)
-
-#define Stack_size (stardata->tmpstore->stream_buffer_stacksize)
-
-#define Next_stack_string *(stardata->tmpstore->stream_buffer+\
- stardata->tmpstore->stream_buffer_stacksize)
-
-#define Previous_stack_string *(stardata->tmpstore->stream_buffer+\
- stardata->tmpstore->stream_buffer_stacksize-1)
-
-#define Stack_string(A) *(stardata->tmpstore->stream_buffer+(A))
-
-#endif // PRINTF_STACK_H
diff --git a/src/evolution/evolution_cleanup.c b/src/evolution/evolution_cleanup.c
index 9c9b7cc4321188acf1413557ca3fefbbeb39c4bc..859a2028f523aa84254a2c59c20a7ecfa6eb070a 100644
--- a/src/evolution/evolution_cleanup.c
+++ b/src/evolution/evolution_cleanup.c
@@ -62,15 +62,16 @@ void evolution_cleanup(struct stardata_t * RESTRICT const stardata,
#endif
Dprint("Leaving function evolution()\n");
-
-#ifdef BUFFERED_STACK
- if(stardata->preferences->internal_buffering !=
- INTERNAL_BUFFERING_STORE)
+ /*
+ * Clear the binary_c printf buffer here, if required
+ * (this should have been done in log_every_timestep also)
+ */
+ if(stardata->preferences->internal_buffering ==
+ INTERNAL_BUFFERING_PRINT)
{
- /* flush any stored output buffer */
Clear_printf_buffer;
}
-#endif//BUFFERED_STACK
+
stardata->evolving = FALSE;
disable_binary_c_timeout();
diff --git a/src/evolution/evolution_prototypes.h b/src/evolution/evolution_prototypes.h
index 9a92c5e89cbdb3cdaa92553a8c0ef1a8cd4d22eb..571ea0e248affb8a6fc23026e4d6d74b978a6103 100644
--- a/src/evolution/evolution_prototypes.h
+++ b/src/evolution/evolution_prototypes.h
@@ -79,7 +79,7 @@ void evolution_forward_Euler(struct stardata_t * RESTRICT const stardata);
void evolution_rejection_tests(struct stardata_t * RESTRICT const stardata);
void free_difflogstack(struct difflogstack_t * RESTRICT const logstack);
-
+void terminate_evolution(struct stardata_t * const stardata);
#endif /* EVOLUTION_PROTOTYPES_H */
diff --git a/src/evolution/terminate_evolution.c b/src/evolution/terminate_evolution.c
new file mode 100644
index 0000000000000000000000000000000000000000..3875b550a5dd5fcc193c91766f4ea58f45a403a1
--- /dev/null
+++ b/src/evolution/terminate_evolution.c
@@ -0,0 +1,10 @@
+#include "../binary_c.h"
+
+
+void terminate_evolution(struct stardata_t * const stardata)
+{
+ /*
+ * End evolution by setting the time to the max_evolution_time
+ */
+ stardata->model.time = stardata->model.max_evolution_time;
+}
diff --git a/src/exit_binaryc.c b/src/exit_binaryc.c
index 5bcecbd787fe700bf577fbd3f173cc61ad0f1d49..dccf08710c8abc1c69e4175b2cdb9e7f5d218682 100644
--- a/src/exit_binaryc.c
+++ b/src/exit_binaryc.c
@@ -124,10 +124,6 @@ static void No_return Gnu_format_args(6,0) exit_binary_c_handler(struct stardata
vsnprintf(s,MAX_EXIT_STATEMENT_PRINT_SIZE,format,args);
chomp(s);
-#ifdef BUFFERED_STACK
- //Dprint("Dump buffer to stderr\n");
- //dump_buffer_to_stderr();
-#endif
Boolean longjump = (binary_c_error_code != BINARY_C_NORMAL_BATCHMODE_EXIT &&
binary_c_error_code != BINARY_C_SPECIAL_EXIT)
diff --git a/src/logging/log_every_timestep.c b/src/logging/log_every_timestep.c
index 9d39042c8762414cfde276b620b1f5e1fd3fedf3..18a637183c5700078b7884602b106894f5aab5cb 100644
--- a/src/logging/log_every_timestep.c
+++ b/src/logging/log_every_timestep.c
@@ -14,25 +14,19 @@
* #endif // FRED
*
* You should use the Printf() binary_c macro instead
- * of printf(). This allows binary_c to (perhaps) compress
- * the output which is then sent to stdout (and binary_grid).
+ * of printf().
*
- * Whether compression is faster, or not, depends on many
- * factors. RGI's basic experiments suggest it is not, but
- * your experience on your hardware may differ.
*/
#include "../binary_c.h"
-#include "buffering/printf_stack.h"
-
void log_every_timestep(struct stardata_t * RESTRICT const stardata)
{
/*
* No logging when RLOF-interpolating
* (negative timesteps are bad!).
*/
- if(unlikely(stardata->model.dtm<-TINY)) return;
+ if(unlikely(stardata->model.dtm<-TINY)) return;
/* timestep and dtp */
const Boolean first_timestep=Is_zero(stardata->model.time);
@@ -2165,16 +2159,7 @@ void log_every_timestep(struct stardata_t * RESTRICT const stardata)
#endif
-#ifdef BUFFERED_STACK
- /*
- * Clear the binary_c printf buffer here, if required
- */
- if(stardata->preferences->internal_buffering ==
- INTERNAL_BUFFERING_PRINT)
- {
- Clear_printf_buffer;
- }
-#endif//BUFFERED_STACK
+
/*
printf("LRLOF %g %g %g %g %g %g %g %g\n",
@@ -2539,24 +2524,6 @@ void log_every_timestep(struct stardata_t * RESTRICT const stardata)
Printf("\n");
#endif // SYSTEM_LOGGING
- if(stardata->preferences->custom_output_function != NULL)
- {
- Dprint("calling custom output function %p\n",
- stardata->preferences->custom_output_function);
- stardata->preferences->custom_output_function(stardata);
- }
-
- if(timestep_fixed_trigger(stardata,FIXED_TIMESTEP_TEST))
- {
- if(NUCLEAR_BURNING_BINARY)
- {
- Printf("test %g %d %d\n",
- stardata->model.time,
- stardata->star[0].stellar_type,
- stardata->star[1].stellar_type
- );
- }
- }
#ifdef ZW2019_SNIA_LOG
{
@@ -2673,4 +2640,33 @@ void log_every_timestep(struct stardata_t * RESTRICT const stardata)
}
}
#endif//GAIAHRD
+
+ if(stardata->preferences->custom_output_function != NULL)
+ {
+ Dprint("calling custom output function %p\n",
+ stardata->preferences->custom_output_function);
+ //printf("CUSTOM OUT stardata %p\n",stardata);
+ stardata->preferences->custom_output_function(stardata);
+ }
+
+ if(timestep_fixed_trigger(stardata,FIXED_TIMESTEP_TEST))
+ {
+ if(NUCLEAR_BURNING_BINARY)
+ {
+ Printf("test %g %d %d\n",
+ stardata->model.time,
+ stardata->star[0].stellar_type,
+ stardata->star[1].stellar_type
+ );
+ }
+ }
+
+ /*
+ * Clear the binary_c printf buffer here, if required
+ */
+ if(stardata->preferences->internal_buffering ==
+ INTERNAL_BUFFERING_PRINT)
+ {
+ Clear_printf_buffer;
+ }
}
diff --git a/src/memory/build_tmpstore_contents.c b/src/memory/build_tmpstore_contents.c
index fa8e2e844cf62e45b941a80743defc98a488ce05..90963b3a63dfcd6d62ac68bbc713cb46d91062f7 100644
--- a/src/memory/build_tmpstore_contents.c
+++ b/src/memory/build_tmpstore_contents.c
@@ -4,5 +4,9 @@
void build_tmpstore_contents(struct tmpstore_t * RESTRICT const tmpstore)
{
+ if(tmpstore->error_buffer == NULL)
+ {
+ tmpstore->error_buffer = Malloc(sizeof(char)*BUFFERED_PRINTF_ERROR_BUFFER_SIZE);
+ }
rinterpolate_alloc_dataspace(&tmpstore->rinterpolate_data);
}
diff --git a/src/memory/free_tmpstore.c b/src/memory/free_tmpstore.c
index 72403a4bb73a4ea78e76c124028620a97d0b197d..6b74ade55cc4eeae807724201e8b5eb826fd2fb7 100644
--- a/src/memory/free_tmpstore.c
+++ b/src/memory/free_tmpstore.c
@@ -23,15 +23,12 @@ void free_tmpstore(struct tmpstore_t * RESTRICT const tmpstore)
Tmp_free(stellar_magnitudes[k]);
}
}
-
+ Tmp_free(error_buffer);
Tmp_free(raw_buffer);
Tmp_free(stellar_structure_newstar);
Tmp_free(stellar_evolution_newstar);
Tmp_free(buffer_string);
tmpstore->raw_buffer_size=0;
-#ifdef BUFFERED_STACK
- binary_c_stack_printf(NULL,NULL);
-#endif
#ifdef BATCHMODE
Tmp_free(batchstring);
Tmp_free(batchstring2);
diff --git a/src/nucsyn/nucsyn_set_third_dredgeup_abunds.c b/src/nucsyn/nucsyn_set_third_dredgeup_abunds.c
index eab31991add21fa2852ebd7a77a78d2d9460a11c..210d34859e8e2c2b91bbdeed58bb8af1c5d34f2c 100644
--- a/src/nucsyn/nucsyn_set_third_dredgeup_abunds.c
+++ b/src/nucsyn/nucsyn_set_third_dredgeup_abunds.c
@@ -128,7 +128,7 @@ void nucsyn_set_third_dredgeup_abunds(Abundance * RESTRICT const dup_material,
if((dup_material[i]<-TINY)||(dup_material[i]>1.0))
{
Exit_binary_c(BINARY_C_OUT_OF_RANGE,
- "Isotope %d = %g: this cannot be correct!\n",i,dup_material[i]);
+ "Isotope %u = %g: this cannot be correct!\n",i,dup_material[i]);
}
}
}
diff --git a/src/perl/modules_targz/Binning-0.03.tar.gz b/src/perl/modules_targz/Binning-0.03.tar.gz
index 6ea9a451d884dd8842fabd3f6a8876a907af5164..b53e5b607482c17ed57e8d2f49d9fcd4fa46b634 100644
Binary files a/src/perl/modules_targz/Binning-0.03.tar.gz and b/src/perl/modules_targz/Binning-0.03.tar.gz differ
diff --git a/src/perl/modules_targz/Data-Serializer-RobJSON-0.05.tar.gz b/src/perl/modules_targz/Data-Serializer-RobJSON-0.05.tar.gz
index bedb7c0a9f574a80343ec279e38eadd964ef33fe..85d4acd864a2b6ec64b528240cc72ca526fc610c 100644
Binary files a/src/perl/modules_targz/Data-Serializer-RobJSON-0.05.tar.gz and b/src/perl/modules_targz/Data-Serializer-RobJSON-0.05.tar.gz differ
diff --git a/src/perl/modules_targz/Hash-RobMerge-0.14.tar.gz b/src/perl/modules_targz/Hash-RobMerge-0.14.tar.gz
index ce7a5103ed655644e1752f7143a61e48b83caa48..8a6a0f21a0995a296995f601f4a07951625b0e82 100644
Binary files a/src/perl/modules_targz/Hash-RobMerge-0.14.tar.gz and b/src/perl/modules_targz/Hash-RobMerge-0.14.tar.gz differ
diff --git a/src/perl/modules_targz/Histogram-0.01.tar.gz b/src/perl/modules_targz/Histogram-0.01.tar.gz
index a84919d73a2f960f0206cc69021e0e3657fa04ec..47744b3357b0e0f40a9ffcd1a86a28e9f0eb53a6 100644
Binary files a/src/perl/modules_targz/Histogram-0.01.tar.gz and b/src/perl/modules_targz/Histogram-0.01.tar.gz differ
diff --git a/src/perl/modules_targz/IMF-0.05.tar.gz b/src/perl/modules_targz/IMF-0.05.tar.gz
index 590a7bb457c46ef543f978e1ca12873857f81cb4..9c3aabc50ec4b3e851da72f29a468ab5fc6eb81e 100644
Binary files a/src/perl/modules_targz/IMF-0.05.tar.gz and b/src/perl/modules_targz/IMF-0.05.tar.gz differ
diff --git a/src/perl/modules_targz/Maths_Double-0.01.tar.gz b/src/perl/modules_targz/Maths_Double-0.01.tar.gz
index c9d4ea358de7cd0697d55a6e8c4c087f81a0a891..38078314520eebd56e5c70a4d7c5f6261dc019ac 100644
Binary files a/src/perl/modules_targz/Maths_Double-0.01.tar.gz and b/src/perl/modules_targz/Maths_Double-0.01.tar.gz differ
diff --git a/src/perl/modules_targz/binary_grid-v2.1.1.tar.gz b/src/perl/modules_targz/binary_grid-v2.1.1.tar.gz
deleted file mode 100644
index aa112c2b78aeeb53655e0a48a34788fae41405ae..0000000000000000000000000000000000000000
Binary files a/src/perl/modules_targz/binary_grid-v2.1.1.tar.gz and /dev/null differ
diff --git a/src/perl/modules_targz/binary_grid-v2.1.2.tar.gz b/src/perl/modules_targz/binary_grid-v2.1.2.tar.gz
deleted file mode 100644
index 84e9b731749c57f32d16219ed8d61471c3546aa9..0000000000000000000000000000000000000000
Binary files a/src/perl/modules_targz/binary_grid-v2.1.2.tar.gz and /dev/null differ
diff --git a/src/perl/modules_targz/binary_grid-v2.1.3.tar.gz b/src/perl/modules_targz/binary_grid-v2.1.3.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..2b4e9d52d3787e04b29c19a171f60846d4b702ef
Binary files /dev/null and b/src/perl/modules_targz/binary_grid-v2.1.3.tar.gz differ
diff --git a/src/perl/modules_targz/binary_stars-0.05.tar.gz b/src/perl/modules_targz/binary_stars-0.05.tar.gz
index d7f548d3d887a23d9d6754613575185d8090c433..90693bbb9f83597828e4da0fe74c9011128b263b 100644
Binary files a/src/perl/modules_targz/binary_stars-0.05.tar.gz and b/src/perl/modules_targz/binary_stars-0.05.tar.gz differ
diff --git a/src/perl/modules_targz/cosmology-0.01.tar.gz b/src/perl/modules_targz/cosmology-0.01.tar.gz
index bd29957ded1eeac68e09967132014c35b6728ad0..1acde115378b8acd5c97c7059f911d955b38e2cb 100644
Binary files a/src/perl/modules_targz/cosmology-0.01.tar.gz and b/src/perl/modules_targz/cosmology-0.01.tar.gz differ
diff --git a/src/perl/modules_targz/deps b/src/perl/modules_targz/deps
index 12b6165635875dc2cabb8ba3325a57fc08e44e11..27e24b2c6a49b95721f232257576dbd206018f95 100644
--- a/src/perl/modules_targz/deps
+++ b/src/perl/modules_targz/deps
@@ -1,4 +1,4 @@
-rob_misc-0.15.tar.gz
+rob_misc-0.16.tar.gz
Hash-RobMerge-0.14.tar.gz
Histogram-0.01.tar.gz
binary_stars-0.05.tar.gz
diff --git a/src/perl/modules_targz/distribution_functions-0.05.tar.gz b/src/perl/modules_targz/distribution_functions-0.05.tar.gz
index 9edee76ce79ba7749d83b09b3861d2876ff70913..32a961adc17feb3f54c28cdfec96005023577290 100644
Binary files a/src/perl/modules_targz/distribution_functions-0.05.tar.gz and b/src/perl/modules_targz/distribution_functions-0.05.tar.gz differ
diff --git a/src/perl/modules_targz/rob_misc-0.15.tar.gz b/src/perl/modules_targz/rob_misc-0.15.tar.gz
deleted file mode 100644
index 0be58eacc35c29788dc4f6c3f7772bc52e46b0c1..0000000000000000000000000000000000000000
Binary files a/src/perl/modules_targz/rob_misc-0.15.tar.gz and /dev/null differ
diff --git a/src/perl/modules_targz/rob_misc-0.16.tar.gz b/src/perl/modules_targz/rob_misc-0.16.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..88bcdb02998d677305a7976505a25e2e84b0ebfa
Binary files /dev/null and b/src/perl/modules_targz/rob_misc-0.16.tar.gz differ
diff --git a/src/perl/modules_targz/robqueue-0.05.tar.gz b/src/perl/modules_targz/robqueue-0.05.tar.gz
index d84f80556a2f3246db46dbdf483c0618ed4d937f..6a3508cd0048f85ed2b197b1d52d23805c793505 100644
Binary files a/src/perl/modules_targz/robqueue-0.05.tar.gz and b/src/perl/modules_targz/robqueue-0.05.tar.gz differ
diff --git a/src/perl/modules_targz/spacing_functions-0.02.tar.gz b/src/perl/modules_targz/spacing_functions-0.02.tar.gz
index 9cd4f86a7c4d6b9d7503bdbde567d94ed455aa32..e8d5862b801774697e1a146c9e814b5aedbf6e02 100644
Binary files a/src/perl/modules_targz/spacing_functions-0.02.tar.gz and b/src/perl/modules_targz/spacing_functions-0.02.tar.gz differ
diff --git a/src/perl/scripts2/plot_yieldsets.pl b/src/perl/scripts2/plot_yieldsets.pl
index f66b02ce6c51f0442c978b7bd1ecbafd562d1233..bf7347b7a3ea547b3f2ac01a73558b73e81d8419 100755
--- a/src/perl/scripts2/plot_yieldsets.pl
+++ b/src/perl/scripts2/plot_yieldsets.pl
@@ -80,7 +80,9 @@ my %options=(vb=>1, # verbosity
gp_solid=>'',
gp_linewidth=>6,
gp_dashlength=>4,
- gp_pltfile=>'yieldsets.plt',
+ gp_dashes=>0,
+ gp_ptcount=>0,
+ gp_pltfile=>'yieldsets.plt',
gp_outfile=>'yieldsets.pdf',
gp_with=>'lp ps 0.86 lw 1',
gp_key=>1,
@@ -116,6 +118,7 @@ my %options=(vb=>1, # verbosity
'00ffff',
'ff00ff',
],
+ gp_ps=>undef,
gp_colour_by=>'source', # can be : source, order, dir, isotope
gp_points_by=>'dir', # can be : source, order, dir, isotope
gp_title=>1, # 1 = title, 0 = no title
@@ -126,7 +129,9 @@ my %options=(vb=>1, # verbosity
line_end_labels=>0, # put data at the end of the lines, instead of in the gnuplot line titles
yield_sigfigs=>2,
-
+ yield_totals=>1, # plot yield totals
+ yield_percents=>1, # plot yield %ages
+
skip_zerocurves=>1, # if 1 skip curves which are just zero
xlow=>'*',
@@ -158,11 +163,14 @@ my %options=(vb=>1, # verbosity
exit_on_inf=>1,
# separate plots for each source?
- separate=>0
+ separate=>0,
+
+ # cleanup tmp?
+ cleanup=>1,
);
# tmp dir
-$options{tmpdir} //= tempdir(CLEANUP=>1,
+$options{tmpdir} //= tempdir(CLEANUP=>0,#$options{cleanup},
DIR=>(-d '/var/tmp' ? '/var/tmp':'/tmp'));
my @infotable;
@@ -456,12 +464,17 @@ load \"$labelsfile\"
# make a list of sources to plot
my %sources_toplot;
- foreach my $filter (@filters)
+ my %dummy_source;
+ foreach my $filter (@filters)
{
- if($filter=~/^source(\d+.*)/)
+ if($filter=~/^(?:dummy)?source(\d+.*)/)
{
$sources_toplot{$1}=1;
}
+ if($filter =~/^dummysource(\d+.*)/)
+ {
+ $dummy_source{$1}=1;
+ }
}
# sorter for the yields
@@ -532,7 +545,14 @@ load \"$labelsfile\"
vsay "PLOT source=$source, subsources=@subsources, ytot=$ytot, yfrac=$yfrac\n";
# add total yield into this source
- $t .= sprintf ' %.'.$options{yield_sigfigs}.'g %.1f%%',$ytot,100.0*$yfrac;
+ if($options{yield_totals})
+ {
+ $t .= sprintf ' %.'.$options{yield_sigfigs}.'g',$ytot;
+ }
+ if($options{yield_percents})
+ {
+ $t .= sprintf ' %.1f%%',100.0*$yfrac;
+ }
# reformat exponential notation
$t =~ s/e([\+-])0*(\d+)/\{\/Symbol \\264\}10^\{\/*0.8 $1$2\}/g;
@@ -541,18 +561,38 @@ load \"$labelsfile\"
$points_count++ if($options{gp_points_by} eq 'order');
my $lineopts;
+
+ if($options{gp_dashes})
+ {
+ # force dashed lines
+ state $dashcount = 0;
+ $dashcount ++;
+ $lineopts .= ' dt '.($dashcount).' ';
+ print "SET DASH $dashcount\n";
+ }
+
if($options{gp_with}=~/^l/)
{
# lines options
- $lineopts = " lt ".($isotope_count+1).' ';
+ $lineopts .= ' lt '.($isotope_count+1).' ';
}
- if($options{gp_with}=~/^(lp|points|linespoints)/)
+ if($options{gp_ptcount})
+ {
+ state $ptcount = 0;
+ $ptcount++;
+ $lineopts .= ' pt '.$ptcount.' ';
+ }
+ elsif($options{gp_with}=~/^(lp|points|linespoints)/)
{
# lines-points options
- $lineopts .= 'pt '.$datadircount.' ';
+ $lineopts .= ' pt '.$datadircount.' ';
}
- $lineopts.= ' ';
+ if(defined $options{gp_ps})
+ {
+ $lineopts .= ' ps '.$options{gp_ps}.' ';
+ }
+ $lineopts.= ' ';
# line colour
my $colour =
@@ -631,28 +671,30 @@ load \"$labelsfile\"
# be linera
my $xcol = $options{yields_logtimes} ? '(10.0**$1)' : '1';
- # output plot string
- print {$gp} "$plotcomma '$plotfile' u $xcol:$ncol with $options{gp_with} $lineopts ";
-
- if($options{line_end_labels})
- {
- my $x = "set label \"\{/=$options{gp_linetitle_fontsize} $t\}\" at $info{$datadir}{maxtime},$ytot\n";
- print "$x\n";
- print {$gp} 'notitle ';
- print {$labels_fp} $x;
- }
- else
+ if(!$dummy_source{$source})
{
- $t=~s/^\s+//;
- $t=~s/\s+$//;
- print {$gp} "title \"$t\" "
- }
+ # output plot string
+ print {$gp} "$plotcomma '$plotfile' u $xcol:$ncol with $options{gp_with} $lineopts ";
- if(!$options{separate})
- {
- $plotcomma =',';
+ if($options{line_end_labels})
+ {
+ my $x = "set label \"\{/=$options{gp_linetitle_fontsize} $t\}\" at $info{$datadir}{maxtime},$ytot\n";
+ print "$x\n";
+ print {$gp} 'notitle ';
+ print {$labels_fp} $x;
+ }
+ else
+ {
+ $t=~s/^\s+//;
+ $t=~s/\s+$//;
+ print {$gp} "title \"$t\" "
+ }
+
+ if(!$options{separate})
+ {
+ $plotcomma =',';
+ }
}
-
push(@datadir_infotable,
sprintf "Element %s : Source %s : Total %g : Frac %5.3f %%",
$isotope,
diff --git a/src/perl/scripts2/template.pl b/src/perl/scripts2/template.pl
index dcce766efbc349fd5b9894fa5b34ae7656082fe1..29e8a607334ac371e917850ce10fe96d542218e6 100755
--- a/src/perl/scripts2/template.pl
+++ b/src/perl/scripts2/template.pl
@@ -89,7 +89,10 @@ $population->set(
'model.dt'
]
},
- individual_novae=>1,
+ # C_logging_code =>
+ # 'PRINTF("stardata = %p\n",stardata);'
+ # ,
+ individual_novae=>0,
## or enter more complicated code yourself:
#
@@ -114,13 +117,13 @@ $population->parse_args();
#
# duplicity is 0 for single stars, 1 for binary stars
# and 2 for a mixed population sampled at equal times
-my $duplicity = 1;
+my $duplicity = 0;
if($duplicity == 0)
{
# make a grid of $nstars single binary stars, log-spaced,
# with masses between $mmin and $mmax
- my $nstars = 1000000;
+ my $nstars = 1000;
my $mmin = 0.1;
my $mmax = 80.0;
$population->add_grid_variable(
@@ -275,7 +278,7 @@ if(0){
$population->evolve();
# output the data
-#output($population);
+output($population);
# done : exit
exit;
@@ -293,6 +296,8 @@ sub parse_data
# subsequent calls to tbse_line contain
# (references to) arrays of data
my $la = $population->tbse_line();
+
+ #print "DATA @$la\n";
# first element is the "header" line
my $header = shift @$la;
@@ -304,6 +309,8 @@ sub parse_data
# expected data lines, if so, act
if($header eq 'MY_STELLAR_DATA')
{
+ #print "GOT @$la\n";
+
# matched MY_STELLAR_DATA header
my $time = $la->[0];
my $mass = $la->[1];
diff --git a/src/setup/argument_setting_functions.c b/src/setup/argument_setting_functions.c
index 52f385eb808c6876ff7c0c07901bd17b234bd403..fb401308cc76226ccce46f3954fc99c966b0ea53 100644
--- a/src/setup/argument_setting_functions.c
+++ b/src/setup/argument_setting_functions.c
@@ -304,11 +304,9 @@ void list_available_args(ARG_SUBROUTINE_DECLARATION)
int buffering = stardata->preferences->internal_buffering;
- int buffering_compression = stardata->preferences->internal_buffering_compression;
reset_stars_defaults(ARG_SUBROUTINE_ARGS2);
stardata->preferences->internal_buffering = buffering;
- stardata->preferences->internal_buffering_compression = buffering_compression;
-
+
*c=-1;
int xint;
double xdouble;
diff --git a/src/setup/cmd_line_args.h b/src/setup/cmd_line_args.h
index 7f5866605f6acd0e5c8fdde6d744c08a5469e3f6..3ddbd8dea1329e242af2fecc2875dfc32a706087 100644
--- a/src/setup/cmd_line_args.h
+++ b/src/setup/cmd_line_args.h
@@ -2993,16 +2993,6 @@ struct cmd_line_arg_t
1.0 \
}, \
\
-{ \
- ARG_SECTION_OUTPUT, \
- "internal_buffering_compression", \
- "Experimental. Set the internal_buffering compression level (0=none, otherwise 1-9). See internal_buffering.", \
- ARG_INTEGER , \
- WTTS_USE_DEFAULT, \
- &(stardata->preferences->internal_buffering_compression), \
- 1.0 \
- }, \
- \
{ \
ARG_SECTION_OUTPUT, \
"individual_novae", \
diff --git a/src/setup/set_default_preferences.c b/src/setup/set_default_preferences.c
index 43ebc85f983bec0e29db595e5dfbb765b6e59128..9daf72989def8cb7a7a35d6f49673c750b572eb3 100644
--- a/src/setup/set_default_preferences.c
+++ b/src/setup/set_default_preferences.c
@@ -306,8 +306,7 @@ preferences->WD_accretion_rate_novae_upper_limit_other_donor = ACCRETION_RATE_NO
preferences->lw = 1.0;
- preferences->internal_buffering=0;
- preferences->internal_buffering_compression=0;
+ preferences->internal_buffering = 0;
preferences->rlperi=FALSE;
preferences->max_tpagb_core_mass = DEFAULT_MAX_TPAGB_CORE_MASS;
preferences->chandrasekhar_mass = DEFAULT_CHANDRASEKHAR_MASS;
diff --git a/src/setup/version.c b/src/setup/version.c
index e63980ea25dbb03f9dd4a96f19df780a737c97f7..6e4cc91b5156414137d9063d08efa2fe4ebc636b 100644
--- a/src/setup/version.c
+++ b/src/setup/version.c
@@ -1488,7 +1488,6 @@ void version(struct stardata_t * RESTRICT const stardata)
#endif
#endif //NUCSYN
- Macrotest(BUFFERED_STACK);
Show_long_int_macro(BUFFERED_PRINTF_MAX_BUFFER_SIZE);
Show_long_int_macro(BUFFERED_PRINTF_ERROR_BUFFER_SIZE);
Macrotest(BUFFER_MEMORY_DEBUGGING);
diff --git a/src/stellar_timescales/stellar_timescales.c b/src/stellar_timescales/stellar_timescales.c
index c2d7bde77b649d763d625066461f3cc2cbb8aa76..12bf035be9238df0f5c4235a957456c0fd2b55f6 100644
--- a/src/stellar_timescales/stellar_timescales.c
+++ b/src/stellar_timescales/stellar_timescales.c
@@ -73,7 +73,7 @@
unsigned int i; \
for(i=1;i<=A;i++) \
{ \
- Dprint_no_newline("%d=%12.12e %s",i,B[i],i==A?"":":"); \
+ Dprint_no_newline("%u=%12.12e %s",i,B[i],i==A?"":":"); \
} \
Dprint("%s",""); \
}
@@ -81,7 +81,7 @@
unsigned int i; \
for(i=1;i<=A;i++) \
{ \
- Dprint_no_newline("% 10d = %20s = %s%12.12e%s %s", \
+ Dprint_no_newline("%10u = %20s = %s%12.12e%s %s", \
i, \
S[i], \
((i>0 && B[i]<B[i-1]) ? BRIGHT_YELLOW : ""), \
diff --git a/tbse b/tbse
index bd56573ae56bf79130bfbd2ac0d55a2c410de343..a74a7d24e5be586f647430603e41731e3179c7bc 100755
--- a/tbse
+++ b/tbse
@@ -1544,9 +1544,6 @@ GAIA_L_BINWIDTH=0.1
# internal use (also can be compressed) and access via e.g. the API
INTERNAL_BUFFERING=INTERNAL_BUFFERING_OFF
-# compression level, passed to zlib : 0=none, 1=use deflate compression (1-9)
-INTERNAL_BUFFERING_COMPRESSION=0
-
# output log : set LOG_FILENAME to /dev/null for no logging
LOG_FILENAME="/tmp/c_log2.dat"
@@ -1960,7 +1957,6 @@ $RANDOM_SEED \
--random_skip $RANDOM_SKIP \
$WARMUP \
--internal_buffering $INTERNAL_BUFFERING \
---internal_buffering_compression $INTERNAL_BUFFERING_COMPRESSION \
--thick_disc_start_age $THICK_DISC_START_AGE \
--thick_disc_end_age $THICK_DISC_END_AGE \
--thick_disc_logg_min $THICK_DISC_LOGG_MIN \