Commit 6d366852 authored by Jonathan Wilkes's avatar Jonathan Wilkes

Merge branch 'double-precision-interface'

parents ceeacdfe 9eb7691c
Pipeline #1370 passed with stage
in 375 minutes and 42 seconds
...@@ -84,6 +84,12 @@ typedef int socklen_t; ...@@ -84,6 +84,12 @@ typedef int socklen_t;
#define X_SPECIFIER "x%.6lx" #define X_SPECIFIER "x%.6lx"
#if PD_FLOATSIZE == 32
#define FLOAT_SPECIFIER "%.6g"
#elif PD_FLOATSIZE == 64
#define FLOAT_SPECIFIER "%.14g"
#endif
static int stderr_isatty; static int stderr_isatty;
/* I don't see any other systems where this header (and backtrace) are /* I don't see any other systems where this header (and backtrace) are
...@@ -865,7 +871,7 @@ void gui_do_vmess(const char *sel, char *fmt, int end, va_list ap) ...@@ -865,7 +871,7 @@ void gui_do_vmess(const char *sel, char *fmt, int end, va_list ap)
if (nargs > 0) sys_gui(","); if (nargs > 0) sys_gui(",");
switch(*fp++) switch(*fp++)
{ {
case 'f': sys_vgui("%g", va_arg(ap, double)); break; case 'f': sys_vgui(FLOAT_SPECIFIER, va_arg(ap, double)); break;
case 's': escape_double_quotes(va_arg(ap, const char *)); break; case 's': escape_double_quotes(va_arg(ap, const char *)); break;
case 'i': sys_vgui("%d", va_arg(ap, int)); break; case 'i': sys_vgui("%d", va_arg(ap, int)); break;
case 'x': sys_vgui("\"" X_SPECIFIER "\"", case 'x': sys_vgui("\"" X_SPECIFIER "\"",
...@@ -912,10 +918,10 @@ void gui_f(t_float f) ...@@ -912,10 +918,10 @@ void gui_f(t_float f)
{ {
if (gui_array_head && !gui_array_tail) if (gui_array_head && !gui_array_tail)
{ {
sys_vgui("%g", f); sys_vgui(FLOAT_SPECIFIER, f);
} }
else else
sys_vgui(",%g", f); sys_vgui("," FLOAT_SPECIFIER, f);
gui_array_head = 0; gui_array_head = 0;
gui_array_tail = 0; gui_array_tail = 0;
} }
......
...@@ -13,9 +13,9 @@ ...@@ -13,9 +13,9 @@
#include <stdio.h> #include <stdio.h>
#if PD_FLOATSIZE == 32 #if PD_FLOATSIZE == 32
#define FLOAT_SPECIFIER "%s%s%.6g" #define FLOAT_SPECIFIER "%.6g"
#elif PD_FLOATSIZE == 64 #elif PD_FLOATSIZE == 64
#define FLOAT_SPECIFIER "%s%s%.14lg" #define FLOAT_SPECIFIER "%.14g"
#endif #endif
/* we need the following for [pdinfo] ... */ /* we need the following for [pdinfo] ... */
...@@ -94,7 +94,8 @@ static void print_pointer(t_print *x, t_gpointer *gp) ...@@ -94,7 +94,8 @@ static void print_pointer(t_print *x, t_gpointer *gp)
static void print_float(t_print *x, t_floatarg f) static void print_float(t_print *x, t_floatarg f)
{ {
if (sys_nogui) if (sys_nogui)
post(FLOAT_SPECIFIER, x->x_sym->s_name, (*x->x_sym->s_name ? ": " : ""), f); post("%s%s" FLOAT_SPECIFIER, x->x_sym->s_name,
(*x->x_sym->s_name ? ": " : ""), f);
else else
{ {
gui_start_vmess("gui_print", "xs", x, x->x_sym->s_name); gui_start_vmess("gui_print", "xs", x, x->x_sym->s_name);
...@@ -612,6 +613,13 @@ void pdinfo_dsp(t_pdinfo *x, t_symbol *s, int argc, t_atom *argv) ...@@ -612,6 +613,13 @@ void pdinfo_dsp(t_pdinfo *x, t_symbol *s, int argc, t_atom *argv)
info_out((t_text *)x, s, 1, at); info_out((t_text *)x, s, 1, at);
} }
void pdinfo_floatsize(t_pdinfo *x, t_symbol *s, int argc, t_atom *argv)
{
t_atom at[1];
SETFLOAT(at, (t_float)PD_FLOATSIZE);
info_out((t_text *)x, s, 1, at);
}
void pdinfo_audio_api(t_pdinfo *x, t_symbol *s, int argc, t_atom *argv) void pdinfo_audio_api(t_pdinfo *x, t_symbol *s, int argc, t_atom *argv)
{ {
t_atom at[1]; t_atom at[1];
...@@ -1025,6 +1033,8 @@ void pdinfo_setup(void) ...@@ -1025,6 +1033,8 @@ void pdinfo_setup(void)
gensym("dir"), A_GIMME, 0); gensym("dir"), A_GIMME, 0);
class_addmethod(pdinfo_class, (t_method)pdinfo_dsp, class_addmethod(pdinfo_class, (t_method)pdinfo_dsp,
gensym("dsp-status"), A_GIMME, 0); gensym("dsp-status"), A_GIMME, 0);
class_addmethod(pdinfo_class, (t_method)pdinfo_floatsize,
gensym("floatsize"), A_GIMME, 0);
class_addmethod(pdinfo_class, (t_method)pdinfo_gui, class_addmethod(pdinfo_class, (t_method)pdinfo_gui,
gensym("gui"), A_GIMME, 0); gensym("gui"), A_GIMME, 0);
class_addmethod(pdinfo_class, (t_method)pdinfo_libdir, class_addmethod(pdinfo_class, (t_method)pdinfo_libdir,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment