diff --git a/TODO b/TODO index 1cf975f3d9eb82ccbcf49ec1a8ba13c78fc06e96..ec02eb1fc198e3ebd3bc4c45fe5c54d43821b3f1 100644 --- a/TODO +++ b/TODO @@ -1,9 +1,10 @@ +Change fixed-length strings, where possible, to C99 flexible array members +https://en.wikipedia.org/wiki/Flexible_array_member -find a way to reconstruct the actual derivative over a timestep -from the stack. ------------------------------------------------------------ + Magnetic braking for remannts (NS,WD) mechanism for preventing events within events diff --git a/src/binary_c_structures.h b/src/binary_c_structures.h index 31b34c436a470d26f86de580dfd6c924bae470c7..d260fc7a1cd523c23b819e4927638178e0559503 100644 --- a/src/binary_c_structures.h +++ b/src/binary_c_structures.h @@ -98,7 +98,7 @@ struct binary_c_random_buffer_t { * This enables you to specify your own * maximum file lengths and monitor file size. */ -struct binary_c_file { +struct binary_c_file_t { #ifdef MEMOIZE struct memoize_hash_t * memo; #endif//MEMOIZE @@ -300,8 +300,8 @@ struct tmpstore_t { struct rinterpolate_data_t * rinterpolate_data; struct data_table_t * comenv_lambda_table; #ifdef DISCS - struct binary_c_file * disc_logfile; - struct binary_c_file * disc_logfile2d; + struct binary_c_file_t * disc_logfile; + struct binary_c_file_t * disc_logfile2d; #endif//DISCS struct difflogstack_t * logstack; struct star_t * stellar_structure_newstar; diff --git a/src/evolution/evolve_system.c b/src/evolution/evolve_system.c index abed625224286c625a82980afab3fd7e14ee87d9..c5e307e95927de021aad222e0b6881a2a9948558 100644 --- a/src/evolution/evolve_system.c +++ b/src/evolution/evolve_system.c @@ -118,12 +118,6 @@ int evolve_system(struct stardata_t * RESTRICT const stardata) retval = 0; } - - printf("call post %p\n", - stardata); - fflush(NULL); - printf("prefs %p\n",stardata->preferences); - fflush(NULL); post_evolution(stardata); diff --git a/src/file/binary_c_fclose.c b/src/file/binary_c_fclose.c index 83783b0a58cca5899335946a67482e2a0e97de36..195cf20843e082323ba936661338acf3b166e6fe 100644 --- a/src/file/binary_c_fclose.c +++ b/src/file/binary_c_fclose.c @@ -1,10 +1,10 @@ #include "../binary_c.h" -int binary_c_fclose(struct binary_c_file ** fp) +int binary_c_fclose(struct binary_c_file_t ** fp) { /* - * Given a pointer fp to a binary_c_file structure pointer, close + * Given a pointer fp to a binary_c_file_t structure pointer, close * the file and free the memory, and set the file structrure pointer * to NULL. * @@ -16,7 +16,7 @@ int binary_c_fclose(struct binary_c_file ** fp) if(fp!=NULL) { - struct binary_c_file * file = *fp; + struct binary_c_file_t * file = *fp; if(likely(file != NULL)) { diff --git a/src/file/binary_c_fflush.c b/src/file/binary_c_fflush.c index 773503b121f9ee016178c317f71c91062d4d3c1e..2df1e0ab5e768c0d8c20dcca099ddd2e5d734e6f 100644 --- a/src/file/binary_c_fflush.c +++ b/src/file/binary_c_fflush.c @@ -1,10 +1,10 @@ #include "../binary_c.h" -int binary_c_fflush(const struct binary_c_file * const file) +int binary_c_fflush(const struct binary_c_file_t * const file) { /* - * Flush a binary_c_file pointer. + * Flush a binary_c_file_t pointer. * * Return what is returned from fflush, * or -1 if file or file->fp is NULL diff --git a/src/file/binary_c_filter_fprintf.c b/src/file/binary_c_filter_fprintf.c index 813a4e18b5f1616cf13ec99d9bac1936685df4b4..6c831f6e1095a2cc040789d0f4a90b5ebc41942e 100644 --- a/src/file/binary_c_filter_fprintf.c +++ b/src/file/binary_c_filter_fprintf.c @@ -7,7 +7,7 @@ * the input format string according to some required algorithm, * then sends the new format string to binary_c_fprintf. */ -int binary_c_filter_fprintf(struct binary_c_file * const file, +int binary_c_filter_fprintf(struct binary_c_file_t * const file, const int algorithm, const char * const format, ...) diff --git a/src/file/binary_c_filter_vprintf.c b/src/file/binary_c_filter_vprintf.c index 4206cca6e78d9cdd322e12ad6bca73573ee2b82a..3528a81bdd9fc52a7cd455ace265d3d2f90505f2 100644 --- a/src/file/binary_c_filter_vprintf.c +++ b/src/file/binary_c_filter_vprintf.c @@ -7,7 +7,7 @@ * then sends the new format string to binary_c_fprintf. */ -int Gnu_format_args(3,0) binary_c_filter_vprintf(struct binary_c_file * const file, +int Gnu_format_args(3,0) binary_c_filter_vprintf(struct binary_c_file_t * const file, const int algorithm, const char * const format, va_list args) diff --git a/src/file/binary_c_fopen.c b/src/file/binary_c_fopen.c index 28cc45f8bb2aa2c71e7a231ec35bf7137718fa6b..9088e28f9658b8c2ff6e30b8687343b228d3f91d 100644 --- a/src/file/binary_c_fopen.c +++ b/src/file/binary_c_fopen.c @@ -1,7 +1,7 @@ #include "../binary_c.h" -struct binary_c_file * binary_c_fopen(const char * RESTRICT const path, +struct binary_c_file_t * binary_c_fopen(const char * RESTRICT const path, const char * RESTRICT const mode, const size_t maxsize) { @@ -18,7 +18,7 @@ struct binary_c_file * binary_c_fopen(const char * RESTRICT const path, * On failure, returns NULL and frees all * associated memory. */ - struct binary_c_file * file = Malloc(sizeof(struct binary_c_file)); + struct binary_c_file_t * file = Malloc(sizeof(struct binary_c_file_t)); if(file != NULL) { file->fp = fopen(path,mode); diff --git a/src/file/binary_c_fprintf.c b/src/file/binary_c_fprintf.c index 8db0f0f7e8121f99fbb927cbe91c5312e2fca10e..5b05d67c14c2f49d94d309bbf0f1270edefb4aa6 100644 --- a/src/file/binary_c_fprintf.c +++ b/src/file/binary_c_fprintf.c @@ -2,7 +2,7 @@ #include "../binary_c.h" -int Gnu_format_args(2,3) binary_c_fprintf(struct binary_c_file * const file, +int Gnu_format_args(2,3) binary_c_fprintf(struct binary_c_file_t * const file, const char * const format, ...) { diff --git a/src/file/binary_c_vprintf.c b/src/file/binary_c_vprintf.c index 01f178e44d205fbeb6fff79cf82f9da087c6bf8e..b92494cfa570331a755239f7a4bb06c1ff6e4ea1 100644 --- a/src/file/binary_c_vprintf.c +++ b/src/file/binary_c_vprintf.c @@ -1,7 +1,7 @@ #include "../binary_c.h" -int Gnu_format_args(2,0) binary_c_vprintf(struct binary_c_file * const file, +int Gnu_format_args(2,0) binary_c_vprintf(struct binary_c_file_t * const file, const char * const format, va_list args) { diff --git a/src/file/file_prototypes.h b/src/file/file_prototypes.h index df754cbea246c1d5a6309ba473da9081ddba39bb..703f06a28c412a2523107e03e7815baf1a0bb456 100644 --- a/src/file/file_prototypes.h +++ b/src/file/file_prototypes.h @@ -2,22 +2,22 @@ #ifndef FILE_H #define FILE_H -struct binary_c_file * binary_c_fopen(const char * RESTRICT const path, +struct binary_c_file_t * binary_c_fopen(const char * RESTRICT const path, const char * RESTRICT const mode, const size_t maxsize); -int binary_c_fprintf(struct binary_c_file * const file, +int binary_c_fprintf(struct binary_c_file_t * const file, const char * const format, ...) Gnu_format_args(2,3); -int binary_c_fclose(struct binary_c_file ** file); -int binary_c_fflush(const struct binary_c_file * const file); -int binary_c_filter_fprintf(struct binary_c_file * const file, +int binary_c_fclose(struct binary_c_file_t ** file); +int binary_c_fflush(const struct binary_c_file_t * const file); +int binary_c_filter_fprintf(struct binary_c_file_t * const file, const int filter_algorithm, const char * const format, ...) Gnu_format_args(3,4); -int binary_c_vprintf(struct binary_c_file * file, +int binary_c_vprintf(struct binary_c_file_t * file, const char * const format, va_list args) Gnu_format_args(2,0); -int binary_c_filter_vprintf(struct binary_c_file * const file, +int binary_c_filter_vprintf(struct binary_c_file_t * const file, const int algorithm, const char * const format, va_list args) Gnu_format_args(3,0); diff --git a/src/setup/version.c b/src/setup/version.c index d7267f86de6d84c68890cd58f8c4992b4cd28384..aacc56a346f80408c891a8641b998f699ed2c532 100644 --- a/src/setup/version.c +++ b/src/setup/version.c @@ -220,7 +220,7 @@ void version(struct stardata_t * RESTRICT const stardata) Show_string_macro(__const__); Show_string_macro(__static__); - Printf("Size of : short int %zu, unsigned short int %zu, int %zu, unsigned int %zu, long int %zu, unsigned long int %zu, long long int %zu, unsigned long long int %zu, float %zu, double %zu, long double %zu, char %zu, Boolean %zu, stardata_t %zu, preferences_t %zu, star_t %zu, common_t %zu, model_t %zu, diffstats_t %zu, probability_distribution_t %zu, RLOF_orbit_t %zu, store_t %zu, tmpstore_t %zu, data_table_t %zu, Random_seed %zu, Random_buffer %zu, FILE %zu, void* %zu, unsigned int* %zu, int* %zu, long int* %zu, long long int* %zu, float* %zu, double* %zu, long double* %zu, char* %zu, Boolean* %zu, stardata_t* %zu, star_t* %zu, FILE* %zu, __int__ %zu, __double__ %zu, __unsigned__ __int__ %zu, __short__ __int__ %zu, __long__ __int__ %zu\n", + Printf("Size of : short int %zu, unsigned short int %zu, int %zu, unsigned int %zu, long int %zu, unsigned long int %zu, long long int %zu, unsigned long long int %zu, float %zu, double %zu, long double %zu, char %zu, Boolean %zu, stardata_t %zu, preferences_t %zu, star_t %zu, common_t %zu, model_t %zu, diffstats_t %zu, probability_distribution_t %zu, RLOF_orbit_t %zu, store_t %zu, tmpstore_t %zu, data_table_t %zu, stardata_dump_t %zu, GSL_args_t %zu, envelope_t %zu, envelope_shell_t %zu, equation_of_state_t %zu, opacity_t %zu, kick_system_t %zu, coordinate_t %zu, binary_system_t %zu, power_law_t %zu, disc_thermal_zone_t %zu, disc_loss_t %zu, disc_t %zu, mersenne_twister_t %zu, binary_c_random_buffer_t %zu, binary_c_file_t %zu, difflogitem_t %zu, difflogstack_t %zu, binary_c_fixed_timestep_t %zu, new_supernova_t %zu, splitinfo_t %zu, derivative_t %zu, bint_t %zu, orbit_t %zu, Random_seed %zu, Random_buffer %zu, FILE %zu, void* %zu, short int* %zu, unsigned short int* %zu, int* %zu, unsigned int* %zu, long int* %zu, unsigned long int* %zu, long long int* %zu, unsigned long long int* %zu, float* %zu, double* %zu, long double* %zu, char* %zu, Boolean* %zu, stardata_t* %zu, star_t* %zu, FILE* %zu, __int__ %zu, __double__ %zu, __unsigned__ __int__ %zu, __short__ __int__ %zu, __long__ __int__ %zu\n", sizeof(short int), sizeof(unsigned short int), sizeof(int), @@ -245,14 +245,62 @@ void version(struct stardata_t * RESTRICT const stardata) sizeof(struct store_t), sizeof(struct tmpstore_t), sizeof(struct data_table_t), + sizeof(struct stardata_dump_t), + sizeof(struct GSL_args_t), + sizeof(struct envelope_t), + sizeof(struct envelope_shell_t), + sizeof(struct equation_of_state_t), + sizeof(struct opacity_t), + sizeof(struct kick_system_t), + sizeof(struct coordinate_t), +#ifdef DISCS + sizeof(struct binary_system_t), + sizeof(struct power_law_t), + sizeof(struct disc_thermal_zone_t), + sizeof(struct disc_loss_t), + sizeof(struct disc_t), +#else + (size_t)0, + (size_t)0, + (size_t)0, + (size_t)0, + (size_t)0, +#endif//DISCS +#ifdef USE_MERSENNE_TWISTER + sizeof(struct mersenne_twister_t), +#else + (size_t)0, +#endif//USE_MERSENNE_TWISTER + sizeof(struct binary_c_random_buffer_t), + sizeof(struct binary_c_file_t), + sizeof(struct difflogitem_t), + sizeof(struct difflogstack_t), + sizeof(struct binary_c_fixed_timestep_t), + sizeof(struct new_supernova_t), +#ifdef EVOLUTION_SPLITTING + sizeof(struct splitinfo_t), +#else + (size_t)0, +#endif//EVOLUTION_SPLITTING + sizeof(struct derivative_t), +#ifdef BINT + sizeof(struct bint_t), +#else + (size_t)0, +#endif//BINT + sizeof(struct orbit_t), sizeof(Random_seed), sizeof(Random_buffer), sizeof(FILE), sizeof(void *), - sizeof(unsigned int *), + sizeof(short int *), + sizeof(unsigned short int *), sizeof(int *), + sizeof(unsigned int *), sizeof(long int *), + sizeof(unsigned long int *), sizeof(long long int *), + sizeof(unsigned long long int *), sizeof(float *), sizeof(double *), sizeof(long double *),