From 2580e9255b139da6ca4afa7f844150a3d71cdda5 Mon Sep 17 00:00:00 2001 From: mwturvey Date: Fri, 17 Feb 2017 10:53:39 -0700 Subject: find_tori: Cache a tan() --- redist/linmath.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'redist') diff --git a/redist/linmath.h b/redist/linmath.h index 20a7848..caec281 100644 --- a/redist/linmath.h +++ b/redist/linmath.h @@ -19,6 +19,7 @@ #define FLT double #define FLT_SQRT sqrt +#define FLT_TAN tan #define FLT_SIN sin #define FLT_COS cos #define FLT_ACOS acos @@ -30,6 +31,7 @@ #define FLT float #define FLT_SQRT sqrtf +#define FLT_TAN tanf #define FLT_SIN sinf #define FLT_COS cosf #define FLT_ACOS acosf -- cgit v1.2.3 From cab4ee6f89a661190b2bd80c30e42d5f45614f20 Mon Sep 17 00:00:00 2001 From: Joshua Allen Date: Sun, 26 Feb 2017 10:13:31 -0500 Subject: json helpers for writing --- redist/json_helpers.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++ redist/json_helpers.h | 14 ++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 redist/json_helpers.c create mode 100644 redist/json_helpers.h (limited to 'redist') diff --git a/redist/json_helpers.c b/redist/json_helpers.c new file mode 100644 index 0000000..e96e873 --- /dev/null +++ b/redist/json_helpers.c @@ -0,0 +1,63 @@ +// (C) 2017 <>< Joshua Allen, Under MIT/x11 License. + +#define _GNU_SOURCE + +#include +#include +#include "json_helpers.h" + +void json_write_float_array(FILE* f, const char* tag, float* v, uint8_t count) { + uint8_t i = 0; + char * str1 = NULL; + char * str2 = NULL; + asprintf(&str1,"\"%s\":[", tag); + + for (i=0;i< Joshua Allen, Under MIT/x11 License. + +#ifndef JSON_HELPERS_H +#define JSON_HELPERS_H + +#include + +void json_write_float_array(FILE* f, const char* tag, float* v, uint8_t count); +void json_write_double_array(FILE* f, const char* tag, double* v, uint8_t count); +void json_write_uint32(FILE* f, const char* tag, uint32_t v); +void json_write_float(FILE* f, const char* tag, float v); +void json_write_str(FILE* f, const char* tag, const char* v); + +#endif \ No newline at end of file -- cgit v1.2.3 From e8d696e03128242be33eb0734addee645e894635 Mon Sep 17 00:00:00 2001 From: Joshua Allen Date: Mon, 27 Feb 2017 20:52:26 -0500 Subject: basic config can be written to file --- redist/json_helpers.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'redist') diff --git a/redist/json_helpers.c b/redist/json_helpers.c index e96e873..74028b2 100644 --- a/redist/json_helpers.c +++ b/redist/json_helpers.c @@ -3,6 +3,7 @@ #define _GNU_SOURCE #include +#include #include #include "json_helpers.h" @@ -22,7 +23,7 @@ void json_write_float_array(FILE* f, const char* tag, float* v, uint8_t count) { str1=str2; str2=NULL; } - asprintf(&str2, "%s]\n", str1,v[i]); + asprintf(&str2, "%s]", str1,v[i]); fputs(str2,f); free(str1); free(str2); @@ -44,20 +45,20 @@ void json_write_double_array(FILE* f, const char* tag, double* v, uint8_t count) str1=str2; str2=NULL; } - asprintf(&str2, "%s]\n", str1,v[i]); + asprintf(&str2, "%s]", str1,v[i]); fputs(str2,f); free(str1); free(str2); } void json_write_uint32(FILE* f, const char* tag, uint32_t v) { - fprintf(f, "\"%s\":\"%d\"\n", tag, v); + fprintf(f, "\"%s\":\"%d\"", tag, v); } void json_write_float(FILE* f, const char* tag, float v) { - fprintf(f, "\"%s\":\"%f\"\n", tag, v); + fprintf(f, "\"%s\":\"%f\"", tag, v); } void json_write_str(FILE* f, const char* tag, const char* v) { - fprintf(f, "\"%s\":\"%s\"\n", tag, v); + fprintf(f, "\"%s\":\"%s\"", tag, v); } \ No newline at end of file -- cgit v1.2.3