Skip to content
Snippets Groups Projects
Commit f4192c14 authored by Izzard, Robert Dr (Maths & Physics)'s avatar Izzard, Robert Dr (Maths & Physics)
Browse files

remove debugging printfs

clean naming of file struct (was missing the trailing '_t')

add missing structure sizes to version() call
parent 2cf7ca87
No related branches found
No related tags found
No related merge requests found
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
......
......@@ -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;
......
......@@ -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);
......
#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))
{
......
#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
......
......@@ -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,
...)
......
......@@ -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)
......
#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);
......
......@@ -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,
...)
{
......
#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)
{
......
......@@ -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);
......
......@@ -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 *),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment