From 0d4560cb0305029fa5f0739670286176ab47cb65 Mon Sep 17 00:00:00 2001 From: Peter D'Hoye Date: Fri, 3 Jul 2009 22:16:11 +0000 Subject: Accept FS #10244 by Wincent Balin: more pdbox work done for GSoC; also some keyword and line-ending fixes by me git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21626 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/pdbox/PDa/extra/OSCroute.c | 30 +- apps/plugins/pdbox/PDa/extra/bandpass.c | 180 +- apps/plugins/pdbox/PDa/extra/dumpOSC.c | 1998 +++++++++--------- apps/plugins/pdbox/PDa/extra/equalizer.c | 177 +- apps/plugins/pdbox/PDa/extra/filters.h | 155 +- apps/plugins/pdbox/PDa/extra/gcanvas.c | 829 ++++---- apps/plugins/pdbox/PDa/extra/highpass.c | 177 +- apps/plugins/pdbox/PDa/extra/highshelf.c | 186 +- apps/plugins/pdbox/PDa/extra/hlshelf.c | 466 ++-- apps/plugins/pdbox/PDa/extra/image.c | 38 +- apps/plugins/pdbox/PDa/extra/lowpass.c | 179 +- apps/plugins/pdbox/PDa/extra/lowshelf.c | 187 +- apps/plugins/pdbox/PDa/extra/moog~.c | 376 ++-- apps/plugins/pdbox/PDa/extra/notch.c | 176 +- apps/plugins/pdbox/PDa/extra/sendOSC.c | 2920 +++++++++++++------------- apps/plugins/pdbox/PDa/extra/shell.c | 622 +++--- apps/plugins/pdbox/PDa/intern/biquad~.c | 8 + apps/plugins/pdbox/PDa/intern/bp~.c | 3 + apps/plugins/pdbox/PDa/intern/cos_table.c | 2 + apps/plugins/pdbox/PDa/intern/cos_table.h | 4 + apps/plugins/pdbox/PDa/intern/cos~.c | 3 + apps/plugins/pdbox/PDa/intern/dbtopow~.c | 8 + apps/plugins/pdbox/PDa/intern/dbtorms~.c | 8 + apps/plugins/pdbox/PDa/intern/delread~.c | 14 +- apps/plugins/pdbox/PDa/intern/delwrite~.c | 2 + apps/plugins/pdbox/PDa/intern/env~.c | 6 +- apps/plugins/pdbox/PDa/intern/ftom~.c | 12 + apps/plugins/pdbox/PDa/intern/hip~.c | 3 + apps/plugins/pdbox/PDa/intern/intern_setup.c | 52 +- apps/plugins/pdbox/PDa/intern/line~.c | 2 + apps/plugins/pdbox/PDa/intern/lop~.c | 3 + apps/plugins/pdbox/PDa/intern/mtof~.c | 8 + apps/plugins/pdbox/PDa/intern/osc~.c | 4 + apps/plugins/pdbox/PDa/intern/powtodb~.c | 8 + apps/plugins/pdbox/PDa/intern/rmstodb~.c | 8 + apps/plugins/pdbox/PDa/intern/rsqrt~.c | 8 + apps/plugins/pdbox/PDa/intern/sfread~.c | 34 +- apps/plugins/pdbox/PDa/intern/sfwrite~.c | 10 +- apps/plugins/pdbox/PDa/intern/sqrt~.c | 8 + apps/plugins/pdbox/PDa/intern/tabosc4~.c | 6 + apps/plugins/pdbox/PDa/intern/tabplay~.c | 8 + apps/plugins/pdbox/PDa/intern/tabread4~.c | 3 + apps/plugins/pdbox/PDa/intern/tabread~.c | 10 + apps/plugins/pdbox/PDa/intern/tabsend~.c | 4 + apps/plugins/pdbox/PDa/intern/tabwrite.c | 4 + apps/plugins/pdbox/PDa/intern/vd~.c | 10 +- apps/plugins/pdbox/PDa/intern/vline~.c | 11 +- apps/plugins/pdbox/PDa/intern/wrap~.c | 3 + apps/plugins/pdbox/PDa/src/d_arithmetic.c | 36 + apps/plugins/pdbox/PDa/src/d_ctl.c | 5 +- apps/plugins/pdbox/PDa/src/d_dac.c | 18 + apps/plugins/pdbox/PDa/src/d_fft.c | 9 + apps/plugins/pdbox/PDa/src/d_fftroutine.c | 48 +- apps/plugins/pdbox/PDa/src/d_global.c | 8 + apps/plugins/pdbox/PDa/src/d_imayer_fft.c | 10 + apps/plugins/pdbox/PDa/src/d_mayer_fft.c | 8 + apps/plugins/pdbox/PDa/src/d_misc.c | 31 +- apps/plugins/pdbox/PDa/src/d_soundfile.c | 82 + apps/plugins/pdbox/PDa/src/d_ugen.c | 51 +- apps/plugins/pdbox/PDa/src/g_all_guis.c | 76 + apps/plugins/pdbox/PDa/src/g_array.c | 181 +- apps/plugins/pdbox/PDa/src/g_bang.c | 116 +- apps/plugins/pdbox/PDa/src/g_canvas.c | 143 +- apps/plugins/pdbox/PDa/src/g_editor.c | 144 +- apps/plugins/pdbox/PDa/src/g_graph.c | 83 +- apps/plugins/pdbox/PDa/src/g_hdial.c | 81 +- apps/plugins/pdbox/PDa/src/g_hslider.c | 86 +- apps/plugins/pdbox/PDa/src/g_io.c | 32 + apps/plugins/pdbox/PDa/src/g_mycanvas.c | 66 + apps/plugins/pdbox/PDa/src/g_numbox.c | 93 + apps/plugins/pdbox/PDa/src/g_readwrite.c | 52 +- apps/plugins/pdbox/PDa/src/g_rtext.c | 56 + apps/plugins/pdbox/PDa/src/g_scalar.c | 46 +- apps/plugins/pdbox/PDa/src/g_template.c | 222 +- apps/plugins/pdbox/PDa/src/g_text.c | 201 +- apps/plugins/pdbox/PDa/src/g_toggle.c | 84 + apps/plugins/pdbox/PDa/src/g_traversal.c | 54 +- apps/plugins/pdbox/PDa/src/g_vdial.c | 79 + apps/plugins/pdbox/PDa/src/g_vslider.c | 85 + apps/plugins/pdbox/PDa/src/g_vumeter.c | 78 +- apps/plugins/pdbox/PDa/src/m_atom.c | 20 +- apps/plugins/pdbox/PDa/src/m_binbuf.c | 138 +- apps/plugins/pdbox/PDa/src/m_class.c | 42 +- apps/plugins/pdbox/PDa/src/m_conf.c | 7 + apps/plugins/pdbox/PDa/src/m_fixed.c | 34 +- apps/plugins/pdbox/PDa/src/m_glob.c | 2 + apps/plugins/pdbox/PDa/src/m_memory.c | 2 +- apps/plugins/pdbox/PDa/src/m_obj.c | 29 +- apps/plugins/pdbox/PDa/src/m_pd.c | 17 +- apps/plugins/pdbox/PDa/src/m_sched.c | 68 +- apps/plugins/pdbox/PDa/src/s_audio.c | 81 + apps/plugins/pdbox/PDa/src/s_audio_rockbox.c | 144 ++ apps/plugins/pdbox/PDa/src/s_file.c | 23 +- apps/plugins/pdbox/PDa/src/s_loader.c | 18 +- apps/plugins/pdbox/PDa/src/s_path.c | 49 +- apps/plugins/pdbox/PDa/src/s_print.c | 10 +- apps/plugins/pdbox/PDa/src/s_stuff.h | 12 +- apps/plugins/pdbox/PDa/src/x_acoustics.c | 5 + apps/plugins/pdbox/PDa/src/x_arithmetic.c | 5 + apps/plugins/pdbox/PDa/src/x_connective.c | 59 + apps/plugins/pdbox/PDa/src/x_interface.c | 9 + apps/plugins/pdbox/PDa/src/x_misc.c | 29 + apps/plugins/pdbox/PDa/src/x_net.c | 116 +- apps/plugins/pdbox/PDa/src/x_qlist.c | 22 + apps/plugins/pdbox/PDa/src/x_time.c | 20 +- apps/plugins/pdbox/SOURCES | 54 +- apps/plugins/pdbox/dbestfit-3.3/dmalloc.c | 1 + apps/plugins/pdbox/math.h | 59 + apps/plugins/pdbox/pdbox-func.c | 2428 +++++++++++++++++++++ apps/plugins/pdbox/pdbox-net.c | 4 +- apps/plugins/pdbox/pdbox.c | 109 +- apps/plugins/pdbox/pdbox.h | 98 +- apps/plugins/pdbox/pdbox.make | 6 +- 113 files changed, 10637 insertions(+), 4420 deletions(-) create mode 100644 apps/plugins/pdbox/PDa/intern/cos_table.c create mode 100644 apps/plugins/pdbox/PDa/src/s_audio_rockbox.c create mode 100644 apps/plugins/pdbox/math.h create mode 100644 apps/plugins/pdbox/pdbox-func.c diff --git a/apps/plugins/pdbox/PDa/extra/OSCroute.c b/apps/plugins/pdbox/PDa/extra/OSCroute.c index 24860d0b79..34af5aab4b 100644 --- a/apps/plugins/pdbox/PDa/extra/OSCroute.c +++ b/apps/plugins/pdbox/PDa/extra/OSCroute.c @@ -42,6 +42,10 @@ The OSC webpage is http://cnmat.cnmat.berkeley.edu/OpenSoundControl */ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#else /* ROCKBOX */ #ifdef WIN32 #include #include @@ -52,6 +56,7 @@ The OSC webpage is http://cnmat.cnmat.berkeley.edu/OpenSoundControl #ifdef UNIX #include #endif +#endif /* ROCKBOX */ /* structure definition of your object */ @@ -114,6 +119,9 @@ static void StrCopyUntilSlash(char *target, const char *source); // free static void OSCroute_free(t_OSCroute *x) { +#ifdef ROCKBOX + (void) x; +#endif // freebytes(x->x_vec, x->x_nelement * sizeof(*x->x_vec)); } @@ -154,7 +162,9 @@ void OSCroute_setup(void) { void *OSCroute_new(t_symbol *s, int argc, t_atom *argv) { - +#ifdef ROCKBOX + (void) s; +#endif t_OSCroute *x = (t_OSCroute *)pd_new(OSCroute_class); // get memory for a new object & initialize int i; //{{raf}} n not used @@ -236,6 +246,9 @@ void *OSCroute_new(t_symbol *s, int argc, t_atom *argv) void OSCroute_version (t_OSCroute *x) { +#ifdef ROCKBOX + (void) x; +#endif // EnterCallback(); post("OSCroute Version " OSC_ROUTE_VERSION ", by Matt Wright. pd jdl, win32: raf.\nOSCroute Compiled " __TIME__ " " __DATE__); @@ -248,15 +261,27 @@ void OSCroute_version (t_OSCroute *x) { void OSCroute_assist (t_OSCroute *x, void *box, long msg, long arg, char *dstString) { +#ifdef ROCKBOX + (void) box; +#endif // EnterCallback(); if (msg==ASSIST_INLET) { +#ifdef ROCKBOX + strcpy(dstString, "Incoming OSC messages"); +#else sprintf(dstString, "Incoming OSC messages"); +#endif } else if (msg==ASSIST_OUTLET) { if (arg < 0 || arg >= x->x_num) { post("* OSCroute_assist: No outlet corresponds to arg %ld!", arg); } else { +#ifdef ROCKBOX + strcpy(dstString, "subaddress + args for prefix "); + strcat(dstString, x->x_prefixes[arg]); +#else sprintf(dstString, "subaddress + args for prefix %s", x->x_prefixes[arg]); +#endif } } else { post("* OSCroute_assist: unrecognized message %ld", msg); @@ -266,6 +291,9 @@ void OSCroute_assist (t_OSCroute *x, void *box, long msg, long arg, } void OSCroute_list(t_OSCroute *x, t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; +#endif // EnterCallback(); if (argc > 0 && argv[0].a_type == A_SYMBOL) { /* Ignore the fact that this is a "list" */ diff --git a/apps/plugins/pdbox/PDa/extra/bandpass.c b/apps/plugins/pdbox/PDa/extra/bandpass.c index 127a1eee06..50a0b42e86 100644 --- a/apps/plugins/pdbox/PDa/extra/bandpass.c +++ b/apps/plugins/pdbox/PDa/extra/bandpass.c @@ -1,87 +1,95 @@ - -/* (C) Guenter Geiger */ - - -/* - - These filter coefficients computations are taken from - http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt - - written by Robert Bristow-Johnson - -*/ - -#include "m_pd.h" -#ifdef NT -#pragma warning( disable : 4244 ) -#pragma warning( disable : 4305 ) -#endif -#include -#include "filters.h" - -/* ------------------- bandpass ----------------------------*/ - -static t_class *bandpass_class; - -void bandpass_bang(t_rbjfilter *x) -{ - t_atom at[5]; - t_float omega = e_omega(x->x_freq,x->x_rate); - t_float alpha = e_alpha(x->x_bw* 0.01,omega); - t_float b1 = 0.; - t_float b0 = alpha; - t_float b2 = -alpha; - t_float a0 = 1 + alpha; - t_float a1 = -2.*cos(omega); - t_float a2 = 1 - alpha; - -/* post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw); */ - - if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) { - post("bandpass: filter unstable -> resetting"); - a0=1.;a1=0.;a2=0.; - b0=1.;b1=0.;b2=0.; - } - - SETFLOAT(at,-a1/a0); - SETFLOAT(at+1,-a2/a0); - SETFLOAT(at+2,b0/a0); - SETFLOAT(at+3,b1/a0); - SETFLOAT(at+4,b2/a0); - - outlet_list(x->x_obj.ob_outlet,&s_list,5,at); -} - - -void bandpass_float(t_rbjfilter *x,t_floatarg f) -{ - x->x_freq = f; - bandpass_bang(x); -} - - -static void *bandpass_new(t_floatarg f,t_floatarg bw) -{ - t_rbjfilter *x = (t_rbjfilter *)pd_new(bandpass_class); - - x->x_rate = 44100.0; - outlet_new(&x->x_obj,&s_float); -/* floatinlet_new(&x->x_obj, &x->x_gain); */ - floatinlet_new(&x->x_obj, &x->x_bw); - if (f > 0.) x->x_freq = f; - if (bw > 0.) x->x_bw = bw; - return (x); -} - - -void bandpass_setup(void) -{ - bandpass_class = class_new(gensym("bandpass"), (t_newmethod)bandpass_new, 0, - sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,0); - class_addbang(bandpass_class,bandpass_bang); - class_addfloat(bandpass_class,bandpass_float); -} - - - + +/* (C) Guenter Geiger */ + + +/* + + These filter coefficients computations are taken from + http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt + + written by Robert Bristow-Johnson + +*/ + +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#include "m_pd.h" +#include "math.h" +#include "filters.h" +#else /* ROCKBOX */ +#include "m_pd.h" +#ifdef NT +#pragma warning( disable : 4244 ) +#pragma warning( disable : 4305 ) +#endif +#include +#include "filters.h" +#endif /* ROCKBOX */ + +/* ------------------- bandpass ----------------------------*/ + +static t_class *bandpass_class; + +void bandpass_bang(t_rbjfilter *x) +{ + t_atom at[5]; + t_float omega = e_omega(x->x_freq,x->x_rate); + t_float alpha = e_alpha(x->x_bw* 0.01,omega); + t_float b1 = 0.; + t_float b0 = alpha; + t_float b2 = -alpha; + t_float a0 = 1 + alpha; + t_float a1 = -2.*cos(omega); + t_float a2 = 1 - alpha; + +/* post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw); */ + + if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) { + post("bandpass: filter unstable -> resetting"); + a0=1.;a1=0.;a2=0.; + b0=1.;b1=0.;b2=0.; + } + + SETFLOAT(at,-a1/a0); + SETFLOAT(at+1,-a2/a0); + SETFLOAT(at+2,b0/a0); + SETFLOAT(at+3,b1/a0); + SETFLOAT(at+4,b2/a0); + + outlet_list(x->x_obj.ob_outlet,&s_list,5,at); +} + + +void bandpass_float(t_rbjfilter *x,t_floatarg f) +{ + x->x_freq = f; + bandpass_bang(x); +} + + +static void *bandpass_new(t_floatarg f,t_floatarg bw) +{ + t_rbjfilter *x = (t_rbjfilter *)pd_new(bandpass_class); + + x->x_rate = 44100.0; + outlet_new(&x->x_obj,&s_float); +/* floatinlet_new(&x->x_obj, &x->x_gain); */ + floatinlet_new(&x->x_obj, &x->x_bw); + if (f > 0.) x->x_freq = f; + if (bw > 0.) x->x_bw = bw; + return (x); +} + + +void bandpass_setup(void) +{ + bandpass_class = class_new(gensym("bandpass"), (t_newmethod)bandpass_new, 0, + sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,0); + class_addbang(bandpass_class,bandpass_bang); + class_addfloat(bandpass_class,bandpass_float); +} + + + diff --git a/apps/plugins/pdbox/PDa/extra/dumpOSC.c b/apps/plugins/pdbox/PDa/extra/dumpOSC.c index 28b0d8223e..4e80de18a0 100644 --- a/apps/plugins/pdbox/PDa/extra/dumpOSC.c +++ b/apps/plugins/pdbox/PDa/extra/dumpOSC.c @@ -1,1000 +1,1000 @@ -/* -Written by Matt Wright and Adrian Freed, The Center for New Music and -Audio Technologies, University of California, Berkeley. Copyright (c) -1992,93,94,95,96,97,98,99,2000,01,02,03,04 The Regents of the University of -California (Regents). - -Permission to use, copy, modify, distribute, and distribute modified versions -of this software and its documentation without fee and without a signed -licensing agreement, is hereby granted, provided that the above copyright -notice, this paragraph and the following two paragraphs appear in all copies, -modifications, and distributions. - -IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, -SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING -OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS -BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED -HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE -MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - - -The OSC webpage is http://cnmat.cnmat.berkeley.edu/OpenSoundControl -*/ - - - /* - - dumpOSC.c - server that displays OpenSoundControl messages sent to it - for debugging client udp and UNIX protocol - - by Matt Wright, 6/3/97 - modified from dumpSC.c, by Matt Wright and Adrian Freed - - version 0.2: Added "-silent" option a.k.a. "-quiet" - - version 0.3: Incorporated patches from Nicola Bernardini to make - things Linux-friendly. Also added ntohl() in the right places - to support little-endian architectures. - - - - compile: - cc -o dumpOSC dumpOSC.c - - to-do: - - More robustness in saying exactly what's wrong with ill-formed - messages. (If they don't make sense, show exactly what was - received.) - - Time-based features: print time-received for each packet - - Clean up to separate OSC parsing code from socket/select stuff - - pd: branched from http://www.cnmat.berkeley.edu/OpenSoundControl/src/dumpOSC/dumpOSC.c - ------------- - -- added pd functions - -- socket is made differently than original via pd mechanisms - -- tweaks for Win32 www.zeggz.com/raf 13-April-2002 - -- the OSX changes from cnmat didnt make it here yet but this compiles - on OSX anyway. - -*/ - -#if HAVE_CONFIG_H -#include -#endif - -#include "m_pd.h" -//#include "m_imp.h" -#include "s_stuff.h" - -/* declarations */ - -// typedef void (*t_fdpollfn)(void *ptr, int fd); -void sys_addpollfn(int fd, t_fdpollfn fn, void *ptr); - - -#if defined(__sgi) || defined(__linux) || defined(WIN32) || defined(__APPLE__) - -#ifdef WIN32 - #include "OSC-common.h" - #include - #include - #include - #include - #include - #include - #include - #include -#else - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - //#include - - #ifdef NEED_SCHEDCTL_AND_LOCK - #include - #include - #endif -#endif - - -char *htm_error_string; -typedef int Boolean; -typedef void *OBJ; - -typedef struct ClientAddressStruct { - struct sockaddr_in cl_addr; - int clilen; - int sockfd; -} *ClientAddr; - -typedef unsigned long long osc_time_t; - -Boolean ShowBytes = FALSE; -Boolean Silent = FALSE; - -/* Declarations */ -#ifndef WIN32 -static int unixinitudp(int chan); -#endif - -static int initudp(int chan); -static void closeudp(int sockfd); -Boolean ClientReply(int packetsize, void *packet, int socketfd, - void *clientaddresspointer, int clientaddressbufferlength); -void sgi_CleanExit(void); -Boolean sgi_HaveToQuit(void); -int RegisterPollingDevice(int fd, void (*callbackfunction)(int , void *), void *dummy); -static void catch_sigint(); -static int Synthmessage(char *m, int n, void *clientdesc, int clientdesclength, int fd) ; -char *DataAfterAlignedString(char *string, char *boundary) ; -Boolean IsNiceString(char *string, char *boundary) ; -void complain(char *s, ...); - -#define MAXMESG 32768 -static char mbuf[MAXMESG]; - -/* ----------------------------- dumpOSC ------------------------- */ - -#define MAXOUTAT 50 - -static t_class *dumpOSC_class; - -typedef struct _dumpOSC -{ - t_object x_obj; - t_outlet *x_msgout; - t_outlet *x_connectout; - t_atom x_outat[MAXOUTAT]; - int x_outatc; - t_binbuf *x_b; - int x_connectsocket; - int x_nconnections; - int x_udp; - struct sockaddr_in x_server; - int x_clilen; -} t_dumpOSC; - -void dumpOSC_ParsePacket(t_dumpOSC *x, char *buf, int n, ClientAddr returnAddr); -Boolean dumpOSC_SendReply(char *buf, int n, void *clientDesc, int clientDescLenght, int fd); -static void dumpOSC_Smessage(t_dumpOSC *x, char *address, void *v, int n, ClientAddr returnAddr); -static void dumpOSC_PrintTypeTaggedArgs(t_dumpOSC *x, void *v, int n); -static void dumpOSC_PrintHeuristicallyTypeGuessedArgs(t_dumpOSC *x, void *v, int n, int skipComma); - -static void dumpOSC_read(t_dumpOSC *x, int sockfd) { - int clilen = x->x_clilen; - int n; - struct ClientAddressStruct ras; - ClientAddr ra = &ras; - - //catchupflag= FALSE; - -/* if (ShowBytes) { */ -/* int i; */ -/* printf("%d byte message:\n", n); */ -/* for (i = 0; i < n; ++i) { */ -/* printf(" %x (%c)\t", m[i], m[i]); */ -/* if (i%4 == 3) printf("\n"); */ -/* } */ -/* printf("\n"); */ -/* } */ - - // return catchupflag; - //struct sockaddr_in x->x_server; - //while( (n = recvfrom(sockfd, mbuf, MAXMESG, 0, &cl_addr, &clilen)) >0) - // while(( - - #ifdef WIN32 - if ((n = recvfrom(sockfd, mbuf, MAXMESG, 0, (SOCKADDR*)&x->x_server, &clilen)) >0) - #else - if ((n = recvfrom(sockfd, mbuf, MAXMESG, 0, (struct sockaddr *)&x->x_server, &clilen)) >0) - #endif - { - //int r; - ras.cl_addr = *((struct sockaddr_in *) &x->x_server); - ras.clilen = x->x_clilen; - ras.sockfd = x->x_connectsocket; - - #ifdef DEBUG - printf("dumpOSC_read: received UDP packet of length %d\n", n); - #endif - - if(!dumpOSC_SendReply(mbuf, n, &x->x_server, clilen, sockfd)) - { - dumpOSC_ParsePacket(x, mbuf, n, ra); - } - //r = Synthmessage(mbuf, n, &x->x_server, clilen, sockfd); - //post ("%d", r); - //outlet_anything(x->x_msgout, at[msg].a_w.w_symbol, - // emsg-msg-1, at + msg + 1); - // outlet_list(x->x_msgout, 0, n, mbuf); - //if( sgi_HaveToQuit()) goto out; - //if(r>0) goto back; - //clilen = maxclilen; - } -} - -static void *dumpOSC_new(t_symbol *compatflag, - t_floatarg fportno) { - t_dumpOSC *x; - struct sockaddr_in server; - int clilen=sizeof(server); - int sockfd; - int portno=fportno; - int udp = 1; - - //x->x_b = binbuf_new(); - //x->x_outat = binbuf_getvec(x->x_b); - - //{{raf}} pointer not valid yet...moving this down - //x->x_outatc = 0; {{raf}} - - /* create a socket */ - if ((sockfd = socket(AF_INET, (udp ? SOCK_DGRAM : SOCK_STREAM), 0)) == -1) - { - sys_sockerror("socket"); - return (0); - } - - server.sin_family = AF_INET; - server.sin_addr.s_addr = INADDR_ANY; - /* assign server port number */ - server.sin_port = htons((u_short)portno); - /* name the socket */ - if (bind(sockfd, (struct sockaddr *)&server, sizeof(server)) < 0) - { - sys_sockerror("bind"); - sys_closesocket(sockfd); - return (0); - } - - x = (t_dumpOSC *)pd_new(dumpOSC_class); - x->x_outatc = 0; // {{raf}} now pointer is valid (less invalid) - - x->x_msgout = outlet_new(&x->x_obj, &s_anything); - - // if (udp) /* datagram protocol */ - { - - sys_addpollfn(sockfd, (t_fdpollfn)dumpOSC_read, x); - x->x_connectout = 0; - } - // else /* streaming protocol */ - /* { */ - /* if (listen(sockfd, 5) < 0) */ - /* { */ - /* sys_sockerror("listen"); */ - /* sys_closesocket(sockfd); */ - /* sockfd = -1; */ - /* } */ - /* else */ - /* { */ - /* sys_addpollfn(sockfd, (t_fdpollfn)dumpOSC_connectpoll, x); */ - /* x->x_connectout = outlet_new(&x->x_obj, &s_float); */ - /* } */ - /* } */ - - x->x_connectsocket = sockfd; - x->x_server = server; - x->x_clilen = clilen; - x->x_nconnections = 0; - x->x_udp = udp; - - return (x); -} - -static void dumpOSC_free(t_dumpOSC *x) -{ - /* LATER make me clean up open connections */ - if (x->x_connectsocket >= 0) - { - sys_rmpollfn(x->x_connectsocket); - sys_closesocket(x->x_connectsocket); - } -} - -#ifdef WIN32 -OSC_API void dumpOSC_setup(void) -#else -void dumpOSC_setup(void) -#endif -{ - dumpOSC_class = class_new(gensym("dumpOSC"), - (t_newmethod)dumpOSC_new, (t_method)dumpOSC_free, - sizeof(t_dumpOSC), CLASS_NOINLET, A_DEFFLOAT, A_DEFFLOAT, - A_DEFSYM, 0); - class_sethelpsymbol(dumpOSC_class, gensym("dumpOSC-help.pd")); -} - - -#ifndef WIN32 - #define UNIXDG_PATH "/tmp/htm" - #define UNIXDG_TMP "/tmp/htm.XXXXXX" - static int unixinitudp(int chan) - { - struct sockaddr_un serv_addr; - int sockfd; - - if((sockfd = socket(AF_UNIX, SOCK_DGRAM, 0)) < 0) - return sockfd; - - bzero((char *)&serv_addr, sizeof(serv_addr)); - serv_addr.sun_family = AF_UNIX; - strcpy(serv_addr.sun_path, UNIXDG_PATH); - sprintf(serv_addr.sun_path+strlen(serv_addr.sun_path), "%d", chan); - unlink(serv_addr.sun_path); - if(bind(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr.sun_family)+strlen(serv_addr.sun_path)) < 0) - { - perror("unable to bind\n"); - return -1; - } - - fcntl(sockfd, F_SETFL, FNDELAY); - return sockfd; - } -#endif // #ifndef WIN32 - - - -static int initudp(int chan) -{ - -#ifdef WIN32 - struct sockaddr_in serv_addr; - unsigned int sockfd; - ULONG nonBlocking = (ULONG) TRUE; - - if( (sockfd = socket(AF_INET, SOCK_DGRAM, 0)) != INVALID_SOCKET ) { - ZeroMemory((char *)&serv_addr, sizeof(serv_addr)); - serv_addr.sin_family = AF_INET; - serv_addr.sin_addr.s_addr = htonl(INADDR_ANY); - serv_addr.sin_port = htons(chan); - if(bind(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) >= 0) { - // set for non-blocking mode - if(ioctlsocket(sockfd, FIONBIO, &nonBlocking) == SOCKET_ERROR) { - perror("unable to set non-blocking\n"); - return -1; - } - } - else { perror("unable to bind\n"); return -1; } - } - return (sockfd == INVALID_SOCKET ? -1 : (int)sockfd); -#else - struct sockaddr_in serv_addr; - int sockfd; - - if((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) - return sockfd; - - bzero((char *)&serv_addr, sizeof(serv_addr)); - serv_addr.sin_family = AF_INET; - serv_addr.sin_addr.s_addr = htonl(INADDR_ANY); - serv_addr.sin_port = htons(chan); - - if(bind(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0) - { - perror("unable to bind\n"); - return -1; - } - - fcntl(sockfd, F_SETFL, FNDELAY); - return sockfd; -#endif -} - - - - - - - - -static void closeudp(int sockfd) { - #ifdef WIN32 - closesocket(sockfd); - #else - close(sockfd); - #endif -} - -static Boolean catchupflag=FALSE; -Boolean ClientReply(int packetsize, void *packet, int socketfd, - void *clientaddresspointer, int clientaddressbufferlength) -{ - if(!clientaddresspointer) return FALSE; - catchupflag= TRUE; - return packetsize==sendto(socketfd, packet, packetsize, 0, clientaddresspointer, clientaddressbufferlength); -} - -static Boolean exitflag= FALSE; -void sgi_CleanExit(void) { - exitflag = TRUE; -} - -Boolean sgi_HaveToQuit(void) { - return exitflag; -} - - -/* file descriptor poll table */ -static int npolldevs =0; -typedef struct polldev -{ - int fd; - void (*callbackfunction)(int , void *); - void *dummy; -} polldev; -#define TABMAX 8 -static polldev polldevs[TABMAX]; - - -/* Register a device (referred to by a file descriptor that the caller - should have already successfully obtained from a system call) to be - polled as real-time constraints allowed. - - When a select(2) call indicates activity on the file descriptor, the - callback function is called with the file descripter as first - argument and the given dummy argument (presumably a pointer to the - instance variables associated with the device). -*/ -int RegisterPollingDevice(int fd, void (*callbackfunction)(int , void *), void *dummy) -{ - if(npolldevscl_addr.sin_addr.s_addr; - printf("Client address %p:\n", CA); - printf(" clilen %d, sockfd %d\n", CA->clilen, CA->sockfd); - printf(" sin_family %d, sin_port %d\n", CA->cl_addr.sin_family, - CA->cl_addr.sin_port); - printf(" address: (%x) %s\n", addr, inet_ntoa(CA->cl_addr.sin_addr)); - - printf(" sin_zero = \"%c%c%c%c%c%c%c%c\"\n", - CA->cl_addr.sin_zero[0], - CA->cl_addr.sin_zero[1], - CA->cl_addr.sin_zero[2], - CA->cl_addr.sin_zero[3], - CA->cl_addr.sin_zero[4], - CA->cl_addr.sin_zero[5], - CA->cl_addr.sin_zero[6], - CA->cl_addr.sin_zero[7]); - - printf("\n"); -} - -//******************* - -void WriteTime(char* dst, osc_time_t osctime) -{ - *(int32_t*)dst = htonl((int32_t)(osctime >> 32)); - *(int32_t*)(dst+4) = htonl((int32_t)osctime); -} - -void WriteMode(char* dst) -{ - *(int32_t*)dst = htonl(0); -} - -osc_time_t ReadTime(const char* src) -{ - osc_time_t osctime = ntohl(*(int32_t*)src); - return (osctime << 32) + ntohl(*(int32_t*)(src+4)); -} - -double TimeToSeconds(osc_time_t osctime) -{ - return (double)osctime * 2.3283064365386962890625e-10 /* 1/2^32 */; -} - -int timeRound(double x) -{ - return x >= 0.0 ? x+0.5 : x-0.5; -} -/* -void WriteLogicalTime(char* dst) -{ - static double startTime = -1.0; - double sTime; - - // Initialisierung der Startzeit. - // Knnte effizienter (ohne 'if') auch irgendwo vorher passieren. - // Knnte wahrscheinlich auch 0.0 sein. - if (startTime < 0.0) { - startTime = clock_getlogicaltime(); - } - - sTime = clock_gettimesince(startTime) * 0.001; - *(int32_t*)dst = hton'K l((int32_t)sTime); - *(int32_t*)(dst+4) = htonl((int32_t)(4294967296.0 * sTime)); -} -*/ - -void WriteLogicalTime(char* dst) -{ - double sTime = clock_gettimesince(19230720) / 1000.0; - double tau = sTime - timeRound(sTime); - - //fprintf(stderr, "sSec = %f tau = %f\n", sTime, tau); - - *(int32_t*)dst = htonl((int32_t)(sTime)); - *(int32_t*)(dst+4) = htonl((int32_t)(4294967296 * tau)); -} - -Boolean dumpOSC_SendReply(char *buf, int n, void *clientDesc, int clientDescLenght, int fd) -{ - if((n == 24) && (strcmp(buf, "#time") == 0)) - { - osc_time_t t0, t1, t2; - double dt0, dt1, dt2; - - WriteMode(buf+6); - - t0 = ReadTime(buf+8); - - WriteLogicalTime(buf+16); - t1 = ReadTime(buf+16); // reverse - dt0 = TimeToSeconds(t0); // client time - dt1 = TimeToSeconds(t1); // server time - - // fprintf(stderr, "%f\t%f\t%f\n", dt0, dt1, dt0 - dt1); - - sendto(fd, buf, n, 0, (struct sockaddr *)clientDesc, clientDescLenght); - return TRUE; - } - else - { - return FALSE; - } -} - -//********************** - -void dumpOSC_ParsePacket(t_dumpOSC *x, char *buf, int n, ClientAddr returnAddr) { - // t_dumpOSC *x; - int size, messageLen, i; - char *messageName; - char *args; - - //#ifdef PRINTADDRS - #ifdef DEBUG - //PrintClientAddr(returnAddr); - #endif - - - if ((n%4) != 0) { - complain("SynthControl packet size (%d) not a multiple of 4 bytes: dropping", n); - return; - } - - if ((n >= 8) && (strncmp(buf, "#bundle", 8) == 0)) { - /* This is a bundle message. */ - #ifdef DEBUG - printf("dumpOSC_ParsePacket: bundle msg: bundles not yet supported\n"); - #endif - - if (n < 16) { - complain("Bundle message too small (%d bytes) for time tag", n); - return; - } - - /* Print the time tag */ - #ifdef DEBUG - printf("[ %lx%08lx\n", ntohl(*((unsigned long *)(buf+8))), ntohl(*((unsigned long *)(buf+12)))); - #endif - - /* Note: if we wanted to actually use the time tag as a little-endian - 64-bit int, we'd have to word-swap the two 32-bit halves of it */ - - i = 16; /* Skip "#group\0" and time tag */ - - while(i n) { - complain("Bad size count %d in bundle (only %d bytes left in entire bundle)", - size, n-i-4); - return; - } - - /* Recursively handle element of bundle */ - dumpOSC_ParsePacket(x, buf+i+4, size, returnAddr); - i += 4 + size; - } - - if (i != n) { - complain("This can't happen"); - } - #ifdef DEBUG - printf("]\n"); - #endif - - } - else if ((n == 24) && (strcmp(buf, "#time") == 0)) - { - complain("Time message: %s\n :).\n", htm_error_string); - return; - - } - else - { - /* This is not a bundle message */ - - messageName = buf; - args = DataAfterAlignedString(messageName, buf+n); - if (args == 0) { - complain("Bad message name string: %s\nDropping entire message.\n", - htm_error_string); - return; - } - messageLen = args-messageName; - dumpOSC_Smessage(x, messageName, (void *)args, n-messageLen, returnAddr); - } -} - -#define SMALLEST_POSITIVE_FLOAT 0.000001f - -static void dumpOSC_Smessage(t_dumpOSC *x, char *address, void *v, int n, ClientAddr returnAddr) { - char *chars = v; - t_atom at; - //t_atom myargv[50]; - - int myargc = x->x_outatc; - t_atom* mya = x->x_outat; - int myi; - -#ifdef DEBUG - printf("%s ", address); -#endif - - // ztoln+cvt from envgen.c, ggee-0.18 .. - // outlet_anything's 'symbol' gets set to address - // so we dont need to append address to the atomlist - /* - SETSYMBOL(mya,gensym(address));myargc++; - x->x_outatc = myargc; - */ - - if (n != 0) { - if (chars[0] == ',') { - if (chars[1] != ',') { - /* This message begins with a type-tag string */ - dumpOSC_PrintTypeTaggedArgs(x, v, n); - } else { - /* Double comma means an escaped real comma, not a type string */ - dumpOSC_PrintHeuristicallyTypeGuessedArgs(x, v, n, 1); - } - } else { - dumpOSC_PrintHeuristicallyTypeGuessedArgs(x, v, n, 0); - } - } - - outlet_anything(x->x_msgout,gensym(address),x->x_outatc,(t_atom*)&x->x_outat); - x->x_outatc = 0; -#ifdef DEBUG - printf("\n"); -#endif - fflush(stdout); /* Added for Sami 5/21/98 */ -} - -static void dumpOSC_PrintTypeTaggedArgs(t_dumpOSC *x, void *v, int n) { - char *typeTags, *thisType; - char *p; - - int myargc = x->x_outatc; - t_atom* mya = x->x_outat; - int myi; - - typeTags = v; - - if (!IsNiceString(typeTags, typeTags+n)) { - /* No null-termination, so maybe it wasn't a type tag - string after all */ - dumpOSC_PrintHeuristicallyTypeGuessedArgs(x, v, n, 0); - return; - } - - p = DataAfterAlignedString(typeTags, typeTags+n); - - - for (thisType = typeTags + 1; *thisType != 0; ++thisType) { - switch (*thisType) { - case 'i': case 'r': case 'm': case 'c': -#ifdef DEBUG - //post("integer: %d", ntohl(*((int *) p))); -#endif - /* Martin Peach fix for negative floats: - * was: SETFLOAT(mya+myargc,ntohl(*((int *) p))); - * now is: - */ - SETFLOAT(mya+myargc,(signed)ntohl(*((int *) p))); - myargc++; - - p += 4; - break; - - case 'f': { - int i = ntohl(*((int *) p)); - float *floatp = ((float *) (&i)); -#ifdef DEBUG - post("float: %f", *floatp); -#endif - SETFLOAT(mya+myargc,*floatp); - myargc++; - - p += 4; - } - break; - - case 'h': case 't': -#ifdef DEBUG - printf("[A 64-bit int] "); -#endif - post("[A 64-bit int] not implemented"); - - p += 8; - break; - - case 'd': -#ifdef DEBUG - printf("[A 64-bit float] "); -#endif - post("[A 64-bit float] not implemented"); - - p += 8; - break; - - case 's': case 'S': - if (!IsNiceString(p, typeTags+n)) { - post("Type tag said this arg is a string but it's not!\n"); - return; - } else { -#ifdef DEBUG - post("string: \"%s\"", p); -#endif - SETSYMBOL(mya+myargc,gensym(p)); - myargc++; - //outlet_list(x->x_msgout, 0,sizeof(p), p); - //outlet_anything(x->x_msgout, 0, sizeof(p), p); - p = DataAfterAlignedString(p, typeTags+n); - // append to output vector .. - } - break; - - case 'T': -#ifdef DEBUG - printf("[True] "); -#endif - SETFLOAT(mya+myargc,1.); - myargc++; - break; - case 'F': -#ifdef DEBUG - printf("[False] "); -#endif - SETFLOAT(mya+myargc,0.); - myargc++; - break; - case 'N': -#ifdef DEBUG - printf("[Nil]"); -#endif - post("sendOSC: [Nil] not implemented"); - break; - case 'I': -#ifdef DEBUG - printf("[Infinitum]"); -#endif - post("sendOSC: [Infinitum] not implemented"); - break; - - default: - post("sendOSC: [Unrecognized type tag %c]", *thisType); - // return; - } - } - x->x_outatc = myargc; -} - -static void dumpOSC_PrintHeuristicallyTypeGuessedArgs(t_dumpOSC *x, void *v, int n, int skipComma) { - int i, thisi; - float thisf; - int *ints; - char *chars; - char *string, *nextString; - - int myargc= x->x_outatc; - t_atom* mya = x->x_outat; - int myi; - - - /* Go through the arguments 32 bits at a time */ - ints = v; - chars = v; - - for (i = 0; i= -1000 && thisi <= 1000000) { -#ifdef DEBUG - printf("%d ", thisi); -#endif - // append to output vector .. - SETFLOAT(mya+myargc,(t_float) (thisi)); - myargc++; - // outlet_float(x->x_msgout, thisi); - i++; - } else if (thisf >= -1000.f && thisf <= 1000000.f && - (thisf <=0.0f || thisf >= SMALLEST_POSITIVE_FLOAT)) { -#ifdef DEBUG - printf("%f ", thisf); -#endif - // append to output vector .. - SETFLOAT(mya+myargc,thisf); - myargc++; - //outlet_float(x->x_msgout, thisf); - i++; - } else if (IsNiceString(string, chars+n)) { - nextString = DataAfterAlignedString(string, chars+n); -#ifdef DEBUG - printf("\"%s\" ", (i == 0 && skipComma) ? string +1 : string); -#endif - // append to output vector .. - SETSYMBOL(mya+myargc,gensym(string)); - myargc++; - //outlet_symbol(x->x_msgout, gensym((i == 0 && skipComma) ? string +1 : string)); - i += (nextString-string) / 4; - } else { - // unhandled .. ;) -#ifdef DEBUG - printf("0x%x xx", ints[i]); -#endif - i++; - } - x->x_outatc = myargc; - } -} - - -#define STRING_ALIGN_PAD 4 - -char *DataAfterAlignedString(char *string, char *boundary) -{ - /* The argument is a block of data beginning with a string. The - string has (presumably) been padded with extra null characters - so that the overall length is a multiple of STRING_ALIGN_PAD - bytes. Return a pointer to the next byte after the null - byte(s). The boundary argument points to the character after - the last valid character in the buffer---if the string hasn't - ended by there, something's wrong. - - If the data looks wrong, return 0, and set htm_error_string */ - - int i; - - if ((boundary - string) %4 != 0) { - fprintf(stderr, "Internal error: DataAfterAlignedString: bad boundary\n"); - return 0; - } - - for (i = 0; string[i] != '\0'; i++) { - if (string + i >= boundary) { - htm_error_string = "DataAfterAlignedString: Unreasonably long string"; - return 0; - } - } - - /* Now string[i] is the first null character */ - i++; - - for (; (i % STRING_ALIGN_PAD) != 0; i++) { - if (string + i >= boundary) { - htm_error_string = "DataAfterAlignedString: Unreasonably long string"; - return 0; - } - if (string[i] != '\0') { - htm_error_string = "DataAfterAlignedString: Incorrectly padded string."; - return 0; - } - } - - return string+i; -} - -Boolean IsNiceString(char *string, char *boundary) -{ - /* Arguments same as DataAfterAlignedString(). Is the given "string" - really a string? I.e., is it a sequence of isprint() characters - terminated with 1-4 null characters to align on a 4-byte boundary? */ - - int i; - - if ((boundary - string) %4 != 0) { - fprintf(stderr, "Internal error: IsNiceString: bad boundary\n"); - return 0; - } - - for (i = 0; string[i] != '\0'; i++) { - if (!isprint(string[i])) return FALSE; - if (string + i >= boundary) return FALSE; - } - - /* If we made it this far, it's a null-terminated sequence of printing characters - in the given boundary. Now we just make sure it's null padded... */ - - /* Now string[i] is the first null character */ - i++; - for (; (i % STRING_ALIGN_PAD) != 0; i++) { - if (string[i] != '\0') return FALSE; - } - - return TRUE; -} - - - - - - - - - -#include -void complain(char *s, ...) { - va_list ap; - va_start(ap, s); - fprintf(stderr, "*** ERROR: "); - vfprintf(stderr, s, ap); - fprintf(stderr, "\n"); - va_end(ap); -} - -#endif /* __sgi or LINUX or WIN32 */ +/* +Written by Matt Wright and Adrian Freed, The Center for New Music and +Audio Technologies, University of California, Berkeley. Copyright (c) +1992,93,94,95,96,97,98,99,2000,01,02,03,04 The Regents of the University of +California (Regents). + +Permission to use, copy, modify, distribute, and distribute modified versions +of this software and its documentation without fee and without a signed +licensing agreement, is hereby granted, provided that the above copyright +notice, this paragraph and the following two paragraphs appear in all copies, +modifications, and distributions. + +IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING +OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS +BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED +HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE +MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + + +The OSC webpage is http://cnmat.cnmat.berkeley.edu/OpenSoundControl +*/ + + + /* + + dumpOSC.c + server that displays OpenSoundControl messages sent to it + for debugging client udp and UNIX protocol + + by Matt Wright, 6/3/97 + modified from dumpSC.c, by Matt Wright and Adrian Freed + + version 0.2: Added "-silent" option a.k.a. "-quiet" + + version 0.3: Incorporated patches from Nicola Bernardini to make + things Linux-friendly. Also added ntohl() in the right places + to support little-endian architectures. + + + + compile: + cc -o dumpOSC dumpOSC.c + + to-do: + + More robustness in saying exactly what's wrong with ill-formed + messages. (If they don't make sense, show exactly what was + received.) + + Time-based features: print time-received for each packet + + Clean up to separate OSC parsing code from socket/select stuff + + pd: branched from http://www.cnmat.berkeley.edu/OpenSoundControl/src/dumpOSC/dumpOSC.c + ------------- + -- added pd functions + -- socket is made differently than original via pd mechanisms + -- tweaks for Win32 www.zeggz.com/raf 13-April-2002 + -- the OSX changes from cnmat didnt make it here yet but this compiles + on OSX anyway. + +*/ + +#if HAVE_CONFIG_H +#include +#endif + +#include "m_pd.h" +//#include "m_imp.h" +#include "s_stuff.h" + +/* declarations */ + +// typedef void (*t_fdpollfn)(void *ptr, int fd); +void sys_addpollfn(int fd, t_fdpollfn fn, void *ptr); + + +#if defined(__sgi) || defined(__linux) || defined(WIN32) || defined(__APPLE__) + +#ifdef WIN32 + #include "OSC-common.h" + #include + #include + #include + #include + #include + #include + #include + #include +#else + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + //#include + + #ifdef NEED_SCHEDCTL_AND_LOCK + #include + #include + #endif +#endif + + +char *htm_error_string; +typedef int Boolean; +typedef void *OBJ; + +typedef struct ClientAddressStruct { + struct sockaddr_in cl_addr; + int clilen; + int sockfd; +} *ClientAddr; + +typedef unsigned long long osc_time_t; + +Boolean ShowBytes = FALSE; +Boolean Silent = FALSE; + +/* Declarations */ +#ifndef WIN32 +static int unixinitudp(int chan); +#endif + +static int initudp(int chan); +static void closeudp(int sockfd); +Boolean ClientReply(int packetsize, void *packet, int socketfd, + void *clientaddresspointer, int clientaddressbufferlength); +void sgi_CleanExit(void); +Boolean sgi_HaveToQuit(void); +int RegisterPollingDevice(int fd, void (*callbackfunction)(int , void *), void *dummy); +static void catch_sigint(); +static int Synthmessage(char *m, int n, void *clientdesc, int clientdesclength, int fd) ; +char *DataAfterAlignedString(char *string, char *boundary) ; +Boolean IsNiceString(char *string, char *boundary) ; +void complain(char *s, ...); + +#define MAXMESG 32768 +static char mbuf[MAXMESG]; + +/* ----------------------------- dumpOSC ------------------------- */ + +#define MAXOUTAT 50 + +static t_class *dumpOSC_class; + +typedef struct _dumpOSC +{ + t_object x_obj; + t_outlet *x_msgout; + t_outlet *x_connectout; + t_atom x_outat[MAXOUTAT]; + int x_outatc; + t_binbuf *x_b; + int x_connectsocket; + int x_nconnections; + int x_udp; + struct sockaddr_in x_server; + int x_clilen; +} t_dumpOSC; + +void dumpOSC_ParsePacket(t_dumpOSC *x, char *buf, int n, ClientAddr returnAddr); +Boolean dumpOSC_SendReply(char *buf, int n, void *clientDesc, int clientDescLenght, int fd); +static void dumpOSC_Smessage(t_dumpOSC *x, char *address, void *v, int n, ClientAddr returnAddr); +static void dumpOSC_PrintTypeTaggedArgs(t_dumpOSC *x, void *v, int n); +static void dumpOSC_PrintHeuristicallyTypeGuessedArgs(t_dumpOSC *x, void *v, int n, int skipComma); + +static void dumpOSC_read(t_dumpOSC *x, int sockfd) { + int clilen = x->x_clilen; + int n; + struct ClientAddressStruct ras; + ClientAddr ra = &ras; + + //catchupflag= FALSE; + +/* if (ShowBytes) { */ +/* int i; */ +/* printf("%d byte message:\n", n); */ +/* for (i = 0; i < n; ++i) { */ +/* printf(" %x (%c)\t", m[i], m[i]); */ +/* if (i%4 == 3) printf("\n"); */ +/* } */ +/* printf("\n"); */ +/* } */ + + // return catchupflag; + //struct sockaddr_in x->x_server; + //while( (n = recvfrom(sockfd, mbuf, MAXMESG, 0, &cl_addr, &clilen)) >0) + // while(( + + #ifdef WIN32 + if ((n = recvfrom(sockfd, mbuf, MAXMESG, 0, (SOCKADDR*)&x->x_server, &clilen)) >0) + #else + if ((n = recvfrom(sockfd, mbuf, MAXMESG, 0, (struct sockaddr *)&x->x_server, &clilen)) >0) + #endif + { + //int r; + ras.cl_addr = *((struct sockaddr_in *) &x->x_server); + ras.clilen = x->x_clilen; + ras.sockfd = x->x_connectsocket; + + #ifdef DEBUG + printf("dumpOSC_read: received UDP packet of length %d\n", n); + #endif + + if(!dumpOSC_SendReply(mbuf, n, &x->x_server, clilen, sockfd)) + { + dumpOSC_ParsePacket(x, mbuf, n, ra); + } + //r = Synthmessage(mbuf, n, &x->x_server, clilen, sockfd); + //post ("%d", r); + //outlet_anything(x->x_msgout, at[msg].a_w.w_symbol, + // emsg-msg-1, at + msg + 1); + // outlet_list(x->x_msgout, 0, n, mbuf); + //if( sgi_HaveToQuit()) goto out; + //if(r>0) goto back; + //clilen = maxclilen; + } +} + +static void *dumpOSC_new(t_symbol *compatflag, + t_floatarg fportno) { + t_dumpOSC *x; + struct sockaddr_in server; + int clilen=sizeof(server); + int sockfd; + int portno=fportno; + int udp = 1; + + //x->x_b = binbuf_new(); + //x->x_outat = binbuf_getvec(x->x_b); + + //{{raf}} pointer not valid yet...moving this down + //x->x_outatc = 0; {{raf}} + + /* create a socket */ + if ((sockfd = socket(AF_INET, (udp ? SOCK_DGRAM : SOCK_STREAM), 0)) == -1) + { + sys_sockerror("socket"); + return (0); + } + + server.sin_family = AF_INET; + server.sin_addr.s_addr = INADDR_ANY; + /* assign server port number */ + server.sin_port = htons((u_short)portno); + /* name the socket */ + if (bind(sockfd, (struct sockaddr *)&server, sizeof(server)) < 0) + { + sys_sockerror("bind"); + sys_closesocket(sockfd); + return (0); + } + + x = (t_dumpOSC *)pd_new(dumpOSC_class); + x->x_outatc = 0; // {{raf}} now pointer is valid (less invalid) + + x->x_msgout = outlet_new(&x->x_obj, &s_anything); + + // if (udp) /* datagram protocol */ + { + + sys_addpollfn(sockfd, (t_fdpollfn)dumpOSC_read, x); + x->x_connectout = 0; + } + // else /* streaming protocol */ + /* { */ + /* if (listen(sockfd, 5) < 0) */ + /* { */ + /* sys_sockerror("listen"); */ + /* sys_closesocket(sockfd); */ + /* sockfd = -1; */ + /* } */ + /* else */ + /* { */ + /* sys_addpollfn(sockfd, (t_fdpollfn)dumpOSC_connectpoll, x); */ + /* x->x_connectout = outlet_new(&x->x_obj, &s_float); */ + /* } */ + /* } */ + + x->x_connectsocket = sockfd; + x->x_server = server; + x->x_clilen = clilen; + x->x_nconnections = 0; + x->x_udp = udp; + + return (x); +} + +static void dumpOSC_free(t_dumpOSC *x) +{ + /* LATER make me clean up open connections */ + if (x->x_connectsocket >= 0) + { + sys_rmpollfn(x->x_connectsocket); + sys_closesocket(x->x_connectsocket); + } +} + +#ifdef WIN32 +OSC_API void dumpOSC_setup(void) +#else +void dumpOSC_setup(void) +#endif +{ + dumpOSC_class = class_new(gensym("dumpOSC"), + (t_newmethod)dumpOSC_new, (t_method)dumpOSC_free, + sizeof(t_dumpOSC), CLASS_NOINLET, A_DEFFLOAT, A_DEFFLOAT, + A_DEFSYM, 0); + class_sethelpsymbol(dumpOSC_class, gensym("dumpOSC-help.pd")); +} + + +#ifndef WIN32 + #define UNIXDG_PATH "/tmp/htm" + #define UNIXDG_TMP "/tmp/htm.XXXXXX" + static int unixinitudp(int chan) + { + struct sockaddr_un serv_addr; + int sockfd; + + if((sockfd = socket(AF_UNIX, SOCK_DGRAM, 0)) < 0) + return sockfd; + + bzero((char *)&serv_addr, sizeof(serv_addr)); + serv_addr.sun_family = AF_UNIX; + strcpy(serv_addr.sun_path, UNIXDG_PATH); + sprintf(serv_addr.sun_path+strlen(serv_addr.sun_path), "%d", chan); + unlink(serv_addr.sun_path); + if(bind(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr.sun_family)+strlen(serv_addr.sun_path)) < 0) + { + perror("unable to bind\n"); + return -1; + } + + fcntl(sockfd, F_SETFL, FNDELAY); + return sockfd; + } +#endif // #ifndef WIN32 + + + +static int initudp(int chan) +{ + +#ifdef WIN32 + struct sockaddr_in serv_addr; + unsigned int sockfd; + ULONG nonBlocking = (ULONG) TRUE; + + if( (sockfd = socket(AF_INET, SOCK_DGRAM, 0)) != INVALID_SOCKET ) { + ZeroMemory((char *)&serv_addr, sizeof(serv_addr)); + serv_addr.sin_family = AF_INET; + serv_addr.sin_addr.s_addr = htonl(INADDR_ANY); + serv_addr.sin_port = htons(chan); + if(bind(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) >= 0) { + // set for non-blocking mode + if(ioctlsocket(sockfd, FIONBIO, &nonBlocking) == SOCKET_ERROR) { + perror("unable to set non-blocking\n"); + return -1; + } + } + else { perror("unable to bind\n"); return -1; } + } + return (sockfd == INVALID_SOCKET ? -1 : (int)sockfd); +#else + struct sockaddr_in serv_addr; + int sockfd; + + if((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) + return sockfd; + + bzero((char *)&serv_addr, sizeof(serv_addr)); + serv_addr.sin_family = AF_INET; + serv_addr.sin_addr.s_addr = htonl(INADDR_ANY); + serv_addr.sin_port = htons(chan); + + if(bind(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr)) < 0) + { + perror("unable to bind\n"); + return -1; + } + + fcntl(sockfd, F_SETFL, FNDELAY); + return sockfd; +#endif +} + + + + + + + + +static void closeudp(int sockfd) { + #ifdef WIN32 + closesocket(sockfd); + #else + close(sockfd); + #endif +} + +static Boolean catchupflag=FALSE; +Boolean ClientReply(int packetsize, void *packet, int socketfd, + void *clientaddresspointer, int clientaddressbufferlength) +{ + if(!clientaddresspointer) return FALSE; + catchupflag= TRUE; + return packetsize==sendto(socketfd, packet, packetsize, 0, clientaddresspointer, clientaddressbufferlength); +} + +static Boolean exitflag= FALSE; +void sgi_CleanExit(void) { + exitflag = TRUE; +} + +Boolean sgi_HaveToQuit(void) { + return exitflag; +} + + +/* file descriptor poll table */ +static int npolldevs =0; +typedef struct polldev +{ + int fd; + void (*callbackfunction)(int , void *); + void *dummy; +} polldev; +#define TABMAX 8 +static polldev polldevs[TABMAX]; + + +/* Register a device (referred to by a file descriptor that the caller + should have already successfully obtained from a system call) to be + polled as real-time constraints allowed. + + When a select(2) call indicates activity on the file descriptor, the + callback function is called with the file descripter as first + argument and the given dummy argument (presumably a pointer to the + instance variables associated with the device). +*/ +int RegisterPollingDevice(int fd, void (*callbackfunction)(int , void *), void *dummy) +{ + if(npolldevscl_addr.sin_addr.s_addr; + printf("Client address %p:\n", CA); + printf(" clilen %d, sockfd %d\n", CA->clilen, CA->sockfd); + printf(" sin_family %d, sin_port %d\n", CA->cl_addr.sin_family, + CA->cl_addr.sin_port); + printf(" address: (%x) %s\n", addr, inet_ntoa(CA->cl_addr.sin_addr)); + + printf(" sin_zero = \"%c%c%c%c%c%c%c%c\"\n", + CA->cl_addr.sin_zero[0], + CA->cl_addr.sin_zero[1], + CA->cl_addr.sin_zero[2], + CA->cl_addr.sin_zero[3], + CA->cl_addr.sin_zero[4], + CA->cl_addr.sin_zero[5], + CA->cl_addr.sin_zero[6], + CA->cl_addr.sin_zero[7]); + + printf("\n"); +} + +//******************* + +void WriteTime(char* dst, osc_time_t osctime) +{ + *(int32_t*)dst = htonl((int32_t)(osctime >> 32)); + *(int32_t*)(dst+4) = htonl((int32_t)osctime); +} + +void WriteMode(char* dst) +{ + *(int32_t*)dst = htonl(0); +} + +osc_time_t ReadTime(const char* src) +{ + osc_time_t osctime = ntohl(*(int32_t*)src); + return (osctime << 32) + ntohl(*(int32_t*)(src+4)); +} + +double TimeToSeconds(osc_time_t osctime) +{ + return (double)osctime * 2.3283064365386962890625e-10 /* 1/2^32 */; +} + +int timeRound(double x) +{ + return x >= 0.0 ? x+0.5 : x-0.5; +} +/* +void WriteLogicalTime(char* dst) +{ + static double startTime = -1.0; + double sTime; + + // Initialisierung der Startzeit. + // Knnte effizienter (ohne 'if') auch irgendwo vorher passieren. + // Knnte wahrscheinlich auch 0.0 sein. + if (startTime < 0.0) { + startTime = clock_getlogicaltime(); + } + + sTime = clock_gettimesince(startTime) * 0.001; + *(int32_t*)dst = hton'K l((int32_t)sTime); + *(int32_t*)(dst+4) = htonl((int32_t)(4294967296.0 * sTime)); +} +*/ + +void WriteLogicalTime(char* dst) +{ + double sTime = clock_gettimesince(19230720) / 1000.0; + double tau = sTime - timeRound(sTime); + + //fprintf(stderr, "sSec = %f tau = %f\n", sTime, tau); + + *(int32_t*)dst = htonl((int32_t)(sTime)); + *(int32_t*)(dst+4) = htonl((int32_t)(4294967296 * tau)); +} + +Boolean dumpOSC_SendReply(char *buf, int n, void *clientDesc, int clientDescLenght, int fd) +{ + if((n == 24) && (strcmp(buf, "#time") == 0)) + { + osc_time_t t0, t1, t2; + double dt0, dt1, dt2; + + WriteMode(buf+6); + + t0 = ReadTime(buf+8); + + WriteLogicalTime(buf+16); + t1 = ReadTime(buf+16); // reverse + dt0 = TimeToSeconds(t0); // client time + dt1 = TimeToSeconds(t1); // server time + + // fprintf(stderr, "%f\t%f\t%f\n", dt0, dt1, dt0 - dt1); + + sendto(fd, buf, n, 0, (struct sockaddr *)clientDesc, clientDescLenght); + return TRUE; + } + else + { + return FALSE; + } +} + +//********************** + +void dumpOSC_ParsePacket(t_dumpOSC *x, char *buf, int n, ClientAddr returnAddr) { + // t_dumpOSC *x; + int size, messageLen, i; + char *messageName; + char *args; + + //#ifdef PRINTADDRS + #ifdef DEBUG + //PrintClientAddr(returnAddr); + #endif + + + if ((n%4) != 0) { + complain("SynthControl packet size (%d) not a multiple of 4 bytes: dropping", n); + return; + } + + if ((n >= 8) && (strncmp(buf, "#bundle", 8) == 0)) { + /* This is a bundle message. */ + #ifdef DEBUG + printf("dumpOSC_ParsePacket: bundle msg: bundles not yet supported\n"); + #endif + + if (n < 16) { + complain("Bundle message too small (%d bytes) for time tag", n); + return; + } + + /* Print the time tag */ + #ifdef DEBUG + printf("[ %lx%08lx\n", ntohl(*((unsigned long *)(buf+8))), ntohl(*((unsigned long *)(buf+12)))); + #endif + + /* Note: if we wanted to actually use the time tag as a little-endian + 64-bit int, we'd have to word-swap the two 32-bit halves of it */ + + i = 16; /* Skip "#group\0" and time tag */ + + while(i n) { + complain("Bad size count %d in bundle (only %d bytes left in entire bundle)", + size, n-i-4); + return; + } + + /* Recursively handle element of bundle */ + dumpOSC_ParsePacket(x, buf+i+4, size, returnAddr); + i += 4 + size; + } + + if (i != n) { + complain("This can't happen"); + } + #ifdef DEBUG + printf("]\n"); + #endif + + } + else if ((n == 24) && (strcmp(buf, "#time") == 0)) + { + complain("Time message: %s\n :).\n", htm_error_string); + return; + + } + else + { + /* This is not a bundle message */ + + messageName = buf; + args = DataAfterAlignedString(messageName, buf+n); + if (args == 0) { + complain("Bad message name string: %s\nDropping entire message.\n", + htm_error_string); + return; + } + messageLen = args-messageName; + dumpOSC_Smessage(x, messageName, (void *)args, n-messageLen, returnAddr); + } +} + +#define SMALLEST_POSITIVE_FLOAT 0.000001f + +static void dumpOSC_Smessage(t_dumpOSC *x, char *address, void *v, int n, ClientAddr returnAddr) { + char *chars = v; + t_atom at; + //t_atom myargv[50]; + + int myargc = x->x_outatc; + t_atom* mya = x->x_outat; + int myi; + +#ifdef DEBUG + printf("%s ", address); +#endif + + // ztoln+cvt from envgen.c, ggee-0.18 .. + // outlet_anything's 'symbol' gets set to address + // so we dont need to append address to the atomlist + /* + SETSYMBOL(mya,gensym(address));myargc++; + x->x_outatc = myargc; + */ + + if (n != 0) { + if (chars[0] == ',') { + if (chars[1] != ',') { + /* This message begins with a type-tag string */ + dumpOSC_PrintTypeTaggedArgs(x, v, n); + } else { + /* Double comma means an escaped real comma, not a type string */ + dumpOSC_PrintHeuristicallyTypeGuessedArgs(x, v, n, 1); + } + } else { + dumpOSC_PrintHeuristicallyTypeGuessedArgs(x, v, n, 0); + } + } + + outlet_anything(x->x_msgout,gensym(address),x->x_outatc,(t_atom*)&x->x_outat); + x->x_outatc = 0; +#ifdef DEBUG + printf("\n"); +#endif + fflush(stdout); /* Added for Sami 5/21/98 */ +} + +static void dumpOSC_PrintTypeTaggedArgs(t_dumpOSC *x, void *v, int n) { + char *typeTags, *thisType; + char *p; + + int myargc = x->x_outatc; + t_atom* mya = x->x_outat; + int myi; + + typeTags = v; + + if (!IsNiceString(typeTags, typeTags+n)) { + /* No null-termination, so maybe it wasn't a type tag + string after all */ + dumpOSC_PrintHeuristicallyTypeGuessedArgs(x, v, n, 0); + return; + } + + p = DataAfterAlignedString(typeTags, typeTags+n); + + + for (thisType = typeTags + 1; *thisType != 0; ++thisType) { + switch (*thisType) { + case 'i': case 'r': case 'm': case 'c': +#ifdef DEBUG + //post("integer: %d", ntohl(*((int *) p))); +#endif + /* Martin Peach fix for negative floats: + * was: SETFLOAT(mya+myargc,ntohl(*((int *) p))); + * now is: + */ + SETFLOAT(mya+myargc,(signed)ntohl(*((int *) p))); + myargc++; + + p += 4; + break; + + case 'f': { + int i = ntohl(*((int *) p)); + float *floatp = ((float *) (&i)); +#ifdef DEBUG + post("float: %f", *floatp); +#endif + SETFLOAT(mya+myargc,*floatp); + myargc++; + + p += 4; + } + break; + + case 'h': case 't': +#ifdef DEBUG + printf("[A 64-bit int] "); +#endif + post("[A 64-bit int] not implemented"); + + p += 8; + break; + + case 'd': +#ifdef DEBUG + printf("[A 64-bit float] "); +#endif + post("[A 64-bit float] not implemented"); + + p += 8; + break; + + case 's': case 'S': + if (!IsNiceString(p, typeTags+n)) { + post("Type tag said this arg is a string but it's not!\n"); + return; + } else { +#ifdef DEBUG + post("string: \"%s\"", p); +#endif + SETSYMBOL(mya+myargc,gensym(p)); + myargc++; + //outlet_list(x->x_msgout, 0,sizeof(p), p); + //outlet_anything(x->x_msgout, 0, sizeof(p), p); + p = DataAfterAlignedString(p, typeTags+n); + // append to output vector .. + } + break; + + case 'T': +#ifdef DEBUG + printf("[True] "); +#endif + SETFLOAT(mya+myargc,1.); + myargc++; + break; + case 'F': +#ifdef DEBUG + printf("[False] "); +#endif + SETFLOAT(mya+myargc,0.); + myargc++; + break; + case 'N': +#ifdef DEBUG + printf("[Nil]"); +#endif + post("sendOSC: [Nil] not implemented"); + break; + case 'I': +#ifdef DEBUG + printf("[Infinitum]"); +#endif + post("sendOSC: [Infinitum] not implemented"); + break; + + default: + post("sendOSC: [Unrecognized type tag %c]", *thisType); + // return; + } + } + x->x_outatc = myargc; +} + +static void dumpOSC_PrintHeuristicallyTypeGuessedArgs(t_dumpOSC *x, void *v, int n, int skipComma) { + int i, thisi; + float thisf; + int *ints; + char *chars; + char *string, *nextString; + + int myargc= x->x_outatc; + t_atom* mya = x->x_outat; + int myi; + + + /* Go through the arguments 32 bits at a time */ + ints = v; + chars = v; + + for (i = 0; i= -1000 && thisi <= 1000000) { +#ifdef DEBUG + printf("%d ", thisi); +#endif + // append to output vector .. + SETFLOAT(mya+myargc,(t_float) (thisi)); + myargc++; + // outlet_float(x->x_msgout, thisi); + i++; + } else if (thisf >= -1000.f && thisf <= 1000000.f && + (thisf <=0.0f || thisf >= SMALLEST_POSITIVE_FLOAT)) { +#ifdef DEBUG + printf("%f ", thisf); +#endif + // append to output vector .. + SETFLOAT(mya+myargc,thisf); + myargc++; + //outlet_float(x->x_msgout, thisf); + i++; + } else if (IsNiceString(string, chars+n)) { + nextString = DataAfterAlignedString(string, chars+n); +#ifdef DEBUG + printf("\"%s\" ", (i == 0 && skipComma) ? string +1 : string); +#endif + // append to output vector .. + SETSYMBOL(mya+myargc,gensym(string)); + myargc++; + //outlet_symbol(x->x_msgout, gensym((i == 0 && skipComma) ? string +1 : string)); + i += (nextString-string) / 4; + } else { + // unhandled .. ;) +#ifdef DEBUG + printf("0x%x xx", ints[i]); +#endif + i++; + } + x->x_outatc = myargc; + } +} + + +#define STRING_ALIGN_PAD 4 + +char *DataAfterAlignedString(char *string, char *boundary) +{ + /* The argument is a block of data beginning with a string. The + string has (presumably) been padded with extra null characters + so that the overall length is a multiple of STRING_ALIGN_PAD + bytes. Return a pointer to the next byte after the null + byte(s). The boundary argument points to the character after + the last valid character in the buffer---if the string hasn't + ended by there, something's wrong. + + If the data looks wrong, return 0, and set htm_error_string */ + + int i; + + if ((boundary - string) %4 != 0) { + fprintf(stderr, "Internal error: DataAfterAlignedString: bad boundary\n"); + return 0; + } + + for (i = 0; string[i] != '\0'; i++) { + if (string + i >= boundary) { + htm_error_string = "DataAfterAlignedString: Unreasonably long string"; + return 0; + } + } + + /* Now string[i] is the first null character */ + i++; + + for (; (i % STRING_ALIGN_PAD) != 0; i++) { + if (string + i >= boundary) { + htm_error_string = "DataAfterAlignedString: Unreasonably long string"; + return 0; + } + if (string[i] != '\0') { + htm_error_string = "DataAfterAlignedString: Incorrectly padded string."; + return 0; + } + } + + return string+i; +} + +Boolean IsNiceString(char *string, char *boundary) +{ + /* Arguments same as DataAfterAlignedString(). Is the given "string" + really a string? I.e., is it a sequence of isprint() characters + terminated with 1-4 null characters to align on a 4-byte boundary? */ + + int i; + + if ((boundary - string) %4 != 0) { + fprintf(stderr, "Internal error: IsNiceString: bad boundary\n"); + return 0; + } + + for (i = 0; string[i] != '\0'; i++) { + if (!isprint(string[i])) return FALSE; + if (string + i >= boundary) return FALSE; + } + + /* If we made it this far, it's a null-terminated sequence of printing characters + in the given boundary. Now we just make sure it's null padded... */ + + /* Now string[i] is the first null character */ + i++; + for (; (i % STRING_ALIGN_PAD) != 0; i++) { + if (string[i] != '\0') return FALSE; + } + + return TRUE; +} + + + + + + + + + +#include +void complain(char *s, ...) { + va_list ap; + va_start(ap, s); + fprintf(stderr, "*** ERROR: "); + vfprintf(stderr, s, ap); + fprintf(stderr, "\n"); + va_end(ap); +} + +#endif /* __sgi or LINUX or WIN32 */ diff --git a/apps/plugins/pdbox/PDa/extra/equalizer.c b/apps/plugins/pdbox/PDa/extra/equalizer.c index 743832302b..18f84ee3b3 100644 --- a/apps/plugins/pdbox/PDa/extra/equalizer.c +++ b/apps/plugins/pdbox/PDa/extra/equalizer.c @@ -1,86 +1,93 @@ -/* (C) Guenter Geiger */ - - -/* - - These filter coefficients computations are taken from - http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt - - written by Robert Bristow-Johnson - -*/ - -#include "m_pd.h" -#ifdef NT -#pragma warning( disable : 4244 ) -#pragma warning( disable : 4305 ) -#endif -#include -#include "filters.h" - - - -/* ------------------- equ ----------------------------*/ -static t_class *equ_class; - -void equ_bang(t_rbjfilter *x) -{ - t_atom at[5]; - t_float omega = e_omega(x->x_freq,x->x_rate); - t_float alpha = e_alpha(x->x_bw*0.01,omega); - t_float b0 = 1 + alpha*e_A(x->x_gain); - t_float b1 = -2.*cos(omega); - t_float b2 = 1 - alpha*e_A(x->x_gain); - t_float a0 = 1 + alpha/e_A(x->x_gain); - t_float a1 = -2.*cos(omega); - t_float a2 = 1 - alpha/e_A(x->x_gain); - -/* post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw);*/ - - if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) { - post("equ: filter unstable -> resetting"); - a0=1.;a1=0.;a2=0.; - b0=1.;b1=0.;b2=0.; - } - - SETFLOAT(at,-a1/a0); - SETFLOAT(at+1,-a2/a0); - SETFLOAT(at+2,b0/a0); - SETFLOAT(at+3,b1/a0); - SETFLOAT(at+4,b2/a0); - - outlet_list(x->x_obj.ob_outlet,&s_list,5,at); -} - - -void equ_float(t_rbjfilter *x,t_floatarg f) -{ - x->x_freq = f; - equ_bang(x); -} - - -static void *equ_new(t_floatarg f,t_floatarg g,t_floatarg bw) -{ - t_rbjfilter *x = (t_rbjfilter *)pd_new(equ_class); - - x->x_rate = 44100.0; - outlet_new(&x->x_obj,&s_float); - floatinlet_new(&x->x_obj, &x->x_gain); - floatinlet_new(&x->x_obj, &x->x_bw); - if (f > 0.) x->x_freq = f; - if (bw > 0.) x->x_bw = bw; - if (g != 0.) x->x_gain = g; - return (x); -} - - -void equalizer_setup(void) -{ - equ_class = class_new(gensym("equalizer"), (t_newmethod)equ_new, 0, - sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0); - class_addbang(equ_class,equ_bang); - class_addfloat(equ_class,equ_float); -} - +/* (C) Guenter Geiger */ + + +/* + + These filter coefficients computations are taken from + http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt + + written by Robert Bristow-Johnson + +*/ + +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#include "m_pd.h" +#include "math.h" +#include "filters.h" +#else /* ROCKBOX */ +#include "m_pd.h" +#ifdef NT +#pragma warning( disable : 4244 ) +#pragma warning( disable : 4305 ) +#endif +#include +#include "filters.h" +#endif /* ROCKBOX */ + + +/* ------------------- equ ----------------------------*/ +static t_class *equ_class; + +void equ_bang(t_rbjfilter *x) +{ + t_atom at[5]; + t_float omega = e_omega(x->x_freq,x->x_rate); + t_float alpha = e_alpha(x->x_bw*0.01,omega); + t_float b0 = 1 + alpha*e_A(x->x_gain); + t_float b1 = -2.*cos(omega); + t_float b2 = 1 - alpha*e_A(x->x_gain); + t_float a0 = 1 + alpha/e_A(x->x_gain); + t_float a1 = -2.*cos(omega); + t_float a2 = 1 - alpha/e_A(x->x_gain); + +/* post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw);*/ + + if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) { + post("equ: filter unstable -> resetting"); + a0=1.;a1=0.;a2=0.; + b0=1.;b1=0.;b2=0.; + } + + SETFLOAT(at,-a1/a0); + SETFLOAT(at+1,-a2/a0); + SETFLOAT(at+2,b0/a0); + SETFLOAT(at+3,b1/a0); + SETFLOAT(at+4,b2/a0); + + outlet_list(x->x_obj.ob_outlet,&s_list,5,at); +} + + +void equ_float(t_rbjfilter *x,t_floatarg f) +{ + x->x_freq = f; + equ_bang(x); +} + + +static void *equ_new(t_floatarg f,t_floatarg g,t_floatarg bw) +{ + t_rbjfilter *x = (t_rbjfilter *)pd_new(equ_class); + + x->x_rate = 44100.0; + outlet_new(&x->x_obj,&s_float); + floatinlet_new(&x->x_obj, &x->x_gain); + floatinlet_new(&x->x_obj, &x->x_bw); + if (f > 0.) x->x_freq = f; + if (bw > 0.) x->x_bw = bw; + if (g != 0.) x->x_gain = g; + return (x); +} + + +void equalizer_setup(void) +{ + equ_class = class_new(gensym("equalizer"), (t_newmethod)equ_new, 0, + sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0); + class_addbang(equ_class,equ_bang); + class_addfloat(equ_class,equ_float); +} + diff --git a/apps/plugins/pdbox/PDa/extra/filters.h b/apps/plugins/pdbox/PDa/extra/filters.h index 8a91f75073..2eaf2b09f9 100644 --- a/apps/plugins/pdbox/PDa/extra/filters.h +++ b/apps/plugins/pdbox/PDa/extra/filters.h @@ -1,75 +1,82 @@ -/* - - These filter coefficients computations are taken from - http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt - - written by Robert Bristow-Johnson - -*/ - - -#ifndef __GGEE_FILTERS_H__ -#define __GGEE_FILTERS_H__ - - - -#ifndef M_PI -#define M_PI 3.141593f -#endif - - -#include -#define LN2 0.69314718 -#define e_A(g) (pow(10,(g/40.))) -#define e_omega(f,r) (2.0*M_PI*f/r) -#define e_alpha(bw,omega) (sin(omega)*sinh(LN2/2. * bw * omega/sin(omega))) -#define e_beta(a,S) (sqrt((a*a + 1)/(S) - (a-1)*(a-1))) - - - - -typedef struct _rbjfilter -{ - t_object x_obj; - t_float x_rate; - t_float x_freq; - t_float x_gain; - t_float x_bw; -} t_rbjfilter; - - -static int check_stability(t_float fb1, - t_float fb2, - t_float ff1, - t_float ff2, - t_float ff3) -{ - float discriminant = fb1 * fb1 + 4 * fb2; - - if (discriminant < 0) /* imaginary roots -- resonant filter */ - { - /* they're conjugates so we just check that the product - is less than one */ - if (fb2 >= -1.0f) goto stable; - } - else /* real roots */ - { - /* check that the parabola 1 - fb1 x - fb2 x^2 has a - vertex between -1 and 1, and that it's nonnegative - at both ends, which implies both roots are in [1-,1]. */ - if (fb1 <= 2.0f && fb1 >= -2.0f && - 1.0f - fb1 -fb2 >= 0 && 1.0f + fb1 - fb2 >= 0) - goto stable; - } - return 0; -stable: - return 1; -} - - - - - - -#endif +/* + + These filter coefficients computations are taken from + http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt + + written by Robert Bristow-Johnson + +*/ + + +#ifndef __GGEE_FILTERS_H__ +#define __GGEE_FILTERS_H__ + +#ifdef ROCKBOX +#include "math.h" +#else +#include +#endif + +#ifndef M_PI +#define M_PI 3.141593f +#endif + +#define LN2 0.69314718 +#define e_A(g) (pow(10,(g/40.))) +#define e_omega(f,r) (2.0*M_PI*f/r) +#define e_alpha(bw,omega) (sin(omega)*sinh(LN2/2. * bw * omega/sin(omega))) +#define e_beta(a,S) (sqrt((a*a + 1)/(S) - (a-1)*(a-1))) + + + + +typedef struct _rbjfilter +{ + t_object x_obj; + t_float x_rate; + t_float x_freq; + t_float x_gain; + t_float x_bw; +} t_rbjfilter; + + +static int check_stability(t_float fb1, + t_float fb2, + t_float ff1, + t_float ff2, + t_float ff3) +{ +#ifdef ROCKBOX + (void) ff1; + (void) ff2; + (void) ff3; +#endif + float discriminant = fb1 * fb1 + 4 * fb2; + + if (discriminant < 0) /* imaginary roots -- resonant filter */ + { + /* they're conjugates so we just check that the product + is less than one */ + if (fb2 >= -1.0f) goto stable; + } + else /* real roots */ + { + /* check that the parabola 1 - fb1 x - fb2 x^2 has a + vertex between -1 and 1, and that it's nonnegative + at both ends, which implies both roots are in [1-,1]. */ + if (fb1 <= 2.0f && fb1 >= -2.0f && + 1.0f - fb1 -fb2 >= 0 && 1.0f + fb1 - fb2 >= 0) + goto stable; + } + return 0; +stable: + return 1; +} + + + + + + +#endif diff --git a/apps/plugins/pdbox/PDa/extra/gcanvas.c b/apps/plugins/pdbox/PDa/extra/gcanvas.c index 9e3f934299..09c120632e 100644 --- a/apps/plugins/pdbox/PDa/extra/gcanvas.c +++ b/apps/plugins/pdbox/PDa/extra/gcanvas.c @@ -1,379 +1,452 @@ -/* (C) Guenter Geiger */ - - -#include "m_pd.h" -#include "g_canvas.h" - -/* ------------------------ gcanvas ----------------------------- */ - - -#define BACKGROUNDCOLOR "grey" - -#define DEFAULTSIZE 80 - -static t_class *gcanvas_class; - -typedef struct _gcanvas -{ - t_object x_obj; - t_glist * x_glist; - t_outlet* out2; - t_outlet* out3; - int x_width; - int x_height; - int x; - int y; - int x_xgrid; - int x_ygrid; -} t_gcanvas; - - -static void rectangle(void* cv,void* o,char c,int x, int y,int w,int h,char* color) { - sys_vgui(".x%x.c create rectangle \ - %d %d %d %d -tags %x%c -fill %s\n",cv,x,y,x+w,y+h,o,c,color); -} - -static void move_object(void* cv,void* o,char c,int x, int y,int w,int h) { - sys_vgui(".x%x.c coords %x%c %d %d %d %d\n", - cv,o,c,x,y,x+w,y+h); - -} - -static void color_object(void* cv,void* o,char c,char* color) { - sys_vgui(".x%x.c itemconfigure %x%c -fill %s\n", cv, - o, c,color); -} - -static void delete_object(void* cv,void* o,char c) { - sys_vgui(".x%x.c delete %x%c\n", - cv, o,c); -} - -static void line(void* cv,void* o,char c,int x,int y,int w,int h,char* color) { - sys_vgui(".x%x.c create line \ - %d %d %d %d -tags %x%c -fill %s\n",cv,x,y,x+w,y+h,o,c,color); -} - - -/* widget helper functions */ - -void gcanvas_drawme(t_gcanvas *x, t_glist *glist, int firsttime) -{ - int i; - if (firsttime) { - rectangle(glist_getcanvas(glist),x,'a', - x->x_obj.te_xpix, x->x_obj.te_ypix, - x->x_width, x->x_height,BACKGROUNDCOLOR); - for (i=1;ix_xgrid;i++) - line(glist_getcanvas(glist),x,'b'+ i, - x->x_obj.te_xpix + x->x_width*i/x->x_xgrid, - x->x_obj.te_ypix, - 0, x->x_height,"red"); - for (i=1;ix_ygrid;i++) - line(glist_getcanvas(glist),x,'B'+ i, - x->x_obj.te_xpix, - x->x_obj.te_ypix + x->x_height*i/x->x_ygrid, - x->x_width, 0,"blue"); - } - else { - move_object( - glist_getcanvas(glist),x,'a', - x->x_obj.te_xpix, x->x_obj.te_ypix, - x->x_width, x->x_height); - for (i=1;ix_xgrid;i++) - move_object(glist_getcanvas(glist),x,'b'+ i, - x->x_obj.te_xpix + x->x_width*i/x->x_xgrid, - x->x_obj.te_ypix, - 0, x->x_height); - for (i=1;ix_ygrid;i++) - move_object(glist_getcanvas(glist),x,'B'+ i, - x->x_obj.te_xpix, - x->x_obj.te_ypix + x->x_height*i/x->x_ygrid, - x->x_width, 0); - } - - { - /* outlets */ - int n = 3; - int nplus, i; - nplus = (n == 1 ? 1 : n-1); - for (i = 0; i < n; i++) - { - int onset = x->x_obj.te_xpix + (x->x_width - IOWIDTH) * i / nplus; - if (firsttime) - sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xo%d\n", - glist_getcanvas(glist), - onset, x->x_obj.te_ypix + x->x_height - 1, - onset + IOWIDTH, x->x_obj.te_ypix + x->x_height, - x, i); - else - sys_vgui(".x%x.c coords %xo%d %d %d %d %d\n", - glist_getcanvas(glist), x, i, - onset, x->x_obj.te_ypix + x->x_height - 1, - onset + IOWIDTH, x->x_obj.te_ypix + x->x_height); - } - /* inlets */ - n = 0; - nplus = (n == 1 ? 1 : n-1); - for (i = 0; i < n; i++) - { - int onset = x->x_obj.te_xpix + (x->x_width - IOWIDTH) * i / nplus; - if (firsttime) - sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xi%d\n", - glist_getcanvas(glist), - onset, x->x_obj.te_ypix, - onset + IOWIDTH, x->x_obj.te_ypix + 1, - x, i); - else - sys_vgui(".x%x.c coords %xi%d %d %d %d %d\n", - glist_getcanvas(glist), x, i, - onset, x->x_obj.te_ypix, - onset + IOWIDTH, x->x_obj.te_ypix + 1); - - } - } - -} - - - - -void gcanvas_erase(t_gcanvas* x,t_glist* glist) -{ - int n,i; - delete_object(glist_getcanvas(glist),x,'a'); - for (i=1;ix_xgrid;i++) - delete_object(glist_getcanvas(glist),x,'b'+ i); - for (i=1;ix_ygrid;i++) - delete_object(glist_getcanvas(glist),x,'B'+ i); - - n = 2; - while (n--) { - sys_vgui(".x%x.c delete %xo%d\n",glist_getcanvas(glist),x,n); - } -} - - - -/* ------------------------ gcanvas widgetbehaviour----------------------------- */ - - -static void gcanvas_getrect(t_gobj *z, t_glist *owner, - int *xp1, int *yp1, int *xp2, int *yp2) -{ - int width, height; - t_gcanvas* s = (t_gcanvas*)z; - - - width = s->x_width; - height = s->x_height; - *xp1 = s->x_obj.te_xpix; - *yp1 = s->x_obj.te_ypix; - *xp2 = s->x_obj.te_xpix + width; - *yp2 = s->x_obj.te_ypix + height; -} - -static void gcanvas_displace(t_gobj *z, t_glist *glist, - int dx, int dy) -{ - t_gcanvas *x = (t_gcanvas *)z; - x->x_obj.te_xpix += dx; - x->x_obj.te_ypix += dy; - gcanvas_drawme(x, glist, 0); - canvas_fixlinesfor(glist_getcanvas(glist),(t_text*) x); -} - -static void gcanvas_select(t_gobj *z, t_glist *glist, int state) -{ - t_gcanvas *x = (t_gcanvas *)z; - color_object(glist,x,'a',state ? "blue" : BACKGROUNDCOLOR); -} - - -static void gcanvas_activate(t_gobj *z, t_glist *glist, int state) -{ -/* t_text *x = (t_text *)z; - t_rtext *y = glist_findrtext(glist, x); - if (z->g_pd != gatom_class) rtext_activate(y, state);*/ -} - -static void gcanvas_delete(t_gobj *z, t_glist *glist) -{ - t_text *x = (t_text *)z; - canvas_deletelinesfor(glist_getcanvas(glist), x); -} - - -static void gcanvas_vis(t_gobj *z, t_glist *glist, int vis) -{ - t_gcanvas* s = (t_gcanvas*)z; - if (vis) - gcanvas_drawme(s, glist, 1); - else - gcanvas_erase(s,glist); -} - -/* can we use the normal text save function ?? */ - -static void gcanvas_save(t_gobj *z, t_binbuf *b) -{ - t_gcanvas *x = (t_gcanvas *)z; - binbuf_addv(b, "ssiisiiii", gensym("#X"),gensym("obj"), - (t_int)x->x_obj.te_xpix, (t_int)x->x_obj.te_ypix, - gensym("gcanvas"),x->x_width,x->x_height, - x->x_xgrid, - x->x_ygrid); - binbuf_addv(b, ";"); -} - - -t_widgetbehavior gcanvas_widgetbehavior; - -static void gcanvas_motion(t_gcanvas *x, t_floatarg dx, t_floatarg dy) -{ - x->x += dx; - x->y += dy; - outlet_float(x->out2,x->y); - outlet_float(x->x_obj.ob_outlet,x->x); -} - -void gcanvas_key(t_gcanvas *x, t_floatarg f) -{ - post("key"); -} - - -static void gcanvas_click(t_gcanvas *x, - t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl, - t_floatarg doit,int up) -{ - glist_grab(x->x_glist, &x->x_obj.te_g, (t_glistmotionfn) gcanvas_motion, - (t_glistkeyfn) NULL, xpos, ypos); - - x->x = xpos - x->x_obj.te_xpix; - x->y = ypos - x->x_obj.te_ypix; - outlet_float(x->out2,x->y); - outlet_float(x->x_obj.ob_outlet,x->x); - outlet_float(x->out3,0); -} - -static int gcanvas_newclick(t_gobj *z, struct _glist *glist, - int xpix, int ypix, int shift, int alt, int dbl, int doit) -{ - if (doit) - gcanvas_click((t_gcanvas *)z, (t_floatarg)xpix, (t_floatarg)ypix, - (t_floatarg)shift, 0, (t_floatarg)alt,dbl); - - if (dbl) outlet_float(((t_gcanvas*)z)->out3,1); - return (1); -} - -void gcanvas_size(t_gcanvas* x,t_floatarg w,t_floatarg h) { - x->x_width = w; - x->x_height = h; - gcanvas_drawme(x, x->x_glist, 0); -} - -static void gcanvas_setwidget(void) -{ - gcanvas_widgetbehavior.w_getrectfn = gcanvas_getrect; - gcanvas_widgetbehavior.w_displacefn = gcanvas_displace; - gcanvas_widgetbehavior.w_selectfn = gcanvas_select; - gcanvas_widgetbehavior.w_activatefn = gcanvas_activate; - gcanvas_widgetbehavior.w_deletefn = gcanvas_delete; - gcanvas_widgetbehavior.w_visfn = gcanvas_vis; - gcanvas_widgetbehavior.w_clickfn = gcanvas_newclick; - class_setsavefn(gcanvas_class,gcanvas_save); -} - - -static void *gcanvas_new(t_symbol* s,t_int ac,t_atom* at) -{ - t_gcanvas *x = (t_gcanvas *)pd_new(gcanvas_class); - - x->x_glist = (t_glist*) canvas_getcurrent(); - - - /* Fetch the width */ - - x->x_width = DEFAULTSIZE; - if (ac-- > 0) { - if (at->a_type != A_FLOAT) - error("gcanvas: wrong argument type"); - else - x->x_width = atom_getfloat(at++); - - if (x->x_width < 0 || x->x_width > 2000) { - error("gcanvas: unallowed width %f",x->x_width); - x->x_width = DEFAULTSIZE; - } - } - - /* Fetch the height */ - - x->x_height = DEFAULTSIZE; - if (ac-- > 0) { - if (at->a_type != A_FLOAT) - error("gcanvas: wrong argument type"); - else - x->x_height = atom_getfloat(at++); - - if (x->x_height < 0 || x->x_height > 2000) { - error("gcanvas: unallowed height %f",x->x_height); - x->x_width = DEFAULTSIZE; - } - } - - /* Fetch the xgrid */ - - x->x_xgrid = 0; - if (ac-- > 0) { - if (at->a_type != A_FLOAT) - error("gcanvas: wrong argument type"); - else - x->x_xgrid = atom_getfloat(at++); - - if (x->x_xgrid < 0 || x->x_xgrid > x->x_width/2) { - error("gcanvas: unallowed xgrid %f",x->x_xgrid); - x->x_xgrid = 0; - } - } - - /* Fetch the ygrid */ - - x->x_ygrid = 0; - if (ac-- > 0) { - if (at->a_type != A_FLOAT) - error("gcanvas: wrong argument type"); - else - x->x_ygrid = atom_getfloat(at++); - - if (x->x_ygrid < 0 || x->x_ygrid > x->x_height/2) { - error("gcanvas: unallowed xgrid %f",x->x_ygrid); - x->x_ygrid = 0; - } - } - - outlet_new(&x->x_obj, &s_float); - x->out2 = outlet_new(&x->x_obj, &s_float); - x->out3 = outlet_new(&x->x_obj, &s_float); - return (x); -} - - - -void gcanvas_setup(void) -{ - gcanvas_class = class_new(gensym("gcanvas"), (t_newmethod)gcanvas_new, 0, - sizeof(t_gcanvas),0, A_GIMME,0); - - class_addmethod(gcanvas_class, (t_method)gcanvas_click, gensym("click"), - A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); - class_addmethod(gcanvas_class, (t_method)gcanvas_size, gensym("size"), - A_FLOAT, A_FLOAT, 0); - - gcanvas_setwidget(); - class_setwidget(gcanvas_class,&gcanvas_widgetbehavior); -} - +/* (C) Guenter Geiger */ + + +#include "m_pd.h" +#include "g_canvas.h" + +/* ------------------------ gcanvas ----------------------------- */ + + +#define BACKGROUNDCOLOR "grey" + +#define DEFAULTSIZE 80 + +static t_class *gcanvas_class; + +typedef struct _gcanvas +{ + t_object x_obj; + t_glist * x_glist; + t_outlet* out2; + t_outlet* out3; + int x_width; + int x_height; + int x; + int y; + int x_xgrid; + int x_ygrid; +} t_gcanvas; + + +static void rectangle(void* cv,void* o,char c,int x, int y,int w,int h,char* color) { +#ifdef ROCKBOX + (void) cv; + (void) o; + (void) c; + (void) x; + (void) y; + (void) w; + (void) h; + (void) color; +#else /* ROCKBOX */ + sys_vgui(".x%x.c create rectangle \ + %d %d %d %d -tags %x%c -fill %s\n",cv,x,y,x+w,y+h,o,c,color); +#endif /* ROCKBOX */ +} + +static void move_object(void* cv,void* o,char c,int x, int y,int w,int h) { +#ifdef ROCKBOX + (void) cv; + (void) o; + (void) c; + (void) x; + (void) y; + (void) w; + (void) h; +#else /* ROCKBOX */ + sys_vgui(".x%x.c coords %x%c %d %d %d %d\n", + cv,o,c,x,y,x+w,y+h); +#endif /* ROCKBOX */ +} + +static void color_object(void* cv,void* o,char c,char* color) { +#ifdef ROCKBOX + (void) cv; + (void) o; + (void) c; + (void) color; +#else /* ROCKBOX */ + sys_vgui(".x%x.c itemconfigure %x%c -fill %s\n", cv, + o, c,color); +#endif /* ROCKBOX */ +} + +static void delete_object(void* cv,void* o,char c) { +#ifdef ROCKBOX + (void) cv; + (void) o; + (void) c; +#else /* ROCKBOX */ + sys_vgui(".x%x.c delete %x%c\n", + cv, o,c); +#endif /* ROCKBOX */ +} + +static void line(void* cv,void* o,char c,int x,int y,int w,int h,char* color) { +#ifdef ROCKBOX + (void) cv; + (void) o; + (void) c; + (void) x; + (void) y; + (void) w; + (void) h; + (void) color; +#else /* ROCKBOX */ + sys_vgui(".x%x.c create line \ + %d %d %d %d -tags %x%c -fill %s\n",cv,x,y,x+w,y+h,o,c,color); +#endif /* ROCKBOX */ +} + + +/* widget helper functions */ + +void gcanvas_drawme(t_gcanvas *x, t_glist *glist, int firsttime) +{ + int i; + if (firsttime) { + rectangle(glist_getcanvas(glist),x,'a', + x->x_obj.te_xpix, x->x_obj.te_ypix, + x->x_width, x->x_height,BACKGROUNDCOLOR); + for (i=1;ix_xgrid;i++) + line(glist_getcanvas(glist),x,'b'+ i, + x->x_obj.te_xpix + x->x_width*i/x->x_xgrid, + x->x_obj.te_ypix, + 0, x->x_height,"red"); + for (i=1;ix_ygrid;i++) + line(glist_getcanvas(glist),x,'B'+ i, + x->x_obj.te_xpix, + x->x_obj.te_ypix + x->x_height*i/x->x_ygrid, + x->x_width, 0,"blue"); + } + else { + move_object( + glist_getcanvas(glist),x,'a', + x->x_obj.te_xpix, x->x_obj.te_ypix, + x->x_width, x->x_height); + for (i=1;ix_xgrid;i++) + move_object(glist_getcanvas(glist),x,'b'+ i, + x->x_obj.te_xpix + x->x_width*i/x->x_xgrid, + x->x_obj.te_ypix, + 0, x->x_height); + for (i=1;ix_ygrid;i++) + move_object(glist_getcanvas(glist),x,'B'+ i, + x->x_obj.te_xpix, + x->x_obj.te_ypix + x->x_height*i/x->x_ygrid, + x->x_width, 0); + } + + { + /* outlets */ + int n = 3; + int nplus, i; + nplus = (n == 1 ? 1 : n-1); + for (i = 0; i < n; i++) + { +#ifndef ROCKBOX + int onset = x->x_obj.te_xpix + (x->x_width - IOWIDTH) * i / nplus; + if (firsttime) + sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xo%d\n", + glist_getcanvas(glist), + onset, x->x_obj.te_ypix + x->x_height - 1, + onset + IOWIDTH, x->x_obj.te_ypix + x->x_height, + x, i); + else + sys_vgui(".x%x.c coords %xo%d %d %d %d %d\n", + glist_getcanvas(glist), x, i, + onset, x->x_obj.te_ypix + x->x_height - 1, + onset + IOWIDTH, x->x_obj.te_ypix + x->x_height); +#endif /* ROCKBOX */ + } + /* inlets */ + n = 0; + nplus = (n == 1 ? 1 : n-1); + for (i = 0; i < n; i++) + { +#ifndef ROCKBOX + int onset = x->x_obj.te_xpix + (x->x_width - IOWIDTH) * i / nplus; + if (firsttime) + sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xi%d\n", + glist_getcanvas(glist), + onset, x->x_obj.te_ypix, + onset + IOWIDTH, x->x_obj.te_ypix + 1, + x, i); + else + sys_vgui(".x%x.c coords %xi%d %d %d %d %d\n", + glist_getcanvas(glist), x, i, + onset, x->x_obj.te_ypix, + onset + IOWIDTH, x->x_obj.te_ypix + 1); +#endif /* ROCKBOX */ + } + } + +} + + + + +void gcanvas_erase(t_gcanvas* x,t_glist* glist) +{ + int n,i; + delete_object(glist_getcanvas(glist),x,'a'); + for (i=1;ix_xgrid;i++) + delete_object(glist_getcanvas(glist),x,'b'+ i); + for (i=1;ix_ygrid;i++) + delete_object(glist_getcanvas(glist),x,'B'+ i); + + n = 2; + while (n--) { +#ifndef ROCKBOX + sys_vgui(".x%x.c delete %xo%d\n",glist_getcanvas(glist),x,n); +#endif + } +} + + + +/* ------------------------ gcanvas widgetbehaviour----------------------------- */ + + +static void gcanvas_getrect(t_gobj *z, t_glist *owner, + int *xp1, int *yp1, int *xp2, int *yp2) +{ +#ifdef ROCKBOX + (void) owner; +#endif + int width, height; + t_gcanvas* s = (t_gcanvas*)z; + + + width = s->x_width; + height = s->x_height; + *xp1 = s->x_obj.te_xpix; + *yp1 = s->x_obj.te_ypix; + *xp2 = s->x_obj.te_xpix + width; + *yp2 = s->x_obj.te_ypix + height; +} + +static void gcanvas_displace(t_gobj *z, t_glist *glist, + int dx, int dy) +{ + t_gcanvas *x = (t_gcanvas *)z; + x->x_obj.te_xpix += dx; + x->x_obj.te_ypix += dy; + gcanvas_drawme(x, glist, 0); + canvas_fixlinesfor(glist_getcanvas(glist),(t_text*) x); +} + +static void gcanvas_select(t_gobj *z, t_glist *glist, int state) +{ + t_gcanvas *x = (t_gcanvas *)z; + color_object(glist,x,'a',state ? "blue" : BACKGROUNDCOLOR); +} + + +static void gcanvas_activate(t_gobj *z, t_glist *glist, int state) +{ +#ifdef ROCKBOX + (void) z; + (void) glist; + (void) state; +#endif +/* t_text *x = (t_text *)z; + t_rtext *y = glist_findrtext(glist, x); + if (z->g_pd != gatom_class) rtext_activate(y, state);*/ +} + +static void gcanvas_delete(t_gobj *z, t_glist *glist) +{ + t_text *x = (t_text *)z; + canvas_deletelinesfor(glist_getcanvas(glist), x); +} + + +static void gcanvas_vis(t_gobj *z, t_glist *glist, int vis) +{ + t_gcanvas* s = (t_gcanvas*)z; + if (vis) + gcanvas_drawme(s, glist, 1); + else + gcanvas_erase(s,glist); +} + +/* can we use the normal text save function ?? */ + +static void gcanvas_save(t_gobj *z, t_binbuf *b) +{ + t_gcanvas *x = (t_gcanvas *)z; + binbuf_addv(b, "ssiisiiii", gensym("#X"),gensym("obj"), + (t_int)x->x_obj.te_xpix, (t_int)x->x_obj.te_ypix, + gensym("gcanvas"),x->x_width,x->x_height, + x->x_xgrid, + x->x_ygrid); + binbuf_addv(b, ";"); +} + + +t_widgetbehavior gcanvas_widgetbehavior; + +static void gcanvas_motion(t_gcanvas *x, t_floatarg dx, t_floatarg dy) +{ + x->x += dx; + x->y += dy; + outlet_float(x->out2,x->y); + outlet_float(x->x_obj.ob_outlet,x->x); +} + +void gcanvas_key(t_gcanvas *x, t_floatarg f) +{ +#ifdef ROCKBOX + (void) x; + (void) f; +#endif + post("key"); +} + + +static void gcanvas_click(t_gcanvas *x, + t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl, + t_floatarg doit,int up) +{ +#ifdef ROCKBOX + (void) shift; + (void) ctrl; + (void) doit; + (void) up; +#endif + glist_grab(x->x_glist, &x->x_obj.te_g, (t_glistmotionfn) gcanvas_motion, + (t_glistkeyfn) NULL, xpos, ypos); + + x->x = xpos - x->x_obj.te_xpix; + x->y = ypos - x->x_obj.te_ypix; + outlet_float(x->out2,x->y); + outlet_float(x->x_obj.ob_outlet,x->x); + outlet_float(x->out3,0); +} + +static int gcanvas_newclick(t_gobj *z, struct _glist *glist, + int xpix, int ypix, int shift, int alt, int dbl, int doit) +{ +#ifdef ROCKBOX + (void) glist; +#endif + if (doit) + gcanvas_click((t_gcanvas *)z, (t_floatarg)xpix, (t_floatarg)ypix, + (t_floatarg)shift, 0, (t_floatarg)alt,dbl); + + if (dbl) outlet_float(((t_gcanvas*)z)->out3,1); + return (1); +} + +void gcanvas_size(t_gcanvas* x,t_floatarg w,t_floatarg h) { + x->x_width = w; + x->x_height = h; + gcanvas_drawme(x, x->x_glist, 0); +} + +static void gcanvas_setwidget(void) +{ + gcanvas_widgetbehavior.w_getrectfn = gcanvas_getrect; + gcanvas_widgetbehavior.w_displacefn = gcanvas_displace; + gcanvas_widgetbehavior.w_selectfn = gcanvas_select; + gcanvas_widgetbehavior.w_activatefn = gcanvas_activate; + gcanvas_widgetbehavior.w_deletefn = gcanvas_delete; + gcanvas_widgetbehavior.w_visfn = gcanvas_vis; + gcanvas_widgetbehavior.w_clickfn = gcanvas_newclick; + class_setsavefn(gcanvas_class,gcanvas_save); +} + + +static void *gcanvas_new(t_symbol* s,t_int ac,t_atom* at) +{ +#ifdef ROCKBOX + (void) s; +#endif + t_gcanvas *x = (t_gcanvas *)pd_new(gcanvas_class); + + x->x_glist = (t_glist*) canvas_getcurrent(); + + + /* Fetch the width */ + + x->x_width = DEFAULTSIZE; + if (ac-- > 0) { + if (at->a_type != A_FLOAT) + error("gcanvas: wrong argument type"); + else + x->x_width = atom_getfloat(at++); + + if (x->x_width < 0 || x->x_width > 2000) { + error("gcanvas: unallowed width %f",x->x_width); + x->x_width = DEFAULTSIZE; + } + } + + /* Fetch the height */ + + x->x_height = DEFAULTSIZE; + if (ac-- > 0) { + if (at->a_type != A_FLOAT) + error("gcanvas: wrong argument type"); + else + x->x_height = atom_getfloat(at++); + + if (x->x_height < 0 || x->x_height > 2000) { + error("gcanvas: unallowed height %f",x->x_height); + x->x_width = DEFAULTSIZE; + } + } + + /* Fetch the xgrid */ + + x->x_xgrid = 0; + if (ac-- > 0) { + if (at->a_type != A_FLOAT) + error("gcanvas: wrong argument type"); + else + x->x_xgrid = atom_getfloat(at++); + + if (x->x_xgrid < 0 || x->x_xgrid > x->x_width/2) { + error("gcanvas: unallowed xgrid %f",x->x_xgrid); + x->x_xgrid = 0; + } + } + + /* Fetch the ygrid */ + + x->x_ygrid = 0; + if (ac-- > 0) { + if (at->a_type != A_FLOAT) + error("gcanvas: wrong argument type"); + else + x->x_ygrid = atom_getfloat(at++); + + if (x->x_ygrid < 0 || x->x_ygrid > x->x_height/2) { + error("gcanvas: unallowed xgrid %f",x->x_ygrid); + x->x_ygrid = 0; + } + } + + outlet_new(&x->x_obj, &s_float); + x->out2 = outlet_new(&x->x_obj, &s_float); + x->out3 = outlet_new(&x->x_obj, &s_float); + return (x); +} + + + +void gcanvas_setup(void) +{ + gcanvas_class = class_new(gensym("gcanvas"), (t_newmethod)gcanvas_new, 0, + sizeof(t_gcanvas),0, A_GIMME,0); + + class_addmethod(gcanvas_class, (t_method)gcanvas_click, gensym("click"), + A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); + class_addmethod(gcanvas_class, (t_method)gcanvas_size, gensym("size"), + A_FLOAT, A_FLOAT, 0); + + gcanvas_setwidget(); + class_setwidget(gcanvas_class,&gcanvas_widgetbehavior); +} + diff --git a/apps/plugins/pdbox/PDa/extra/highpass.c b/apps/plugins/pdbox/PDa/extra/highpass.c index f97ca233f3..05e8a06d59 100644 --- a/apps/plugins/pdbox/PDa/extra/highpass.c +++ b/apps/plugins/pdbox/PDa/extra/highpass.c @@ -1,85 +1,94 @@ -/* (C) Guenter Geiger */ - - -/* - - These filter coefficients computations are taken from - http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt - - written by Robert Bristow-Johnson - -*/ - -#include "m_pd.h" -#ifdef NT -#pragma warning( disable : 4244 ) -#pragma warning( disable : 4305 ) -#endif -#include -#include "filters.h" - - -/* ------------------- highpass ----------------------------*/ - -static t_class *highpass_class; - -void highpass_bang(t_rbjfilter *x) -{ - t_atom at[5]; - t_float omega = e_omega(x->x_freq,x->x_rate); - t_float alpha = e_alpha(x->x_bw* 0.01,omega); - t_float b1 = -(1 + cos(omega)); - t_float b0 = -b1/2.; - t_float b2 = b0; - t_float a0 = 1 + alpha; - t_float a1 = -2.*cos(omega); - t_float a2 = 1 - alpha; - -/* post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw); */ - - if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) { - post("highpass: filter unstable -> resetting"); - a0=1.;a1=0.;a2=0.; - b0=1.;b1=0.;b2=0.; - } - - SETFLOAT(at,-a1/a0); - SETFLOAT(at+1,-a2/a0); - SETFLOAT(at+2,b0/a0); - SETFLOAT(at+3,b1/a0); - SETFLOAT(at+4,b2/a0); - - outlet_list(x->x_obj.ob_outlet,&s_list,5,at); -} - - -void highpass_float(t_rbjfilter *x,t_floatarg f) -{ - x->x_freq = f; - highpass_bang(x); -} - - -static void *highpass_new(t_floatarg f,t_floatarg bw) -{ - t_rbjfilter *x = (t_rbjfilter *)pd_new(highpass_class); - - x->x_rate = 44100.0; - outlet_new(&x->x_obj,&s_float); -/* floatinlet_new(&x->x_obj, &x->x_gain); */ - floatinlet_new(&x->x_obj, &x->x_bw); - if (f > 0.) x->x_freq = f; - if (bw > 0.) x->x_bw = bw; - return (x); -} - - -void highpass_setup(void) -{ - highpass_class = class_new(gensym("highpass"), (t_newmethod)highpass_new, 0, - sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,0); - class_addbang(highpass_class,highpass_bang); - class_addfloat(highpass_class,highpass_float); -} - +/* (C) Guenter Geiger */ + + +/* + + These filter coefficients computations are taken from + http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt + + written by Robert Bristow-Johnson + +*/ + + +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#include "m_pd.h" +#include "math.h" +#include "filters.h" +#else /* ROCKBOX */ +#include "m_pd.h" +#ifdef NT +#pragma warning( disable : 4244 ) +#pragma warning( disable : 4305 ) +#endif +#include +#include "filters.h" +#endif /* ROCKBOX */ + + +/* ------------------- highpass ----------------------------*/ + +static t_class *highpass_class; + +void highpass_bang(t_rbjfilter *x) +{ + t_atom at[5]; + t_float omega = e_omega(x->x_freq,x->x_rate); + t_float alpha = e_alpha(x->x_bw* 0.01,omega); + t_float b1 = -(1 + cos(omega)); + t_float b0 = -b1/2.; + t_float b2 = b0; + t_float a0 = 1 + alpha; + t_float a1 = -2.*cos(omega); + t_float a2 = 1 - alpha; + +/* post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw); */ + + if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) { + post("highpass: filter unstable -> resetting"); + a0=1.;a1=0.;a2=0.; + b0=1.;b1=0.;b2=0.; + } + + SETFLOAT(at,-a1/a0); + SETFLOAT(at+1,-a2/a0); + SETFLOAT(at+2,b0/a0); + SETFLOAT(at+3,b1/a0); + SETFLOAT(at+4,b2/a0); + + outlet_list(x->x_obj.ob_outlet,&s_list,5,at); +} + + +void highpass_float(t_rbjfilter *x,t_floatarg f) +{ + x->x_freq = f; + highpass_bang(x); +} + + +static void *highpass_new(t_floatarg f,t_floatarg bw) +{ + t_rbjfilter *x = (t_rbjfilter *)pd_new(highpass_class); + + x->x_rate = 44100.0; + outlet_new(&x->x_obj,&s_float); +/* floatinlet_new(&x->x_obj, &x->x_gain); */ + floatinlet_new(&x->x_obj, &x->x_bw); + if (f > 0.) x->x_freq = f; + if (bw > 0.) x->x_bw = bw; + return (x); +} + + +void highpass_setup(void) +{ + highpass_class = class_new(gensym("highpass"), (t_newmethod)highpass_new, 0, + sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,0); + class_addbang(highpass_class,highpass_bang); + class_addfloat(highpass_class,highpass_float); +} + diff --git a/apps/plugins/pdbox/PDa/extra/highshelf.c b/apps/plugins/pdbox/PDa/extra/highshelf.c index 74db29178a..b058a2a2e6 100644 --- a/apps/plugins/pdbox/PDa/extra/highshelf.c +++ b/apps/plugins/pdbox/PDa/extra/highshelf.c @@ -1,90 +1,98 @@ -/* (C) Guenter Geiger */ - - -/* - - These filter coefficients computations are taken from - http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt - - written by Robert Bristow-Johnson - -*/ - -#include "m_pd.h" -#ifdef NT -#pragma warning( disable : 4244 ) -#pragma warning( disable : 4305 ) -#endif -#include -#include "filters.h" - - -/* ------------------- highshelf ----------------------------*/ - -static t_class *highshelf_class; - -void highshelf_bang(t_rbjfilter *x) -{ - t_atom at[5]; - t_float omega = e_omega(x->x_freq,x->x_rate); - t_float A = e_A(x->x_gain); - t_float cs = cos(omega); - t_float sn = sin(omega); - t_float beta = e_beta(A,x->x_bw* 0.01); - - t_float b0 = A*((A+1) + (A-1)*cs + beta*sn); - t_float b1 =-2.*A*((A-1) + (A+1)*cs); - t_float b2 = A*((A+1) + (A-1)*cs - beta*sn); - t_float a0 = ((A+1) - (A-1)*cs + beta*sn); - t_float a1 = 2.*((A-1) - (A+1)*cs); - t_float a2 = ((A+1) - (A-1)*cs - beta*sn); - -/* post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw);*/ - - if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) { - post("highshelf: filter unstable -> resetting"); - a0=1.;a1=0.;a2=0.; - b0=1.;b1=0.;b2=0.; - } - - SETFLOAT(at,-a1/a0); - SETFLOAT(at+1,-a2/a0); - SETFLOAT(at+2,b0/a0); - SETFLOAT(at+3,b1/a0); - SETFLOAT(at+4,b2/a0); - - outlet_list(x->x_obj.ob_outlet,&s_list,5,at); -} - - -void highshelf_float(t_rbjfilter *x,t_floatarg f) -{ - x->x_freq = f; - highshelf_bang(x); -} - - -static void *highshelf_new(t_floatarg f,t_floatarg g,t_floatarg bw) -{ - t_rbjfilter *x = (t_rbjfilter *)pd_new(highshelf_class); - - x->x_rate = 44100.0; - outlet_new(&x->x_obj,&s_float); - floatinlet_new(&x->x_obj, &x->x_gain); - floatinlet_new(&x->x_obj, &x->x_bw); - if (f > 0.) x->x_freq = f; - if (bw > 0.) x->x_bw = bw; - if (g != 0.) x->x_gain = g; - return (x); -} - - -void highshelf_setup(void) -{ - highshelf_class = class_new(gensym("highshelf"), (t_newmethod)highshelf_new, 0, - sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0); - class_addbang(highshelf_class,highshelf_bang); - class_addfloat(highshelf_class,highshelf_float); -} - +/* (C) Guenter Geiger */ + + +/* + + These filter coefficients computations are taken from + http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt + + written by Robert Bristow-Johnson + +*/ + +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#include "m_pd.h" +#include "math.h" +#include "filters.h" +#else /* ROCKBOX */ +#include "m_pd.h" +#ifdef NT +#pragma warning( disable : 4244 ) +#pragma warning( disable : 4305 ) +#endif +#include +#include "filters.h" +#endif /* ROCKBOX */ + + +/* ------------------- highshelf ----------------------------*/ + +static t_class *highshelf_class; + +void highshelf_bang(t_rbjfilter *x) +{ + t_atom at[5]; + t_float omega = e_omega(x->x_freq,x->x_rate); + t_float A = e_A(x->x_gain); + t_float cs = cos(omega); + t_float sn = sin(omega); + t_float beta = e_beta(A,x->x_bw* 0.01); + + t_float b0 = A*((A+1) + (A-1)*cs + beta*sn); + t_float b1 =-2.*A*((A-1) + (A+1)*cs); + t_float b2 = A*((A+1) + (A-1)*cs - beta*sn); + t_float a0 = ((A+1) - (A-1)*cs + beta*sn); + t_float a1 = 2.*((A-1) - (A+1)*cs); + t_float a2 = ((A+1) - (A-1)*cs - beta*sn); + +/* post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw);*/ + + if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) { + post("highshelf: filter unstable -> resetting"); + a0=1.;a1=0.;a2=0.; + b0=1.;b1=0.;b2=0.; + } + + SETFLOAT(at,-a1/a0); + SETFLOAT(at+1,-a2/a0); + SETFLOAT(at+2,b0/a0); + SETFLOAT(at+3,b1/a0); + SETFLOAT(at+4,b2/a0); + + outlet_list(x->x_obj.ob_outlet,&s_list,5,at); +} + + +void highshelf_float(t_rbjfilter *x,t_floatarg f) +{ + x->x_freq = f; + highshelf_bang(x); +} + + +static void *highshelf_new(t_floatarg f,t_floatarg g,t_floatarg bw) +{ + t_rbjfilter *x = (t_rbjfilter *)pd_new(highshelf_class); + + x->x_rate = 44100.0; + outlet_new(&x->x_obj,&s_float); + floatinlet_new(&x->x_obj, &x->x_gain); + floatinlet_new(&x->x_obj, &x->x_bw); + if (f > 0.) x->x_freq = f; + if (bw > 0.) x->x_bw = bw; + if (g != 0.) x->x_gain = g; + return (x); +} + + +void highshelf_setup(void) +{ + highshelf_class = class_new(gensym("highshelf"), (t_newmethod)highshelf_new, 0, + sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0); + class_addbang(highshelf_class,highshelf_bang); + class_addfloat(highshelf_class,highshelf_float); +} + diff --git a/apps/plugins/pdbox/PDa/extra/hlshelf.c b/apps/plugins/pdbox/PDa/extra/hlshelf.c index 242a2e625f..49f413f9ca 100644 --- a/apps/plugins/pdbox/PDa/extra/hlshelf.c +++ b/apps/plugins/pdbox/PDa/extra/hlshelf.c @@ -1,226 +1,242 @@ -/* (C) Guenter Geiger */ - - -#include -#include - -#ifdef NT -#pragma warning( disable : 4244 ) -#pragma warning( disable : 4305 ) -#endif - -/* ------------------------ hlshelf ----------------------------- */ - - -#ifndef M_PI -#define M_PI 3.141593f -#endif - -#define SRATE 44100.0 -#define MAX_GAIN 120.0f - -static t_class *hlshelf_class; - - -typedef struct _hlshelf -{ - t_object x_obj; - float s_rate; - float s_gain0; - float s_gain1; - float s_gain2; - float s_ltransfq; - float s_htransfq; - float s_lradians; - float s_hradians; -} t_hlshelf; - - -int hlshelf_check_stability(t_float fb1, - t_float fb2, - t_float ff1, - t_float ff2, - t_float ff3) -{ - float discriminant = fb1 * fb1 + 4 * fb2; - - if (discriminant < 0) /* imaginary roots -- resonant filter */ - { - /* they're conjugates so we just check that the product - is less than one */ - if (fb2 >= -1.0f) goto stable; - } - else /* real roots */ - { - /* check that the parabola 1 - fb1 x - fb2 x^2 has a - vertex between -1 and 1, and that it's nonnegative - at both ends, which implies both roots are in [1-,1]. */ - if (fb1 <= 2.0f && fb1 >= -2.0f && - 1.0f - fb1 -fb2 >= 0 && 1.0f + fb1 - fb2 >= 0) - goto stable; - } - return 0; -stable: - return 1; -} - - -void hlshelf_check(t_hlshelf *x) -{ - - if(x->s_gain0 - x->s_gain1 > MAX_GAIN) { - x->s_gain0 = x->s_gain1 + MAX_GAIN; - post("setting gain0 to %f",x->s_gain0); - } - - - if(x->s_gain1 > MAX_GAIN) { - x->s_gain1 = MAX_GAIN; - post("setting gain1 to %f",x->s_gain1); - } - - if(x->s_gain2 - x->s_gain1 > MAX_GAIN) { - x->s_gain2 = x->s_gain1 + MAX_GAIN; - post("setting gain2 to %f",x->s_gain2); - } - - /* constrain: 0 <= x->s_ltransfq < x->s_htransfq. */ - x->s_ltransfq = (x->s_ltransfq < x->s_htransfq) ? x->s_ltransfq : x->s_htransfq - 0.5f; - - if (x->s_ltransfq < 0) x->s_ltransfq = 0.0f; - - x->s_lradians = M_PI * x->s_ltransfq / x->s_rate; - x->s_hradians= M_PI * (0.5f - (x->s_htransfq / x->s_rate)); - -} - - -void hlshelf_bang(t_hlshelf *x) -{ - t_atom at[6]; - float c0, c1, c2, d0, d1, d2; /* output coefs */ - float a1, a2, b1, b2, g1, g2; /* temp coefs */ - double xf; - - hlshelf_check(x); - - /* low shelf */ - xf = 0.5 * 0.115129255 * (double)(x->s_gain0 - x->s_gain1); /* ln(10) / 20 = 0.115129255 */ - if(xf < -200.) /* exp(x) -> 0 */ - { - a1 = 1.0f; - b1 = -1.0f; - g1 = 0.0f; - } - else - { - double t = tan(x->s_lradians); - double e = exp(xf); - double r = t / e; - double kr = t * e; - - a1 = (r - 1) / (r + 1); - b1 = (kr - 1) / (kr + 1); - g1 = (kr + 1) / (r + 1); - } - - /* high shelf */ - xf = 0.5 * 0.115129255 * (double)(x->s_gain2 - x->s_gain1); /* ln(10) / 20 = 0.115129255 */ - if(xf < -200.) /* exp(x) -> 0 */ - { - a2 = -1.0f; - b2 = 1.0f; - g2 = 0.0f; - } - else - { - double t = tan(x->s_hradians); - double e = exp(xf); - double r = t / e; - double kr = t * e; - - a2 = (1 - r) / (1 + r); - b2 = (1 - kr) / (1 + kr); - g2 = (1 + kr) / (1 + r); - } - - /* form product */ - c0 = g1 * g2 * (float)(exp((double)(x->s_gain1) * 0.05f * 2.302585093f)); ; - c1 = a1 + a2; - c2 = a1 * a2; - d0 = 1.0f; - d1 = b1 + b2; - d2 = b1 * b2; - - if (!hlshelf_check_stability(-c1/d0,-c2/d0,d0/d0,d1/d0,d2/d0)) { - post("hlshelf: filter unstable -> resetting"); - c0=1.;c1=0.;c2=0.; - d0=1.;d1=0.;d2=0.; - } - - SETFLOAT(at,-c1/d0); - SETFLOAT(at+1,-c2/d0); - SETFLOAT(at+2,d0/d0); - SETFLOAT(at+3,d1/d0); - SETFLOAT(at+4,d2/d0); - - outlet_list(x->x_obj.ob_outlet,&s_list,5,at); -} - -void hlshelf_float(t_hlshelf *x,t_floatarg f) -{ - x->s_gain0 = f; - hlshelf_bang(x); -} - - -static void *hlshelf_new(t_symbol* s,t_int argc, t_atom* at) -{ - t_hlshelf *x = (t_hlshelf *)pd_new(hlshelf_class); - t_float k0 = atom_getfloat(at); - t_float k1 = atom_getfloat(at+1); - t_float k2 = atom_getfloat(at+2); - t_float f1 = atom_getfloat(at+3); - t_float f2 = atom_getfloat(at+4); - - - f1 = atom_getfloat(at); - f2 = atom_getfloat(at); - - if ((f1 == 0.0f && f2 == 0.0f) || f1 > f2){ /* all gains = 0db */ - f1 = 150.0f; - f2 = 5000.0f; - } - - if (f1 < 0) f1 = 0.0f; - if (f2 > SRATE) f2 = .5f*SRATE; - - x->s_rate = SRATE; /* srate default */ - x->s_gain0 = k0; - x->s_gain1 = k1; - x->s_gain2 = k2; - - x->s_ltransfq = 0.0f; - x->s_htransfq = SRATE/2; - - x->s_lradians = M_PI * x->s_ltransfq / x->s_rate; - x->s_hradians= M_PI * (0.5f - (x->s_htransfq / x->s_rate)); - - floatinlet_new(&x->x_obj, &x->s_gain1); - floatinlet_new(&x->x_obj, &x->s_gain2); - floatinlet_new(&x->x_obj, &x->s_ltransfq); - floatinlet_new(&x->x_obj, &x->s_htransfq); - outlet_new(&x->x_obj, &s_list); - - return (x); -} - -void hlshelf_setup(void) -{ - hlshelf_class = class_new(gensym("hlshelf"), (t_newmethod)hlshelf_new, 0, - sizeof(t_hlshelf), 0, A_GIMME, 0); - class_addbang(hlshelf_class,hlshelf_bang); - class_addfloat(hlshelf_class,hlshelf_float); -} - +/* (C) Guenter Geiger */ + + +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#include "m_pd.h" +#include "math.h" +#else /* ROCKBOX */ +#include +#include + +#ifdef NT +#pragma warning( disable : 4244 ) +#pragma warning( disable : 4305 ) +#endif +#endif /* ROCKBOX */ + +/* ------------------------ hlshelf ----------------------------- */ + + +#ifndef M_PI +#define M_PI 3.141593f +#endif + +#define SRATE 44100.0 +#define MAX_GAIN 120.0f + +static t_class *hlshelf_class; + + +typedef struct _hlshelf +{ + t_object x_obj; + float s_rate; + float s_gain0; + float s_gain1; + float s_gain2; + float s_ltransfq; + float s_htransfq; + float s_lradians; + float s_hradians; +} t_hlshelf; + + +int hlshelf_check_stability(t_float fb1, + t_float fb2, + t_float ff1, + t_float ff2, + t_float ff3) +{ +#ifdef ROCKBOX + (void) ff1; + (void) ff2; + (void) ff3; +#endif + float discriminant = fb1 * fb1 + 4 * fb2; + + if (discriminant < 0) /* imaginary roots -- resonant filter */ + { + /* they're conjugates so we just check that the product + is less than one */ + if (fb2 >= -1.0f) goto stable; + } + else /* real roots */ + { + /* check that the parabola 1 - fb1 x - fb2 x^2 has a + vertex between -1 and 1, and that it's nonnegative + at both ends, which implies both roots are in [1-,1]. */ + if (fb1 <= 2.0f && fb1 >= -2.0f && + 1.0f - fb1 -fb2 >= 0 && 1.0f + fb1 - fb2 >= 0) + goto stable; + } + return 0; +stable: + return 1; +} + + +void hlshelf_check(t_hlshelf *x) +{ + + if(x->s_gain0 - x->s_gain1 > MAX_GAIN) { + x->s_gain0 = x->s_gain1 + MAX_GAIN; + post("setting gain0 to %f",x->s_gain0); + } + + + if(x->s_gain1 > MAX_GAIN) { + x->s_gain1 = MAX_GAIN; + post("setting gain1 to %f",x->s_gain1); + } + + if(x->s_gain2 - x->s_gain1 > MAX_GAIN) { + x->s_gain2 = x->s_gain1 + MAX_GAIN; + post("setting gain2 to %f",x->s_gain2); + } + + /* constrain: 0 <= x->s_ltransfq < x->s_htransfq. */ + x->s_ltransfq = (x->s_ltransfq < x->s_htransfq) ? x->s_ltransfq : x->s_htransfq - 0.5f; + + if (x->s_ltransfq < 0) x->s_ltransfq = 0.0f; + + x->s_lradians = M_PI * x->s_ltransfq / x->s_rate; + x->s_hradians= M_PI * (0.5f - (x->s_htransfq / x->s_rate)); + +} + + +void hlshelf_bang(t_hlshelf *x) +{ + t_atom at[6]; + float c0, c1, c2, d0, d1, d2; /* output coefs */ + float a1, a2, b1, b2, g1, g2; /* temp coefs */ + double xf; + + hlshelf_check(x); + + /* low shelf */ + xf = 0.5 * 0.115129255 * (double)(x->s_gain0 - x->s_gain1); /* ln(10) / 20 = 0.115129255 */ + if(xf < -200.) /* exp(x) -> 0 */ + { + a1 = 1.0f; + b1 = -1.0f; + g1 = 0.0f; + } + else + { + double t = tan(x->s_lradians); + double e = exp(xf); + double r = t / e; + double kr = t * e; + + a1 = (r - 1) / (r + 1); + b1 = (kr - 1) / (kr + 1); + g1 = (kr + 1) / (r + 1); + } + + /* high shelf */ + xf = 0.5 * 0.115129255 * (double)(x->s_gain2 - x->s_gain1); /* ln(10) / 20 = 0.115129255 */ + if(xf < -200.) /* exp(x) -> 0 */ + { + a2 = -1.0f; + b2 = 1.0f; + g2 = 0.0f; + } + else + { + double t = tan(x->s_hradians); + double e = exp(xf); + double r = t / e; + double kr = t * e; + + a2 = (1 - r) / (1 + r); + b2 = (1 - kr) / (1 + kr); + g2 = (1 + kr) / (1 + r); + } + + /* form product */ + c0 = g1 * g2 * (float)(exp((double)(x->s_gain1) * 0.05f * 2.302585093f)); ; + c1 = a1 + a2; + c2 = a1 * a2; + d0 = 1.0f; + d1 = b1 + b2; + d2 = b1 * b2; + + if (!hlshelf_check_stability(-c1/d0,-c2/d0,d0/d0,d1/d0,d2/d0)) { + post("hlshelf: filter unstable -> resetting"); + c0=1.;c1=0.;c2=0.; + d0=1.;d1=0.;d2=0.; + } + + SETFLOAT(at,-c1/d0); + SETFLOAT(at+1,-c2/d0); + SETFLOAT(at+2,d0/d0); + SETFLOAT(at+3,d1/d0); + SETFLOAT(at+4,d2/d0); + + outlet_list(x->x_obj.ob_outlet,&s_list,5,at); +} + +void hlshelf_float(t_hlshelf *x,t_floatarg f) +{ + x->s_gain0 = f; + hlshelf_bang(x); +} + + +static void *hlshelf_new(t_symbol* s,t_int argc, t_atom* at) +{ +#ifdef ROCKBOX + (void) s; + (void) argc; +#endif + t_hlshelf *x = (t_hlshelf *)pd_new(hlshelf_class); + t_float k0 = atom_getfloat(at); + t_float k1 = atom_getfloat(at+1); + t_float k2 = atom_getfloat(at+2); + t_float f1 = atom_getfloat(at+3); + t_float f2 = atom_getfloat(at+4); + + + f1 = atom_getfloat(at); + f2 = atom_getfloat(at); + + if ((f1 == 0.0f && f2 == 0.0f) || f1 > f2){ /* all gains = 0db */ + f1 = 150.0f; + f2 = 5000.0f; + } + + if (f1 < 0) f1 = 0.0f; + if (f2 > SRATE) f2 = .5f*SRATE; + + x->s_rate = SRATE; /* srate default */ + x->s_gain0 = k0; + x->s_gain1 = k1; + x->s_gain2 = k2; + + x->s_ltransfq = 0.0f; + x->s_htransfq = SRATE/2; + + x->s_lradians = M_PI * x->s_ltransfq / x->s_rate; + x->s_hradians= M_PI * (0.5f - (x->s_htransfq / x->s_rate)); + + floatinlet_new(&x->x_obj, &x->s_gain1); + floatinlet_new(&x->x_obj, &x->s_gain2); + floatinlet_new(&x->x_obj, &x->s_ltransfq); + floatinlet_new(&x->x_obj, &x->s_htransfq); + outlet_new(&x->x_obj, &s_list); + + return (x); +} + +void hlshelf_setup(void) +{ + hlshelf_class = class_new(gensym("hlshelf"), (t_newmethod)hlshelf_new, 0, + sizeof(t_hlshelf), 0, A_GIMME, 0); + class_addbang(hlshelf_class,hlshelf_bang); + class_addfloat(hlshelf_class,hlshelf_float); +} + diff --git a/apps/plugins/pdbox/PDa/extra/image.c b/apps/plugins/pdbox/PDa/extra/image.c index 946a363986..7f55a01a87 100644 --- a/apps/plugins/pdbox/PDa/extra/image.c +++ b/apps/plugins/pdbox/PDa/extra/image.c @@ -23,6 +23,11 @@ typedef struct _image void image_drawme(t_image *x, t_glist *glist, int firsttime) { +#ifdef ROCKBOX + (void) x; + (void) glist; + (void) firsttime; +#else /* ROCKBOX */ if (firsttime) { char fname[MAXPDSTRING]; canvas_makefilename(glist_getcanvas(x->x_glist), x->x_fname->s_name, @@ -42,16 +47,20 @@ void image_drawme(t_image *x, t_glist *glist, int firsttime) glist_getcanvas(glist), x, text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist)); } - +#endif /* ROCKBOX */ } void image_erase(t_image* x,t_glist* glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ int n; sys_vgui(".x%x.c delete %xS\n", glist_getcanvas(glist), x); - +#endif /* ROCKBOX */ } @@ -80,17 +89,23 @@ static void image_displace(t_gobj *z, t_glist *glist, t_image *x = (t_image *)z; x->x_obj.te_xpix += dx; x->x_obj.te_ypix += dy; +#ifndef ROCKBOX sys_vgui(".x%x.c coords %xSEL %d %d %d %d\n", glist_getcanvas(glist), x, text_xpix(&x->x_obj, glist), text_ypix(&x->x_obj, glist), text_xpix(&x->x_obj, glist) + x->x_width, text_ypix(&x->x_obj, glist) + x->x_height); - +#endif image_drawme(x, glist, 0); canvas_fixlinesfor(glist_getcanvas(glist),(t_text*) x); } static void image_select(t_gobj *z, t_glist *glist, int state) { +#ifdef ROCKBOX + (void) z; + (void) glist; + (void) state; +#else /* ROCKBOX */ t_image *x = (t_image *)z; if (state) { sys_vgui(".x%x.c create rectangle \ @@ -104,14 +119,17 @@ static void image_select(t_gobj *z, t_glist *glist, int state) sys_vgui(".x%x.c delete %xSEL\n", glist_getcanvas(glist), x); } - - - +#endif /* ROCKBOX */ } static void image_activate(t_gobj *z, t_glist *glist, int state) { +#ifdef ROCKBOX + (void) z; + (void) glist; + (void) state; +#endif /* t_text *x = (t_text *)z; t_rtext *y = glist_findrtext(glist, x); if (z->g_pd != gatom_class) rtext_activate(y, state);*/ @@ -154,6 +172,10 @@ void image_size(t_image* x,t_floatarg w,t_floatarg h) { void image_color(t_image* x,t_symbol* col) { +#ifdef ROCKBOX + (void) x; + (void) col; +#endif /* outlet_bang(x->x_obj.ob_outlet); only bang if there was a bang .. so color black does the same as bang, but doesn't forward the bang */ @@ -167,11 +189,11 @@ static void image_setwidget(void) image_widgetbehavior.w_activatefn = image_activate; image_widgetbehavior.w_deletefn = image_delete; image_widgetbehavior.w_visfn = image_vis; -#if (PD_VERSION_MINOR > 31) +#if defined(PD_VERSION_MINOR) && (PD_VERSION_MINOR > 31) image_widgetbehavior.w_clickfn = NULL; image_widgetbehavior.w_propertiesfn = NULL; #endif -#if PD_MINOR_VERSION < 37 +#if defined(PD_VERSION_MINOR) && PD_MINOR_VERSION < 37 image_widgetbehavior.w_savefn = image_save; #endif } diff --git a/apps/plugins/pdbox/PDa/extra/lowpass.c b/apps/plugins/pdbox/PDa/extra/lowpass.c index 251b7175f3..18de4afe8b 100644 --- a/apps/plugins/pdbox/PDa/extra/lowpass.c +++ b/apps/plugins/pdbox/PDa/extra/lowpass.c @@ -1,87 +1,94 @@ -/* (C) Guenter Geiger */ - - -/* - - These filter coefficients computations are taken from - http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt - - written by Robert Bristow-Johnson - -*/ - -#include "m_pd.h" -#ifdef NT -#pragma warning( disable : 4244 ) -#pragma warning( disable : 4305 ) -#endif -#include -#include "filters.h" - - - -/* ------------------- lowpass ----------------------------*/ - -static t_class *lowpass_class; - -void lowpass_bang(t_rbjfilter *x) -{ - t_atom at[5]; - t_float omega = e_omega(x->x_freq,x->x_rate); - t_float alpha = e_alpha(x->x_bw*0.01,omega); - t_float b1 = 1 - cos(omega); - t_float b0 = b1/2.; - t_float b2 = b0; - t_float a0 = 1 + alpha; - t_float a1 = -2.*cos(omega); - t_float a2 = 1 - alpha; - -/* post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw); */ - - if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) { - post("lowpass: filter unstable -> resetting"); - a0=1.;a1=0.;a2=0.; - b0=1.;b1=0.;b2=0.; - } - - SETFLOAT(at,-a1/a0); - SETFLOAT(at+1,-a2/a0); - SETFLOAT(at+2,b0/a0); - SETFLOAT(at+3,b1/a0); - SETFLOAT(at+4,b2/a0); - - outlet_list(x->x_obj.ob_outlet,&s_list,5,at); -} - - -void lowpass_float(t_rbjfilter *x,t_floatarg f) -{ - x->x_freq = f; - lowpass_bang(x); -} - - -static void *lowpass_new(t_floatarg f,t_floatarg bw) -{ - t_rbjfilter *x = (t_rbjfilter *)pd_new(lowpass_class); - - x->x_rate = 44100.0; - outlet_new(&x->x_obj,&s_float); -/* floatinlet_new(&x->x_obj, &x->x_gain); */ - floatinlet_new(&x->x_obj, &x->x_bw); - - if (f > 0.) x->x_freq = f; - if (bw > 0.) x->x_bw = bw; - return (x); -} - - -void lowpass_setup(void) -{ - lowpass_class = class_new(gensym("lowpass"), (t_newmethod)lowpass_new, 0, - sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,0); - class_addbang(lowpass_class,lowpass_bang); - class_addfloat(lowpass_class,lowpass_float); -} - +/* (C) Guenter Geiger */ + + +/* + + These filter coefficients computations are taken from + http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt + + written by Robert Bristow-Johnson + +*/ + +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#include "m_pd.h" +#include "math.h" +#include "filters.h" +#else /* ROCKBOX */ +#include "m_pd.h" +#ifdef NT +#pragma warning( disable : 4244 ) +#pragma warning( disable : 4305 ) +#endif +#include +#include "filters.h" +#endif /* ROCKBOX */ + + +/* ------------------- lowpass ----------------------------*/ + +static t_class *lowpass_class; + +void lowpass_bang(t_rbjfilter *x) +{ + t_atom at[5]; + t_float omega = e_omega(x->x_freq,x->x_rate); + t_float alpha = e_alpha(x->x_bw*0.01,omega); + t_float b1 = 1 - cos(omega); + t_float b0 = b1/2.; + t_float b2 = b0; + t_float a0 = 1 + alpha; + t_float a1 = -2.*cos(omega); + t_float a2 = 1 - alpha; + +/* post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw); */ + + if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) { + post("lowpass: filter unstable -> resetting"); + a0=1.;a1=0.;a2=0.; + b0=1.;b1=0.;b2=0.; + } + + SETFLOAT(at,-a1/a0); + SETFLOAT(at+1,-a2/a0); + SETFLOAT(at+2,b0/a0); + SETFLOAT(at+3,b1/a0); + SETFLOAT(at+4,b2/a0); + + outlet_list(x->x_obj.ob_outlet,&s_list,5,at); +} + + +void lowpass_float(t_rbjfilter *x,t_floatarg f) +{ + x->x_freq = f; + lowpass_bang(x); +} + + +static void *lowpass_new(t_floatarg f,t_floatarg bw) +{ + t_rbjfilter *x = (t_rbjfilter *)pd_new(lowpass_class); + + x->x_rate = 44100.0; + outlet_new(&x->x_obj,&s_float); +/* floatinlet_new(&x->x_obj, &x->x_gain); */ + floatinlet_new(&x->x_obj, &x->x_bw); + + if (f > 0.) x->x_freq = f; + if (bw > 0.) x->x_bw = bw; + return (x); +} + + +void lowpass_setup(void) +{ + lowpass_class = class_new(gensym("lowpass"), (t_newmethod)lowpass_new, 0, + sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,0); + class_addbang(lowpass_class,lowpass_bang); + class_addfloat(lowpass_class,lowpass_float); +} + diff --git a/apps/plugins/pdbox/PDa/extra/lowshelf.c b/apps/plugins/pdbox/PDa/extra/lowshelf.c index ba32b6dba8..77086badb7 100644 --- a/apps/plugins/pdbox/PDa/extra/lowshelf.c +++ b/apps/plugins/pdbox/PDa/extra/lowshelf.c @@ -1,91 +1,98 @@ -/* (C) Guenter Geiger */ - - -/* - - These filter coefficients computations are taken from - http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt - - written by Robert Bristow-Johnson - -*/ - -#include "m_pd.h" -#ifdef NT -#pragma warning( disable : 4244 ) -#pragma warning( disable : 4305 ) -#endif -#include -#include "filters.h" - - - -/* ------------------- lowshelf ----------------------------*/ - -static t_class *lowshelf_class; - -void lowshelf_bang(t_rbjfilter *x) -{ - t_atom at[5]; - t_float omega = e_omega(x->x_freq,x->x_rate); - t_float A = e_A(x->x_gain); - t_float cs = cos(omega); - t_float sn = sin(omega); - t_float beta = e_beta(A,x->x_bw*0.01); - - t_float b0 = A*((A+1) - (A-1)*cs + beta*sn); - t_float b1 = 2.*A*((A-1) - (A+1)*cs); - t_float b2 = A*((A+1) - (A-1)*cs - beta*sn); - t_float a0 = ((A+1) + (A-1)*cs + beta*sn); - t_float a1 = -2.*((A-1) + (A+1)*cs); - t_float a2 = ((A+1) + (A-1)*cs - beta*sn); - -/* post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw); */ - - if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) { - post("lowshelf: filter unstable -> resetting"); - a0=1.;a1=0.;a2=0.; - b0=1.;b1=0.;b2=0.; - } - - SETFLOAT(at,-a1/a0); - SETFLOAT(at+1,-a2/a0); - SETFLOAT(at+2,b0/a0); - SETFLOAT(at+3,b1/a0); - SETFLOAT(at+4,b2/a0); - - outlet_list(x->x_obj.ob_outlet,&s_list,5,at); -} - - -void lowshelf_float(t_rbjfilter *x,t_floatarg f) -{ - x->x_freq = f; - lowshelf_bang(x); -} - - -static void *lowshelf_new(t_floatarg f,t_floatarg g,t_floatarg bw) -{ - t_rbjfilter *x = (t_rbjfilter *)pd_new(lowshelf_class); - - x->x_rate = 44100.0; - outlet_new(&x->x_obj,&s_float); - floatinlet_new(&x->x_obj, &x->x_gain); - floatinlet_new(&x->x_obj, &x->x_bw); - if (f > 0.) x->x_freq = f; - if (bw > 0.) x->x_bw = bw; - if (g != 0.) x->x_gain = g; - return (x); -} - - -void lowshelf_setup(void) -{ - lowshelf_class = class_new(gensym("lowshelf"), (t_newmethod)lowshelf_new, 0, - sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0); - class_addbang(lowshelf_class,lowshelf_bang); - class_addfloat(lowshelf_class,lowshelf_float); -} - +/* (C) Guenter Geiger */ + + +/* + + These filter coefficients computations are taken from + http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt + + written by Robert Bristow-Johnson + +*/ + +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#include "m_pd.h" +#include "math.h" +#include "filters.h" +#else /* ROCKBOX */ +#include "m_pd.h" +#ifdef NT +#pragma warning( disable : 4244 ) +#pragma warning( disable : 4305 ) +#endif +#include +#include "filters.h" +#endif /* ROCKBOX */ + + +/* ------------------- lowshelf ----------------------------*/ + +static t_class *lowshelf_class; + +void lowshelf_bang(t_rbjfilter *x) +{ + t_atom at[5]; + t_float omega = e_omega(x->x_freq,x->x_rate); + t_float A = e_A(x->x_gain); + t_float cs = cos(omega); + t_float sn = sin(omega); + t_float beta = e_beta(A,x->x_bw*0.01); + + t_float b0 = A*((A+1) - (A-1)*cs + beta*sn); + t_float b1 = 2.*A*((A-1) - (A+1)*cs); + t_float b2 = A*((A+1) - (A-1)*cs - beta*sn); + t_float a0 = ((A+1) + (A-1)*cs + beta*sn); + t_float a1 = -2.*((A-1) + (A+1)*cs); + t_float a2 = ((A+1) + (A-1)*cs - beta*sn); + +/* post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw); */ + + if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) { + post("lowshelf: filter unstable -> resetting"); + a0=1.;a1=0.;a2=0.; + b0=1.;b1=0.;b2=0.; + } + + SETFLOAT(at,-a1/a0); + SETFLOAT(at+1,-a2/a0); + SETFLOAT(at+2,b0/a0); + SETFLOAT(at+3,b1/a0); + SETFLOAT(at+4,b2/a0); + + outlet_list(x->x_obj.ob_outlet,&s_list,5,at); +} + + +void lowshelf_float(t_rbjfilter *x,t_floatarg f) +{ + x->x_freq = f; + lowshelf_bang(x); +} + + +static void *lowshelf_new(t_floatarg f,t_floatarg g,t_floatarg bw) +{ + t_rbjfilter *x = (t_rbjfilter *)pd_new(lowshelf_class); + + x->x_rate = 44100.0; + outlet_new(&x->x_obj,&s_float); + floatinlet_new(&x->x_obj, &x->x_gain); + floatinlet_new(&x->x_obj, &x->x_bw); + if (f > 0.) x->x_freq = f; + if (bw > 0.) x->x_bw = bw; + if (g != 0.) x->x_gain = g; + return (x); +} + + +void lowshelf_setup(void) +{ + lowshelf_class = class_new(gensym("lowshelf"), (t_newmethod)lowshelf_new, 0, + sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0); + class_addbang(lowshelf_class,lowshelf_bang); + class_addfloat(lowshelf_class,lowshelf_float); +} + diff --git a/apps/plugins/pdbox/PDa/extra/moog~.c b/apps/plugins/pdbox/PDa/extra/moog~.c index 48d4dfe932..29525db2ef 100644 --- a/apps/plugins/pdbox/PDa/extra/moog~.c +++ b/apps/plugins/pdbox/PDa/extra/moog~.c @@ -1,184 +1,194 @@ -/* (C) Guenter Geiger */ - - -#include "math.h" -#include - -/* ----------------------------- moog ----------------------------- */ -static t_class *moog_class; - - -typedef struct _moog -{ - t_object x_obj; - t_pd in2; - t_sample x_1,x_2,x_3,x_4; - t_sample y_1,y_2,y_3,y_4; -} t_moog; - -static void moog_reset(t_moog *x) -{ - x->x_1 = x->x_2 = x->x_3 = x->x_4 = 0; - x->y_1 = x->y_2 = x->y_3 = x->y_4 = 0; - -} - - - -static void *moog_new(t_symbol *s, int argc, t_atom *argv) -{ - if (argc > 1) post("moog~: extra arguments ignored"); - { - t_moog *x = (t_moog *)pd_new(moog_class); - outlet_new(&x->x_obj, &s_signal); - inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); - inlet_new(&x->x_obj, &x->in2, &s_signal, &s_signal); - moog_reset(x); - return (x); - } - - -} - - - -static t_sample calc_k(t_sample f,t_sample k) { - if (k>itofix(4)) k = itofix(4); - if (k < 0) k = 0; - if (f <= itofix(3800)) return k; - k = k - mult(0.5,(f-idiv(itofix(3800),itofix(4300)))); - return k; -} - -t_int *moog_perform(t_int *w) -{ - t_moog* x = (t_moog*) (w[1]); - t_sample *in1 = (t_sample *)(w[2]); - t_sample *p = (t_sample *)(w[3]); - t_sample *k = (t_sample *)(w[4]); - - t_sample *out = (t_sample *)(w[5]); - int n = (int)(w[6]); - t_sample in; - t_sample pt,pt1; - - t_sample x1 = x->x_1; - t_sample x2 = x->x_2; - t_sample x3 = x->x_3; - t_sample x4 = x->x_4; - t_sample ys1 = x->y_1; - t_sample ys2 = x->y_2; - t_sample ys3 = x->y_3; - t_sample ys4 = x->y_4; - - - while (n--) { - if (*p > itofix(8140)) *p = itofix(8140); - *k = calc_k(*p,*k); - pt =*p; - pt1=mult((pt+1),ftofix(0.76923077)); - in = *in1++ - mult(*k,ys4); - ys1 = mult(pt1,in) + mult(0.3,x1) - mult(pt,ys1); - x1 = in; - ys2 = mult(pt1,ys1) + mult(0.3,x2) - mult(pt,ys2); - x2 = ys1; - ys3 = mult(pt1,ys2) + mult(0.3,x3) - mult(pt,ys3); - x3 = ys2; - ys4 = mult(pt1,ys3) + mult(0.3,x4) - mult(pt,ys4); - x4 = ys3; - *out++ = ys4; - } - - - x->y_1 = ys1; - x->y_2 = ys2; - x->y_3 = ys3; - x->y_4 = ys4; - x->x_1 = x1; - x->x_2 = x2; - x->x_3 = x3; - x->x_4 = x4; - - return (w+7); -} - - -#define CLIP(x) x = ((x) > 1.0 ? (1.0) : (x)) - -t_int *moog_perf8(t_int *w) -{ - t_moog* x = (t_moog*) (w[1]); - t_sample *in1 = (t_sample *)(w[2]); - t_sample *p = (t_sample *)(w[3]); - t_sample *k = (t_sample *)(w[4]); - t_sample *out = (t_sample *)(w[5]); - int n = (int)(w[6]); - - t_sample x1 = x->x_1; - t_sample x2 = x->x_2; - t_sample x3 = x->x_3; - t_sample x4 = x->x_4; - t_sample ys1 = x->y_1; - t_sample ys2 = x->y_2; - t_sample ys3 = x->y_3; - t_sample ys4 = x->y_4; - - t_sample temp,temp2; - t_sample pt,pt1; - t_sample in; - - while (n--) { - if (*p > itofix(8140)) *p = itofix(8140); - *k = calc_k(*p,*k); - - pt =mult(*p, ftofix(0.01*0.0140845)) - ftofix(0.9999999f); - pt1=mult((pt+itofix(1)),ftofix(0.76923077)); - in = *in1++ - mult(*k,ys4); - ys1 = mult(pt1,(in + mult(ftofix(0.3),x1))) - mult(pt,ys1); - x1 = in; - ys2 = mult(pt1,(ys1 + mult(0.3,x2))) - mult(pt,ys2); - x2 = ys1; - ys3 = mult(pt1,(ys2 + mult(0.3,x3))) - mult(pt,ys3); - x3 = ys2; - ys4 = mult(pt1,(ys3 + mult(0.3,x4))) - mult(pt,ys4); - x4 = ys3; - *out++ = ys4; - - p++;k++; - } - - x->y_1 = ys1; - x->y_2 = ys2; - x->y_3 = ys3; - x->y_4 = ys4; - x->x_1 = x1; - x->x_2 = x2; - x->x_3 = x3; - x->x_4 = x4; - - return (w+7); -} - -void dsp_add_moog(t_moog *x, t_sample *in1, t_sample *in2, t_sample *in3, t_sample *out, int n) -{ - if (n&7) - dsp_add(moog_perform, 6,(t_int)x, in1,in2,in3, out, n); - else - dsp_add(moog_perf8, 6,(t_int) x, in1, in2, in3, out, n); -} - -static void moog_dsp(t_moog *x, t_signal **sp) -{ - dsp_add_moog(x,sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec,sp[0]->s_n); -} - - -void moog_tilde_setup(void) -{ - moog_class = class_new(gensym("moog~"), (t_newmethod)moog_new, 0, - sizeof(t_moog), 0, A_GIMME, 0); - class_addmethod(moog_class, nullfn, gensym("signal"), 0); - class_addmethod(moog_class, (t_method)moog_reset, gensym("reset"), 0); - class_addmethod(moog_class, (t_method)moog_dsp, gensym("dsp"), A_NULL); -} +/* (C) Guenter Geiger */ + + +#include "math.h" +#ifdef ROCKBOX +#include "m_pd.h" +#else +#include +#endif + +/* ----------------------------- moog ----------------------------- */ +static t_class *moog_class; + + +typedef struct _moog +{ + t_object x_obj; + t_pd in2; + t_sample x_1,x_2,x_3,x_4; + t_sample y_1,y_2,y_3,y_4; +} t_moog; + +static void moog_reset(t_moog *x) +{ + x->x_1 = x->x_2 = x->x_3 = x->x_4 = 0; + x->y_1 = x->y_2 = x->y_3 = x->y_4 = 0; + +} + + + +static void *moog_new(t_symbol *s, int argc, t_atom *argv) +{ +#ifdef ROCKBOX + (void) s; + (void) argv; +#endif + if (argc > 1) post("moog~: extra arguments ignored"); + { + t_moog *x = (t_moog *)pd_new(moog_class); + outlet_new(&x->x_obj, &s_signal); + inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); + inlet_new(&x->x_obj, &x->in2, &s_signal, &s_signal); + moog_reset(x); + return (x); + } + + +} + + + +static t_sample calc_k(t_sample f,t_sample k) { + if (k>itofix(4)) k = itofix(4); + if (k < 0) k = 0; + if (f <= itofix(3800)) return k; + k = k - mult(0.5,(f-idiv(itofix(3800),itofix(4300)))); + return k; +} + +t_int *moog_perform(t_int *w) +{ + t_moog* x = (t_moog*) (w[1]); + t_sample *in1 = (t_sample *)(w[2]); + t_sample *p = (t_sample *)(w[3]); + t_sample *k = (t_sample *)(w[4]); + + t_sample *out = (t_sample *)(w[5]); + int n = (int)(w[6]); + t_sample in; + t_sample pt,pt1; + + t_sample x1 = x->x_1; + t_sample x2 = x->x_2; + t_sample x3 = x->x_3; + t_sample x4 = x->x_4; + t_sample ys1 = x->y_1; + t_sample ys2 = x->y_2; + t_sample ys3 = x->y_3; + t_sample ys4 = x->y_4; + + + while (n--) { + if (*p > itofix(8140)) *p = itofix(8140); + *k = calc_k(*p,*k); + pt =*p; + pt1=mult((pt+1),ftofix(0.76923077)); + in = *in1++ - mult(*k,ys4); + ys1 = mult(pt1,in) + mult(0.3,x1) - mult(pt,ys1); + x1 = in; + ys2 = mult(pt1,ys1) + mult(0.3,x2) - mult(pt,ys2); + x2 = ys1; + ys3 = mult(pt1,ys2) + mult(0.3,x3) - mult(pt,ys3); + x3 = ys2; + ys4 = mult(pt1,ys3) + mult(0.3,x4) - mult(pt,ys4); + x4 = ys3; + *out++ = ys4; + } + + + x->y_1 = ys1; + x->y_2 = ys2; + x->y_3 = ys3; + x->y_4 = ys4; + x->x_1 = x1; + x->x_2 = x2; + x->x_3 = x3; + x->x_4 = x4; + + return (w+7); +} + + +#define CLIP(x) x = ((x) > 1.0 ? (1.0) : (x)) + +t_int *moog_perf8(t_int *w) +{ + t_moog* x = (t_moog*) (w[1]); + t_sample *in1 = (t_sample *)(w[2]); + t_sample *p = (t_sample *)(w[3]); + t_sample *k = (t_sample *)(w[4]); + t_sample *out = (t_sample *)(w[5]); + int n = (int)(w[6]); + + t_sample x1 = x->x_1; + t_sample x2 = x->x_2; + t_sample x3 = x->x_3; + t_sample x4 = x->x_4; + t_sample ys1 = x->y_1; + t_sample ys2 = x->y_2; + t_sample ys3 = x->y_3; + t_sample ys4 = x->y_4; + +#ifndef ROCKBOX + t_sample temp,temp2; +#endif + t_sample pt,pt1; + t_sample in; + + while (n--) { + if (*p > itofix(8140)) *p = itofix(8140); + *k = calc_k(*p,*k); + + pt =mult(*p, ftofix(0.01*0.0140845)) - ftofix(0.9999999f); + pt1=mult((pt+itofix(1)),ftofix(0.76923077)); + in = *in1++ - mult(*k,ys4); + ys1 = mult(pt1,(in + mult(ftofix(0.3),x1))) - mult(pt,ys1); + x1 = in; + ys2 = mult(pt1,(ys1 + mult(0.3,x2))) - mult(pt,ys2); + x2 = ys1; + ys3 = mult(pt1,(ys2 + mult(0.3,x3))) - mult(pt,ys3); + x3 = ys2; + ys4 = mult(pt1,(ys3 + mult(0.3,x4))) - mult(pt,ys4); + x4 = ys3; + *out++ = ys4; + + p++;k++; + } + + x->y_1 = ys1; + x->y_2 = ys2; + x->y_3 = ys3; + x->y_4 = ys4; + x->x_1 = x1; + x->x_2 = x2; + x->x_3 = x3; + x->x_4 = x4; + + return (w+7); +} + +void dsp_add_moog(t_moog *x, t_sample *in1, t_sample *in2, t_sample *in3, t_sample *out, int n) +{ + if (n&7) + dsp_add(moog_perform, 6,(t_int)x, in1,in2,in3, out, n); + else + dsp_add(moog_perf8, 6,(t_int) x, in1, in2, in3, out, n); +} + +static void moog_dsp(t_moog *x, t_signal **sp) +{ + dsp_add_moog(x,sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec,sp[0]->s_n); +} + + +void moog_tilde_setup(void) +{ + moog_class = class_new(gensym("moog~"), (t_newmethod)moog_new, 0, + sizeof(t_moog), 0, A_GIMME, 0); + class_addmethod(moog_class, nullfn, gensym("signal"), 0); + class_addmethod(moog_class, (t_method)moog_reset, gensym("reset"), 0); + class_addmethod(moog_class, (t_method)moog_dsp, gensym("dsp"), A_NULL); +} diff --git a/apps/plugins/pdbox/PDa/extra/notch.c b/apps/plugins/pdbox/PDa/extra/notch.c index 0ab4332166..44f029988c 100644 --- a/apps/plugins/pdbox/PDa/extra/notch.c +++ b/apps/plugins/pdbox/PDa/extra/notch.c @@ -1,85 +1,93 @@ -/* (C) Guenter Geiger */ - - -/* - - These filter coefficients computations are taken from - http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt - - written by Robert Bristow-Johnson - -*/ - -#include "m_pd.h" -#ifdef NT -#pragma warning( disable : 4244 ) -#pragma warning( disable : 4305 ) -#endif -#include -#include "filters.h" - - - -/* ------------------- notch ----------------------------*/ - -static t_class *notch_class; - -void notch_bang(t_rbjfilter *x) -{ - t_atom at[5]; - t_float omega = e_omega(x->x_freq,x->x_rate); - t_float alpha = e_alpha(x->x_bw* 0.01,omega); - t_float b1 = -2.*cos(omega); - t_float b0 = 1; - t_float b2 = b0; - t_float a0 = 1 + alpha; - t_float a1 = -2.*cos(omega); - t_float a2 = 1 - alpha; - -/* post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw); */ - - if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) { - post("notch: filter unstable -> resetting"); - a0=1.;a1=0.;a2=0.; - b0=1.;b1=0.;b2=0.; - } - - SETFLOAT(at,-a1/a0); - SETFLOAT(at+1,-a2/a0); - SETFLOAT(at+2,b0/a0); - SETFLOAT(at+3,b1/a0); - SETFLOAT(at+4,b2/a0); - - outlet_list(x->x_obj.ob_outlet,&s_list,5,at); -} - - -void notch_float(t_rbjfilter *x,t_floatarg f) -{ - x->x_freq = f; - notch_bang(x); -} - - -static void *notch_new(t_floatarg f,t_floatarg bw) -{ - t_rbjfilter *x = (t_rbjfilter *)pd_new(notch_class); - - x->x_rate = 44100.0; - outlet_new(&x->x_obj,&s_float); -/* floatinlet_new(&x->x_obj, &x->x_gain); */ - floatinlet_new(&x->x_obj, &x->x_bw); - if (f > 0.) x->x_freq = f; - if (bw > 0.) x->x_bw = bw; - return (x); -} - - -void notch_setup(void) -{ - notch_class = class_new(gensym("notch"), (t_newmethod)notch_new, 0, - sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,0); - class_addbang(notch_class,notch_bang); - class_addfloat(notch_class,notch_float); -} +/* (C) Guenter Geiger */ + + +/* + + These filter coefficients computations are taken from + http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt + + written by Robert Bristow-Johnson + +*/ + +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#include "m_pd.h" +#include "math.h" +#include "filters.h" +#else /* ROCKBOX */ +#include "m_pd.h" +#ifdef NT +#pragma warning( disable : 4244 ) +#pragma warning( disable : 4305 ) +#endif +#include +#include "filters.h" +#endif /* ROCKBOX */ + + + +/* ------------------- notch ----------------------------*/ + +static t_class *notch_class; + +void notch_bang(t_rbjfilter *x) +{ + t_atom at[5]; + t_float omega = e_omega(x->x_freq,x->x_rate); + t_float alpha = e_alpha(x->x_bw* 0.01,omega); + t_float b1 = -2.*cos(omega); + t_float b0 = 1; + t_float b2 = b0; + t_float a0 = 1 + alpha; + t_float a1 = -2.*cos(omega); + t_float a2 = 1 - alpha; + +/* post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw); */ + + if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) { + post("notch: filter unstable -> resetting"); + a0=1.;a1=0.;a2=0.; + b0=1.;b1=0.;b2=0.; + } + + SETFLOAT(at,-a1/a0); + SETFLOAT(at+1,-a2/a0); + SETFLOAT(at+2,b0/a0); + SETFLOAT(at+3,b1/a0); + SETFLOAT(at+4,b2/a0); + + outlet_list(x->x_obj.ob_outlet,&s_list,5,at); +} + + +void notch_float(t_rbjfilter *x,t_floatarg f) +{ + x->x_freq = f; + notch_bang(x); +} + + +static void *notch_new(t_floatarg f,t_floatarg bw) +{ + t_rbjfilter *x = (t_rbjfilter *)pd_new(notch_class); + + x->x_rate = 44100.0; + outlet_new(&x->x_obj,&s_float); +/* floatinlet_new(&x->x_obj, &x->x_gain); */ + floatinlet_new(&x->x_obj, &x->x_bw); + if (f > 0.) x->x_freq = f; + if (bw > 0.) x->x_bw = bw; + return (x); +} + + +void notch_setup(void) +{ + notch_class = class_new(gensym("notch"), (t_newmethod)notch_new, 0, + sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,0); + class_addbang(notch_class,notch_bang); + class_addfloat(notch_class,notch_float); +} diff --git a/apps/plugins/pdbox/PDa/extra/sendOSC.c b/apps/plugins/pdbox/PDa/extra/sendOSC.c index bc983cc31e..ac7ae37954 100644 --- a/apps/plugins/pdbox/PDa/extra/sendOSC.c +++ b/apps/plugins/pdbox/PDa/extra/sendOSC.c @@ -1,1461 +1,1461 @@ -/* -Written by Matt Wright, The Center for New Music and Audio Technologies, -University of California, Berkeley. Copyright (c) 1996,97,98,99,2000,01,02,03 -The Regents of the University of California (Regents). - -Permission to use, copy, modify, distribute, and distribute modified versions -of this software and its documentation without fee and without a signed -licensing agreement, is hereby granted, provided that the above copyright -notice, this paragraph and the following two paragraphs appear in all copies, -modifications, and distributions. - -IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, -SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING -OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS -BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED -HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE -MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - - -The OSC webpage is http://cnmat.cnmat.berkeley.edu/OpenSoundControl -*/ - - -/* sendOSC.c - - Matt Wright, 6/3/97 - based on sendOSC.c, which was based on a version by Adrian Freed - - Text-based OpenSoundControl client. User can enter messages via command - line arguments or standard input. - - Version 0.1: "play" feature - Version 0.2: Message type tags. - - pd version branched from http://www.cnmat.berkeley.edu/OpenSoundControl/src/sendOSC/sendOSC.c - ------------- - -- added bundle stuff to send. jdl 20020416 - -- tweaks for Win32 www.zeggz.com/raf 13-April-2002 - -- ost_at_test.at + i22_at_test.at, 2000-2002 - modified to compile as pd externel -*/ - -#define MAX_ARGS 2000 -#define SC_BUFFER_SIZE 64000 - -#include "m_pd.h" -#include "OSC-client.h" - -#include -#include -#include -#include -#include -#include - -#ifdef WIN32 -#include -#include -#include -#include -#include -#include -#include -#else -#include -#include -#include -#include -#include -#include -#include -#include -#endif - -#ifdef __APPLE__ - #include -#endif - -#define UNIXDG_PATH "/tmp/htm" -#define UNIXDG_TMP "/tmp/htm.XXXXXX" - - - -OSCTimeTag OSCTT_Immediately(void) { - OSCTimeTag result; - result.seconds = 0; - result.fraction = 1; - return result; -} - - -OSCTimeTag OSCTT_CurrentTime(void) { - OSCTimeTag result; - result.seconds = 0; - result.fraction = 1; - return result; -} - -OSCTimeTag OSCTT_PlusSeconds(OSCTimeTag original, float secondsOffset) { - OSCTimeTag result; - result.seconds = 0; - result.fraction = 1; - return result; -} - - -typedef int bool; - -typedef struct -{ - float srate; - - struct sockaddr_in serv_addr; /* udp socket */ - #ifndef WIN32 - struct sockaddr_un userv_addr; /* UNIX socket */ - #endif - int sockfd; /* socket file descriptor */ - int index, len,uservlen; - void *addr; - int id; -} desc; - - -/* open a socket for HTM communication to given host on given portnumber */ -/* if host is 0 then UNIX protocol is used (i.e. local communication */ -void *OpenHTMSocket(char *host, int portnumber) -{ - struct sockaddr_in cl_addr; - #ifndef WIN32 - int sockfd; - struct sockaddr_un ucl_addr; - #else - unsigned int sockfd; - #endif - - desc *o; - int oval = 1; - o = malloc(sizeof(*o)); - if(!o) return 0; - - #ifndef WIN32 - - if(!host) - { - char *mktemp(char *); - int clilen; - o->len = sizeof(ucl_addr); - /* - * Fill in the structure "userv_addr" with the address of the - * server that we want to send to. - */ - - bzero((char *) &o->userv_addr, sizeof(o->userv_addr)); - o->userv_addr.sun_family = AF_UNIX; - strcpy(o->userv_addr.sun_path, UNIXDG_PATH); - sprintf(o->userv_addr.sun_path+strlen(o->userv_addr.sun_path), "%d", portnumber); - o->uservlen = sizeof(o->userv_addr.sun_family) + strlen(o->userv_addr.sun_path); - o->addr = &(o->userv_addr); - /* - * Open a socket (a UNIX domain datagram socket). - */ - - if ( (sockfd = socket(AF_UNIX, SOCK_DGRAM, 0)) >= 0) - { - /* - * Bind a local address for us. - * In the UNIX domain we have to choose our own name (that - * should be unique). We'll use mktemp() to create a unique - * pathname, based on our process id. - */ - - bzero((char *) &ucl_addr, sizeof(ucl_addr)); /* zero out */ - ucl_addr.sun_family = AF_UNIX; - strcpy(ucl_addr.sun_path, UNIXDG_TMP); - - mktemp(ucl_addr.sun_path); - clilen = sizeof(ucl_addr.sun_family) + strlen(ucl_addr.sun_path); - - if (bind(sockfd, (struct sockaddr *) &ucl_addr, clilen) < 0) - { - perror("client: can't bind local address"); - close(sockfd); - sockfd = -1; - } - } - else - perror("unable to make socket\n"); - - }else - - #endif - - { - /* - * Fill in the structure "serv_addr" with the address of the - * server that we want to send to. - */ - o->len = sizeof(cl_addr); - - #ifdef WIN32 - ZeroMemory((char *)&o->serv_addr, sizeof(o->serv_addr)); - #else - bzero((char *)&o->serv_addr, sizeof(o->serv_addr)); - #endif - - o->serv_addr.sin_family = AF_INET; - - /* MW 6/6/96: Call gethostbyname() instead of inet_addr(), - so that host can be either an Internet host name (e.g., - "les") or an Internet address in standard dot notation - (e.g., "128.32.122.13") */ - { - struct hostent *hostsEntry; - unsigned long address; - - hostsEntry = gethostbyname(host); - if (hostsEntry == NULL) { - fprintf(stderr, "Couldn't decipher host name \"%s\"\n", host); - #ifndef WIN32 - herror(NULL); - #endif - return 0; - } - address = *((unsigned long *) hostsEntry->h_addr_list[0]); - o->serv_addr.sin_addr.s_addr = address; - } - - /* was: o->serv_addr.sin_addr.s_addr = inet_addr(host); */ - - /* End MW changes */ - - /* - * Open a socket (a UDP domain datagram socket). - */ - - - #ifdef WIN32 - o->serv_addr.sin_port = htons((USHORT)portnumber); - o->addr = &(o->serv_addr); - if((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) != INVALID_SOCKET) { - ZeroMemory((char *)&cl_addr, sizeof(cl_addr)); - cl_addr.sin_family = AF_INET; - cl_addr.sin_addr.s_addr = htonl(INADDR_ANY); - cl_addr.sin_port = htons(0); - - // enable broadcast: jdl ~2003 - if(setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &oval, sizeof(int)) == -1) { - perror("setsockopt"); - } - - if(bind(sockfd, (struct sockaddr *) &cl_addr, sizeof(cl_addr)) < 0) { - perror("could not bind\n"); - closesocket(sockfd); - sockfd = -1; - } - } - else { perror("unable to make socket\n");} - #else - o->serv_addr.sin_port = htons(portnumber); - o->addr = &(o->serv_addr); - if((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) >= 0) { - bzero((char *)&cl_addr, sizeof(cl_addr)); - cl_addr.sin_family = AF_INET; - cl_addr.sin_addr.s_addr = htonl(INADDR_ANY); - cl_addr.sin_port = htons(0); - - // enable broadcast: jdl ~2003 - if(setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &oval, sizeof(int)) == -1) { - perror("setsockopt"); - } - - if(bind(sockfd, (struct sockaddr *) &cl_addr, sizeof(cl_addr)) < 0) { - perror("could not bind\n"); - close(sockfd); - sockfd = -1; - } - } - else { perror("unable to make socket\n");} - #endif - } - #ifdef WIN32 - if(sockfd == INVALID_SOCKET) { - #else - if(sockfd < 0) { - #endif - free(o); - o = 0; - } - else - o->sockfd = sockfd; - return o; -} - -static bool sendudp(const struct sockaddr *sp, int sockfd,int length, int count, void *b) -{ - int rcount; - if((rcount=sendto(sockfd, b, count, 0, sp, length)) != count) - { - printf("sockfd %d count %d rcount %dlength %d\n", sockfd,count,rcount,length); - return FALSE; - } - return TRUE; -} - -bool SendHTMSocket(void *htmsendhandle, int length_in_bytes, void *buffer) -{ - desc *o = (desc *)htmsendhandle; - return sendudp(o->addr, o->sockfd, o->len, length_in_bytes, buffer); -} -void CloseHTMSocket(void *htmsendhandle) -{ - desc *o = (desc *)htmsendhandle; - #ifdef WIN32 - if(SOCKET_ERROR == closesocket(o->sockfd)) { - perror("CloseHTMSocket::closesocket failed\n"); - return; - } - #else - if(close(o->sockfd) == -1) - { - perror("CloseHTMSocket::closesocket failed"); - return; - } - #endif - - free(o); -} - - -/////////////////////// -// from sendOSC - -typedef struct { - //enum {INT, FLOAT, STRING} type; - enum {INT_osc, FLOAT_osc, STRING_osc} type; - union { - int i; - float f; - char *s; - } datum; -} typedArg; - -void CommandLineMode(int argc, char *argv[], void *htmsocket); -OSCTimeTag ParseTimeTag(char *s); -void ParseInteractiveLine(OSCbuf *buf, char *mesg); -typedArg ParseToken(char *token); -int WriteMessage(OSCbuf *buf, char *messageName, int numArgs, typedArg *args); -void SendBuffer(void *htmsocket, OSCbuf *buf); -void SendData(void *htmsocket, int size, char *data); -/* defined in OSC-system-dependent.c now */ - -//static void *htmsocket; -static int exitStatus = 0; -static int useTypeTags = 0; - -static char bufferForOSCbuf[SC_BUFFER_SIZE]; - - -///////// -// end from sendOSC - -static t_class *sendOSC_class; - -typedef struct _sendOSC -{ - t_object x_obj; - int x_protocol; // UDP/TCP (udp only atm) - t_int x_typetags; // typetag flag - void *x_htmsocket; // sending socket - int x_bundle; // bundle open flag - OSCbuf x_oscbuf[1]; // OSCbuffer - t_outlet *x_bdpthout;// bundle-depth floatoutlet -} t_sendOSC; - -static void *sendOSC_new(t_floatarg udpflag) -{ - t_sendOSC *x = (t_sendOSC *)pd_new(sendOSC_class); - outlet_new(&x->x_obj, &s_float); - x->x_htmsocket = 0; // {{raf}} - // set udp - x->x_protocol = SOCK_STREAM; - // set typetags to 1 by default - x->x_typetags = 1; - // bunlde is closed - x->x_bundle = 0; - OSC_initBuffer(x->x_oscbuf, SC_BUFFER_SIZE, bufferForOSCbuf); - x->x_bdpthout = outlet_new(&x->x_obj, 0); // outlet_float(); - //x->x_oscbuf = - return (x); -} - - -void sendOSC_openbundle(t_sendOSC *x) -{ - if (x->x_oscbuf->bundleDepth + 1 >= MAX_BUNDLE_NESTING || - OSC_openBundle(x->x_oscbuf, OSCTT_Immediately())) - { - post("Problem opening bundle: %s\n", OSC_errorMessage); - return; - } - x->x_bundle = 1; - outlet_float(x->x_bdpthout, (float)x->x_oscbuf->bundleDepth); -} - -static void sendOSC_closebundle(t_sendOSC *x) -{ - if (OSC_closeBundle(x->x_oscbuf)) { - post("Problem closing bundle: %s\n", OSC_errorMessage); - return; - } - outlet_float(x->x_bdpthout, (float)x->x_oscbuf->bundleDepth); - // in bundle mode we send when bundle is closed? - if(!OSC_isBufferEmpty(x->x_oscbuf) > 0 && OSC_isBufferDone(x->x_oscbuf)) { - // post("x_oscbuf: something inside me?"); - if (x->x_htmsocket) { - SendBuffer(x->x_htmsocket, x->x_oscbuf); - } else { - post("sendOSC: not connected"); - } - OSC_initBuffer(x->x_oscbuf, SC_BUFFER_SIZE, bufferForOSCbuf); - x->x_bundle = 0; - return; - } - // post("x_oscbuf: something went wrong"); -} - -static void sendOSC_settypetags(t_sendOSC *x, t_float *f) - { - x->x_typetags = (int)f; - post("sendOSC.c: setting typetags %d",x->x_typetags); - } - - -static void sendOSC_connect(t_sendOSC *x, t_symbol *hostname, - t_floatarg fportno) -{ - int portno = fportno; - /* create a socket */ - - // make sure handle is available - if(x->x_htmsocket == 0) { - // - x->x_htmsocket = OpenHTMSocket(hostname->s_name, portno); - if (!x->x_htmsocket) - post("Couldn't open socket: "); - else { - post("connected to port %s:%d (hSock=%d)", hostname->s_name, portno, x->x_htmsocket); - outlet_float(x->x_obj.ob_outlet, 1); - } - } - else - perror("call to sendOSC_connect() against UNavailable socket handle"); -} - -void sendOSC_disconnect(t_sendOSC *x) -{ - if (x->x_htmsocket) - { - post("disconnecting htmsock (hSock=%d)...", x->x_htmsocket); - CloseHTMSocket(x->x_htmsocket); - x->x_htmsocket = 0; // {{raf}} semi-quasi-semaphorize this - outlet_float(x->x_obj.ob_outlet, 0); - } - else { - perror("call to sendOSC_disconnect() against unused socket handle"); - } -} - -void sendOSC_senduntyped(t_sendOSC *x, t_symbol *s, int argc, t_atom *argv) -{ - char* targv[MAXPDARG]; - char tmparg[MAXPDSTRING]; - char* tmp = tmparg; - //char testarg[MAXPDSTRING]; - int c; - - post("sendOSC: use typetags 0/1 message and plain send method so send untypetagged..."); - return; - - //atom_string(argv,testarg, MAXPDSTRING); - for (c=0;c= .. - if (x->x_htmsocket) - { - CommandLineMode(argc, targv, x->x_htmsocket); - // post("test %d", c); - } - else { - post("sendOSC: not connected"); - } -} - -////////////////////////////////////////////////////////////////////// -// this is the real and only sending routine now, for both typed and -// undtyped mode. - -static void sendOSC_sendtyped(t_sendOSC *x, t_symbol *s, int argc, t_atom *argv) -{ - char* targv[MAX_ARGS]; - char tmparg[MAXPDSTRING]; - char* tmp = tmparg; - int c; - - char *messageName; - char *token; - typedArg args[MAX_ARGS]; - int i,j; - int numArgs = 0; - - messageName = ""; -#ifdef DEBUG - post ("sendOSC: messageName: %s", messageName); -#endif - - - - for (c=0;c= .. - if (x->x_htmsocket > 0) - { -#ifdef DEBUG - post ("sendOSC: type tags? %d", useTypeTags); -#endif - - messageName = strtok(targv[0], ","); - j = 1; - for (i = j; i < argc; i++) { - token = strtok(targv[i],","); - args[i-j] = ParseToken(token); -#ifdef DEBUG - printf("cell-cont: %s\n", targv[i]); - printf(" type-id: %d\n", args[i-j]); -#endif - numArgs = i; - } - - - if(WriteMessage(x->x_oscbuf, messageName, numArgs, args)) { - post("sendOSC: usage error, write-msg failed: %s", OSC_errorMessage); - return; - } - - if(!x->x_bundle) { - SendBuffer(x->x_htmsocket, x->x_oscbuf); - OSC_initBuffer(x->x_oscbuf, SC_BUFFER_SIZE, bufferForOSCbuf); - } - - //CommandLineMode(argc, targv, x->x_htmsocket); - //useTypeTags = 0; - } - else { - post("sendOSC: not connected"); - } -} - -void sendOSC_send(t_sendOSC *x, t_symbol *s, int argc, t_atom *argv) -{ - if(!argc) { - post("not sending empty message."); - return; - } - if(x->x_typetags) { - useTypeTags = 1; - sendOSC_sendtyped(x,s,argc,argv); - useTypeTags = 0; - } else { - sendOSC_sendtyped(x,s,argc,argv); - } -} - -static void sendOSC_free(t_sendOSC *x) -{ - sendOSC_disconnect(x); -} - -#ifdef WIN32 - OSC_API void sendOSC_setup(void) { -#else - void sendOSC_setup(void) { -#endif - sendOSC_class = class_new(gensym("sendOSC"), (t_newmethod)sendOSC_new, - (t_method)sendOSC_free, - sizeof(t_sendOSC), 0, A_DEFFLOAT, 0); - class_addmethod(sendOSC_class, (t_method)sendOSC_connect, - gensym("connect"), A_SYMBOL, A_FLOAT, 0); - class_addmethod(sendOSC_class, (t_method)sendOSC_disconnect, - gensym("disconnect"), 0); - class_addmethod(sendOSC_class, (t_method)sendOSC_settypetags, - gensym("typetags"), - A_FLOAT, 0); - class_addmethod(sendOSC_class, (t_method)sendOSC_send, - gensym("send"), - A_GIMME, 0); - class_addmethod(sendOSC_class, (t_method)sendOSC_send, - gensym("senduntyped"), - A_GIMME, 0); - class_addmethod(sendOSC_class, (t_method)sendOSC_send, - gensym("sendtyped"), - A_GIMME, 0); - class_addmethod(sendOSC_class, (t_method)sendOSC_openbundle, - gensym("["), - 0, 0); - class_addmethod(sendOSC_class, (t_method)sendOSC_closebundle, - gensym("]"), - 0, 0); - class_sethelpsymbol(sendOSC_class, gensym("sendOSC-help.pd")); -} - - - - - -/* Exit status codes: - 0: successful - 2: Message(s) dropped because of buffer overflow - 3: Socket error - 4: Usage error - 5: Internal error -*/ - -void CommandLineMode(int argc, char *argv[], void *htmsocket) { - char *messageName; - char *token; - typedArg args[MAX_ARGS]; - int i,j, numArgs; - OSCbuf buf[1]; - - OSC_initBuffer(buf, SC_BUFFER_SIZE, bufferForOSCbuf); - - if (argc > 1) { - post("argc (%d) > 1", argc); - } - - // ParseInteractiveLine(buf, argv); - messageName = strtok(argv[0], ","); - - j = 1; - for (i = j; i < argc; i++) { - token = strtok(argv[i],","); - args[i-j] = ParseToken(token); -#ifdef DEBUG - printf("cell-cont: %s\n", argv[i]); - printf(" type-id: %d\n", args[i-j]); -#endif - numArgs = i; - } - - if(WriteMessage(buf, messageName, numArgs, args)) { - post("sendOSC: usage error. write-msg failed: %s", OSC_errorMessage); - return; - } - - SendBuffer(htmsocket, buf); -} - -#define MAXMESG 2048 - -void InteractiveMode(void *htmsocket) { - char mesg[MAXMESG]; - OSCbuf buf[1]; - int bundleDepth = 0; /* At first, we haven't seen "[". */ - - OSC_initBuffer(buf, SC_BUFFER_SIZE, bufferForOSCbuf); - - while (fgets(mesg, MAXMESG, stdin) != NULL) { - if (mesg[0] == '\n') { - if (bundleDepth > 0) { - /* Ignore blank lines inside a group. */ - } else { - /* blank line => repeat previous send */ - SendBuffer(htmsocket, buf); - } - continue; - } - - if (bundleDepth == 0) { - OSC_resetBuffer(buf); - } - - if (mesg[0] == '[') { - OSCTimeTag tt = ParseTimeTag(mesg+1); - if (OSC_openBundle(buf, tt)) { - post("Problem opening bundle: %s\n", OSC_errorMessage); - OSC_resetBuffer(buf); - bundleDepth = 0; - continue; - } - bundleDepth++; - } else if (mesg[0] == ']' && mesg[1] == '\n' && mesg[2] == '\0') { - if (bundleDepth == 0) { - post("Unexpected ']': not currently in a bundle.\n"); - } else { - if (OSC_closeBundle(buf)) { - post("Problem closing bundle: %s\n", OSC_errorMessage); - OSC_resetBuffer(buf); - bundleDepth = 0; - continue; - } - - bundleDepth--; - if (bundleDepth == 0) { - SendBuffer(htmsocket, buf); - } - } - } else { - ParseInteractiveLine(buf, mesg); - if (bundleDepth != 0) { - /* Don't send anything until we close all bundles */ - } else { - SendBuffer(htmsocket, buf); - } - } - } -} - -OSCTimeTag ParseTimeTag(char *s) { - char *p, *newline; - typedArg arg; - - p = s; - while (isspace(*p)) p++; - if (*p == '\0') return OSCTT_Immediately(); - - if (*p == '+') { - /* Time tag is for some time in the future. It should be a - number of seconds as an int or float */ - - newline = strchr(s, '\n'); - if (newline != NULL) *newline = '\0'; - - p++; /* Skip '+' */ - while (isspace(*p)) p++; - - arg = ParseToken(p); - if (arg.type == STRING_osc) { - post("warning: inscrutable time tag request: %s\n", s); - return OSCTT_Immediately(); - } else if (arg.type == INT_osc) { - return OSCTT_PlusSeconds(OSCTT_CurrentTime(), - (float) arg.datum.i); - } else if (arg.type == FLOAT_osc) { - return OSCTT_PlusSeconds(OSCTT_CurrentTime(), arg.datum.f); - } else { - error("This can't happen!"); - } - } - - if (isdigit(*p) || (*p >= 'a' && *p <='f') || (*p >= 'A' && *p <='F')) { - /* They specified the 8-byte tag in hex */ - OSCTimeTag tt; - if (sscanf(p, "%llx", &tt) != 1) { - post("warning: couldn't parse time tag %s\n", s); - return OSCTT_Immediately(); - } -#ifndef HAS8BYTEINT - if (ntohl(1) != 1) { - /* tt is a struct of seconds and fractional part, - and this machine is little-endian, so sscanf - wrote each half of the time tag in the wrong half - of the struct. */ - int temp; - temp = tt.seconds; - tt.seconds = tt.fraction ; - tt.fraction = temp; - } -#endif - return tt; - } - - post("warning: invalid time tag: %s\n", s); - return OSCTT_Immediately(); -} - - -void ParseInteractiveLine(OSCbuf *buf, char *mesg) { - char *messageName, *token, *p; - typedArg args[MAX_ARGS]; - int thisArg; - - p = mesg; - while (isspace(*p)) p++; - if (*p == '\0') return; - - messageName = p; - - if (strcmp(messageName, "play\n") == 0) { - /* Special kludge feature to save typing */ - typedArg arg; - - if (OSC_openBundle(buf, OSCTT_Immediately())) { - post("Problem opening bundle: %s\n", OSC_errorMessage); - return; - } - - arg.type = INT_osc; - arg.datum.i = 0; - WriteMessage(buf, "/voices/0/tp/timbre_index", 1, &arg); - - arg.type = FLOAT_osc; - arg.datum.i = 0.0f; - WriteMessage(buf, "/voices/0/tm/goto", 1, &arg); - - if (OSC_closeBundle(buf)) { - post("Problem closing bundle: %s\n", OSC_errorMessage); - } - - return; - } - - while (!isspace(*p) && *p != '\0') p++; - if (isspace(*p)) { - *p = '\0'; - p++; - } - - thisArg = 0; - while (*p != '\0') { - /* flush leading whitespace */ - while (isspace(*p)) p++; - if (*p == '\0') break; - - if (*p == '"') { - /* A string argument: scan for close quotes */ - p++; - args[thisArg].type = STRING_osc; - args[thisArg].datum.s = p; - - while (*p != '"') { - if (*p == '\0') { - post("Unterminated quote mark: ignoring line\n"); - return; - } - p++; - } - *p = '\0'; - p++; - } else { - token = p; - while (!isspace(*p) && (*p != '\0')) p++; - if (isspace(*p)) { - *p = '\0'; - p++; - } - args[thisArg] = ParseToken(token); - } - thisArg++; - if (thisArg >= MAX_ARGS) { - post("Sorry, your message has more than MAX_ARGS (%d) arguments; ignoring the rest.\n", - MAX_ARGS); - break; - } - } - - if (WriteMessage(buf, messageName, thisArg, args) != 0) { - post("Problem sending message: %s\n", OSC_errorMessage); - } -} - -typedArg ParseToken(char *token) { - char *p = token; - typedArg returnVal; - - /* It might be an int, a float, or a string */ - - if (*p == '-') p++; - - if (isdigit(*p) || *p == '.') { - while (isdigit(*p)) p++; - if (*p == '\0') { - returnVal.type = INT_osc; - returnVal.datum.i = atoi(token); - return returnVal; - } - if (*p == '.') { - p++; - while (isdigit(*p)) p++; - if (*p == '\0') { - returnVal.type = FLOAT_osc; - returnVal.datum.f = atof(token); - return returnVal; - } - } - } - - returnVal.type = STRING_osc; - returnVal.datum.s = token; - return returnVal; -} - -int WriteMessage(OSCbuf *buf, char *messageName, int numArgs, typedArg *args) { - int j, returnVal; - const int wmERROR = -1; - - returnVal = 0; - -#ifdef DEBUG - printf("WriteMessage: %s ", messageName); - - for (j = 0; j < numArgs; j++) { - switch (args[j].type) { - case INT_osc: - printf("%d ", args[j].datum.i); - break; - - case FLOAT_osc: - printf("%f ", args[j].datum.f); - break; - - case STRING_osc: - printf("%s ", args[j].datum.s); - break; - - default: - error("Unrecognized arg type, (not exiting)"); - return(wmERROR); - } - } - printf("\n"); -#endif - - if (!useTypeTags) { - returnVal = OSC_writeAddress(buf, messageName); - if (returnVal) { - post("Problem writing address: %s\n", OSC_errorMessage); - } - } else { - /* First figure out the type tags */ - char typeTags[MAX_ARGS+2]; - int i; - - typeTags[0] = ','; - - for (i = 0; i < numArgs; ++i) { - switch (args[i].type) { - case INT_osc: - typeTags[i+1] = 'i'; - break; - - case FLOAT_osc: - typeTags[i+1] = 'f'; - break; - - case STRING_osc: - typeTags[i+1] = 's'; - break; - - default: - error("Unrecognized arg type (not exiting)"); - return(wmERROR); - } - } - typeTags[i+1] = '\0'; - - returnVal = OSC_writeAddressAndTypes(buf, messageName, typeTags); - if (returnVal) { - post("Problem writing address: %s\n", OSC_errorMessage); - } - } - - for (j = 0; j < numArgs; j++) { - switch (args[j].type) { - case INT_osc: - if ((returnVal = OSC_writeIntArg(buf, args[j].datum.i)) != 0) { - return returnVal; - } - break; - - case FLOAT_osc: - if ((returnVal = OSC_writeFloatArg(buf, args[j].datum.f)) != 0) { - return returnVal; - } - break; - - case STRING_osc: - if ((returnVal = OSC_writeStringArg(buf, args[j].datum.s)) != 0) { - return returnVal; - } - break; - - default: - error("Unrecognized arg type (not exiting)"); - returnVal = wmERROR; - } - } - return returnVal; -} - -void SendBuffer(void *htmsocket, OSCbuf *buf) { -#ifdef DEBUG - printf("Sending buffer...\n"); -#endif - if (OSC_isBufferEmpty(buf)) { - post("SendBuffer() called but buffer empty"); - return; - } - if (!OSC_isBufferDone(buf)) { - error("SendBuffer() called but buffer not ready!, not exiting"); - return; //{{raf}} - } - SendData(htmsocket, OSC_packetSize(buf), OSC_getPacket(buf)); -} - -void SendData(void *htmsocket, int size, char *data) { - if (!SendHTMSocket(htmsocket, size, data)) { - post("SendData::SendHTMSocket()failure -- not connected"); - CloseHTMSocket(htmsocket); - } -} - - - -/* ---------------------- - OSC-client code - - */ - -/* Here are the possible values of the state field: */ - -#define EMPTY 0 /* Nothing written to packet yet */ -#define ONE_MSG_ARGS 1 /* Packet has a single message; gathering arguments */ -#define NEED_COUNT 2 /* Just opened a bundle; must write message name or - open another bundle */ -#define GET_ARGS 3 /* Getting arguments to a message. If we see a message - name or a bundle open/close then the current message - will end. */ -#define DONE 4 /* All open bundles have been closed, so can't write - anything else */ - -#ifdef WIN32 - #include - #include - #include - #include - #include - #include - #include -#endif - -#ifdef __APPLE__ - #include -#endif - -#ifdef unix - #include - #include -#endif - - -char *OSC_errorMessage; - -static int OSC_padString(char *dest, char *str); -static int OSC_padStringWithAnExtraStupidComma(char *dest, char *str); -static int OSC_WritePadding(char *dest, int i); -static int CheckTypeTag(OSCbuf *buf, char expectedType); - -void OSC_initBuffer(OSCbuf *buf, int size, char *byteArray) { - buf->buffer = byteArray; - buf->size = size; - OSC_resetBuffer(buf); -} - -void OSC_resetBuffer(OSCbuf *buf) { - buf->bufptr = buf->buffer; - buf->state = EMPTY; - buf->bundleDepth = 0; - buf->prevCounts[0] = 0; - buf->gettingFirstUntypedArg = 0; - buf->typeStringPtr = 0; -} - -int OSC_isBufferEmpty(OSCbuf *buf) { - return buf->bufptr == buf->buffer; -} - -int OSC_freeSpaceInBuffer(OSCbuf *buf) { - return buf->size - (buf->bufptr - buf->buffer); -} - -int OSC_isBufferDone(OSCbuf *buf) { - return (buf->state == DONE || buf->state == ONE_MSG_ARGS); -} - -char *OSC_getPacket(OSCbuf *buf) { -#ifdef ERROR_CHECK_GETPACKET - if (buf->state == DONE || buf->state == ONE_MSG_ARGS) { - return buf->buffer; - } else { - OSC_errorMessage = "Packet has unterminated bundles"; - return 0; - } -#else - return buf->buffer; -#endif -} - -int OSC_packetSize(OSCbuf *buf) { -#ifdef ERROR_CHECK_PACKETSIZE - if (buf->state == DONE || buf->state == ONE_MSG_ARGS) { - return (buf->bufptr - buf->buffer); - } else { - OSC_errorMessage = "Packet has unterminated bundles"; - return 0; - } -#else - return (buf->bufptr - buf->buffer); -#endif -} - -#define CheckOverflow(buf, bytesNeeded) { if ((bytesNeeded) > OSC_freeSpaceInBuffer(buf)) {OSC_errorMessage = "buffer overflow"; return 1;}} - -static void PatchMessageSize(OSCbuf *buf) { - int4byte size; - size = buf->bufptr - ((char *) buf->thisMsgSize) - 4; - *(buf->thisMsgSize) = htonl(size); -} - -int OSC_openBundle(OSCbuf *buf, OSCTimeTag tt) { - if (buf->state == ONE_MSG_ARGS) { - OSC_errorMessage = "Can't open a bundle in a one-message packet"; - return 3; - } - - if (buf->state == DONE) { - OSC_errorMessage = "This packet is finished; can't open a new bundle"; - return 4; - } - - if (++(buf->bundleDepth) >= MAX_BUNDLE_NESTING) { - OSC_errorMessage = "Bundles nested too deeply; change MAX_BUNDLE_NESTING in OpenSoundControl.h"; - return 2; - } - - if (CheckTypeTag(buf, '\0')) return 9; - - if (buf->state == GET_ARGS) { - PatchMessageSize(buf); - } - - if (buf->state == EMPTY) { - /* Need 16 bytes for "#bundle" and time tag */ - CheckOverflow(buf, 16); - } else { - /* This bundle is inside another bundle, so we need to leave - a blank size count for the size of this current bundle. */ - CheckOverflow(buf, 20); - *((int4byte *)buf->bufptr) = 0xaaaaaaaa; - buf->prevCounts[buf->bundleDepth] = (int4byte *)buf->bufptr; - - buf->bufptr += 4; - } - - buf->bufptr += OSC_padString(buf->bufptr, "#bundle"); - - - *((OSCTimeTag *) buf->bufptr) = tt; - - if (htonl(1) != 1) { - /* Byte swap the 8-byte integer time tag */ - int4byte *intp = (int4byte *)buf->bufptr; - intp[0] = htonl(intp[0]); - intp[1] = htonl(intp[1]); - -#ifdef HAS8BYTEINT - { /* tt is a 64-bit int so we have to swap the two 32-bit words. - (Otherwise tt is a struct of two 32-bit words, and even though - each word was wrong-endian, they were in the right order - in the struct.) */ - int4byte temp = intp[0]; - intp[0] = intp[1]; - intp[1] = temp; - } -#endif - } - - buf->bufptr += sizeof(OSCTimeTag); - - buf->state = NEED_COUNT; - - buf->gettingFirstUntypedArg = 0; - buf->typeStringPtr = 0; - return 0; -} - - -int OSC_closeBundle(OSCbuf *buf) { - if (buf->bundleDepth == 0) { - /* This handles EMPTY, ONE_MSG, ARGS, and DONE */ - OSC_errorMessage = "Can't close bundle; no bundle is open!"; - return 5; - } - - if (CheckTypeTag(buf, '\0')) return 9; - - if (buf->state == GET_ARGS) { - PatchMessageSize(buf); - } - - if (buf->bundleDepth == 1) { - /* Closing the last bundle: No bundle size to patch */ - buf->state = DONE; - } else { - /* Closing a sub-bundle: patch bundle size */ - int size = buf->bufptr - ((char *) buf->prevCounts[buf->bundleDepth]) - 4; - *(buf->prevCounts[buf->bundleDepth]) = htonl(size); - buf->state = NEED_COUNT; - } - - --buf->bundleDepth; - buf->gettingFirstUntypedArg = 0; - buf->typeStringPtr = 0; - return 0; -} - - -int OSC_closeAllBundles(OSCbuf *buf) { - if (buf->bundleDepth == 0) { - /* This handles EMPTY, ONE_MSG, ARGS, and DONE */ - OSC_errorMessage = "Can't close all bundles; no bundle is open!"; - return 6; - } - - if (CheckTypeTag(buf, '\0')) return 9; - - while (buf->bundleDepth > 0) { - OSC_closeBundle(buf); - } - buf->typeStringPtr = 0; - return 0; -} - -int OSC_writeAddress(OSCbuf *buf, char *name) { - int4byte paddedLength; - - if (buf->state == ONE_MSG_ARGS) { - OSC_errorMessage = "This packet is not a bundle, so you can't write another address"; - return 7; - } - - if (buf->state == DONE) { - OSC_errorMessage = "This packet is finished; can't write another address"; - return 8; - } - - if (CheckTypeTag(buf, '\0')) return 9; - - paddedLength = OSC_effectiveStringLength(name); - - if (buf->state == EMPTY) { - /* This will be a one-message packet, so no sizes to worry about */ - CheckOverflow(buf, paddedLength); - buf->state = ONE_MSG_ARGS; - } else { - /* GET_ARGS or NEED_COUNT */ - CheckOverflow(buf, 4+paddedLength); - if (buf->state == GET_ARGS) { - /* Close the old message */ - PatchMessageSize(buf); - } - buf->thisMsgSize = (int4byte *)buf->bufptr; - *(buf->thisMsgSize) = 0xbbbbbbbb; - buf->bufptr += 4; - buf->state = GET_ARGS; - } - - /* Now write the name */ - buf->bufptr += OSC_padString(buf->bufptr, name); - buf->typeStringPtr = 0; - buf->gettingFirstUntypedArg = 1; - - return 0; -} - -int OSC_writeAddressAndTypes(OSCbuf *buf, char *name, char *types) { - int result; - int4byte paddedLength; - - if (CheckTypeTag(buf, '\0')) return 9; - - result = OSC_writeAddress(buf, name); - - if (result) return result; - - paddedLength = OSC_effectiveStringLength(types); - - CheckOverflow(buf, paddedLength); - - buf->typeStringPtr = buf->bufptr + 1; /* skip comma */ - buf->bufptr += OSC_padString(buf->bufptr, types); - - buf->gettingFirstUntypedArg = 0; - return 0; -} - -static int CheckTypeTag(OSCbuf *buf, char expectedType) { - if (buf->typeStringPtr) { - if (*(buf->typeStringPtr) != expectedType) { - if (expectedType == '\0') { - OSC_errorMessage = - "According to the type tag I expected more arguments."; - } else if (*(buf->typeStringPtr) == '\0') { - OSC_errorMessage = - "According to the type tag I didn't expect any more arguments."; - } else { - OSC_errorMessage = - "According to the type tag I expected an argument of a different type."; - printf("* Expected %c, string now %s\n", expectedType, buf->typeStringPtr); - } - return 9; - } - ++(buf->typeStringPtr); - } - return 0; -} - - -int OSC_writeFloatArg(OSCbuf *buf, float arg) { - int4byte *intp; - //int result; - - CheckOverflow(buf, 4); - - if (CheckTypeTag(buf, 'f')) return 9; - - /* Pretend arg is a long int so we can use htonl() */ - intp = ((int4byte *) &arg); - *((int4byte *) buf->bufptr) = htonl(*intp); - - buf->bufptr += 4; - - buf->gettingFirstUntypedArg = 0; - return 0; -} - - - -int OSC_writeFloatArgs(OSCbuf *buf, int numFloats, float *args) { - int i; - int4byte *intp; - - CheckOverflow(buf, 4 * numFloats); - - /* Pretend args are long ints so we can use htonl() */ - intp = ((int4byte *) args); - - for (i = 0; i < numFloats; i++) { - if (CheckTypeTag(buf, 'f')) return 9; - *((int4byte *) buf->bufptr) = htonl(intp[i]); - buf->bufptr += 4; - } - - buf->gettingFirstUntypedArg = 0; - return 0; -} - -int OSC_writeIntArg(OSCbuf *buf, int4byte arg) { - CheckOverflow(buf, 4); - if (CheckTypeTag(buf, 'i')) return 9; - - *((int4byte *) buf->bufptr) = htonl(arg); - buf->bufptr += 4; - - buf->gettingFirstUntypedArg = 0; - return 0; -} - -int OSC_writeStringArg(OSCbuf *buf, char *arg) { - int len; - - if (CheckTypeTag(buf, 's')) return 9; - - len = OSC_effectiveStringLength(arg); - - if (buf->gettingFirstUntypedArg && arg[0] == ',') { - /* This un-type-tagged message starts with a string - that starts with a comma, so we have to escape it - (with a double comma) so it won't look like a type - tag string. */ - - CheckOverflow(buf, len+4); /* Too conservative */ - buf->bufptr += - OSC_padStringWithAnExtraStupidComma(buf->bufptr, arg); - - } else { - CheckOverflow(buf, len); - buf->bufptr += OSC_padString(buf->bufptr, arg); - } - - buf->gettingFirstUntypedArg = 0; - return 0; - -} - -/* String utilities */ - -#define STRING_ALIGN_PAD 4 -int OSC_effectiveStringLength(char *string) { - int len = strlen(string) + 1; /* We need space for the null char. */ - - /* Round up len to next multiple of STRING_ALIGN_PAD to account for alignment padding */ - if ((len % STRING_ALIGN_PAD) != 0) { - len += STRING_ALIGN_PAD - (len % STRING_ALIGN_PAD); - } - return len; -} - -static int OSC_padString(char *dest, char *str) { - int i; - - for (i = 0; str[i] != '\0'; i++) { - dest[i] = str[i]; - } - - return OSC_WritePadding(dest, i); -} - -static int OSC_padStringWithAnExtraStupidComma(char *dest, char *str) { - int i; - - dest[0] = ','; - for (i = 0; str[i] != '\0'; i++) { - dest[i+1] = str[i]; - } - - return OSC_WritePadding(dest, i+1); -} - -static int OSC_WritePadding(char *dest, int i) { - dest[i] = '\0'; - i++; - - for (; (i % STRING_ALIGN_PAD) != 0; i++) { - dest[i] = '\0'; - } - - return i; -} - +/* +Written by Matt Wright, The Center for New Music and Audio Technologies, +University of California, Berkeley. Copyright (c) 1996,97,98,99,2000,01,02,03 +The Regents of the University of California (Regents). + +Permission to use, copy, modify, distribute, and distribute modified versions +of this software and its documentation without fee and without a signed +licensing agreement, is hereby granted, provided that the above copyright +notice, this paragraph and the following two paragraphs appear in all copies, +modifications, and distributions. + +IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING +OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS +BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED +HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE +MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + + +The OSC webpage is http://cnmat.cnmat.berkeley.edu/OpenSoundControl +*/ + + +/* sendOSC.c + + Matt Wright, 6/3/97 + based on sendOSC.c, which was based on a version by Adrian Freed + + Text-based OpenSoundControl client. User can enter messages via command + line arguments or standard input. + + Version 0.1: "play" feature + Version 0.2: Message type tags. + + pd version branched from http://www.cnmat.berkeley.edu/OpenSoundControl/src/sendOSC/sendOSC.c + ------------- + -- added bundle stuff to send. jdl 20020416 + -- tweaks for Win32 www.zeggz.com/raf 13-April-2002 + -- ost_at_test.at + i22_at_test.at, 2000-2002 + modified to compile as pd externel +*/ + +#define MAX_ARGS 2000 +#define SC_BUFFER_SIZE 64000 + +#include "m_pd.h" +#include "OSC-client.h" + +#include +#include +#include +#include +#include +#include + +#ifdef WIN32 +#include +#include +#include +#include +#include +#include +#include +#else +#include +#include +#include +#include +#include +#include +#include +#include +#endif + +#ifdef __APPLE__ + #include +#endif + +#define UNIXDG_PATH "/tmp/htm" +#define UNIXDG_TMP "/tmp/htm.XXXXXX" + + + +OSCTimeTag OSCTT_Immediately(void) { + OSCTimeTag result; + result.seconds = 0; + result.fraction = 1; + return result; +} + + +OSCTimeTag OSCTT_CurrentTime(void) { + OSCTimeTag result; + result.seconds = 0; + result.fraction = 1; + return result; +} + +OSCTimeTag OSCTT_PlusSeconds(OSCTimeTag original, float secondsOffset) { + OSCTimeTag result; + result.seconds = 0; + result.fraction = 1; + return result; +} + + +typedef int bool; + +typedef struct +{ + float srate; + + struct sockaddr_in serv_addr; /* udp socket */ + #ifndef WIN32 + struct sockaddr_un userv_addr; /* UNIX socket */ + #endif + int sockfd; /* socket file descriptor */ + int index, len,uservlen; + void *addr; + int id; +} desc; + + +/* open a socket for HTM communication to given host on given portnumber */ +/* if host is 0 then UNIX protocol is used (i.e. local communication */ +void *OpenHTMSocket(char *host, int portnumber) +{ + struct sockaddr_in cl_addr; + #ifndef WIN32 + int sockfd; + struct sockaddr_un ucl_addr; + #else + unsigned int sockfd; + #endif + + desc *o; + int oval = 1; + o = malloc(sizeof(*o)); + if(!o) return 0; + + #ifndef WIN32 + + if(!host) + { + char *mktemp(char *); + int clilen; + o->len = sizeof(ucl_addr); + /* + * Fill in the structure "userv_addr" with the address of the + * server that we want to send to. + */ + + bzero((char *) &o->userv_addr, sizeof(o->userv_addr)); + o->userv_addr.sun_family = AF_UNIX; + strcpy(o->userv_addr.sun_path, UNIXDG_PATH); + sprintf(o->userv_addr.sun_path+strlen(o->userv_addr.sun_path), "%d", portnumber); + o->uservlen = sizeof(o->userv_addr.sun_family) + strlen(o->userv_addr.sun_path); + o->addr = &(o->userv_addr); + /* + * Open a socket (a UNIX domain datagram socket). + */ + + if ( (sockfd = socket(AF_UNIX, SOCK_DGRAM, 0)) >= 0) + { + /* + * Bind a local address for us. + * In the UNIX domain we have to choose our own name (that + * should be unique). We'll use mktemp() to create a unique + * pathname, based on our process id. + */ + + bzero((char *) &ucl_addr, sizeof(ucl_addr)); /* zero out */ + ucl_addr.sun_family = AF_UNIX; + strcpy(ucl_addr.sun_path, UNIXDG_TMP); + + mktemp(ucl_addr.sun_path); + clilen = sizeof(ucl_addr.sun_family) + strlen(ucl_addr.sun_path); + + if (bind(sockfd, (struct sockaddr *) &ucl_addr, clilen) < 0) + { + perror("client: can't bind local address"); + close(sockfd); + sockfd = -1; + } + } + else + perror("unable to make socket\n"); + + }else + + #endif + + { + /* + * Fill in the structure "serv_addr" with the address of the + * server that we want to send to. + */ + o->len = sizeof(cl_addr); + + #ifdef WIN32 + ZeroMemory((char *)&o->serv_addr, sizeof(o->serv_addr)); + #else + bzero((char *)&o->serv_addr, sizeof(o->serv_addr)); + #endif + + o->serv_addr.sin_family = AF_INET; + + /* MW 6/6/96: Call gethostbyname() instead of inet_addr(), + so that host can be either an Internet host name (e.g., + "les") or an Internet address in standard dot notation + (e.g., "128.32.122.13") */ + { + struct hostent *hostsEntry; + unsigned long address; + + hostsEntry = gethostbyname(host); + if (hostsEntry == NULL) { + fprintf(stderr, "Couldn't decipher host name \"%s\"\n", host); + #ifndef WIN32 + herror(NULL); + #endif + return 0; + } + address = *((unsigned long *) hostsEntry->h_addr_list[0]); + o->serv_addr.sin_addr.s_addr = address; + } + + /* was: o->serv_addr.sin_addr.s_addr = inet_addr(host); */ + + /* End MW changes */ + + /* + * Open a socket (a UDP domain datagram socket). + */ + + + #ifdef WIN32 + o->serv_addr.sin_port = htons((USHORT)portnumber); + o->addr = &(o->serv_addr); + if((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) != INVALID_SOCKET) { + ZeroMemory((char *)&cl_addr, sizeof(cl_addr)); + cl_addr.sin_family = AF_INET; + cl_addr.sin_addr.s_addr = htonl(INADDR_ANY); + cl_addr.sin_port = htons(0); + + // enable broadcast: jdl ~2003 + if(setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &oval, sizeof(int)) == -1) { + perror("setsockopt"); + } + + if(bind(sockfd, (struct sockaddr *) &cl_addr, sizeof(cl_addr)) < 0) { + perror("could not bind\n"); + closesocket(sockfd); + sockfd = -1; + } + } + else { perror("unable to make socket\n");} + #else + o->serv_addr.sin_port = htons(portnumber); + o->addr = &(o->serv_addr); + if((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) >= 0) { + bzero((char *)&cl_addr, sizeof(cl_addr)); + cl_addr.sin_family = AF_INET; + cl_addr.sin_addr.s_addr = htonl(INADDR_ANY); + cl_addr.sin_port = htons(0); + + // enable broadcast: jdl ~2003 + if(setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &oval, sizeof(int)) == -1) { + perror("setsockopt"); + } + + if(bind(sockfd, (struct sockaddr *) &cl_addr, sizeof(cl_addr)) < 0) { + perror("could not bind\n"); + close(sockfd); + sockfd = -1; + } + } + else { perror("unable to make socket\n");} + #endif + } + #ifdef WIN32 + if(sockfd == INVALID_SOCKET) { + #else + if(sockfd < 0) { + #endif + free(o); + o = 0; + } + else + o->sockfd = sockfd; + return o; +} + +static bool sendudp(const struct sockaddr *sp, int sockfd,int length, int count, void *b) +{ + int rcount; + if((rcount=sendto(sockfd, b, count, 0, sp, length)) != count) + { + printf("sockfd %d count %d rcount %dlength %d\n", sockfd,count,rcount,length); + return FALSE; + } + return TRUE; +} + +bool SendHTMSocket(void *htmsendhandle, int length_in_bytes, void *buffer) +{ + desc *o = (desc *)htmsendhandle; + return sendudp(o->addr, o->sockfd, o->len, length_in_bytes, buffer); +} +void CloseHTMSocket(void *htmsendhandle) +{ + desc *o = (desc *)htmsendhandle; + #ifdef WIN32 + if(SOCKET_ERROR == closesocket(o->sockfd)) { + perror("CloseHTMSocket::closesocket failed\n"); + return; + } + #else + if(close(o->sockfd) == -1) + { + perror("CloseHTMSocket::closesocket failed"); + return; + } + #endif + + free(o); +} + + +/////////////////////// +// from sendOSC + +typedef struct { + //enum {INT, FLOAT, STRING} type; + enum {INT_osc, FLOAT_osc, STRING_osc} type; + union { + int i; + float f; + char *s; + } datum; +} typedArg; + +void CommandLineMode(int argc, char *argv[], void *htmsocket); +OSCTimeTag ParseTimeTag(char *s); +void ParseInteractiveLine(OSCbuf *buf, char *mesg); +typedArg ParseToken(char *token); +int WriteMessage(OSCbuf *buf, char *messageName, int numArgs, typedArg *args); +void SendBuffer(void *htmsocket, OSCbuf *buf); +void SendData(void *htmsocket, int size, char *data); +/* defined in OSC-system-dependent.c now */ + +//static void *htmsocket; +static int exitStatus = 0; +static int useTypeTags = 0; + +static char bufferForOSCbuf[SC_BUFFER_SIZE]; + + +///////// +// end from sendOSC + +static t_class *sendOSC_class; + +typedef struct _sendOSC +{ + t_object x_obj; + int x_protocol; // UDP/TCP (udp only atm) + t_int x_typetags; // typetag flag + void *x_htmsocket; // sending socket + int x_bundle; // bundle open flag + OSCbuf x_oscbuf[1]; // OSCbuffer + t_outlet *x_bdpthout;// bundle-depth floatoutlet +} t_sendOSC; + +static void *sendOSC_new(t_floatarg udpflag) +{ + t_sendOSC *x = (t_sendOSC *)pd_new(sendOSC_class); + outlet_new(&x->x_obj, &s_float); + x->x_htmsocket = 0; // {{raf}} + // set udp + x->x_protocol = SOCK_STREAM; + // set typetags to 1 by default + x->x_typetags = 1; + // bunlde is closed + x->x_bundle = 0; + OSC_initBuffer(x->x_oscbuf, SC_BUFFER_SIZE, bufferForOSCbuf); + x->x_bdpthout = outlet_new(&x->x_obj, 0); // outlet_float(); + //x->x_oscbuf = + return (x); +} + + +void sendOSC_openbundle(t_sendOSC *x) +{ + if (x->x_oscbuf->bundleDepth + 1 >= MAX_BUNDLE_NESTING || + OSC_openBundle(x->x_oscbuf, OSCTT_Immediately())) + { + post("Problem opening bundle: %s\n", OSC_errorMessage); + return; + } + x->x_bundle = 1; + outlet_float(x->x_bdpthout, (float)x->x_oscbuf->bundleDepth); +} + +static void sendOSC_closebundle(t_sendOSC *x) +{ + if (OSC_closeBundle(x->x_oscbuf)) { + post("Problem closing bundle: %s\n", OSC_errorMessage); + return; + } + outlet_float(x->x_bdpthout, (float)x->x_oscbuf->bundleDepth); + // in bundle mode we send when bundle is closed? + if(!OSC_isBufferEmpty(x->x_oscbuf) > 0 && OSC_isBufferDone(x->x_oscbuf)) { + // post("x_oscbuf: something inside me?"); + if (x->x_htmsocket) { + SendBuffer(x->x_htmsocket, x->x_oscbuf); + } else { + post("sendOSC: not connected"); + } + OSC_initBuffer(x->x_oscbuf, SC_BUFFER_SIZE, bufferForOSCbuf); + x->x_bundle = 0; + return; + } + // post("x_oscbuf: something went wrong"); +} + +static void sendOSC_settypetags(t_sendOSC *x, t_float *f) + { + x->x_typetags = (int)f; + post("sendOSC.c: setting typetags %d",x->x_typetags); + } + + +static void sendOSC_connect(t_sendOSC *x, t_symbol *hostname, + t_floatarg fportno) +{ + int portno = fportno; + /* create a socket */ + + // make sure handle is available + if(x->x_htmsocket == 0) { + // + x->x_htmsocket = OpenHTMSocket(hostname->s_name, portno); + if (!x->x_htmsocket) + post("Couldn't open socket: "); + else { + post("connected to port %s:%d (hSock=%d)", hostname->s_name, portno, x->x_htmsocket); + outlet_float(x->x_obj.ob_outlet, 1); + } + } + else + perror("call to sendOSC_connect() against UNavailable socket handle"); +} + +void sendOSC_disconnect(t_sendOSC *x) +{ + if (x->x_htmsocket) + { + post("disconnecting htmsock (hSock=%d)...", x->x_htmsocket); + CloseHTMSocket(x->x_htmsocket); + x->x_htmsocket = 0; // {{raf}} semi-quasi-semaphorize this + outlet_float(x->x_obj.ob_outlet, 0); + } + else { + perror("call to sendOSC_disconnect() against unused socket handle"); + } +} + +void sendOSC_senduntyped(t_sendOSC *x, t_symbol *s, int argc, t_atom *argv) +{ + char* targv[MAXPDARG]; + char tmparg[MAXPDSTRING]; + char* tmp = tmparg; + //char testarg[MAXPDSTRING]; + int c; + + post("sendOSC: use typetags 0/1 message and plain send method so send untypetagged..."); + return; + + //atom_string(argv,testarg, MAXPDSTRING); + for (c=0;c= .. + if (x->x_htmsocket) + { + CommandLineMode(argc, targv, x->x_htmsocket); + // post("test %d", c); + } + else { + post("sendOSC: not connected"); + } +} + +////////////////////////////////////////////////////////////////////// +// this is the real and only sending routine now, for both typed and +// undtyped mode. + +static void sendOSC_sendtyped(t_sendOSC *x, t_symbol *s, int argc, t_atom *argv) +{ + char* targv[MAX_ARGS]; + char tmparg[MAXPDSTRING]; + char* tmp = tmparg; + int c; + + char *messageName; + char *token; + typedArg args[MAX_ARGS]; + int i,j; + int numArgs = 0; + + messageName = ""; +#ifdef DEBUG + post ("sendOSC: messageName: %s", messageName); +#endif + + + + for (c=0;c= .. + if (x->x_htmsocket > 0) + { +#ifdef DEBUG + post ("sendOSC: type tags? %d", useTypeTags); +#endif + + messageName = strtok(targv[0], ","); + j = 1; + for (i = j; i < argc; i++) { + token = strtok(targv[i],","); + args[i-j] = ParseToken(token); +#ifdef DEBUG + printf("cell-cont: %s\n", targv[i]); + printf(" type-id: %d\n", args[i-j]); +#endif + numArgs = i; + } + + + if(WriteMessage(x->x_oscbuf, messageName, numArgs, args)) { + post("sendOSC: usage error, write-msg failed: %s", OSC_errorMessage); + return; + } + + if(!x->x_bundle) { + SendBuffer(x->x_htmsocket, x->x_oscbuf); + OSC_initBuffer(x->x_oscbuf, SC_BUFFER_SIZE, bufferForOSCbuf); + } + + //CommandLineMode(argc, targv, x->x_htmsocket); + //useTypeTags = 0; + } + else { + post("sendOSC: not connected"); + } +} + +void sendOSC_send(t_sendOSC *x, t_symbol *s, int argc, t_atom *argv) +{ + if(!argc) { + post("not sending empty message."); + return; + } + if(x->x_typetags) { + useTypeTags = 1; + sendOSC_sendtyped(x,s,argc,argv); + useTypeTags = 0; + } else { + sendOSC_sendtyped(x,s,argc,argv); + } +} + +static void sendOSC_free(t_sendOSC *x) +{ + sendOSC_disconnect(x); +} + +#ifdef WIN32 + OSC_API void sendOSC_setup(void) { +#else + void sendOSC_setup(void) { +#endif + sendOSC_class = class_new(gensym("sendOSC"), (t_newmethod)sendOSC_new, + (t_method)sendOSC_free, + sizeof(t_sendOSC), 0, A_DEFFLOAT, 0); + class_addmethod(sendOSC_class, (t_method)sendOSC_connect, + gensym("connect"), A_SYMBOL, A_FLOAT, 0); + class_addmethod(sendOSC_class, (t_method)sendOSC_disconnect, + gensym("disconnect"), 0); + class_addmethod(sendOSC_class, (t_method)sendOSC_settypetags, + gensym("typetags"), + A_FLOAT, 0); + class_addmethod(sendOSC_class, (t_method)sendOSC_send, + gensym("send"), + A_GIMME, 0); + class_addmethod(sendOSC_class, (t_method)sendOSC_send, + gensym("senduntyped"), + A_GIMME, 0); + class_addmethod(sendOSC_class, (t_method)sendOSC_send, + gensym("sendtyped"), + A_GIMME, 0); + class_addmethod(sendOSC_class, (t_method)sendOSC_openbundle, + gensym("["), + 0, 0); + class_addmethod(sendOSC_class, (t_method)sendOSC_closebundle, + gensym("]"), + 0, 0); + class_sethelpsymbol(sendOSC_class, gensym("sendOSC-help.pd")); +} + + + + + +/* Exit status codes: + 0: successful + 2: Message(s) dropped because of buffer overflow + 3: Socket error + 4: Usage error + 5: Internal error +*/ + +void CommandLineMode(int argc, char *argv[], void *htmsocket) { + char *messageName; + char *token; + typedArg args[MAX_ARGS]; + int i,j, numArgs; + OSCbuf buf[1]; + + OSC_initBuffer(buf, SC_BUFFER_SIZE, bufferForOSCbuf); + + if (argc > 1) { + post("argc (%d) > 1", argc); + } + + // ParseInteractiveLine(buf, argv); + messageName = strtok(argv[0], ","); + + j = 1; + for (i = j; i < argc; i++) { + token = strtok(argv[i],","); + args[i-j] = ParseToken(token); +#ifdef DEBUG + printf("cell-cont: %s\n", argv[i]); + printf(" type-id: %d\n", args[i-j]); +#endif + numArgs = i; + } + + if(WriteMessage(buf, messageName, numArgs, args)) { + post("sendOSC: usage error. write-msg failed: %s", OSC_errorMessage); + return; + } + + SendBuffer(htmsocket, buf); +} + +#define MAXMESG 2048 + +void InteractiveMode(void *htmsocket) { + char mesg[MAXMESG]; + OSCbuf buf[1]; + int bundleDepth = 0; /* At first, we haven't seen "[". */ + + OSC_initBuffer(buf, SC_BUFFER_SIZE, bufferForOSCbuf); + + while (fgets(mesg, MAXMESG, stdin) != NULL) { + if (mesg[0] == '\n') { + if (bundleDepth > 0) { + /* Ignore blank lines inside a group. */ + } else { + /* blank line => repeat previous send */ + SendBuffer(htmsocket, buf); + } + continue; + } + + if (bundleDepth == 0) { + OSC_resetBuffer(buf); + } + + if (mesg[0] == '[') { + OSCTimeTag tt = ParseTimeTag(mesg+1); + if (OSC_openBundle(buf, tt)) { + post("Problem opening bundle: %s\n", OSC_errorMessage); + OSC_resetBuffer(buf); + bundleDepth = 0; + continue; + } + bundleDepth++; + } else if (mesg[0] == ']' && mesg[1] == '\n' && mesg[2] == '\0') { + if (bundleDepth == 0) { + post("Unexpected ']': not currently in a bundle.\n"); + } else { + if (OSC_closeBundle(buf)) { + post("Problem closing bundle: %s\n", OSC_errorMessage); + OSC_resetBuffer(buf); + bundleDepth = 0; + continue; + } + + bundleDepth--; + if (bundleDepth == 0) { + SendBuffer(htmsocket, buf); + } + } + } else { + ParseInteractiveLine(buf, mesg); + if (bundleDepth != 0) { + /* Don't send anything until we close all bundles */ + } else { + SendBuffer(htmsocket, buf); + } + } + } +} + +OSCTimeTag ParseTimeTag(char *s) { + char *p, *newline; + typedArg arg; + + p = s; + while (isspace(*p)) p++; + if (*p == '\0') return OSCTT_Immediately(); + + if (*p == '+') { + /* Time tag is for some time in the future. It should be a + number of seconds as an int or float */ + + newline = strchr(s, '\n'); + if (newline != NULL) *newline = '\0'; + + p++; /* Skip '+' */ + while (isspace(*p)) p++; + + arg = ParseToken(p); + if (arg.type == STRING_osc) { + post("warning: inscrutable time tag request: %s\n", s); + return OSCTT_Immediately(); + } else if (arg.type == INT_osc) { + return OSCTT_PlusSeconds(OSCTT_CurrentTime(), + (float) arg.datum.i); + } else if (arg.type == FLOAT_osc) { + return OSCTT_PlusSeconds(OSCTT_CurrentTime(), arg.datum.f); + } else { + error("This can't happen!"); + } + } + + if (isdigit(*p) || (*p >= 'a' && *p <='f') || (*p >= 'A' && *p <='F')) { + /* They specified the 8-byte tag in hex */ + OSCTimeTag tt; + if (sscanf(p, "%llx", &tt) != 1) { + post("warning: couldn't parse time tag %s\n", s); + return OSCTT_Immediately(); + } +#ifndef HAS8BYTEINT + if (ntohl(1) != 1) { + /* tt is a struct of seconds and fractional part, + and this machine is little-endian, so sscanf + wrote each half of the time tag in the wrong half + of the struct. */ + int temp; + temp = tt.seconds; + tt.seconds = tt.fraction ; + tt.fraction = temp; + } +#endif + return tt; + } + + post("warning: invalid time tag: %s\n", s); + return OSCTT_Immediately(); +} + + +void ParseInteractiveLine(OSCbuf *buf, char *mesg) { + char *messageName, *token, *p; + typedArg args[MAX_ARGS]; + int thisArg; + + p = mesg; + while (isspace(*p)) p++; + if (*p == '\0') return; + + messageName = p; + + if (strcmp(messageName, "play\n") == 0) { + /* Special kludge feature to save typing */ + typedArg arg; + + if (OSC_openBundle(buf, OSCTT_Immediately())) { + post("Problem opening bundle: %s\n", OSC_errorMessage); + return; + } + + arg.type = INT_osc; + arg.datum.i = 0; + WriteMessage(buf, "/voices/0/tp/timbre_index", 1, &arg); + + arg.type = FLOAT_osc; + arg.datum.i = 0.0f; + WriteMessage(buf, "/voices/0/tm/goto", 1, &arg); + + if (OSC_closeBundle(buf)) { + post("Problem closing bundle: %s\n", OSC_errorMessage); + } + + return; + } + + while (!isspace(*p) && *p != '\0') p++; + if (isspace(*p)) { + *p = '\0'; + p++; + } + + thisArg = 0; + while (*p != '\0') { + /* flush leading whitespace */ + while (isspace(*p)) p++; + if (*p == '\0') break; + + if (*p == '"') { + /* A string argument: scan for close quotes */ + p++; + args[thisArg].type = STRING_osc; + args[thisArg].datum.s = p; + + while (*p != '"') { + if (*p == '\0') { + post("Unterminated quote mark: ignoring line\n"); + return; + } + p++; + } + *p = '\0'; + p++; + } else { + token = p; + while (!isspace(*p) && (*p != '\0')) p++; + if (isspace(*p)) { + *p = '\0'; + p++; + } + args[thisArg] = ParseToken(token); + } + thisArg++; + if (thisArg >= MAX_ARGS) { + post("Sorry, your message has more than MAX_ARGS (%d) arguments; ignoring the rest.\n", + MAX_ARGS); + break; + } + } + + if (WriteMessage(buf, messageName, thisArg, args) != 0) { + post("Problem sending message: %s\n", OSC_errorMessage); + } +} + +typedArg ParseToken(char *token) { + char *p = token; + typedArg returnVal; + + /* It might be an int, a float, or a string */ + + if (*p == '-') p++; + + if (isdigit(*p) || *p == '.') { + while (isdigit(*p)) p++; + if (*p == '\0') { + returnVal.type = INT_osc; + returnVal.datum.i = atoi(token); + return returnVal; + } + if (*p == '.') { + p++; + while (isdigit(*p)) p++; + if (*p == '\0') { + returnVal.type = FLOAT_osc; + returnVal.datum.f = atof(token); + return returnVal; + } + } + } + + returnVal.type = STRING_osc; + returnVal.datum.s = token; + return returnVal; +} + +int WriteMessage(OSCbuf *buf, char *messageName, int numArgs, typedArg *args) { + int j, returnVal; + const int wmERROR = -1; + + returnVal = 0; + +#ifdef DEBUG + printf("WriteMessage: %s ", messageName); + + for (j = 0; j < numArgs; j++) { + switch (args[j].type) { + case INT_osc: + printf("%d ", args[j].datum.i); + break; + + case FLOAT_osc: + printf("%f ", args[j].datum.f); + break; + + case STRING_osc: + printf("%s ", args[j].datum.s); + break; + + default: + error("Unrecognized arg type, (not exiting)"); + return(wmERROR); + } + } + printf("\n"); +#endif + + if (!useTypeTags) { + returnVal = OSC_writeAddress(buf, messageName); + if (returnVal) { + post("Problem writing address: %s\n", OSC_errorMessage); + } + } else { + /* First figure out the type tags */ + char typeTags[MAX_ARGS+2]; + int i; + + typeTags[0] = ','; + + for (i = 0; i < numArgs; ++i) { + switch (args[i].type) { + case INT_osc: + typeTags[i+1] = 'i'; + break; + + case FLOAT_osc: + typeTags[i+1] = 'f'; + break; + + case STRING_osc: + typeTags[i+1] = 's'; + break; + + default: + error("Unrecognized arg type (not exiting)"); + return(wmERROR); + } + } + typeTags[i+1] = '\0'; + + returnVal = OSC_writeAddressAndTypes(buf, messageName, typeTags); + if (returnVal) { + post("Problem writing address: %s\n", OSC_errorMessage); + } + } + + for (j = 0; j < numArgs; j++) { + switch (args[j].type) { + case INT_osc: + if ((returnVal = OSC_writeIntArg(buf, args[j].datum.i)) != 0) { + return returnVal; + } + break; + + case FLOAT_osc: + if ((returnVal = OSC_writeFloatArg(buf, args[j].datum.f)) != 0) { + return returnVal; + } + break; + + case STRING_osc: + if ((returnVal = OSC_writeStringArg(buf, args[j].datum.s)) != 0) { + return returnVal; + } + break; + + default: + error("Unrecognized arg type (not exiting)"); + returnVal = wmERROR; + } + } + return returnVal; +} + +void SendBuffer(void *htmsocket, OSCbuf *buf) { +#ifdef DEBUG + printf("Sending buffer...\n"); +#endif + if (OSC_isBufferEmpty(buf)) { + post("SendBuffer() called but buffer empty"); + return; + } + if (!OSC_isBufferDone(buf)) { + error("SendBuffer() called but buffer not ready!, not exiting"); + return; //{{raf}} + } + SendData(htmsocket, OSC_packetSize(buf), OSC_getPacket(buf)); +} + +void SendData(void *htmsocket, int size, char *data) { + if (!SendHTMSocket(htmsocket, size, data)) { + post("SendData::SendHTMSocket()failure -- not connected"); + CloseHTMSocket(htmsocket); + } +} + + + +/* ---------------------- + OSC-client code + + */ + +/* Here are the possible values of the state field: */ + +#define EMPTY 0 /* Nothing written to packet yet */ +#define ONE_MSG_ARGS 1 /* Packet has a single message; gathering arguments */ +#define NEED_COUNT 2 /* Just opened a bundle; must write message name or + open another bundle */ +#define GET_ARGS 3 /* Getting arguments to a message. If we see a message + name or a bundle open/close then the current message + will end. */ +#define DONE 4 /* All open bundles have been closed, so can't write + anything else */ + +#ifdef WIN32 + #include + #include + #include + #include + #include + #include + #include +#endif + +#ifdef __APPLE__ + #include +#endif + +#ifdef unix + #include + #include +#endif + + +char *OSC_errorMessage; + +static int OSC_padString(char *dest, char *str); +static int OSC_padStringWithAnExtraStupidComma(char *dest, char *str); +static int OSC_WritePadding(char *dest, int i); +static int CheckTypeTag(OSCbuf *buf, char expectedType); + +void OSC_initBuffer(OSCbuf *buf, int size, char *byteArray) { + buf->buffer = byteArray; + buf->size = size; + OSC_resetBuffer(buf); +} + +void OSC_resetBuffer(OSCbuf *buf) { + buf->bufptr = buf->buffer; + buf->state = EMPTY; + buf->bundleDepth = 0; + buf->prevCounts[0] = 0; + buf->gettingFirstUntypedArg = 0; + buf->typeStringPtr = 0; +} + +int OSC_isBufferEmpty(OSCbuf *buf) { + return buf->bufptr == buf->buffer; +} + +int OSC_freeSpaceInBuffer(OSCbuf *buf) { + return buf->size - (buf->bufptr - buf->buffer); +} + +int OSC_isBufferDone(OSCbuf *buf) { + return (buf->state == DONE || buf->state == ONE_MSG_ARGS); +} + +char *OSC_getPacket(OSCbuf *buf) { +#ifdef ERROR_CHECK_GETPACKET + if (buf->state == DONE || buf->state == ONE_MSG_ARGS) { + return buf->buffer; + } else { + OSC_errorMessage = "Packet has unterminated bundles"; + return 0; + } +#else + return buf->buffer; +#endif +} + +int OSC_packetSize(OSCbuf *buf) { +#ifdef ERROR_CHECK_PACKETSIZE + if (buf->state == DONE || buf->state == ONE_MSG_ARGS) { + return (buf->bufptr - buf->buffer); + } else { + OSC_errorMessage = "Packet has unterminated bundles"; + return 0; + } +#else + return (buf->bufptr - buf->buffer); +#endif +} + +#define CheckOverflow(buf, bytesNeeded) { if ((bytesNeeded) > OSC_freeSpaceInBuffer(buf)) {OSC_errorMessage = "buffer overflow"; return 1;}} + +static void PatchMessageSize(OSCbuf *buf) { + int4byte size; + size = buf->bufptr - ((char *) buf->thisMsgSize) - 4; + *(buf->thisMsgSize) = htonl(size); +} + +int OSC_openBundle(OSCbuf *buf, OSCTimeTag tt) { + if (buf->state == ONE_MSG_ARGS) { + OSC_errorMessage = "Can't open a bundle in a one-message packet"; + return 3; + } + + if (buf->state == DONE) { + OSC_errorMessage = "This packet is finished; can't open a new bundle"; + return 4; + } + + if (++(buf->bundleDepth) >= MAX_BUNDLE_NESTING) { + OSC_errorMessage = "Bundles nested too deeply; change MAX_BUNDLE_NESTING in OpenSoundControl.h"; + return 2; + } + + if (CheckTypeTag(buf, '\0')) return 9; + + if (buf->state == GET_ARGS) { + PatchMessageSize(buf); + } + + if (buf->state == EMPTY) { + /* Need 16 bytes for "#bundle" and time tag */ + CheckOverflow(buf, 16); + } else { + /* This bundle is inside another bundle, so we need to leave + a blank size count for the size of this current bundle. */ + CheckOverflow(buf, 20); + *((int4byte *)buf->bufptr) = 0xaaaaaaaa; + buf->prevCounts[buf->bundleDepth] = (int4byte *)buf->bufptr; + + buf->bufptr += 4; + } + + buf->bufptr += OSC_padString(buf->bufptr, "#bundle"); + + + *((OSCTimeTag *) buf->bufptr) = tt; + + if (htonl(1) != 1) { + /* Byte swap the 8-byte integer time tag */ + int4byte *intp = (int4byte *)buf->bufptr; + intp[0] = htonl(intp[0]); + intp[1] = htonl(intp[1]); + +#ifdef HAS8BYTEINT + { /* tt is a 64-bit int so we have to swap the two 32-bit words. + (Otherwise tt is a struct of two 32-bit words, and even though + each word was wrong-endian, they were in the right order + in the struct.) */ + int4byte temp = intp[0]; + intp[0] = intp[1]; + intp[1] = temp; + } +#endif + } + + buf->bufptr += sizeof(OSCTimeTag); + + buf->state = NEED_COUNT; + + buf->gettingFirstUntypedArg = 0; + buf->typeStringPtr = 0; + return 0; +} + + +int OSC_closeBundle(OSCbuf *buf) { + if (buf->bundleDepth == 0) { + /* This handles EMPTY, ONE_MSG, ARGS, and DONE */ + OSC_errorMessage = "Can't close bundle; no bundle is open!"; + return 5; + } + + if (CheckTypeTag(buf, '\0')) return 9; + + if (buf->state == GET_ARGS) { + PatchMessageSize(buf); + } + + if (buf->bundleDepth == 1) { + /* Closing the last bundle: No bundle size to patch */ + buf->state = DONE; + } else { + /* Closing a sub-bundle: patch bundle size */ + int size = buf->bufptr - ((char *) buf->prevCounts[buf->bundleDepth]) - 4; + *(buf->prevCounts[buf->bundleDepth]) = htonl(size); + buf->state = NEED_COUNT; + } + + --buf->bundleDepth; + buf->gettingFirstUntypedArg = 0; + buf->typeStringPtr = 0; + return 0; +} + + +int OSC_closeAllBundles(OSCbuf *buf) { + if (buf->bundleDepth == 0) { + /* This handles EMPTY, ONE_MSG, ARGS, and DONE */ + OSC_errorMessage = "Can't close all bundles; no bundle is open!"; + return 6; + } + + if (CheckTypeTag(buf, '\0')) return 9; + + while (buf->bundleDepth > 0) { + OSC_closeBundle(buf); + } + buf->typeStringPtr = 0; + return 0; +} + +int OSC_writeAddress(OSCbuf *buf, char *name) { + int4byte paddedLength; + + if (buf->state == ONE_MSG_ARGS) { + OSC_errorMessage = "This packet is not a bundle, so you can't write another address"; + return 7; + } + + if (buf->state == DONE) { + OSC_errorMessage = "This packet is finished; can't write another address"; + return 8; + } + + if (CheckTypeTag(buf, '\0')) return 9; + + paddedLength = OSC_effectiveStringLength(name); + + if (buf->state == EMPTY) { + /* This will be a one-message packet, so no sizes to worry about */ + CheckOverflow(buf, paddedLength); + buf->state = ONE_MSG_ARGS; + } else { + /* GET_ARGS or NEED_COUNT */ + CheckOverflow(buf, 4+paddedLength); + if (buf->state == GET_ARGS) { + /* Close the old message */ + PatchMessageSize(buf); + } + buf->thisMsgSize = (int4byte *)buf->bufptr; + *(buf->thisMsgSize) = 0xbbbbbbbb; + buf->bufptr += 4; + buf->state = GET_ARGS; + } + + /* Now write the name */ + buf->bufptr += OSC_padString(buf->bufptr, name); + buf->typeStringPtr = 0; + buf->gettingFirstUntypedArg = 1; + + return 0; +} + +int OSC_writeAddressAndTypes(OSCbuf *buf, char *name, char *types) { + int result; + int4byte paddedLength; + + if (CheckTypeTag(buf, '\0')) return 9; + + result = OSC_writeAddress(buf, name); + + if (result) return result; + + paddedLength = OSC_effectiveStringLength(types); + + CheckOverflow(buf, paddedLength); + + buf->typeStringPtr = buf->bufptr + 1; /* skip comma */ + buf->bufptr += OSC_padString(buf->bufptr, types); + + buf->gettingFirstUntypedArg = 0; + return 0; +} + +static int CheckTypeTag(OSCbuf *buf, char expectedType) { + if (buf->typeStringPtr) { + if (*(buf->typeStringPtr) != expectedType) { + if (expectedType == '\0') { + OSC_errorMessage = + "According to the type tag I expected more arguments."; + } else if (*(buf->typeStringPtr) == '\0') { + OSC_errorMessage = + "According to the type tag I didn't expect any more arguments."; + } else { + OSC_errorMessage = + "According to the type tag I expected an argument of a different type."; + printf("* Expected %c, string now %s\n", expectedType, buf->typeStringPtr); + } + return 9; + } + ++(buf->typeStringPtr); + } + return 0; +} + + +int OSC_writeFloatArg(OSCbuf *buf, float arg) { + int4byte *intp; + //int result; + + CheckOverflow(buf, 4); + + if (CheckTypeTag(buf, 'f')) return 9; + + /* Pretend arg is a long int so we can use htonl() */ + intp = ((int4byte *) &arg); + *((int4byte *) buf->bufptr) = htonl(*intp); + + buf->bufptr += 4; + + buf->gettingFirstUntypedArg = 0; + return 0; +} + + + +int OSC_writeFloatArgs(OSCbuf *buf, int numFloats, float *args) { + int i; + int4byte *intp; + + CheckOverflow(buf, 4 * numFloats); + + /* Pretend args are long ints so we can use htonl() */ + intp = ((int4byte *) args); + + for (i = 0; i < numFloats; i++) { + if (CheckTypeTag(buf, 'f')) return 9; + *((int4byte *) buf->bufptr) = htonl(intp[i]); + buf->bufptr += 4; + } + + buf->gettingFirstUntypedArg = 0; + return 0; +} + +int OSC_writeIntArg(OSCbuf *buf, int4byte arg) { + CheckOverflow(buf, 4); + if (CheckTypeTag(buf, 'i')) return 9; + + *((int4byte *) buf->bufptr) = htonl(arg); + buf->bufptr += 4; + + buf->gettingFirstUntypedArg = 0; + return 0; +} + +int OSC_writeStringArg(OSCbuf *buf, char *arg) { + int len; + + if (CheckTypeTag(buf, 's')) return 9; + + len = OSC_effectiveStringLength(arg); + + if (buf->gettingFirstUntypedArg && arg[0] == ',') { + /* This un-type-tagged message starts with a string + that starts with a comma, so we have to escape it + (with a double comma) so it won't look like a type + tag string. */ + + CheckOverflow(buf, len+4); /* Too conservative */ + buf->bufptr += + OSC_padStringWithAnExtraStupidComma(buf->bufptr, arg); + + } else { + CheckOverflow(buf, len); + buf->bufptr += OSC_padString(buf->bufptr, arg); + } + + buf->gettingFirstUntypedArg = 0; + return 0; + +} + +/* String utilities */ + +#define STRING_ALIGN_PAD 4 +int OSC_effectiveStringLength(char *string) { + int len = strlen(string) + 1; /* We need space for the null char. */ + + /* Round up len to next multiple of STRING_ALIGN_PAD to account for alignment padding */ + if ((len % STRING_ALIGN_PAD) != 0) { + len += STRING_ALIGN_PAD - (len % STRING_ALIGN_PAD); + } + return len; +} + +static int OSC_padString(char *dest, char *str) { + int i; + + for (i = 0; str[i] != '\0'; i++) { + dest[i] = str[i]; + } + + return OSC_WritePadding(dest, i); +} + +static int OSC_padStringWithAnExtraStupidComma(char *dest, char *str) { + int i; + + dest[0] = ','; + for (i = 0; str[i] != '\0'; i++) { + dest[i+1] = str[i]; + } + + return OSC_WritePadding(dest, i+1); +} + +static int OSC_WritePadding(char *dest, int i) { + dest[i] = '\0'; + i++; + + for (; (i % STRING_ALIGN_PAD) != 0; i++) { + dest[i] = '\0'; + } + + return i; +} + diff --git a/apps/plugins/pdbox/PDa/extra/shell.c b/apps/plugins/pdbox/PDa/extra/shell.c index dd6b0e239d..51abc134bd 100644 --- a/apps/plugins/pdbox/PDa/extra/shell.c +++ b/apps/plugins/pdbox/PDa/extra/shell.c @@ -1,312 +1,312 @@ -/* (C) Guenter Geiger */ - -#include "m_pd.h" -#ifdef NT -#pragma warning( disable : 4244 ) -#pragma warning( disable : 4305 ) -#endif - -#include -#include -#include -#include -#include -#include -#include -#include - -void sys_rmpollfn(int fd); -void sys_addpollfn(int fd, void* fn, void *ptr); - -/* ------------------------ shell ----------------------------- */ - -#define INBUFSIZE 1024 - -static t_class *shell_class; - - -static void drop_priority(void) -{ -#ifdef _POSIX_PRIORITY_SCHEDULING - struct sched_param par; - int p1 ,p2, p3; - par.sched_priority = 0; - sched_setscheduler(0,SCHED_OTHER,&par); -#endif -} - - -typedef struct _shell -{ - t_object x_obj; - int x_echo; - char *sr_inbuf; - int sr_inhead; - int sr_intail; - void* x_binbuf; - int fdpipe[2]; - int fdinpipe[2]; - int pid; - int x_del; - t_outlet* x_done; - t_clock* x_clock; -} t_shell; - -static int shell_pid; - - -void shell_cleanup(t_shell* x) -{ - sys_rmpollfn(x->fdpipe[0]); - - if (x->fdpipe[0]>0) close(x->fdpipe[0]); - if (x->fdpipe[1]>0) close(x->fdpipe[1]); - if (x->fdinpipe[0]>0) close(x->fdinpipe[0]); - if (x->fdinpipe[1]>0) close(x->fdinpipe[1]); - - x->fdpipe[0] = -1; - x->fdpipe[1] = -1; - x->fdinpipe[0] = -1; - x->fdinpipe[1] = -1; - clock_unset(x->x_clock); -} - -void shell_check(t_shell* x) -{ - int ret; - int status; - ret = waitpid(x->pid,&status,WNOHANG); - if (ret == x->pid) { - shell_cleanup(x); - if (WIFEXITED(status)) { - outlet_float(x->x_done,WEXITSTATUS(status)); - } - else outlet_float(x->x_done,0); - } - else { - if (x->x_del < 100) x->x_del+=2; /* increment poll times */ - clock_delay(x->x_clock,x->x_del); - } -} - - -void shell_bang(t_shell *x) -{ - post("bang"); -} - -/* snippet from pd's code */ -static void shell_doit(void *z, t_binbuf *b) -{ - t_shell *x = (t_shell *)z; - int msg, natom = binbuf_getnatom(b); - t_atom *at = binbuf_getvec(b); - - for (msg = 0; msg < natom;) - { - int emsg; - for (emsg = msg; emsg < natom && at[emsg].a_type != A_COMMA - && at[emsg].a_type != A_SEMI; emsg++) - ; - if (emsg > msg) - { - int i; - for (i = msg; i < emsg; i++) - if (at[i].a_type == A_DOLLAR || at[i].a_type == A_DOLLSYM) - { - pd_error(x, "netreceive: got dollar sign in message"); - goto nodice; - } - if (at[msg].a_type == A_FLOAT) - { - if (emsg > msg + 1) - outlet_list(x->x_obj.ob_outlet, 0, emsg-msg, at + msg); - else outlet_float(x->x_obj.ob_outlet, at[msg].a_w.w_float); - } - else if (at[msg].a_type == A_SYMBOL) - outlet_anything(x->x_obj.ob_outlet, at[msg].a_w.w_symbol, - emsg-msg-1, at + msg + 1); - } - nodice: - msg = emsg + 1; - } -} - - -void shell_read(t_shell *x, int fd) -{ - char buf[INBUFSIZE]; - t_binbuf* bbuf = binbuf_new(); - int i; - int readto = - (x->sr_inhead >= x->sr_intail ? INBUFSIZE : x->sr_intail-1); - int ret; - - ret = read(fd, buf,INBUFSIZE-1); - buf[ret] = '\0'; - - for (i=0;ifdpipe[0] = -1; - close(fd); - return; - } - else if (ret == 0) - { - post("EOF on socket %d\n", fd); - sys_rmpollfn(fd); - x->fdpipe[0] = -1; - close(fd); - return; - } - else - { - int natom; - t_atom *at; - binbuf_text(bbuf, buf, strlen(buf)); - - natom = binbuf_getnatom(bbuf); - at = binbuf_getvec(bbuf); - shell_doit(x,bbuf); - } - binbuf_free(bbuf); -} - - -static void shell_send(t_shell *x, t_symbol *s,int ac, t_atom *at) -{ - int i; - char tmp[MAXPDSTRING]; - int size = 0; - - if (x->fdinpipe[0] == -1) return; /* nothing to send to */ - - for (i=0;ifdinpipe[0],tmp,strlen(tmp)); -} - -static void shell_anything(t_shell *x, t_symbol *s, int ac, t_atom *at) -{ - int i; - char* argv[20]; - t_symbol* sym; - - if (!strcmp(s->s_name,"send")) { - post("send"); - shell_send(x,s,ac,at); - return; - } - - argv[0] = s->s_name; - - if (x->fdpipe[0] != -1) { - post("shell: old process still running"); - kill(x->pid,SIGKILL); - shell_cleanup(x); - } - - - if (pipe(x->fdpipe) < 0) { - error("unable to create pipe"); - return; - } - - if (pipe(x->fdinpipe) < 0) { - error("unable to create input pipe"); - return; - } - - - sys_addpollfn(x->fdpipe[0],shell_read,x); - - if (!(x->pid = fork())) { - int status; - char* cmd = getbytes(1024); - char* tcmd = getbytes(1024); - strcpy(cmd,s->s_name); - -#if 0 - for (i=1;i<=ac;i++) { - argv[i] = getbytes(255); - atom_string(at,argv[i],255); -/* post("argument %s",argv[i]); */ - at++; - } - argv[i] = 0; -#endif - for (i=1;i<=ac;i++) { - atom_string(at,tcmd,255); - strcat(cmd," "); - strcat(cmd,tcmd); - at++; - } - - - /* reassign stdout */ - dup2(x->fdpipe[1],1); - dup2(x->fdinpipe[1],0); - - /* drop privileges */ - drop_priority(); - seteuid(getuid()); /* lose setuid priveliges */ - - post("executing %s",cmd); - system(cmd); -// execvp(s->s_name,argv); - exit(0); - } - x->x_del = 4; - clock_delay(x->x_clock,x->x_del); - - if (x->x_echo) - outlet_anything(x->x_obj.ob_outlet, s, ac, at); -} - - - -void shell_free(t_shell* x) -{ - binbuf_free(x->x_binbuf); -} - -static void *shell_new(void) -{ - t_shell *x = (t_shell *)pd_new(shell_class); - - x->x_echo = 0; - x->fdpipe[0] = -1; - x->fdpipe[1] = -1; - x->fdinpipe[0] = -1; - x->fdinpipe[1] = -1; - - x->sr_inhead = x->sr_intail = 0; - if (!(x->sr_inbuf = (char*) malloc(INBUFSIZE))) bug("t_shell");; - - x->x_binbuf = binbuf_new(); - - outlet_new(&x->x_obj, &s_list); - x->x_done = outlet_new(&x->x_obj, &s_bang); - x->x_clock = clock_new(x, (t_method) shell_check); - return (x); -} - -void shell_setup(void) -{ - shell_class = class_new(gensym("shell"), (t_newmethod)shell_new, - (t_method)shell_free,sizeof(t_shell), 0,0); - class_addbang(shell_class,shell_bang); - class_addanything(shell_class, shell_anything); -} - +/* (C) Guenter Geiger */ + +#include "m_pd.h" +#ifdef NT +#pragma warning( disable : 4244 ) +#pragma warning( disable : 4305 ) +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +void sys_rmpollfn(int fd); +void sys_addpollfn(int fd, void* fn, void *ptr); + +/* ------------------------ shell ----------------------------- */ + +#define INBUFSIZE 1024 + +static t_class *shell_class; + + +static void drop_priority(void) +{ +#ifdef _POSIX_PRIORITY_SCHEDULING + struct sched_param par; + int p1 ,p2, p3; + par.sched_priority = 0; + sched_setscheduler(0,SCHED_OTHER,&par); +#endif +} + + +typedef struct _shell +{ + t_object x_obj; + int x_echo; + char *sr_inbuf; + int sr_inhead; + int sr_intail; + void* x_binbuf; + int fdpipe[2]; + int fdinpipe[2]; + int pid; + int x_del; + t_outlet* x_done; + t_clock* x_clock; +} t_shell; + +static int shell_pid; + + +void shell_cleanup(t_shell* x) +{ + sys_rmpollfn(x->fdpipe[0]); + + if (x->fdpipe[0]>0) close(x->fdpipe[0]); + if (x->fdpipe[1]>0) close(x->fdpipe[1]); + if (x->fdinpipe[0]>0) close(x->fdinpipe[0]); + if (x->fdinpipe[1]>0) close(x->fdinpipe[1]); + + x->fdpipe[0] = -1; + x->fdpipe[1] = -1; + x->fdinpipe[0] = -1; + x->fdinpipe[1] = -1; + clock_unset(x->x_clock); +} + +void shell_check(t_shell* x) +{ + int ret; + int status; + ret = waitpid(x->pid,&status,WNOHANG); + if (ret == x->pid) { + shell_cleanup(x); + if (WIFEXITED(status)) { + outlet_float(x->x_done,WEXITSTATUS(status)); + } + else outlet_float(x->x_done,0); + } + else { + if (x->x_del < 100) x->x_del+=2; /* increment poll times */ + clock_delay(x->x_clock,x->x_del); + } +} + + +void shell_bang(t_shell *x) +{ + post("bang"); +} + +/* snippet from pd's code */ +static void shell_doit(void *z, t_binbuf *b) +{ + t_shell *x = (t_shell *)z; + int msg, natom = binbuf_getnatom(b); + t_atom *at = binbuf_getvec(b); + + for (msg = 0; msg < natom;) + { + int emsg; + for (emsg = msg; emsg < natom && at[emsg].a_type != A_COMMA + && at[emsg].a_type != A_SEMI; emsg++) + ; + if (emsg > msg) + { + int i; + for (i = msg; i < emsg; i++) + if (at[i].a_type == A_DOLLAR || at[i].a_type == A_DOLLSYM) + { + pd_error(x, "netreceive: got dollar sign in message"); + goto nodice; + } + if (at[msg].a_type == A_FLOAT) + { + if (emsg > msg + 1) + outlet_list(x->x_obj.ob_outlet, 0, emsg-msg, at + msg); + else outlet_float(x->x_obj.ob_outlet, at[msg].a_w.w_float); + } + else if (at[msg].a_type == A_SYMBOL) + outlet_anything(x->x_obj.ob_outlet, at[msg].a_w.w_symbol, + emsg-msg-1, at + msg + 1); + } + nodice: + msg = emsg + 1; + } +} + + +void shell_read(t_shell *x, int fd) +{ + char buf[INBUFSIZE]; + t_binbuf* bbuf = binbuf_new(); + int i; + int readto = + (x->sr_inhead >= x->sr_intail ? INBUFSIZE : x->sr_intail-1); + int ret; + + ret = read(fd, buf,INBUFSIZE-1); + buf[ret] = '\0'; + + for (i=0;ifdpipe[0] = -1; + close(fd); + return; + } + else if (ret == 0) + { + post("EOF on socket %d\n", fd); + sys_rmpollfn(fd); + x->fdpipe[0] = -1; + close(fd); + return; + } + else + { + int natom; + t_atom *at; + binbuf_text(bbuf, buf, strlen(buf)); + + natom = binbuf_getnatom(bbuf); + at = binbuf_getvec(bbuf); + shell_doit(x,bbuf); + } + binbuf_free(bbuf); +} + + +static void shell_send(t_shell *x, t_symbol *s,int ac, t_atom *at) +{ + int i; + char tmp[MAXPDSTRING]; + int size = 0; + + if (x->fdinpipe[0] == -1) return; /* nothing to send to */ + + for (i=0;ifdinpipe[0],tmp,strlen(tmp)); +} + +static void shell_anything(t_shell *x, t_symbol *s, int ac, t_atom *at) +{ + int i; + char* argv[20]; + t_symbol* sym; + + if (!strcmp(s->s_name,"send")) { + post("send"); + shell_send(x,s,ac,at); + return; + } + + argv[0] = s->s_name; + + if (x->fdpipe[0] != -1) { + post("shell: old process still running"); + kill(x->pid,SIGKILL); + shell_cleanup(x); + } + + + if (pipe(x->fdpipe) < 0) { + error("unable to create pipe"); + return; + } + + if (pipe(x->fdinpipe) < 0) { + error("unable to create input pipe"); + return; + } + + + sys_addpollfn(x->fdpipe[0],shell_read,x); + + if (!(x->pid = fork())) { + int status; + char* cmd = getbytes(1024); + char* tcmd = getbytes(1024); + strcpy(cmd,s->s_name); + +#if 0 + for (i=1;i<=ac;i++) { + argv[i] = getbytes(255); + atom_string(at,argv[i],255); +/* post("argument %s",argv[i]); */ + at++; + } + argv[i] = 0; +#endif + for (i=1;i<=ac;i++) { + atom_string(at,tcmd,255); + strcat(cmd," "); + strcat(cmd,tcmd); + at++; + } + + + /* reassign stdout */ + dup2(x->fdpipe[1],1); + dup2(x->fdinpipe[1],0); + + /* drop privileges */ + drop_priority(); + seteuid(getuid()); /* lose setuid priveliges */ + + post("executing %s",cmd); + system(cmd); +// execvp(s->s_name,argv); + exit(0); + } + x->x_del = 4; + clock_delay(x->x_clock,x->x_del); + + if (x->x_echo) + outlet_anything(x->x_obj.ob_outlet, s, ac, at); +} + + + +void shell_free(t_shell* x) +{ + binbuf_free(x->x_binbuf); +} + +static void *shell_new(void) +{ + t_shell *x = (t_shell *)pd_new(shell_class); + + x->x_echo = 0; + x->fdpipe[0] = -1; + x->fdpipe[1] = -1; + x->fdinpipe[0] = -1; + x->fdinpipe[1] = -1; + + x->sr_inhead = x->sr_intail = 0; + if (!(x->sr_inbuf = (char*) malloc(INBUFSIZE))) bug("t_shell");; + + x->x_binbuf = binbuf_new(); + + outlet_new(&x->x_obj, &s_list); + x->x_done = outlet_new(&x->x_obj, &s_bang); + x->x_clock = clock_new(x, (t_method) shell_check); + return (x); +} + +void shell_setup(void) +{ + shell_class = class_new(gensym("shell"), (t_newmethod)shell_new, + (t_method)shell_free,sizeof(t_shell), 0,0); + class_addbang(shell_class,shell_bang); + class_addanything(shell_class, shell_anything); +} + diff --git a/apps/plugins/pdbox/PDa/intern/biquad~.c b/apps/plugins/pdbox/PDa/intern/biquad~.c index 2dc6d72071..f0a4ad2961 100644 --- a/apps/plugins/pdbox/PDa/intern/biquad~.c +++ b/apps/plugins/pdbox/PDa/intern/biquad~.c @@ -65,12 +65,17 @@ static t_int *sigbiquad_perform(t_int *w) static void sigbiquad_list(t_sigbiquad *x, t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; +#endif + float fb1 = atom_getfloatarg(0, argc, argv); float fb2 = atom_getfloatarg(1, argc, argv); float ff1 = atom_getfloatarg(2, argc, argv); float ff2 = atom_getfloatarg(3, argc, argv); float ff3 = atom_getfloatarg(4, argc, argv); float discriminant = fb1 * fb1 + 4 * fb2; + t_biquadctl *c = x->x_ctl; if (discriminant < 0) /* imaginary roots -- resonant filter */ { @@ -99,6 +104,9 @@ stable: static void sigbiquad_set(t_sigbiquad *x, t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; +#endif t_biquadctl *c = x->x_ctl; c->c_x1 = atom_getfloatarg(0, argc, argv); c->c_x2 = atom_getfloatarg(1, argc, argv); diff --git a/apps/plugins/pdbox/PDa/intern/bp~.c b/apps/plugins/pdbox/PDa/intern/bp~.c index 2c44536e8a..d9da27cc2e 100644 --- a/apps/plugins/pdbox/PDa/intern/bp~.c +++ b/apps/plugins/pdbox/PDa/intern/bp~.c @@ -81,6 +81,9 @@ static void sigbp_ft2(t_sigbp *x, t_floatarg q) static void sigbp_clear(t_sigbp *x, t_floatarg q) { +#ifdef ROCKBOX + (void) q; +#endif x->x_ctl->c_x1 = x->x_ctl->c_x2 = 0; } diff --git a/apps/plugins/pdbox/PDa/intern/cos_table.c b/apps/plugins/pdbox/PDa/intern/cos_table.c new file mode 100644 index 0000000000..7de7818ba6 --- /dev/null +++ b/apps/plugins/pdbox/PDa/intern/cos_table.c @@ -0,0 +1,2 @@ +#include "m_pd.h" +t_sample cos_table[] = {262144,262144,262144,262144,262144,262144,262144,262144,262144,262144,262144,262143,262143,262143,262143,262143,262143,262143,262142,262142,262142,262142,262142,262141,262141,262141,262141,262140,262140,262140,262140,262139,262139,262139,262138,262138,262138,262137,262137,262137,262136,262136,262135,262135,262135,262134,262134,262133,262133,262132,262132,262131,262131,262130,262130,262129,262129,262128,262128,262127,262127,262126,262125,262125,262124,262124,262123,262122,262122,262121,262120,262120,262119,262118,262118,262117,262116,262115,262115,262114,262113,262112,262112,262111,262110,262109,262108,262108,262107,262106,262105,262104,262103,262102,262101,262101,262100,262099,262098,262097,262096,262095,262094,262093,262092,262091,262090,262089,262088,262087,262086,262085,262084,262082,262081,262080,262079,262078,262077,262076,262075,262073,262072,262071,262070,262069,262067,262066,262065,262064,262063,262061,262060,262059,262057,262056,262055,262054,262052,262051,262050,262048,262047,262045,262044,262043,262041,262040,262038,262037,262036,262034,262033,262031,262030,262028,262027,262025,262024,262022,262021,262019,262018,262016,262014,262013,262011,262010,262008,262006,262005,262003,262001,262000,261998,261996,261995,261993,261991,261990,261988,261986,261984,261983,261981,261979,261977,261975,261974,261972,261970,261968,261966,261965,261963,261961,261959,261957,261955,261953,261951,261949,261947,261945,261943,261942,261940,261938,261936,261934,261932,261929,261927,261925,261923,261921,261919,261917,261915,261913,261911,261909,261907,261904,261902,261900,261898,261896,261894,261891,261889,261887,261885,261882,261880,261878,261876,261873,261871,261869,261866,261864,261862,261859,261857,261855,261852,261850,261848,261845,261843,261840,261838,261836,261833,261831,261828,261826,261823,261821,261818,261816,261813,261811,261808,261806,261803,261801,261798,261795,261793,261790,261788,261785,261782,261780,261777,261774,261772,261769,261766,261764,261761,261758,261755,261753,261750,261747,261744,261742,261739,261736,261733,261730,261728,261725,261722,261719,261716,261713,261710,261708,261705,261702,261699,261696,261693,261690,261687,261684,261681,261678,261675,261672,261669,261666,261663,261660,261657,261654,261651,261648,261644,261641,261638,261635,261632,261629,261626,261623,261619,261616,261613,261610,261607,261603,261600,261597,261594,261590,261587,261584,261581,261577,261574,261571,261567,261564,261561,261557,261554,261551,261547,261544,261540,261537,261533,261530,261527,261523,261520,261516,261513,261509,261506,261502,261499,261495,261492,261488,261485,261481,261477,261474,261470,261467,261463,261459,261456,261452,261448,261445,261441,261437,261434,261430,261426,261423,261419,261415,261411,261408,261404,261400,261396,261392,261389,261385,261381,261377,261373,261369,261366,261362,261358,261354,261350,261346,261342,261338,261334,261330,261326,261322,261318,261314,261310,261306,261302,261298,261294,261290,261286,261282,261278,261274,261270,261266,261262,261258,261253,261249,261245,261241,261237,261233,261228,261224,261220,261216,261212,261207,261203,261199,261195,261190,261186,261182,261177,261173,261169,261164,261160,261156,261151,261147,261143,261138,261134,261129,261125,261120,261116,261112,261107,261103,261098,261094,261089,261085,261080,261076,261071,261067,261062,261057,261053,261048,261044,261039,261034,261030,261025,261021,261016,261011,261007,261002,260997,260992,260988,260983,260978,260974,260969,260964,260959,260955,260950,260945,260940,260935,260930,260926,260921,260916,260911,260906,260901,260896,260892,260887,260882,260877,260872,260867,260862,260857,260852,260847,260842,260837,260832,260827,260822,260817,260812,260807,260802,260797,260791,260786,260781,260776,260771,260766,260761,260756,260750,260745,260740,260735,260730,260724,260719,260714,260709,260703,260698,260693,260688,260682,260677,260672,260666,260661,260656,260650,260645,260640,260634,260629,260623,260618,260613,260607,260602,260596,260591,260585,260580,260574,260569,260563,260558,260552,260547,260541,260536,260530,260525,260519,260513,260508,260502,260496,260491,260485,260480,260474,260468,260463,260457,260451,260445,260440,260434,260428,260423,260417,260411,260405,260399,260394,260388,260382,260376,260370,260365,260359,260353,260347,260341,260335,260329,260323,260317,260312,260306,260300,260294,260288,260282,260276,260270,260264,260258,260252,260246,260240,260234,260228,260221,260215,260209,260203,260197,260191,260185,260179,260173,260166,260160,260154,260148,260142,260135,260129,260123,260117,260111,260104,260098,260092,260085,260079,260073,260067,260060,260054,260048,260041,260035,260029,260022,260016,260009,260003,259997,259990,259984,259977,259971,259964,259958,259951,259945,259938,259932,259925,259919,259912,259906,259899,259893,259886,259879,259873,259866,259860,259853,259846,259840,259833,259826,259820,259813,259806,259800,259793,259786,259779,259773,259766,259759,259752,259746,259739,259732,259725,259718,259712,259705,259698,259691,259684,259677,259670,259664,259657,259650,259643,259636,259629,259622,259615,259608,259601,259594,259587,259580,259573,259566,259559,259552,259545,259538,259531,259524,259517,259509,259502,259495,259488,259481,259474,259467,259459,259452,259445,259438,259431,259423,259416,259409,259402,259395,259387,259380,259373,259365,259358,259351,259343,259336,259329,259321,259314,259307,259299,259292,259285,259277,259270,259262,259255,259247,259240,259232,259225,259217,259210,259202,259195,259187,259180,259172,259165,259157,259150,259142,259135,259127,259119,259112,259104,259096,259089,259081,259073,259066,259058,259050,259043,259035,259027,259020,259012,259004,258996,258989,258981,258973,258965,258957,258950,258942,258934,258926,258918,258910,258902,258895,258887,258879,258871,258863,258855,258847,258839,258831,258823,258815,258807,258799,258791,258783,258775,258767,258759,258751,258743,258735,258727,258719,258711,258702,258694,258686,258678,258670,258662,258654,258645,258637,258629,258621,258613,258604,258596,258588,258580,258571,258563,258555,258546,258538,258530,258522,258513,258505,258496,258488,258480,258471,258463,258455,258446,258438,258429,258421,258412,258404,258396,258387,258379,258370,258362,258353,258345,258336,258327,258319,258310,258302,258293,258285,258276,258267,258259,258250,258242,258233,258224,258216,258207,258198,258190,258181,258172,258163,258155,258146,258137,258128,258120,258111,258102,258093,258084,258076,258067,258058,258049,258040,258031,258023,258014,258005,257996,257987,257978,257969,257960,257951,257942,257933,257924,257915,257906,257897,257888,257879,257870,257861,257852,257843,257834,257825,257816,257807,257798,257789,257779,257770,257761,257752,257743,257734,257724,257715,257706,257697,257688,257678,257669,257660,257651,257641,257632,257623,257613,257604,257595,257585,257576,257567,257557,257548,257539,257529,257520,257510,257501,257492,257482,257473,257463,257454,257444,257435,257425,257416,257406,257397,257387,257378,257368,257359,257349,257340,257330,257320,257311,257301,257292,257282,257272,257263,257253,257243,257234,257224,257214,257205,257195,257185,257175,257166,257156,257146,257136,257127,257117,257107,257097,257087,257078,257068,257058,257048,257038,257028,257018,257008,256999,256989,256979,256969,256959,256949,256939,256929,256919,256909,256899,256889,256879,256869,256859,256849,256839,256829,256819,256809,256798,256788,256778,256768,256758,256748,256738,256728,256717,256707,256697,256687,256677,256666,256656,256646,256636,256625,256615,256605,256595,256584,256574,256564,256553,256543,256533,256522,256512,256502,256491,256481,256470,256460,256450,256439,256429,256418,256408,256397,256387,256376,256366,256355,256345,256334,256324,256313,256303,256292,256282,256271,256261,256250,256239,256229,256218,256207,256197,256186,256176,256165,256154,256143,256133,256122,256111,256101,256090,256079,256068,256058,256047,256036,256025,256014,256004,255993,255982,255971,255960,255949,255939,255928,255917,255906,255895,255884,255873,255862,255851,255840,255829,255818,255807,255796,255785,255774,255763,255752,255741,255730,255719,255708,255697,255686,255675,255664,255653,255642,255630,255619,255608,255597,255586,255575,255564,255552,255541,255530,255519,255507,255496,255485,255474,255462,255451,255440,255429,255417,255406,255395,255383,255372,255361,255349,255338,255326,255315,255304,255292,255281,255269,255258,255246,255235,255224,255212,255201,255189,255178,255166,255155,255143,255131,255120,255108,255097,255085,255074,255062,255050,255039,255027,255015,255004,254992,254981,254969,254957,254945,254934,254922,254910,254899,254887,254875,254863,254852,254840,254828,254816,254804,254793,254781,254769,254757,254745,254733,254721,254710,254698,254686,254674,254662,254650,254638,254626,254614,254602,254590,254578,254566,254554,254542,254530,254518,254506,254494,254482,254470,254458,254446,254434,254422,254410,254397,254385,254373,254361,254349,254337,254324,254312,254300,254288,254276,254263,254251,254239,254227,254214,254202,254190,254178,254165,254153,254141,254128,254116,254104,254091,254079,254067,254054,254042,254029,254017,254004,253992,253980,253967,253955,253942,253930,253917,253905,253892,253880,253867,253855,253842,253830,253817,253804,253792,253779,253767,253754,253741,253729,253716,253704,253691,253678,253666,253653,253640,253627,253615,253602,253589,253577,253564,253551,253538,253525,253513,253500,253487,253474,253461,253449,253436,253423,253410,253397,253384,253371,253359,253346,253333,253320,253307,253294,253281,253268,253255,253242,253229,253216,253203,253190,253177,253164,253151,253138,253125,253112,253099,253085,253072,253059,253046,253033,253020,253007,252994,252980,252967,252954,252941,252928,252914,252901,252888,252875,252861,252848,252835,252822,252808,252795,252782,252768,252755,252742,252728,252715,252702,252688,252675,252662,252648,252635,252621,252608,252594,252581,252568,252554,252541,252527,252514,252500,252487,252473,252460,252446,252432,252419,252405,252392,252378,252365,252351,252337,252324,252310,252296,252283,252269,252255,252242,252228,252214,252201,252187,252173,252159,252146,252132,252118,252104,252091,252077,252063,252049,252035,252022,252008,251994,251980,251966,251952,251938,251925,251911,251897,251883,251869,251855,251841,251827,251813,251799,251785,251771,251757,251743,251729,251715,251701,251687,251673,251659,251645,251631,251617,251602,251588,251574,251560,251546,251532,251518,251503,251489,251475,251461,251447,251432,251418,251404,251390,251375,251361,251347,251333,251318,251304,251290,251275,251261,251247,251232,251218,251204,251189,251175,251161,251146,251132,251117,251103,251088,251074,251060,251045,251031,251016,251002,250987,250973,250958,250944,250929,250914,250900,250885,250871,250856,250842,250827,250812,250798,250783,250768,250754,250739,250724,250710,250695,250680,250666,250651,250636,250622,250607,250592,250577,250562,250548,250533,250518,250503,250489,250474,250459,250444,250429,250414,250399,250385,250370,250355,250340,250325,250310,250295,250280,250265,250250,250235,250220,250205,250190,250175,250160,250145,250130,250115,250100,250085,250070,250055,250040,250025,250009,249994,249979,249964,249949,249934,249919,249903,249888,249873,249858,249843,249827,249812,249797,249782,249766,249751,249736,249721,249705,249690,249675,249659,249644,249629,249613,249598,249583,249567,249552,249536,249521,249506,249490,249475,249459,249444,249428,249413,249398,249382,249367,249351,249335,249320,249304,249289,249273,249258,249242,249227,249211,249195,249180,249164,249149,249133,249117,249102,249086,249070,249055,249039,249023,249008,248992,248976,248960,248945,248929,248913,248897,248882,248866,248850,248834,248818,248803,248787,248771,248755,248739,248723,248707,248691,248676,248660,248644,248628,248612,248596,248580,248564,248548,248532,248516,248500,248484,248468,248452,248436,248420,248404,248388,248372,248356,248340,248323,248307,248291,248275,248259,248243,248227,248211,248194,248178,248162,248146,248130,248113,248097,248081,248065,248048,248032,248016,248000,247983,247967,247951,247934,247918,247902,247885,247869,247853,247836,247820,247803,247787,247771,247754,247738,247721,247705,247688,247672,247655,247639,247622,247606,247589,247573,247556,247540,247523,247507,247490,247474,247457,247440,247424,247407,247391,247374,247357,247341,247324,247307,247291,247274,247257,247241,247224,247207,247190,247174,247157,247140,247123,247107,247090,247073,247056,247040,247023,247006,246989,246972,246955,246938,246922,246905,246888,246871,246854,246837,246820,246803,246786,246769,246752,246735,246718,246701,246684,246667,246650,246633,246616,246599,246582,246565,246548,246531,246514,246497,246480,246463,246445,246428,246411,246394,246377,246360,246342,246325,246308,246291,246274,246256,246239,246222,246205,246187,246170,246153,246136,246118,246101,246084,246066,246049,246032,246014,245997,245979,245962,245945,245927,245910,245892,245875,245858,245840,245823,245805,245788,245770,245753,245735,245718,245700,245683,245665,245648,245630,245613,245595,245577,245560,245542,245525,245507,245489,245472,245454,245436,245419,245401,245383,245366,245348,245330,245313,245295,245277,245259,245242,245224,245206,245188,245171,245153,245135,245117,245099,245081,245064,245046,245028,245010,244992,244974,244956,244938,244921,244903,244885,244867,244849,244831,244813,244795,244777,244759,244741,244723,244705,244687,244669,244651,244633,244615,244597,244578,244560,244542,244524,244506,244488,244470,244452,244433,244415,244397,244379,244361,244343,244324,244306,244288,244270,244251,244233,244215,244197,244178,244160,244142,244123,244105,244087,244068,244050,244032,244013,243995,243977,243958,243940,243921,243903,243885,243866,243848,243829,243811,243792,243774,243755,243737,243718,243700,243681,243663,243644,243626,243607,243588,243570,243551,243533,243514,243496,243477,243458,243440,243421,243402,243384,243365,243346,243328,243309,243290,243271,243253,243234,243215,243196,243178,243159,243140,243121,243103,243084,243065,243046,243027,243008,242990,242971,242952,242933,242914,242895,242876,242857,242838,242819,242800,242782,242763,242744,242725,242706,242687,242668,242649,242630,242611,242591,242572,242553,242534,242515,242496,242477,242458,242439,242420,242401,242381,242362,242343,242324,242305,242286,242266,242247,242228,242209,242189,242170,242151,242132,242112,242093,242074,242055,242035,242016,241997,241977,241958,241939,241919,241900,241881,241861,241842,241822,241803,241784,241764,241745,241725,241706,241686,241667,241647,241628,241608,241589,241569,241550,241530,241511,241491,241472,241452,241433,241413,241393,241374,241354,241334,241315,241295,241276,241256,241236,241217,241197,241177,241157,241138,241118,241098,241079,241059,241039,241019,241000,240980,240960,240940,240920,240901,240881,240861,240841,240821,240801,240781,240762,240742,240722,240702,240682,240662,240642,240622,240602,240582,240562,240542,240522,240502,240482,240462,240442,240422,240402,240382,240362,240342,240322,240302,240282,240262,240242,240221,240201,240181,240161,240141,240121,240101,240080,240060,240040,240020,240000,239979,239959,239939,239919,239898,239878,239858,239838,239817,239797,239777,239756,239736,239716,239695,239675,239655,239634,239614,239593,239573,239553,239532,239512,239491,239471,239450,239430,239410,239389,239369,239348,239328,239307,239287,239266,239245,239225,239204,239184,239163,239143,239122,239101,239081,239060,239040,239019,238998,238978,238957,238936,238916,238895,238874,238853,238833,238812,238791,238771,238750,238729,238708,238688,238667,238646,238625,238604,238583,238563,238542,238521,238500,238479,238458,238437,238417,238396,238375,238354,238333,238312,238291,238270,238249,238228,238207,238186,238165,238144,238123,238102,238081,238060,238039,238018,237997,237976,237955,237934,237913,237891,237870,237849,237828,237807,237786,237765,237743,237722,237701,237680,237659,237637,237616,237595,237574,237552,237531,237510,237489,237467,237446,237425,237403,237382,237361,237339,237318,237297,237275,237254,237233,237211,237190,237168,237147,237126,237104,237083,237061,237040,237018,236997,236975,236954,236932,236911,236889,236868,236846,236825,236803,236782,236760,236738,236717,236695,236674,236652,236630,236609,236587,236565,236544,236522,236500,236479,236457,236435,236414,236392,236370,236348,236327,236305,236283,236261,236240,236218,236196,236174,236152,236131,236109,236087,236065,236043,236021,235999,235978,235956,235934,235912,235890,235868,235846,235824,235802,235780,235758,235736,235714,235692,235670,235648,235626,235604,235582,235560,235538,235516,235494,235472,235450,235428,235405,235383,235361,235339,235317,235295,235273,235250,235228,235206,235184,235162,235139,235117,235095,235073,235050,235028,235006,234984,234961,234939,234917,234894,234872,234850,234828,234805,234783,234760,234738,234716,234693,234671,234649,234626,234604,234581,234559,234536,234514,234491,234469,234446,234424,234401,234379,234356,234334,234311,234289,234266,234244,234221,234199,234176,234153,234131,234108,234086,234063,234040,234018,233995,233972,233950,233927,233904,233882,233859,233836,233813,233791,233768,233745,233722,233700,233677,233654,233631,233609,233586,233563,233540,233517,233494,233472,233449,233426,233403,233380,233357,233334,233311,233288,233265,233243,233220,233197,233174,233151,233128,233105,233082,233059,233036,233013,232990,232967,232944,232920,232897,232874,232851,232828,232805,232782,232759,232736,232713,232689,232666,232643,232620,232597,232574,232550,232527,232504,232481,232457,232434,232411,232388,232364,232341,232318,232295,232271,232248,232225,232201,232178,232155,232131,232108,232085,232061,232038,232014,231991,231968,231944,231921,231897,231874,231850,231827,231804,231780,231757,231733,231710,231686,231663,231639,231615,231592,231568,231545,231521,231498,231474,231450,231427,231403,231380,231356,231332,231309,231285,231261,231238,231214,231190,231167,231143,231119,231096,231072,231048,231024,231001,230977,230953,230929,230905,230882,230858,230834,230810,230786,230762,230739,230715,230691,230667,230643,230619,230595,230571,230548,230524,230500,230476,230452,230428,230404,230380,230356,230332,230308,230284,230260,230236,230212,230188,230164,230140,230116,230091,230067,230043,230019,229995,229971,229947,229923,229898,229874,229850,229826,229802,229778,229753,229729,229705,229681,229657,229632,229608,229584,229560,229535,229511,229487,229462,229438,229414,229389,229365,229341,229316,229292,229268,229243,229219,229194,229170,229146,229121,229097,229072,229048,229024,228999,228975,228950,228926,228901,228877,228852,228828,228803,228779,228754,228729,228705,228680,228656,228631,228607,228582,228557,228533,228508,228483,228459,228434,228409,228385,228360,228335,228311,228286,228261,228237,228212,228187,228162,228138,228113,228088,228063,228039,228014,227989,227964,227939,227914,227890,227865,227840,227815,227790,227765,227740,227716,227691,227666,227641,227616,227591,227566,227541,227516,227491,227466,227441,227416,227391,227366,227341,227316,227291,227266,227241,227216,227191,227166,227141,227115,227090,227065,227040,227015,226990,226965,226940,226914,226889,226864,226839,226814,226788,226763,226738,226713,226688,226662,226637,226612,226586,226561,226536,226511,226485,226460,226435,226409,226384,226359,226333,226308,226283,226257,226232,226206,226181,226156,226130,226105,226079,226054,226028,226003,225977,225952,225926,225901,225875,225850,225824,225799,225773,225748,225722,225697,225671,225646,225620,225594,225569,225543,225517,225492,225466,225441,225415,225389,225364,225338,225312,225287,225261,225235,225209,225184,225158,225132,225106,225081,225055,225029,225003,224978,224952,224926,224900,224874,224848,224823,224797,224771,224745,224719,224693,224667,224641,224615,224590,224564,224538,224512,224486,224460,224434,224408,224382,224356,224330,224304,224278,224252,224226,224200,224174,224148,224122,224096,224069,224043,224017,223991,223965,223939,223913,223887,223860,223834,223808,223782,223756,223730,223703,223677,223651,223625,223599,223572,223546,223520,223493,223467,223441,223415,223388,223362,223336,223309,223283,223257,223230,223204,223178,223151,223125,223099,223072,223046,223019,222993,222966,222940,222914,222887,222861,222834,222808,222781,222755,222728,222702,222675,222649,222622,222596,222569,222542,222516,222489,222463,222436,222410,222383,222356,222330,222303,222276,222250,222223,222196,222170,222143,222116,222090,222063,222036,222010,221983,221956,221929,221903,221876,221849,221822,221795,221769,221742,221715,221688,221661,221634,221608,221581,221554,221527,221500,221473,221446,221419,221393,221366,221339,221312,221285,221258,221231,221204,221177,221150,221123,221096,221069,221042,221015,220988,220961,220934,220907,220880,220853,220826,220798,220771,220744,220717,220690,220663,220636,220609,220581,220554,220527,220500,220473,220446,220418,220391,220364,220337,220309,220282,220255,220228,220200,220173,220146,220119,220091,220064,220037,220009,219982,219955,219927,219900,219873,219845,219818,219790,219763,219736,219708,219681,219653,219626,219598,219571,219544,219516,219489,219461,219434,219406,219379,219351,219324,219296,219268,219241,219213,219186,219158,219131,219103,219075,219048,219020,218993,218965,218937,218910,218882,218854,218827,218799,218771,218744,218716,218688,218660,218633,218605,218577,218549,218522,218494,218466,218438,218411,218383,218355,218327,218299,218271,218244,218216,218188,218160,218132,218104,218076,218049,218021,217993,217965,217937,217909,217881,217853,217825,217797,217769,217741,217713,217685,217657,217629,217601,217573,217545,217517,217489,217461,217433,217405,217377,217348,217320,217292,217264,217236,217208,217180,217152,217123,217095,217067,217039,217011,216982,216954,216926,216898,216870,216841,216813,216785,216757,216728,216700,216672,216643,216615,216587,216558,216530,216502,216473,216445,216417,216388,216360,216332,216303,216275,216246,216218,216190,216161,216133,216104,216076,216047,216019,215990,215962,215933,215905,215876,215848,215819,215791,215762,215734,215705,215677,215648,215619,215591,215562,215534,215505,215476,215448,215419,215390,215362,215333,215304,215276,215247,215218,215190,215161,215132,215104,215075,215046,215017,214989,214960,214931,214902,214873,214845,214816,214787,214758,214729,214701,214672,214643,214614,214585,214556,214527,214498,214470,214441,214412,214383,214354,214325,214296,214267,214238,214209,214180,214151,214122,214093,214064,214035,214006,213977,213948,213919,213890,213861,213832,213803,213774,213745,213715,213686,213657,213628,213599,213570,213541,213511,213482,213453,213424,213395,213366,213336,213307,213278,213249,213219,213190,213161,213132,213102,213073,213044,213015,212985,212956,212927,212897,212868,212839,212809,212780,212751,212721,212692,212662,212633,212604,212574,212545,212515,212486,212456,212427,212398,212368,212339,212309,212280,212250,212221,212191,212162,212132,212103,212073,212043,212014,211984,211955,211925,211896,211866,211836,211807,211777,211748,211718,211688,211659,211629,211599,211570,211540,211510,211481,211451,211421,211391,211362,211332,211302,211272,211243,211213,211183,211153,211124,211094,211064,211034,211004,210974,210945,210915,210885,210855,210825,210795,210765,210736,210706,210676,210646,210616,210586,210556,210526,210496,210466,210436,210406,210376,210346,210316,210286,210256,210226,210196,210166,210136,210106,210076,210046,210016,209986,209956,209926,209895,209865,209835,209805,209775,209745,209715,209684,209654,209624,209594,209564,209534,209503,209473,209443,209413,209382,209352,209322,209292,209261,209231,209201,209170,209140,209110,209080,209049,209019,208989,208958,208928,208897,208867,208837,208806,208776,208746,208715,208685,208654,208624,208593,208563,208533,208502,208472,208441,208411,208380,208350,208319,208289,208258,208228,208197,208166,208136,208105,208075,208044,208014,207983,207952,207922,207891,207861,207830,207799,207769,207738,207707,207677,207646,207615,207585,207554,207523,207492,207462,207431,207400,207370,207339,207308,207277,207246,207216,207185,207154,207123,207092,207062,207031,207000,206969,206938,206907,206877,206846,206815,206784,206753,206722,206691,206660,206629,206598,206567,206537,206506,206475,206444,206413,206382,206351,206320,206289,206258,206227,206196,206165,206133,206102,206071,206040,206009,205978,205947,205916,205885,205854,205823,205791,205760,205729,205698,205667,205636,205604,205573,205542,205511,205480,205448,205417,205386,205355,205324,205292,205261,205230,205198,205167,205136,205105,205073,205042,205011,204979,204948,204917,204885,204854,204823,204791,204760,204728,204697,204666,204634,204603,204571,204540,204508,204477,204446,204414,204383,204351,204320,204288,204257,204225,204194,204162,204131,204099,204067,204036,204004,203973,203941,203910,203878,203846,203815,203783,203752,203720,203688,203657,203625,203593,203562,203530,203498,203467,203435,203403,203372,203340,203308,203276,203245,203213,203181,203149,203118,203086,203054,203022,202990,202959,202927,202895,202863,202831,202799,202768,202736,202704,202672,202640,202608,202576,202544,202512,202481,202449,202417,202385,202353,202321,202289,202257,202225,202193,202161,202129,202097,202065,202033,202001,201969,201937,201905,201873,201841,201808,201776,201744,201712,201680,201648,201616,201584,201552,201519,201487,201455,201423,201391,201359,201326,201294,201262,201230,201198,201165,201133,201101,201069,201036,201004,200972,200940,200907,200875,200843,200810,200778,200746,200713,200681,200649,200616,200584,200552,200519,200487,200454,200422,200390,200357,200325,200292,200260,200228,200195,200163,200130,200098,200065,200033,200000,199968,199935,199903,199870,199838,199805,199773,199740,199708,199675,199642,199610,199577,199545,199512,199479,199447,199414,199382,199349,199316,199284,199251,199218,199186,199153,199120,199088,199055,199022,198989,198957,198924,198891,198858,198826,198793,198760,198727,198695,198662,198629,198596,198563,198531,198498,198465,198432,198399,198366,198334,198301,198268,198235,198202,198169,198136,198103,198070,198037,198004,197972,197939,197906,197873,197840,197807,197774,197741,197708,197675,197642,197609,197576,197543,197510,197476,197443,197410,197377,197344,197311,197278,197245,197212,197179,197146,197112,197079,197046,197013,196980,196947,196913,196880,196847,196814,196781,196747,196714,196681,196648,196615,196581,196548,196515,196481,196448,196415,196382,196348,196315,196282,196248,196215,196182,196148,196115,196082,196048,196015,195982,195948,195915,195881,195848,195815,195781,195748,195714,195681,195647,195614,195580,195547,195513,195480,195446,195413,195379,195346,195312,195279,195245,195212,195178,195145,195111,195078,195044,195010,194977,194943,194910,194876,194842,194809,194775,194741,194708,194674,194640,194607,194573,194539,194506,194472,194438,194405,194371,194337,194303,194270,194236,194202,194168,194135,194101,194067,194033,193999,193966,193932,193898,193864,193830,193796,193763,193729,193695,193661,193627,193593,193559,193525,193492,193458,193424,193390,193356,193322,193288,193254,193220,193186,193152,193118,193084,193050,193016,192982,192948,192914,192880,192846,192812,192778,192744,192710,192676,192641,192607,192573,192539,192505,192471,192437,192403,192369,192334,192300,192266,192232,192198,192164,192129,192095,192061,192027,191992,191958,191924,191890,191856,191821,191787,191753,191718,191684,191650,191616,191581,191547,191513,191478,191444,191410,191375,191341,191307,191272,191238,191203,191169,191135,191100,191066,191031,190997,190963,190928,190894,190859,190825,190790,190756,190721,190687,190652,190618,190583,190549,190514,190480,190445,190411,190376,190342,190307,190272,190238,190203,190169,190134,190099,190065,190030,189996,189961,189926,189892,189857,189822,189788,189753,189718,189684,189649,189614,189580,189545,189510,189475,189441,189406,189371,189336,189302,189267,189232,189197,189162,189128,189093,189058,189023,188988,188954,188919,188884,188849,188814,188779,188744,188709,188675,188640,188605,188570,188535,188500,188465,188430,188395,188360,188325,188290,188255,188220,188185,188150,188115,188080,188045,188010,187975,187940,187905,187870,187835,187800,187765,187730,187695,187660,187625,187589,187554,187519,187484,187449,187414,187379,187343,187308,187273,187238,187203,187168,187132,187097,187062,187027,186992,186956,186921,186886,186851,186815,186780,186745,186710,186674,186639,186604,186568,186533,186498,186462,186427,186392,186356,186321,186286,186250,186215,186179,186144,186109,186073,186038,186002,185967,185932,185896,185861,185825,185790,185754,185719,185683,185648,185612,185577,185541,185506,185470,185435,185399,185364,185328,185293,185257,185222,185186,185150,185115,185079,185044,185008,184972,184937,184901,184866,184830,184794,184759,184723,184687,184652,184616,184580,184545,184509,184473,184437,184402,184366,184330,184294,184259,184223,184187,184151,184116,184080,184044,184008,183972,183937,183901,183865,183829,183793,183757,183722,183686,183650,183614,183578,183542,183506,183470,183435,183399,183363,183327,183291,183255,183219,183183,183147,183111,183075,183039,183003,182967,182931,182895,182859,182823,182787,182751,182715,182679,182643,182607,182571,182535,182499,182463,182426,182390,182354,182318,182282,182246,182210,182174,182137,182101,182065,182029,181993,181957,181920,181884,181848,181812,181776,181739,181703,181667,181631,181594,181558,181522,181486,181449,181413,181377,181341,181304,181268,181232,181195,181159,181123,181086,181050,181014,180977,180941,180904,180868,180832,180795,180759,180723,180686,180650,180613,180577,180540,180504,180467,180431,180395,180358,180322,180285,180249,180212,180176,180139,180103,180066,180029,179993,179956,179920,179883,179847,179810,179774,179737,179700,179664,179627,179591,179554,179517,179481,179444,179407,179371,179334,179297,179261,179224,179187,179151,179114,179077,179041,179004,178967,178930,178894,178857,178820,178783,178747,178710,178673,178636,178600,178563,178526,178489,178452,178415,178379,178342,178305,178268,178231,178194,178158,178121,178084,178047,178010,177973,177936,177899,177862,177825,177788,177752,177715,177678,177641,177604,177567,177530,177493,177456,177419,177382,177345,177308,177271,177234,177197,177160,177123,177085,177048,177011,176974,176937,176900,176863,176826,176789,176752,176714,176677,176640,176603,176566,176529,176492,176454,176417,176380,176343,176306,176268,176231,176194,176157,176120,176082,176045,176008,175971,175933,175896,175859,175822,175784,175747,175710,175672,175635,175598,175560,175523,175486,175448,175411,175374,175336,175299,175262,175224,175187,175149,175112,175075,175037,175000,174962,174925,174887,174850,174813,174775,174738,174700,174663,174625,174588,174550,174513,174475,174438,174400,174363,174325,174288,174250,174212,174175,174137,174100,174062,174025,173987,173949,173912,173874,173837,173799,173761,173724,173686,173648,173611,173573,173535,173498,173460,173422,173385,173347,173309,173271,173234,173196,173158,173121,173083,173045,173007,172969,172932,172894,172856,172818,172781,172743,172705,172667,172629,172591,172554,172516,172478,172440,172402,172364,172326,172289,172251,172213,172175,172137,172099,172061,172023,171985,171947,171909,171871,171834,171796,171758,171720,171682,171644,171606,171568,171530,171492,171454,171416,171378,171339,171301,171263,171225,171187,171149,171111,171073,171035,170997,170959,170921,170883,170844,170806,170768,170730,170692,170654,170616,170577,170539,170501,170463,170425,170386,170348,170310,170272,170234,170195,170157,170119,170081,170042,170004,169966,169928,169889,169851,169813,169774,169736,169698,169660,169621,169583,169545,169506,169468,169430,169391,169353,169314,169276,169238,169199,169161,169122,169084,169046,169007,168969,168930,168892,168853,168815,168777,168738,168700,168661,168623,168584,168546,168507,168469,168430,168392,168353,168315,168276,168238,168199,168160,168122,168083,168045,168006,167968,167929,167890,167852,167813,167774,167736,167697,167659,167620,167581,167543,167504,167465,167427,167388,167349,167311,167272,167233,167194,167156,167117,167078,167040,167001,166962,166923,166885,166846,166807,166768,166729,166691,166652,166613,166574,166535,166497,166458,166419,166380,166341,166302,166264,166225,166186,166147,166108,166069,166030,165991,165952,165914,165875,165836,165797,165758,165719,165680,165641,165602,165563,165524,165485,165446,165407,165368,165329,165290,165251,165212,165173,165134,165095,165056,165017,164978,164939,164900,164861,164821,164782,164743,164704,164665,164626,164587,164548,164509,164469,164430,164391,164352,164313,164274,164234,164195,164156,164117,164078,164039,163999,163960,163921,163882,163842,163803,163764,163725,163685,163646,163607,163568,163528,163489,163450,163410,163371,163332,163292,163253,163214,163174,163135,163096,163056,163017,162978,162938,162899,162860,162820,162781,162741,162702,162663,162623,162584,162544,162505,162465,162426,162386,162347,162308,162268,162229,162189,162150,162110,162071,162031,161992,161952,161913,161873,161833,161794,161754,161715,161675,161636,161596,161557,161517,161477,161438,161398,161359,161319,161279,161240,161200,161160,161121,161081,161041,161002,160962,160922,160883,160843,160803,160764,160724,160684,160644,160605,160565,160525,160486,160446,160406,160366,160327,160287,160247,160207,160167,160128,160088,160048,160008,159968,159929,159889,159849,159809,159769,159729,159689,159650,159610,159570,159530,159490,159450,159410,159370,159330,159291,159251,159211,159171,159131,159091,159051,159011,158971,158931,158891,158851,158811,158771,158731,158691,158651,158611,158571,158531,158491,158451,158411,158371,158331,158291,158251,158211,158170,158130,158090,158050,158010,157970,157930,157890,157850,157809,157769,157729,157689,157649,157609,157569,157528,157488,157448,157408,157368,157327,157287,157247,157207,157167,157126,157086,157046,157006,156965,156925,156885,156845,156804,156764,156724,156683,156643,156603,156562,156522,156482,156441,156401,156361,156320,156280,156240,156199,156159,156119,156078,156038,155997,155957,155917,155876,155836,155795,155755,155715,155674,155634,155593,155553,155512,155472,155431,155391,155350,155310,155269,155229,155188,155148,155107,155067,155026,154986,154945,154905,154864,154824,154783,154742,154702,154661,154621,154580,154539,154499,154458,154418,154377,154336,154296,154255,154214,154174,154133,154093,154052,154011,153970,153930,153889,153848,153808,153767,153726,153686,153645,153604,153563,153523,153482,153441,153400,153360,153319,153278,153237,153197,153156,153115,153074,153033,152993,152952,152911,152870,152829,152788,152748,152707,152666,152625,152584,152543,152502,152461,152421,152380,152339,152298,152257,152216,152175,152134,152093,152052,152011,151970,151929,151888,151847,151806,151765,151724,151683,151642,151601,151560,151519,151478,151437,151396,151355,151314,151273,151232,151191,151150,151109,151068,151027,150986,150945,150904,150862,150821,150780,150739,150698,150657,150616,150575,150533,150492,150451,150410,150369,150328,150286,150245,150204,150163,150122,150080,150039,149998,149957,149916,149874,149833,149792,149751,149709,149668,149627,149585,149544,149503,149462,149420,149379,149338,149296,149255,149214,149172,149131,149090,149048,149007,148966,148924,148883,148842,148800,148759,148717,148676,148635,148593,148552,148510,148469,148428,148386,148345,148303,148262,148220,148179,148137,148096,148054,148013,147971,147930,147888,147847,147805,147764,147722,147681,147639,147598,147556,147515,147473,147432,147390,147348,147307,147265,147224,147182,147141,147099,147057,147016,146974,146932,146891,146849,146808,146766,146724,146683,146641,146599,146558,146516,146474,146433,146391,146349,146307,146266,146224,146182,146141,146099,146057,146015,145974,145932,145890,145848,145807,145765,145723,145681,145639,145598,145556,145514,145472,145430,145389,145347,145305,145263,145221,145179,145137,145096,145054,145012,144970,144928,144886,144844,144802,144761,144719,144677,144635,144593,144551,144509,144467,144425,144383,144341,144299,144257,144215,144173,144131,144089,144047,144005,143963,143921,143879,143837,143795,143753,143711,143669,143627,143585,143543,143501,143459,143417,143375,143333,143291,143248,143206,143164,143122,143080,143038,142996,142954,142912,142869,142827,142785,142743,142701,142659,142616,142574,142532,142490,142448,142405,142363,142321,142279,142237,142194,142152,142110,142068,142025,141983,141941,141899,141856,141814,141772,141730,141687,141645,141603,141560,141518,141476,141433,141391,141349,141306,141264,141222,141179,141137,141095,141052,141010,140968,140925,140883,140840,140798,140756,140713,140671,140628,140586,140544,140501,140459,140416,140374,140331,140289,140246,140204,140161,140119,140077,140034,139992,139949,139907,139864,139821,139779,139736,139694,139651,139609,139566,139524,139481,139439,139396,139353,139311,139268,139226,139183,139141,139098,139055,139013,138970,138927,138885,138842,138800,138757,138714,138672,138629,138586,138544,138501,138458,138416,138373,138330,138288,138245,138202,138159,138117,138074,138031,137988,137946,137903,137860,137817,137775,137732,137689,137646,137604,137561,137518,137475,137432,137390,137347,137304,137261,137218,137176,137133,137090,137047,137004,136961,136918,136876,136833,136790,136747,136704,136661,136618,136575,136532,136490,136447,136404,136361,136318,136275,136232,136189,136146,136103,136060,136017,135974,135931,135888,135845,135802,135759,135716,135673,135630,135587,135544,135501,135458,135415,135372,135329,135286,135243,135200,135157,135114,135071,135028,134984,134941,134898,134855,134812,134769,134726,134683,134640,134596,134553,134510,134467,134424,134381,134338,134294,134251,134208,134165,134122,134078,134035,133992,133949,133906,133862,133819,133776,133733,133690,133646,133603,133560,133517,133473,133430,133387,133343,133300,133257,133214,133170,133127,133084,133040,132997,132954,132910,132867,132824,132780,132737,132694,132650,132607,132564,132520,132477,132434,132390,132347,132303,132260,132217,132173,132130,132086,132043,132000,131956,131913,131869,131826,131782,131739,131695,131652,131609,131565,131522,131478,131435,131391,131348,131304,131261,131217,131174,131130,131087,131043,130999,130956,130912,130869,130825,130782,130738,130695,130651,130607,130564,130520,130477,130433,130389,130346,130302,130259,130215,130171,130128,130084,130040,129997,129953,129909,129866,129822,129778,129735,129691,129647,129604,129560,129516,129473,129429,129385,129341,129298,129254,129210,129167,129123,129079,129035,128992,128948,128904,128860,128816,128773,128729,128685,128641,128598,128554,128510,128466,128422,128378,128335,128291,128247,128203,128159,128115,128072,128028,127984,127940,127896,127852,127808,127764,127721,127677,127633,127589,127545,127501,127457,127413,127369,127325,127281,127237,127193,127150,127106,127062,127018,126974,126930,126886,126842,126798,126754,126710,126666,126622,126578,126534,126490,126446,126402,126358,126314,126269,126225,126181,126137,126093,126049,126005,125961,125917,125873,125829,125785,125741,125696,125652,125608,125564,125520,125476,125432,125388,125343,125299,125255,125211,125167,125123,125078,125034,124990,124946,124902,124857,124813,124769,124725,124681,124636,124592,124548,124504,124460,124415,124371,124327,124283,124238,124194,124150,124105,124061,124017,123973,123928,123884,123840,123795,123751,123707,123662,123618,123574,123529,123485,123441,123396,123352,123308,123263,123219,123175,123130,123086,123042,122997,122953,122908,122864,122820,122775,122731,122686,122642,122597,122553,122509,122464,122420,122375,122331,122286,122242,122197,122153,122108,122064,122019,121975,121931,121886,121842,121797,121752,121708,121663,121619,121574,121530,121485,121441,121396,121352,121307,121263,121218,121173,121129,121084,121040,120995,120950,120906,120861,120817,120772,120727,120683,120638,120594,120549,120504,120460,120415,120370,120326,120281,120236,120192,120147,120102,120058,120013,119968,119924,119879,119834,119790,119745,119700,119655,119611,119566,119521,119476,119432,119387,119342,119297,119253,119208,119163,119118,119074,119029,118984,118939,118894,118850,118805,118760,118715,118670,118626,118581,118536,118491,118446,118401,118357,118312,118267,118222,118177,118132,118087,118042,117998,117953,117908,117863,117818,117773,117728,117683,117638,117593,117549,117504,117459,117414,117369,117324,117279,117234,117189,117144,117099,117054,117009,116964,116919,116874,116829,116784,116739,116694,116649,116604,116559,116514,116469,116424,116379,116334,116289,116244,116199,116154,116109,116064,116018,115973,115928,115883,115838,115793,115748,115703,115658,115613,115567,115522,115477,115432,115387,115342,115297,115252,115206,115161,115116,115071,115026,114981,114935,114890,114845,114800,114755,114710,114664,114619,114574,114529,114483,114438,114393,114348,114303,114257,114212,114167,114122,114076,114031,113986,113941,113895,113850,113805,113759,113714,113669,113624,113578,113533,113488,113442,113397,113352,113306,113261,113216,113170,113125,113080,113034,112989,112944,112898,112853,112808,112762,112717,112671,112626,112581,112535,112490,112444,112399,112354,112308,112263,112217,112172,112126,112081,112036,111990,111945,111899,111854,111808,111763,111717,111672,111626,111581,111535,111490,111444,111399,111353,111308,111262,111217,111171,111126,111080,111035,110989,110944,110898,110853,110807,110762,110716,110670,110625,110579,110534,110488,110443,110397,110351,110306,110260,110215,110169,110123,110078,110032,109986,109941,109895,109850,109804,109758,109713,109667,109621,109576,109530,109484,109439,109393,109347,109302,109256,109210,109165,109119,109073,109027,108982,108936,108890,108845,108799,108753,108707,108662,108616,108570,108524,108479,108433,108387,108341,108295,108250,108204,108158,108112,108067,108021,107975,107929,107883,107838,107792,107746,107700,107654,107608,107563,107517,107471,107425,107379,107333,107287,107242,107196,107150,107104,107058,107012,106966,106920,106875,106829,106783,106737,106691,106645,106599,106553,106507,106461,106415,106369,106323,106278,106232,106186,106140,106094,106048,106002,105956,105910,105864,105818,105772,105726,105680,105634,105588,105542,105496,105450,105404,105358,105312,105266,105220,105174,105128,105082,105035,104989,104943,104897,104851,104805,104759,104713,104667,104621,104575,104529,104483,104436,104390,104344,104298,104252,104206,104160,104114,104067,104021,103975,103929,103883,103837,103791,103744,103698,103652,103606,103560,103514,103467,103421,103375,103329,103283,103236,103190,103144,103098,103052,103005,102959,102913,102867,102820,102774,102728,102682,102635,102589,102543,102497,102450,102404,102358,102312,102265,102219,102173,102126,102080,102034,101988,101941,101895,101849,101802,101756,101710,101663,101617,101571,101524,101478,101432,101385,101339,101293,101246,101200,101153,101107,101061,101014,100968,100922,100875,100829,100782,100736,100690,100643,100597,100550,100504,100457,100411,100365,100318,100272,100225,100179,100132,100086,100039,99993,99947,99900,99854,99807,99761,99714,99668,99621,99575,99528,99482,99435,99389,99342,99296,99249,99203,99156,99110,99063,99016,98970,98923,98877,98830,98784,98737,98691,98644,98597,98551,98504,98458,98411,98364,98318,98271,98225,98178,98131,98085,98038,97992,97945,97898,97852,97805,97758,97712,97665,97619,97572,97525,97479,97432,97385,97339,97292,97245,97199,97152,97105,97058,97012,96965,96918,96872,96825,96778,96732,96685,96638,96591,96545,96498,96451,96404,96358,96311,96264,96217,96171,96124,96077,96030,95984,95937,95890,95843,95796,95750,95703,95656,95609,95562,95516,95469,95422,95375,95328,95282,95235,95188,95141,95094,95047,95001,94954,94907,94860,94813,94766,94719,94673,94626,94579,94532,94485,94438,94391,94344,94297,94251,94204,94157,94110,94063,94016,93969,93922,93875,93828,93781,93734,93687,93640,93594,93547,93500,93453,93406,93359,93312,93265,93218,93171,93124,93077,93030,92983,92936,92889,92842,92795,92748,92701,92654,92607,92560,92513,92466,92419,92372,92325,92278,92230,92183,92136,92089,92042,91995,91948,91901,91854,91807,91760,91713,91666,91619,91571,91524,91477,91430,91383,91336,91289,91242,91195,91147,91100,91053,91006,90959,90912,90865,90817,90770,90723,90676,90629,90582,90534,90487,90440,90393,90346,90299,90251,90204,90157,90110,90063,90015,89968,89921,89874,89826,89779,89732,89685,89638,89590,89543,89496,89449,89401,89354,89307,89260,89212,89165,89118,89070,89023,88976,88929,88881,88834,88787,88739,88692,88645,88598,88550,88503,88456,88408,88361,88314,88266,88219,88172,88124,88077,88030,87982,87935,87888,87840,87793,87745,87698,87651,87603,87556,87509,87461,87414,87366,87319,87272,87224,87177,87129,87082,87035,86987,86940,86892,86845,86798,86750,86703,86655,86608,86560,86513,86465,86418,86371,86323,86276,86228,86181,86133,86086,86038,85991,85943,85896,85848,85801,85753,85706,85658,85611,85563,85516,85468,85421,85373,85326,85278,85231,85183,85136,85088,85040,84993,84945,84898,84850,84803,84755,84708,84660,84612,84565,84517,84470,84422,84374,84327,84279,84232,84184,84136,84089,84041,83994,83946,83898,83851,83803,83756,83708,83660,83613,83565,83517,83470,83422,83374,83327,83279,83231,83184,83136,83088,83041,82993,82945,82898,82850,82802,82755,82707,82659,82612,82564,82516,82468,82421,82373,82325,82278,82230,82182,82134,82087,82039,81991,81943,81896,81848,81800,81752,81705,81657,81609,81561,81514,81466,81418,81370,81322,81275,81227,81179,81131,81083,81036,80988,80940,80892,80844,80797,80749,80701,80653,80605,80557,80510,80462,80414,80366,80318,80270,80223,80175,80127,80079,80031,79983,79935,79887,79840,79792,79744,79696,79648,79600,79552,79504,79457,79409,79361,79313,79265,79217,79169,79121,79073,79025,78977,78929,78881,78834,78786,78738,78690,78642,78594,78546,78498,78450,78402,78354,78306,78258,78210,78162,78114,78066,78018,77970,77922,77874,77826,77778,77730,77682,77634,77586,77538,77490,77442,77394,77346,77298,77250,77202,77154,77106,77058,77010,76962,76914,76866,76818,76770,76721,76673,76625,76577,76529,76481,76433,76385,76337,76289,76241,76193,76144,76096,76048,76000,75952,75904,75856,75808,75760,75711,75663,75615,75567,75519,75471,75423,75375,75326,75278,75230,75182,75134,75086,75037,74989,74941,74893,74845,74797,74748,74700,74652,74604,74556,74508,74459,74411,74363,74315,74267,74218,74170,74122,74074,74025,73977,73929,73881,73833,73784,73736,73688,73640,73591,73543,73495,73447,73398,73350,73302,73254,73205,73157,73109,73061,73012,72964,72916,72867,72819,72771,72723,72674,72626,72578,72529,72481,72433,72384,72336,72288,72239,72191,72143,72095,72046,71998,71950,71901,71853,71805,71756,71708,71659,71611,71563,71514,71466,71418,71369,71321,71273,71224,71176,71127,71079,71031,70982,70934,70886,70837,70789,70740,70692,70644,70595,70547,70498,70450,70401,70353,70305,70256,70208,70159,70111,70062,70014,69966,69917,69869,69820,69772,69723,69675,69626,69578,69530,69481,69433,69384,69336,69287,69239,69190,69142,69093,69045,68996,68948,68899,68851,68802,68754,68705,68657,68608,68560,68511,68463,68414,68366,68317,68269,68220,68171,68123,68074,68026,67977,67929,67880,67832,67783,67735,67686,67637,67589,67540,67492,67443,67395,67346,67297,67249,67200,67152,67103,67055,67006,66957,66909,66860,66812,66763,66714,66666,66617,66568,66520,66471,66423,66374,66325,66277,66228,66179,66131,66082,66034,65985,65936,65888,65839,65790,65742,65693,65644,65596,65547,65498,65450,65401,65352,65304,65255,65206,65158,65109,65060,65011,64963,64914,64865,64817,64768,64719,64671,64622,64573,64524,64476,64427,64378,64329,64281,64232,64183,64135,64086,64037,63988,63940,63891,63842,63793,63745,63696,63647,63598,63550,63501,63452,63403,63354,63306,63257,63208,63159,63111,63062,63013,62964,62915,62867,62818,62769,62720,62671,62623,62574,62525,62476,62427,62378,62330,62281,62232,62183,62134,62085,62037,61988,61939,61890,61841,61792,61744,61695,61646,61597,61548,61499,61450,61402,61353,61304,61255,61206,61157,61108,61059,61011,60962,60913,60864,60815,60766,60717,60668,60619,60570,60522,60473,60424,60375,60326,60277,60228,60179,60130,60081,60032,59983,59935,59886,59837,59788,59739,59690,59641,59592,59543,59494,59445,59396,59347,59298,59249,59200,59151,59102,59053,59004,58955,58906,58857,58808,58759,58711,58662,58613,58564,58515,58466,58417,58368,58319,58270,58221,58171,58122,58073,58024,57975,57926,57877,57828,57779,57730,57681,57632,57583,57534,57485,57436,57387,57338,57289,57240,57191,57142,57093,57044,56995,56946,56896,56847,56798,56749,56700,56651,56602,56553,56504,56455,56406,56357,56308,56258,56209,56160,56111,56062,56013,55964,55915,55866,55816,55767,55718,55669,55620,55571,55522,55473,55424,55374,55325,55276,55227,55178,55129,55080,55030,54981,54932,54883,54834,54785,54736,54686,54637,54588,54539,54490,54441,54391,54342,54293,54244,54195,54145,54096,54047,53998,53949,53900,53850,53801,53752,53703,53654,53604,53555,53506,53457,53408,53358,53309,53260,53211,53161,53112,53063,53014,52965,52915,52866,52817,52768,52718,52669,52620,52571,52521,52472,52423,52374,52324,52275,52226,52177,52127,52078,52029,51980,51930,51881,51832,51782,51733,51684,51635,51585,51536,51487,51438,51388,51339,51290,51240,51191,51142,51092,51043,50994,50945,50895,50846,50797,50747,50698,50649,50599,50550,50501,50451,50402,50353,50303,50254,50205,50155,50106,50057,50007,49958,49909,49859,49810,49761,49711,49662,49613,49563,49514,49464,49415,49366,49316,49267,49218,49168,49119,49070,49020,48971,48921,48872,48823,48773,48724,48674,48625,48576,48526,48477,48427,48378,48329,48279,48230,48180,48131,48082,48032,47983,47933,47884,47835,47785,47736,47686,47637,47587,47538,47489,47439,47390,47340,47291,47241,47192,47142,47093,47044,46994,46945,46895,46846,46796,46747,46697,46648,46598,46549,46500,46450,46401,46351,46302,46252,46203,46153,46104,46054,46005,45955,45906,45856,45807,45757,45708,45658,45609,45559,45510,45460,45411,45361,45312,45262,45213,45163,45114,45064,45015,44965,44916,44866,44817,44767,44718,44668,44619,44569,44519,44470,44420,44371,44321,44272,44222,44173,44123,44074,44024,43974,43925,43875,43826,43776,43727,43677,43628,43578,43528,43479,43429,43380,43330,43281,43231,43181,43132,43082,43033,42983,42933,42884,42834,42785,42735,42686,42636,42586,42537,42487,42438,42388,42338,42289,42239,42190,42140,42090,42041,41991,41941,41892,41842,41793,41743,41693,41644,41594,41544,41495,41445,41396,41346,41296,41247,41197,41147,41098,41048,40998,40949,40899,40849,40800,40750,40701,40651,40601,40552,40502,40452,40403,40353,40303,40254,40204,40154,40105,40055,40005,39956,39906,39856,39806,39757,39707,39657,39608,39558,39508,39459,39409,39359,39310,39260,39210,39160,39111,39061,39011,38962,38912,38862,38813,38763,38713,38663,38614,38564,38514,38465,38415,38365,38315,38266,38216,38166,38116,38067,38017,37967,37917,37868,37818,37768,37719,37669,37619,37569,37520,37470,37420,37370,37321,37271,37221,37171,37122,37072,37022,36972,36922,36873,36823,36773,36723,36674,36624,36574,36524,36475,36425,36375,36325,36275,36226,36176,36126,36076,36027,35977,35927,35877,35827,35778,35728,35678,35628,35578,35529,35479,35429,35379,35329,35280,35230,35180,35130,35080,35030,34981,34931,34881,34831,34781,34732,34682,34632,34582,34532,34482,34433,34383,34333,34283,34233,34183,34134,34084,34034,33984,33934,33884,33835,33785,33735,33685,33635,33585,33535,33486,33436,33386,33336,33286,33236,33186,33137,33087,33037,32987,32937,32887,32837,32788,32738,32688,32638,32588,32538,32488,32438,32389,32339,32289,32239,32189,32139,32089,32039,31989,31940,31890,31840,31790,31740,31690,31640,31590,31540,31490,31441,31391,31341,31291,31241,31191,31141,31091,31041,30991,30942,30892,30842,30792,30742,30692,30642,30592,30542,30492,30442,30392,30342,30293,30243,30193,30143,30093,30043,29993,29943,29893,29843,29793,29743,29693,29643,29593,29543,29494,29444,29394,29344,29294,29244,29194,29144,29094,29044,28994,28944,28894,28844,28794,28744,28694,28644,28594,28544,28494,28444,28394,28344,28295,28245,28195,28145,28095,28045,27995,27945,27895,27845,27795,27745,27695,27645,27595,27545,27495,27445,27395,27345,27295,27245,27195,27145,27095,27045,26995,26945,26895,26845,26795,26745,26695,26645,26595,26545,26495,26445,26395,26345,26295,26245,26195,26145,26095,26045,25995,25945,25895,25845,25795,25745,25695,25645,25595,25545,25495,25444,25394,25344,25294,25244,25194,25144,25094,25044,24994,24944,24894,24844,24794,24744,24694,24644,24594,24544,24494,24444,24394,24344,24294,24244,24193,24143,24093,24043,23993,23943,23893,23843,23793,23743,23693,23643,23593,23543,23493,23443,23393,23342,23292,23242,23192,23142,23092,23042,22992,22942,22892,22842,22792,22742,22692,22641,22591,22541,22491,22441,22391,22341,22291,22241,22191,22141,22091,22040,21990,21940,21890,21840,21790,21740,21690,21640,21590,21540,21489,21439,21389,21339,21289,21239,21189,21139,21089,21039,20988,20938,20888,20838,20788,20738,20688,20638,20588,20538,20487,20437,20387,20337,20287,20237,20187,20137,20086,20036,19986,19936,19886,19836,19786,19736,19686,19635,19585,19535,19485,19435,19385,19335,19285,19234,19184,19134,19084,19034,18984,18934,18883,18833,18783,18733,18683,18633,18583,18532,18482,18432,18382,18332,18282,18232,18181,18131,18081,18031,17981,17931,17881,17830,17780,17730,17680,17630,17580,17530,17479,17429,17379,17329,17279,17229,17178,17128,17078,17028,16978,16928,16878,16827,16777,16727,16677,16627,16577,16526,16476,16426,16376,16326,16276,16225,16175,16125,16075,16025,15975,15924,15874,15824,15774,15724,15673,15623,15573,15523,15473,15423,15372,15322,15272,15222,15172,15122,15071,15021,14971,14921,14871,14820,14770,14720,14670,14620,14569,14519,14469,14419,14369,14319,14268,14218,14168,14118,14068,14017,13967,13917,13867,13817,13766,13716,13666,13616,13566,13515,13465,13415,13365,13315,13264,13214,13164,13114,13064,13013,12963,12913,12863,12813,12762,12712,12662,12612,12562,12511,12461,12411,12361,12311,12260,12210,12160,12110,12059,12009,11959,11909,11859,11808,11758,11708,11658,11608,11557,11507,11457,11407,11356,11306,11256,11206,11156,11105,11055,11005,10955,10904,10854,10804,10754,10704,10653,10603,10553,10503,10452,10402,10352,10302,10252,10201,10151,10101,10051,10000,9950,9900,9850,9799,9749,9699,9649,9599,9548,9498,9448,9398,9347,9297,9247,9197,9146,9096,9046,8996,8946,8895,8845,8795,8745,8694,8644,8594,8544,8493,8443,8393,8343,8292,8242,8192,8142,8091,8041,7991,7941,7890,7840,7790,7740,7690,7639,7589,7539,7489,7438,7388,7338,7288,7237,7187,7137,7087,7036,6986,6936,6886,6835,6785,6735,6685,6634,6584,6534,6484,6433,6383,6333,6283,6232,6182,6132,6082,6031,5981,5931,5881,5830,5780,5730,5680,5629,5579,5529,5479,5428,5378,5328,5278,5227,5177,5127,5076,5026,4976,4926,4875,4825,4775,4725,4674,4624,4574,4524,4473,4423,4373,4323,4272,4222,4172,4122,4071,4021,3971,3921,3870,3820,3770,3720,3669,3619,3569,3518,3468,3418,3368,3317,3267,3217,3167,3116,3066,3016,2966,2915,2865,2815,2765,2714,2664,2614,2563,2513,2463,2413,2362,2312,2262,2212,2161,2111,2061,2011,1960,1910,1860,1810,1759,1709,1659,1608,1558,1508,1458,1407,1357,1307,1257,1206,1156,1106,1056,1005,955,905,855,804,754,704,653,603,553,503,452,402,352,302,251,201,151,101,50,0,-49,-100,-150,-200,-250,-301,-351,-401,-451,-502,-552,-602,-652,-703,-753,-803,-854,-904,-954,-1004,-1055,-1105,-1155,-1205,-1256,-1306,-1356,-1406,-1457,-1507,-1557,-1607,-1658,-1708,-1758,-1809,-1859,-1909,-1959,-2010,-2060,-2110,-2160,-2211,-2261,-2311,-2361,-2412,-2462,-2512,-2562,-2613,-2663,-2713,-2764,-2814,-2864,-2914,-2965,-3015,-3065,-3115,-3166,-3216,-3266,-3316,-3367,-3417,-3467,-3517,-3568,-3618,-3668,-3719,-3769,-3819,-3869,-3920,-3970,-4020,-4070,-4121,-4171,-4221,-4271,-4322,-4372,-4422,-4472,-4523,-4573,-4623,-4673,-4724,-4774,-4824,-4874,-4925,-4975,-5025,-5075,-5126,-5176,-5226,-5277,-5327,-5377,-5427,-5478,-5528,-5578,-5628,-5679,-5729,-5779,-5829,-5880,-5930,-5980,-6030,-6081,-6131,-6181,-6231,-6282,-6332,-6382,-6432,-6483,-6533,-6583,-6633,-6684,-6734,-6784,-6834,-6885,-6935,-6985,-7035,-7086,-7136,-7186,-7236,-7287,-7337,-7387,-7437,-7488,-7538,-7588,-7638,-7689,-7739,-7789,-7839,-7889,-7940,-7990,-8040,-8090,-8141,-8191,-8241,-8291,-8342,-8392,-8442,-8492,-8543,-8593,-8643,-8693,-8744,-8794,-8844,-8894,-8945,-8995,-9045,-9095,-9145,-9196,-9246,-9296,-9346,-9397,-9447,-9497,-9547,-9598,-9648,-9698,-9748,-9798,-9849,-9899,-9949,-9999,-10050,-10100,-10150,-10200,-10251,-10301,-10351,-10401,-10451,-10502,-10552,-10602,-10652,-10703,-10753,-10803,-10853,-10903,-10954,-11004,-11054,-11104,-11155,-11205,-11255,-11305,-11355,-11406,-11456,-11506,-11556,-11607,-11657,-11707,-11757,-11807,-11858,-11908,-11958,-12008,-12058,-12109,-12159,-12209,-12259,-12310,-12360,-12410,-12460,-12510,-12561,-12611,-12661,-12711,-12761,-12812,-12862,-12912,-12962,-13012,-13063,-13113,-13163,-13213,-13263,-13314,-13364,-13414,-13464,-13514,-13565,-13615,-13665,-13715,-13765,-13816,-13866,-13916,-13966,-14016,-14067,-14117,-14167,-14217,-14267,-14318,-14368,-14418,-14468,-14518,-14568,-14619,-14669,-14719,-14769,-14819,-14870,-14920,-14970,-15020,-15070,-15121,-15171,-15221,-15271,-15321,-15371,-15422,-15472,-15522,-15572,-15622,-15672,-15723,-15773,-15823,-15873,-15923,-15974,-16024,-16074,-16124,-16174,-16224,-16275,-16325,-16375,-16425,-16475,-16525,-16576,-16626,-16676,-16726,-16776,-16826,-16877,-16927,-16977,-17027,-17077,-17127,-17177,-17228,-17278,-17328,-17378,-17428,-17478,-17529,-17579,-17629,-17679,-17729,-17779,-17829,-17880,-17930,-17980,-18030,-18080,-18130,-18180,-18231,-18281,-18331,-18381,-18431,-18481,-18531,-18582,-18632,-18682,-18732,-18782,-18832,-18882,-18933,-18983,-19033,-19083,-19133,-19183,-19233,-19284,-19334,-19384,-19434,-19484,-19534,-19584,-19634,-19685,-19735,-19785,-19835,-19885,-19935,-19985,-20035,-20085,-20136,-20186,-20236,-20286,-20336,-20386,-20436,-20486,-20537,-20587,-20637,-20687,-20737,-20787,-20837,-20887,-20937,-20987,-21038,-21088,-21138,-21188,-21238,-21288,-21338,-21388,-21438,-21488,-21539,-21589,-21639,-21689,-21739,-21789,-21839,-21889,-21939,-21989,-22039,-22090,-22140,-22190,-22240,-22290,-22340,-22390,-22440,-22490,-22540,-22590,-22640,-22691,-22741,-22791,-22841,-22891,-22941,-22991,-23041,-23091,-23141,-23191,-23241,-23291,-23341,-23392,-23442,-23492,-23542,-23592,-23642,-23692,-23742,-23792,-23842,-23892,-23942,-23992,-24042,-24092,-24142,-24192,-24243,-24293,-24343,-24393,-24443,-24493,-24543,-24593,-24643,-24693,-24743,-24793,-24843,-24893,-24943,-24993,-25043,-25093,-25143,-25193,-25243,-25293,-25343,-25393,-25443,-25494,-25544,-25594,-25644,-25694,-25744,-25794,-25844,-25894,-25944,-25994,-26044,-26094,-26144,-26194,-26244,-26294,-26344,-26394,-26444,-26494,-26544,-26594,-26644,-26694,-26744,-26794,-26844,-26894,-26944,-26994,-27044,-27094,-27144,-27194,-27244,-27294,-27344,-27394,-27444,-27494,-27544,-27594,-27644,-27694,-27744,-27794,-27844,-27894,-27944,-27994,-28044,-28094,-28144,-28194,-28244,-28294,-28343,-28393,-28443,-28493,-28543,-28593,-28643,-28693,-28743,-28793,-28843,-28893,-28943,-28993,-29043,-29093,-29143,-29193,-29243,-29293,-29343,-29393,-29443,-29493,-29542,-29592,-29642,-29692,-29742,-29792,-29842,-29892,-29942,-29992,-30042,-30092,-30142,-30192,-30242,-30292,-30341,-30391,-30441,-30491,-30541,-30591,-30641,-30691,-30741,-30791,-30841,-30891,-30941,-30990,-31040,-31090,-31140,-31190,-31240,-31290,-31340,-31390,-31440,-31489,-31539,-31589,-31639,-31689,-31739,-31789,-31839,-31889,-31939,-31988,-32038,-32088,-32138,-32188,-32238,-32288,-32338,-32388,-32437,-32487,-32537,-32587,-32637,-32687,-32737,-32787,-32836,-32886,-32936,-32986,-33036,-33086,-33136,-33185,-33235,-33285,-33335,-33385,-33435,-33485,-33534,-33584,-33634,-33684,-33734,-33784,-33834,-33883,-33933,-33983,-34033,-34083,-34133,-34182,-34232,-34282,-34332,-34382,-34432,-34481,-34531,-34581,-34631,-34681,-34731,-34780,-34830,-34880,-34930,-34980,-35029,-35079,-35129,-35179,-35229,-35279,-35328,-35378,-35428,-35478,-35528,-35577,-35627,-35677,-35727,-35777,-35826,-35876,-35926,-35976,-36026,-36075,-36125,-36175,-36225,-36274,-36324,-36374,-36424,-36474,-36523,-36573,-36623,-36673,-36722,-36772,-36822,-36872,-36921,-36971,-37021,-37071,-37121,-37170,-37220,-37270,-37320,-37369,-37419,-37469,-37519,-37568,-37618,-37668,-37718,-37767,-37817,-37867,-37916,-37966,-38016,-38066,-38115,-38165,-38215,-38265,-38314,-38364,-38414,-38464,-38513,-38563,-38613,-38662,-38712,-38762,-38812,-38861,-38911,-38961,-39010,-39060,-39110,-39159,-39209,-39259,-39309,-39358,-39408,-39458,-39507,-39557,-39607,-39656,-39706,-39756,-39805,-39855,-39905,-39955,-40004,-40054,-40104,-40153,-40203,-40253,-40302,-40352,-40402,-40451,-40501,-40551,-40600,-40650,-40700,-40749,-40799,-40848,-40898,-40948,-40997,-41047,-41097,-41146,-41196,-41246,-41295,-41345,-41395,-41444,-41494,-41543,-41593,-41643,-41692,-41742,-41792,-41841,-41891,-41940,-41990,-42040,-42089,-42139,-42189,-42238,-42288,-42337,-42387,-42437,-42486,-42536,-42585,-42635,-42685,-42734,-42784,-42833,-42883,-42932,-42982,-43032,-43081,-43131,-43180,-43230,-43280,-43329,-43379,-43428,-43478,-43527,-43577,-43627,-43676,-43726,-43775,-43825,-43874,-43924,-43973,-44023,-44073,-44122,-44172,-44221,-44271,-44320,-44370,-44419,-44469,-44518,-44568,-44618,-44667,-44717,-44766,-44816,-44865,-44915,-44964,-45014,-45063,-45113,-45162,-45212,-45261,-45311,-45360,-45410,-45459,-45509,-45558,-45608,-45657,-45707,-45756,-45806,-45855,-45905,-45954,-46004,-46053,-46103,-46152,-46202,-46251,-46301,-46350,-46400,-46449,-46499,-46548,-46597,-46647,-46696,-46746,-46795,-46845,-46894,-46944,-46993,-47043,-47092,-47141,-47191,-47240,-47290,-47339,-47389,-47438,-47488,-47537,-47586,-47636,-47685,-47735,-47784,-47834,-47883,-47932,-47982,-48031,-48081,-48130,-48179,-48229,-48278,-48328,-48377,-48426,-48476,-48525,-48575,-48624,-48673,-48723,-48772,-48822,-48871,-48920,-48970,-49019,-49069,-49118,-49167,-49217,-49266,-49315,-49365,-49414,-49463,-49513,-49562,-49612,-49661,-49710,-49760,-49809,-49858,-49908,-49957,-50006,-50056,-50105,-50154,-50204,-50253,-50302,-50352,-50401,-50450,-50500,-50549,-50598,-50648,-50697,-50746,-50796,-50845,-50894,-50944,-50993,-51042,-51091,-51141,-51190,-51239,-51289,-51338,-51387,-51437,-51486,-51535,-51584,-51634,-51683,-51732,-51781,-51831,-51880,-51929,-51979,-52028,-52077,-52126,-52176,-52225,-52274,-52323,-52373,-52422,-52471,-52520,-52570,-52619,-52668,-52717,-52767,-52816,-52865,-52914,-52964,-53013,-53062,-53111,-53160,-53210,-53259,-53308,-53357,-53407,-53456,-53505,-53554,-53603,-53653,-53702,-53751,-53800,-53849,-53899,-53948,-53997,-54046,-54095,-54144,-54194,-54243,-54292,-54341,-54390,-54440,-54489,-54538,-54587,-54636,-54685,-54735,-54784,-54833,-54882,-54931,-54980,-55029,-55079,-55128,-55177,-55226,-55275,-55324,-55373,-55423,-55472,-55521,-55570,-55619,-55668,-55717,-55766,-55815,-55865,-55914,-55963,-56012,-56061,-56110,-56159,-56208,-56257,-56307,-56356,-56405,-56454,-56503,-56552,-56601,-56650,-56699,-56748,-56797,-56846,-56895,-56945,-56994,-57043,-57092,-57141,-57190,-57239,-57288,-57337,-57386,-57435,-57484,-57533,-57582,-57631,-57680,-57729,-57778,-57827,-57876,-57925,-57974,-58023,-58072,-58121,-58170,-58220,-58269,-58318,-58367,-58416,-58465,-58514,-58563,-58612,-58661,-58710,-58758,-58807,-58856,-58905,-58954,-59003,-59052,-59101,-59150,-59199,-59248,-59297,-59346,-59395,-59444,-59493,-59542,-59591,-59640,-59689,-59738,-59787,-59836,-59885,-59934,-59982,-60031,-60080,-60129,-60178,-60227,-60276,-60325,-60374,-60423,-60472,-60521,-60569,-60618,-60667,-60716,-60765,-60814,-60863,-60912,-60961,-61010,-61058,-61107,-61156,-61205,-61254,-61303,-61352,-61401,-61449,-61498,-61547,-61596,-61645,-61694,-61743,-61791,-61840,-61889,-61938,-61987,-62036,-62084,-62133,-62182,-62231,-62280,-62329,-62377,-62426,-62475,-62524,-62573,-62622,-62670,-62719,-62768,-62817,-62866,-62914,-62963,-63012,-63061,-63110,-63158,-63207,-63256,-63305,-63353,-63402,-63451,-63500,-63549,-63597,-63646,-63695,-63744,-63792,-63841,-63890,-63939,-63987,-64036,-64085,-64134,-64182,-64231,-64280,-64328,-64377,-64426,-64475,-64523,-64572,-64621,-64670,-64718,-64767,-64816,-64864,-64913,-64962,-65010,-65059,-65108,-65157,-65205,-65254,-65303,-65351,-65400,-65449,-65497,-65546,-65595,-65643,-65692,-65741,-65789,-65838,-65887,-65935,-65984,-66033,-66081,-66130,-66178,-66227,-66276,-66324,-66373,-66422,-66470,-66519,-66567,-66616,-66665,-66713,-66762,-66811,-66859,-66908,-66956,-67005,-67054,-67102,-67151,-67199,-67248,-67296,-67345,-67394,-67442,-67491,-67539,-67588,-67636,-67685,-67734,-67782,-67831,-67879,-67928,-67976,-68025,-68073,-68122,-68170,-68219,-68268,-68316,-68365,-68413,-68462,-68510,-68559,-68607,-68656,-68704,-68753,-68801,-68850,-68898,-68947,-68995,-69044,-69092,-69141,-69189,-69238,-69286,-69335,-69383,-69432,-69480,-69529,-69577,-69625,-69674,-69722,-69771,-69819,-69868,-69916,-69965,-70013,-70061,-70110,-70158,-70207,-70255,-70304,-70352,-70400,-70449,-70497,-70546,-70594,-70643,-70691,-70739,-70788,-70836,-70885,-70933,-70981,-71030,-71078,-71126,-71175,-71223,-71272,-71320,-71368,-71417,-71465,-71513,-71562,-71610,-71658,-71707,-71755,-71804,-71852,-71900,-71949,-71997,-72045,-72094,-72142,-72190,-72238,-72287,-72335,-72383,-72432,-72480,-72528,-72577,-72625,-72673,-72722,-72770,-72818,-72866,-72915,-72963,-73011,-73060,-73108,-73156,-73204,-73253,-73301,-73349,-73397,-73446,-73494,-73542,-73590,-73639,-73687,-73735,-73783,-73832,-73880,-73928,-73976,-74024,-74073,-74121,-74169,-74217,-74266,-74314,-74362,-74410,-74458,-74507,-74555,-74603,-74651,-74699,-74747,-74796,-74844,-74892,-74940,-74988,-75036,-75085,-75133,-75181,-75229,-75277,-75325,-75374,-75422,-75470,-75518,-75566,-75614,-75662,-75710,-75759,-75807,-75855,-75903,-75951,-75999,-76047,-76095,-76143,-76192,-76240,-76288,-76336,-76384,-76432,-76480,-76528,-76576,-76624,-76672,-76720,-76769,-76817,-76865,-76913,-76961,-77009,-77057,-77105,-77153,-77201,-77249,-77297,-77345,-77393,-77441,-77489,-77537,-77585,-77633,-77681,-77729,-77777,-77825,-77873,-77921,-77969,-78017,-78065,-78113,-78161,-78209,-78257,-78305,-78353,-78401,-78449,-78497,-78545,-78593,-78641,-78689,-78737,-78785,-78833,-78880,-78928,-78976,-79024,-79072,-79120,-79168,-79216,-79264,-79312,-79360,-79408,-79456,-79503,-79551,-79599,-79647,-79695,-79743,-79791,-79839,-79886,-79934,-79982,-80030,-80078,-80126,-80174,-80222,-80269,-80317,-80365,-80413,-80461,-80509,-80556,-80604,-80652,-80700,-80748,-80796,-80843,-80891,-80939,-80987,-81035,-81082,-81130,-81178,-81226,-81274,-81321,-81369,-81417,-81465,-81513,-81560,-81608,-81656,-81704,-81751,-81799,-81847,-81895,-81942,-81990,-82038,-82086,-82133,-82181,-82229,-82277,-82324,-82372,-82420,-82467,-82515,-82563,-82611,-82658,-82706,-82754,-82801,-82849,-82897,-82944,-82992,-83040,-83087,-83135,-83183,-83230,-83278,-83326,-83373,-83421,-83469,-83516,-83564,-83612,-83659,-83707,-83755,-83802,-83850,-83897,-83945,-83993,-84040,-84088,-84135,-84183,-84231,-84278,-84326,-84373,-84421,-84469,-84516,-84564,-84611,-84659,-84707,-84754,-84802,-84849,-84897,-84944,-84992,-85039,-85087,-85135,-85182,-85230,-85277,-85325,-85372,-85420,-85467,-85515,-85562,-85610,-85657,-85705,-85752,-85800,-85847,-85895,-85942,-85990,-86037,-86085,-86132,-86180,-86227,-86275,-86322,-86370,-86417,-86464,-86512,-86559,-86607,-86654,-86702,-86749,-86797,-86844,-86891,-86939,-86986,-87034,-87081,-87128,-87176,-87223,-87271,-87318,-87365,-87413,-87460,-87508,-87555,-87602,-87650,-87697,-87744,-87792,-87839,-87887,-87934,-87981,-88029,-88076,-88123,-88171,-88218,-88265,-88313,-88360,-88407,-88455,-88502,-88549,-88597,-88644,-88691,-88738,-88786,-88833,-88880,-88928,-88975,-89022,-89069,-89117,-89164,-89211,-89259,-89306,-89353,-89400,-89448,-89495,-89542,-89589,-89637,-89684,-89731,-89778,-89825,-89873,-89920,-89967,-90014,-90062,-90109,-90156,-90203,-90250,-90298,-90345,-90392,-90439,-90486,-90533,-90581,-90628,-90675,-90722,-90769,-90816,-90864,-90911,-90958,-91005,-91052,-91099,-91146,-91194,-91241,-91288,-91335,-91382,-91429,-91476,-91523,-91570,-91618,-91665,-91712,-91759,-91806,-91853,-91900,-91947,-91994,-92041,-92088,-92135,-92182,-92229,-92277,-92324,-92371,-92418,-92465,-92512,-92559,-92606,-92653,-92700,-92747,-92794,-92841,-92888,-92935,-92982,-93029,-93076,-93123,-93170,-93217,-93264,-93311,-93358,-93405,-93452,-93499,-93546,-93593,-93639,-93686,-93733,-93780,-93827,-93874,-93921,-93968,-94015,-94062,-94109,-94156,-94203,-94250,-94296,-94343,-94390,-94437,-94484,-94531,-94578,-94625,-94672,-94718,-94765,-94812,-94859,-94906,-94953,-95000,-95046,-95093,-95140,-95187,-95234,-95281,-95327,-95374,-95421,-95468,-95515,-95561,-95608,-95655,-95702,-95749,-95795,-95842,-95889,-95936,-95983,-96029,-96076,-96123,-96170,-96216,-96263,-96310,-96357,-96403,-96450,-96497,-96544,-96590,-96637,-96684,-96731,-96777,-96824,-96871,-96917,-96964,-97011,-97057,-97104,-97151,-97198,-97244,-97291,-97338,-97384,-97431,-97478,-97524,-97571,-97618,-97664,-97711,-97757,-97804,-97851,-97897,-97944,-97991,-98037,-98084,-98130,-98177,-98224,-98270,-98317,-98363,-98410,-98457,-98503,-98550,-98596,-98643,-98690,-98736,-98783,-98829,-98876,-98922,-98969,-99015,-99062,-99109,-99155,-99202,-99248,-99295,-99341,-99388,-99434,-99481,-99527,-99574,-99620,-99667,-99713,-99760,-99806,-99853,-99899,-99946,-99992,-100038,-100085,-100131,-100178,-100224,-100271,-100317,-100364,-100410,-100456,-100503,-100549,-100596,-100642,-100689,-100735,-100781,-100828,-100874,-100921,-100967,-101013,-101060,-101106,-101152,-101199,-101245,-101292,-101338,-101384,-101431,-101477,-101523,-101570,-101616,-101662,-101709,-101755,-101801,-101848,-101894,-101940,-101987,-102033,-102079,-102125,-102172,-102218,-102264,-102311,-102357,-102403,-102449,-102496,-102542,-102588,-102634,-102681,-102727,-102773,-102819,-102866,-102912,-102958,-103004,-103051,-103097,-103143,-103189,-103235,-103282,-103328,-103374,-103420,-103466,-103513,-103559,-103605,-103651,-103697,-103743,-103790,-103836,-103882,-103928,-103974,-104020,-104066,-104113,-104159,-104205,-104251,-104297,-104343,-104389,-104435,-104482,-104528,-104574,-104620,-104666,-104712,-104758,-104804,-104850,-104896,-104942,-104988,-105034,-105081,-105127,-105173,-105219,-105265,-105311,-105357,-105403,-105449,-105495,-105541,-105587,-105633,-105679,-105725,-105771,-105817,-105863,-105909,-105955,-106001,-106047,-106093,-106139,-106185,-106231,-106277,-106322,-106368,-106414,-106460,-106506,-106552,-106598,-106644,-106690,-106736,-106782,-106828,-106874,-106919,-106965,-107011,-107057,-107103,-107149,-107195,-107241,-107286,-107332,-107378,-107424,-107470,-107516,-107562,-107607,-107653,-107699,-107745,-107791,-107837,-107882,-107928,-107974,-108020,-108066,-108111,-108157,-108203,-108249,-108294,-108340,-108386,-108432,-108478,-108523,-108569,-108615,-108661,-108706,-108752,-108798,-108844,-108889,-108935,-108981,-109026,-109072,-109118,-109164,-109209,-109255,-109301,-109346,-109392,-109438,-109483,-109529,-109575,-109620,-109666,-109712,-109757,-109803,-109849,-109894,-109940,-109985,-110031,-110077,-110122,-110168,-110214,-110259,-110305,-110350,-110396,-110442,-110487,-110533,-110578,-110624,-110669,-110715,-110761,-110806,-110852,-110897,-110943,-110988,-111034,-111079,-111125,-111170,-111216,-111261,-111307,-111352,-111398,-111443,-111489,-111534,-111580,-111625,-111671,-111716,-111762,-111807,-111853,-111898,-111944,-111989,-112035,-112080,-112125,-112171,-112216,-112262,-112307,-112353,-112398,-112443,-112489,-112534,-112580,-112625,-112670,-112716,-112761,-112807,-112852,-112897,-112943,-112988,-113033,-113079,-113124,-113169,-113215,-113260,-113305,-113351,-113396,-113441,-113487,-113532,-113577,-113623,-113668,-113713,-113758,-113804,-113849,-113894,-113940,-113985,-114030,-114075,-114121,-114166,-114211,-114256,-114302,-114347,-114392,-114437,-114482,-114528,-114573,-114618,-114663,-114709,-114754,-114799,-114844,-114889,-114934,-114980,-115025,-115070,-115115,-115160,-115205,-115251,-115296,-115341,-115386,-115431,-115476,-115521,-115566,-115612,-115657,-115702,-115747,-115792,-115837,-115882,-115927,-115972,-116017,-116063,-116108,-116153,-116198,-116243,-116288,-116333,-116378,-116423,-116468,-116513,-116558,-116603,-116648,-116693,-116738,-116783,-116828,-116873,-116918,-116963,-117008,-117053,-117098,-117143,-117188,-117233,-117278,-117323,-117368,-117413,-117458,-117503,-117548,-117592,-117637,-117682,-117727,-117772,-117817,-117862,-117907,-117952,-117997,-118041,-118086,-118131,-118176,-118221,-118266,-118311,-118356,-118400,-118445,-118490,-118535,-118580,-118625,-118669,-118714,-118759,-118804,-118849,-118893,-118938,-118983,-119028,-119073,-119117,-119162,-119207,-119252,-119296,-119341,-119386,-119431,-119475,-119520,-119565,-119610,-119654,-119699,-119744,-119789,-119833,-119878,-119923,-119967,-120012,-120057,-120101,-120146,-120191,-120235,-120280,-120325,-120369,-120414,-120459,-120503,-120548,-120593,-120637,-120682,-120726,-120771,-120816,-120860,-120905,-120949,-120994,-121039,-121083,-121128,-121172,-121217,-121262,-121306,-121351,-121395,-121440,-121484,-121529,-121573,-121618,-121662,-121707,-121751,-121796,-121841,-121885,-121930,-121974,-122018,-122063,-122107,-122152,-122196,-122241,-122285,-122330,-122374,-122419,-122463,-122508,-122552,-122596,-122641,-122685,-122730,-122774,-122819,-122863,-122907,-122952,-122996,-123041,-123085,-123129,-123174,-123218,-123262,-123307,-123351,-123395,-123440,-123484,-123528,-123573,-123617,-123661,-123706,-123750,-123794,-123839,-123883,-123927,-123972,-124016,-124060,-124104,-124149,-124193,-124237,-124282,-124326,-124370,-124414,-124459,-124503,-124547,-124591,-124635,-124680,-124724,-124768,-124812,-124856,-124901,-124945,-124989,-125033,-125077,-125122,-125166,-125210,-125254,-125298,-125342,-125387,-125431,-125475,-125519,-125563,-125607,-125651,-125695,-125740,-125784,-125828,-125872,-125916,-125960,-126004,-126048,-126092,-126136,-126180,-126224,-126268,-126313,-126357,-126401,-126445,-126489,-126533,-126577,-126621,-126665,-126709,-126753,-126797,-126841,-126885,-126929,-126973,-127017,-127061,-127105,-127149,-127192,-127236,-127280,-127324,-127368,-127412,-127456,-127500,-127544,-127588,-127632,-127676,-127720,-127763,-127807,-127851,-127895,-127939,-127983,-128027,-128071,-128114,-128158,-128202,-128246,-128290,-128334,-128377,-128421,-128465,-128509,-128553,-128597,-128640,-128684,-128728,-128772,-128815,-128859,-128903,-128947,-128991,-129034,-129078,-129122,-129166,-129209,-129253,-129297,-129340,-129384,-129428,-129472,-129515,-129559,-129603,-129646,-129690,-129734,-129777,-129821,-129865,-129908,-129952,-129996,-130039,-130083,-130127,-130170,-130214,-130258,-130301,-130345,-130388,-130432,-130476,-130519,-130563,-130606,-130650,-130694,-130737,-130781,-130824,-130868,-130911,-130955,-130998,-131042,-131086,-131129,-131173,-131216,-131260,-131303,-131347,-131390,-131434,-131477,-131521,-131564,-131608,-131651,-131694,-131738,-131781,-131825,-131868,-131912,-131955,-131999,-132042,-132085,-132129,-132172,-132216,-132259,-132302,-132346,-132389,-132433,-132476,-132519,-132563,-132606,-132649,-132693,-132736,-132779,-132823,-132866,-132909,-132953,-132996,-133039,-133083,-133126,-133169,-133213,-133256,-133299,-133342,-133386,-133429,-133472,-133516,-133559,-133602,-133645,-133689,-133732,-133775,-133818,-133861,-133905,-133948,-133991,-134034,-134077,-134121,-134164,-134207,-134250,-134293,-134337,-134380,-134423,-134466,-134509,-134552,-134595,-134639,-134682,-134725,-134768,-134811,-134854,-134897,-134940,-134983,-135027,-135070,-135113,-135156,-135199,-135242,-135285,-135328,-135371,-135414,-135457,-135500,-135543,-135586,-135629,-135672,-135715,-135758,-135801,-135844,-135887,-135930,-135973,-136016,-136059,-136102,-136145,-136188,-136231,-136274,-136317,-136360,-136403,-136446,-136489,-136531,-136574,-136617,-136660,-136703,-136746,-136789,-136832,-136875,-136917,-136960,-137003,-137046,-137089,-137132,-137175,-137217,-137260,-137303,-137346,-137389,-137431,-137474,-137517,-137560,-137603,-137645,-137688,-137731,-137774,-137816,-137859,-137902,-137945,-137987,-138030,-138073,-138116,-138158,-138201,-138244,-138287,-138329,-138372,-138415,-138457,-138500,-138543,-138585,-138628,-138671,-138713,-138756,-138799,-138841,-138884,-138926,-138969,-139012,-139054,-139097,-139140,-139182,-139225,-139267,-139310,-139352,-139395,-139438,-139480,-139523,-139565,-139608,-139650,-139693,-139735,-139778,-139820,-139863,-139906,-139948,-139991,-140033,-140076,-140118,-140160,-140203,-140245,-140288,-140330,-140373,-140415,-140458,-140500,-140543,-140585,-140627,-140670,-140712,-140755,-140797,-140839,-140882,-140924,-140967,-141009,-141051,-141094,-141136,-141178,-141221,-141263,-141305,-141348,-141390,-141432,-141475,-141517,-141559,-141602,-141644,-141686,-141729,-141771,-141813,-141855,-141898,-141940,-141982,-142024,-142067,-142109,-142151,-142193,-142236,-142278,-142320,-142362,-142404,-142447,-142489,-142531,-142573,-142615,-142658,-142700,-142742,-142784,-142826,-142868,-142911,-142953,-142995,-143037,-143079,-143121,-143163,-143205,-143247,-143290,-143332,-143374,-143416,-143458,-143500,-143542,-143584,-143626,-143668,-143710,-143752,-143794,-143836,-143878,-143920,-143962,-144004,-144046,-144088,-144130,-144172,-144214,-144256,-144298,-144340,-144382,-144424,-144466,-144508,-144550,-144592,-144634,-144676,-144718,-144760,-144801,-144843,-144885,-144927,-144969,-145011,-145053,-145095,-145136,-145178,-145220,-145262,-145304,-145346,-145388,-145429,-145471,-145513,-145555,-145597,-145638,-145680,-145722,-145764,-145806,-145847,-145889,-145931,-145973,-146014,-146056,-146098,-146140,-146181,-146223,-146265,-146306,-146348,-146390,-146432,-146473,-146515,-146557,-146598,-146640,-146682,-146723,-146765,-146807,-146848,-146890,-146931,-146973,-147015,-147056,-147098,-147140,-147181,-147223,-147264,-147306,-147347,-147389,-147431,-147472,-147514,-147555,-147597,-147638,-147680,-147721,-147763,-147804,-147846,-147887,-147929,-147970,-148012,-148053,-148095,-148136,-148178,-148219,-148261,-148302,-148344,-148385,-148427,-148468,-148509,-148551,-148592,-148634,-148675,-148716,-148758,-148799,-148841,-148882,-148923,-148965,-149006,-149047,-149089,-149130,-149171,-149213,-149254,-149295,-149337,-149378,-149419,-149461,-149502,-149543,-149584,-149626,-149667,-149708,-149750,-149791,-149832,-149873,-149915,-149956,-149997,-150038,-150079,-150121,-150162,-150203,-150244,-150285,-150327,-150368,-150409,-150450,-150491,-150532,-150574,-150615,-150656,-150697,-150738,-150779,-150820,-150861,-150903,-150944,-150985,-151026,-151067,-151108,-151149,-151190,-151231,-151272,-151313,-151354,-151395,-151436,-151477,-151518,-151559,-151600,-151641,-151682,-151723,-151764,-151805,-151846,-151887,-151928,-151969,-152010,-152051,-152092,-152133,-152174,-152215,-152256,-152297,-152338,-152379,-152420,-152460,-152501,-152542,-152583,-152624,-152665,-152706,-152747,-152787,-152828,-152869,-152910,-152951,-152992,-153032,-153073,-153114,-153155,-153196,-153236,-153277,-153318,-153359,-153399,-153440,-153481,-153522,-153562,-153603,-153644,-153685,-153725,-153766,-153807,-153847,-153888,-153929,-153969,-154010,-154051,-154092,-154132,-154173,-154213,-154254,-154295,-154335,-154376,-154417,-154457,-154498,-154538,-154579,-154620,-154660,-154701,-154741,-154782,-154823,-154863,-154904,-154944,-154985,-155025,-155066,-155106,-155147,-155187,-155228,-155268,-155309,-155349,-155390,-155430,-155471,-155511,-155552,-155592,-155633,-155673,-155714,-155754,-155794,-155835,-155875,-155916,-155956,-155996,-156037,-156077,-156118,-156158,-156198,-156239,-156279,-156319,-156360,-156400,-156440,-156481,-156521,-156561,-156602,-156642,-156682,-156723,-156763,-156803,-156844,-156884,-156924,-156964,-157005,-157045,-157085,-157125,-157166,-157206,-157246,-157286,-157326,-157367,-157407,-157447,-157487,-157527,-157568,-157608,-157648,-157688,-157728,-157768,-157808,-157849,-157889,-157929,-157969,-158009,-158049,-158089,-158129,-158169,-158210,-158250,-158290,-158330,-158370,-158410,-158450,-158490,-158530,-158570,-158610,-158650,-158690,-158730,-158770,-158810,-158850,-158890,-158930,-158970,-159010,-159050,-159090,-159130,-159170,-159210,-159250,-159290,-159329,-159369,-159409,-159449,-159489,-159529,-159569,-159609,-159649,-159688,-159728,-159768,-159808,-159848,-159888,-159928,-159967,-160007,-160047,-160087,-160127,-160166,-160206,-160246,-160286,-160326,-160365,-160405,-160445,-160485,-160524,-160564,-160604,-160643,-160683,-160723,-160763,-160802,-160842,-160882,-160921,-160961,-161001,-161040,-161080,-161120,-161159,-161199,-161239,-161278,-161318,-161358,-161397,-161437,-161476,-161516,-161556,-161595,-161635,-161674,-161714,-161753,-161793,-161832,-161872,-161912,-161951,-161991,-162030,-162070,-162109,-162149,-162188,-162228,-162267,-162307,-162346,-162385,-162425,-162464,-162504,-162543,-162583,-162622,-162662,-162701,-162740,-162780,-162819,-162859,-162898,-162937,-162977,-163016,-163055,-163095,-163134,-163173,-163213,-163252,-163291,-163331,-163370,-163409,-163449,-163488,-163527,-163567,-163606,-163645,-163684,-163724,-163763,-163802,-163841,-163881,-163920,-163959,-163998,-164038,-164077,-164116,-164155,-164194,-164233,-164273,-164312,-164351,-164390,-164429,-164468,-164508,-164547,-164586,-164625,-164664,-164703,-164742,-164781,-164820,-164860,-164899,-164938,-164977,-165016,-165055,-165094,-165133,-165172,-165211,-165250,-165289,-165328,-165367,-165406,-165445,-165484,-165523,-165562,-165601,-165640,-165679,-165718,-165757,-165796,-165835,-165874,-165913,-165951,-165990,-166029,-166068,-166107,-166146,-166185,-166224,-166263,-166301,-166340,-166379,-166418,-166457,-166496,-166534,-166573,-166612,-166651,-166690,-166728,-166767,-166806,-166845,-166884,-166922,-166961,-167000,-167039,-167077,-167116,-167155,-167193,-167232,-167271,-167310,-167348,-167387,-167426,-167464,-167503,-167542,-167580,-167619,-167658,-167696,-167735,-167773,-167812,-167851,-167889,-167928,-167967,-168005,-168044,-168082,-168121,-168159,-168198,-168237,-168275,-168314,-168352,-168391,-168429,-168468,-168506,-168545,-168583,-168622,-168660,-168699,-168737,-168776,-168814,-168852,-168891,-168929,-168968,-169006,-169045,-169083,-169121,-169160,-169198,-169237,-169275,-169313,-169352,-169390,-169429,-169467,-169505,-169544,-169582,-169620,-169659,-169697,-169735,-169773,-169812,-169850,-169888,-169927,-169965,-170003,-170041,-170080,-170118,-170156,-170194,-170233,-170271,-170309,-170347,-170385,-170424,-170462,-170500,-170538,-170576,-170615,-170653,-170691,-170729,-170767,-170805,-170843,-170882,-170920,-170958,-170996,-171034,-171072,-171110,-171148,-171186,-171224,-171262,-171300,-171338,-171377,-171415,-171453,-171491,-171529,-171567,-171605,-171643,-171681,-171719,-171757,-171795,-171833,-171870,-171908,-171946,-171984,-172022,-172060,-172098,-172136,-172174,-172212,-172250,-172288,-172325,-172363,-172401,-172439,-172477,-172515,-172553,-172590,-172628,-172666,-172704,-172742,-172780,-172817,-172855,-172893,-172931,-172968,-173006,-173044,-173082,-173120,-173157,-173195,-173233,-173270,-173308,-173346,-173384,-173421,-173459,-173497,-173534,-173572,-173610,-173647,-173685,-173723,-173760,-173798,-173836,-173873,-173911,-173948,-173986,-174024,-174061,-174099,-174136,-174174,-174211,-174249,-174287,-174324,-174362,-174399,-174437,-174474,-174512,-174549,-174587,-174624,-174662,-174699,-174737,-174774,-174812,-174849,-174886,-174924,-174961,-174999,-175036,-175074,-175111,-175148,-175186,-175223,-175261,-175298,-175335,-175373,-175410,-175447,-175485,-175522,-175559,-175597,-175634,-175671,-175709,-175746,-175783,-175821,-175858,-175895,-175932,-175970,-176007,-176044,-176081,-176119,-176156,-176193,-176230,-176267,-176305,-176342,-176379,-176416,-176453,-176491,-176528,-176565,-176602,-176639,-176676,-176713,-176751,-176788,-176825,-176862,-176899,-176936,-176973,-177010,-177047,-177084,-177122,-177159,-177196,-177233,-177270,-177307,-177344,-177381,-177418,-177455,-177492,-177529,-177566,-177603,-177640,-177677,-177714,-177751,-177787,-177824,-177861,-177898,-177935,-177972,-178009,-178046,-178083,-178120,-178157,-178193,-178230,-178267,-178304,-178341,-178378,-178414,-178451,-178488,-178525,-178562,-178599,-178635,-178672,-178709,-178746,-178782,-178819,-178856,-178893,-178929,-178966,-179003,-179040,-179076,-179113,-179150,-179186,-179223,-179260,-179296,-179333,-179370,-179406,-179443,-179480,-179516,-179553,-179590,-179626,-179663,-179699,-179736,-179773,-179809,-179846,-179882,-179919,-179955,-179992,-180028,-180065,-180102,-180138,-180175,-180211,-180248,-180284,-180321,-180357,-180394,-180430,-180466,-180503,-180539,-180576,-180612,-180649,-180685,-180722,-180758,-180794,-180831,-180867,-180903,-180940,-180976,-181013,-181049,-181085,-181122,-181158,-181194,-181231,-181267,-181303,-181340,-181376,-181412,-181448,-181485,-181521,-181557,-181593,-181630,-181666,-181702,-181738,-181775,-181811,-181847,-181883,-181919,-181956,-181992,-182028,-182064,-182100,-182136,-182173,-182209,-182245,-182281,-182317,-182353,-182389,-182425,-182462,-182498,-182534,-182570,-182606,-182642,-182678,-182714,-182750,-182786,-182822,-182858,-182894,-182930,-182966,-183002,-183038,-183074,-183110,-183146,-183182,-183218,-183254,-183290,-183326,-183362,-183398,-183434,-183469,-183505,-183541,-183577,-183613,-183649,-183685,-183721,-183756,-183792,-183828,-183864,-183900,-183936,-183971,-184007,-184043,-184079,-184115,-184150,-184186,-184222,-184258,-184293,-184329,-184365,-184401,-184436,-184472,-184508,-184544,-184579,-184615,-184651,-184686,-184722,-184758,-184793,-184829,-184865,-184900,-184936,-184971,-185007,-185043,-185078,-185114,-185149,-185185,-185221,-185256,-185292,-185327,-185363,-185398,-185434,-185469,-185505,-185540,-185576,-185611,-185647,-185682,-185718,-185753,-185789,-185824,-185860,-185895,-185931,-185966,-186001,-186037,-186072,-186108,-186143,-186178,-186214,-186249,-186285,-186320,-186355,-186391,-186426,-186461,-186497,-186532,-186567,-186603,-186638,-186673,-186709,-186744,-186779,-186814,-186850,-186885,-186920,-186955,-186991,-187026,-187061,-187096,-187131,-187167,-187202,-187237,-187272,-187307,-187342,-187378,-187413,-187448,-187483,-187518,-187553,-187588,-187624,-187659,-187694,-187729,-187764,-187799,-187834,-187869,-187904,-187939,-187974,-188009,-188044,-188079,-188114,-188149,-188184,-188219,-188254,-188289,-188324,-188359,-188394,-188429,-188464,-188499,-188534,-188569,-188604,-188639,-188674,-188708,-188743,-188778,-188813,-188848,-188883,-188918,-188953,-188987,-189022,-189057,-189092,-189127,-189161,-189196,-189231,-189266,-189301,-189335,-189370,-189405,-189440,-189474,-189509,-189544,-189579,-189613,-189648,-189683,-189717,-189752,-189787,-189821,-189856,-189891,-189925,-189960,-189995,-190029,-190064,-190098,-190133,-190168,-190202,-190237,-190271,-190306,-190341,-190375,-190410,-190444,-190479,-190513,-190548,-190582,-190617,-190651,-190686,-190720,-190755,-190789,-190824,-190858,-190893,-190927,-190962,-190996,-191030,-191065,-191099,-191134,-191168,-191202,-191237,-191271,-191306,-191340,-191374,-191409,-191443,-191477,-191512,-191546,-191580,-191615,-191649,-191683,-191717,-191752,-191786,-191820,-191855,-191889,-191923,-191957,-191991,-192026,-192060,-192094,-192128,-192163,-192197,-192231,-192265,-192299,-192333,-192368,-192402,-192436,-192470,-192504,-192538,-192572,-192606,-192640,-192675,-192709,-192743,-192777,-192811,-192845,-192879,-192913,-192947,-192981,-193015,-193049,-193083,-193117,-193151,-193185,-193219,-193253,-193287,-193321,-193355,-193389,-193423,-193457,-193491,-193524,-193558,-193592,-193626,-193660,-193694,-193728,-193762,-193795,-193829,-193863,-193897,-193931,-193965,-193998,-194032,-194066,-194100,-194134,-194167,-194201,-194235,-194269,-194302,-194336,-194370,-194404,-194437,-194471,-194505,-194538,-194572,-194606,-194639,-194673,-194707,-194740,-194774,-194808,-194841,-194875,-194909,-194942,-194976,-195009,-195043,-195077,-195110,-195144,-195177,-195211,-195244,-195278,-195311,-195345,-195378,-195412,-195445,-195479,-195512,-195546,-195579,-195613,-195646,-195680,-195713,-195747,-195780,-195814,-195847,-195880,-195914,-195947,-195981,-196014,-196047,-196081,-196114,-196147,-196181,-196214,-196247,-196281,-196314,-196347,-196381,-196414,-196447,-196480,-196514,-196547,-196580,-196614,-196647,-196680,-196713,-196746,-196780,-196813,-196846,-196879,-196912,-196946,-196979,-197012,-197045,-197078,-197111,-197145,-197178,-197211,-197244,-197277,-197310,-197343,-197376,-197409,-197442,-197475,-197509,-197542,-197575,-197608,-197641,-197674,-197707,-197740,-197773,-197806,-197839,-197872,-197905,-197938,-197971,-198003,-198036,-198069,-198102,-198135,-198168,-198201,-198234,-198267,-198300,-198333,-198365,-198398,-198431,-198464,-198497,-198530,-198562,-198595,-198628,-198661,-198694,-198726,-198759,-198792,-198825,-198857,-198890,-198923,-198956,-198988,-199021,-199054,-199087,-199119,-199152,-199185,-199217,-199250,-199283,-199315,-199348,-199381,-199413,-199446,-199478,-199511,-199544,-199576,-199609,-199641,-199674,-199707,-199739,-199772,-199804,-199837,-199869,-199902,-199934,-199967,-199999,-200032,-200064,-200097,-200129,-200162,-200194,-200227,-200259,-200291,-200324,-200356,-200389,-200421,-200453,-200486,-200518,-200551,-200583,-200615,-200648,-200680,-200712,-200745,-200777,-200809,-200842,-200874,-200906,-200939,-200971,-201003,-201035,-201068,-201100,-201132,-201164,-201197,-201229,-201261,-201293,-201325,-201358,-201390,-201422,-201454,-201486,-201518,-201551,-201583,-201615,-201647,-201679,-201711,-201743,-201775,-201807,-201840,-201872,-201904,-201936,-201968,-202000,-202032,-202064,-202096,-202128,-202160,-202192,-202224,-202256,-202288,-202320,-202352,-202384,-202416,-202448,-202480,-202511,-202543,-202575,-202607,-202639,-202671,-202703,-202735,-202767,-202798,-202830,-202862,-202894,-202926,-202958,-202989,-203021,-203053,-203085,-203117,-203148,-203180,-203212,-203244,-203275,-203307,-203339,-203371,-203402,-203434,-203466,-203497,-203529,-203561,-203592,-203624,-203656,-203687,-203719,-203751,-203782,-203814,-203845,-203877,-203909,-203940,-203972,-204003,-204035,-204066,-204098,-204130,-204161,-204193,-204224,-204256,-204287,-204319,-204350,-204382,-204413,-204445,-204476,-204507,-204539,-204570,-204602,-204633,-204665,-204696,-204727,-204759,-204790,-204822,-204853,-204884,-204916,-204947,-204978,-205010,-205041,-205072,-205104,-205135,-205166,-205197,-205229,-205260,-205291,-205323,-205354,-205385,-205416,-205447,-205479,-205510,-205541,-205572,-205603,-205635,-205666,-205697,-205728,-205759,-205790,-205822,-205853,-205884,-205915,-205946,-205977,-206008,-206039,-206070,-206101,-206132,-206164,-206195,-206226,-206257,-206288,-206319,-206350,-206381,-206412,-206443,-206474,-206505,-206536,-206566,-206597,-206628,-206659,-206690,-206721,-206752,-206783,-206814,-206845,-206876,-206906,-206937,-206968,-206999,-207030,-207061,-207091,-207122,-207153,-207184,-207215,-207245,-207276,-207307,-207338,-207369,-207399,-207430,-207461,-207491,-207522,-207553,-207584,-207614,-207645,-207676,-207706,-207737,-207768,-207798,-207829,-207860,-207890,-207921,-207951,-207982,-208013,-208043,-208074,-208104,-208135,-208165,-208196,-208227,-208257,-208288,-208318,-208349,-208379,-208410,-208440,-208471,-208501,-208532,-208562,-208592,-208623,-208653,-208684,-208714,-208745,-208775,-208805,-208836,-208866,-208896,-208927,-208957,-208988,-209018,-209048,-209079,-209109,-209139,-209169,-209200,-209230,-209260,-209291,-209321,-209351,-209381,-209412,-209442,-209472,-209502,-209533,-209563,-209593,-209623,-209653,-209683,-209714,-209744,-209774,-209804,-209834,-209864,-209894,-209925,-209955,-209985,-210015,-210045,-210075,-210105,-210135,-210165,-210195,-210225,-210255,-210285,-210315,-210345,-210375,-210405,-210435,-210465,-210495,-210525,-210555,-210585,-210615,-210645,-210675,-210705,-210735,-210764,-210794,-210824,-210854,-210884,-210914,-210944,-210973,-211003,-211033,-211063,-211093,-211123,-211152,-211182,-211212,-211242,-211271,-211301,-211331,-211361,-211390,-211420,-211450,-211480,-211509,-211539,-211569,-211598,-211628,-211658,-211687,-211717,-211747,-211776,-211806,-211835,-211865,-211895,-211924,-211954,-211983,-212013,-212042,-212072,-212102,-212131,-212161,-212190,-212220,-212249,-212279,-212308,-212338,-212367,-212397,-212426,-212455,-212485,-212514,-212544,-212573,-212603,-212632,-212661,-212691,-212720,-212750,-212779,-212808,-212838,-212867,-212896,-212926,-212955,-212984,-213014,-213043,-213072,-213101,-213131,-213160,-213189,-213218,-213248,-213277,-213306,-213335,-213365,-213394,-213423,-213452,-213481,-213510,-213540,-213569,-213598,-213627,-213656,-213685,-213714,-213744,-213773,-213802,-213831,-213860,-213889,-213918,-213947,-213976,-214005,-214034,-214063,-214092,-214121,-214150,-214179,-214208,-214237,-214266,-214295,-214324,-214353,-214382,-214411,-214440,-214469,-214497,-214526,-214555,-214584,-214613,-214642,-214671,-214700,-214728,-214757,-214786,-214815,-214844,-214872,-214901,-214930,-214959,-214988,-215016,-215045,-215074,-215103,-215131,-215160,-215189,-215217,-215246,-215275,-215303,-215332,-215361,-215389,-215418,-215447,-215475,-215504,-215533,-215561,-215590,-215618,-215647,-215676,-215704,-215733,-215761,-215790,-215818,-215847,-215875,-215904,-215932,-215961,-215989,-216018,-216046,-216075,-216103,-216132,-216160,-216189,-216217,-216245,-216274,-216302,-216331,-216359,-216387,-216416,-216444,-216472,-216501,-216529,-216557,-216586,-216614,-216642,-216671,-216699,-216727,-216756,-216784,-216812,-216840,-216869,-216897,-216925,-216953,-216981,-217010,-217038,-217066,-217094,-217122,-217151,-217179,-217207,-217235,-217263,-217291,-217319,-217347,-217376,-217404,-217432,-217460,-217488,-217516,-217544,-217572,-217600,-217628,-217656,-217684,-217712,-217740,-217768,-217796,-217824,-217852,-217880,-217908,-217936,-217964,-217992,-218020,-218048,-218075,-218103,-218131,-218159,-218187,-218215,-218243,-218270,-218298,-218326,-218354,-218382,-218410,-218437,-218465,-218493,-218521,-218548,-218576,-218604,-218632,-218659,-218687,-218715,-218743,-218770,-218798,-218826,-218853,-218881,-218909,-218936,-218964,-218992,-219019,-219047,-219074,-219102,-219130,-219157,-219185,-219212,-219240,-219267,-219295,-219323,-219350,-219378,-219405,-219433,-219460,-219488,-219515,-219543,-219570,-219597,-219625,-219652,-219680,-219707,-219735,-219762,-219789,-219817,-219844,-219872,-219899,-219926,-219954,-219981,-220008,-220036,-220063,-220090,-220118,-220145,-220172,-220199,-220227,-220254,-220281,-220308,-220336,-220363,-220390,-220417,-220445,-220472,-220499,-220526,-220553,-220580,-220608,-220635,-220662,-220689,-220716,-220743,-220770,-220797,-220825,-220852,-220879,-220906,-220933,-220960,-220987,-221014,-221041,-221068,-221095,-221122,-221149,-221176,-221203,-221230,-221257,-221284,-221311,-221338,-221365,-221392,-221418,-221445,-221472,-221499,-221526,-221553,-221580,-221607,-221633,-221660,-221687,-221714,-221741,-221768,-221794,-221821,-221848,-221875,-221902,-221928,-221955,-221982,-222009,-222035,-222062,-222089,-222115,-222142,-222169,-222195,-222222,-222249,-222275,-222302,-222329,-222355,-222382,-222409,-222435,-222462,-222488,-222515,-222541,-222568,-222595,-222621,-222648,-222674,-222701,-222727,-222754,-222780,-222807,-222833,-222860,-222886,-222913,-222939,-222965,-222992,-223018,-223045,-223071,-223098,-223124,-223150,-223177,-223203,-223229,-223256,-223282,-223308,-223335,-223361,-223387,-223414,-223440,-223466,-223492,-223519,-223545,-223571,-223598,-223624,-223650,-223676,-223702,-223729,-223755,-223781,-223807,-223833,-223859,-223886,-223912,-223938,-223964,-223990,-224016,-224042,-224068,-224095,-224121,-224147,-224173,-224199,-224225,-224251,-224277,-224303,-224329,-224355,-224381,-224407,-224433,-224459,-224485,-224511,-224537,-224563,-224589,-224614,-224640,-224666,-224692,-224718,-224744,-224770,-224796,-224822,-224847,-224873,-224899,-224925,-224951,-224977,-225002,-225028,-225054,-225080,-225105,-225131,-225157,-225183,-225208,-225234,-225260,-225286,-225311,-225337,-225363,-225388,-225414,-225440,-225465,-225491,-225516,-225542,-225568,-225593,-225619,-225645,-225670,-225696,-225721,-225747,-225772,-225798,-225823,-225849,-225874,-225900,-225925,-225951,-225976,-226002,-226027,-226053,-226078,-226104,-226129,-226155,-226180,-226205,-226231,-226256,-226282,-226307,-226332,-226358,-226383,-226408,-226434,-226459,-226484,-226510,-226535,-226560,-226585,-226611,-226636,-226661,-226687,-226712,-226737,-226762,-226787,-226813,-226838,-226863,-226888,-226913,-226939,-226964,-226989,-227014,-227039,-227064,-227089,-227114,-227140,-227165,-227190,-227215,-227240,-227265,-227290,-227315,-227340,-227365,-227390,-227415,-227440,-227465,-227490,-227515,-227540,-227565,-227590,-227615,-227640,-227665,-227690,-227715,-227739,-227764,-227789,-227814,-227839,-227864,-227889,-227913,-227938,-227963,-227988,-228013,-228038,-228062,-228087,-228112,-228137,-228161,-228186,-228211,-228236,-228260,-228285,-228310,-228334,-228359,-228384,-228408,-228433,-228458,-228482,-228507,-228532,-228556,-228581,-228606,-228630,-228655,-228679,-228704,-228728,-228753,-228778,-228802,-228827,-228851,-228876,-228900,-228925,-228949,-228974,-228998,-229023,-229047,-229071,-229096,-229120,-229145,-229169,-229193,-229218,-229242,-229267,-229291,-229315,-229340,-229364,-229388,-229413,-229437,-229461,-229486,-229510,-229534,-229559,-229583,-229607,-229631,-229656,-229680,-229704,-229728,-229752,-229777,-229801,-229825,-229849,-229873,-229897,-229922,-229946,-229970,-229994,-230018,-230042,-230066,-230090,-230115,-230139,-230163,-230187,-230211,-230235,-230259,-230283,-230307,-230331,-230355,-230379,-230403,-230427,-230451,-230475,-230499,-230523,-230547,-230570,-230594,-230618,-230642,-230666,-230690,-230714,-230738,-230761,-230785,-230809,-230833,-230857,-230881,-230904,-230928,-230952,-230976,-231000,-231023,-231047,-231071,-231095,-231118,-231142,-231166,-231189,-231213,-231237,-231260,-231284,-231308,-231331,-231355,-231379,-231402,-231426,-231449,-231473,-231497,-231520,-231544,-231567,-231591,-231614,-231638,-231662,-231685,-231709,-231732,-231756,-231779,-231803,-231826,-231849,-231873,-231896,-231920,-231943,-231967,-231990,-232013,-232037,-232060,-232084,-232107,-232130,-232154,-232177,-232200,-232224,-232247,-232270,-232294,-232317,-232340,-232363,-232387,-232410,-232433,-232456,-232480,-232503,-232526,-232549,-232573,-232596,-232619,-232642,-232665,-232688,-232712,-232735,-232758,-232781,-232804,-232827,-232850,-232873,-232896,-232919,-232943,-232966,-232989,-233012,-233035,-233058,-233081,-233104,-233127,-233150,-233173,-233196,-233219,-233242,-233264,-233287,-233310,-233333,-233356,-233379,-233402,-233425,-233448,-233471,-233493,-233516,-233539,-233562,-233585,-233608,-233630,-233653,-233676,-233699,-233721,-233744,-233767,-233790,-233812,-233835,-233858,-233881,-233903,-233926,-233949,-233971,-233994,-234017,-234039,-234062,-234085,-234107,-234130,-234152,-234175,-234198,-234220,-234243,-234265,-234288,-234310,-234333,-234355,-234378,-234400,-234423,-234445,-234468,-234490,-234513,-234535,-234558,-234580,-234603,-234625,-234648,-234670,-234692,-234715,-234737,-234759,-234782,-234804,-234827,-234849,-234871,-234893,-234916,-234938,-234960,-234983,-235005,-235027,-235049,-235072,-235094,-235116,-235138,-235161,-235183,-235205,-235227,-235249,-235272,-235294,-235316,-235338,-235360,-235382,-235404,-235427,-235449,-235471,-235493,-235515,-235537,-235559,-235581,-235603,-235625,-235647,-235669,-235691,-235713,-235735,-235757,-235779,-235801,-235823,-235845,-235867,-235889,-235911,-235933,-235955,-235977,-235998,-236020,-236042,-236064,-236086,-236108,-236130,-236151,-236173,-236195,-236217,-236239,-236260,-236282,-236304,-236326,-236347,-236369,-236391,-236413,-236434,-236456,-236478,-236499,-236521,-236543,-236564,-236586,-236608,-236629,-236651,-236673,-236694,-236716,-236737,-236759,-236781,-236802,-236824,-236845,-236867,-236888,-236910,-236931,-236953,-236974,-236996,-237017,-237039,-237060,-237082,-237103,-237125,-237146,-237167,-237189,-237210,-237232,-237253,-237274,-237296,-237317,-237338,-237360,-237381,-237402,-237424,-237445,-237466,-237488,-237509,-237530,-237551,-237573,-237594,-237615,-237636,-237658,-237679,-237700,-237721,-237742,-237764,-237785,-237806,-237827,-237848,-237869,-237890,-237912,-237933,-237954,-237975,-237996,-238017,-238038,-238059,-238080,-238101,-238122,-238143,-238164,-238185,-238206,-238227,-238248,-238269,-238290,-238311,-238332,-238353,-238374,-238395,-238416,-238436,-238457,-238478,-238499,-238520,-238541,-238562,-238582,-238603,-238624,-238645,-238666,-238687,-238707,-238728,-238749,-238770,-238790,-238811,-238832,-238852,-238873,-238894,-238915,-238935,-238956,-238977,-238997,-239018,-239039,-239059,-239080,-239100,-239121,-239142,-239162,-239183,-239203,-239224,-239244,-239265,-239286,-239306,-239327,-239347,-239368,-239388,-239409,-239429,-239449,-239470,-239490,-239511,-239531,-239552,-239572,-239592,-239613,-239633,-239654,-239674,-239694,-239715,-239735,-239755,-239776,-239796,-239816,-239837,-239857,-239877,-239897,-239918,-239938,-239958,-239978,-239999,-240019,-240039,-240059,-240079,-240100,-240120,-240140,-240160,-240180,-240200,-240220,-240241,-240261,-240281,-240301,-240321,-240341,-240361,-240381,-240401,-240421,-240441,-240461,-240481,-240501,-240521,-240541,-240561,-240581,-240601,-240621,-240641,-240661,-240681,-240701,-240721,-240741,-240761,-240780,-240800,-240820,-240840,-240860,-240880,-240900,-240919,-240939,-240959,-240979,-240999,-241018,-241038,-241058,-241078,-241097,-241117,-241137,-241156,-241176,-241196,-241216,-241235,-241255,-241275,-241294,-241314,-241333,-241353,-241373,-241392,-241412,-241432,-241451,-241471,-241490,-241510,-241529,-241549,-241568,-241588,-241607,-241627,-241646,-241666,-241685,-241705,-241724,-241744,-241763,-241783,-241802,-241821,-241841,-241860,-241880,-241899,-241918,-241938,-241957,-241976,-241996,-242015,-242034,-242054,-242073,-242092,-242111,-242131,-242150,-242169,-242188,-242208,-242227,-242246,-242265,-242285,-242304,-242323,-242342,-242361,-242380,-242400,-242419,-242438,-242457,-242476,-242495,-242514,-242533,-242552,-242571,-242590,-242610,-242629,-242648,-242667,-242686,-242705,-242724,-242743,-242762,-242781,-242799,-242818,-242837,-242856,-242875,-242894,-242913,-242932,-242951,-242970,-242989,-243007,-243026,-243045,-243064,-243083,-243102,-243120,-243139,-243158,-243177,-243195,-243214,-243233,-243252,-243270,-243289,-243308,-243327,-243345,-243364,-243383,-243401,-243420,-243439,-243457,-243476,-243495,-243513,-243532,-243550,-243569,-243587,-243606,-243625,-243643,-243662,-243680,-243699,-243717,-243736,-243754,-243773,-243791,-243810,-243828,-243847,-243865,-243884,-243902,-243920,-243939,-243957,-243976,-243994,-244012,-244031,-244049,-244067,-244086,-244104,-244122,-244141,-244159,-244177,-244196,-244214,-244232,-244250,-244269,-244287,-244305,-244323,-244342,-244360,-244378,-244396,-244414,-244432,-244451,-244469,-244487,-244505,-244523,-244541,-244559,-244577,-244596,-244614,-244632,-244650,-244668,-244686,-244704,-244722,-244740,-244758,-244776,-244794,-244812,-244830,-244848,-244866,-244884,-244902,-244920,-244937,-244955,-244973,-244991,-245009,-245027,-245045,-245063,-245080,-245098,-245116,-245134,-245152,-245170,-245187,-245205,-245223,-245241,-245258,-245276,-245294,-245312,-245329,-245347,-245365,-245382,-245400,-245418,-245435,-245453,-245471,-245488,-245506,-245524,-245541,-245559,-245576,-245594,-245612,-245629,-245647,-245664,-245682,-245699,-245717,-245734,-245752,-245769,-245787,-245804,-245822,-245839,-245857,-245874,-245891,-245909,-245926,-245944,-245961,-245978,-245996,-246013,-246031,-246048,-246065,-246083,-246100,-246117,-246135,-246152,-246169,-246186,-246204,-246221,-246238,-246255,-246273,-246290,-246307,-246324,-246341,-246359,-246376,-246393,-246410,-246427,-246444,-246462,-246479,-246496,-246513,-246530,-246547,-246564,-246581,-246598,-246615,-246632,-246649,-246666,-246683,-246700,-246717,-246734,-246751,-246768,-246785,-246802,-246819,-246836,-246853,-246870,-246887,-246904,-246921,-246937,-246954,-246971,-246988,-247005,-247022,-247039,-247055,-247072,-247089,-247106,-247122,-247139,-247156,-247173,-247189,-247206,-247223,-247240,-247256,-247273,-247290,-247306,-247323,-247340,-247356,-247373,-247390,-247406,-247423,-247439,-247456,-247473,-247489,-247506,-247522,-247539,-247555,-247572,-247588,-247605,-247621,-247638,-247654,-247671,-247687,-247704,-247720,-247737,-247753,-247770,-247786,-247802,-247819,-247835,-247852,-247868,-247884,-247901,-247917,-247933,-247950,-247966,-247982,-247999,-248015,-248031,-248047,-248064,-248080,-248096,-248112,-248129,-248145,-248161,-248177,-248193,-248210,-248226,-248242,-248258,-248274,-248290,-248306,-248322,-248339,-248355,-248371,-248387,-248403,-248419,-248435,-248451,-248467,-248483,-248499,-248515,-248531,-248547,-248563,-248579,-248595,-248611,-248627,-248643,-248659,-248675,-248690,-248706,-248722,-248738,-248754,-248770,-248786,-248802,-248817,-248833,-248849,-248865,-248881,-248896,-248912,-248928,-248944,-248959,-248975,-248991,-249007,-249022,-249038,-249054,-249069,-249085,-249101,-249116,-249132,-249148,-249163,-249179,-249194,-249210,-249226,-249241,-249257,-249272,-249288,-249303,-249319,-249334,-249350,-249366,-249381,-249397,-249412,-249427,-249443,-249458,-249474,-249489,-249505,-249520,-249535,-249551,-249566,-249582,-249597,-249612,-249628,-249643,-249658,-249674,-249689,-249704,-249720,-249735,-249750,-249765,-249781,-249796,-249811,-249826,-249842,-249857,-249872,-249887,-249902,-249918,-249933,-249948,-249963,-249978,-249993,-250008,-250024,-250039,-250054,-250069,-250084,-250099,-250114,-250129,-250144,-250159,-250174,-250189,-250204,-250219,-250234,-250249,-250264,-250279,-250294,-250309,-250324,-250339,-250354,-250369,-250384,-250398,-250413,-250428,-250443,-250458,-250473,-250488,-250502,-250517,-250532,-250547,-250561,-250576,-250591,-250606,-250621,-250635,-250650,-250665,-250679,-250694,-250709,-250723,-250738,-250753,-250767,-250782,-250797,-250811,-250826,-250841,-250855,-250870,-250884,-250899,-250913,-250928,-250943,-250957,-250972,-250986,-251001,-251015,-251030,-251044,-251059,-251073,-251087,-251102,-251116,-251131,-251145,-251160,-251174,-251188,-251203,-251217,-251231,-251246,-251260,-251274,-251289,-251303,-251317,-251332,-251346,-251360,-251374,-251389,-251403,-251417,-251431,-251446,-251460,-251474,-251488,-251502,-251517,-251531,-251545,-251559,-251573,-251587,-251601,-251616,-251630,-251644,-251658,-251672,-251686,-251700,-251714,-251728,-251742,-251756,-251770,-251784,-251798,-251812,-251826,-251840,-251854,-251868,-251882,-251896,-251910,-251924,-251937,-251951,-251965,-251979,-251993,-252007,-252021,-252034,-252048,-252062,-252076,-252090,-252103,-252117,-252131,-252145,-252158,-252172,-252186,-252200,-252213,-252227,-252241,-252254,-252268,-252282,-252295,-252309,-252323,-252336,-252350,-252364,-252377,-252391,-252404,-252418,-252431,-252445,-252459,-252472,-252486,-252499,-252513,-252526,-252540,-252553,-252567,-252580,-252593,-252607,-252620,-252634,-252647,-252661,-252674,-252687,-252701,-252714,-252727,-252741,-252754,-252767,-252781,-252794,-252807,-252821,-252834,-252847,-252860,-252874,-252887,-252900,-252913,-252927,-252940,-252953,-252966,-252979,-252993,-253006,-253019,-253032,-253045,-253058,-253071,-253084,-253098,-253111,-253124,-253137,-253150,-253163,-253176,-253189,-253202,-253215,-253228,-253241,-253254,-253267,-253280,-253293,-253306,-253319,-253332,-253345,-253358,-253370,-253383,-253396,-253409,-253422,-253435,-253448,-253460,-253473,-253486,-253499,-253512,-253524,-253537,-253550,-253563,-253576,-253588,-253601,-253614,-253626,-253639,-253652,-253665,-253677,-253690,-253703,-253715,-253728,-253740,-253753,-253766,-253778,-253791,-253803,-253816,-253829,-253841,-253854,-253866,-253879,-253891,-253904,-253916,-253929,-253941,-253954,-253966,-253979,-253991,-254003,-254016,-254028,-254041,-254053,-254066,-254078,-254090,-254103,-254115,-254127,-254140,-254152,-254164,-254177,-254189,-254201,-254213,-254226,-254238,-254250,-254262,-254275,-254287,-254299,-254311,-254323,-254336,-254348,-254360,-254372,-254384,-254396,-254409,-254421,-254433,-254445,-254457,-254469,-254481,-254493,-254505,-254517,-254529,-254541,-254553,-254565,-254577,-254589,-254601,-254613,-254625,-254637,-254649,-254661,-254673,-254685,-254697,-254709,-254720,-254732,-254744,-254756,-254768,-254780,-254792,-254803,-254815,-254827,-254839,-254851,-254862,-254874,-254886,-254898,-254909,-254921,-254933,-254944,-254956,-254968,-254980,-254991,-255003,-255014,-255026,-255038,-255049,-255061,-255073,-255084,-255096,-255107,-255119,-255130,-255142,-255154,-255165,-255177,-255188,-255200,-255211,-255223,-255234,-255245,-255257,-255268,-255280,-255291,-255303,-255314,-255325,-255337,-255348,-255360,-255371,-255382,-255394,-255405,-255416,-255428,-255439,-255450,-255461,-255473,-255484,-255495,-255506,-255518,-255529,-255540,-255551,-255563,-255574,-255585,-255596,-255607,-255618,-255629,-255641,-255652,-255663,-255674,-255685,-255696,-255707,-255718,-255729,-255740,-255751,-255762,-255773,-255784,-255795,-255806,-255817,-255828,-255839,-255850,-255861,-255872,-255883,-255894,-255905,-255916,-255927,-255938,-255948,-255959,-255970,-255981,-255992,-256003,-256013,-256024,-256035,-256046,-256057,-256067,-256078,-256089,-256100,-256110,-256121,-256132,-256142,-256153,-256164,-256175,-256185,-256196,-256206,-256217,-256228,-256238,-256249,-256260,-256270,-256281,-256291,-256302,-256312,-256323,-256333,-256344,-256354,-256365,-256375,-256386,-256396,-256407,-256417,-256428,-256438,-256449,-256459,-256469,-256480,-256490,-256501,-256511,-256521,-256532,-256542,-256552,-256563,-256573,-256583,-256594,-256604,-256614,-256624,-256635,-256645,-256655,-256665,-256676,-256686,-256696,-256706,-256716,-256727,-256737,-256747,-256757,-256767,-256777,-256787,-256797,-256808,-256818,-256828,-256838,-256848,-256858,-256868,-256878,-256888,-256898,-256908,-256918,-256928,-256938,-256948,-256958,-256968,-256978,-256988,-256998,-257007,-257017,-257027,-257037,-257047,-257057,-257067,-257077,-257086,-257096,-257106,-257116,-257126,-257135,-257145,-257155,-257165,-257174,-257184,-257194,-257204,-257213,-257223,-257233,-257242,-257252,-257262,-257271,-257281,-257291,-257300,-257310,-257319,-257329,-257339,-257348,-257358,-257367,-257377,-257386,-257396,-257405,-257415,-257424,-257434,-257443,-257453,-257462,-257472,-257481,-257491,-257500,-257509,-257519,-257528,-257538,-257547,-257556,-257566,-257575,-257584,-257594,-257603,-257612,-257622,-257631,-257640,-257650,-257659,-257668,-257677,-257687,-257696,-257705,-257714,-257723,-257733,-257742,-257751,-257760,-257769,-257778,-257788,-257797,-257806,-257815,-257824,-257833,-257842,-257851,-257860,-257869,-257878,-257887,-257896,-257905,-257914,-257923,-257932,-257941,-257950,-257959,-257968,-257977,-257986,-257995,-258004,-258013,-258022,-258030,-258039,-258048,-258057,-258066,-258075,-258083,-258092,-258101,-258110,-258119,-258127,-258136,-258145,-258154,-258162,-258171,-258180,-258189,-258197,-258206,-258215,-258223,-258232,-258241,-258249,-258258,-258266,-258275,-258284,-258292,-258301,-258309,-258318,-258326,-258335,-258344,-258352,-258361,-258369,-258378,-258386,-258395,-258403,-258411,-258420,-258428,-258437,-258445,-258454,-258462,-258470,-258479,-258487,-258495,-258504,-258512,-258521,-258529,-258537,-258545,-258554,-258562,-258570,-258579,-258587,-258595,-258603,-258612,-258620,-258628,-258636,-258644,-258653,-258661,-258669,-258677,-258685,-258693,-258701,-258710,-258718,-258726,-258734,-258742,-258750,-258758,-258766,-258774,-258782,-258790,-258798,-258806,-258814,-258822,-258830,-258838,-258846,-258854,-258862,-258870,-258878,-258886,-258894,-258901,-258909,-258917,-258925,-258933,-258941,-258949,-258956,-258964,-258972,-258980,-258988,-258995,-259003,-259011,-259019,-259026,-259034,-259042,-259049,-259057,-259065,-259072,-259080,-259088,-259095,-259103,-259111,-259118,-259126,-259134,-259141,-259149,-259156,-259164,-259171,-259179,-259186,-259194,-259201,-259209,-259216,-259224,-259231,-259239,-259246,-259254,-259261,-259269,-259276,-259284,-259291,-259298,-259306,-259313,-259320,-259328,-259335,-259342,-259350,-259357,-259364,-259372,-259379,-259386,-259394,-259401,-259408,-259415,-259422,-259430,-259437,-259444,-259451,-259458,-259466,-259473,-259480,-259487,-259494,-259501,-259508,-259516,-259523,-259530,-259537,-259544,-259551,-259558,-259565,-259572,-259579,-259586,-259593,-259600,-259607,-259614,-259621,-259628,-259635,-259642,-259649,-259656,-259663,-259669,-259676,-259683,-259690,-259697,-259704,-259711,-259717,-259724,-259731,-259738,-259745,-259751,-259758,-259765,-259772,-259778,-259785,-259792,-259799,-259805,-259812,-259819,-259825,-259832,-259839,-259845,-259852,-259859,-259865,-259872,-259878,-259885,-259892,-259898,-259905,-259911,-259918,-259924,-259931,-259937,-259944,-259950,-259957,-259963,-259970,-259976,-259983,-259989,-259996,-260002,-260008,-260015,-260021,-260028,-260034,-260040,-260047,-260053,-260059,-260066,-260072,-260078,-260084,-260091,-260097,-260103,-260110,-260116,-260122,-260128,-260134,-260141,-260147,-260153,-260159,-260165,-260172,-260178,-260184,-260190,-260196,-260202,-260208,-260214,-260220,-260227,-260233,-260239,-260245,-260251,-260257,-260263,-260269,-260275,-260281,-260287,-260293,-260299,-260305,-260311,-260316,-260322,-260328,-260334,-260340,-260346,-260352,-260358,-260364,-260369,-260375,-260381,-260387,-260393,-260398,-260404,-260410,-260416,-260422,-260427,-260433,-260439,-260444,-260450,-260456,-260462,-260467,-260473,-260479,-260484,-260490,-260495,-260501,-260507,-260512,-260518,-260524,-260529,-260535,-260540,-260546,-260551,-260557,-260562,-260568,-260573,-260579,-260584,-260590,-260595,-260601,-260606,-260612,-260617,-260622,-260628,-260633,-260639,-260644,-260649,-260655,-260660,-260665,-260671,-260676,-260681,-260687,-260692,-260697,-260702,-260708,-260713,-260718,-260723,-260729,-260734,-260739,-260744,-260749,-260755,-260760,-260765,-260770,-260775,-260780,-260785,-260790,-260796,-260801,-260806,-260811,-260816,-260821,-260826,-260831,-260836,-260841,-260846,-260851,-260856,-260861,-260866,-260871,-260876,-260881,-260886,-260891,-260895,-260900,-260905,-260910,-260915,-260920,-260925,-260929,-260934,-260939,-260944,-260949,-260954,-260958,-260963,-260968,-260973,-260977,-260982,-260987,-260991,-260996,-261001,-261006,-261010,-261015,-261020,-261024,-261029,-261033,-261038,-261043,-261047,-261052,-261056,-261061,-261066,-261070,-261075,-261079,-261084,-261088,-261093,-261097,-261102,-261106,-261111,-261115,-261119,-261124,-261128,-261133,-261137,-261142,-261146,-261150,-261155,-261159,-261163,-261168,-261172,-261176,-261181,-261185,-261189,-261194,-261198,-261202,-261206,-261211,-261215,-261219,-261223,-261227,-261232,-261236,-261240,-261244,-261248,-261252,-261257,-261261,-261265,-261269,-261273,-261277,-261281,-261285,-261289,-261293,-261297,-261301,-261305,-261309,-261313,-261317,-261321,-261325,-261329,-261333,-261337,-261341,-261345,-261349,-261353,-261357,-261361,-261365,-261368,-261372,-261376,-261380,-261384,-261388,-261391,-261395,-261399,-261403,-261407,-261410,-261414,-261418,-261422,-261425,-261429,-261433,-261436,-261440,-261444,-261447,-261451,-261455,-261458,-261462,-261466,-261469,-261473,-261476,-261480,-261484,-261487,-261491,-261494,-261498,-261501,-261505,-261508,-261512,-261515,-261519,-261522,-261526,-261529,-261532,-261536,-261539,-261543,-261546,-261550,-261553,-261556,-261560,-261563,-261566,-261570,-261573,-261576,-261580,-261583,-261586,-261589,-261593,-261596,-261599,-261602,-261606,-261609,-261612,-261615,-261618,-261622,-261625,-261628,-261631,-261634,-261637,-261640,-261643,-261647,-261650,-261653,-261656,-261659,-261662,-261665,-261668,-261671,-261674,-261677,-261680,-261683,-261686,-261689,-261692,-261695,-261698,-261701,-261704,-261707,-261709,-261712,-261715,-261718,-261721,-261724,-261727,-261729,-261732,-261735,-261738,-261741,-261743,-261746,-261749,-261752,-261754,-261757,-261760,-261763,-261765,-261768,-261771,-261773,-261776,-261779,-261781,-261784,-261787,-261789,-261792,-261794,-261797,-261800,-261802,-261805,-261807,-261810,-261812,-261815,-261817,-261820,-261822,-261825,-261827,-261830,-261832,-261835,-261837,-261839,-261842,-261844,-261847,-261849,-261851,-261854,-261856,-261858,-261861,-261863,-261865,-261868,-261870,-261872,-261875,-261877,-261879,-261881,-261884,-261886,-261888,-261890,-261893,-261895,-261897,-261899,-261901,-261903,-261906,-261908,-261910,-261912,-261914,-261916,-261918,-261920,-261922,-261924,-261926,-261928,-261931,-261933,-261935,-261937,-261939,-261941,-261942,-261944,-261946,-261948,-261950,-261952,-261954,-261956,-261958,-261960,-261962,-261964,-261965,-261967,-261969,-261971,-261973,-261974,-261976,-261978,-261980,-261982,-261983,-261985,-261987,-261989,-261990,-261992,-261994,-261995,-261997,-261999,-262000,-262002,-262004,-262005,-262007,-262009,-262010,-262012,-262013,-262015,-262017,-262018,-262020,-262021,-262023,-262024,-262026,-262027,-262029,-262030,-262032,-262033,-262035,-262036,-262037,-262039,-262040,-262042,-262043,-262044,-262046,-262047,-262049,-262050,-262051,-262053,-262054,-262055,-262056,-262058,-262059,-262060,-262062,-262063,-262064,-262065,-262066,-262068,-262069,-262070,-262071,-262072,-262074,-262075,-262076,-262077,-262078,-262079,-262080,-262081,-262083,-262084,-262085,-262086,-262087,-262088,-262089,-262090,-262091,-262092,-262093,-262094,-262095,-262096,-262097,-262098,-262099,-262100,-262100,-262101,-262102,-262103,-262104,-262105,-262106,-262107,-262107,-262108,-262109,-262110,-262111,-262111,-262112,-262113,-262114,-262114,-262115,-262116,-262117,-262117,-262118,-262119,-262119,-262120,-262121,-262121,-262122,-262123,-262123,-262124,-262124,-262125,-262126,-262126,-262127,-262127,-262128,-262128,-262129,-262129,-262130,-262130,-262131,-262131,-262132,-262132,-262133,-262133,-262134,-262134,-262134,-262135,-262135,-262136,-262136,-262136,-262137,-262137,-262137,-262138,-262138,-262138,-262139,-262139,-262139,-262139,-262140,-262140,-262140,-262140,-262141,-262141,-262141,-262141,-262141,-262142,-262142,-262142,-262142,-262142,-262142,-262142,-262143,-262143,-262143,-262143,-262143,-262143,-262143,-262143,-262143,-262143,-262143,-262143,-262143,-262143,-262143,-262143,-262143,-262143,-262143,-262143,-262143,-262142,-262142,-262142,-262142,-262142,-262142,-262142,-262141,-262141,-262141,-262141,-262141,-262140,-262140,-262140,-262140,-262139,-262139,-262139,-262139,-262138,-262138,-262138,-262137,-262137,-262137,-262136,-262136,-262136,-262135,-262135,-262134,-262134,-262134,-262133,-262133,-262132,-262132,-262131,-262131,-262130,-262130,-262129,-262129,-262128,-262128,-262127,-262127,-262126,-262126,-262125,-262124,-262124,-262123,-262123,-262122,-262121,-262121,-262120,-262119,-262119,-262118,-262117,-262117,-262116,-262115,-262114,-262114,-262113,-262112,-262111,-262111,-262110,-262109,-262108,-262107,-262107,-262106,-262105,-262104,-262103,-262102,-262101,-262100,-262100,-262099,-262098,-262097,-262096,-262095,-262094,-262093,-262092,-262091,-262090,-262089,-262088,-262087,-262086,-262085,-262084,-262083,-262081,-262080,-262079,-262078,-262077,-262076,-262075,-262074,-262072,-262071,-262070,-262069,-262068,-262066,-262065,-262064,-262063,-262062,-262060,-262059,-262058,-262056,-262055,-262054,-262053,-262051,-262050,-262049,-262047,-262046,-262044,-262043,-262042,-262040,-262039,-262037,-262036,-262035,-262033,-262032,-262030,-262029,-262027,-262026,-262024,-262023,-262021,-262020,-262018,-262017,-262015,-262013,-262012,-262010,-262009,-262007,-262005,-262004,-262002,-262000,-261999,-261997,-261995,-261994,-261992,-261990,-261989,-261987,-261985,-261983,-261982,-261980,-261978,-261976,-261974,-261973,-261971,-261969,-261967,-261965,-261964,-261962,-261960,-261958,-261956,-261954,-261952,-261950,-261948,-261946,-261944,-261942,-261941,-261939,-261937,-261935,-261933,-261931,-261928,-261926,-261924,-261922,-261920,-261918,-261916,-261914,-261912,-261910,-261908,-261906,-261903,-261901,-261899,-261897,-261895,-261893,-261890,-261888,-261886,-261884,-261881,-261879,-261877,-261875,-261872,-261870,-261868,-261865,-261863,-261861,-261858,-261856,-261854,-261851,-261849,-261847,-261844,-261842,-261839,-261837,-261835,-261832,-261830,-261827,-261825,-261822,-261820,-261817,-261815,-261812,-261810,-261807,-261805,-261802,-261800,-261797,-261794,-261792,-261789,-261787,-261784,-261781,-261779,-261776,-261773,-261771,-261768,-261765,-261763,-261760,-261757,-261754,-261752,-261749,-261746,-261743,-261741,-261738,-261735,-261732,-261729,-261727,-261724,-261721,-261718,-261715,-261712,-261709,-261707,-261704,-261701,-261698,-261695,-261692,-261689,-261686,-261683,-261680,-261677,-261674,-261671,-261668,-261665,-261662,-261659,-261656,-261653,-261650,-261647,-261643,-261640,-261637,-261634,-261631,-261628,-261625,-261622,-261618,-261615,-261612,-261609,-261606,-261602,-261599,-261596,-261593,-261589,-261586,-261583,-261580,-261576,-261573,-261570,-261566,-261563,-261560,-261556,-261553,-261550,-261546,-261543,-261539,-261536,-261532,-261529,-261526,-261522,-261519,-261515,-261512,-261508,-261505,-261501,-261498,-261494,-261491,-261487,-261484,-261480,-261476,-261473,-261469,-261466,-261462,-261458,-261455,-261451,-261447,-261444,-261440,-261436,-261433,-261429,-261425,-261422,-261418,-261414,-261410,-261407,-261403,-261399,-261395,-261391,-261388,-261384,-261380,-261376,-261372,-261368,-261365,-261361,-261357,-261353,-261349,-261345,-261341,-261337,-261333,-261329,-261325,-261321,-261317,-261313,-261309,-261305,-261301,-261297,-261293,-261289,-261285,-261281,-261277,-261273,-261269,-261265,-261261,-261257,-261252,-261248,-261244,-261240,-261236,-261232,-261227,-261223,-261219,-261215,-261211,-261206,-261202,-261198,-261194,-261189,-261185,-261181,-261176,-261172,-261168,-261163,-261159,-261155,-261150,-261146,-261142,-261137,-261133,-261128,-261124,-261119,-261115,-261111,-261106,-261102,-261097,-261093,-261088,-261084,-261079,-261075,-261070,-261066,-261061,-261056,-261052,-261047,-261043,-261038,-261033,-261029,-261024,-261020,-261015,-261010,-261006,-261001,-260996,-260991,-260987,-260982,-260977,-260973,-260968,-260963,-260958,-260954,-260949,-260944,-260939,-260934,-260929,-260925,-260920,-260915,-260910,-260905,-260900,-260895,-260891,-260886,-260881,-260876,-260871,-260866,-260861,-260856,-260851,-260846,-260841,-260836,-260831,-260826,-260821,-260816,-260811,-260806,-260801,-260796,-260790,-260785,-260780,-260775,-260770,-260765,-260760,-260755,-260749,-260744,-260739,-260734,-260729,-260723,-260718,-260713,-260708,-260702,-260697,-260692,-260687,-260681,-260676,-260671,-260665,-260660,-260655,-260649,-260644,-260639,-260633,-260628,-260622,-260617,-260612,-260606,-260601,-260595,-260590,-260584,-260579,-260573,-260568,-260562,-260557,-260551,-260546,-260540,-260535,-260529,-260524,-260518,-260512,-260507,-260501,-260495,-260490,-260484,-260479,-260473,-260467,-260462,-260456,-260450,-260444,-260439,-260433,-260427,-260422,-260416,-260410,-260404,-260398,-260393,-260387,-260381,-260375,-260369,-260364,-260358,-260352,-260346,-260340,-260334,-260328,-260322,-260316,-260311,-260305,-260299,-260293,-260287,-260281,-260275,-260269,-260263,-260257,-260251,-260245,-260239,-260233,-260227,-260220,-260214,-260208,-260202,-260196,-260190,-260184,-260178,-260172,-260165,-260159,-260153,-260147,-260141,-260134,-260128,-260122,-260116,-260110,-260103,-260097,-260091,-260084,-260078,-260072,-260066,-260059,-260053,-260047,-260040,-260034,-260028,-260021,-260015,-260008,-260002,-259996,-259989,-259983,-259976,-259970,-259963,-259957,-259950,-259944,-259937,-259931,-259924,-259918,-259911,-259905,-259898,-259892,-259885,-259878,-259872,-259865,-259859,-259852,-259845,-259839,-259832,-259825,-259819,-259812,-259805,-259799,-259792,-259785,-259778,-259772,-259765,-259758,-259751,-259745,-259738,-259731,-259724,-259717,-259711,-259704,-259697,-259690,-259683,-259676,-259669,-259663,-259656,-259649,-259642,-259635,-259628,-259621,-259614,-259607,-259600,-259593,-259586,-259579,-259572,-259565,-259558,-259551,-259544,-259537,-259530,-259523,-259516,-259508,-259501,-259494,-259487,-259480,-259473,-259466,-259458,-259451,-259444,-259437,-259430,-259422,-259415,-259408,-259401,-259394,-259386,-259379,-259372,-259364,-259357,-259350,-259342,-259335,-259328,-259320,-259313,-259306,-259298,-259291,-259284,-259276,-259269,-259261,-259254,-259246,-259239,-259231,-259224,-259216,-259209,-259201,-259194,-259186,-259179,-259171,-259164,-259156,-259149,-259141,-259134,-259126,-259118,-259111,-259103,-259095,-259088,-259080,-259072,-259065,-259057,-259049,-259042,-259034,-259026,-259019,-259011,-259003,-258995,-258988,-258980,-258972,-258964,-258956,-258949,-258941,-258933,-258925,-258917,-258909,-258901,-258894,-258886,-258878,-258870,-258862,-258854,-258846,-258838,-258830,-258822,-258814,-258806,-258798,-258790,-258782,-258774,-258766,-258758,-258750,-258742,-258734,-258726,-258718,-258710,-258701,-258693,-258685,-258677,-258669,-258661,-258653,-258644,-258636,-258628,-258620,-258612,-258603,-258595,-258587,-258579,-258570,-258562,-258554,-258545,-258537,-258529,-258521,-258512,-258504,-258495,-258487,-258479,-258470,-258462,-258454,-258445,-258437,-258428,-258420,-258411,-258403,-258395,-258386,-258378,-258369,-258361,-258352,-258344,-258335,-258326,-258318,-258309,-258301,-258292,-258284,-258275,-258266,-258258,-258249,-258241,-258232,-258223,-258215,-258206,-258197,-258189,-258180,-258171,-258162,-258154,-258145,-258136,-258127,-258119,-258110,-258101,-258092,-258083,-258075,-258066,-258057,-258048,-258039,-258030,-258022,-258013,-258004,-257995,-257986,-257977,-257968,-257959,-257950,-257941,-257932,-257923,-257914,-257905,-257896,-257887,-257878,-257869,-257860,-257851,-257842,-257833,-257824,-257815,-257806,-257797,-257788,-257778,-257769,-257760,-257751,-257742,-257733,-257723,-257714,-257705,-257696,-257687,-257677,-257668,-257659,-257650,-257640,-257631,-257622,-257612,-257603,-257594,-257584,-257575,-257566,-257556,-257547,-257538,-257528,-257519,-257509,-257500,-257491,-257481,-257472,-257462,-257453,-257443,-257434,-257424,-257415,-257405,-257396,-257386,-257377,-257367,-257358,-257348,-257339,-257329,-257319,-257310,-257300,-257291,-257281,-257271,-257262,-257252,-257242,-257233,-257223,-257213,-257204,-257194,-257184,-257174,-257165,-257155,-257145,-257135,-257126,-257116,-257106,-257096,-257086,-257077,-257067,-257057,-257047,-257037,-257027,-257017,-257007,-256998,-256988,-256978,-256968,-256958,-256948,-256938,-256928,-256918,-256908,-256898,-256888,-256878,-256868,-256858,-256848,-256838,-256828,-256818,-256808,-256797,-256787,-256777,-256767,-256757,-256747,-256737,-256727,-256716,-256706,-256696,-256686,-256676,-256665,-256655,-256645,-256635,-256624,-256614,-256604,-256594,-256583,-256573,-256563,-256552,-256542,-256532,-256521,-256511,-256501,-256490,-256480,-256469,-256459,-256449,-256438,-256428,-256417,-256407,-256396,-256386,-256375,-256365,-256354,-256344,-256333,-256323,-256312,-256302,-256291,-256281,-256270,-256260,-256249,-256238,-256228,-256217,-256206,-256196,-256185,-256175,-256164,-256153,-256142,-256132,-256121,-256110,-256100,-256089,-256078,-256067,-256057,-256046,-256035,-256024,-256013,-256003,-255992,-255981,-255970,-255959,-255948,-255938,-255927,-255916,-255905,-255894,-255883,-255872,-255861,-255850,-255839,-255828,-255817,-255806,-255795,-255784,-255773,-255762,-255751,-255740,-255729,-255718,-255707,-255696,-255685,-255674,-255663,-255652,-255641,-255629,-255618,-255607,-255596,-255585,-255574,-255563,-255551,-255540,-255529,-255518,-255506,-255495,-255484,-255473,-255461,-255450,-255439,-255428,-255416,-255405,-255394,-255382,-255371,-255360,-255348,-255337,-255325,-255314,-255303,-255291,-255280,-255268,-255257,-255245,-255234,-255223,-255211,-255200,-255188,-255177,-255165,-255154,-255142,-255130,-255119,-255107,-255096,-255084,-255073,-255061,-255049,-255038,-255026,-255014,-255003,-254991,-254980,-254968,-254956,-254944,-254933,-254921,-254909,-254898,-254886,-254874,-254862,-254851,-254839,-254827,-254815,-254803,-254792,-254780,-254768,-254756,-254744,-254732,-254720,-254709,-254697,-254685,-254673,-254661,-254649,-254637,-254625,-254613,-254601,-254589,-254577,-254565,-254553,-254541,-254529,-254517,-254505,-254493,-254481,-254469,-254457,-254445,-254433,-254421,-254409,-254396,-254384,-254372,-254360,-254348,-254336,-254323,-254311,-254299,-254287,-254275,-254262,-254250,-254238,-254226,-254213,-254201,-254189,-254177,-254164,-254152,-254140,-254127,-254115,-254103,-254090,-254078,-254066,-254053,-254041,-254028,-254016,-254003,-253991,-253979,-253966,-253954,-253941,-253929,-253916,-253904,-253891,-253879,-253866,-253854,-253841,-253829,-253816,-253803,-253791,-253778,-253766,-253753,-253740,-253728,-253715,-253703,-253690,-253677,-253665,-253652,-253639,-253626,-253614,-253601,-253588,-253576,-253563,-253550,-253537,-253524,-253512,-253499,-253486,-253473,-253460,-253448,-253435,-253422,-253409,-253396,-253383,-253370,-253358,-253345,-253332,-253319,-253306,-253293,-253280,-253267,-253254,-253241,-253228,-253215,-253202,-253189,-253176,-253163,-253150,-253137,-253124,-253111,-253098,-253084,-253071,-253058,-253045,-253032,-253019,-253006,-252993,-252979,-252966,-252953,-252940,-252927,-252913,-252900,-252887,-252874,-252860,-252847,-252834,-252821,-252807,-252794,-252781,-252767,-252754,-252741,-252727,-252714,-252701,-252687,-252674,-252661,-252647,-252634,-252620,-252607,-252593,-252580,-252567,-252553,-252540,-252526,-252513,-252499,-252486,-252472,-252459,-252445,-252431,-252418,-252404,-252391,-252377,-252364,-252350,-252336,-252323,-252309,-252295,-252282,-252268,-252254,-252241,-252227,-252213,-252200,-252186,-252172,-252158,-252145,-252131,-252117,-252103,-252090,-252076,-252062,-252048,-252034,-252021,-252007,-251993,-251979,-251965,-251951,-251937,-251924,-251910,-251896,-251882,-251868,-251854,-251840,-251826,-251812,-251798,-251784,-251770,-251756,-251742,-251728,-251714,-251700,-251686,-251672,-251658,-251644,-251630,-251616,-251601,-251587,-251573,-251559,-251545,-251531,-251517,-251502,-251488,-251474,-251460,-251446,-251431,-251417,-251403,-251389,-251374,-251360,-251346,-251332,-251317,-251303,-251289,-251274,-251260,-251246,-251231,-251217,-251203,-251188,-251174,-251160,-251145,-251131,-251116,-251102,-251087,-251073,-251059,-251044,-251030,-251015,-251001,-250986,-250972,-250957,-250943,-250928,-250913,-250899,-250884,-250870,-250855,-250841,-250826,-250811,-250797,-250782,-250767,-250753,-250738,-250723,-250709,-250694,-250679,-250665,-250650,-250635,-250621,-250606,-250591,-250576,-250561,-250547,-250532,-250517,-250502,-250488,-250473,-250458,-250443,-250428,-250413,-250398,-250384,-250369,-250354,-250339,-250324,-250309,-250294,-250279,-250264,-250249,-250234,-250219,-250204,-250189,-250174,-250159,-250144,-250129,-250114,-250099,-250084,-250069,-250054,-250039,-250024,-250008,-249993,-249978,-249963,-249948,-249933,-249918,-249902,-249887,-249872,-249857,-249842,-249826,-249811,-249796,-249781,-249765,-249750,-249735,-249720,-249704,-249689,-249674,-249658,-249643,-249628,-249612,-249597,-249582,-249566,-249551,-249535,-249520,-249505,-249489,-249474,-249458,-249443,-249427,-249412,-249397,-249381,-249366,-249350,-249334,-249319,-249303,-249288,-249272,-249257,-249241,-249226,-249210,-249194,-249179,-249163,-249148,-249132,-249116,-249101,-249085,-249069,-249054,-249038,-249022,-249007,-248991,-248975,-248959,-248944,-248928,-248912,-248896,-248881,-248865,-248849,-248833,-248817,-248802,-248786,-248770,-248754,-248738,-248722,-248706,-248690,-248675,-248659,-248643,-248627,-248611,-248595,-248579,-248563,-248547,-248531,-248515,-248499,-248483,-248467,-248451,-248435,-248419,-248403,-248387,-248371,-248355,-248339,-248322,-248306,-248290,-248274,-248258,-248242,-248226,-248210,-248193,-248177,-248161,-248145,-248129,-248112,-248096,-248080,-248064,-248047,-248031,-248015,-247999,-247982,-247966,-247950,-247933,-247917,-247901,-247884,-247868,-247852,-247835,-247819,-247802,-247786,-247770,-247753,-247737,-247720,-247704,-247687,-247671,-247654,-247638,-247621,-247605,-247588,-247572,-247555,-247539,-247522,-247506,-247489,-247473,-247456,-247439,-247423,-247406,-247390,-247373,-247356,-247340,-247323,-247306,-247290,-247273,-247256,-247240,-247223,-247206,-247189,-247173,-247156,-247139,-247122,-247106,-247089,-247072,-247055,-247039,-247022,-247005,-246988,-246971,-246954,-246937,-246921,-246904,-246887,-246870,-246853,-246836,-246819,-246802,-246785,-246768,-246751,-246734,-246717,-246700,-246683,-246666,-246649,-246632,-246615,-246598,-246581,-246564,-246547,-246530,-246513,-246496,-246479,-246462,-246444,-246427,-246410,-246393,-246376,-246359,-246341,-246324,-246307,-246290,-246273,-246255,-246238,-246221,-246204,-246186,-246169,-246152,-246135,-246117,-246100,-246083,-246065,-246048,-246031,-246013,-245996,-245978,-245961,-245944,-245926,-245909,-245891,-245874,-245857,-245839,-245822,-245804,-245787,-245769,-245752,-245734,-245717,-245699,-245682,-245664,-245647,-245629,-245612,-245594,-245576,-245559,-245541,-245524,-245506,-245488,-245471,-245453,-245435,-245418,-245400,-245382,-245365,-245347,-245329,-245312,-245294,-245276,-245258,-245241,-245223,-245205,-245187,-245170,-245152,-245134,-245116,-245098,-245080,-245063,-245045,-245027,-245009,-244991,-244973,-244955,-244937,-244920,-244902,-244884,-244866,-244848,-244830,-244812,-244794,-244776,-244758,-244740,-244722,-244704,-244686,-244668,-244650,-244632,-244614,-244596,-244577,-244559,-244541,-244523,-244505,-244487,-244469,-244451,-244432,-244414,-244396,-244378,-244360,-244342,-244323,-244305,-244287,-244269,-244250,-244232,-244214,-244196,-244177,-244159,-244141,-244122,-244104,-244086,-244067,-244049,-244031,-244012,-243994,-243976,-243957,-243939,-243920,-243902,-243884,-243865,-243847,-243828,-243810,-243791,-243773,-243754,-243736,-243717,-243699,-243680,-243662,-243643,-243625,-243606,-243587,-243569,-243550,-243532,-243513,-243495,-243476,-243457,-243439,-243420,-243401,-243383,-243364,-243345,-243327,-243308,-243289,-243270,-243252,-243233,-243214,-243195,-243177,-243158,-243139,-243120,-243102,-243083,-243064,-243045,-243026,-243007,-242989,-242970,-242951,-242932,-242913,-242894,-242875,-242856,-242837,-242818,-242799,-242781,-242762,-242743,-242724,-242705,-242686,-242667,-242648,-242629,-242610,-242590,-242571,-242552,-242533,-242514,-242495,-242476,-242457,-242438,-242419,-242400,-242380,-242361,-242342,-242323,-242304,-242285,-242265,-242246,-242227,-242208,-242188,-242169,-242150,-242131,-242111,-242092,-242073,-242054,-242034,-242015,-241996,-241976,-241957,-241938,-241918,-241899,-241880,-241860,-241841,-241821,-241802,-241783,-241763,-241744,-241724,-241705,-241685,-241666,-241646,-241627,-241607,-241588,-241568,-241549,-241529,-241510,-241490,-241471,-241451,-241432,-241412,-241392,-241373,-241353,-241333,-241314,-241294,-241275,-241255,-241235,-241216,-241196,-241176,-241156,-241137,-241117,-241097,-241078,-241058,-241038,-241018,-240999,-240979,-240959,-240939,-240919,-240900,-240880,-240860,-240840,-240820,-240800,-240780,-240761,-240741,-240721,-240701,-240681,-240661,-240641,-240621,-240601,-240581,-240561,-240541,-240521,-240501,-240481,-240461,-240441,-240421,-240401,-240381,-240361,-240341,-240321,-240301,-240281,-240261,-240241,-240220,-240200,-240180,-240160,-240140,-240120,-240100,-240079,-240059,-240039,-240019,-239999,-239978,-239958,-239938,-239918,-239897,-239877,-239857,-239837,-239816,-239796,-239776,-239755,-239735,-239715,-239694,-239674,-239654,-239633,-239613,-239592,-239572,-239552,-239531,-239511,-239490,-239470,-239449,-239429,-239409,-239388,-239368,-239347,-239327,-239306,-239286,-239265,-239244,-239224,-239203,-239183,-239162,-239142,-239121,-239100,-239080,-239059,-239039,-239018,-238997,-238977,-238956,-238935,-238915,-238894,-238873,-238852,-238832,-238811,-238790,-238770,-238749,-238728,-238707,-238687,-238666,-238645,-238624,-238603,-238582,-238562,-238541,-238520,-238499,-238478,-238457,-238436,-238416,-238395,-238374,-238353,-238332,-238311,-238290,-238269,-238248,-238227,-238206,-238185,-238164,-238143,-238122,-238101,-238080,-238059,-238038,-238017,-237996,-237975,-237954,-237933,-237912,-237890,-237869,-237848,-237827,-237806,-237785,-237764,-237742,-237721,-237700,-237679,-237658,-237636,-237615,-237594,-237573,-237551,-237530,-237509,-237488,-237466,-237445,-237424,-237402,-237381,-237360,-237338,-237317,-237296,-237274,-237253,-237232,-237210,-237189,-237167,-237146,-237125,-237103,-237082,-237060,-237039,-237017,-236996,-236974,-236953,-236931,-236910,-236888,-236867,-236845,-236824,-236802,-236781,-236759,-236737,-236716,-236694,-236673,-236651,-236629,-236608,-236586,-236564,-236543,-236521,-236499,-236478,-236456,-236434,-236413,-236391,-236369,-236347,-236326,-236304,-236282,-236260,-236239,-236217,-236195,-236173,-236151,-236130,-236108,-236086,-236064,-236042,-236020,-235998,-235977,-235955,-235933,-235911,-235889,-235867,-235845,-235823,-235801,-235779,-235757,-235735,-235713,-235691,-235669,-235647,-235625,-235603,-235581,-235559,-235537,-235515,-235493,-235471,-235449,-235427,-235404,-235382,-235360,-235338,-235316,-235294,-235272,-235249,-235227,-235205,-235183,-235161,-235138,-235116,-235094,-235072,-235049,-235027,-235005,-234983,-234960,-234938,-234916,-234893,-234871,-234849,-234827,-234804,-234782,-234759,-234737,-234715,-234692,-234670,-234648,-234625,-234603,-234580,-234558,-234535,-234513,-234490,-234468,-234445,-234423,-234400,-234378,-234355,-234333,-234310,-234288,-234265,-234243,-234220,-234198,-234175,-234152,-234130,-234107,-234085,-234062,-234039,-234017,-233994,-233971,-233949,-233926,-233903,-233881,-233858,-233835,-233812,-233790,-233767,-233744,-233721,-233699,-233676,-233653,-233630,-233608,-233585,-233562,-233539,-233516,-233493,-233471,-233448,-233425,-233402,-233379,-233356,-233333,-233310,-233287,-233264,-233242,-233219,-233196,-233173,-233150,-233127,-233104,-233081,-233058,-233035,-233012,-232989,-232966,-232943,-232919,-232896,-232873,-232850,-232827,-232804,-232781,-232758,-232735,-232712,-232688,-232665,-232642,-232619,-232596,-232573,-232549,-232526,-232503,-232480,-232456,-232433,-232410,-232387,-232363,-232340,-232317,-232294,-232270,-232247,-232224,-232200,-232177,-232154,-232130,-232107,-232084,-232060,-232037,-232013,-231990,-231967,-231943,-231920,-231896,-231873,-231849,-231826,-231803,-231779,-231756,-231732,-231709,-231685,-231662,-231638,-231614,-231591,-231567,-231544,-231520,-231497,-231473,-231449,-231426,-231402,-231379,-231355,-231331,-231308,-231284,-231260,-231237,-231213,-231189,-231166,-231142,-231118,-231095,-231071,-231047,-231023,-231000,-230976,-230952,-230928,-230904,-230881,-230857,-230833,-230809,-230785,-230761,-230738,-230714,-230690,-230666,-230642,-230618,-230594,-230570,-230547,-230523,-230499,-230475,-230451,-230427,-230403,-230379,-230355,-230331,-230307,-230283,-230259,-230235,-230211,-230187,-230163,-230139,-230115,-230090,-230066,-230042,-230018,-229994,-229970,-229946,-229922,-229897,-229873,-229849,-229825,-229801,-229777,-229752,-229728,-229704,-229680,-229656,-229631,-229607,-229583,-229559,-229534,-229510,-229486,-229461,-229437,-229413,-229388,-229364,-229340,-229315,-229291,-229267,-229242,-229218,-229193,-229169,-229145,-229120,-229096,-229071,-229047,-229023,-228998,-228974,-228949,-228925,-228900,-228876,-228851,-228827,-228802,-228778,-228753,-228728,-228704,-228679,-228655,-228630,-228606,-228581,-228556,-228532,-228507,-228482,-228458,-228433,-228408,-228384,-228359,-228334,-228310,-228285,-228260,-228236,-228211,-228186,-228161,-228137,-228112,-228087,-228062,-228038,-228013,-227988,-227963,-227938,-227913,-227889,-227864,-227839,-227814,-227789,-227764,-227739,-227715,-227690,-227665,-227640,-227615,-227590,-227565,-227540,-227515,-227490,-227465,-227440,-227415,-227390,-227365,-227340,-227315,-227290,-227265,-227240,-227215,-227190,-227165,-227140,-227114,-227089,-227064,-227039,-227014,-226989,-226964,-226939,-226913,-226888,-226863,-226838,-226813,-226787,-226762,-226737,-226712,-226687,-226661,-226636,-226611,-226585,-226560,-226535,-226510,-226484,-226459,-226434,-226408,-226383,-226358,-226332,-226307,-226282,-226256,-226231,-226205,-226180,-226155,-226129,-226104,-226078,-226053,-226027,-226002,-225976,-225951,-225925,-225900,-225874,-225849,-225823,-225798,-225772,-225747,-225721,-225696,-225670,-225645,-225619,-225593,-225568,-225542,-225516,-225491,-225465,-225440,-225414,-225388,-225363,-225337,-225311,-225286,-225260,-225234,-225208,-225183,-225157,-225131,-225105,-225080,-225054,-225028,-225002,-224977,-224951,-224925,-224899,-224873,-224847,-224822,-224796,-224770,-224744,-224718,-224692,-224666,-224640,-224614,-224589,-224563,-224537,-224511,-224485,-224459,-224433,-224407,-224381,-224355,-224329,-224303,-224277,-224251,-224225,-224199,-224173,-224147,-224121,-224095,-224068,-224042,-224016,-223990,-223964,-223938,-223912,-223886,-223859,-223833,-223807,-223781,-223755,-223729,-223702,-223676,-223650,-223624,-223598,-223571,-223545,-223519,-223492,-223466,-223440,-223414,-223387,-223361,-223335,-223308,-223282,-223256,-223229,-223203,-223177,-223150,-223124,-223098,-223071,-223045,-223018,-222992,-222965,-222939,-222913,-222886,-222860,-222833,-222807,-222780,-222754,-222727,-222701,-222674,-222648,-222621,-222595,-222568,-222541,-222515,-222488,-222462,-222435,-222409,-222382,-222355,-222329,-222302,-222275,-222249,-222222,-222195,-222169,-222142,-222115,-222089,-222062,-222035,-222009,-221982,-221955,-221928,-221902,-221875,-221848,-221821,-221794,-221768,-221741,-221714,-221687,-221660,-221633,-221607,-221580,-221553,-221526,-221499,-221472,-221445,-221418,-221392,-221365,-221338,-221311,-221284,-221257,-221230,-221203,-221176,-221149,-221122,-221095,-221068,-221041,-221014,-220987,-220960,-220933,-220906,-220879,-220852,-220825,-220797,-220770,-220743,-220716,-220689,-220662,-220635,-220608,-220580,-220553,-220526,-220499,-220472,-220445,-220417,-220390,-220363,-220336,-220308,-220281,-220254,-220227,-220199,-220172,-220145,-220118,-220090,-220063,-220036,-220008,-219981,-219954,-219926,-219899,-219872,-219844,-219817,-219789,-219762,-219735,-219707,-219680,-219652,-219625,-219597,-219570,-219543,-219515,-219488,-219460,-219433,-219405,-219378,-219350,-219323,-219295,-219267,-219240,-219212,-219185,-219157,-219130,-219102,-219074,-219047,-219019,-218992,-218964,-218936,-218909,-218881,-218853,-218826,-218798,-218770,-218743,-218715,-218687,-218659,-218632,-218604,-218576,-218548,-218521,-218493,-218465,-218437,-218410,-218382,-218354,-218326,-218298,-218270,-218243,-218215,-218187,-218159,-218131,-218103,-218075,-218048,-218020,-217992,-217964,-217936,-217908,-217880,-217852,-217824,-217796,-217768,-217740,-217712,-217684,-217656,-217628,-217600,-217572,-217544,-217516,-217488,-217460,-217432,-217404,-217376,-217347,-217319,-217291,-217263,-217235,-217207,-217179,-217151,-217122,-217094,-217066,-217038,-217010,-216981,-216953,-216925,-216897,-216869,-216840,-216812,-216784,-216756,-216727,-216699,-216671,-216642,-216614,-216586,-216557,-216529,-216501,-216472,-216444,-216416,-216387,-216359,-216331,-216302,-216274,-216245,-216217,-216189,-216160,-216132,-216103,-216075,-216046,-216018,-215989,-215961,-215932,-215904,-215875,-215847,-215818,-215790,-215761,-215733,-215704,-215676,-215647,-215618,-215590,-215561,-215533,-215504,-215475,-215447,-215418,-215389,-215361,-215332,-215303,-215275,-215246,-215217,-215189,-215160,-215131,-215103,-215074,-215045,-215016,-214988,-214959,-214930,-214901,-214872,-214844,-214815,-214786,-214757,-214728,-214700,-214671,-214642,-214613,-214584,-214555,-214526,-214497,-214469,-214440,-214411,-214382,-214353,-214324,-214295,-214266,-214237,-214208,-214179,-214150,-214121,-214092,-214063,-214034,-214005,-213976,-213947,-213918,-213889,-213860,-213831,-213802,-213773,-213744,-213714,-213685,-213656,-213627,-213598,-213569,-213540,-213510,-213481,-213452,-213423,-213394,-213365,-213335,-213306,-213277,-213248,-213218,-213189,-213160,-213131,-213101,-213072,-213043,-213014,-212984,-212955,-212926,-212896,-212867,-212838,-212808,-212779,-212750,-212720,-212691,-212661,-212632,-212603,-212573,-212544,-212514,-212485,-212455,-212426,-212397,-212367,-212338,-212308,-212279,-212249,-212220,-212190,-212161,-212131,-212102,-212072,-212042,-212013,-211983,-211954,-211924,-211895,-211865,-211835,-211806,-211776,-211747,-211717,-211687,-211658,-211628,-211598,-211569,-211539,-211509,-211480,-211450,-211420,-211390,-211361,-211331,-211301,-211271,-211242,-211212,-211182,-211152,-211123,-211093,-211063,-211033,-211003,-210973,-210944,-210914,-210884,-210854,-210824,-210794,-210764,-210735,-210705,-210675,-210645,-210615,-210585,-210555,-210525,-210495,-210465,-210435,-210405,-210375,-210345,-210315,-210285,-210255,-210225,-210195,-210165,-210135,-210105,-210075,-210045,-210015,-209985,-209955,-209925,-209894,-209864,-209834,-209804,-209774,-209744,-209714,-209683,-209653,-209623,-209593,-209563,-209533,-209502,-209472,-209442,-209412,-209381,-209351,-209321,-209291,-209260,-209230,-209200,-209169,-209139,-209109,-209079,-209048,-209018,-208988,-208957,-208927,-208896,-208866,-208836,-208805,-208775,-208745,-208714,-208684,-208653,-208623,-208592,-208562,-208532,-208501,-208471,-208440,-208410,-208379,-208349,-208318,-208288,-208257,-208227,-208196,-208165,-208135,-208104,-208074,-208043,-208013,-207982,-207951,-207921,-207890,-207860,-207829,-207798,-207768,-207737,-207706,-207676,-207645,-207614,-207584,-207553,-207522,-207491,-207461,-207430,-207399,-207369,-207338,-207307,-207276,-207245,-207215,-207184,-207153,-207122,-207091,-207061,-207030,-206999,-206968,-206937,-206906,-206876,-206845,-206814,-206783,-206752,-206721,-206690,-206659,-206628,-206597,-206566,-206536,-206505,-206474,-206443,-206412,-206381,-206350,-206319,-206288,-206257,-206226,-206195,-206164,-206132,-206101,-206070,-206039,-206008,-205977,-205946,-205915,-205884,-205853,-205822,-205790,-205759,-205728,-205697,-205666,-205635,-205603,-205572,-205541,-205510,-205479,-205447,-205416,-205385,-205354,-205323,-205291,-205260,-205229,-205197,-205166,-205135,-205104,-205072,-205041,-205010,-204978,-204947,-204916,-204884,-204853,-204822,-204790,-204759,-204727,-204696,-204665,-204633,-204602,-204570,-204539,-204507,-204476,-204445,-204413,-204382,-204350,-204319,-204287,-204256,-204224,-204193,-204161,-204130,-204098,-204066,-204035,-204003,-203972,-203940,-203909,-203877,-203845,-203814,-203782,-203751,-203719,-203687,-203656,-203624,-203592,-203561,-203529,-203497,-203466,-203434,-203402,-203371,-203339,-203307,-203275,-203244,-203212,-203180,-203148,-203117,-203085,-203053,-203021,-202989,-202958,-202926,-202894,-202862,-202830,-202798,-202767,-202735,-202703,-202671,-202639,-202607,-202575,-202543,-202511,-202480,-202448,-202416,-202384,-202352,-202320,-202288,-202256,-202224,-202192,-202160,-202128,-202096,-202064,-202032,-202000,-201968,-201936,-201904,-201872,-201840,-201807,-201775,-201743,-201711,-201679,-201647,-201615,-201583,-201551,-201518,-201486,-201454,-201422,-201390,-201358,-201325,-201293,-201261,-201229,-201197,-201164,-201132,-201100,-201068,-201035,-201003,-200971,-200939,-200906,-200874,-200842,-200809,-200777,-200745,-200712,-200680,-200648,-200615,-200583,-200551,-200518,-200486,-200453,-200421,-200389,-200356,-200324,-200291,-200259,-200227,-200194,-200162,-200129,-200097,-200064,-200032,-199999,-199967,-199934,-199902,-199869,-199837,-199804,-199772,-199739,-199707,-199674,-199641,-199609,-199576,-199544,-199511,-199478,-199446,-199413,-199381,-199348,-199315,-199283,-199250,-199217,-199185,-199152,-199119,-199087,-199054,-199021,-198988,-198956,-198923,-198890,-198857,-198825,-198792,-198759,-198726,-198694,-198661,-198628,-198595,-198562,-198530,-198497,-198464,-198431,-198398,-198365,-198333,-198300,-198267,-198234,-198201,-198168,-198135,-198102,-198069,-198036,-198003,-197971,-197938,-197905,-197872,-197839,-197806,-197773,-197740,-197707,-197674,-197641,-197608,-197575,-197542,-197509,-197475,-197442,-197409,-197376,-197343,-197310,-197277,-197244,-197211,-197178,-197145,-197111,-197078,-197045,-197012,-196979,-196946,-196912,-196879,-196846,-196813,-196780,-196746,-196713,-196680,-196647,-196614,-196580,-196547,-196514,-196480,-196447,-196414,-196381,-196347,-196314,-196281,-196247,-196214,-196181,-196147,-196114,-196081,-196047,-196014,-195981,-195947,-195914,-195880,-195847,-195814,-195780,-195747,-195713,-195680,-195646,-195613,-195579,-195546,-195512,-195479,-195445,-195412,-195378,-195345,-195311,-195278,-195244,-195211,-195177,-195144,-195110,-195077,-195043,-195009,-194976,-194942,-194909,-194875,-194841,-194808,-194774,-194740,-194707,-194673,-194639,-194606,-194572,-194538,-194505,-194471,-194437,-194404,-194370,-194336,-194302,-194269,-194235,-194201,-194167,-194134,-194100,-194066,-194032,-193998,-193965,-193931,-193897,-193863,-193829,-193795,-193762,-193728,-193694,-193660,-193626,-193592,-193558,-193524,-193491,-193457,-193423,-193389,-193355,-193321,-193287,-193253,-193219,-193185,-193151,-193117,-193083,-193049,-193015,-192981,-192947,-192913,-192879,-192845,-192811,-192777,-192743,-192709,-192675,-192640,-192606,-192572,-192538,-192504,-192470,-192436,-192402,-192368,-192333,-192299,-192265,-192231,-192197,-192163,-192128,-192094,-192060,-192026,-191991,-191957,-191923,-191889,-191855,-191820,-191786,-191752,-191717,-191683,-191649,-191615,-191580,-191546,-191512,-191477,-191443,-191409,-191374,-191340,-191306,-191271,-191237,-191202,-191168,-191134,-191099,-191065,-191030,-190996,-190962,-190927,-190893,-190858,-190824,-190789,-190755,-190720,-190686,-190651,-190617,-190582,-190548,-190513,-190479,-190444,-190410,-190375,-190341,-190306,-190271,-190237,-190202,-190168,-190133,-190098,-190064,-190029,-189995,-189960,-189925,-189891,-189856,-189821,-189787,-189752,-189717,-189683,-189648,-189613,-189579,-189544,-189509,-189474,-189440,-189405,-189370,-189335,-189301,-189266,-189231,-189196,-189161,-189127,-189092,-189057,-189022,-188987,-188953,-188918,-188883,-188848,-188813,-188778,-188743,-188708,-188674,-188639,-188604,-188569,-188534,-188499,-188464,-188429,-188394,-188359,-188324,-188289,-188254,-188219,-188184,-188149,-188114,-188079,-188044,-188009,-187974,-187939,-187904,-187869,-187834,-187799,-187764,-187729,-187694,-187659,-187624,-187588,-187553,-187518,-187483,-187448,-187413,-187378,-187342,-187307,-187272,-187237,-187202,-187167,-187131,-187096,-187061,-187026,-186991,-186955,-186920,-186885,-186850,-186814,-186779,-186744,-186709,-186673,-186638,-186603,-186567,-186532,-186497,-186461,-186426,-186391,-186355,-186320,-186285,-186249,-186214,-186178,-186143,-186108,-186072,-186037,-186001,-185966,-185931,-185895,-185860,-185824,-185789,-185753,-185718,-185682,-185647,-185611,-185576,-185540,-185505,-185469,-185434,-185398,-185363,-185327,-185292,-185256,-185221,-185185,-185149,-185114,-185078,-185043,-185007,-184971,-184936,-184900,-184865,-184829,-184793,-184758,-184722,-184686,-184651,-184615,-184579,-184544,-184508,-184472,-184436,-184401,-184365,-184329,-184293,-184258,-184222,-184186,-184150,-184115,-184079,-184043,-184007,-183971,-183936,-183900,-183864,-183828,-183792,-183756,-183721,-183685,-183649,-183613,-183577,-183541,-183505,-183469,-183434,-183398,-183362,-183326,-183290,-183254,-183218,-183182,-183146,-183110,-183074,-183038,-183002,-182966,-182930,-182894,-182858,-182822,-182786,-182750,-182714,-182678,-182642,-182606,-182570,-182534,-182498,-182462,-182425,-182389,-182353,-182317,-182281,-182245,-182209,-182173,-182136,-182100,-182064,-182028,-181992,-181956,-181919,-181883,-181847,-181811,-181775,-181738,-181702,-181666,-181630,-181593,-181557,-181521,-181485,-181448,-181412,-181376,-181340,-181303,-181267,-181231,-181194,-181158,-181122,-181085,-181049,-181013,-180976,-180940,-180903,-180867,-180831,-180794,-180758,-180722,-180685,-180649,-180612,-180576,-180539,-180503,-180466,-180430,-180394,-180357,-180321,-180284,-180248,-180211,-180175,-180138,-180102,-180065,-180028,-179992,-179955,-179919,-179882,-179846,-179809,-179773,-179736,-179699,-179663,-179626,-179590,-179553,-179516,-179480,-179443,-179406,-179370,-179333,-179296,-179260,-179223,-179186,-179150,-179113,-179076,-179040,-179003,-178966,-178929,-178893,-178856,-178819,-178782,-178746,-178709,-178672,-178635,-178599,-178562,-178525,-178488,-178451,-178414,-178378,-178341,-178304,-178267,-178230,-178193,-178157,-178120,-178083,-178046,-178009,-177972,-177935,-177898,-177861,-177824,-177787,-177751,-177714,-177677,-177640,-177603,-177566,-177529,-177492,-177455,-177418,-177381,-177344,-177307,-177270,-177233,-177196,-177159,-177122,-177084,-177047,-177010,-176973,-176936,-176899,-176862,-176825,-176788,-176751,-176713,-176676,-176639,-176602,-176565,-176528,-176491,-176453,-176416,-176379,-176342,-176305,-176267,-176230,-176193,-176156,-176119,-176081,-176044,-176007,-175970,-175932,-175895,-175858,-175821,-175783,-175746,-175709,-175671,-175634,-175597,-175559,-175522,-175485,-175447,-175410,-175373,-175335,-175298,-175261,-175223,-175186,-175148,-175111,-175074,-175036,-174999,-174961,-174924,-174886,-174849,-174812,-174774,-174737,-174699,-174662,-174624,-174587,-174549,-174512,-174474,-174437,-174399,-174362,-174324,-174287,-174249,-174211,-174174,-174136,-174099,-174061,-174024,-173986,-173948,-173911,-173873,-173836,-173798,-173760,-173723,-173685,-173647,-173610,-173572,-173534,-173497,-173459,-173421,-173384,-173346,-173308,-173270,-173233,-173195,-173157,-173120,-173082,-173044,-173006,-172968,-172931,-172893,-172855,-172817,-172780,-172742,-172704,-172666,-172628,-172590,-172553,-172515,-172477,-172439,-172401,-172363,-172325,-172288,-172250,-172212,-172174,-172136,-172098,-172060,-172022,-171984,-171946,-171908,-171870,-171833,-171795,-171757,-171719,-171681,-171643,-171605,-171567,-171529,-171491,-171453,-171415,-171377,-171338,-171300,-171262,-171224,-171186,-171148,-171110,-171072,-171034,-170996,-170958,-170920,-170882,-170843,-170805,-170767,-170729,-170691,-170653,-170615,-170576,-170538,-170500,-170462,-170424,-170385,-170347,-170309,-170271,-170233,-170194,-170156,-170118,-170080,-170041,-170003,-169965,-169927,-169888,-169850,-169812,-169773,-169735,-169697,-169659,-169620,-169582,-169544,-169505,-169467,-169429,-169390,-169352,-169313,-169275,-169237,-169198,-169160,-169121,-169083,-169045,-169006,-168968,-168929,-168891,-168852,-168814,-168776,-168737,-168699,-168660,-168622,-168583,-168545,-168506,-168468,-168429,-168391,-168352,-168314,-168275,-168237,-168198,-168159,-168121,-168082,-168044,-168005,-167967,-167928,-167889,-167851,-167812,-167773,-167735,-167696,-167658,-167619,-167580,-167542,-167503,-167464,-167426,-167387,-167348,-167310,-167271,-167232,-167193,-167155,-167116,-167077,-167039,-167000,-166961,-166922,-166884,-166845,-166806,-166767,-166728,-166690,-166651,-166612,-166573,-166534,-166496,-166457,-166418,-166379,-166340,-166301,-166263,-166224,-166185,-166146,-166107,-166068,-166029,-165990,-165951,-165913,-165874,-165835,-165796,-165757,-165718,-165679,-165640,-165601,-165562,-165523,-165484,-165445,-165406,-165367,-165328,-165289,-165250,-165211,-165172,-165133,-165094,-165055,-165016,-164977,-164938,-164899,-164860,-164820,-164781,-164742,-164703,-164664,-164625,-164586,-164547,-164508,-164468,-164429,-164390,-164351,-164312,-164273,-164233,-164194,-164155,-164116,-164077,-164038,-163998,-163959,-163920,-163881,-163841,-163802,-163763,-163724,-163684,-163645,-163606,-163567,-163527,-163488,-163449,-163409,-163370,-163331,-163291,-163252,-163213,-163173,-163134,-163095,-163055,-163016,-162977,-162937,-162898,-162859,-162819,-162780,-162740,-162701,-162662,-162622,-162583,-162543,-162504,-162464,-162425,-162385,-162346,-162307,-162267,-162228,-162188,-162149,-162109,-162070,-162030,-161991,-161951,-161912,-161872,-161832,-161793,-161753,-161714,-161674,-161635,-161595,-161556,-161516,-161476,-161437,-161397,-161358,-161318,-161278,-161239,-161199,-161159,-161120,-161080,-161040,-161001,-160961,-160921,-160882,-160842,-160802,-160763,-160723,-160683,-160643,-160604,-160564,-160524,-160485,-160445,-160405,-160365,-160326,-160286,-160246,-160206,-160166,-160127,-160087,-160047,-160007,-159967,-159928,-159888,-159848,-159808,-159768,-159728,-159688,-159649,-159609,-159569,-159529,-159489,-159449,-159409,-159369,-159329,-159290,-159250,-159210,-159170,-159130,-159090,-159050,-159010,-158970,-158930,-158890,-158850,-158810,-158770,-158730,-158690,-158650,-158610,-158570,-158530,-158490,-158450,-158410,-158370,-158330,-158290,-158250,-158210,-158169,-158129,-158089,-158049,-158009,-157969,-157929,-157889,-157849,-157808,-157768,-157728,-157688,-157648,-157608,-157568,-157527,-157487,-157447,-157407,-157367,-157326,-157286,-157246,-157206,-157166,-157125,-157085,-157045,-157005,-156964,-156924,-156884,-156844,-156803,-156763,-156723,-156682,-156642,-156602,-156561,-156521,-156481,-156440,-156400,-156360,-156319,-156279,-156239,-156198,-156158,-156118,-156077,-156037,-155996,-155956,-155916,-155875,-155835,-155794,-155754,-155714,-155673,-155633,-155592,-155552,-155511,-155471,-155430,-155390,-155349,-155309,-155268,-155228,-155187,-155147,-155106,-155066,-155025,-154985,-154944,-154904,-154863,-154823,-154782,-154741,-154701,-154660,-154620,-154579,-154538,-154498,-154457,-154417,-154376,-154335,-154295,-154254,-154213,-154173,-154132,-154092,-154051,-154010,-153969,-153929,-153888,-153847,-153807,-153766,-153725,-153685,-153644,-153603,-153562,-153522,-153481,-153440,-153399,-153359,-153318,-153277,-153236,-153196,-153155,-153114,-153073,-153032,-152992,-152951,-152910,-152869,-152828,-152787,-152747,-152706,-152665,-152624,-152583,-152542,-152501,-152460,-152420,-152379,-152338,-152297,-152256,-152215,-152174,-152133,-152092,-152051,-152010,-151969,-151928,-151887,-151846,-151805,-151764,-151723,-151682,-151641,-151600,-151559,-151518,-151477,-151436,-151395,-151354,-151313,-151272,-151231,-151190,-151149,-151108,-151067,-151026,-150985,-150944,-150903,-150861,-150820,-150779,-150738,-150697,-150656,-150615,-150574,-150532,-150491,-150450,-150409,-150368,-150327,-150285,-150244,-150203,-150162,-150121,-150079,-150038,-149997,-149956,-149915,-149873,-149832,-149791,-149750,-149708,-149667,-149626,-149584,-149543,-149502,-149461,-149419,-149378,-149337,-149295,-149254,-149213,-149171,-149130,-149089,-149047,-149006,-148965,-148923,-148882,-148841,-148799,-148758,-148716,-148675,-148634,-148592,-148551,-148509,-148468,-148427,-148385,-148344,-148302,-148261,-148219,-148178,-148136,-148095,-148053,-148012,-147970,-147929,-147887,-147846,-147804,-147763,-147721,-147680,-147638,-147597,-147555,-147514,-147472,-147431,-147389,-147347,-147306,-147264,-147223,-147181,-147140,-147098,-147056,-147015,-146973,-146931,-146890,-146848,-146807,-146765,-146723,-146682,-146640,-146598,-146557,-146515,-146473,-146432,-146390,-146348,-146306,-146265,-146223,-146181,-146140,-146098,-146056,-146014,-145973,-145931,-145889,-145847,-145806,-145764,-145722,-145680,-145638,-145597,-145555,-145513,-145471,-145429,-145388,-145346,-145304,-145262,-145220,-145178,-145136,-145095,-145053,-145011,-144969,-144927,-144885,-144843,-144801,-144760,-144718,-144676,-144634,-144592,-144550,-144508,-144466,-144424,-144382,-144340,-144298,-144256,-144214,-144172,-144130,-144088,-144046,-144004,-143962,-143920,-143878,-143836,-143794,-143752,-143710,-143668,-143626,-143584,-143542,-143500,-143458,-143416,-143374,-143332,-143290,-143247,-143205,-143163,-143121,-143079,-143037,-142995,-142953,-142911,-142868,-142826,-142784,-142742,-142700,-142658,-142615,-142573,-142531,-142489,-142447,-142404,-142362,-142320,-142278,-142236,-142193,-142151,-142109,-142067,-142024,-141982,-141940,-141898,-141855,-141813,-141771,-141729,-141686,-141644,-141602,-141559,-141517,-141475,-141432,-141390,-141348,-141305,-141263,-141221,-141178,-141136,-141094,-141051,-141009,-140967,-140924,-140882,-140839,-140797,-140755,-140712,-140670,-140627,-140585,-140543,-140500,-140458,-140415,-140373,-140330,-140288,-140245,-140203,-140160,-140118,-140076,-140033,-139991,-139948,-139906,-139863,-139820,-139778,-139735,-139693,-139650,-139608,-139565,-139523,-139480,-139438,-139395,-139352,-139310,-139267,-139225,-139182,-139140,-139097,-139054,-139012,-138969,-138926,-138884,-138841,-138799,-138756,-138713,-138671,-138628,-138585,-138543,-138500,-138457,-138415,-138372,-138329,-138287,-138244,-138201,-138158,-138116,-138073,-138030,-137987,-137945,-137902,-137859,-137816,-137774,-137731,-137688,-137645,-137603,-137560,-137517,-137474,-137431,-137389,-137346,-137303,-137260,-137217,-137175,-137132,-137089,-137046,-137003,-136960,-136917,-136875,-136832,-136789,-136746,-136703,-136660,-136617,-136574,-136531,-136489,-136446,-136403,-136360,-136317,-136274,-136231,-136188,-136145,-136102,-136059,-136016,-135973,-135930,-135887,-135844,-135801,-135758,-135715,-135672,-135629,-135586,-135543,-135500,-135457,-135414,-135371,-135328,-135285,-135242,-135199,-135156,-135113,-135070,-135027,-134983,-134940,-134897,-134854,-134811,-134768,-134725,-134682,-134639,-134595,-134552,-134509,-134466,-134423,-134380,-134337,-134293,-134250,-134207,-134164,-134121,-134077,-134034,-133991,-133948,-133905,-133861,-133818,-133775,-133732,-133689,-133645,-133602,-133559,-133516,-133472,-133429,-133386,-133342,-133299,-133256,-133213,-133169,-133126,-133083,-133039,-132996,-132953,-132909,-132866,-132823,-132779,-132736,-132693,-132649,-132606,-132563,-132519,-132476,-132433,-132389,-132346,-132302,-132259,-132216,-132172,-132129,-132085,-132042,-131999,-131955,-131912,-131868,-131825,-131781,-131738,-131694,-131651,-131608,-131564,-131521,-131477,-131434,-131390,-131347,-131303,-131260,-131216,-131173,-131129,-131086,-131042,-130998,-130955,-130911,-130868,-130824,-130781,-130737,-130694,-130650,-130606,-130563,-130519,-130476,-130432,-130388,-130345,-130301,-130258,-130214,-130170,-130127,-130083,-130039,-129996,-129952,-129908,-129865,-129821,-129777,-129734,-129690,-129646,-129603,-129559,-129515,-129472,-129428,-129384,-129340,-129297,-129253,-129209,-129166,-129122,-129078,-129034,-128991,-128947,-128903,-128859,-128815,-128772,-128728,-128684,-128640,-128597,-128553,-128509,-128465,-128421,-128377,-128334,-128290,-128246,-128202,-128158,-128114,-128071,-128027,-127983,-127939,-127895,-127851,-127807,-127763,-127720,-127676,-127632,-127588,-127544,-127500,-127456,-127412,-127368,-127324,-127280,-127236,-127192,-127149,-127105,-127061,-127017,-126973,-126929,-126885,-126841,-126797,-126753,-126709,-126665,-126621,-126577,-126533,-126489,-126445,-126401,-126357,-126313,-126268,-126224,-126180,-126136,-126092,-126048,-126004,-125960,-125916,-125872,-125828,-125784,-125740,-125695,-125651,-125607,-125563,-125519,-125475,-125431,-125387,-125342,-125298,-125254,-125210,-125166,-125122,-125077,-125033,-124989,-124945,-124901,-124856,-124812,-124768,-124724,-124680,-124635,-124591,-124547,-124503,-124459,-124414,-124370,-124326,-124282,-124237,-124193,-124149,-124104,-124060,-124016,-123972,-123927,-123883,-123839,-123794,-123750,-123706,-123661,-123617,-123573,-123528,-123484,-123440,-123395,-123351,-123307,-123262,-123218,-123174,-123129,-123085,-123041,-122996,-122952,-122907,-122863,-122819,-122774,-122730,-122685,-122641,-122596,-122552,-122508,-122463,-122419,-122374,-122330,-122285,-122241,-122196,-122152,-122107,-122063,-122018,-121974,-121930,-121885,-121841,-121796,-121751,-121707,-121662,-121618,-121573,-121529,-121484,-121440,-121395,-121351,-121306,-121262,-121217,-121172,-121128,-121083,-121039,-120994,-120949,-120905,-120860,-120816,-120771,-120726,-120682,-120637,-120593,-120548,-120503,-120459,-120414,-120369,-120325,-120280,-120235,-120191,-120146,-120101,-120057,-120012,-119967,-119923,-119878,-119833,-119789,-119744,-119699,-119654,-119610,-119565,-119520,-119475,-119431,-119386,-119341,-119296,-119252,-119207,-119162,-119117,-119073,-119028,-118983,-118938,-118893,-118849,-118804,-118759,-118714,-118669,-118625,-118580,-118535,-118490,-118445,-118400,-118356,-118311,-118266,-118221,-118176,-118131,-118086,-118041,-117997,-117952,-117907,-117862,-117817,-117772,-117727,-117682,-117637,-117592,-117548,-117503,-117458,-117413,-117368,-117323,-117278,-117233,-117188,-117143,-117098,-117053,-117008,-116963,-116918,-116873,-116828,-116783,-116738,-116693,-116648,-116603,-116558,-116513,-116468,-116423,-116378,-116333,-116288,-116243,-116198,-116153,-116108,-116063,-116017,-115972,-115927,-115882,-115837,-115792,-115747,-115702,-115657,-115612,-115566,-115521,-115476,-115431,-115386,-115341,-115296,-115251,-115205,-115160,-115115,-115070,-115025,-114980,-114934,-114889,-114844,-114799,-114754,-114709,-114663,-114618,-114573,-114528,-114482,-114437,-114392,-114347,-114302,-114256,-114211,-114166,-114121,-114075,-114030,-113985,-113940,-113894,-113849,-113804,-113758,-113713,-113668,-113623,-113577,-113532,-113487,-113441,-113396,-113351,-113305,-113260,-113215,-113169,-113124,-113079,-113033,-112988,-112943,-112897,-112852,-112807,-112761,-112716,-112670,-112625,-112580,-112534,-112489,-112443,-112398,-112353,-112307,-112262,-112216,-112171,-112125,-112080,-112035,-111989,-111944,-111898,-111853,-111807,-111762,-111716,-111671,-111625,-111580,-111534,-111489,-111443,-111398,-111352,-111307,-111261,-111216,-111170,-111125,-111079,-111034,-110988,-110943,-110897,-110852,-110806,-110761,-110715,-110669,-110624,-110578,-110533,-110487,-110442,-110396,-110350,-110305,-110259,-110214,-110168,-110122,-110077,-110031,-109985,-109940,-109894,-109849,-109803,-109757,-109712,-109666,-109620,-109575,-109529,-109483,-109438,-109392,-109346,-109301,-109255,-109209,-109164,-109118,-109072,-109026,-108981,-108935,-108889,-108844,-108798,-108752,-108706,-108661,-108615,-108569,-108523,-108478,-108432,-108386,-108340,-108294,-108249,-108203,-108157,-108111,-108066,-108020,-107974,-107928,-107882,-107837,-107791,-107745,-107699,-107653,-107607,-107562,-107516,-107470,-107424,-107378,-107332,-107286,-107241,-107195,-107149,-107103,-107057,-107011,-106965,-106919,-106874,-106828,-106782,-106736,-106690,-106644,-106598,-106552,-106506,-106460,-106414,-106368,-106322,-106277,-106231,-106185,-106139,-106093,-106047,-106001,-105955,-105909,-105863,-105817,-105771,-105725,-105679,-105633,-105587,-105541,-105495,-105449,-105403,-105357,-105311,-105265,-105219,-105173,-105127,-105081,-105034,-104988,-104942,-104896,-104850,-104804,-104758,-104712,-104666,-104620,-104574,-104528,-104482,-104435,-104389,-104343,-104297,-104251,-104205,-104159,-104113,-104066,-104020,-103974,-103928,-103882,-103836,-103790,-103743,-103697,-103651,-103605,-103559,-103513,-103466,-103420,-103374,-103328,-103282,-103235,-103189,-103143,-103097,-103051,-103004,-102958,-102912,-102866,-102819,-102773,-102727,-102681,-102634,-102588,-102542,-102496,-102449,-102403,-102357,-102311,-102264,-102218,-102172,-102125,-102079,-102033,-101987,-101940,-101894,-101848,-101801,-101755,-101709,-101662,-101616,-101570,-101523,-101477,-101431,-101384,-101338,-101292,-101245,-101199,-101152,-101106,-101060,-101013,-100967,-100921,-100874,-100828,-100781,-100735,-100689,-100642,-100596,-100549,-100503,-100456,-100410,-100364,-100317,-100271,-100224,-100178,-100131,-100085,-100038,-99992,-99946,-99899,-99853,-99806,-99760,-99713,-99667,-99620,-99574,-99527,-99481,-99434,-99388,-99341,-99295,-99248,-99202,-99155,-99109,-99062,-99015,-98969,-98922,-98876,-98829,-98783,-98736,-98690,-98643,-98596,-98550,-98503,-98457,-98410,-98363,-98317,-98270,-98224,-98177,-98130,-98084,-98037,-97991,-97944,-97897,-97851,-97804,-97757,-97711,-97664,-97618,-97571,-97524,-97478,-97431,-97384,-97338,-97291,-97244,-97198,-97151,-97104,-97057,-97011,-96964,-96917,-96871,-96824,-96777,-96731,-96684,-96637,-96590,-96544,-96497,-96450,-96403,-96357,-96310,-96263,-96216,-96170,-96123,-96076,-96029,-95983,-95936,-95889,-95842,-95795,-95749,-95702,-95655,-95608,-95561,-95515,-95468,-95421,-95374,-95327,-95281,-95234,-95187,-95140,-95093,-95046,-95000,-94953,-94906,-94859,-94812,-94765,-94718,-94672,-94625,-94578,-94531,-94484,-94437,-94390,-94343,-94296,-94250,-94203,-94156,-94109,-94062,-94015,-93968,-93921,-93874,-93827,-93780,-93733,-93686,-93639,-93593,-93546,-93499,-93452,-93405,-93358,-93311,-93264,-93217,-93170,-93123,-93076,-93029,-92982,-92935,-92888,-92841,-92794,-92747,-92700,-92653,-92606,-92559,-92512,-92465,-92418,-92371,-92324,-92277,-92229,-92182,-92135,-92088,-92041,-91994,-91947,-91900,-91853,-91806,-91759,-91712,-91665,-91618,-91570,-91523,-91476,-91429,-91382,-91335,-91288,-91241,-91194,-91146,-91099,-91052,-91005,-90958,-90911,-90864,-90816,-90769,-90722,-90675,-90628,-90581,-90533,-90486,-90439,-90392,-90345,-90298,-90250,-90203,-90156,-90109,-90062,-90014,-89967,-89920,-89873,-89825,-89778,-89731,-89684,-89637,-89589,-89542,-89495,-89448,-89400,-89353,-89306,-89259,-89211,-89164,-89117,-89069,-89022,-88975,-88928,-88880,-88833,-88786,-88738,-88691,-88644,-88597,-88549,-88502,-88455,-88407,-88360,-88313,-88265,-88218,-88171,-88123,-88076,-88029,-87981,-87934,-87887,-87839,-87792,-87744,-87697,-87650,-87602,-87555,-87508,-87460,-87413,-87365,-87318,-87271,-87223,-87176,-87128,-87081,-87034,-86986,-86939,-86891,-86844,-86797,-86749,-86702,-86654,-86607,-86559,-86512,-86464,-86417,-86370,-86322,-86275,-86227,-86180,-86132,-86085,-86037,-85990,-85942,-85895,-85847,-85800,-85752,-85705,-85657,-85610,-85562,-85515,-85467,-85420,-85372,-85325,-85277,-85230,-85182,-85135,-85087,-85039,-84992,-84944,-84897,-84849,-84802,-84754,-84707,-84659,-84611,-84564,-84516,-84469,-84421,-84373,-84326,-84278,-84231,-84183,-84135,-84088,-84040,-83993,-83945,-83897,-83850,-83802,-83755,-83707,-83659,-83612,-83564,-83516,-83469,-83421,-83373,-83326,-83278,-83230,-83183,-83135,-83087,-83040,-82992,-82944,-82897,-82849,-82801,-82754,-82706,-82658,-82611,-82563,-82515,-82467,-82420,-82372,-82324,-82277,-82229,-82181,-82133,-82086,-82038,-81990,-81942,-81895,-81847,-81799,-81751,-81704,-81656,-81608,-81560,-81513,-81465,-81417,-81369,-81321,-81274,-81226,-81178,-81130,-81082,-81035,-80987,-80939,-80891,-80843,-80796,-80748,-80700,-80652,-80604,-80556,-80509,-80461,-80413,-80365,-80317,-80269,-80222,-80174,-80126,-80078,-80030,-79982,-79934,-79886,-79839,-79791,-79743,-79695,-79647,-79599,-79551,-79503,-79456,-79408,-79360,-79312,-79264,-79216,-79168,-79120,-79072,-79024,-78976,-78928,-78880,-78833,-78785,-78737,-78689,-78641,-78593,-78545,-78497,-78449,-78401,-78353,-78305,-78257,-78209,-78161,-78113,-78065,-78017,-77969,-77921,-77873,-77825,-77777,-77729,-77681,-77633,-77585,-77537,-77489,-77441,-77393,-77345,-77297,-77249,-77201,-77153,-77105,-77057,-77009,-76961,-76913,-76865,-76817,-76769,-76720,-76672,-76624,-76576,-76528,-76480,-76432,-76384,-76336,-76288,-76240,-76192,-76143,-76095,-76047,-75999,-75951,-75903,-75855,-75807,-75759,-75710,-75662,-75614,-75566,-75518,-75470,-75422,-75374,-75325,-75277,-75229,-75181,-75133,-75085,-75036,-74988,-74940,-74892,-74844,-74796,-74747,-74699,-74651,-74603,-74555,-74507,-74458,-74410,-74362,-74314,-74266,-74217,-74169,-74121,-74073,-74024,-73976,-73928,-73880,-73832,-73783,-73735,-73687,-73639,-73590,-73542,-73494,-73446,-73397,-73349,-73301,-73253,-73204,-73156,-73108,-73060,-73011,-72963,-72915,-72866,-72818,-72770,-72722,-72673,-72625,-72577,-72528,-72480,-72432,-72383,-72335,-72287,-72238,-72190,-72142,-72094,-72045,-71997,-71949,-71900,-71852,-71804,-71755,-71707,-71658,-71610,-71562,-71513,-71465,-71417,-71368,-71320,-71272,-71223,-71175,-71126,-71078,-71030,-70981,-70933,-70885,-70836,-70788,-70739,-70691,-70643,-70594,-70546,-70497,-70449,-70400,-70352,-70304,-70255,-70207,-70158,-70110,-70061,-70013,-69965,-69916,-69868,-69819,-69771,-69722,-69674,-69625,-69577,-69529,-69480,-69432,-69383,-69335,-69286,-69238,-69189,-69141,-69092,-69044,-68995,-68947,-68898,-68850,-68801,-68753,-68704,-68656,-68607,-68559,-68510,-68462,-68413,-68365,-68316,-68268,-68219,-68170,-68122,-68073,-68025,-67976,-67928,-67879,-67831,-67782,-67734,-67685,-67636,-67588,-67539,-67491,-67442,-67394,-67345,-67296,-67248,-67199,-67151,-67102,-67054,-67005,-66956,-66908,-66859,-66811,-66762,-66713,-66665,-66616,-66567,-66519,-66470,-66422,-66373,-66324,-66276,-66227,-66178,-66130,-66081,-66033,-65984,-65935,-65887,-65838,-65789,-65741,-65692,-65643,-65595,-65546,-65497,-65449,-65400,-65351,-65303,-65254,-65205,-65157,-65108,-65059,-65010,-64962,-64913,-64864,-64816,-64767,-64718,-64670,-64621,-64572,-64523,-64475,-64426,-64377,-64328,-64280,-64231,-64182,-64134,-64085,-64036,-63987,-63939,-63890,-63841,-63792,-63744,-63695,-63646,-63597,-63549,-63500,-63451,-63402,-63353,-63305,-63256,-63207,-63158,-63110,-63061,-63012,-62963,-62914,-62866,-62817,-62768,-62719,-62670,-62622,-62573,-62524,-62475,-62426,-62377,-62329,-62280,-62231,-62182,-62133,-62084,-62036,-61987,-61938,-61889,-61840,-61791,-61743,-61694,-61645,-61596,-61547,-61498,-61449,-61401,-61352,-61303,-61254,-61205,-61156,-61107,-61058,-61010,-60961,-60912,-60863,-60814,-60765,-60716,-60667,-60618,-60569,-60521,-60472,-60423,-60374,-60325,-60276,-60227,-60178,-60129,-60080,-60031,-59982,-59934,-59885,-59836,-59787,-59738,-59689,-59640,-59591,-59542,-59493,-59444,-59395,-59346,-59297,-59248,-59199,-59150,-59101,-59052,-59003,-58954,-58905,-58856,-58807,-58758,-58710,-58661,-58612,-58563,-58514,-58465,-58416,-58367,-58318,-58269,-58220,-58170,-58121,-58072,-58023,-57974,-57925,-57876,-57827,-57778,-57729,-57680,-57631,-57582,-57533,-57484,-57435,-57386,-57337,-57288,-57239,-57190,-57141,-57092,-57043,-56994,-56945,-56895,-56846,-56797,-56748,-56699,-56650,-56601,-56552,-56503,-56454,-56405,-56356,-56307,-56257,-56208,-56159,-56110,-56061,-56012,-55963,-55914,-55865,-55815,-55766,-55717,-55668,-55619,-55570,-55521,-55472,-55423,-55373,-55324,-55275,-55226,-55177,-55128,-55079,-55029,-54980,-54931,-54882,-54833,-54784,-54735,-54685,-54636,-54587,-54538,-54489,-54440,-54390,-54341,-54292,-54243,-54194,-54144,-54095,-54046,-53997,-53948,-53899,-53849,-53800,-53751,-53702,-53653,-53603,-53554,-53505,-53456,-53407,-53357,-53308,-53259,-53210,-53160,-53111,-53062,-53013,-52964,-52914,-52865,-52816,-52767,-52717,-52668,-52619,-52570,-52520,-52471,-52422,-52373,-52323,-52274,-52225,-52176,-52126,-52077,-52028,-51979,-51929,-51880,-51831,-51781,-51732,-51683,-51634,-51584,-51535,-51486,-51437,-51387,-51338,-51289,-51239,-51190,-51141,-51091,-51042,-50993,-50944,-50894,-50845,-50796,-50746,-50697,-50648,-50598,-50549,-50500,-50450,-50401,-50352,-50302,-50253,-50204,-50154,-50105,-50056,-50006,-49957,-49908,-49858,-49809,-49760,-49710,-49661,-49612,-49562,-49513,-49463,-49414,-49365,-49315,-49266,-49217,-49167,-49118,-49069,-49019,-48970,-48920,-48871,-48822,-48772,-48723,-48673,-48624,-48575,-48525,-48476,-48426,-48377,-48328,-48278,-48229,-48179,-48130,-48081,-48031,-47982,-47932,-47883,-47834,-47784,-47735,-47685,-47636,-47586,-47537,-47488,-47438,-47389,-47339,-47290,-47240,-47191,-47141,-47092,-47043,-46993,-46944,-46894,-46845,-46795,-46746,-46696,-46647,-46597,-46548,-46499,-46449,-46400,-46350,-46301,-46251,-46202,-46152,-46103,-46053,-46004,-45954,-45905,-45855,-45806,-45756,-45707,-45657,-45608,-45558,-45509,-45459,-45410,-45360,-45311,-45261,-45212,-45162,-45113,-45063,-45014,-44964,-44915,-44865,-44816,-44766,-44717,-44667,-44618,-44568,-44518,-44469,-44419,-44370,-44320,-44271,-44221,-44172,-44122,-44073,-44023,-43973,-43924,-43874,-43825,-43775,-43726,-43676,-43627,-43577,-43527,-43478,-43428,-43379,-43329,-43280,-43230,-43180,-43131,-43081,-43032,-42982,-42932,-42883,-42833,-42784,-42734,-42685,-42635,-42585,-42536,-42486,-42437,-42387,-42337,-42288,-42238,-42189,-42139,-42089,-42040,-41990,-41940,-41891,-41841,-41792,-41742,-41692,-41643,-41593,-41543,-41494,-41444,-41395,-41345,-41295,-41246,-41196,-41146,-41097,-41047,-40997,-40948,-40898,-40848,-40799,-40749,-40700,-40650,-40600,-40551,-40501,-40451,-40402,-40352,-40302,-40253,-40203,-40153,-40104,-40054,-40004,-39955,-39905,-39855,-39805,-39756,-39706,-39656,-39607,-39557,-39507,-39458,-39408,-39358,-39309,-39259,-39209,-39159,-39110,-39060,-39010,-38961,-38911,-38861,-38812,-38762,-38712,-38662,-38613,-38563,-38513,-38464,-38414,-38364,-38314,-38265,-38215,-38165,-38115,-38066,-38016,-37966,-37916,-37867,-37817,-37767,-37718,-37668,-37618,-37568,-37519,-37469,-37419,-37369,-37320,-37270,-37220,-37170,-37121,-37071,-37021,-36971,-36921,-36872,-36822,-36772,-36722,-36673,-36623,-36573,-36523,-36474,-36424,-36374,-36324,-36274,-36225,-36175,-36125,-36075,-36026,-35976,-35926,-35876,-35826,-35777,-35727,-35677,-35627,-35577,-35528,-35478,-35428,-35378,-35328,-35279,-35229,-35179,-35129,-35079,-35029,-34980,-34930,-34880,-34830,-34780,-34731,-34681,-34631,-34581,-34531,-34481,-34432,-34382,-34332,-34282,-34232,-34182,-34133,-34083,-34033,-33983,-33933,-33883,-33834,-33784,-33734,-33684,-33634,-33584,-33534,-33485,-33435,-33385,-33335,-33285,-33235,-33185,-33136,-33086,-33036,-32986,-32936,-32886,-32836,-32787,-32737,-32687,-32637,-32587,-32537,-32487,-32437,-32388,-32338,-32288,-32238,-32188,-32138,-32088,-32038,-31988,-31939,-31889,-31839,-31789,-31739,-31689,-31639,-31589,-31539,-31489,-31440,-31390,-31340,-31290,-31240,-31190,-31140,-31090,-31040,-30990,-30941,-30891,-30841,-30791,-30741,-30691,-30641,-30591,-30541,-30491,-30441,-30391,-30341,-30292,-30242,-30192,-30142,-30092,-30042,-29992,-29942,-29892,-29842,-29792,-29742,-29692,-29642,-29592,-29542,-29493,-29443,-29393,-29343,-29293,-29243,-29193,-29143,-29093,-29043,-28993,-28943,-28893,-28843,-28793,-28743,-28693,-28643,-28593,-28543,-28493,-28443,-28393,-28343,-28294,-28244,-28194,-28144,-28094,-28044,-27994,-27944,-27894,-27844,-27794,-27744,-27694,-27644,-27594,-27544,-27494,-27444,-27394,-27344,-27294,-27244,-27194,-27144,-27094,-27044,-26994,-26944,-26894,-26844,-26794,-26744,-26694,-26644,-26594,-26544,-26494,-26444,-26394,-26344,-26294,-26244,-26194,-26144,-26094,-26044,-25994,-25944,-25894,-25844,-25794,-25744,-25694,-25644,-25594,-25544,-25494,-25443,-25393,-25343,-25293,-25243,-25193,-25143,-25093,-25043,-24993,-24943,-24893,-24843,-24793,-24743,-24693,-24643,-24593,-24543,-24493,-24443,-24393,-24343,-24293,-24243,-24192,-24142,-24092,-24042,-23992,-23942,-23892,-23842,-23792,-23742,-23692,-23642,-23592,-23542,-23492,-23442,-23392,-23341,-23291,-23241,-23191,-23141,-23091,-23041,-22991,-22941,-22891,-22841,-22791,-22741,-22691,-22640,-22590,-22540,-22490,-22440,-22390,-22340,-22290,-22240,-22190,-22140,-22090,-22039,-21989,-21939,-21889,-21839,-21789,-21739,-21689,-21639,-21589,-21539,-21488,-21438,-21388,-21338,-21288,-21238,-21188,-21138,-21088,-21038,-20987,-20937,-20887,-20837,-20787,-20737,-20687,-20637,-20587,-20537,-20486,-20436,-20386,-20336,-20286,-20236,-20186,-20136,-20085,-20035,-19985,-19935,-19885,-19835,-19785,-19735,-19685,-19634,-19584,-19534,-19484,-19434,-19384,-19334,-19284,-19233,-19183,-19133,-19083,-19033,-18983,-18933,-18882,-18832,-18782,-18732,-18682,-18632,-18582,-18531,-18481,-18431,-18381,-18331,-18281,-18231,-18180,-18130,-18080,-18030,-17980,-17930,-17880,-17829,-17779,-17729,-17679,-17629,-17579,-17529,-17478,-17428,-17378,-17328,-17278,-17228,-17177,-17127,-17077,-17027,-16977,-16927,-16877,-16826,-16776,-16726,-16676,-16626,-16576,-16525,-16475,-16425,-16375,-16325,-16275,-16224,-16174,-16124,-16074,-16024,-15974,-15923,-15873,-15823,-15773,-15723,-15672,-15622,-15572,-15522,-15472,-15422,-15371,-15321,-15271,-15221,-15171,-15121,-15070,-15020,-14970,-14920,-14870,-14819,-14769,-14719,-14669,-14619,-14568,-14518,-14468,-14418,-14368,-14318,-14267,-14217,-14167,-14117,-14067,-14016,-13966,-13916,-13866,-13816,-13765,-13715,-13665,-13615,-13565,-13514,-13464,-13414,-13364,-13314,-13263,-13213,-13163,-13113,-13063,-13012,-12962,-12912,-12862,-12812,-12761,-12711,-12661,-12611,-12561,-12510,-12460,-12410,-12360,-12310,-12259,-12209,-12159,-12109,-12058,-12008,-11958,-11908,-11858,-11807,-11757,-11707,-11657,-11607,-11556,-11506,-11456,-11406,-11355,-11305,-11255,-11205,-11155,-11104,-11054,-11004,-10954,-10903,-10853,-10803,-10753,-10703,-10652,-10602,-10552,-10502,-10451,-10401,-10351,-10301,-10251,-10200,-10150,-10100,-10050,-9999,-9949,-9899,-9849,-9798,-9748,-9698,-9648,-9598,-9547,-9497,-9447,-9397,-9346,-9296,-9246,-9196,-9145,-9095,-9045,-8995,-8945,-8894,-8844,-8794,-8744,-8693,-8643,-8593,-8543,-8492,-8442,-8392,-8342,-8291,-8241,-8191,-8141,-8090,-8040,-7990,-7940,-7889,-7839,-7789,-7739,-7689,-7638,-7588,-7538,-7488,-7437,-7387,-7337,-7287,-7236,-7186,-7136,-7086,-7035,-6985,-6935,-6885,-6834,-6784,-6734,-6684,-6633,-6583,-6533,-6483,-6432,-6382,-6332,-6282,-6231,-6181,-6131,-6081,-6030,-5980,-5930,-5880,-5829,-5779,-5729,-5679,-5628,-5578,-5528,-5478,-5427,-5377,-5327,-5277,-5226,-5176,-5126,-5075,-5025,-4975,-4925,-4874,-4824,-4774,-4724,-4673,-4623,-4573,-4523,-4472,-4422,-4372,-4322,-4271,-4221,-4171,-4121,-4070,-4020,-3970,-3920,-3869,-3819,-3769,-3719,-3668,-3618,-3568,-3517,-3467,-3417,-3367,-3316,-3266,-3216,-3166,-3115,-3065,-3015,-2965,-2914,-2864,-2814,-2764,-2713,-2663,-2613,-2562,-2512,-2462,-2412,-2361,-2311,-2261,-2211,-2160,-2110,-2060,-2010,-1959,-1909,-1859,-1809,-1758,-1708,-1658,-1607,-1557,-1507,-1457,-1406,-1356,-1306,-1256,-1205,-1155,-1105,-1055,-1004,-954,-904,-854,-803,-753,-703,-652,-602,-552,-502,-451,-401,-351,-301,-250,-200,-150,-100,-49,0,50,101,151,201,251,302,352,402,452,503,553,603,653,704,754,804,855,905,955,1005,1056,1106,1156,1206,1257,1307,1357,1407,1458,1508,1558,1608,1659,1709,1759,1810,1860,1910,1960,2011,2061,2111,2161,2212,2262,2312,2362,2413,2463,2513,2563,2614,2664,2714,2765,2815,2865,2915,2966,3016,3066,3116,3167,3217,3267,3317,3368,3418,3468,3518,3569,3619,3669,3720,3770,3820,3870,3921,3971,4021,4071,4122,4172,4222,4272,4323,4373,4423,4473,4524,4574,4624,4674,4725,4775,4825,4875,4926,4976,5026,5076,5127,5177,5227,5278,5328,5378,5428,5479,5529,5579,5629,5680,5730,5780,5830,5881,5931,5981,6031,6082,6132,6182,6232,6283,6333,6383,6433,6484,6534,6584,6634,6685,6735,6785,6835,6886,6936,6986,7036,7087,7137,7187,7237,7288,7338,7388,7438,7489,7539,7589,7639,7690,7740,7790,7840,7890,7941,7991,8041,8091,8142,8192,8242,8292,8343,8393,8443,8493,8544,8594,8644,8694,8745,8795,8845,8895,8946,8996,9046,9096,9146,9197,9247,9297,9347,9398,9448,9498,9548,9599,9649,9699,9749,9799,9850,9900,9950,10000,10051,10101,10151,10201,10252,10302,10352,10402,10452,10503,10553,10603,10653,10704,10754,10804,10854,10904,10955,11005,11055,11105,11156,11206,11256,11306,11356,11407,11457,11507,11557,11608,11658,11708,11758,11808,11859,11909,11959,12009,12059,12110,12160,12210,12260,12311,12361,12411,12461,12511,12562,12612,12662,12712,12762,12813,12863,12913,12963,13013,13064,13114,13164,13214,13264,13315,13365,13415,13465,13515,13566,13616,13666,13716,13766,13817,13867,13917,13967,14017,14068,14118,14168,14218,14268,14319,14369,14419,14469,14519,14569,14620,14670,14720,14770,14820,14871,14921,14971,15021,15071,15122,15172,15222,15272,15322,15372,15423,15473,15523,15573,15623,15673,15724,15774,15824,15874,15924,15975,16025,16075,16125,16175,16225,16276,16326,16376,16426,16476,16526,16577,16627,16677,16727,16777,16827,16878,16928,16978,17028,17078,17128,17178,17229,17279,17329,17379,17429,17479,17530,17580,17630,17680,17730,17780,17830,17881,17931,17981,18031,18081,18131,18181,18232,18282,18332,18382,18432,18482,18532,18583,18633,18683,18733,18783,18833,18883,18934,18984,19034,19084,19134,19184,19234,19285,19335,19385,19435,19485,19535,19585,19635,19686,19736,19786,19836,19886,19936,19986,20036,20086,20137,20187,20237,20287,20337,20387,20437,20487,20538,20588,20638,20688,20738,20788,20838,20888,20938,20988,21039,21089,21139,21189,21239,21289,21339,21389,21439,21489,21540,21590,21640,21690,21740,21790,21840,21890,21940,21990,22040,22091,22141,22191,22241,22291,22341,22391,22441,22491,22541,22591,22641,22692,22742,22792,22842,22892,22942,22992,23042,23092,23142,23192,23242,23292,23342,23393,23443,23493,23543,23593,23643,23693,23743,23793,23843,23893,23943,23993,24043,24093,24143,24193,24244,24294,24344,24394,24444,24494,24544,24594,24644,24694,24744,24794,24844,24894,24944,24994,25044,25094,25144,25194,25244,25294,25344,25394,25444,25495,25545,25595,25645,25695,25745,25795,25845,25895,25945,25995,26045,26095,26145,26195,26245,26295,26345,26395,26445,26495,26545,26595,26645,26695,26745,26795,26845,26895,26945,26995,27045,27095,27145,27195,27245,27295,27345,27395,27445,27495,27545,27595,27645,27695,27745,27795,27845,27895,27945,27995,28045,28095,28145,28195,28245,28295,28344,28394,28444,28494,28544,28594,28644,28694,28744,28794,28844,28894,28944,28994,29044,29094,29144,29194,29244,29294,29344,29394,29444,29494,29543,29593,29643,29693,29743,29793,29843,29893,29943,29993,30043,30093,30143,30193,30243,30293,30342,30392,30442,30492,30542,30592,30642,30692,30742,30792,30842,30892,30942,30991,31041,31091,31141,31191,31241,31291,31341,31391,31441,31490,31540,31590,31640,31690,31740,31790,31840,31890,31940,31989,32039,32089,32139,32189,32239,32289,32339,32389,32438,32488,32538,32588,32638,32688,32738,32788,32837,32887,32937,32987,33037,33087,33137,33186,33236,33286,33336,33386,33436,33486,33535,33585,33635,33685,33735,33785,33835,33884,33934,33984,34034,34084,34134,34183,34233,34283,34333,34383,34433,34482,34532,34582,34632,34682,34732,34781,34831,34881,34931,34981,35030,35080,35130,35180,35230,35280,35329,35379,35429,35479,35529,35578,35628,35678,35728,35778,35827,35877,35927,35977,36027,36076,36126,36176,36226,36275,36325,36375,36425,36475,36524,36574,36624,36674,36723,36773,36823,36873,36922,36972,37022,37072,37122,37171,37221,37271,37321,37370,37420,37470,37520,37569,37619,37669,37719,37768,37818,37868,37917,37967,38017,38067,38116,38166,38216,38266,38315,38365,38415,38465,38514,38564,38614,38663,38713,38763,38813,38862,38912,38962,39011,39061,39111,39160,39210,39260,39310,39359,39409,39459,39508,39558,39608,39657,39707,39757,39806,39856,39906,39956,40005,40055,40105,40154,40204,40254,40303,40353,40403,40452,40502,40552,40601,40651,40701,40750,40800,40849,40899,40949,40998,41048,41098,41147,41197,41247,41296,41346,41396,41445,41495,41544,41594,41644,41693,41743,41793,41842,41892,41941,41991,42041,42090,42140,42190,42239,42289,42338,42388,42438,42487,42537,42586,42636,42686,42735,42785,42834,42884,42933,42983,43033,43082,43132,43181,43231,43281,43330,43380,43429,43479,43528,43578,43628,43677,43727,43776,43826,43875,43925,43974,44024,44074,44123,44173,44222,44272,44321,44371,44420,44470,44519,44569,44619,44668,44718,44767,44817,44866,44916,44965,45015,45064,45114,45163,45213,45262,45312,45361,45411,45460,45510,45559,45609,45658,45708,45757,45807,45856,45906,45955,46005,46054,46104,46153,46203,46252,46302,46351,46401,46450,46500,46549,46598,46648,46697,46747,46796,46846,46895,46945,46994,47044,47093,47142,47192,47241,47291,47340,47390,47439,47489,47538,47587,47637,47686,47736,47785,47835,47884,47933,47983,48032,48082,48131,48180,48230,48279,48329,48378,48427,48477,48526,48576,48625,48674,48724,48773,48823,48872,48921,48971,49020,49070,49119,49168,49218,49267,49316,49366,49415,49464,49514,49563,49613,49662,49711,49761,49810,49859,49909,49958,50007,50057,50106,50155,50205,50254,50303,50353,50402,50451,50501,50550,50599,50649,50698,50747,50797,50846,50895,50945,50994,51043,51092,51142,51191,51240,51290,51339,51388,51438,51487,51536,51585,51635,51684,51733,51782,51832,51881,51930,51980,52029,52078,52127,52177,52226,52275,52324,52374,52423,52472,52521,52571,52620,52669,52718,52768,52817,52866,52915,52965,53014,53063,53112,53161,53211,53260,53309,53358,53408,53457,53506,53555,53604,53654,53703,53752,53801,53850,53900,53949,53998,54047,54096,54145,54195,54244,54293,54342,54391,54441,54490,54539,54588,54637,54686,54736,54785,54834,54883,54932,54981,55030,55080,55129,55178,55227,55276,55325,55374,55424,55473,55522,55571,55620,55669,55718,55767,55816,55866,55915,55964,56013,56062,56111,56160,56209,56258,56308,56357,56406,56455,56504,56553,56602,56651,56700,56749,56798,56847,56896,56946,56995,57044,57093,57142,57191,57240,57289,57338,57387,57436,57485,57534,57583,57632,57681,57730,57779,57828,57877,57926,57975,58024,58073,58122,58171,58221,58270,58319,58368,58417,58466,58515,58564,58613,58662,58711,58759,58808,58857,58906,58955,59004,59053,59102,59151,59200,59249,59298,59347,59396,59445,59494,59543,59592,59641,59690,59739,59788,59837,59886,59935,59983,60032,60081,60130,60179,60228,60277,60326,60375,60424,60473,60522,60570,60619,60668,60717,60766,60815,60864,60913,60962,61011,61059,61108,61157,61206,61255,61304,61353,61402,61450,61499,61548,61597,61646,61695,61744,61792,61841,61890,61939,61988,62037,62085,62134,62183,62232,62281,62330,62378,62427,62476,62525,62574,62623,62671,62720,62769,62818,62867,62915,62964,63013,63062,63111,63159,63208,63257,63306,63354,63403,63452,63501,63550,63598,63647,63696,63745,63793,63842,63891,63940,63988,64037,64086,64135,64183,64232,64281,64329,64378,64427,64476,64524,64573,64622,64671,64719,64768,64817,64865,64914,64963,65011,65060,65109,65158,65206,65255,65304,65352,65401,65450,65498,65547,65596,65644,65693,65742,65790,65839,65888,65936,65985,66034,66082,66131,66179,66228,66277,66325,66374,66423,66471,66520,66568,66617,66666,66714,66763,66812,66860,66909,66957,67006,67055,67103,67152,67200,67249,67297,67346,67395,67443,67492,67540,67589,67637,67686,67735,67783,67832,67880,67929,67977,68026,68074,68123,68171,68220,68269,68317,68366,68414,68463,68511,68560,68608,68657,68705,68754,68802,68851,68899,68948,68996,69045,69093,69142,69190,69239,69287,69336,69384,69433,69481,69530,69578,69626,69675,69723,69772,69820,69869,69917,69966,70014,70062,70111,70159,70208,70256,70305,70353,70401,70450,70498,70547,70595,70644,70692,70740,70789,70837,70886,70934,70982,71031,71079,71127,71176,71224,71273,71321,71369,71418,71466,71514,71563,71611,71659,71708,71756,71805,71853,71901,71950,71998,72046,72095,72143,72191,72239,72288,72336,72384,72433,72481,72529,72578,72626,72674,72723,72771,72819,72867,72916,72964,73012,73061,73109,73157,73205,73254,73302,73350,73398,73447,73495,73543,73591,73640,73688,73736,73784,73833,73881,73929,73977,74025,74074,74122,74170,74218,74267,74315,74363,74411,74459,74508,74556,74604,74652,74700,74748,74797,74845,74893,74941,74989,75037,75086,75134,75182,75230,75278,75326,75375,75423,75471,75519,75567,75615,75663,75711,75760,75808,75856,75904,75952,76000,76048,76096,76144,76193,76241,76289,76337,76385,76433,76481,76529,76577,76625,76673,76721,76770,76818,76866,76914,76962,77010,77058,77106,77154,77202,77250,77298,77346,77394,77442,77490,77538,77586,77634,77682,77730,77778,77826,77874,77922,77970,78018,78066,78114,78162,78210,78258,78306,78354,78402,78450,78498,78546,78594,78642,78690,78738,78786,78834,78881,78929,78977,79025,79073,79121,79169,79217,79265,79313,79361,79409,79457,79504,79552,79600,79648,79696,79744,79792,79840,79887,79935,79983,80031,80079,80127,80175,80223,80270,80318,80366,80414,80462,80510,80557,80605,80653,80701,80749,80797,80844,80892,80940,80988,81036,81083,81131,81179,81227,81275,81322,81370,81418,81466,81514,81561,81609,81657,81705,81752,81800,81848,81896,81943,81991,82039,82087,82134,82182,82230,82278,82325,82373,82421,82468,82516,82564,82612,82659,82707,82755,82802,82850,82898,82945,82993,83041,83088,83136,83184,83231,83279,83327,83374,83422,83470,83517,83565,83613,83660,83708,83756,83803,83851,83898,83946,83994,84041,84089,84136,84184,84232,84279,84327,84374,84422,84470,84517,84565,84612,84660,84708,84755,84803,84850,84898,84945,84993,85040,85088,85136,85183,85231,85278,85326,85373,85421,85468,85516,85563,85611,85658,85706,85753,85801,85848,85896,85943,85991,86038,86086,86133,86181,86228,86276,86323,86371,86418,86465,86513,86560,86608,86655,86703,86750,86798,86845,86892,86940,86987,87035,87082,87129,87177,87224,87272,87319,87366,87414,87461,87509,87556,87603,87651,87698,87745,87793,87840,87888,87935,87982,88030,88077,88124,88172,88219,88266,88314,88361,88408,88456,88503,88550,88598,88645,88692,88739,88787,88834,88881,88929,88976,89023,89070,89118,89165,89212,89260,89307,89354,89401,89449,89496,89543,89590,89638,89685,89732,89779,89826,89874,89921,89968,90015,90063,90110,90157,90204,90251,90299,90346,90393,90440,90487,90534,90582,90629,90676,90723,90770,90817,90865,90912,90959,91006,91053,91100,91147,91195,91242,91289,91336,91383,91430,91477,91524,91571,91619,91666,91713,91760,91807,91854,91901,91948,91995,92042,92089,92136,92183,92230,92278,92325,92372,92419,92466,92513,92560,92607,92654,92701,92748,92795,92842,92889,92936,92983,93030,93077,93124,93171,93218,93265,93312,93359,93406,93453,93500,93547,93594,93640,93687,93734,93781,93828,93875,93922,93969,94016,94063,94110,94157,94204,94251,94297,94344,94391,94438,94485,94532,94579,94626,94673,94719,94766,94813,94860,94907,94954,95001,95047,95094,95141,95188,95235,95282,95328,95375,95422,95469,95516,95562,95609,95656,95703,95750,95796,95843,95890,95937,95984,96030,96077,96124,96171,96217,96264,96311,96358,96404,96451,96498,96545,96591,96638,96685,96732,96778,96825,96872,96918,96965,97012,97058,97105,97152,97199,97245,97292,97339,97385,97432,97479,97525,97572,97619,97665,97712,97758,97805,97852,97898,97945,97992,98038,98085,98131,98178,98225,98271,98318,98364,98411,98458,98504,98551,98597,98644,98691,98737,98784,98830,98877,98923,98970,99016,99063,99110,99156,99203,99249,99296,99342,99389,99435,99482,99528,99575,99621,99668,99714,99761,99807,99854,99900,99947,99993,100039,100086,100132,100179,100225,100272,100318,100365,100411,100457,100504,100550,100597,100643,100690,100736,100782,100829,100875,100922,100968,101014,101061,101107,101153,101200,101246,101293,101339,101385,101432,101478,101524,101571,101617,101663,101710,101756,101802,101849,101895,101941,101988,102034,102080,102126,102173,102219,102265,102312,102358,102404,102450,102497,102543,102589,102635,102682,102728,102774,102820,102867,102913,102959,103005,103052,103098,103144,103190,103236,103283,103329,103375,103421,103467,103514,103560,103606,103652,103698,103744,103791,103837,103883,103929,103975,104021,104067,104114,104160,104206,104252,104298,104344,104390,104436,104483,104529,104575,104621,104667,104713,104759,104805,104851,104897,104943,104989,105035,105082,105128,105174,105220,105266,105312,105358,105404,105450,105496,105542,105588,105634,105680,105726,105772,105818,105864,105910,105956,106002,106048,106094,106140,106186,106232,106278,106323,106369,106415,106461,106507,106553,106599,106645,106691,106737,106783,106829,106875,106920,106966,107012,107058,107104,107150,107196,107242,107287,107333,107379,107425,107471,107517,107563,107608,107654,107700,107746,107792,107838,107883,107929,107975,108021,108067,108112,108158,108204,108250,108295,108341,108387,108433,108479,108524,108570,108616,108662,108707,108753,108799,108845,108890,108936,108982,109027,109073,109119,109165,109210,109256,109302,109347,109393,109439,109484,109530,109576,109621,109667,109713,109758,109804,109850,109895,109941,109986,110032,110078,110123,110169,110215,110260,110306,110351,110397,110443,110488,110534,110579,110625,110670,110716,110762,110807,110853,110898,110944,110989,111035,111080,111126,111171,111217,111262,111308,111353,111399,111444,111490,111535,111581,111626,111672,111717,111763,111808,111854,111899,111945,111990,112036,112081,112126,112172,112217,112263,112308,112354,112399,112444,112490,112535,112581,112626,112671,112717,112762,112808,112853,112898,112944,112989,113034,113080,113125,113170,113216,113261,113306,113352,113397,113442,113488,113533,113578,113624,113669,113714,113759,113805,113850,113895,113941,113986,114031,114076,114122,114167,114212,114257,114303,114348,114393,114438,114483,114529,114574,114619,114664,114710,114755,114800,114845,114890,114935,114981,115026,115071,115116,115161,115206,115252,115297,115342,115387,115432,115477,115522,115567,115613,115658,115703,115748,115793,115838,115883,115928,115973,116018,116064,116109,116154,116199,116244,116289,116334,116379,116424,116469,116514,116559,116604,116649,116694,116739,116784,116829,116874,116919,116964,117009,117054,117099,117144,117189,117234,117279,117324,117369,117414,117459,117504,117549,117593,117638,117683,117728,117773,117818,117863,117908,117953,117998,118042,118087,118132,118177,118222,118267,118312,118357,118401,118446,118491,118536,118581,118626,118670,118715,118760,118805,118850,118894,118939,118984,119029,119074,119118,119163,119208,119253,119297,119342,119387,119432,119476,119521,119566,119611,119655,119700,119745,119790,119834,119879,119924,119968,120013,120058,120102,120147,120192,120236,120281,120326,120370,120415,120460,120504,120549,120594,120638,120683,120727,120772,120817,120861,120906,120950,120995,121040,121084,121129,121173,121218,121263,121307,121352,121396,121441,121485,121530,121574,121619,121663,121708,121752,121797,121842,121886,121931,121975,122019,122064,122108,122153,122197,122242,122286,122331,122375,122420,122464,122509,122553,122597,122642,122686,122731,122775,122820,122864,122908,122953,122997,123042,123086,123130,123175,123219,123263,123308,123352,123396,123441,123485,123529,123574,123618,123662,123707,123751,123795,123840,123884,123928,123973,124017,124061,124105,124150,124194,124238,124283,124327,124371,124415,124460,124504,124548,124592,124636,124681,124725,124769,124813,124857,124902,124946,124990,125034,125078,125123,125167,125211,125255,125299,125343,125388,125432,125476,125520,125564,125608,125652,125696,125741,125785,125829,125873,125917,125961,126005,126049,126093,126137,126181,126225,126269,126314,126358,126402,126446,126490,126534,126578,126622,126666,126710,126754,126798,126842,126886,126930,126974,127018,127062,127106,127150,127193,127237,127281,127325,127369,127413,127457,127501,127545,127589,127633,127677,127721,127764,127808,127852,127896,127940,127984,128028,128072,128115,128159,128203,128247,128291,128335,128378,128422,128466,128510,128554,128598,128641,128685,128729,128773,128816,128860,128904,128948,128992,129035,129079,129123,129167,129210,129254,129298,129341,129385,129429,129473,129516,129560,129604,129647,129691,129735,129778,129822,129866,129909,129953,129997,130040,130084,130128,130171,130215,130259,130302,130346,130389,130433,130477,130520,130564,130607,130651,130695,130738,130782,130825,130869,130912,130956,130999,131043,131087,131130,131174,131217,131261,131304,131348,131391,131435,131478,131522,131565,131609,131652,131695,131739,131782,131826,131869,131913,131956,132000,132043,132086,132130,132173,132217,132260,132303,132347,132390,132434,132477,132520,132564,132607,132650,132694,132737,132780,132824,132867,132910,132954,132997,133040,133084,133127,133170,133214,133257,133300,133343,133387,133430,133473,133517,133560,133603,133646,133690,133733,133776,133819,133862,133906,133949,133992,134035,134078,134122,134165,134208,134251,134294,134338,134381,134424,134467,134510,134553,134596,134640,134683,134726,134769,134812,134855,134898,134941,134984,135028,135071,135114,135157,135200,135243,135286,135329,135372,135415,135458,135501,135544,135587,135630,135673,135716,135759,135802,135845,135888,135931,135974,136017,136060,136103,136146,136189,136232,136275,136318,136361,136404,136447,136490,136532,136575,136618,136661,136704,136747,136790,136833,136876,136918,136961,137004,137047,137090,137133,137176,137218,137261,137304,137347,137390,137432,137475,137518,137561,137604,137646,137689,137732,137775,137817,137860,137903,137946,137988,138031,138074,138117,138159,138202,138245,138288,138330,138373,138416,138458,138501,138544,138586,138629,138672,138714,138757,138800,138842,138885,138927,138970,139013,139055,139098,139141,139183,139226,139268,139311,139353,139396,139439,139481,139524,139566,139609,139651,139694,139736,139779,139821,139864,139907,139949,139992,140034,140077,140119,140161,140204,140246,140289,140331,140374,140416,140459,140501,140544,140586,140628,140671,140713,140756,140798,140840,140883,140925,140968,141010,141052,141095,141137,141179,141222,141264,141306,141349,141391,141433,141476,141518,141560,141603,141645,141687,141730,141772,141814,141856,141899,141941,141983,142025,142068,142110,142152,142194,142237,142279,142321,142363,142405,142448,142490,142532,142574,142616,142659,142701,142743,142785,142827,142869,142912,142954,142996,143038,143080,143122,143164,143206,143248,143291,143333,143375,143417,143459,143501,143543,143585,143627,143669,143711,143753,143795,143837,143879,143921,143963,144005,144047,144089,144131,144173,144215,144257,144299,144341,144383,144425,144467,144509,144551,144593,144635,144677,144719,144761,144802,144844,144886,144928,144970,145012,145054,145096,145137,145179,145221,145263,145305,145347,145389,145430,145472,145514,145556,145598,145639,145681,145723,145765,145807,145848,145890,145932,145974,146015,146057,146099,146141,146182,146224,146266,146307,146349,146391,146433,146474,146516,146558,146599,146641,146683,146724,146766,146808,146849,146891,146932,146974,147016,147057,147099,147141,147182,147224,147265,147307,147348,147390,147432,147473,147515,147556,147598,147639,147681,147722,147764,147805,147847,147888,147930,147971,148013,148054,148096,148137,148179,148220,148262,148303,148345,148386,148428,148469,148510,148552,148593,148635,148676,148717,148759,148800,148842,148883,148924,148966,149007,149048,149090,149131,149172,149214,149255,149296,149338,149379,149420,149462,149503,149544,149585,149627,149668,149709,149751,149792,149833,149874,149916,149957,149998,150039,150080,150122,150163,150204,150245,150286,150328,150369,150410,150451,150492,150533,150575,150616,150657,150698,150739,150780,150821,150862,150904,150945,150986,151027,151068,151109,151150,151191,151232,151273,151314,151355,151396,151437,151478,151519,151560,151601,151642,151683,151724,151765,151806,151847,151888,151929,151970,152011,152052,152093,152134,152175,152216,152257,152298,152339,152380,152421,152461,152502,152543,152584,152625,152666,152707,152748,152788,152829,152870,152911,152952,152993,153033,153074,153115,153156,153197,153237,153278,153319,153360,153400,153441,153482,153523,153563,153604,153645,153686,153726,153767,153808,153848,153889,153930,153970,154011,154052,154093,154133,154174,154214,154255,154296,154336,154377,154418,154458,154499,154539,154580,154621,154661,154702,154742,154783,154824,154864,154905,154945,154986,155026,155067,155107,155148,155188,155229,155269,155310,155350,155391,155431,155472,155512,155553,155593,155634,155674,155715,155755,155795,155836,155876,155917,155957,155997,156038,156078,156119,156159,156199,156240,156280,156320,156361,156401,156441,156482,156522,156562,156603,156643,156683,156724,156764,156804,156845,156885,156925,156965,157006,157046,157086,157126,157167,157207,157247,157287,157327,157368,157408,157448,157488,157528,157569,157609,157649,157689,157729,157769,157809,157850,157890,157930,157970,158010,158050,158090,158130,158170,158211,158251,158291,158331,158371,158411,158451,158491,158531,158571,158611,158651,158691,158731,158771,158811,158851,158891,158931,158971,159011,159051,159091,159131,159171,159211,159251,159291,159330,159370,159410,159450,159490,159530,159570,159610,159650,159689,159729,159769,159809,159849,159889,159929,159968,160008,160048,160088,160128,160167,160207,160247,160287,160327,160366,160406,160446,160486,160525,160565,160605,160644,160684,160724,160764,160803,160843,160883,160922,160962,161002,161041,161081,161121,161160,161200,161240,161279,161319,161359,161398,161438,161477,161517,161557,161596,161636,161675,161715,161754,161794,161833,161873,161913,161952,161992,162031,162071,162110,162150,162189,162229,162268,162308,162347,162386,162426,162465,162505,162544,162584,162623,162663,162702,162741,162781,162820,162860,162899,162938,162978,163017,163056,163096,163135,163174,163214,163253,163292,163332,163371,163410,163450,163489,163528,163568,163607,163646,163685,163725,163764,163803,163842,163882,163921,163960,163999,164039,164078,164117,164156,164195,164234,164274,164313,164352,164391,164430,164469,164509,164548,164587,164626,164665,164704,164743,164782,164821,164861,164900,164939,164978,165017,165056,165095,165134,165173,165212,165251,165290,165329,165368,165407,165446,165485,165524,165563,165602,165641,165680,165719,165758,165797,165836,165875,165914,165952,165991,166030,166069,166108,166147,166186,166225,166264,166302,166341,166380,166419,166458,166497,166535,166574,166613,166652,166691,166729,166768,166807,166846,166885,166923,166962,167001,167040,167078,167117,167156,167194,167233,167272,167311,167349,167388,167427,167465,167504,167543,167581,167620,167659,167697,167736,167774,167813,167852,167890,167929,167968,168006,168045,168083,168122,168160,168199,168238,168276,168315,168353,168392,168430,168469,168507,168546,168584,168623,168661,168700,168738,168777,168815,168853,168892,168930,168969,169007,169046,169084,169122,169161,169199,169238,169276,169314,169353,169391,169430,169468,169506,169545,169583,169621,169660,169698,169736,169774,169813,169851,169889,169928,169966,170004,170042,170081,170119,170157,170195,170234,170272,170310,170348,170386,170425,170463,170501,170539,170577,170616,170654,170692,170730,170768,170806,170844,170883,170921,170959,170997,171035,171073,171111,171149,171187,171225,171263,171301,171339,171378,171416,171454,171492,171530,171568,171606,171644,171682,171720,171758,171796,171834,171871,171909,171947,171985,172023,172061,172099,172137,172175,172213,172251,172289,172326,172364,172402,172440,172478,172516,172554,172591,172629,172667,172705,172743,172781,172818,172856,172894,172932,172969,173007,173045,173083,173121,173158,173196,173234,173271,173309,173347,173385,173422,173460,173498,173535,173573,173611,173648,173686,173724,173761,173799,173837,173874,173912,173949,173987,174025,174062,174100,174137,174175,174212,174250,174288,174325,174363,174400,174438,174475,174513,174550,174588,174625,174663,174700,174738,174775,174813,174850,174887,174925,174962,175000,175037,175075,175112,175149,175187,175224,175262,175299,175336,175374,175411,175448,175486,175523,175560,175598,175635,175672,175710,175747,175784,175822,175859,175896,175933,175971,176008,176045,176082,176120,176157,176194,176231,176268,176306,176343,176380,176417,176454,176492,176529,176566,176603,176640,176677,176714,176752,176789,176826,176863,176900,176937,176974,177011,177048,177085,177123,177160,177197,177234,177271,177308,177345,177382,177419,177456,177493,177530,177567,177604,177641,177678,177715,177752,177788,177825,177862,177899,177936,177973,178010,178047,178084,178121,178158,178194,178231,178268,178305,178342,178379,178415,178452,178489,178526,178563,178600,178636,178673,178710,178747,178783,178820,178857,178894,178930,178967,179004,179041,179077,179114,179151,179187,179224,179261,179297,179334,179371,179407,179444,179481,179517,179554,179591,179627,179664,179700,179737,179774,179810,179847,179883,179920,179956,179993,180029,180066,180103,180139,180176,180212,180249,180285,180322,180358,180395,180431,180467,180504,180540,180577,180613,180650,180686,180723,180759,180795,180832,180868,180904,180941,180977,181014,181050,181086,181123,181159,181195,181232,181268,181304,181341,181377,181413,181449,181486,181522,181558,181594,181631,181667,181703,181739,181776,181812,181848,181884,181920,181957,181993,182029,182065,182101,182137,182174,182210,182246,182282,182318,182354,182390,182426,182463,182499,182535,182571,182607,182643,182679,182715,182751,182787,182823,182859,182895,182931,182967,183003,183039,183075,183111,183147,183183,183219,183255,183291,183327,183363,183399,183435,183470,183506,183542,183578,183614,183650,183686,183722,183757,183793,183829,183865,183901,183937,183972,184008,184044,184080,184116,184151,184187,184223,184259,184294,184330,184366,184402,184437,184473,184509,184545,184580,184616,184652,184687,184723,184759,184794,184830,184866,184901,184937,184972,185008,185044,185079,185115,185150,185186,185222,185257,185293,185328,185364,185399,185435,185470,185506,185541,185577,185612,185648,185683,185719,185754,185790,185825,185861,185896,185932,185967,186002,186038,186073,186109,186144,186179,186215,186250,186286,186321,186356,186392,186427,186462,186498,186533,186568,186604,186639,186674,186710,186745,186780,186815,186851,186886,186921,186956,186992,187027,187062,187097,187132,187168,187203,187238,187273,187308,187343,187379,187414,187449,187484,187519,187554,187589,187625,187660,187695,187730,187765,187800,187835,187870,187905,187940,187975,188010,188045,188080,188115,188150,188185,188220,188255,188290,188325,188360,188395,188430,188465,188500,188535,188570,188605,188640,188675,188709,188744,188779,188814,188849,188884,188919,188954,188988,189023,189058,189093,189128,189162,189197,189232,189267,189302,189336,189371,189406,189441,189475,189510,189545,189580,189614,189649,189684,189718,189753,189788,189822,189857,189892,189926,189961,189996,190030,190065,190099,190134,190169,190203,190238,190272,190307,190342,190376,190411,190445,190480,190514,190549,190583,190618,190652,190687,190721,190756,190790,190825,190859,190894,190928,190963,190997,191031,191066,191100,191135,191169,191203,191238,191272,191307,191341,191375,191410,191444,191478,191513,191547,191581,191616,191650,191684,191718,191753,191787,191821,191856,191890,191924,191958,191992,192027,192061,192095,192129,192164,192198,192232,192266,192300,192334,192369,192403,192437,192471,192505,192539,192573,192607,192641,192676,192710,192744,192778,192812,192846,192880,192914,192948,192982,193016,193050,193084,193118,193152,193186,193220,193254,193288,193322,193356,193390,193424,193458,193492,193525,193559,193593,193627,193661,193695,193729,193763,193796,193830,193864,193898,193932,193966,193999,194033,194067,194101,194135,194168,194202,194236,194270,194303,194337,194371,194405,194438,194472,194506,194539,194573,194607,194640,194674,194708,194741,194775,194809,194842,194876,194910,194943,194977,195010,195044,195078,195111,195145,195178,195212,195245,195279,195312,195346,195379,195413,195446,195480,195513,195547,195580,195614,195647,195681,195714,195748,195781,195815,195848,195881,195915,195948,195982,196015,196048,196082,196115,196148,196182,196215,196248,196282,196315,196348,196382,196415,196448,196481,196515,196548,196581,196615,196648,196681,196714,196747,196781,196814,196847,196880,196913,196947,196980,197013,197046,197079,197112,197146,197179,197212,197245,197278,197311,197344,197377,197410,197443,197476,197510,197543,197576,197609,197642,197675,197708,197741,197774,197807,197840,197873,197906,197939,197972,198004,198037,198070,198103,198136,198169,198202,198235,198268,198301,198334,198366,198399,198432,198465,198498,198531,198563,198596,198629,198662,198695,198727,198760,198793,198826,198858,198891,198924,198957,198989,199022,199055,199088,199120,199153,199186,199218,199251,199284,199316,199349,199382,199414,199447,199479,199512,199545,199577,199610,199642,199675,199708,199740,199773,199805,199838,199870,199903,199935,199968,200000,200033,200065,200098,200130,200163,200195,200228,200260,200292,200325,200357,200390,200422,200454,200487,200519,200552,200584,200616,200649,200681,200713,200746,200778,200810,200843,200875,200907,200940,200972,201004,201036,201069,201101,201133,201165,201198,201230,201262,201294,201326,201359,201391,201423,201455,201487,201519,201552,201584,201616,201648,201680,201712,201744,201776,201808,201841,201873,201905,201937,201969,202001,202033,202065,202097,202129,202161,202193,202225,202257,202289,202321,202353,202385,202417,202449,202481,202512,202544,202576,202608,202640,202672,202704,202736,202768,202799,202831,202863,202895,202927,202959,202990,203022,203054,203086,203118,203149,203181,203213,203245,203276,203308,203340,203372,203403,203435,203467,203498,203530,203562,203593,203625,203657,203688,203720,203752,203783,203815,203846,203878,203910,203941,203973,204004,204036,204067,204099,204131,204162,204194,204225,204257,204288,204320,204351,204383,204414,204446,204477,204508,204540,204571,204603,204634,204666,204697,204728,204760,204791,204823,204854,204885,204917,204948,204979,205011,205042,205073,205105,205136,205167,205198,205230,205261,205292,205324,205355,205386,205417,205448,205480,205511,205542,205573,205604,205636,205667,205698,205729,205760,205791,205823,205854,205885,205916,205947,205978,206009,206040,206071,206102,206133,206165,206196,206227,206258,206289,206320,206351,206382,206413,206444,206475,206506,206537,206567,206598,206629,206660,206691,206722,206753,206784,206815,206846,206877,206907,206938,206969,207000,207031,207062,207092,207123,207154,207185,207216,207246,207277,207308,207339,207370,207400,207431,207462,207492,207523,207554,207585,207615,207646,207677,207707,207738,207769,207799,207830,207861,207891,207922,207952,207983,208014,208044,208075,208105,208136,208166,208197,208228,208258,208289,208319,208350,208380,208411,208441,208472,208502,208533,208563,208593,208624,208654,208685,208715,208746,208776,208806,208837,208867,208897,208928,208958,208989,209019,209049,209080,209110,209140,209170,209201,209231,209261,209292,209322,209352,209382,209413,209443,209473,209503,209534,209564,209594,209624,209654,209684,209715,209745,209775,209805,209835,209865,209895,209926,209956,209986,210016,210046,210076,210106,210136,210166,210196,210226,210256,210286,210316,210346,210376,210406,210436,210466,210496,210526,210556,210586,210616,210646,210676,210706,210736,210765,210795,210825,210855,210885,210915,210945,210974,211004,211034,211064,211094,211124,211153,211183,211213,211243,211272,211302,211332,211362,211391,211421,211451,211481,211510,211540,211570,211599,211629,211659,211688,211718,211748,211777,211807,211836,211866,211896,211925,211955,211984,212014,212043,212073,212103,212132,212162,212191,212221,212250,212280,212309,212339,212368,212398,212427,212456,212486,212515,212545,212574,212604,212633,212662,212692,212721,212751,212780,212809,212839,212868,212897,212927,212956,212985,213015,213044,213073,213102,213132,213161,213190,213219,213249,213278,213307,213336,213366,213395,213424,213453,213482,213511,213541,213570,213599,213628,213657,213686,213715,213745,213774,213803,213832,213861,213890,213919,213948,213977,214006,214035,214064,214093,214122,214151,214180,214209,214238,214267,214296,214325,214354,214383,214412,214441,214470,214498,214527,214556,214585,214614,214643,214672,214701,214729,214758,214787,214816,214845,214873,214902,214931,214960,214989,215017,215046,215075,215104,215132,215161,215190,215218,215247,215276,215304,215333,215362,215390,215419,215448,215476,215505,215534,215562,215591,215619,215648,215677,215705,215734,215762,215791,215819,215848,215876,215905,215933,215962,215990,216019,216047,216076,216104,216133,216161,216190,216218,216246,216275,216303,216332,216360,216388,216417,216445,216473,216502,216530,216558,216587,216615,216643,216672,216700,216728,216757,216785,216813,216841,216870,216898,216926,216954,216982,217011,217039,217067,217095,217123,217152,217180,217208,217236,217264,217292,217320,217348,217377,217405,217433,217461,217489,217517,217545,217573,217601,217629,217657,217685,217713,217741,217769,217797,217825,217853,217881,217909,217937,217965,217993,218021,218049,218076,218104,218132,218160,218188,218216,218244,218271,218299,218327,218355,218383,218411,218438,218466,218494,218522,218549,218577,218605,218633,218660,218688,218716,218744,218771,218799,218827,218854,218882,218910,218937,218965,218993,219020,219048,219075,219103,219131,219158,219186,219213,219241,219268,219296,219324,219351,219379,219406,219434,219461,219489,219516,219544,219571,219598,219626,219653,219681,219708,219736,219763,219790,219818,219845,219873,219900,219927,219955,219982,220009,220037,220064,220091,220119,220146,220173,220200,220228,220255,220282,220309,220337,220364,220391,220418,220446,220473,220500,220527,220554,220581,220609,220636,220663,220690,220717,220744,220771,220798,220826,220853,220880,220907,220934,220961,220988,221015,221042,221069,221096,221123,221150,221177,221204,221231,221258,221285,221312,221339,221366,221393,221419,221446,221473,221500,221527,221554,221581,221608,221634,221661,221688,221715,221742,221769,221795,221822,221849,221876,221903,221929,221956,221983,222010,222036,222063,222090,222116,222143,222170,222196,222223,222250,222276,222303,222330,222356,222383,222410,222436,222463,222489,222516,222542,222569,222596,222622,222649,222675,222702,222728,222755,222781,222808,222834,222861,222887,222914,222940,222966,222993,223019,223046,223072,223099,223125,223151,223178,223204,223230,223257,223283,223309,223336,223362,223388,223415,223441,223467,223493,223520,223546,223572,223599,223625,223651,223677,223703,223730,223756,223782,223808,223834,223860,223887,223913,223939,223965,223991,224017,224043,224069,224096,224122,224148,224174,224200,224226,224252,224278,224304,224330,224356,224382,224408,224434,224460,224486,224512,224538,224564,224590,224615,224641,224667,224693,224719,224745,224771,224797,224823,224848,224874,224900,224926,224952,224978,225003,225029,225055,225081,225106,225132,225158,225184,225209,225235,225261,225287,225312,225338,225364,225389,225415,225441,225466,225492,225517,225543,225569,225594,225620,225646,225671,225697,225722,225748,225773,225799,225824,225850,225875,225901,225926,225952,225977,226003,226028,226054,226079,226105,226130,226156,226181,226206,226232,226257,226283,226308,226333,226359,226384,226409,226435,226460,226485,226511,226536,226561,226586,226612,226637,226662,226688,226713,226738,226763,226788,226814,226839,226864,226889,226914,226940,226965,226990,227015,227040,227065,227090,227115,227141,227166,227191,227216,227241,227266,227291,227316,227341,227366,227391,227416,227441,227466,227491,227516,227541,227566,227591,227616,227641,227666,227691,227716,227740,227765,227790,227815,227840,227865,227890,227914,227939,227964,227989,228014,228039,228063,228088,228113,228138,228162,228187,228212,228237,228261,228286,228311,228335,228360,228385,228409,228434,228459,228483,228508,228533,228557,228582,228607,228631,228656,228680,228705,228729,228754,228779,228803,228828,228852,228877,228901,228926,228950,228975,228999,229024,229048,229072,229097,229121,229146,229170,229194,229219,229243,229268,229292,229316,229341,229365,229389,229414,229438,229462,229487,229511,229535,229560,229584,229608,229632,229657,229681,229705,229729,229753,229778,229802,229826,229850,229874,229898,229923,229947,229971,229995,230019,230043,230067,230091,230116,230140,230164,230188,230212,230236,230260,230284,230308,230332,230356,230380,230404,230428,230452,230476,230500,230524,230548,230571,230595,230619,230643,230667,230691,230715,230739,230762,230786,230810,230834,230858,230882,230905,230929,230953,230977,231001,231024,231048,231072,231096,231119,231143,231167,231190,231214,231238,231261,231285,231309,231332,231356,231380,231403,231427,231450,231474,231498,231521,231545,231568,231592,231615,231639,231663,231686,231710,231733,231757,231780,231804,231827,231850,231874,231897,231921,231944,231968,231991,232014,232038,232061,232085,232108,232131,232155,232178,232201,232225,232248,232271,232295,232318,232341,232364,232388,232411,232434,232457,232481,232504,232527,232550,232574,232597,232620,232643,232666,232689,232713,232736,232759,232782,232805,232828,232851,232874,232897,232920,232944,232967,232990,233013,233036,233059,233082,233105,233128,233151,233174,233197,233220,233243,233265,233288,233311,233334,233357,233380,233403,233426,233449,233472,233494,233517,233540,233563,233586,233609,233631,233654,233677,233700,233722,233745,233768,233791,233813,233836,233859,233882,233904,233927,233950,233972,233995,234018,234040,234063,234086,234108,234131,234153,234176,234199,234221,234244,234266,234289,234311,234334,234356,234379,234401,234424,234446,234469,234491,234514,234536,234559,234581,234604,234626,234649,234671,234693,234716,234738,234760,234783,234805,234828,234850,234872,234894,234917,234939,234961,234984,235006,235028,235050,235073,235095,235117,235139,235162,235184,235206,235228,235250,235273,235295,235317,235339,235361,235383,235405,235428,235450,235472,235494,235516,235538,235560,235582,235604,235626,235648,235670,235692,235714,235736,235758,235780,235802,235824,235846,235868,235890,235912,235934,235956,235978,235999,236021,236043,236065,236087,236109,236131,236152,236174,236196,236218,236240,236261,236283,236305,236327,236348,236370,236392,236414,236435,236457,236479,236500,236522,236544,236565,236587,236609,236630,236652,236674,236695,236717,236738,236760,236782,236803,236825,236846,236868,236889,236911,236932,236954,236975,236997,237018,237040,237061,237083,237104,237126,237147,237168,237190,237211,237233,237254,237275,237297,237318,237339,237361,237382,237403,237425,237446,237467,237489,237510,237531,237552,237574,237595,237616,237637,237659,237680,237701,237722,237743,237765,237786,237807,237828,237849,237870,237891,237913,237934,237955,237976,237997,238018,238039,238060,238081,238102,238123,238144,238165,238186,238207,238228,238249,238270,238291,238312,238333,238354,238375,238396,238417,238437,238458,238479,238500,238521,238542,238563,238583,238604,238625,238646,238667,238688,238708,238729,238750,238771,238791,238812,238833,238853,238874,238895,238916,238936,238957,238978,238998,239019,239040,239060,239081,239101,239122,239143,239163,239184,239204,239225,239245,239266,239287,239307,239328,239348,239369,239389,239410,239430,239450,239471,239491,239512,239532,239553,239573,239593,239614,239634,239655,239675,239695,239716,239736,239756,239777,239797,239817,239838,239858,239878,239898,239919,239939,239959,239979,240000,240020,240040,240060,240080,240101,240121,240141,240161,240181,240201,240221,240242,240262,240282,240302,240322,240342,240362,240382,240402,240422,240442,240462,240482,240502,240522,240542,240562,240582,240602,240622,240642,240662,240682,240702,240722,240742,240762,240781,240801,240821,240841,240861,240881,240901,240920,240940,240960,240980,241000,241019,241039,241059,241079,241098,241118,241138,241157,241177,241197,241217,241236,241256,241276,241295,241315,241334,241354,241374,241393,241413,241433,241452,241472,241491,241511,241530,241550,241569,241589,241608,241628,241647,241667,241686,241706,241725,241745,241764,241784,241803,241822,241842,241861,241881,241900,241919,241939,241958,241977,241997,242016,242035,242055,242074,242093,242112,242132,242151,242170,242189,242209,242228,242247,242266,242286,242305,242324,242343,242362,242381,242401,242420,242439,242458,242477,242496,242515,242534,242553,242572,242591,242611,242630,242649,242668,242687,242706,242725,242744,242763,242782,242800,242819,242838,242857,242876,242895,242914,242933,242952,242971,242990,243008,243027,243046,243065,243084,243103,243121,243140,243159,243178,243196,243215,243234,243253,243271,243290,243309,243328,243346,243365,243384,243402,243421,243440,243458,243477,243496,243514,243533,243551,243570,243588,243607,243626,243644,243663,243681,243700,243718,243737,243755,243774,243792,243811,243829,243848,243866,243885,243903,243921,243940,243958,243977,243995,244013,244032,244050,244068,244087,244105,244123,244142,244160,244178,244197,244215,244233,244251,244270,244288,244306,244324,244343,244361,244379,244397,244415,244433,244452,244470,244488,244506,244524,244542,244560,244578,244597,244615,244633,244651,244669,244687,244705,244723,244741,244759,244777,244795,244813,244831,244849,244867,244885,244903,244921,244938,244956,244974,244992,245010,245028,245046,245064,245081,245099,245117,245135,245153,245171,245188,245206,245224,245242,245259,245277,245295,245313,245330,245348,245366,245383,245401,245419,245436,245454,245472,245489,245507,245525,245542,245560,245577,245595,245613,245630,245648,245665,245683,245700,245718,245735,245753,245770,245788,245805,245823,245840,245858,245875,245892,245910,245927,245945,245962,245979,245997,246014,246032,246049,246066,246084,246101,246118,246136,246153,246170,246187,246205,246222,246239,246256,246274,246291,246308,246325,246342,246360,246377,246394,246411,246428,246445,246463,246480,246497,246514,246531,246548,246565,246582,246599,246616,246633,246650,246667,246684,246701,246718,246735,246752,246769,246786,246803,246820,246837,246854,246871,246888,246905,246922,246938,246955,246972,246989,247006,247023,247040,247056,247073,247090,247107,247123,247140,247157,247174,247190,247207,247224,247241,247257,247274,247291,247307,247324,247341,247357,247374,247391,247407,247424,247440,247457,247474,247490,247507,247523,247540,247556,247573,247589,247606,247622,247639,247655,247672,247688,247705,247721,247738,247754,247771,247787,247803,247820,247836,247853,247869,247885,247902,247918,247934,247951,247967,247983,248000,248016,248032,248048,248065,248081,248097,248113,248130,248146,248162,248178,248194,248211,248227,248243,248259,248275,248291,248307,248323,248340,248356,248372,248388,248404,248420,248436,248452,248468,248484,248500,248516,248532,248548,248564,248580,248596,248612,248628,248644,248660,248676,248691,248707,248723,248739,248755,248771,248787,248803,248818,248834,248850,248866,248882,248897,248913,248929,248945,248960,248976,248992,249008,249023,249039,249055,249070,249086,249102,249117,249133,249149,249164,249180,249195,249211,249227,249242,249258,249273,249289,249304,249320,249335,249351,249367,249382,249398,249413,249428,249444,249459,249475,249490,249506,249521,249536,249552,249567,249583,249598,249613,249629,249644,249659,249675,249690,249705,249721,249736,249751,249766,249782,249797,249812,249827,249843,249858,249873,249888,249903,249919,249934,249949,249964,249979,249994,250009,250025,250040,250055,250070,250085,250100,250115,250130,250145,250160,250175,250190,250205,250220,250235,250250,250265,250280,250295,250310,250325,250340,250355,250370,250385,250399,250414,250429,250444,250459,250474,250489,250503,250518,250533,250548,250562,250577,250592,250607,250622,250636,250651,250666,250680,250695,250710,250724,250739,250754,250768,250783,250798,250812,250827,250842,250856,250871,250885,250900,250914,250929,250944,250958,250973,250987,251002,251016,251031,251045,251060,251074,251088,251103,251117,251132,251146,251161,251175,251189,251204,251218,251232,251247,251261,251275,251290,251304,251318,251333,251347,251361,251375,251390,251404,251418,251432,251447,251461,251475,251489,251503,251518,251532,251546,251560,251574,251588,251602,251617,251631,251645,251659,251673,251687,251701,251715,251729,251743,251757,251771,251785,251799,251813,251827,251841,251855,251869,251883,251897,251911,251925,251938,251952,251966,251980,251994,252008,252022,252035,252049,252063,252077,252091,252104,252118,252132,252146,252159,252173,252187,252201,252214,252228,252242,252255,252269,252283,252296,252310,252324,252337,252351,252365,252378,252392,252405,252419,252432,252446,252460,252473,252487,252500,252514,252527,252541,252554,252568,252581,252594,252608,252621,252635,252648,252662,252675,252688,252702,252715,252728,252742,252755,252768,252782,252795,252808,252822,252835,252848,252861,252875,252888,252901,252914,252928,252941,252954,252967,252980,252994,253007,253020,253033,253046,253059,253072,253085,253099,253112,253125,253138,253151,253164,253177,253190,253203,253216,253229,253242,253255,253268,253281,253294,253307,253320,253333,253346,253359,253371,253384,253397,253410,253423,253436,253449,253461,253474,253487,253500,253513,253525,253538,253551,253564,253577,253589,253602,253615,253627,253640,253653,253666,253678,253691,253704,253716,253729,253741,253754,253767,253779,253792,253804,253817,253830,253842,253855,253867,253880,253892,253905,253917,253930,253942,253955,253967,253980,253992,254004,254017,254029,254042,254054,254067,254079,254091,254104,254116,254128,254141,254153,254165,254178,254190,254202,254214,254227,254239,254251,254263,254276,254288,254300,254312,254324,254337,254349,254361,254373,254385,254397,254410,254422,254434,254446,254458,254470,254482,254494,254506,254518,254530,254542,254554,254566,254578,254590,254602,254614,254626,254638,254650,254662,254674,254686,254698,254710,254721,254733,254745,254757,254769,254781,254793,254804,254816,254828,254840,254852,254863,254875,254887,254899,254910,254922,254934,254945,254957,254969,254981,254992,255004,255015,255027,255039,255050,255062,255074,255085,255097,255108,255120,255131,255143,255155,255166,255178,255189,255201,255212,255224,255235,255246,255258,255269,255281,255292,255304,255315,255326,255338,255349,255361,255372,255383,255395,255406,255417,255429,255440,255451,255462,255474,255485,255496,255507,255519,255530,255541,255552,255564,255575,255586,255597,255608,255619,255630,255642,255653,255664,255675,255686,255697,255708,255719,255730,255741,255752,255763,255774,255785,255796,255807,255818,255829,255840,255851,255862,255873,255884,255895,255906,255917,255928,255939,255949,255960,255971,255982,255993,256004,256014,256025,256036,256047,256058,256068,256079,256090,256101,256111,256122,256133,256143,256154,256165,256176,256186,256197,256207,256218,256229,256239,256250,256261,256271,256282,256292,256303,256313,256324,256334,256345,256355,256366,256376,256387,256397,256408,256418,256429,256439,256450,256460,256470,256481,256491,256502,256512,256522,256533,256543,256553,256564,256574,256584,256595,256605,256615,256625,256636,256646,256656,256666,256677,256687,256697,256707,256717,256728,256738,256748,256758,256768,256778,256788,256798,256809,256819,256829,256839,256849,256859,256869,256879,256889,256899,256909,256919,256929,256939,256949,256959,256969,256979,256989,256999,257008,257018,257028,257038,257048,257058,257068,257078,257087,257097,257107,257117,257127,257136,257146,257156,257166,257175,257185,257195,257205,257214,257224,257234,257243,257253,257263,257272,257282,257292,257301,257311,257320,257330,257340,257349,257359,257368,257378,257387,257397,257406,257416,257425,257435,257444,257454,257463,257473,257482,257492,257501,257510,257520,257529,257539,257548,257557,257567,257576,257585,257595,257604,257613,257623,257632,257641,257651,257660,257669,257678,257688,257697,257706,257715,257724,257734,257743,257752,257761,257770,257779,257789,257798,257807,257816,257825,257834,257843,257852,257861,257870,257879,257888,257897,257906,257915,257924,257933,257942,257951,257960,257969,257978,257987,257996,258005,258014,258023,258031,258040,258049,258058,258067,258076,258084,258093,258102,258111,258120,258128,258137,258146,258155,258163,258172,258181,258190,258198,258207,258216,258224,258233,258242,258250,258259,258267,258276,258285,258293,258302,258310,258319,258327,258336,258345,258353,258362,258370,258379,258387,258396,258404,258412,258421,258429,258438,258446,258455,258463,258471,258480,258488,258496,258505,258513,258522,258530,258538,258546,258555,258563,258571,258580,258588,258596,258604,258613,258621,258629,258637,258645,258654,258662,258670,258678,258686,258694,258702,258711,258719,258727,258735,258743,258751,258759,258767,258775,258783,258791,258799,258807,258815,258823,258831,258839,258847,258855,258863,258871,258879,258887,258895,258902,258910,258918,258926,258934,258942,258950,258957,258965,258973,258981,258989,258996,259004,259012,259020,259027,259035,259043,259050,259058,259066,259073,259081,259089,259096,259104,259112,259119,259127,259135,259142,259150,259157,259165,259172,259180,259187,259195,259202,259210,259217,259225,259232,259240,259247,259255,259262,259270,259277,259285,259292,259299,259307,259314,259321,259329,259336,259343,259351,259358,259365,259373,259380,259387,259395,259402,259409,259416,259423,259431,259438,259445,259452,259459,259467,259474,259481,259488,259495,259502,259509,259517,259524,259531,259538,259545,259552,259559,259566,259573,259580,259587,259594,259601,259608,259615,259622,259629,259636,259643,259650,259657,259664,259670,259677,259684,259691,259698,259705,259712,259718,259725,259732,259739,259746,259752,259759,259766,259773,259779,259786,259793,259800,259806,259813,259820,259826,259833,259840,259846,259853,259860,259866,259873,259879,259886,259893,259899,259906,259912,259919,259925,259932,259938,259945,259951,259958,259964,259971,259977,259984,259990,259997,260003,260009,260016,260022,260029,260035,260041,260048,260054,260060,260067,260073,260079,260085,260092,260098,260104,260111,260117,260123,260129,260135,260142,260148,260154,260160,260166,260173,260179,260185,260191,260197,260203,260209,260215,260221,260228,260234,260240,260246,260252,260258,260264,260270,260276,260282,260288,260294,260300,260306,260312,260317,260323,260329,260335,260341,260347,260353,260359,260365,260370,260376,260382,260388,260394,260399,260405,260411,260417,260423,260428,260434,260440,260445,260451,260457,260463,260468,260474,260480,260485,260491,260496,260502,260508,260513,260519,260525,260530,260536,260541,260547,260552,260558,260563,260569,260574,260580,260585,260591,260596,260602,260607,260613,260618,260623,260629,260634,260640,260645,260650,260656,260661,260666,260672,260677,260682,260688,260693,260698,260703,260709,260714,260719,260724,260730,260735,260740,260745,260750,260756,260761,260766,260771,260776,260781,260786,260791,260797,260802,260807,260812,260817,260822,260827,260832,260837,260842,260847,260852,260857,260862,260867,260872,260877,260882,260887,260892,260896,260901,260906,260911,260916,260921,260926,260930,260935,260940,260945,260950,260955,260959,260964,260969,260974,260978,260983,260988,260992,260997,261002,261007,261011,261016,261021,261025,261030,261034,261039,261044,261048,261053,261057,261062,261067,261071,261076,261080,261085,261089,261094,261098,261103,261107,261112,261116,261120,261125,261129,261134,261138,261143,261147,261151,261156,261160,261164,261169,261173,261177,261182,261186,261190,261195,261199,261203,261207,261212,261216,261220,261224,261228,261233,261237,261241,261245,261249,261253,261258,261262,261266,261270,261274,261278,261282,261286,261290,261294,261298,261302,261306,261310,261314,261318,261322,261326,261330,261334,261338,261342,261346,261350,261354,261358,261362,261366,261369,261373,261377,261381,261385,261389,261392,261396,261400,261404,261408,261411,261415,261419,261423,261426,261430,261434,261437,261441,261445,261448,261452,261456,261459,261463,261467,261470,261474,261477,261481,261485,261488,261492,261495,261499,261502,261506,261509,261513,261516,261520,261523,261527,261530,261533,261537,261540,261544,261547,261551,261554,261557,261561,261564,261567,261571,261574,261577,261581,261584,261587,261590,261594,261597,261600,261603,261607,261610,261613,261616,261619,261623,261626,261629,261632,261635,261638,261641,261644,261648,261651,261654,261657,261660,261663,261666,261669,261672,261675,261678,261681,261684,261687,261690,261693,261696,261699,261702,261705,261708,261710,261713,261716,261719,261722,261725,261728,261730,261733,261736,261739,261742,261744,261747,261750,261753,261755,261758,261761,261764,261766,261769,261772,261774,261777,261780,261782,261785,261788,261790,261793,261795,261798,261801,261803,261806,261808,261811,261813,261816,261818,261821,261823,261826,261828,261831,261833,261836,261838,261840,261843,261845,261848,261850,261852,261855,261857,261859,261862,261864,261866,261869,261871,261873,261876,261878,261880,261882,261885,261887,261889,261891,261894,261896,261898,261900,261902,261904,261907,261909,261911,261913,261915,261917,261919,261921,261923,261925,261927,261929,261932,261934,261936,261938,261940,261942,261943,261945,261947,261949,261951,261953,261955,261957,261959,261961,261963,261965,261966,261968,261970,261972,261974,261975,261977,261979,261981,261983,261984,261986,261988,261990,261991,261993,261995,261996,261998,262000,262001,262003,262005,262006,262008,262010,262011,262013,262014,262016,262018,262019,262021,262022,262024,262025,262027,262028,262030,262031,262033,262034,262036,262037,262038,262040,262041,262043,262044,262045,262047,262048,262050,262051,262052,262054,262055,262056,262057,262059,262060,262061,262063,262064,262065,262066,262067,262069,262070,262071,262072,262073,262075,262076,262077,262078,262079,262080,262081,262082,262084,262085,262086,262087,262088,262089,262090,262091,262092,262093,262094,262095,262096,262097,262098,262099,262100,262101,262101,262102,262103,262104,262105,262106,262107,262108,262108,262109,262110,262111,262112,262112,262113,262114,262115,262115,262116,262117,262118,262118,262119,262120,262120,262121,262122,262122,262123,262124,262124,262125,262125,262126,262127,262127,262128,262128,262129,262129,262130,262130,262131,262131,262132,262132,262133,262133,262134,262134,262135,262135,262135,262136,262136,262137,262137,262137,262138,262138,262138,262139,262139,262139,262140,262140,262140,262140,262141,262141,262141,262141,262142,262142,262142,262142,262142,262143,262143,262143,262143,262143,262143,262143,262144,262144,262144,262144,262144,262144,262144,262144,262144,262144,262144,0}; diff --git a/apps/plugins/pdbox/PDa/intern/cos_table.h b/apps/plugins/pdbox/PDa/intern/cos_table.h index e8be7f5c8c..fc7aff9115 100644 --- a/apps/plugins/pdbox/PDa/intern/cos_table.h +++ b/apps/plugins/pdbox/PDa/intern/cos_table.h @@ -1,3 +1,7 @@ #define ILOGCOSTABSIZE 15 #define ICOSTABSIZE (1<s_vec, sp[1]->s_vec, sp[0]->s_n); } diff --git a/apps/plugins/pdbox/PDa/intern/dbtopow~.c b/apps/plugins/pdbox/PDa/intern/dbtopow~.c index ad4a826f9e..de25b95c5c 100644 --- a/apps/plugins/pdbox/PDa/intern/dbtopow~.c +++ b/apps/plugins/pdbox/PDa/intern/dbtopow~.c @@ -1,3 +1,8 @@ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#endif + #include #include @@ -39,6 +44,9 @@ static t_int *dbtopow_tilde_perform(t_int *w) static void dbtopow_tilde_dsp(t_dbtopow_tilde *x, t_signal **sp) { +#ifdef ROCKBOX + (void) x; +#endif post("warning: %s not usable yet",__FUNCTION__); dsp_add(dbtopow_tilde_perform, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); } diff --git a/apps/plugins/pdbox/PDa/intern/dbtorms~.c b/apps/plugins/pdbox/PDa/intern/dbtorms~.c index 703d0883b9..1473ca8170 100644 --- a/apps/plugins/pdbox/PDa/intern/dbtorms~.c +++ b/apps/plugins/pdbox/PDa/intern/dbtorms~.c @@ -1,3 +1,8 @@ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#endif + #include #include @@ -40,6 +45,9 @@ static t_int *dbtorms_tilde_perform(t_int *w) static void dbtorms_tilde_dsp(t_dbtorms_tilde *x, t_signal **sp) { +#ifdef ROCKBOX + (void) x; +#endif post("warning: %s not usable yet",__FUNCTION__); dsp_add(dbtorms_tilde_perform, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); } diff --git a/apps/plugins/pdbox/PDa/intern/delread~.c b/apps/plugins/pdbox/PDa/intern/delread~.c index ed7d2f2d80..d7db986fea 100644 --- a/apps/plugins/pdbox/PDa/intern/delread~.c +++ b/apps/plugins/pdbox/PDa/intern/delread~.c @@ -1,11 +1,19 @@ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#endif + #include #include -#include "delay.h" extern int ugen_getsortno(void); +#include "delay.h" + #define DEFDELVS 64 /* LATER get this from canvas at DSP time */ +#ifndef ROCKBOX static int delread_zero = 0; /* four bytes of zero for delread~, vd~ */ +#endif static t_class *sigdelread_class; @@ -36,13 +44,17 @@ static void *sigdelread_new(t_symbol *s, t_floatarg f) static void sigdelread_float(t_sigdelread *x, t_float f) { +#ifndef ROCKBOX int samps; +#endif t_sigdelwrite *delwriter = (t_sigdelwrite *)pd_findbyclass(x->x_sym, sigdelwrite_class); x->x_deltime = f; if (delwriter) { +#ifndef ROCKBOX int delsize = delwriter->x_cspace.c_n; +#endif x->x_delsamps = (int)(0.5 + x->x_sr * x->x_deltime) + x->x_n - x->x_zerodel; if (x->x_delsamps < x->x_n) x->x_delsamps = x->x_n; diff --git a/apps/plugins/pdbox/PDa/intern/delwrite~.c b/apps/plugins/pdbox/PDa/intern/delwrite~.c index 825ff2396a..74ddb45611 100644 --- a/apps/plugins/pdbox/PDa/intern/delwrite~.c +++ b/apps/plugins/pdbox/PDa/intern/delwrite~.c @@ -4,7 +4,9 @@ extern int ugen_getsortno(void); #define DEFDELVS 64 /* LATER get this from canvas at DSP time */ +#ifndef ROCKBOX static int delread_zero = 0; /* four bytes of zero for delread~, vd~ */ +#endif #include "delay.h" diff --git a/apps/plugins/pdbox/PDa/intern/env~.c b/apps/plugins/pdbox/PDa/intern/env~.c index 8f42658461..c46a3f8f6f 100644 --- a/apps/plugins/pdbox/PDa/intern/env~.c +++ b/apps/plugins/pdbox/PDa/intern/env~.c @@ -1,5 +1,9 @@ - +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#else /* ROCKBOX */ #define FIXEDPOINT +#endif /* ROCKBOX */ #include #include diff --git a/apps/plugins/pdbox/PDa/intern/ftom~.c b/apps/plugins/pdbox/PDa/intern/ftom~.c index fb40ff6e7c..0b6fa14a00 100644 --- a/apps/plugins/pdbox/PDa/intern/ftom~.c +++ b/apps/plugins/pdbox/PDa/intern/ftom~.c @@ -1,3 +1,8 @@ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#endif + #include #include @@ -19,7 +24,11 @@ static void *ftom_tilde_new(void) static t_int *ftom_tilde_perform(t_int *w) { +#ifdef ROCKBOX + t_sample *in = *(t_sample **)(w+1), *out = (t_sample*)*(t_float **)(w+2); +#else t_sample *in = *(t_sample **)(w+1), *out = *(t_float **)(w+2); +#endif t_int n = *(t_int *)(w+3); for (; n--; *in++, out++) { @@ -31,6 +40,9 @@ static t_int *ftom_tilde_perform(t_int *w) static void ftom_tilde_dsp(t_ftom_tilde *x, t_signal **sp) { +#ifdef ROCKBOX + (void) x; +#endif post("warning: %s not usable yet",__FUNCTION__); dsp_add(ftom_tilde_perform, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); } diff --git a/apps/plugins/pdbox/PDa/intern/hip~.c b/apps/plugins/pdbox/PDa/intern/hip~.c index 6c6de41809..4c4a55d515 100644 --- a/apps/plugins/pdbox/PDa/intern/hip~.c +++ b/apps/plugins/pdbox/PDa/intern/hip~.c @@ -76,6 +76,9 @@ static void sighip_dsp(t_sighip *x, t_signal **sp) static void sighip_clear(t_sighip *x, t_floatarg q) { +#ifdef ROCKBOX + (void) q; +#endif x->x_cspace.c_x = 0; } diff --git a/apps/plugins/pdbox/PDa/intern/intern_setup.c b/apps/plugins/pdbox/PDa/intern/intern_setup.c index 017f72a349..95d29b8cf5 100644 --- a/apps/plugins/pdbox/PDa/intern/intern_setup.c +++ b/apps/plugins/pdbox/PDa/intern/intern_setup.c @@ -1,7 +1,57 @@ +#ifndef ROCKBOX #include +#endif -void d_intern_setup() { +#ifdef ROCKBOX +/* Get rid of warnings. */ +void biquad_tilde_setup(void); +void bp_tilde_setup(void); +void clip_tilde_setup(void); +void cos_tilde_setup(void); +void dbtopow_tilde_setup(void); +void dbtorms_tilde_setup(void); +void delread_tilde_setup(void); +void delwrite_tilde_setup(void); +void env_tilde_setup(void); +void ftom_tilde_setup(void); +void hip_tilde_setup(void); +void line_tilde_setup(void); +void lop_tilde_setup(void); +void mtof_tilde_setup(void); +void noise_tilde_setup(void); +void osc_tilde_setup(void); +void phasor_tilde_setup(void); +void powtodb_tilde_setup(void); +void print_tilde_setup(void); +void rmstodb_tilde_setup(void); +void rsqrt_tilde_setup(void); +void samphold_tilde_setup(void); +void sfread_tilde_setup(void); +void sfwrite_tilde_setup(void); +void sig_tilde_setup(void); +void snapshot_tilde_setup(void); +void sqrt_tilde_setup(void); +void tabosc4_tilde_setup(void); +void tabplay_tilde_setup(void); +void tabread4_tilde_setup(void); +void tabread_tilde_setup(void); +void tabread_setup(void); +void tabreceive_tilde_setup(void); +void tabsend_tilde_setup(void); +void tabwrite_tilde_setup(void); +void tabwrite_setup(void); +void threshold_tilde_setup(void); +void vcf_tilde_setup(void); +void vd_tilde_setup(void); +void vline_tilde_setup(void); +void vsnapshot_tilde_setup(void); +void wrap_tilde_setup(void); +#endif /* ROCKBOX */ + +void d_intern_setup(void) { +#ifndef ROCKBOX fprintf(stderr,"setup\n"); +#endif biquad_tilde_setup(); bp_tilde_setup(); clip_tilde_setup(); diff --git a/apps/plugins/pdbox/PDa/intern/line~.c b/apps/plugins/pdbox/PDa/intern/line~.c index f37f23c19d..bb4e689bda 100644 --- a/apps/plugins/pdbox/PDa/intern/line~.c +++ b/apps/plugins/pdbox/PDa/intern/line~.c @@ -23,7 +23,9 @@ static t_int *line_perform(t_int *w) t_line *x = (t_line *)(w[1]); t_sample *out = (t_sample *)(w[2]); int n = (int)(w[3]); +#ifndef ROCKBOX t_sample f = x->x_value; +#endif if (x->x_retarget) { diff --git a/apps/plugins/pdbox/PDa/intern/lop~.c b/apps/plugins/pdbox/PDa/intern/lop~.c index 9d36091711..08fe8188c9 100644 --- a/apps/plugins/pdbox/PDa/intern/lop~.c +++ b/apps/plugins/pdbox/PDa/intern/lop~.c @@ -46,6 +46,9 @@ static void siglop_ft1(t_siglop *x, t_floatarg f) static void siglop_clear(t_siglop *x, t_floatarg q) { +#ifdef ROCKBOX + (void) q; +#endif x->x_cspace.c_x = 0; } diff --git a/apps/plugins/pdbox/PDa/intern/mtof~.c b/apps/plugins/pdbox/PDa/intern/mtof~.c index cf0fd66da6..86d78ce107 100644 --- a/apps/plugins/pdbox/PDa/intern/mtof~.c +++ b/apps/plugins/pdbox/PDa/intern/mtof~.c @@ -1,3 +1,8 @@ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#endif + #include #include @@ -36,6 +41,9 @@ static t_int *mtof_tilde_perform(t_int *w) static void mtof_tilde_dsp(t_mtof_tilde *x, t_signal **sp) { +#ifdef ROCKBOX + (void) x; +#endif post("warning: %s not usable yet",__FUNCTION__); dsp_add(mtof_tilde_perform, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); } diff --git a/apps/plugins/pdbox/PDa/intern/osc~.c b/apps/plugins/pdbox/PDa/intern/osc~.c index b2cc843b55..871519173b 100644 --- a/apps/plugins/pdbox/PDa/intern/osc~.c +++ b/apps/plugins/pdbox/PDa/intern/osc~.c @@ -6,7 +6,11 @@ /* ------------------------ osc~ ----------------------------- */ +#ifdef ROCKBOX +static t_class *osc_class; +#else static t_class *osc_class, *scalarosc_class; +#endif typedef struct _osc { diff --git a/apps/plugins/pdbox/PDa/intern/powtodb~.c b/apps/plugins/pdbox/PDa/intern/powtodb~.c index 5fead1511c..1714c8855e 100644 --- a/apps/plugins/pdbox/PDa/intern/powtodb~.c +++ b/apps/plugins/pdbox/PDa/intern/powtodb~.c @@ -1,3 +1,8 @@ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#endif + #include #include @@ -39,6 +44,9 @@ static t_int *powtodb_tilde_perform(t_int *w) static void powtodb_tilde_dsp(t_powtodb_tilde *x, t_signal **sp) { +#ifdef ROCKBOX + (void) x; +#endif post("warning: %s not usable yet",__FUNCTION__); dsp_add(powtodb_tilde_perform, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); } diff --git a/apps/plugins/pdbox/PDa/intern/rmstodb~.c b/apps/plugins/pdbox/PDa/intern/rmstodb~.c index ee2b2a9874..3b46b38ea7 100644 --- a/apps/plugins/pdbox/PDa/intern/rmstodb~.c +++ b/apps/plugins/pdbox/PDa/intern/rmstodb~.c @@ -1,3 +1,8 @@ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#endif + #include #include @@ -39,6 +44,9 @@ static t_int *rmstodb_tilde_perform(t_int *w) static void rmstodb_tilde_dsp(t_rmstodb_tilde *x, t_signal **sp) { +#ifdef ROCKBOX + (void) x; +#endif post("warning: %s not usable yet",__FUNCTION__); dsp_add(rmstodb_tilde_perform, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); } diff --git a/apps/plugins/pdbox/PDa/intern/rsqrt~.c b/apps/plugins/pdbox/PDa/intern/rsqrt~.c index dd7e2a135b..7f5a481132 100644 --- a/apps/plugins/pdbox/PDa/intern/rsqrt~.c +++ b/apps/plugins/pdbox/PDa/intern/rsqrt~.c @@ -1,3 +1,8 @@ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#endif + #include #include @@ -89,6 +94,9 @@ static t_int *sigrsqrt_perform(t_int *w) static void sigrsqrt_dsp(t_sigrsqrt *x, t_signal **sp) { +#ifdef ROCKBOX + (void) x; +#endif dsp_add(sigrsqrt_perform, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); } diff --git a/apps/plugins/pdbox/PDa/intern/sfread~.c b/apps/plugins/pdbox/PDa/intern/sfread~.c index 3882777ed9..186d7b5893 100644 --- a/apps/plugins/pdbox/PDa/intern/sfread~.c +++ b/apps/plugins/pdbox/PDa/intern/sfread~.c @@ -1,3 +1,7 @@ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#else /* ROCKBOX */ #include #include #include @@ -6,6 +10,7 @@ #include #include #include +#endif /* ROCKBOX */ #include #include @@ -40,7 +45,9 @@ typedef struct _sfread void sfread_open(t_sfread *x,t_symbol *filename) { +#ifndef ROCKBOX struct stat fstate; +#endif char fname[MAXPDSTRING]; if (filename == &s_) { @@ -54,7 +61,11 @@ void sfread_open(t_sfread *x,t_symbol *filename) /* close the old file */ +#ifdef ROCKBOX + if (x->x_mapaddr) freebytes(x->x_mapaddr, x->x_size); +#else if (x->x_mapaddr) munmap(x->x_mapaddr,x->x_size); +#endif if (x->x_fd >= 0) close(x->x_fd); if ((x->x_fd = open(fname,O_RDONLY)) < 0) @@ -66,17 +77,35 @@ void sfread_open(t_sfread *x,t_symbol *filename) } /* get the size */ - +#ifdef ROCKBOX + x->x_size = rb->filesize(x->x_fd); +#else fstat(x->x_fd,&fstate); x->x_size = fstate.st_size; +#endif /* map the file into memory */ +#ifdef ROCKBOX + x->x_mapaddr = getbytes(x->x_size); + if (!x->x_mapaddr) + { + error("can't mmap %s",fname); + return; + } + int r = read(x->x_fd, x->x_mapaddr, x->x_size); + if (r != x->x_size) + { + error("can't mmap %s",fname); + return; + } +#else if (!(x->x_mapaddr = mmap(NULL,x->x_size,PROT_READ,MAP_PRIVATE,x->x_fd,0))) { error("can't mmap %s",fname); return; } +#endif } #define MAX_CHANS 4 @@ -236,6 +265,9 @@ static void sfread_offset(t_sfread* x, t_floatarg f) static void *sfread_new(t_floatarg chan,t_floatarg skip) { +#ifdef ROCKBOX + (void) skip; +#endif t_sfread *x = (t_sfread *)pd_new(sfread_class); t_int c = chan; diff --git a/apps/plugins/pdbox/PDa/intern/sfwrite~.c b/apps/plugins/pdbox/PDa/intern/sfwrite~.c index 6b054f17b9..0a6f4e9381 100644 --- a/apps/plugins/pdbox/PDa/intern/sfwrite~.c +++ b/apps/plugins/pdbox/PDa/intern/sfwrite~.c @@ -1,4 +1,7 @@ - +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#else /* ROCKBOX */ #include #include #include @@ -7,6 +10,7 @@ #include #include #include +#endif /* ROCKBOX */ #include #include @@ -87,7 +91,11 @@ static void sfwrite_open(t_sfwrite *x,t_symbol *filename) sfwrite_close(x); +#ifdef ROCKBOX + if ((x->x_file = open(fname, O_RDWR | O_CREAT)) < 0) +#else if ((x->x_file = open(fname,O_RDWR | O_CREAT,0664)) < 0) +#endif { error("can't create %s",fname); return; diff --git a/apps/plugins/pdbox/PDa/intern/sqrt~.c b/apps/plugins/pdbox/PDa/intern/sqrt~.c index f5362f094f..d78a6c6b98 100644 --- a/apps/plugins/pdbox/PDa/intern/sqrt~.c +++ b/apps/plugins/pdbox/PDa/intern/sqrt~.c @@ -1,6 +1,11 @@ #define DUMTAB1SIZE 256 #define DUMTAB2SIZE 1024 +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#endif + #include #include @@ -62,6 +67,9 @@ t_int *sigsqrt_perform(t_int *w) /* not static; also used in d_fft.c */ static void sigsqrt_dsp(t_sigsqrt *x, t_signal **sp) { +#ifdef ROCKBOX + (void) x; +#endif dsp_add(sigsqrt_perform, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); } diff --git a/apps/plugins/pdbox/PDa/intern/tabosc4~.c b/apps/plugins/pdbox/PDa/intern/tabosc4~.c index f9b6ad0ac3..1c41e44bc3 100644 --- a/apps/plugins/pdbox/PDa/intern/tabosc4~.c +++ b/apps/plugins/pdbox/PDa/intern/tabosc4~.c @@ -77,7 +77,11 @@ zero: void tabosc4_tilde_set(t_tabosc4_tilde *x, t_symbol *s) { t_garray *a; +#ifdef ROCKBOX + int pointsinarray; +#else int npoints, pointsinarray; +#endif x->x_arrayname = s; if (!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class))) @@ -93,7 +97,9 @@ void tabosc4_tilde_set(t_tabosc4_tilde *x, t_symbol *s) } else { +#ifndef ROCKBOX int i; +#endif x->x_fnpoints = pointsinarray; x->x_lognpoints = ilog2(pointsinarray); post("tabosc~: using %d (log %d) points of array",x->x_fnpoints,x->x_lognpoints); diff --git a/apps/plugins/pdbox/PDa/intern/tabplay~.c b/apps/plugins/pdbox/PDa/intern/tabplay~.c index 5ac0d2701a..cc326559fa 100644 --- a/apps/plugins/pdbox/PDa/intern/tabplay~.c +++ b/apps/plugins/pdbox/PDa/intern/tabplay~.c @@ -1,5 +1,8 @@ +#ifndef ROCKBOX #define FIXEDPOINT +#endif + #include #include @@ -94,6 +97,11 @@ static void tabplay_tilde_list(t_tabplay_tilde *x, t_symbol *s, { long start = atom_getfloatarg(0, argc, argv); long length = atom_getfloatarg(1, argc, argv); + +#ifdef ROCKBOX + (void) s; +#endif + if (start < 0) start = 0; if (length <= 0) x->x_limit = 0x7fffffff; diff --git a/apps/plugins/pdbox/PDa/intern/tabread4~.c b/apps/plugins/pdbox/PDa/intern/tabread4~.c index 47a6fc3ddf..62b539eb03 100644 --- a/apps/plugins/pdbox/PDa/intern/tabread4~.c +++ b/apps/plugins/pdbox/PDa/intern/tabread4~.c @@ -90,6 +90,9 @@ static void tabread4_tilde_dsp(t_tabread4_tilde *x, t_signal **sp) static void tabread4_tilde_free(t_tabread4_tilde *x) { +#ifdef ROCKBOX + (void) x; +#endif } void tabread4_tilde_setup(void) diff --git a/apps/plugins/pdbox/PDa/intern/tabread~.c b/apps/plugins/pdbox/PDa/intern/tabread~.c index 5a7ea5d57f..c46a9045a0 100644 --- a/apps/plugins/pdbox/PDa/intern/tabread~.c +++ b/apps/plugins/pdbox/PDa/intern/tabread~.c @@ -1,4 +1,7 @@ +#ifndef ROCKBOX #define FIXEDPOINT +#endif + #include #include @@ -30,7 +33,11 @@ static t_int *tabread_tilde_perform(t_int *w) t_sample *out = (t_sample *)(w[3]); int n = (int)(w[4]); int maxindex; +#ifdef ROCKBOX + t_sample *buf = x->x_vec; +#else t_sample *buf = x->x_vec, *fp; +#endif int i; maxindex = x->x_npoints - 1; @@ -82,6 +89,9 @@ static void tabread_tilde_dsp(t_tabread_tilde *x, t_signal **sp) static void tabread_tilde_free(t_tabread_tilde *x) { +#ifdef ROCKBOX + (void) x; +#endif } void tabread_tilde_setup(void) diff --git a/apps/plugins/pdbox/PDa/intern/tabsend~.c b/apps/plugins/pdbox/PDa/intern/tabsend~.c index 9021bac951..a3bc5605b4 100644 --- a/apps/plugins/pdbox/PDa/intern/tabsend~.c +++ b/apps/plugins/pdbox/PDa/intern/tabsend~.c @@ -54,7 +54,11 @@ bad: static void tabsend_dsp(t_tabsend *x, t_signal **sp) { +#ifdef ROCKBOX + int vecsize; +#else int i, vecsize; +#endif t_garray *a; if (!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class))) diff --git a/apps/plugins/pdbox/PDa/intern/tabwrite.c b/apps/plugins/pdbox/PDa/intern/tabwrite.c index ff4e40d042..1db5aaa407 100644 --- a/apps/plugins/pdbox/PDa/intern/tabwrite.c +++ b/apps/plugins/pdbox/PDa/intern/tabwrite.c @@ -24,7 +24,11 @@ static void tabwrite_tick(t_tabwrite *x) static void tabwrite_float(t_tabwrite *x, t_float f) { +#ifdef ROCKBOX + int vecsize; +#else int i, vecsize; +#endif t_garray *a; t_sample *vec; diff --git a/apps/plugins/pdbox/PDa/intern/vd~.c b/apps/plugins/pdbox/PDa/intern/vd~.c index 471df56753..81f9d48938 100644 --- a/apps/plugins/pdbox/PDa/intern/vd~.c +++ b/apps/plugins/pdbox/PDa/intern/vd~.c @@ -1,12 +1,14 @@ #include #include -#include "delay.h" - extern int ugen_getsortno(void); +#include "delay.h" + #define DEFDELVS 64 /* LATER get this from canvas at DSP time */ +#ifndef ROCKBOX static int delread_zero = 0; /* four bytes of zero for delread~, vd~ */ +#endif static t_class *sigvd_class; @@ -37,14 +39,18 @@ static t_int *sigvd_perform(t_int *w) t_sample *in = (t_sample *)(w[1]); t_sample *out = (t_sample *)(w[2]); t_delwritectl *ctl = (t_delwritectl *)(w[3]); +#ifndef ROCKBOX t_sigvd *x = (t_sigvd *)(w[4]); +#endif int n = (int)(w[5]); int nsamps = ctl->c_n; int fn = n; t_sample limit = nsamps - n - 1; t_sample *vp = ctl->c_vec, *bp, *wp = vp + ctl->c_phase; +#ifndef ROCKBOX t_sample zerodel = x->x_zerodel; +#endif while (n--) { t_time delsamps = ((long long) mult((*in++),ftofix(44.1)));//- itofix(zerodel); diff --git a/apps/plugins/pdbox/PDa/intern/vline~.c b/apps/plugins/pdbox/PDa/intern/vline~.c index 15f0d1793e..dc73f72571 100644 --- a/apps/plugins/pdbox/PDa/intern/vline~.c +++ b/apps/plugins/pdbox/PDa/intern/vline~.c @@ -1,3 +1,8 @@ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#endif + #include #include @@ -36,7 +41,9 @@ static t_int *vline_tilde_perform(t_int *w) t_sample f = x->x_value; t_sample inc = x->x_inc; t_time msecpersamp = x->x_msecpersamp; +#ifndef ROCKBOX t_time samppermsec = x->x_samppermsec; +#endif t_time timenow = clock_gettimesince(x->x_referencetime) - n * msecpersamp; t_vseg *s = x->x_list; for (i = 0; i < n; i++) @@ -58,7 +65,7 @@ static t_int *vline_tilde_perform(t_int *w) } else { - t_time incpermsec = div((s->s_target - f), + t_time incpermsec = idiv((s->s_target - f), (s->s_targettime - s->s_starttime)); f = mult(f + incpermsec,(timenext - s->s_starttime)); inc = mult(incpermsec,msecpersamp); @@ -123,7 +130,7 @@ static void vline_tilde_float(t_vline *x, t_float f) } else { - for (s1 = x->x_list; s2 = s1->s_next; s1 = s2) + for (s1 = x->x_list; (s2 = s1->s_next); s1 = s2) { if (s2->s_starttime > starttime || (s2->s_starttime == starttime && diff --git a/apps/plugins/pdbox/PDa/intern/wrap~.c b/apps/plugins/pdbox/PDa/intern/wrap~.c index c011babdfc..99b50e61dd 100644 --- a/apps/plugins/pdbox/PDa/intern/wrap~.c +++ b/apps/plugins/pdbox/PDa/intern/wrap~.c @@ -40,6 +40,9 @@ static t_int *sigwrap_perform(t_int *w) static void sigwrap_dsp(t_sigwrap *x, t_signal **sp) { +#ifdef ROCKBOX + (void) x; +#endif dsp_add(sigwrap_perform, 3, sp[0]->s_vec, sp[1]->s_vec, sp[0]->s_n); } diff --git a/apps/plugins/pdbox/PDa/src/d_arithmetic.c b/apps/plugins/pdbox/PDa/src/d_arithmetic.c index 30744882f4..fa306dedd3 100644 --- a/apps/plugins/pdbox/PDa/src/d_arithmetic.c +++ b/apps/plugins/pdbox/PDa/src/d_arithmetic.c @@ -28,6 +28,9 @@ typedef struct _scalarplus static void *plus_new(t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; +#endif if (argc > 1) post("+~: extra arguments ignored"); if (argc) { @@ -115,6 +118,9 @@ void dsp_add_plus(t_sample *in1, t_sample *in2, t_sample *out, int n) static void plus_dsp(t_plus *x, t_signal **sp) { +#ifdef ROCKBOX + (void) x; +#endif dsp_add_plus(sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[0]->s_n); } @@ -161,6 +167,9 @@ typedef struct _scalarminus static void *minus_new(t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; +#endif if (argc > 1) post("-~: extra arguments ignored"); if (argc) { @@ -240,6 +249,9 @@ t_int *scalarminus_perf8(t_int *w) static void minus_dsp(t_minus *x, t_signal **sp) { +#ifdef ROCKBOX + (void) x; +#endif if (sp[0]->s_n&7) dsp_add(minus_perform, 4, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[0]->s_n); @@ -292,6 +304,9 @@ typedef struct _scalartimes static void *times_new(t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; +#endif if (argc > 1) post("*~: extra arguments ignored"); if (argc) { @@ -371,6 +386,9 @@ t_int *scalartimes_perf8(t_int *w) static void times_dsp(t_times *x, t_signal **sp) { +#ifdef ROCKBOX + (void) x; +#endif if (sp[0]->s_n&7) dsp_add(times_perform, 4, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[0]->s_n); @@ -422,6 +440,9 @@ typedef struct _scalarover static void *over_new(t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; +#endif if (argc > 1) post("/~: extra arguments ignored"); if (argc) { @@ -512,6 +533,9 @@ t_int *scalarover_perf8(t_int *w) static void over_dsp(t_over *x, t_signal **sp) { +#ifdef ROCKBOX + (void) x; +#endif if (sp[0]->s_n&7) dsp_add(over_perform, 4, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[0]->s_n); @@ -563,6 +587,9 @@ typedef struct _scalarmax static void *max_new(t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; +#endif if (argc > 1) post("max~: extra arguments ignored"); if (argc) { @@ -654,6 +681,9 @@ t_int *scalarmax_perf8(t_int *w) static void max_dsp(t_max *x, t_signal **sp) { +#ifdef ROCKBOX + (void) x; +#endif if (sp[0]->s_n&7) dsp_add(max_perform, 4, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[0]->s_n); @@ -705,6 +735,9 @@ typedef struct _scalarmin static void *min_new(t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; +#endif if (argc > 1) post("min~: extra arguments ignored"); if (argc) { @@ -796,6 +829,9 @@ t_int *scalarmin_perf8(t_int *w) static void min_dsp(t_min *x, t_signal **sp) { +#ifdef ROCKBOX + (void) x; +#endif if (sp[0]->s_n&7) dsp_add(min_perform, 4, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[0]->s_n); diff --git a/apps/plugins/pdbox/PDa/src/d_ctl.c b/apps/plugins/pdbox/PDa/src/d_ctl.c index 809899addf..aa8df4fae8 100644 --- a/apps/plugins/pdbox/PDa/src/d_ctl.c +++ b/apps/plugins/pdbox/PDa/src/d_ctl.c @@ -74,7 +74,10 @@ static void *sig_tilde_new(t_floatarg f) return (x); } -static void sig_tilde_setup(void) +#ifndef ROCKBOX +static +#endif +void sig_tilde_setup(void) { sig_tilde_class = class_new(gensym("sig~"), (t_newmethod)sig_tilde_new, 0, sizeof(t_sig), 0, A_DEFFLOAT, 0); diff --git a/apps/plugins/pdbox/PDa/src/d_dac.c b/apps/plugins/pdbox/PDa/src/d_dac.c index 1606b3a1f2..29b3410de9 100644 --- a/apps/plugins/pdbox/PDa/src/d_dac.c +++ b/apps/plugins/pdbox/PDa/src/d_dac.c @@ -22,8 +22,17 @@ typedef struct _dac static void *dac_new(t_symbol *s, int argc, t_atom *argv) { t_dac *x = (t_dac *)pd_new(dac_class); +#ifdef ROCKBOX + t_atom defarg[2]; +#else t_atom defarg[2], *ap; +#endif int i; + +#ifdef ROCKBOX + (void) s; +#endif + if (!argc) { argv = defarg; @@ -83,8 +92,17 @@ typedef struct _adc static void *adc_new(t_symbol *s, int argc, t_atom *argv) { t_adc *x = (t_adc *)pd_new(adc_class); +#ifdef ROCKBOX + t_atom defarg[2]; +#else t_atom defarg[2], *ap; +#endif int i; + +#ifdef ROCKBOX + (void) s; +#endif + if (!argc) { argv = defarg; diff --git a/apps/plugins/pdbox/PDa/src/d_fft.c b/apps/plugins/pdbox/PDa/src/d_fft.c index 7b70561a0e..6e2713a960 100644 --- a/apps/plugins/pdbox/PDa/src/d_fft.c +++ b/apps/plugins/pdbox/PDa/src/d_fft.c @@ -67,6 +67,9 @@ static t_int *sigifft_perform(t_int *w) static void sigfft_dspx(t_sigfft *x, t_signal **sp, t_int *(*f)(t_int *w)) { +#ifdef ROCKBOX + (void) x; +#endif int n = sp[0]->s_n; t_sample *in1 = sp[0]->s_vec; t_sample *in2 = sp[1]->s_vec; @@ -150,6 +153,9 @@ static t_int *sigrfft_perform(t_int *w) static void sigrfft_dsp(t_sigrfft *x, t_signal **sp) { +#ifdef ROCKBOX + (void) x; +#endif int n = sp[0]->s_n, n2 = (n>>1); t_sample *in1 = sp[0]->s_vec; t_sample *out1 = sp[1]->s_vec; @@ -213,6 +219,9 @@ static t_int *sigrifft_perform(t_int *w) static void sigrifft_dsp(t_sigrifft *x, t_signal **sp) { +#ifdef ROCKBOX + (void) x; +#endif int n = sp[0]->s_n, n2 = (n>>1); t_sample *in1 = sp[0]->s_vec; t_sample *in2 = sp[1]->s_vec; diff --git a/apps/plugins/pdbox/PDa/src/d_fftroutine.c b/apps/plugins/pdbox/PDa/src/d_fftroutine.c index 41948132d7..08888333fc 100644 --- a/apps/plugins/pdbox/PDa/src/d_fftroutine.c +++ b/apps/plugins/pdbox/PDa/src/d_fftroutine.c @@ -84,9 +84,14 @@ /* INCLUDE FILES */ /*****************************************************************************/ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#else /* ROCKBOX */ #include #include #include +#endif /* ROCKBOX */ /* the following is needed only to declare pd_fft() as exportable in MSW */ #include "m_pd.h" @@ -280,7 +285,7 @@ void fft_clear(void) nextnet = thisnet->next; net_dealloc(thisnet); free((char *)thisnet); - } while (thisnet = nextnet); + } while ((thisnet = nextnet)); } } @@ -485,14 +490,21 @@ void load_registers(FFT_NET *fft_net, float *buf, int buf_form, { int *load_index = fft_net->load_index; +#ifdef ROCKBOX + SAMPLE *window = NULL; + int index, i = 0; +#else SAMPLE *window; int index, i = 0, n = fft_net->n; +#endif if (trnsfrm_dir==FORWARD) window = fft_net->window; else if (trnsfrm_dir==INVERSE) window = fft_net->inv_window; else { +#ifndef ROCKBOX fprintf(stderr, "load_registers:illegal transform direction\n"); exit(0); +#endif } fft_net->direction = trnsfrm_dir; @@ -539,8 +551,10 @@ void load_registers(FFT_NET *fft_net, float *buf, int buf_form, } break; default: { +#ifndef ROCKBOX fprintf(stderr, "load_registers:illegal input form\n"); exit(0); +#endif } break; } } break; @@ -591,15 +605,19 @@ void load_registers(FFT_NET *fft_net, float *buf, int buf_form, } break; default: { +#ifndef ROCKBOX fprintf(stderr, "load_registers:illegal input form\n"); exit(0); +#endif } break; } } break; default: { +#ifndef ROCKBOX fprintf(stderr, "load_registers:illegal input scale\n"); exit(0); +#endif } break; } } @@ -616,8 +634,15 @@ void store_registers(FFT_NET *fft_net, float *buf, int buf_form, */ { +#ifdef ROCKBOX + (void) debug; +#endif int i; +#ifdef ROCKBOX + SAMPLE real, imag; +#else SAMPLE real, imag, mag, phase; +#endif int n; i = 0; @@ -661,12 +686,21 @@ void store_registers(FFT_NET *fft_net, float *buf, int buf_form, if (real > .00001) *buf++ = (float)atan2(imag, real); else { /* deal with bad case */ +#ifdef ROCKBOX + if (imag > 0){ *buf++ = PI / 2.; + } + else if (imag < 0){ *buf++ = -PI / 2.; + } + else { *buf++ = 0; + } +#else if (imag > 0){ *buf++ = PI / 2.; if(debug) fprintf(stderr,"real=0 and imag > 0\n");} else if (imag < 0){ *buf++ = -PI / 2.; if(debug) fprintf(stderr,"real=0 and imag < 0\n");} else { *buf++ = 0; - if(debug) fprintf(stderr,"real=0 and imag=0\n");} + if(debug) fprintf(stderr,"real=0 and imag=0\n");} +#endif } } while (++i < n); } break; @@ -687,8 +721,10 @@ void store_registers(FFT_NET *fft_net, float *buf, int buf_form, } break; default: { +#ifndef ROCKBOX fprintf(stderr, "store_registers:illegal output form\n"); exit(0); +#endif } break; } } break; @@ -753,15 +789,19 @@ void store_registers(FFT_NET *fft_net, float *buf, int buf_form, } break; default: { +#ifndef ROCKBOX fprintf(stderr, "store_registers:illegal output form\n"); exit(0); +#endif } break; } } break; default: { +#ifndef ROCKBOX fprintf(stderr, "store_registers:illegal output scale\n"); exit(0); +#endif } break; } } @@ -992,7 +1032,11 @@ void short_to_float(short *short_buf, float *float_buf, int n) void pd_fft(float *buf, int npoints, int inverse) { double renorm; +#ifdef ROCKBOX + float *fp; +#else float *fp, *fp2; +#endif int i; renorm = (inverse ? npoints : 1.); cfft((inverse ? INVERSE : FORWARD), npoints, RECTANGULAR, diff --git a/apps/plugins/pdbox/PDa/src/d_global.c b/apps/plugins/pdbox/PDa/src/d_global.c index 893abe1f7d..9f4676d48a 100644 --- a/apps/plugins/pdbox/PDa/src/d_global.c +++ b/apps/plugins/pdbox/PDa/src/d_global.c @@ -4,8 +4,16 @@ /* send~, receive~, throw~, catch~ */ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#endif + #include "m_pd.h" + +#ifndef ROCKBOX #include +#endif #define DEFSENDVS 64 /* LATER get send to get this from canvas */ diff --git a/apps/plugins/pdbox/PDa/src/d_imayer_fft.c b/apps/plugins/pdbox/PDa/src/d_imayer_fft.c index 05d944ed44..3e07eac49e 100644 --- a/apps/plugins/pdbox/PDa/src/d_imayer_fft.c +++ b/apps/plugins/pdbox/PDa/src/d_imayer_fft.c @@ -95,7 +95,9 @@ char mtrig_algorithm[] = "Simple"; #define TRIG_TAB_SIZE 22 +#ifndef ROCKBOX static long long halsec[TRIG_TAB_SIZE]= {1,2,3}; +#endif #define FFTmult(x,y) mult(x,y) @@ -286,7 +288,11 @@ void imayer_ifft(int n, t_fixed *real, t_fixed *imag) void imayer_realfft(int n, t_fixed *real) { +#ifdef ROCKBOX + t_fixed a,b; +#else t_fixed a,b,c,d; +#endif int i,j,k; imayer_fht(real,n); for (i=1,j=n-1,k=n/2;i #include +#endif /* ------------------------- print~ -------------------------- */ static t_class *print_class; @@ -69,7 +77,10 @@ static void *print_new(t_symbol *s) return (x); } -static void print_setup(void) +#ifndef ROCKBOX +static +#endif +void print_setup(void) { print_class = class_new(gensym("print~"), (t_newmethod)print_new, 0, sizeof(t_print), 0, A_DEFSYM, 0); @@ -118,7 +129,11 @@ static void scope_dsp(t_scope *x, t_signal **sp) static void scope_erase(t_scope *x) { +#ifdef ROCKBOX + (void) x; +#else if (x->x_drawn) sys_vgui(".x%x.c delete gumbo\n", x->x_canvas); +#endif } #define X1 10. @@ -126,6 +141,7 @@ static void scope_erase(t_scope *x) #define YC 5. static void scope_bang(t_scope *x) { +#ifndef ROCKBOX int n, phase; char hugebuf[10000], *s = hugebuf; scope_erase(x); @@ -142,6 +158,7 @@ static void scope_bang(t_scope *x) } sprintf(s, "-tags gumbo\n"); sys_gui(hugebuf); +#endif x->x_drawn = 1; } @@ -152,6 +169,9 @@ static void scope_free(t_scope *x) static void *scope_new(t_symbol *s) { +#ifdef ROCKBOX + (void) s; +#endif t_scope *x = (t_scope *)pd_new(scope_class); error("scope: this is now obsolete; use arrays and tabwrite~ instead"); x->x_phase = 0; @@ -188,6 +208,9 @@ static t_int *bang_tilde_perform(t_int *w) static void bang_tilde_dsp(t_bang *x, t_signal **sp) { +#ifdef ROCKBOX + (void) sp; +#endif dsp_add(bang_tilde_perform, 1, x); } @@ -203,6 +226,9 @@ static void bang_tilde_free(t_bang *x) static void *bang_tilde_new(t_symbol *s) { +#ifdef ROCKBOX + (void) s; +#endif t_bang *x = (t_bang *)pd_new(bang_tilde_class); x->x_clock = clock_new(x, (t_method)bang_tilde_tick); outlet_new(&x->x_obj, &s_bang); @@ -233,6 +259,9 @@ static void samplerate_tilde_bang(t_samplerate *x) static void *samplerate_tilde_new(t_symbol *s) { +#ifdef ROCKBOX + (void) s; +#endif t_samplerate *x = (t_samplerate *)pd_new(samplerate_tilde_class); outlet_new(&x->x_obj, &s_float); return (x); diff --git a/apps/plugins/pdbox/PDa/src/d_soundfile.c b/apps/plugins/pdbox/PDa/src/d_soundfile.c index 4b89e93fd4..34aa105d28 100644 --- a/apps/plugins/pdbox/PDa/src/d_soundfile.c +++ b/apps/plugins/pdbox/PDa/src/d_soundfile.c @@ -11,6 +11,10 @@ readsf~ and writesf~ are defined which confine disk operations to a separate thread so that they can be used in real time. The readsf~ and writesf~ objects use Posix-like threads. */ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#else /* ROCKBOX */ #ifdef UNIX #include #include @@ -22,6 +26,7 @@ objects use Posix-like threads. */ #include #include #include +#endif /* ROCKBOX */ #include "m_pd.h" @@ -198,9 +203,15 @@ int open_soundfile(const char *dirname, const char *filename, int headersize, long skipframes) { char buf[OBUFSIZE], *bufptr; +#ifdef ROCKBOX + int fd, nchannels, bigendian, bytespersamp, swap, sysrtn; +#else int fd, format, nchannels, bigendian, bytespersamp, swap, sysrtn; +#endif long bytelimit = 0x7fffffff; +#ifndef ROCKBOX errno = 0; +#endif fd = open_via_path(dirname, filename, "", buf, &bufptr, MAXPDSTRING, 1); if (fd < 0) @@ -239,7 +250,9 @@ int open_soundfile(const char *dirname, const char *filename, int headersize, swap = (bigendian != garray_ambigendian()); if (format == FORMAT_NEXT) /* nextstep header */ { +#ifndef ROCKBOX uint32 param; +#endif if (bytesread < (int)sizeof(t_nextstep)) goto badheader; nchannels = swap4(((t_nextstep *)buf)->ns_nchans, swap); @@ -381,7 +394,9 @@ int open_soundfile(const char *dirname, const char *filename, int headersize, badheader: /* the header wasn't recognized. We're threadable here so let's not print out the error... */ +#ifndef ROCKBOX errno = EIO; +#endif return (-1); } @@ -705,7 +720,11 @@ static int create_soundfile(t_canvas *canvas, const char *filename, canvas_makefilename(canvas, filenamebuf, buf2, MAXPDSTRING); sys_bashfilename(buf2, buf2); +#ifdef ROCKBOX + if ((fd = open(buf2, BINCREATE)) < 0) +#else if ((fd = open(buf2, BINCREATE, 0666)) < 0) +#endif return (-1); if (write(fd, headerbuf, headersize) < headersize) @@ -771,7 +790,11 @@ static void soundfile_finishwrite(void *obj, char *filename, int fd, } return; baddonewrite: +#ifdef ROCKBOX + post("%s: error", filename); +#else post("%s: %s", filename, strerror(errno)); +#endif } static void soundfile_xferout(int nchannels, t_sample **vecs, @@ -920,9 +943,16 @@ static t_soundfiler *soundfiler_new(void) static void soundfiler_read(t_soundfiler *x, t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; +#endif int headersize = -1, channels = 0, bytespersamp = 0, bigendian = 0, resize = 0, i, j; +#ifdef ROCKBOX + long skipframes = 0, nframes = 0, finalsize = 0, +#else long skipframes = 0, nframes = 0, finalsize = 0, itemsleft, +#endif maxsize = DEFMAXSIZE, itemsread = 0, bytelimit = 0x7fffffff; int fd = -1; char endianness, *filename; @@ -930,7 +960,11 @@ static void soundfiler_read(t_soundfiler *x, t_symbol *s, t_sample *vecs[MAXSFCHANS]; char sampbuf[SAMPBUFSIZE]; int bufframes, nitems; +#ifdef ROCKBOX + int fp; +#else FILE *fp; +#endif while (argc > 0 && argv->a_type == A_SYMBOL && *argv->a_w.w_symbol->s_name == '-') { @@ -1019,8 +1053,14 @@ static void soundfiler_read(t_soundfiler *x, t_symbol *s, if (fd < 0) { +#ifdef ROCKBOX + pd_error(x, "soundfiler_read: %s: %s", + filename, + "unknown or bad header format"); +#else pd_error(x, "soundfiler_read: %s: %s", filename, (errno == EIO ? "unknown or bad header format" : strerror(errno))); +#endif goto done; } @@ -1065,14 +1105,22 @@ static void soundfiler_read(t_soundfiler *x, t_symbol *s, if (!finalsize) finalsize = 0x7fffffff; if (finalsize > bytelimit / (channels * bytespersamp)) finalsize = bytelimit / (channels * bytespersamp); +#ifdef ROCKBOX + fp = open(filename, O_RDONLY); +#else fp = fdopen(fd, "rb"); +#endif bufframes = SAMPBUFSIZE / (channels * bytespersamp); for (itemsread = 0; itemsread < finalsize; ) { int thisread = finalsize - itemsread; thisread = (thisread > bufframes ? bufframes : thisread); +#ifdef ROCKBOX + nitems = read(fp, sampbuf, thisread * bytespersamp * channels); +#else nitems = fread(sampbuf, channels * bytespersamp, thisread, fp); +#endif if (nitems <= 0) break; soundfile_xferin(channels, argc, vecs, itemsread, (unsigned char *)sampbuf, nitems, bytespersamp, bigendian); @@ -1082,7 +1130,11 @@ static void soundfiler_read(t_soundfiler *x, t_symbol *s, for (i = 0; i < argc; i++) { +#ifdef ROCKBOX + int vecsize; +#else int nzero, vecsize; +#endif garray_getfloatarray(garrays[i], &vecsize, &vecs[i]); for (j = itemsread; j < vecsize; j++) vecs[i][j] = 0; @@ -1099,7 +1151,11 @@ static void soundfiler_read(t_soundfiler *x, t_symbol *s, /* do all graphics updates */ for (i = 0; i < argc; i++) garray_redraw(garrays[i]); +#ifdef ROCKBOX + close(fp); +#else fclose(fp); +#endif fd = -1; goto done; usage: @@ -1118,14 +1174,25 @@ done: long soundfiler_dowrite(void *obj, t_canvas *canvas, int argc, t_atom *argv) { +#ifdef ROCKBOX + int bytespersamp, bigendian, + swap, filetype, normalize, i, j, nchannels; + long onset, nframes, + itemswritten = 0; +#else int headersize, bytespersamp, bigendian, endianness, swap, filetype, normalize, i, j, nchannels; long onset, nframes, itemsleft, maxsize = DEFMAXSIZE, itemswritten = 0; +#endif t_garray *garrays[MAXSFCHANS]; t_sample *vecs[MAXSFCHANS]; char sampbuf[SAMPBUFSIZE]; +#ifdef ROCKBOX + int bufframes; +#else int bufframes, nitems; +#endif int fd = -1; float normfactor, biggest = 0, samplerate; t_symbol *filesym; @@ -1174,7 +1241,11 @@ long soundfiler_dowrite(void *obj, t_canvas *canvas, nframes, bytespersamp, bigendian, nchannels, swap, samplerate)) < 0) { +#ifdef ROCKBOX + post("%s: %s\n", filesym->s_name, "error"); +#else post("%s: %s\n", filesym->s_name, strerror(errno)); +#endif goto fail; } if (!normalize) @@ -1194,14 +1265,22 @@ long soundfiler_dowrite(void *obj, t_canvas *canvas, for (itemswritten = 0; itemswritten < nframes; ) { +#ifdef ROCKBOX + int thiswrite = nframes - itemswritten, nbytes; +#else int thiswrite = nframes - itemswritten, nitems, nbytes; +#endif thiswrite = (thiswrite > bufframes ? bufframes : thiswrite); soundfile_xferout(argc, vecs, (unsigned char *)sampbuf, thiswrite, onset, bytespersamp, bigendian, normfactor); nbytes = write(fd, sampbuf, nchannels * bytespersamp * thiswrite); if (nbytes < nchannels * bytespersamp * thiswrite) { +#ifdef ROCKBOX + post("%s: %s", filesym->s_name, "error"); +#else post("%s: %s", filesym->s_name, strerror(errno)); +#endif if (nbytes > 0) itemswritten += nbytes / (nchannels * bytespersamp); break; @@ -1230,6 +1309,9 @@ fail: static void soundfiler_write(t_soundfiler *x, t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; +#endif long bozo = soundfiler_dowrite(x, x->x_canvas, argc, argv); outlet_float(x->x_obj.ob_outlet, (float)bozo); diff --git a/apps/plugins/pdbox/PDa/src/d_ugen.c b/apps/plugins/pdbox/PDa/src/d_ugen.c index 2c359c384d..6cf0a5a97d 100644 --- a/apps/plugins/pdbox/PDa/src/d_ugen.c +++ b/apps/plugins/pdbox/PDa/src/d_ugen.c @@ -21,11 +21,17 @@ * */ - +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#include "m_pd.h" +#include "m_imp.h" +#else /* ROCKBOX */ #include "m_pd.h" #include "m_imp.h" #include #include +#endif /* ROCKBOX */ extern t_class *vinlet_class, *voutlet_class, *canvas_class; t_sample *obj_findsignalscalar(t_object *x, int m); @@ -258,6 +264,10 @@ static t_int *block_epilog(t_int *w) static void block_dsp(t_block *x, t_signal **sp) { +#ifdef ROCKBOX + (void) x; + (void) sp; +#endif /* do nothing here */ } @@ -303,6 +313,7 @@ void dsp_tick(void) t_int *ip; for (ip = dsp_chain; *ip; ) ip = (*(t_perfroutine)(*ip))(ip); dsp_phase++; +printf("%d\n", dsp_phase); } } @@ -330,9 +341,13 @@ static t_signal *signal_usedlist; /* call this when DSP is stopped to free all the signals */ void signal_cleanup(void) { +#ifdef ROCKBOX + t_signal *sig; +#else t_signal **svec, *sig, *sig2; +#endif int i; - while (sig = signal_usedlist) + while((sig = signal_usedlist)) { signal_usedlist = sig->s_nextused; if (!sig->s_isborrowed) @@ -397,9 +412,15 @@ void signal_makereusable(t_signal *sig) t_signal *signal_new(int n, float sr) { +#ifdef ROCKBOX + int logn; +#else int logn, n2; +#endif t_signal *ret, **whichlist; +#ifndef ROCKBOX t_sample *fp; +#endif logn = ilog2(n); if (n) { @@ -413,7 +434,7 @@ t_signal *signal_new(int n, float sr) whichlist = &signal_freeborrowed; /* first try to reclaim one from the free list */ - if (ret = *whichlist) + if((ret = *whichlist)) *whichlist = ret->s_nextfree; else { @@ -520,8 +541,10 @@ static t_dspcontext *ugen_currentcontext; void ugen_stop(void) { +#ifndef ROCKBOX t_signal *s; int i; +#endif if (dsp_chain) { freebytes(dsp_chain, dsp_chainsize * sizeof (t_int)); @@ -577,8 +600,10 @@ t_dspcontext *ugen_start_graph(int toplevel, t_signal **sp, int ninlets, int noutlets) { t_dspcontext *dc = (t_dspcontext *)getbytes(sizeof(*dc)); +#ifndef ROCKBOX float parent_srate, srate; int parent_vecsize, vecsize; +#endif if (ugen_loud) post("ugen_start_graph..."); @@ -672,7 +697,11 @@ static void ugen_doit(t_dspcontext *dc, t_ugenbox *u) { t_sigoutlet *uout; t_siginlet *uin; +#ifdef ROCKBOX + t_sigoutconnect *oc; +#else t_sigoutconnect *oc, *oc2; +#endif t_class *class = pd_class(&u->u_obj->ob_pd); int i, n; /* suppress creating new signals for the outputs of signal @@ -681,13 +710,13 @@ static void ugen_doit(t_dspcontext *dc, t_ugenbox *u) we delay new signal creation, which will be handled by calling signal_setborrowed in the ugen_done_graph routine below. */ int nonewsigs = (class == canvas_class || - (class == vinlet_class) && !(dc->dc_reblock)); + ((class == vinlet_class) && !(dc->dc_reblock))); /* when we encounter a subcanvas or a signal outlet, suppress freeing the input signals as they may be "borrowed" for the super or sub patch; same exception as above, but also if we're "switched" we have to do a copy rather than a borrow. */ int nofreesigs = (class == canvas_class || - (class == voutlet_class) && !(dc->dc_reblock || dc->dc_switched)); + ((class == voutlet_class) && !(dc->dc_reblock || dc->dc_switched))); t_signal **insig, **outsig, **sig, *s1, *s2, *s3; t_ugenbox *u2; @@ -701,7 +730,7 @@ static void ugen_doit(t_dspcontext *dc, t_ugenbox *u) s3 = signal_new(dc->dc_vecsize, dc->dc_srate); /* post("%s: unconnected signal inlet set to zero", class_getname(u->u_obj->ob_pd)); */ - if (scalar = obj_findsignalscalar(u->u_obj, i)) + if((scalar = obj_findsignalscalar(u->u_obj, i))) dsp_add_scalarcopy(scalar, s3->s_vec, s3->s_n); else dsp_add_zero(s3->s_vec, s3->s_n); @@ -781,7 +810,7 @@ static void ugen_doit(t_dspcontext *dc, t_ugenbox *u) u2 = oc->oc_who; uin = &u2->u_in[oc->oc_inno]; /* if there's already someone here, sum the two */ - if (s2 = uin->i_signal) + if((s2 = uin->i_signal)) { s1->s_refcount--; s2->s_refcount--; @@ -825,7 +854,11 @@ static void ugen_doit(t_dspcontext *dc, t_ugenbox *u) void ugen_done_graph(t_dspcontext *dc) { +#ifdef ROCKBOX + t_ugenbox *u; +#else t_ugenbox *u, *u2; +#endif t_sigoutlet *uout; t_siginlet *uin; t_sigoutconnect *oc, *oc2; @@ -966,7 +999,11 @@ void ugen_done_graph(t_dspcontext *dc) for (u = dc->dc_ugenlist; u; u = u->u_next) { t_pd *zz = &u->u_obj->ob_pd; +#ifdef ROCKBOX + t_signal **outsigs = dc->dc_iosigs; +#else t_signal **insigs = dc->dc_iosigs, **outsigs = dc->dc_iosigs; +#endif if (outsigs) outsigs += dc->dc_ninlets; if (pd_class(zz) == vinlet_class) diff --git a/apps/plugins/pdbox/PDa/src/g_all_guis.c b/apps/plugins/pdbox/PDa/src/g_all_guis.c index 74a7656492..165c9ac14f 100644 --- a/apps/plugins/pdbox/PDa/src/g_all_guis.c +++ b/apps/plugins/pdbox/PDa/src/g_all_guis.c @@ -6,6 +6,14 @@ /* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#include "m_pd.h" +#include "g_canvas.h" +#include "g_all_guis.h" +#define snprintf rb->snprintf +#else /* ROCKBOX */ #include #include #include @@ -21,6 +29,7 @@ #else #include #endif +#endif /* ROCKBOX */ /* #define GGEE_HSLIDER_COMPATIBLE */ @@ -185,12 +194,20 @@ void iemgui_verify_snd_ne_rcv(t_iemgui *iemgui) t_symbol *iemgui_new_dogetname(t_iemgui *iemgui, int indx, t_atom *argv) { +#ifdef ROCKBOX + (void) iemgui; +#endif if (IS_A_SYMBOL(argv, indx)) return (atom_getsymbolarg(indx, 100000, argv)); else if (IS_A_FLOAT(argv, indx)) { char str[80]; +#ifdef ROCKBOX + snprintf(str, sizeof(str)-1, + "%d", (int)atom_getintarg(indx, 100000, argv)); +#else sprintf(str, "%d", (int)atom_getintarg(indx, 100000, argv)); +#endif return (gensym(str)); } else return (gensym("empty")); @@ -261,6 +278,10 @@ void iemgui_all_sym2dollararg(t_iemgui *iemgui, t_symbol **srlsym) void iemgui_first_dollararg2sym(t_iemgui *iemgui, t_symbol **srlsym) { +#ifdef ROCKBOX + (void) iemgui; + (void) srlsym; +#endif /* delete this function */ } @@ -341,8 +362,12 @@ void iemgui_all_raute2dollar(t_symbol **srlsym) void iemgui_send(void *x, t_iemgui *iemgui, t_symbol *s) { t_symbol *snd; +#ifdef ROCKBOX + int sndable=1, oldsndrcvable=0; +#else int pargc, tail_len, nth_arg, sndable=1, oldsndrcvable=0; t_atom *pargv; +#endif if(iemgui->x_fsf.x_rcv_able) oldsndrcvable += IEM_GUI_OLD_RCV_FLAG; @@ -364,8 +389,12 @@ void iemgui_send(void *x, t_iemgui *iemgui, t_symbol *s) void iemgui_receive(void *x, t_iemgui *iemgui, t_symbol *s) { t_symbol *rcv; +#ifdef ROCKBOX + int rcvable=1, oldsndrcvable=0; +#else int pargc, tail_len, nth_arg, rcvable=1, oldsndrcvable=0; t_atom *pargv; +#endif if(iemgui->x_fsf.x_rcv_able) oldsndrcvable += IEM_GUI_OLD_RCV_FLAG; @@ -399,34 +428,55 @@ void iemgui_receive(void *x, t_iemgui *iemgui, t_symbol *s) void iemgui_label(void *x, t_iemgui *iemgui, t_symbol *s) { t_symbol *lab; +#ifndef ROCKBOX int pargc, tail_len, nth_arg; t_atom *pargv; +#endif + +#ifdef ROCKBOX + (void) x; +#endif lab = iemgui_raute2dollar(s); iemgui->x_lab_unexpanded = lab; iemgui->x_lab = lab = canvas_realizedollar(iemgui->x_glist, lab); +#ifndef ROCKBOX if(glist_isvisible(iemgui->x_glist)) sys_vgui(".x%x.c itemconfigure %xLABEL -text {%s} \n", glist_getcanvas(iemgui->x_glist), x, strcmp(s->s_name, "empty")?iemgui->x_lab->s_name:""); +#endif } void iemgui_label_pos(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av) { +#ifdef ROCKBOX + (void) x; + (void) s; +#endif + iemgui->x_ldx = (int)atom_getintarg(0, ac, av); iemgui->x_ldy = (int)atom_getintarg(1, ac, av); + +#ifndef ROCKBOX if(glist_isvisible(iemgui->x_glist)) sys_vgui(".x%x.c coords %xLABEL %d %d\n", glist_getcanvas(iemgui->x_glist), x, iemgui->x_obj.te_xpix+iemgui->x_ldx, iemgui->x_obj.te_ypix+iemgui->x_ldy); +#endif } void iemgui_label_font(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av) { int f = (int)atom_getintarg(0, ac, av); +#ifdef ROCKBOX + (void) x; + (void) s; +#endif + if(f == 1) strcpy(iemgui->x_font, "helvetica"); else if(f == 2) strcpy(iemgui->x_font, "times"); else @@ -439,9 +489,11 @@ void iemgui_label_font(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *a if(f < 4) f = 4; iemgui->x_fontsize = f; +#ifndef ROCKBOX if(glist_isvisible(iemgui->x_glist)) sys_vgui(".x%x.c itemconfigure %xLABEL -font {%s %d bold}\n", glist_getcanvas(iemgui->x_glist), x, iemgui->x_font, iemgui->x_fontsize); +#endif } void iemgui_size(void *x, t_iemgui *iemgui) @@ -455,6 +507,9 @@ void iemgui_size(void *x, t_iemgui *iemgui) void iemgui_delta(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av) { +#ifdef ROCKBOX + (void) s; +#endif iemgui->x_obj.te_xpix += (int)atom_getintarg(0, ac, av); iemgui->x_obj.te_ypix += (int)atom_getintarg(1, ac, av); if(glist_isvisible(iemgui->x_glist)) @@ -466,6 +521,9 @@ void iemgui_delta(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av) void iemgui_pos(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av) { +#ifdef ROCKBOX + (void) s; +#endif iemgui->x_obj.te_xpix = (int)atom_getintarg(0, ac, av); iemgui->x_obj.te_ypix = (int)atom_getintarg(1, ac, av); if(glist_isvisible(iemgui->x_glist)) @@ -477,6 +535,9 @@ void iemgui_pos(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av) void iemgui_color(void *x, t_iemgui *iemgui, t_symbol *s, int ac, t_atom *av) { +#ifdef ROCKBOX + (void) s; +#endif iemgui->x_bcol = iemgui_compatible_col(atom_getintarg(0, ac, av)); if(ac > 2) { @@ -561,21 +622,36 @@ int iemgui_dialog(t_iemgui *iemgui, t_symbol **srl, int argc, t_atom *argv) srl[0] = atom_getsymbolarg(7, argc, argv); else if(IS_A_FLOAT(argv,7)) { +#ifdef ROCKBOX + snprintf(str, sizeof(str)-1, + "%d", (int)atom_getintarg(7, argc, argv)); +#else sprintf(str, "%d", (int)atom_getintarg(7, argc, argv)); +#endif srl[0] = gensym(str); } if(IS_A_SYMBOL(argv,8)) srl[1] = atom_getsymbolarg(8, argc, argv); else if(IS_A_FLOAT(argv,8)) { +#ifdef ROCKBOX + snprintf(str, sizeof(str)-1, + "%d", (int)atom_getintarg(8, argc, argv)); +#else sprintf(str, "%d", (int)atom_getintarg(8, argc, argv)); +#endif srl[1] = gensym(str); } if(IS_A_SYMBOL(argv,9)) srl[2] = atom_getsymbolarg(9, argc, argv); else if(IS_A_FLOAT(argv,9)) { +#ifdef ROCKBOX + snprintf(str, sizeof(str)-1, + "%d", (int)atom_getintarg(9, argc, argv)); +#else sprintf(str, "%d", (int)atom_getintarg(9, argc, argv)); +#endif srl[2] = gensym(str); } if(init != 0) init = 1; diff --git a/apps/plugins/pdbox/PDa/src/g_array.c b/apps/plugins/pdbox/PDa/src/g_array.c index 3e2225637a..b6870b6117 100644 --- a/apps/plugins/pdbox/PDa/src/g_array.c +++ b/apps/plugins/pdbox/PDa/src/g_array.c @@ -2,12 +2,22 @@ * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#include "m_pd.h" +#include "g_canvas.h" +#ifdef SIMULATOR +int printf(const char *fmt, ...); +#endif /* SIMULATOR */ +#else /* ROCKBOX */ #include #include #include /* for read/write to files */ #include "m_pd.h" #include "g_canvas.h" #include +#endif /* ROCKBOX */ /* see also the "plot" object in g_scalar.c which deals with graphing arrays which are fields in scalars. Someday we should unify the @@ -40,7 +50,9 @@ t_array *array_new(t_symbol *templatesym, t_gpointer *parent) { t_array *x = (t_array *)getbytes(sizeof (*x)); t_template *template; +#ifndef ROCKBOX t_gpointer *gp; +#endif template = template_findbyname(templatesym); x->a_templatesym = templatesym; x->a_n = 1; @@ -59,7 +71,9 @@ t_array *array_new(t_symbol *templatesym, t_gpointer *parent) void array_resize(t_array *x, t_template *template, int n) { int elemsize, oldn; +#ifndef ROCKBOX t_gpointer *gp; +#endif if (n < 1) n = 1; @@ -135,7 +149,11 @@ t_garray *graph_array(t_glist *gl, t_symbol *s, t_symbol *templatesym, if (s == &s_) { char buf[40]; +#ifdef ROCKBOX + snprintf(buf, sizeof(buf)-1, "array%d", ++gcount); +#else sprintf(buf, "array%d", ++gcount); +#endif s = gensym(buf); templatesym = &s_float; n = 100; @@ -179,7 +197,7 @@ t_garray *graph_array(t_glist *gl, t_symbol *s, t_symbol *templatesym, x->x_glist = gl; x->x_usedindsp = 0; x->x_saveit = (saveit != 0); - if (x2 = pd_findbyclass(gensym("#A"), garray_class)) + if((x2 = pd_findbyclass(gensym("#A"), garray_class))) pd_unbind(x2, gensym("#A")); pd_bind(&x->x_gobj.g_pd, gensym("#A")); @@ -190,16 +208,23 @@ t_garray *graph_array(t_glist *gl, t_symbol *s, t_symbol *templatesym, /* called from array menu item to create a new one */ void canvas_menuarray(t_glist *canvas) { +#ifdef ROCKBOX + (void) canvas; +#else /* ROCKBOX */ t_glist *x = (t_glist *)canvas; char cmdbuf[200]; sprintf(cmdbuf, "pdtk_array_dialog %%s array%d 100 1 1\n", ++gcount); gfxstub_new(&x->gl_pd, x, cmdbuf); +#endif /* ROCKBOX */ } /* called from graph_dialog to set properties */ void garray_properties(t_garray *x) { +#ifdef ROCKBOX + (void) x; +#else /* ROCKBOX */ char cmdbuf[200]; gfxstub_deleteforkey(x); /* create dialog window. LATER fix this to escape '$' @@ -211,6 +236,7 @@ void garray_properties(t_garray *x) else sprintf(cmdbuf, "pdtk_array_dialog %%s %s %d %d 0\n", x->x_name->s_name, x->x_n, x->x_saveit); gfxstub_new(&x->x_gobj.g_pd, x, cmdbuf); +#endif /* ROCKBOX */ } /* this is called back from the dialog window to create a garray. @@ -260,10 +286,12 @@ void garray_arraydialog(t_garray *x, t_symbol *name, t_floatarg fsize, static void garray_free(t_garray *x) { t_pd *x2; +#ifndef ROCKBOX gfxstub_deleteforkey(x); +#endif pd_unbind(&x->x_gobj.g_pd, x->x_realname); /* LATER find a way to get #A unbound earlier (at end of load?) */ - while (x2 = pd_findbyclass(gensym("#A"), garray_class)) + while((x2 = pd_findbyclass(gensym("#A"), garray_class))) pd_unbind(x2, gensym("#A")); freebytes(x->x_vec, x->x_n * x->x_elemsize); } @@ -308,7 +336,9 @@ static t_word *array_motion_wp; static t_template *array_motion_template; static int array_motion_npoints; static int array_motion_elemsize; +#ifndef ROCKBOX static int array_motion_altkey; +#endif static float array_motion_initx; static float array_motion_xperpix; static float array_motion_yperpix; @@ -320,6 +350,9 @@ static int array_motion_fatten; static void array_motion(void *z, t_floatarg dx, t_floatarg dy) { +#ifdef ROCKBOX + (void) z; +#endif array_motion_xcumulative += dx * array_motion_xperpix; array_motion_ycumulative += dy * array_motion_yperpix; if (*array_motion_xfield->s_name) @@ -402,6 +435,12 @@ int array_doclick(t_array *array, t_glist *glist, t_gobj *gobj, t_template *elemtemplate; int elemsize, yonset, wonset, xonset, i; +#ifdef ROCKBOX + (void) linewidth; + (void) shift; + (void) dbl; +#endif + if (!array_getfields(elemtemplatesym, &elemtemplatecanvas, &elemtemplate, &elemsize, &xonset, &yonset, &wonset)) { @@ -575,7 +614,11 @@ static void garray_getrect(t_gobj *z, t_glist *glist, else incr = x->x_array.a_n / 300; for (i = 0; i < x->x_array.a_n; i += incr) { +#ifdef ROCKBOX + float pxpix, pypix, pwpix; +#else /* ROCKBOX */ float pxpix, pypix, pwpix, dx, dy; +#endif /* ROCKBOX */ array_getcoordinate(glist, (char *)(x->x_array.a_vec) + i * elemsize, xonset, yonset, wonset, i, 0, 0, 1, @@ -600,21 +643,42 @@ static void garray_getrect(t_gobj *z, t_glist *glist, static void garray_displace(t_gobj *z, t_glist *glist, int dx, int dy) { +#ifdef ROCKBOX + (void) z; + (void) glist; + (void) dx; + (void) dy; +#endif /* refuse */ } static void garray_select(t_gobj *z, t_glist *glist, int state) { +#ifdef ROCKBOX + (void) z; + (void) glist; + (void) state; +#else /* ROCKBOX */ t_garray *x = (t_garray *)z; +#endif /* ROCKBOX */ /* fill in later */ } static void garray_activate(t_gobj *z, t_glist *glist, int state) { +#ifdef ROCKBOX + (void) z; + (void) glist; + (void) state; +#endif } static void garray_delete(t_gobj *z, t_glist *glist) { +#ifdef ROCKBOX + (void) z; + (void) glist; +#endif /* nothing to do */ } @@ -633,9 +697,11 @@ static void garray_vis(t_gobj *z, t_glist *glist, int vis) { error("%s: needs floating-point 'y' field", x->x_templatesym->s_name); +#ifndef ROCKBOX sys_vgui(".x%x.c create text 50 50 -text foo\ -tags .x%x.a%x\n", glist_getcanvas(glist), glist_getcanvas(glist), x); +#endif } else if (!template_find_field(template, gensym("x"), &xonset, &type, &arraytype) || type != DT_FLOAT) @@ -644,7 +710,9 @@ static void garray_vis(t_gobj *z, t_glist *glist, int vis) int lastpixel = -1, ndrawn = 0; float yval = 0, xpix; int ixpix = 0; +#ifndef ROCKBOX sys_vgui(".x%x.c create line \\\n", glist_getcanvas(glist)); +#endif for (i = 0; i < x->x_n; i++) { yval = fixtof(*(t_sample *)(x->x_vec + @@ -653,8 +721,10 @@ static void garray_vis(t_gobj *z, t_glist *glist, int vis) ixpix = xpix + 0.5; if (ixpix != lastpixel) { +#ifndef ROCKBOX sys_vgui("%d %f \\\n", ixpix, glist_ytopixels(glist, yval)); +#endif ndrawn++; } lastpixel = ixpix; @@ -662,11 +732,14 @@ static void garray_vis(t_gobj *z, t_glist *glist, int vis) xcum += x->x_xinc; } /* TK will complain if there aren't at least 2 points... */ +#ifndef ROCKBOX if (ndrawn == 0) sys_vgui("0 0 0 0 \\\n"); else if (ndrawn == 1) sys_vgui("%d %f \\\n", ixpix, glist_ytopixels(glist, yval)); sys_vgui("-tags .x%x.a%x\n", glist_getcanvas(glist), x); +#endif firsty = fixtof(*(t_sample *)(x->x_vec + yonset)); +#ifndef ROCKBOX sys_vgui(".x%x.c create text %f %f -text {%s} -anchor e\ -font -*-courier-bold--normal--%d-* -tags .x%x.a%x\n", glist_getcanvas(glist), @@ -674,6 +747,7 @@ static void garray_vis(t_gobj *z, t_glist *glist, int vis) glist_ytopixels(glist, firsty), x->x_name->s_name, glist_getfont(glist), glist_getcanvas(glist), x); +#endif } else { @@ -682,8 +756,10 @@ static void garray_vis(t_gobj *z, t_glist *glist, int vis) } else { +#ifndef ROCKBOX sys_vgui(".x%x.c delete .x%x.a%x\n", glist_getcanvas(glist), glist_getcanvas(glist), x); +#endif } } @@ -702,7 +778,13 @@ static void garray_save(t_gobj *z, t_binbuf *b) t_garray *x = (t_garray *)z; binbuf_addv(b, "sssisi;", gensym("#X"), gensym("array"), x->x_name, x->x_n, x->x_templatesym, x->x_saveit); +#ifdef ROCKBOX +#ifdef SIMULATOR + printf("array save\n"); +#endif /* SIMULATOR */ +#else /* ROCKBOX */ fprintf(stderr,"array save\n"); +#endif /* ROCKBOX */ if (x->x_saveit) { int n = x->x_n, n2 = 0; @@ -877,7 +959,11 @@ static void garray_dofo(t_garray *x, int npoints, float dcval, static void garray_sinesum(t_garray *x, t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; +#else t_template *template = garray_template(x); +#endif t_float *svec = (t_float *)t_getbytes(sizeof(t_float) * argc); int npoints, i; @@ -902,7 +988,11 @@ static void garray_sinesum(t_garray *x, t_symbol *s, int argc, t_atom *argv) static void garray_cosinesum(t_garray *x, t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; +#else t_template *template = garray_template(x); +#endif t_float *svec = (t_float *)t_getbytes(sizeof(t_float) * argc); int npoints, i; @@ -928,7 +1018,11 @@ static void garray_cosinesum(t_garray *x, t_symbol *s, int argc, t_atom *argv) static void garray_normalize(t_garray *x, t_float f) { t_template *template = garray_template(x); +#ifdef ROCKBOX + int yonset, type, i; +#else int yonset, type, npoints, i; +#endif double maxv, renormer; t_symbol *arraytype; @@ -968,6 +1062,9 @@ static void garray_list(t_garray *x, t_symbol *s, int argc, t_atom *argv) t_template *template = garray_template(x); int yonset, type, i; t_symbol *arraytype; +#ifdef ROCKBOX + (void) s; +#endif if (!template_find_field(template, gensym("y"), &yonset, &type, &arraytype) || type != DT_FLOAT) error("%s: needs floating-point 'y' field", @@ -1038,7 +1135,11 @@ static void garray_rename(t_garray *x, t_symbol *s) static void garray_read(t_garray *x, t_symbol *filename) { int nelem = x->x_n, filedesc; +#ifdef ROCKBOX + int fd = 0; +#else FILE *fd; +#endif char buf[MAXPDSTRING], *bufptr; t_template *template = garray_template(x); int yonset, type, i; @@ -1052,15 +1153,23 @@ static void garray_read(t_garray *x, t_symbol *filename) if ((filedesc = open_via_path( canvas_getdir(glist_getcanvas(x->x_glist))->s_name, filename->s_name, "", buf, &bufptr, MAXPDSTRING, 0)) < 0 +#ifdef ROCKBOX + ) +#else || !(fd = fdopen(filedesc, "r"))) +#endif { error("%s: can't open", filename->s_name); return; } for (i = 0; i < nelem; i++) { +#ifdef ROCKBOX + if(rb_fscanf_f(fd, (float*)((x->x_vec + sizeof(t_word) * i) + yonset))) +#else if (!fscanf(fd, "%f", (float *)((x->x_vec + sizeof(t_word) * i) + yonset))) +#endif { post("%s: read %d elements into table of size %d", filename->s_name, i, nelem); @@ -1069,7 +1178,11 @@ static void garray_read(t_garray *x, t_symbol *filename) } while (i < nelem) *(float *)((x->x_vec + sizeof(t_word) * i) + yonset) = 0, i++; +#ifdef ROCKBOX + close(fd); +#else fclose(fd); +#endif garray_redraw(x); } @@ -1090,7 +1203,11 @@ static void garray_read16(t_garray *x, t_symbol *filename, int skip = fskip, filedesc; int i, nelem; t_sample *vec; +#ifdef ROCKBOX + int fd = 0; +#else FILE *fd; +#endif char buf[MAXPDSTRING], *bufptr; short s; int cpubig = garray_ambigendian(), swap = 0; @@ -1116,25 +1233,41 @@ static void garray_read16(t_garray *x, t_symbol *filename, if ((filedesc = open_via_path( canvas_getdir(glist_getcanvas(x->x_glist))->s_name, filename->s_name, "", buf, &bufptr, MAXPDSTRING, 1)) < 0 +#ifdef ROCKBOX + ) +#else || !(fd = fdopen(filedesc, BINREADMODE))) +#endif { error("%s: can't open", filename->s_name); return; } if (skip) { +#ifdef ROCKBOX + long pos = lseek(fd, (long)skip, SEEK_SET); +#else long pos = fseek(fd, (long)skip, SEEK_SET); +#endif if (pos < 0) { error("%s: can't seek to byte %d", buf, skip); +#ifdef ROCKBOX + close(fd); +#else fclose(fd); +#endif return; } } for (i = 0; i < nelem; i++) { +#ifdef ROCKBOX + if(read(fd, &s, sizeof(s)) < 1) +#else if (fread(&s, sizeof(s), 1, fd) < 1) +#endif { post("%s: read %d elements into table of size %d", filename->s_name, i, nelem); @@ -1144,13 +1277,21 @@ static void garray_read16(t_garray *x, t_symbol *filename, vec[i] = s * (1./32768.); } while (i < nelem) vec[i++] = 0; +#ifdef ROCKBOX + close(fd); +#else fclose(fd); +#endif garray_redraw(x); } static void garray_write(t_garray *x, t_symbol *filename) { +#ifdef ROCKBOX + int fd; +#else FILE *fd; +#endif char buf[MAXPDSTRING]; t_template *template = garray_template(x); int yonset, type, i; @@ -1164,21 +1305,33 @@ static void garray_write(t_garray *x, t_symbol *filename) canvas_makefilename(glist_getcanvas(x->x_glist), filename->s_name, buf, MAXPDSTRING); sys_bashfilename(buf, buf); +#ifdef ROCKBOX + if(!(fd = open(buf, O_WRONLY|O_CREAT|O_TRUNC))) +#else if (!(fd = fopen(buf, "w"))) +#endif { error("%s: can't create", buf); return; } for (i = 0; i < x->x_n; i++) { +#ifdef ROCKBOX + if(rb_fprintf_f(fd, +#else /* ROCKBOX */ if (fprintf(fd, "%g\n", +#endif /* ROCKBOX */ *(float *)((x->x_vec + sizeof(t_word) * i) + yonset)) < 1) { post("%s: write error", filename->s_name); break; } } +#ifdef ROCKBOX + close(fd); +#else fclose(fd); +#endif } static unsigned char waveheader[] = { @@ -1203,7 +1356,11 @@ static void garray_write16(t_garray *x, t_symbol *filename, t_symbol *format) t_template *template = garray_template(x); int yonset, type, i; t_symbol *arraytype; +#ifdef ROCKBOX + int fd; +#else FILE *fd; +#endif int aiff = (format == gensym("aiff")); char filenamebuf[MAXPDSTRING], buf2[MAXPDSTRING]; int swap = garray_ambigendian(); /* wave is only little endian */ @@ -1230,7 +1387,11 @@ static void garray_write16(t_garray *x, t_symbol *filename, t_symbol *format) canvas_makefilename(glist_getcanvas(x->x_glist), filenamebuf, buf2, MAXPDSTRING); sys_bashfilename(buf2, buf2); +#ifdef ROCKBOX + if(!(fd = open(buf2, O_WRONLY|O_CREAT|O_TRUNC))) +#else if (!(fd = fopen(buf2, BINWRITEMODE))) +#endif { error("%s: can't create", buf2); return; @@ -1251,7 +1412,11 @@ static void garray_write16(t_garray *x, t_symbol *filename, t_symbol *format) xxx = foo[1]; foo[1] = foo[2]; foo[2] = xxx; } memcpy((void *)(waveheader + 40), (void *)(&intbuf), 4); +#ifdef ROCKBOX + if(write(fd, waveheader, sizeof(waveheader)) < 1) +#else if (fwrite(waveheader, sizeof(waveheader), 1, fd) < 1) +#endif { post("%s: write error", buf2); goto closeit; @@ -1268,21 +1433,31 @@ static void garray_write16(t_garray *x, t_symbol *filename, t_symbol *format) unsigned char *foo = (unsigned char *)&sh, xxx; xxx = foo[0]; foo[0] = foo[1]; foo[1] = xxx; } +#ifdef ROCKBOX + if(write(fd, &sh, sizeof(sh)) < 1) +#else if (fwrite(&sh, sizeof(sh), 1, fd) < 1) +#endif { post("%s: write error", buf2); goto closeit; } } closeit: +#ifdef ROCKBOX + close(fd); +#else fclose(fd); +#endif } void garray_resize(t_garray *x, t_floatarg f) { int was = x->x_n, elemsize; t_glist *gl; +#ifndef ROCKBOX int dspwas; +#endif int n = f; char *nvec; @@ -1309,7 +1484,9 @@ void garray_resize(t_garray *x, t_floatarg f) vmess(&gl->gl_pd, gensym("bounds"), "ffff", 0., gl->gl_y1, (double)(n > 1 ? n-1 : 1), gl->gl_y2); /* close any dialogs that might have the wrong info now... */ +#ifndef ROCKBOX gfxstub_deleteforkey(gl); +#endif } else garray_redraw(x); if (x->x_usedindsp) canvas_update_dsp(); diff --git a/apps/plugins/pdbox/PDa/src/g_bang.c b/apps/plugins/pdbox/PDa/src/g_bang.c index 6556f7019a..ce1bed9c9a 100644 --- a/apps/plugins/pdbox/PDa/src/g_bang.c +++ b/apps/plugins/pdbox/PDa/src/g_bang.c @@ -5,7 +5,13 @@ /* g_7_guis.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */ /* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */ - +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#include "m_pd.h" +#include "g_canvas.h" +#include "g_all_guis.h" +#else /* ROCKBOX */ #include #include #include @@ -21,6 +27,7 @@ #else #include #endif +#endif /* ROCKBOX */ /* --------------- bng gui-bang ------------------------- */ @@ -33,15 +40,24 @@ static t_class *bng_class; void bng_draw_update(t_bng *x, t_glist *glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ if(glist_isvisible(glist)) { sys_vgui(".x%x.c itemconfigure %xBUT -fill #%6.6x\n", glist_getcanvas(glist), x, x->x_flashed?x->x_gui.x_fcol:x->x_gui.x_bcol); } +#endif /* ROCKBOX */ } void bng_draw_new(t_bng *x, t_glist *glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ int xpos=text_xpix(&x->x_gui.x_obj, glist); int ypos=text_ypix(&x->x_gui.x_obj, glist); t_canvas *canvas=glist_getcanvas(glist); @@ -69,10 +85,15 @@ void bng_draw_new(t_bng *x, t_glist *glist) sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xIN%d\n", canvas, xpos, ypos, xpos + IOWIDTH, ypos+1, x, 0); +#endif /* ROCKBOX */ } void bng_draw_move(t_bng *x, t_glist *glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ int xpos=text_xpix(&x->x_gui.x_obj, glist); int ypos=text_ypix(&x->x_gui.x_obj, glist); t_canvas *canvas=glist_getcanvas(glist); @@ -96,10 +117,15 @@ void bng_draw_move(t_bng *x, t_glist *glist) sys_vgui(".x%x.c coords %xIN%d %d %d %d %d\n", canvas, x, 0, xpos, ypos, xpos + IOWIDTH, ypos+1); +#endif /* ROCKBOX */ } void bng_draw_erase(t_bng* x, t_glist* glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ t_canvas *canvas=glist_getcanvas(glist); sys_vgui(".x%x.c delete %xBASE\n", canvas, x); @@ -109,10 +135,15 @@ void bng_draw_erase(t_bng* x, t_glist* glist) sys_vgui(".x%x.c delete %xOUT%d\n", canvas, x, 0); if(!x->x_gui.x_fsf.x_rcv_able) sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); +#endif /* ROCKBOX */ } void bng_draw_config(t_bng* x, t_glist* glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ t_canvas *canvas=glist_getcanvas(glist); sys_vgui(".x%x.c itemconfigure %xLABEL -font {%s %d bold} -fill #%6.6x -text {%s} \n", @@ -122,10 +153,16 @@ void bng_draw_config(t_bng* x, t_glist* glist) sys_vgui(".x%x.c itemconfigure %xBASE -fill #%6.6x\n", canvas, x, x->x_gui.x_bcol); sys_vgui(".x%x.c itemconfigure %xBUT -fill #%6.6x\n", canvas, x, x->x_flashed?x->x_gui.x_fcol:x->x_gui.x_bcol); +#endif /* ROCKBOX */ } void bng_draw_io(t_bng* x, t_glist* glist, int old_snd_rcv_flags) { +#ifdef ROCKBOX + (void) x; + (void) glist; + (void) old_snd_rcv_flags; +#else /* ROCKBOX */ int xpos=text_xpix(&x->x_gui.x_obj, glist); int ypos=text_ypix(&x->x_gui.x_obj, glist); t_canvas *canvas=glist_getcanvas(glist); @@ -143,10 +180,15 @@ void bng_draw_io(t_bng* x, t_glist* glist, int old_snd_rcv_flags) xpos + IOWIDTH, ypos+1, x, 0); if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able) sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); +#endif /* ROCKBOX */ } void bng_draw_select(t_bng* x, t_glist* glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ t_canvas *canvas=glist_getcanvas(glist); if(x->x_gui.x_fsf.x_selected) @@ -161,6 +203,7 @@ void bng_draw_select(t_bng* x, t_glist* glist) sys_vgui(".x%x.c itemconfigure %xBUT -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL); sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol); } +#endif /* ROCKBOX */ } void bng_draw(t_bng *x, t_glist *glist, int mode) @@ -232,6 +275,10 @@ void bng_check_minmax(t_bng *x, int ftbreak, int fthold) static void bng_properties(t_gobj *z, t_glist *owner) { +#ifdef ROCKBOX + (void) z; + (void) owner; +#else /* ROCKBOX */ t_bng *x = (t_bng *)z; char buf[800]; t_symbol *srl[3]; @@ -253,6 +300,7 @@ static void bng_properties(t_gobj *z, t_glist *owner) x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize, 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol); gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); +#endif /* ROCKBOX */ } static void bng_set(t_bng *x) @@ -316,6 +364,9 @@ static void bng_bang2(t_bng *x)/*wird immer gesendet, wenn moeglich*/ static void bng_dialog(t_bng *x, t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; +#endif t_symbol *srl[3]; int a = (int)atom_getintarg(0, argc, argv); int fthold = (int)atom_getintarg(2, argc, argv); @@ -333,33 +384,84 @@ static void bng_dialog(t_bng *x, t_symbol *s, int argc, t_atom *argv) static void bng_click(t_bng *x, t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl, t_floatarg alt) { +#ifdef ROCKBOX + (void) xpos; + (void) ypos; + (void) shift; + (void) ctrl; + (void) alt; +#endif bng_set(x); bng_bout2(x); } static int bng_newclick(t_gobj *z, struct _glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit) { +#ifdef ROCKBOX + (void) glist; + (void) dbl; +#endif if(doit) bng_click((t_bng *)z, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift, 0, (t_floatarg)alt); return (1); } static void bng_float(t_bng *x, t_floatarg f) +#ifdef ROCKBOX +{ + (void) f; + + bng_bang2(x); +} +#else /* ROCKBOX */ {bng_bang2(x);} +#endif /* ROCKBOX */ static void bng_symbol(t_bng *x, t_symbol *s) +#ifdef ROCKBOX +{ + (void) s; + + bng_bang2(x); +} +#else /* ROCKBOX */ {bng_bang2(x);} +#endif /* ROCKBOX */ static void bng_pointer(t_bng *x, t_gpointer *gp) +#ifdef ROCKBOX +{ + (void) gp; + + bng_bang2(x); +} +#else /* ROCKBOX */ {bng_bang2(x);} +#endif /* ROCKBOX */ static void bng_list(t_bng *x, t_symbol *s, int ac, t_atom *av) { +#ifdef ROCKBOX + (void) s; + (void) ac; + (void) av; +#endif /* ROCKBOX */ + bng_bang2(x); } static void bng_anything(t_bng *x, t_symbol *s, int argc, t_atom *argv) +#ifdef ROCKBOX +{ + (void) s; + (void) argc; + (void) argv; + + bng_bang2(x); +} +#else /* ROCKBOX */ {bng_bang2(x);} +#endif /* ROCKBOX */ static void bng_loadbang(t_bng *x) { @@ -372,6 +474,9 @@ static void bng_loadbang(t_bng *x) static void bng_size(t_bng *x, t_symbol *s, int ac, t_atom *av) { +#ifdef ROCKBOX + (void) s; +#endif x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av)); x->x_gui.x_h = x->x_gui.x_w; iemgui_size((void *)x, &x->x_gui); @@ -385,6 +490,9 @@ static void bng_pos(t_bng *x, t_symbol *s, int ac, t_atom *av) static void bng_flashtime(t_bng *x, t_symbol *s, int ac, t_atom *av) { +#ifdef ROCKBOX + (void) s; +#endif bng_check_minmax(x, (int)atom_getintarg(0, ac, av), (int)atom_getintarg(1, ac, av)); } @@ -437,7 +545,11 @@ static void *bng_new(t_symbol *s, int argc, t_atom *argv) int fs=8; int ftbreak=IEM_BNG_DEFAULTBREAKFLASHTIME, fthold=IEM_BNG_DEFAULTHOLDFLASHTIME; +#ifdef ROCKBOX + (void) s; +#else char str[144]; +#endif iem_inttosymargs(&x->x_gui.x_isa, 0); iem_inttofstyle(&x->x_gui.x_fsf, 0); @@ -511,7 +623,9 @@ static void bng_ff(t_bng *x) clock_free(x->x_clock_lck); clock_free(x->x_clock_brk); clock_free(x->x_clock_hld); +#ifndef ROCKBOX gfxstub_deleteforkey(x); +#endif } void g_bang_setup(void) diff --git a/apps/plugins/pdbox/PDa/src/g_canvas.c b/apps/plugins/pdbox/PDa/src/g_canvas.c index f8b8dda0cf..19c10474c1 100644 --- a/apps/plugins/pdbox/PDa/src/g_canvas.c +++ b/apps/plugins/pdbox/PDa/src/g_canvas.c @@ -18,6 +18,15 @@ to be different but are now unified except for some fossilized names.) */ * changes marked with IOhannes */ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#include "m_pd.h" +#include "m_imp.h" +#include "s_stuff.h" +#include "g_canvas.h" +#include "g_all_guis.h" +#else /* ROCKBOX */ #include #include #include "m_pd.h" @@ -26,6 +35,7 @@ to be different but are now unified except for some fossilized names.) */ #include "g_canvas.h" #include #include "g_all_guis.h" +#endif /* ROCKBOX */ struct _canvasenvironment { @@ -83,7 +93,12 @@ static void glist_doupdatewindowlist(t_glist *gl, char *sbuf) if (strlen(sbuf) + strlen(gl->gl_name->s_name) + 100 <= 1024) { char tbuf[1024]; +#ifdef ROCKBOX + snprintf(tbuf, sizeof(tbuf)-1, + "{%s .x%x} ", gl->gl_name->s_name, (t_int)canvas); +#else /* ROCKBOX */ sprintf(tbuf, "{%s .x%x} ", gl->gl_name->s_name, (t_int)canvas); +#endif /* ROCKBOX */ strcat(sbuf, tbuf); } } @@ -107,7 +122,9 @@ void canvas_updatewindowlist( void) glist_doupdatewindowlist(x, sbuf); /* next line updates the window menu state before -postcommand tries it */ strcat(sbuf, "}\npdtk_fixwindowmenu\n"); +#ifndef ROCKBOX sys_gui(sbuf); +#endif } /* add a glist the list of "root" canvases (toplevels without parents.) */ @@ -144,6 +161,9 @@ void canvas_setargs(int argc, t_atom *argv) void glob_setfilename(void *dummy, t_symbol *filesym, t_symbol *dirsym) { +#ifdef ROCKBOX + (void) dummy; +#endif canvas_newfilename = filesym; canvas_newdirectory = dirsym; } @@ -286,7 +306,7 @@ t_outconnect *linetraverser_next(t_linetraverser *t) if (!t->tr_ob) y = t->tr_x->gl_list; else y = t->tr_ob->ob_g.g_next; for (; y; y = y->g_next) - if (ob = pd_checkobject(&y->g_pd)) break; + if((ob = pd_checkobject(&y->g_pd))) break; if (!ob) return (0); t->tr_ob = ob; t->tr_nout = obj_noutlets(ob); @@ -357,7 +377,13 @@ t_canvas *canvas_new(void *dummy, t_symbol *sel, int argc, t_atom *argv) t_symbol *s = &s_; int vis = 0, width = GLIST_DEFCANVASWIDTH, height = GLIST_DEFCANVASHEIGHT; int xloc = 0, yloc = GLIST_DEFCANVASYLOC; +#ifdef ROCKBOX + (void) dummy; + (void) sel; + int font = 10; +#else /* ROCKBOX */ int font = (owner ? owner->gl_font : sys_defaultfont); +#endif /* ROCKBOX */ glist_init(x); x->gl_obj.te_type = T_OBJECT; if (!owner) @@ -415,7 +441,11 @@ t_canvas *canvas_new(void *dummy, t_symbol *sel, int argc, t_atom *argv) x->gl_loading = 1; x->gl_willvis = vis; x->gl_edit = !strncmp(x->gl_name->s_name, "Untitled", 8); +#ifdef ROCKBOX + x->gl_font = 10; +#else /* ROCKBOX */ x->gl_font = sys_nearestfontsize(font); +#endif /* ROCKBOX */ pd_pushsym(&x->gl_pd); return(x); } @@ -424,6 +454,9 @@ void canvas_setgraph(t_glist *x, int flag); static void canvas_coords(t_glist *x, t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; +#endif x->gl_x1 = atom_getfloatarg(0, argc, argv); x->gl_y1 = atom_getfloatarg(1, argc, argv); x->gl_x2 = atom_getfloatarg(2, argc, argv); @@ -449,7 +482,11 @@ t_glist *glist_addglist(t_glist *g, t_symbol *sym, if (!*sym->s_name) { char buf[40]; +#ifdef ROCKBOX + snprintf(buf, sizeof(buf)-1, "graph%d", ++gcount); +#else /* ROCKBOX */ sprintf(buf, "graph%d", ++gcount); +#endif /* ROCKBOX */ sym = gensym(buf); menu = 1; } @@ -484,8 +521,12 @@ t_glist *glist_addglist(t_glist *g, t_symbol *sym, x->gl_obj.te_ypix = py1; x->gl_pixwidth = px2 - px1; x->gl_pixheight = py2 - py1; +#ifdef ROCKBOX + x->gl_font = 10; +#else /* ROCKBOX */ x->gl_font = (canvas_getcurrent() ? canvas_getcurrent()->gl_font : sys_defaultfont); +#endif /* ROCKBOX */ x->gl_screenx1 = x->gl_screeny1 = 0; x->gl_screenx2 = 240; x->gl_screeny2 = 300; @@ -507,6 +548,9 @@ t_glist *glist_addglist(t_glist *g, t_symbol *sym, /* call glist_addglist from a Pd message */ void glist_glist(t_glist *g, t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; +#endif t_symbol *sym = atom_getsymbolarg(0, argc, argv); float x1 = atom_getfloatarg(1, argc, argv); float y1 = atom_getfloatarg(2, argc, argv); @@ -584,9 +628,11 @@ void canvas_reflecttitle(t_canvas *x) strcat(namebuf, ")"); } else namebuf[0] = 0; +#ifndef ROCKBOX sys_vgui("wm title .x%x {%s%c%s - %s}\n", x, x->gl_name->s_name, (x->gl_dirty? '*' : ' '), namebuf, canvas_getdir(x)->s_name); +#endif } void canvas_dirty(t_canvas *x, t_int n) @@ -624,7 +670,9 @@ void canvas_map(t_canvas *x, t_floatarg f) canvas_drawlines(x); /* simulate a mouse up so u_main will calculate scrollbars... ugly! */ +#ifndef ROCKBOX sys_vgui("pdtk_canvas_mouseup .x%x.c 0 0 0\n", x); +#endif } } else @@ -632,7 +680,9 @@ void canvas_map(t_canvas *x, t_floatarg f) if (glist_isvisible(x)) { /* just clear out the whole canvas... */ +#ifndef ROCKBOX sys_vgui(".x%x.c delete all\n", x); +#endif /* alternatively, we could have erased them one by one... for (y = x->gl_list; y; y = y->g_next) gobj_vis(y, x, 0); @@ -661,7 +711,11 @@ static t_editor *editor_new(t_glist *owner) x->e_connectbuf = binbuf_new(); x->e_deleted = binbuf_new(); x->e_glist = owner; +#ifdef ROCKBOX + snprintf(buf, sizeof(buf)-1, ".x%x", (t_int)owner); +#else /* ROCKBOX */ sprintf(buf, ".x%x", (t_int)owner); +#endif /* ROCKBOX */ x->e_guiconnect = guiconnect_new(&owner->gl_pd, gensym(buf)); return (x); } @@ -689,7 +743,7 @@ void canvas_create_editor(t_glist *x, int createit) { x->gl_editor = editor_new(x); for (y = x->gl_list; y; y = y->g_next) - if (ob = pd_checkobject(&y->g_pd)) + if((ob = pd_checkobject(&y->g_pd))) rtext_new(x, ob); } } @@ -700,7 +754,7 @@ void canvas_create_editor(t_glist *x, int createit) else { for (y = x->gl_list; y; y = y->g_next) - if (ob = pd_checkobject(&y->g_pd)) + if((ob = pd_checkobject(&y->g_pd))) rtext_free(glist_findrtext(x, ob)); editor_free(x->gl_editor, x); x->gl_editor = 0; @@ -717,7 +771,9 @@ void canvas_create_editor(t_glist *x, int createit) the window. */ void canvas_vis(t_canvas *x, t_floatarg f) { +#ifndef ROCKBOX char buf[30]; +#endif int flag = (f != 0); if (flag) { @@ -728,19 +784,23 @@ void canvas_vis(t_canvas *x, t_floatarg f) canvas_vis(x, 0); canvas_vis(x, 1); #else +#ifndef ROCKBOX sys_vgui("raise .x%x\n", x); sys_vgui("focus .x%x.c\n", x); sys_vgui("wm deiconify .x%x\n", x); +#endif /* ROCKBOX */ #endif } else { canvas_create_editor(x, 1); +#ifndef ROCKBOX sys_vgui("pdtk_canvas_new .x%x %d %d +%d+%d %d\n", x, (int)(x->gl_screenx2 - x->gl_screenx1), (int)(x->gl_screeny2 - x->gl_screeny1), (int)(x->gl_screenx1), (int)(x->gl_screeny1), x->gl_edit); +#endif /* ROCKBOX */ canvas_reflecttitle(x); x->gl_havewindow = 1; canvas_updatewindowlist(); @@ -765,10 +825,14 @@ void canvas_vis(t_canvas *x, t_floatarg f) if (glist_isvisible(x)) canvas_map(x, 0); canvas_create_editor(x, 0); +#ifndef ROCKBOX sys_vgui("destroy .x%x\n", x); +#endif for (i = 1, x2 = x; x2; x2 = x2->gl_next, i++) ; +#ifndef ROCKBOX sys_vgui(".mbar.find delete %d\n", i); +#endif /* if we're a graph on our parent, and if the parent exists and is visible, show ourselves on parent. */ if (glist_isgraph(x) && x->gl_owner) @@ -837,7 +901,7 @@ void canvas_free(t_canvas *x) if (canvas_whichfind == x) canvas_whichfind = 0; glist_noselect(x); - while (y = x->gl_list) + while((y = x->gl_list)) glist_delete(x, y); canvas_vis(x, 0); @@ -850,7 +914,9 @@ void canvas_free(t_canvas *x) } canvas_resume_dsp(dspstate); glist_cleanup(x); +#ifndef ROCKBOX gfxstub_deleteforkey(x); /* probably unnecessary */ +#endif if (!x->gl_owner) canvas_takeofflist(x); } @@ -863,12 +929,16 @@ static void canvas_drawlines(t_canvas *x) t_outconnect *oc; { linetraverser_start(&t, x); - while (oc = linetraverser_next(&t)) + while((oc = linetraverser_next(&t))) +#ifdef ROCKBOX + ; +#else /* ROCKBOX */ sys_vgui(".x%x.c create line %d %d %d %d -width %d -tags l%x\n", glist_getcanvas(x), t.tr_lx1, t.tr_ly1, t.tr_lx2, t.tr_ly2, (outlet_getsymbol(t.tr_outlet) == &s_signal ? 2:1), oc); +#endif /* ROCKBOX */ } } @@ -878,13 +948,15 @@ void canvas_fixlinesfor(t_canvas *x, t_text *text) t_outconnect *oc; linetraverser_start(&t, x); - while (oc = linetraverser_next(&t)) + while((oc = linetraverser_next(&t))) { if (t.tr_ob == text || t.tr_ob2 == text) { +#ifndef ROCKBOX sys_vgui(".x%x.c coords l%x %d %d %d %d\n", glist_getcanvas(x), oc, t.tr_lx1, t.tr_ly1, t.tr_lx2, t.tr_ly2); +#endif } } } @@ -895,14 +967,16 @@ void canvas_deletelinesfor(t_canvas *x, t_text *text) t_linetraverser t; t_outconnect *oc; linetraverser_start(&t, x); - while (oc = linetraverser_next(&t)) + while((oc = linetraverser_next(&t))) { if (t.tr_ob == text || t.tr_ob2 == text) { if (x->gl_editor) { +#ifndef ROCKBOX sys_vgui(".x%x.c delete l%x\n", glist_getcanvas(x), oc); +#endif } obj_disconnect(t.tr_ob, t.tr_outno, t.tr_ob2, t.tr_inno); } @@ -916,15 +990,17 @@ void canvas_deletelinesforio(t_canvas *x, t_text *text, t_linetraverser t; t_outconnect *oc; linetraverser_start(&t, x); - while (oc = linetraverser_next(&t)) + while((oc = linetraverser_next(&t))) { if ((t.tr_ob == text && t.tr_outlet == outp) || (t.tr_ob2 == text && t.tr_inlet == inp)) { if (x->gl_editor) { +#ifndef ROCKBOX sys_vgui(".x%x.c delete l%x\n", glist_getcanvas(x), oc); +#endif } obj_disconnect(t.tr_ob, t.tr_outno, t.tr_ob2, t.tr_inno); } @@ -947,6 +1023,9 @@ void canvas_objfor(t_glist *gl, t_text *x, int argc, t_atom *argv); void canvas_restore(t_canvas *x, t_symbol *s, int argc, t_atom *argv) { /* IOhannes */ t_pd *z; +#ifdef ROCKBOX + (void) s; +#endif /* this should be unnecessary, but sometimes the canvas's name gets out of sync with the owning box's argument; this fixes that */ if (argc > 3) @@ -992,7 +1071,9 @@ void canvas_restore(t_canvas *x, t_symbol *s, int argc, t_atom *argv) static void canvas_loadbangabstractions(t_canvas *x) { t_gobj *y; +#ifndef ROCKBOX t_symbol *s = gensym("loadbang"); +#endif for (y = x->gl_list; y; y = y->g_next) if (pd_class(&y->g_pd) == canvas_class) { @@ -1021,7 +1102,9 @@ void canvas_loadbangsubpatches(t_canvas *x) void canvas_loadbang(t_canvas *x) { +#ifndef ROCKBOX t_gobj *y; +#endif canvas_loadbangabstractions(x); canvas_loadbangsubpatches(x); } @@ -1042,6 +1125,11 @@ void canvas_loadbang(t_canvas *x) static void canvas_relocate(t_canvas *x, t_symbol *canvasgeom, t_symbol *topgeom) { +#ifdef ROCKBOX + (void) x; + (void) canvasgeom; + (void) topgeom; +#else /* ROCKBOX */ int cxpix, cypix, cw, ch, txpix, typix, tw, th; if (sscanf(canvasgeom->s_name, "%dx%d+%d+%d", &cw, &ch, &cxpix, &cypix) < 4 || @@ -1052,6 +1140,7 @@ static void canvas_relocate(t_canvas *x, t_symbol *canvasgeom, if (cw > 5 && ch > 5) canvas_setbounds(x, txpix, typix, txpix + cw - HORIZBORDER, typix + ch - VERTBORDER); +#endif /* ROCKBOX */ } void canvas_popabstraction(t_canvas *x) @@ -1065,6 +1154,9 @@ void canvas_popabstraction(t_canvas *x) void canvas_logerror(t_object *y) { +#ifdef ROCKBOX + (void) y; +#endif #ifdef LATER canvas_vis(x, 1); if (!glist_isselected(x, &y->ob_g)) @@ -1095,6 +1187,13 @@ static void canvas_click(t_canvas *x, t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl, t_floatarg alt) { +#ifdef ROCKBOX + (void) xpos; + (void) ypos; + (void) shift; + (void) ctrl; + (void) alt; +#endif canvas_vis(x, 1); } @@ -1103,13 +1202,22 @@ static void canvas_click(t_canvas *x, void canvas_fattensub(t_canvas *x, int *xp1, int *yp1, int *xp2, int *yp2) { +#ifdef ROCKBOX + (void) x; + (void) xp1; + (void) yp1; +#else /* ROCKBOX */ t_gobj *y; +#endif /* ROCKBOX */ *xp2 += 50; /* fake for now */ *yp2 += 50; } static void canvas_rename_method(t_canvas *x, t_symbol *s, int ac, t_atom *av) { +#ifdef ROCKBOX + (void) s; +#endif if (ac && av->a_type == A_SYMBOL) canvas_rename(x, av->a_w.w_symbol, 0); else canvas_rename(x, gensym("Pd"), 0); @@ -1128,7 +1236,11 @@ static void *table_new(t_symbol *s, t_floatarg f) { char tabname[255]; t_symbol *t = gensym("table"); +#ifdef ROCKBOX + snprintf(tabname, sizeof(tabname)-1, "%s%d", t->s_name, tabcount++); +#else /* ROCKBOX */ sprintf(tabname, "%s%d", t->s_name, tabcount++); +#endif /* ROCKBOX */ s = gensym(tabname); } if (f <= 1) @@ -1239,7 +1351,7 @@ static void canvas_dodsp(t_canvas *x, int toplevel, t_signal **sp) /* ... and all dsp interconnections */ linetraverser_start(&t, x); - while (oc = linetraverser_next(&t)) + while((oc = linetraverser_next(&t))) if (obj_issignaloutlet(t.tr_ob, t.tr_outno)) ugen_connect(dc, t.tr_ob, t.tr_outno, t.tr_ob2, t.tr_inno); @@ -1252,7 +1364,9 @@ static void canvas_start_dsp(void) { t_canvas *x; if (canvas_dspstate) ugen_stop(); +#ifndef ROCKBOX else sys_gui("pdtk_pd_dsp ON\n"); +#endif ugen_start(); for (x = canvas_list; x; x = x->gl_next) @@ -1266,7 +1380,9 @@ static void canvas_stop_dsp(void) if (canvas_dspstate) { ugen_stop(); +#ifndef ROCKBOX sys_gui("pdtk_pd_dsp OFF\n"); +#endif canvas_dspstate = 0; } } @@ -1297,6 +1413,10 @@ void canvas_update_dsp(void) void glob_dsp(void *dummy, t_symbol *s, int argc, t_atom *argv) { int newstate; +#ifdef ROCKBOX + (void) dummy; + (void) s; +#endif if (argc) { newstate = atom_getintarg(0, argc, argv); @@ -1333,7 +1453,9 @@ static void glist_redrawall(t_glist *gl) int vis = glist_isvisible(gl); for (g = gl->gl_list; g; g = g->g_next) { +#ifndef ROCKBOX t_class *cl; +#endif if (vis && g->g_pd == scalar_class) glist_redrawitem(gl, g); else if (g->g_pd == canvas_class) @@ -1345,6 +1467,9 @@ static void glist_redrawall(t_glist *gl) void canvas_redrawallfortemplate(t_canvas *templatecanvas) { t_canvas *x; +#ifdef ROCKBOX + (void) templatecanvas; +#endif /* find all root canvases */ for (x = canvas_list; x; x = x->gl_next) glist_redrawall(x); diff --git a/apps/plugins/pdbox/PDa/src/g_editor.c b/apps/plugins/pdbox/PDa/src/g_editor.c index 1190739e1a..a5cce20e10 100644 --- a/apps/plugins/pdbox/PDa/src/g_editor.c +++ b/apps/plugins/pdbox/PDa/src/g_editor.c @@ -2,6 +2,14 @@ * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#include "m_pd.h" +#include "m_imp.h" +#include "s_stuff.h" +#include "g_canvas.h" +#else /* ROCKBOX */ #include #include #include "m_pd.h" @@ -9,6 +17,7 @@ #include "s_stuff.h" #include "g_canvas.h" #include +#endif /* ROCKBOX */ void glist_readfrombinbuf(t_glist *x, t_binbuf *b, char *filename, int selectem); @@ -88,8 +97,10 @@ void glist_selectline(t_glist *x, t_outconnect *oc, int index1, x->gl_editor->e_selectline_index2 = index2; x->gl_editor->e_selectline_inno = inno; x->gl_editor->e_selectline_tag = oc; +#ifndef ROCKBOX sys_vgui(".x%x.c itemconfigure l%x -fill blue\n", x, x->gl_editor->e_selectline_tag); +#endif } } @@ -98,8 +109,10 @@ void glist_deselectline(t_glist *x) if (x->gl_editor) { x->gl_editor->e_selectedline = 0; +#ifndef ROCKBOX sys_vgui(".x%x.c itemconfigure l%x -fill black\n", x, x->gl_editor->e_selectline_tag); +#endif } } @@ -166,7 +179,7 @@ void glist_deselect(t_glist *x, t_gobj *y) } else { - for (sel = x->gl_editor->e_selection; sel2 = sel->sel_next; + for(sel = x->gl_editor->e_selection; (sel2 = sel->sel_next); sel = sel2) { if (sel2->sel_what == y) @@ -217,7 +230,7 @@ void glist_selectall(t_glist *x) x->gl_editor->e_selection = sel; sel->sel_what = y; gobj_select(y, x, 1); - while (y = y->g_next) + while((y = y->g_next)) { t_selection *sel2 = (t_selection *)getbytes(sizeof(*sel2)); sel->sel_next = sel2; @@ -290,11 +303,13 @@ void canvas_setundo(t_canvas *x, t_undofn undofn, void *buf, canvas_undo_buf = buf; canvas_undo_whatnext = UNDO_UNDO; canvas_undo_name = name; +#ifndef ROCKBOX if (x && glist_isvisible(x) && glist_istoplevel(x)) /* enable undo in menu */ sys_vgui("pdtk_undomenu .x%x %s no\n", x, name); else if (hadone) sys_vgui("pdtk_undomenu nobody no no\n"); +#endif } /* clear undo if it happens to be for the canvas x. @@ -316,8 +331,10 @@ static void canvas_undo(t_canvas *x) /* post("undo"); */ (*canvas_undo_fn)(canvas_undo_canvas, canvas_undo_buf, UNDO_UNDO); /* enable redo in menu */ +#ifndef ROCKBOX if (glist_isvisible(x) && glist_istoplevel(x)) sys_vgui("pdtk_undomenu .x%x no %s\n", x, canvas_undo_name); +#endif canvas_undo_whatnext = UNDO_REDO; } } @@ -333,8 +350,10 @@ static void canvas_redo(t_canvas *x) /* post("redo"); */ (*canvas_undo_fn)(canvas_undo_canvas, canvas_undo_buf, UNDO_REDO); /* enable undo in menu */ +#ifndef ROCKBOX if (glist_isvisible(x) && glist_istoplevel(x)) sys_vgui("pdtk_undomenu .x%x %s no\n", x, canvas_undo_name); +#endif canvas_undo_whatnext = UNDO_UNDO; } } @@ -352,6 +371,9 @@ typedef struct _undo_connect static void *canvas_undo_set_disconnect(t_canvas *x, int index1, int outno, int index2, int inno) { +#ifdef ROCKBOX + (void) x; +#endif t_undo_connect *buf = (t_undo_connect *)getbytes(sizeof(*buf)); buf->u_index1 = index1; buf->u_outletno = outno; @@ -366,14 +388,16 @@ void canvas_disconnect(t_canvas *x, t_linetraverser t; t_outconnect *oc; linetraverser_start(&t, x); - while (oc = linetraverser_next(&t)) + while((oc = linetraverser_next(&t))) { int srcno = canvas_getindex(x, &t.tr_ob->ob_g); int sinkno = canvas_getindex(x, &t.tr_ob2->ob_g); if (srcno == index1 && t.tr_outno == outno && sinkno == index2 && t.tr_inno == inno) { +#ifndef ROCKBOX sys_vgui(".x%x.c delete l%x\n", x, oc); +#endif obj_disconnect(t.tr_ob, t.tr_outno, t.tr_ob2, t.tr_inno); break; } @@ -432,7 +456,9 @@ typedef struct _undo_cut static void *canvas_undo_set_cut(t_canvas *x, int mode) { t_undo_cut *buf; +#ifndef ROCKBOX t_gobj *y; +#endif t_linetraverser t; t_outconnect *oc; int nnotsel= glist_selectionindex(x, 0, 0); @@ -443,7 +469,7 @@ static void *canvas_undo_set_cut(t_canvas *x, int mode) /* store connections into/out of the selection */ buf->u_reconnectbuf = binbuf_new(); linetraverser_start(&t, x); - while (oc = linetraverser_next(&t)) + while((oc = linetraverser_next(&t))) { int issel1 = glist_isselected(x, &t.tr_ob->ob_g); int issel2 = glist_isselected(x, &t.tr_ob2->ob_g); @@ -488,7 +514,7 @@ static void canvas_undo_cut(t_canvas *x, void *z, int action) { t_gobj *y1, *y2; glist_noselect(x); - for (y1 = x->gl_list; y2 = y1->g_next; y1 = y2) + for(y1 = x->gl_list; (y2 = y1->g_next); y1 = y2) ; if (y1) { @@ -514,7 +540,7 @@ static void canvas_undo_cut(t_canvas *x, void *z, int action) else if (mode == UCUT_TEXT) { t_gobj *y1, *y2; - for (y1 = x->gl_list; y2 = y1->g_next; y1 = y2) + for(y1 = x->gl_list; (y2 = y1->g_next); y1 = y2) ; if (y1) glist_delete(x, y1); @@ -738,7 +764,9 @@ void canvas_setcursor(t_canvas *x, unsigned int cursornum) } if (xwas != x || cursorwas != cursornum) { +#ifndef ROCKBOX sys_vgui(".x%x configure -cursor %s\n", x, cursorlist[cursornum]); +#endif xwas = x; cursorwas = cursornum; } @@ -784,8 +812,14 @@ static void canvas_rightclick(t_canvas *x, int xpos, int ypos, t_gobj *y) int canprop, canopen; canprop = (!y || (y && class_getpropertiesfn(pd_class(&y->g_pd)))); canopen = (y && zgetfn(&y->g_pd, gensym("menu-open"))); +#ifdef ROCKBOX + (void) x; + (void) xpos; + (void) ypos; +#else /* ROCKBOX */ sys_vgui("pdtk_canvas_popup .x%x %d %d %d %d\n", x, xpos, ypos, canprop, canopen); +#endif /* ROCKBOX */ } /* tell GUI to create a properties dialog on the canvas. We tell @@ -793,11 +827,15 @@ static void canvas_rightclick(t_canvas *x, int xpos, int ypos, t_gobj *y) naturally upward, whereas pixels grow downward. */ static void canvas_properties(t_glist *x) { +#ifdef ROCKBOX + (void) x; +#else /* ROCKBOX */ char graphbuf[200]; sprintf(graphbuf, "pdtk_canvas_dialog %%s %g %g %g %g \n", glist_dpixtodx(x, 1), -glist_dpixtody(x, 1), (float)glist_isgraph(x), (float)x->gl_stretch); gfxstub_new(&x->gl_pd, x, graphbuf); +#endif /* ROCKBOX */ } @@ -885,7 +923,11 @@ static void canvas_donecanvasdialog(t_glist *x, t_floatarg xperpix, "open," or "help." */ static void canvas_done_popup(t_canvas *x, float which, float xpos, float ypos) { +#ifdef ROCKBOX + char namebuf[MAXPDSTRING]; +#else char pathbuf[MAXPDSTRING], namebuf[MAXPDSTRING]; +#endif t_gobj *y; for (y = x->gl_list; y; y = y->g_next) { @@ -936,9 +978,11 @@ static void canvas_done_popup(t_canvas *x, float which, float xpos, float ypos) canvas_properties(x); else if (which == 2) { +#ifndef ROCKBOX strcpy(pathbuf, sys_libdir->s_name); strcat(pathbuf, "/doc/5.reference/0.INTRO.txt"); sys_vgui("menu_opentext %s\n", pathbuf); +#endif } } @@ -967,7 +1011,11 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, t_gobj *y; int shiftmod, runmode, altmod, rightclick; int x1, y1, x2, y2, clickreturned = 0; - + +#ifdef ROCKBOX + (void) which; +#endif + if (!x->gl_editor) { bug("editor"); @@ -1027,7 +1075,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, return; } /* if not a runmode left click, fall here. */ - if (y = canvas_findhitbox(x, xpos, ypos, &x1, &y1, &x2, &y2)) + if((y = canvas_findhitbox(x, xpos, ypos, &x1, &y1, &x2, &y2))) { t_object *ob = pd_checkobject(&y->g_pd); /* check you're in the rectangle */ @@ -1071,14 +1119,18 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, { if (doit) { +#ifndef ROCKBOX int issignal = obj_issignaloutlet(ob, closest); +#endif x->gl_editor->e_onmotion = MA_CONNECT; x->gl_editor->e_xwas = xpos; x->gl_editor->e_ywas = ypos; +#ifndef ROCKBOX sys_vgui( ".x%x.c create line %d %d %d %d -width %d -tags x\n", x, xpos, ypos, xpos, ypos, (issignal ? 2 : 1)); +#endif } else canvas_setcursor(x, CURSOR_EDITMODE_CONNECT); } @@ -1134,7 +1186,7 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, float fx = xpos, fy = ypos; t_glist *glist2 = glist_getcanvas(x); linetraverser_start(&t, glist2); - while (oc = linetraverser_next(&t)) + while((oc = linetraverser_next(&t))) { float lx1 = t.tr_lx1, ly1 = t.tr_ly1, lx2 = t.tr_lx2, ly2 = t.tr_ly2; @@ -1158,8 +1210,10 @@ void canvas_doclick(t_canvas *x, int xpos, int ypos, int which, if (doit) { if (!shiftmod) glist_noselect(x); +#ifndef ROCKBOX sys_vgui(".x%x.c create rectangle %d %d %d %d -tags x\n", x, xpos, ypos, xpos, ypos); +#endif x->gl_editor->e_xwas = xpos; x->gl_editor->e_ywas = ypos; x->gl_editor->e_onmotion = MA_REGION; @@ -1178,7 +1232,7 @@ int canvas_isconnected (t_canvas *x, t_text *ob1, int n1, t_linetraverser t; t_outconnect *oc; linetraverser_start(&t, x); - while (oc = linetraverser_next(&t)) + while((oc = linetraverser_next(&t))) if (t.tr_ob == ob1 && t.tr_outno == n1 && t.tr_ob2 == ob2 && t.tr_inno == n2) return (1); @@ -1193,10 +1247,15 @@ void canvas_doconnect(t_canvas *x, int xpos, int ypos, int which, int doit) t_gobj *y2; int xwas = x->gl_editor->e_xwas, ywas = x->gl_editor->e_ywas; +#ifdef ROCKBOX + (void) which; +#endif /* ROCKBOX */ +#ifndef ROCKBOX if (doit) sys_vgui(".x%x.c delete x\n", x); else sys_vgui(".x%x.c coords x %d %d %d %d\n", x, x->gl_editor->e_xwas, x->gl_editor->e_ywas, xpos, ypos); +#endif /* ROCKBOX */ if ((y1 = canvas_findhitbox(x, xwas, ywas, &x11, &y11, &x12, &y12)) && (y2 = canvas_findhitbox(x, xpos, ypos, &x21, &y21, &x22, &y22))) @@ -1258,10 +1317,12 @@ void canvas_doconnect(t_canvas *x, int xpos, int ypos, int which, int doit) ((x22-x21-IOWIDTH) * closest2)/(ninlet2-1) : 0) + IOMIDDLE; ly2 = y21; +#ifndef ROCKBOX sys_vgui(".x%x.c create line %d %d %d %d -width %d -tags l%x\n", glist_getcanvas(x), lx1, ly1, lx2, ly2, (obj_issignaloutlet(ob1, closest1) ? 2 : 1), oc); +#endif /* ROCKBOX */ canvas_setundo(x, canvas_undo_connect, canvas_undo_set_connect(x, canvas_getindex(x, &ob1->ob_g), closest1, @@ -1300,12 +1361,16 @@ static void canvas_doregion(t_canvas *x, int xpos, int ypos, int doit) loy = x->gl_editor->e_ywas, hiy = ypos; else hiy = x->gl_editor->e_ywas, loy = ypos; canvas_selectinrect(x, lox, loy, hix, hiy); +#ifndef ROCKBOX sys_vgui(".x%x.c delete x\n", x); +#endif x->gl_editor->e_onmotion = 0; } +#ifndef ROCKBOX else sys_vgui(".x%x.c coords x %d %d %d %d\n", x, x->gl_editor->e_xwas, x->gl_editor->e_ywas, xpos, ypos); +#endif } void canvas_mouseup(t_canvas *x, @@ -1395,7 +1460,11 @@ void canvas_key(t_canvas *x, t_symbol *s, int ac, t_atom *av) t_symbol *gotkeysym; int down, shift; - + +#ifdef ROCKBOX + (void) s; +#endif + if (ac < 3) return; if (!x->gl_editor) @@ -1411,7 +1480,11 @@ void canvas_key(t_canvas *x, t_symbol *s, int ac, t_atom *av) else if (av[1].a_type == A_FLOAT) { char buf[3]; +#ifdef ROCKBOX + snprintf(buf, sizeof(buf)-1, "%c", (int)(av[1].a_w.w_float)); +#else /* ROCKBOX */ sprintf(buf, "%c", (int)(av[1].a_w.w_float)); +#endif /* ROCKBOX */ gotkeysym = gensym(buf); } else gotkeysym = gensym("?"); @@ -1559,8 +1632,13 @@ void canvas_startmotion(t_canvas *x) void canvas_print(t_canvas *x, t_symbol *s) { +#ifdef ROCKBOX + (void) x; + (void) s; +#else /* ROCKBOX */ if (*s->s_name) sys_vgui(".x%x.c postscript -file %s\n", x, s->s_name); else sys_vgui(".x%x.c postscript -file x.ps\n", x); +#endif /* ROCKBOX */ } void canvas_menuclose(t_canvas *x, t_floatarg force) @@ -1569,18 +1647,24 @@ void canvas_menuclose(t_canvas *x, t_floatarg force) canvas_vis(x, 0); else if ((force != 0) || (!x->gl_dirty)) pd_free(&x->gl_pd); +#ifndef ROCKBOX else sys_vgui("pdtk_check {This window has been modified. Close anyway?}\ {.x%x menuclose 1;\n}\n", x); +#endif } /* put up a dialog which may call canvas_font back to do the work */ static void canvas_menufont(t_canvas *x) { +#ifdef ROCKBOX + (void) x; +#else /* ROCKBOX */ char buf[80]; t_canvas *x2 = canvas_getrootfor(x); gfxstub_deleteforkey(x2); sprintf(buf, "pdtk_canvas_dofont %%s %d\n", x2->gl_font); gfxstub_new(&x2->gl_pd, &x2->gl_pd, buf); +#endif /* ROCKBOX */ } static int canvas_find_index1, canvas_find_index2; @@ -1598,13 +1682,13 @@ static int canvas_dofind(t_canvas *x, int *myindex1p) y = y->g_next, myindex2++) { t_object *ob = 0; - if (ob = pd_checkobject(&y->g_pd)) + if((ob = pd_checkobject(&y->g_pd))) { if (binbuf_match(ob->ob_binbuf, canvas_findbuf)) { if (myindex1 > canvas_find_index1 || - myindex1 == canvas_find_index1 && - myindex2 > canvas_find_index2) + (myindex1 == canvas_find_index1 && + myindex2 > canvas_find_index2)) { canvas_find_index1 = myindex1; canvas_find_index2 = myindex2; @@ -1633,6 +1717,9 @@ static int canvas_dofind(t_canvas *x, int *myindex1p) static void canvas_find(t_canvas *x, t_symbol *s, int ac, t_atom *av) { int myindex1 = 0, i; +#ifdef ROCKBOX + (void) s; +#endif for (i = 0; i < ac; i++) { if (av[i].a_type == A_SYMBOL) @@ -1660,6 +1747,9 @@ static void canvas_find(t_canvas *x, t_symbol *s, int ac, t_atom *av) static void canvas_find_again(t_canvas *x) { int myindex1 = 0; +#ifdef ROCKBOX + (void) x; +#endif if (!canvas_findbuf || !canvas_whichfind) return; if (!canvas_dofind(canvas_whichfind, &myindex1)) @@ -1756,7 +1846,7 @@ void canvas_stowconnections(t_canvas *x) /* add connections to binbuf */ binbuf_clear(x->gl_editor->e_connectbuf); linetraverser_start(&t, x); - while (oc = linetraverser_next(&t)) + while((oc = linetraverser_next(&t))) { int s1 = glist_isselected(x, &t.tr_ob->ob_g); int s2 = glist_isselected(x, &t.tr_ob2->ob_g); @@ -1787,7 +1877,7 @@ static t_binbuf *canvas_docopy(t_canvas *x) gobj_save(y, b); } linetraverser_start(&t, x); - while (oc = linetraverser_next(&t)) + while((oc = linetraverser_next(&t))) { if (glist_isselected(x, &t.tr_ob->ob_g) && glist_isselected(x, &t.tr_ob2->ob_g)) @@ -1912,7 +2002,11 @@ static void glist_donewloadbangs(t_glist *x) static void canvas_dopaste(t_canvas *x, t_binbuf *b) { +#ifdef ROCKBOX + t_gobj *g2; +#else /* ROCKBOX */ t_gobj *newgobj, *last, *g2; +#endif /* ROCKBOX */ int dspstate = canvas_suspend_dsp(), nbox, count; canvas_editmode(x, 1.); @@ -1987,9 +2081,11 @@ void canvas_connect(t_canvas *x, t_floatarg fwhoout, t_floatarg foutno, if (!(oc = obj_connect(objsrc, outno, objsink, inno))) goto bad; if (glist_isvisible(x)) { +#ifndef ROCKBOX sys_vgui(".x%x.c create line %d %d %d %d -width %d -tags l%x\n", glist_getcanvas(x), 0, 0, 0, 0, (obj_issignaloutlet(objsrc, outno) ? 2 : 1),oc); +#endif canvas_fixlinesfor(x, objsrc); } return; @@ -2008,7 +2104,11 @@ bad: /* LATER might have to speed this up */ static void canvas_tidy(t_canvas *x) { +#ifdef ROCKBOX + t_gobj *y, *y2; +#else /* ROCKBOX */ t_gobj *y, *y2, *y3; +#endif /* ROCKBOX */ int ax1, ay1, ax2, ay2, bx1, by1, bx2, by2; int histogram[NHIST], *ip, i, besthist, bestdist; /* if nobody is selected, this means do it to all boxes; @@ -2114,15 +2214,19 @@ static void canvas_texteditor(t_canvas *x) t_rtext *foo; char *buf; int bufsize; - if (foo = x->gl_editor->e_textedfor) + if((foo = x->gl_editor->e_textedfor)) rtext_gettext(foo, &buf, &bufsize); else buf = "", bufsize = 0; +#ifndef ROCKBOX sys_vgui("pdtk_pd_texteditor {%.*s}\n", bufsize, buf); - +#endif } void glob_key(void *dummy, t_symbol *s, int ac, t_atom *av) { +#ifdef ROCKBOX + (void) dummy; +#endif /* canvas_editing can be zero; canvas_key checks for that */ canvas_key(canvas_editing, s, ac, av); } @@ -2141,8 +2245,10 @@ void canvas_editmode(t_canvas *x, t_floatarg fyesplease) if (glist_isvisible(x) && glist_istoplevel(x)) canvas_setcursor(x, CURSOR_RUNMODE_NOTHING); } +#ifndef ROCKBOX sys_vgui("pdtk_canvas_editval .x%x %d\n", glist_getcanvas(x), x->gl_edit); +#endif } /* called by canvas_font below */ @@ -2188,7 +2294,9 @@ static void canvas_font(t_canvas *x, t_floatarg font, t_floatarg resize, if (whichresize != 3) realresx = realresize; if (whichresize != 2) realresy = realresize; canvas_dofont(x2, font, realresx, realresy); +#ifndef ROCKBOX sys_defaultfont = font; +#endif } static t_glist *canvas_last_glist; diff --git a/apps/plugins/pdbox/PDa/src/g_graph.c b/apps/plugins/pdbox/PDa/src/g_graph.c index c81bac10b8..a3d1798733 100644 --- a/apps/plugins/pdbox/PDa/src/g_graph.c +++ b/apps/plugins/pdbox/PDa/src/g_graph.c @@ -6,12 +6,21 @@ "graphs" inside another glist. LATER move the inlet/outlet code of g_canvas.c to this file... */ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#include "m_pd.h" +#include "g_canvas.h" +#define snprintf rb->snprintf +#define atof rb_atof +#else /* ROCKBOX */ #include #include "m_pd.h" #include "t_tk.h" #include "g_canvas.h" #include #include +#endif /* ROCKBOX */ /* ---------------------- forward definitions ----------------- */ @@ -80,7 +89,11 @@ void glist_delete(t_glist *x, t_gobj *y) if (gl->gl_isgraph) { char tag[80]; +#ifdef ROCKBOX + snprintf(tag, sizeof(tag)-1, "graph%x", (int)gl); +#else /* ROCKBOX */ sprintf(tag, "graph%x", (int)gl); +#endif /* ROCKBOX */ glist_eraseiofor(x, &gl->gl_obj, tag); } else @@ -112,16 +125,22 @@ void glist_delete(t_glist *x, t_gobj *y) /* remove every object from a glist. Experimental. */ void glist_clear(t_glist *x) { +#ifdef ROCKBOX + t_gobj *y; +#else t_gobj *y, *y2; +#endif int dspstate = canvas_suspend_dsp(); - while (y = x->gl_list) + while((y = x->gl_list)) glist_delete(x, y); canvas_resume_dsp(dspstate); } void glist_retext(t_glist *glist, t_text *y) { +#ifndef ROCKBOX t_canvas *c = glist_getcanvas(glist); +#endif /* check that we have built rtexts yet. LATER need a better test. */ if (glist->gl_editor && glist->gl_editor->e_rtext) { @@ -167,6 +186,9 @@ static t_gobj *glist_merge(t_glist *x, t_gobj *g1, t_gobj *g2) { t_gobj *g = 0, *g9 = 0; float f1 = 0, f2 = 0; +#ifdef ROCKBOX + (void) x; +#endif if (g1) f1 = gobj_getxforsort(g1); if (g2) @@ -190,7 +212,7 @@ static t_gobj *glist_merge(t_glist *x, t_gobj *g1, t_gobj *g2) if (g9) g9->g_next = g1, g9 = g1; else g9 = g = g1; - if (g1 = g1->g_next) + if((g1 = g1->g_next)) f1 = gobj_getxforsort(g1); g9->g_next = 0; continue; @@ -198,7 +220,7 @@ static t_gobj *glist_merge(t_glist *x, t_gobj *g1, t_gobj *g2) if (g9) g9->g_next = g2, g9 = g2; else g9 = g = g2; - if (g2 = g2->g_next) + if((g2 = g2->g_next)) f2 = gobj_getxforsort(g2); g9->g_next = 0; continue; @@ -333,6 +355,9 @@ void canvas_resortinlets(t_canvas *x) t_outlet *canvas_addoutlet(t_canvas *x, t_pd *who, t_symbol *s) { t_outlet *op = outlet_new(&x->gl_obj, s); +#ifdef ROCKBOX + (void) who; +#endif if (!x->gl_loading && x->gl_owner && glist_isvisible(x->gl_owner)) { gobj_vis(&x->gl_gobj, x->gl_owner, 0); @@ -444,6 +469,9 @@ static void graph_yticks(t_glist *x, static void graph_xlabel(t_glist *x, t_symbol *s, int argc, t_atom *argv) { int i; +#ifdef ROCKBOX + (void) s; +#endif if (argc < 1) error("graph_xlabel: no y value given"); else { @@ -460,6 +488,9 @@ static void graph_xlabel(t_glist *x, t_symbol *s, int argc, t_atom *argv) static void graph_ylabel(t_glist *x, t_symbol *s, int argc, t_atom *argv) { int i; +#ifdef ROCKBOX + (void) s; +#endif if (argc < 1) error("graph_ylabel: no x value given"); else { @@ -613,10 +644,14 @@ void glist_redraw(t_glist *x) } /* redraw all the lines */ linetraverser_start(&t, x); - while (oc = linetraverser_next(&t)) + while((oc = linetraverser_next(&t))) +#ifdef ROCKBOX + ; +#else /* ROCKBOX */ sys_vgui(".x%x.c coords l%x %d %d %d %d\n", glist_getcanvas(x), oc, t.tr_lx1, t.tr_ly1, t.tr_lx2, t.tr_ly2); +#endif /* ROCKBOX */ } if (x->gl_owner) { @@ -651,7 +686,11 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis) if (!vis) rtext_erase(glist_findrtext(parent_glist, &x->gl_obj)); +#ifdef ROCKBOX + snprintf(tag, sizeof(tag)-1, "graph%x", (int) x); +#else sprintf(tag, "graph%x", (int)x); +#endif if (vis) glist_drawiofor(parent_glist, &x->gl_obj, 1, tag, x1, y1, x2, y2); @@ -660,6 +699,7 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis) just show the bounding rectangle */ if (x->gl_havewindow) { +#ifndef ROCKBOX if (vis) { sys_vgui(".x%x.c create polygon\ @@ -672,6 +712,7 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis) sys_vgui(".x%x.c delete %s\n", glist_getcanvas(x->gl_owner), tag); } +#endif return; } /* otherwise draw (or erase) us as a graph inside another glist. */ @@ -681,10 +722,12 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis) float f; /* draw a rectangle around the graph */ +#ifndef ROCKBOX sys_vgui(".x%x.c create line\ %d %d %d %d %d %d %d %d %d %d -tags %s\n", glist_getcanvas(x->gl_owner), x1, y1, x1, y2, x2, y2, x2, y1, x1, y1, tag); +#endif /* draw ticks on horizontal borders. If lperb field is zero, this is disabled. */ @@ -698,6 +741,7 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis) f < 0.99 * x->gl_x2 + 0.01*x->gl_x1; i++, f += x->gl_xtick.k_inc) { +#ifndef ROCKBOX int tickpix = (i % x->gl_xtick.k_lperb ? 2 : 4); sys_vgui(".x%x.c create line %d %d %d %d -tags %s\n", glist_getcanvas(x->gl_owner), @@ -707,11 +751,13 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis) glist_getcanvas(x->gl_owner), (int)glist_xtopixels(x, f), (int)lpix, (int)glist_xtopixels(x, f), (int)lpix + tickpix, tag); +#endif } for (i = 1, f = x->gl_xtick.k_point - x->gl_xtick.k_inc; f > 0.99 * x->gl_x1 + 0.01*x->gl_x2; i++, f -= x->gl_xtick.k_inc) { +#ifndef ROCKBOX int tickpix = (i % x->gl_xtick.k_lperb ? 2 : 4); sys_vgui(".x%x.c create line %d %d %d %d -tags %s\n", glist_getcanvas(x->gl_owner), @@ -721,6 +767,7 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis) glist_getcanvas(x->gl_owner), (int)glist_xtopixels(x, f), (int)lpix, (int)glist_xtopixels(x, f), (int)lpix + tickpix, tag); +#endif } } @@ -735,6 +782,7 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis) f < 0.99 * ubound + 0.01 * lbound; i++, f += x->gl_ytick.k_inc) { +#ifndef ROCKBOX int tickpix = (i % x->gl_ytick.k_lperb ? 2 : 4); sys_vgui(".x%x.c create line %d %d %d %d -tags %s\n", glist_getcanvas(x->gl_owner), @@ -744,11 +792,13 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis) glist_getcanvas(x->gl_owner), x2, (int)glist_ytopixels(x, f), x2 - tickpix, (int)glist_ytopixels(x, f), tag); +#endif } for (i = 1, f = x->gl_ytick.k_point - x->gl_ytick.k_inc; f > 0.99 * lbound + 0.01 * ubound; i++, f -= x->gl_ytick.k_inc) { +#ifndef ROCKBOX int tickpix = (i % x->gl_ytick.k_lperb ? 2 : 4); sys_vgui(".x%x.c create line %d %d %d %d -tags %s\n", glist_getcanvas(x->gl_owner), @@ -758,19 +808,27 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis) glist_getcanvas(x->gl_owner), x2, (int)glist_ytopixels(x, f), x2 - tickpix, (int)glist_ytopixels(x, f), tag); +#endif } } /* draw x labels */ for (i = 0; i < x->gl_nxlabels; i++) +#ifdef ROCKBOX + ; +#else /* ROCKBOX */ sys_vgui(".x%x.c create text\ %d %d -text {%s} -font -*-courier-bold--normal--%d-* -tags %s\n", glist_getcanvas(x), (int)glist_xtopixels(x, atof(x->gl_xlabel[i]->s_name)), (int)glist_ytopixels(x, x->gl_xlabely), x->gl_xlabel[i]->s_name, glist_getfont(x), tag); +#endif /* ROCKBOX */ /* draw y labels */ for (i = 0; i < x->gl_nylabels; i++) +#ifdef ROCKBOX + ; +#else /* ROCKBOX */ sys_vgui(".x%x.c create text\ %d %d -text {%s} -font -*-courier-bold--normal--%d-* -tags %s\n", glist_getcanvas(x), @@ -778,6 +836,7 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis) (int)glist_ytopixels(x, atof(x->gl_ylabel[i]->s_name)), x->gl_ylabel[i]->s_name, glist_getfont(x), tag); +#endif /* ROCKBOX */ /* draw contents of graph as glist */ for (g = x->gl_list; g; g = g->g_next) @@ -785,8 +844,10 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis) } else { +#ifndef ROCKBOX sys_vgui(".x%x.c delete %s\n", glist_getcanvas(x->gl_owner), tag); +#endif for (g = x->gl_list; g; g = g->g_next) gobj_vis(g, x, 0); } @@ -904,10 +965,12 @@ static void graph_select(t_gobj *z, t_glist *glist, int state) t_rtext *y = glist_findrtext(glist, &x->gl_obj); if (canvas_showtext(x)) rtext_select(y, state); +#ifndef ROCKBOX sys_vgui(".x%x.c itemconfigure %sR -fill %s\n", glist, rtext_gettag(y), (state? "blue" : "black")); sys_vgui(".x%x.c itemconfigure graph%x -fill %s\n", glist_getcanvas(glist), z, (state? "blue" : "black")); +#endif } } @@ -941,10 +1004,11 @@ static void graph_delete(t_gobj *z, t_glist *glist) t_glist *x = (t_glist *)z; t_gobj *y; text_widgetbehavior.w_deletefn(z, glist); - while (y = x->gl_list) + while((y = x->gl_list)) glist_delete(x, y); } +#ifndef ROCKBOX static float graph_lastxpix, graph_lastypix; static void graph_motion(void *z, t_floatarg dx, t_floatarg dy) @@ -986,6 +1050,7 @@ static void graph_motion(void *z, t_floatarg dx, t_floatarg dy) else vec[newx] = newy; garray_redraw(a); } +#endif static int graph_click(t_gobj *z, struct _glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit) @@ -1037,11 +1102,16 @@ void graph_properties(t_gobj *z, t_glist *owner) t_glist *x = (t_glist *)z; { t_gobj *y; +#ifdef ROCKBOX + (void) owner; +#else /* ROCKBOX */ char graphbuf[200]; + sprintf(graphbuf, "pdtk_graph_dialog %%s %g %g %g %g %d %d\n", x->gl_x1, x->gl_y1, x->gl_x2, x->gl_y2, x->gl_pixwidth, x->gl_pixheight); gfxstub_new(&x->gl_pd, x, graphbuf); +#endif /* ROCKBOX */ for (y = x->gl_list; y; y = y->g_next) if (pd_class(&y->g_pd) == garray_class) @@ -1071,6 +1141,9 @@ static void graph_dialog(t_glist *x, t_symbol *s, int argc, t_atom *argv) t_float y2 = atom_getfloatarg(3, argc, argv); t_float xpix = atom_getfloatarg(4, argc, argv); t_float ypix = atom_getfloatarg(5, argc, argv); +#ifdef ROCKBOX + (void) s; +#endif if (x1 != x->gl_x1 || x2 != x->gl_x2 || y1 != x->gl_y1 || y2 != x->gl_y2) graph_bounds(x, x1, y1, x2, y2); diff --git a/apps/plugins/pdbox/PDa/src/g_hdial.c b/apps/plugins/pdbox/PDa/src/g_hdial.c index eb88f22e2d..4bf2e0ad50 100644 --- a/apps/plugins/pdbox/PDa/src/g_hdial.c +++ b/apps/plugins/pdbox/PDa/src/g_hdial.c @@ -8,6 +8,13 @@ /* name change to hradio by MSP and changed to put out a "float" as in sliders, toggles, etc. */ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#include "m_pd.h" +#include "g_canvas.h" +#include "g_all_guis.h" +#else /* ROCKBOX */ #include #include #include @@ -23,6 +30,7 @@ put out a "float" as in sliders, toggles, etc. */ #else #include #endif +#endif /* ROCKBOX */ /* ------------- hdl gui-horicontal dial ---------------------- */ @@ -33,6 +41,10 @@ static t_class *hradio_class, *hradio_old_class; void hradio_draw_update(t_hradio *x, t_glist *glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ if(glist_isvisible(glist)) { t_canvas *canvas=glist_getcanvas(glist); @@ -44,10 +56,15 @@ void hradio_draw_update(t_hradio *x, t_glist *glist) canvas, x, x->x_on, x->x_gui.x_fcol, x->x_gui.x_fcol); } +#endif /* ROCKBOX */ } void hradio_draw_new(t_hradio *x, t_glist *glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ t_canvas *canvas=glist_getcanvas(glist); int n=x->x_number, i, dx=x->x_gui.x_w, s4=dx/4; int yy11=text_ypix(&x->x_gui.x_obj, glist), yy12=yy11+dx; @@ -55,7 +72,6 @@ void hradio_draw_new(t_hradio *x, t_glist *glist) int xx11b=text_xpix(&x->x_gui.x_obj, glist), xx11=xx11b, xx21=xx11b+s4; int xx22=xx11b+dx-s4; - for(i=0; ix_gui.x_fsf.x_rcv_able) sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xIN%d\n", canvas, xx11b, yy11, xx11b + IOWIDTH, yy11+1, x, 0); - +#endif /* ROCKBOX */ } void hradio_draw_move(t_hradio *x, t_glist *glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ t_canvas *canvas=glist_getcanvas(glist); int n=x->x_number, i, dx=x->x_gui.x_w, s4=dx/4; int yy11=text_ypix(&x->x_gui.x_obj, glist), yy12=yy11+dx; @@ -114,10 +134,15 @@ void hradio_draw_move(t_hradio *x, t_glist *glist) if(!x->x_gui.x_fsf.x_rcv_able) sys_vgui(".x%x.c coords %xIN%d %d %d %d %d\n", canvas, x, 0, xx11b, yy11, xx11b + IOWIDTH, yy11+1); +#endif /* ROCKBOX */ } void hradio_draw_erase(t_hradio* x, t_glist* glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ t_canvas *canvas=glist_getcanvas(glist); int n=x->x_number, i; @@ -131,10 +156,15 @@ void hradio_draw_erase(t_hradio* x, t_glist* glist) sys_vgui(".x%x.c delete %xOUT%d\n", canvas, x, 0); if(!x->x_gui.x_fsf.x_rcv_able) sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); +#endif /* ROCKBOX */ } void hradio_draw_config(t_hradio* x, t_glist* glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ t_canvas *canvas=glist_getcanvas(glist); int n=x->x_number, i; @@ -150,10 +180,16 @@ void hradio_draw_config(t_hradio* x, t_glist* glist) (x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol, (x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol); } +#endif } void hradio_draw_io(t_hradio* x, t_glist* glist, int old_snd_rcv_flags) { +#ifdef ROCKBOX + (void) x; + (void) glist; + (void) old_snd_rcv_flags; +#else /* ROCKBOX */ t_canvas *canvas=glist_getcanvas(glist); int xpos=text_xpix(&x->x_gui.x_obj, glist); int ypos=text_ypix(&x->x_gui.x_obj, glist); @@ -173,10 +209,15 @@ void hradio_draw_io(t_hradio* x, t_glist* glist, int old_snd_rcv_flags) xpos + IOWIDTH, ypos+1, x, 0); if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able) sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); +#endif /* ROCKBOX */ } void hradio_draw_select(t_hradio* x, t_glist* glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ t_canvas *canvas=glist_getcanvas(glist); int n=x->x_number, i; @@ -199,6 +240,7 @@ void hradio_draw_select(t_hradio* x, t_glist* glist) sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol); } +#endif /* ROCKBOX */ } void hradio_draw(t_hradio *x, t_glist *glist, int mode) @@ -254,6 +296,10 @@ static void hradio_save(t_gobj *z, t_binbuf *b) static void hradio_properties(t_gobj *z, t_glist *owner) { +#ifdef ROCKBOX + (void) z; + (void) owner; +#else /* ROCKBOX */ t_hradio *x = (t_hradio *)z; char buf[800]; t_symbol *srl[3]; @@ -278,6 +324,7 @@ static void hradio_properties(t_gobj *z, t_glist *owner) x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize, 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol); gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); +#endif /* ROCKBOX */ } static void hradio_dialog(t_hradio *x, t_symbol *s, int argc, t_atom *argv) @@ -288,6 +335,10 @@ static void hradio_dialog(t_hradio *x, t_symbol *s, int argc, t_atom *argv) int num = (int)atom_getintarg(6, argc, argv); int sr_flags; +#ifdef ROCKBOX + (void) s; +#endif + if(chg != 0) chg = 1; x->x_change = chg; sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv); @@ -462,11 +513,22 @@ static void hradio_click(t_hradio *x, t_floatarg xpos, t_floatarg ypos, t_floata { int xx = (int)xpos - (int)text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist); +#ifdef ROCKBOX + (void) ypos; + (void) shift; + (void) ctrl; + (void) alt; +#endif + hradio_fout(x, (float)(xx / x->x_gui.x_w)); } static int hradio_newclick(t_gobj *z, struct _glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit) { +#ifdef ROCKBOX + (void) glist; + (void) dbl; +#endif if(doit) hradio_click((t_hradio *)z, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift, 0, (t_floatarg)alt); return (1); @@ -499,6 +561,9 @@ static void hradio_number(t_hradio *x, t_floatarg num) static void hradio_size(t_hradio *x, t_symbol *s, int ac, t_atom *av) { +#ifdef ROCKBOX + (void) s; +#endif x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av)); x->x_gui.x_h = x->x_gui.x_w; iemgui_size((void *)x, &x->x_gui); @@ -543,11 +608,21 @@ static void *hradio_donew(t_symbol *s, int argc, t_atom *argv, int old) { t_hradio *x = (t_hradio *)pd_new(old? hradio_old_class : hradio_class); int bflcol[]={-262144, -1, -1}; +#ifdef ROCKBOX + int a=IEM_GUI_DEFAULTSIZE, on=0; +#else int a=IEM_GUI_DEFAULTSIZE, on=0, f=0; +#endif int ldx=0, ldy=-6, chg=1, num=8; int fs=8; +#ifndef ROCKBOX int ftbreak=IEM_BNG_DEFAULTBREAKFLASHTIME, fthold=IEM_BNG_DEFAULTHOLDFLASHTIME; char str[144]; +#endif + +#ifdef ROCKBOX + (void) s; +#endif iem_inttosymargs(&x->x_gui.x_isa, 0); iem_inttofstyle(&x->x_gui.x_fsf, 0); @@ -632,7 +707,9 @@ static void hradio_ff(t_hradio *x) { if(x->x_gui.x_fsf.x_rcv_able) pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); +#ifndef ROCKBOX gfxstub_deleteforkey(x); +#endif } void g_hradio_setup(void) diff --git a/apps/plugins/pdbox/PDa/src/g_hslider.c b/apps/plugins/pdbox/PDa/src/g_hslider.c index c5d660c5d7..4f9343cffa 100644 --- a/apps/plugins/pdbox/PDa/src/g_hslider.c +++ b/apps/plugins/pdbox/PDa/src/g_hslider.c @@ -6,6 +6,13 @@ /* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#include "m_pd.h" +#include "g_canvas.h" +#include "g_all_guis.h" +#else /* ROCKBOX */ #include #include #include @@ -21,7 +28,7 @@ #else #include #endif - +#endif /* ROCKBOX */ /* ------------ hsl gui-horicontal slider ----------------------- */ @@ -32,6 +39,10 @@ static t_class *hslider_class; static void hslider_draw_update(t_hslider *x, t_glist *glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ t_canvas *canvas=glist_getcanvas(glist); int ypos=text_ypix(&x->x_gui.x_obj, glist); @@ -58,10 +69,15 @@ static void hslider_draw_update(t_hslider *x, t_glist *glist) } } } +#endif /* ROCKBOX */ } static void hslider_draw_new(t_hslider *x, t_glist *glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ int xpos=text_xpix(&x->x_gui.x_obj, glist); int ypos=text_ypix(&x->x_gui.x_obj, glist); int r = xpos + (x->x_val + 50)/100; @@ -88,10 +104,15 @@ static void hslider_draw_new(t_hslider *x, t_glist *glist) sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xIN%d\n", canvas, xpos-3, ypos, xpos+4, ypos+1, x, 0); +#endif /* ROCKBOX */ } static void hslider_draw_move(t_hslider *x, t_glist *glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ int xpos=text_xpix(&x->x_gui.x_obj, glist); int ypos=text_ypix(&x->x_gui.x_obj, glist); int r = xpos + (x->x_val + 50)/100; @@ -116,10 +137,15 @@ static void hslider_draw_move(t_hslider *x, t_glist *glist) canvas, x, 0, xpos-3, ypos, xpos+4, ypos+1); +#endif /* ROCKBOX */ } static void hslider_draw_erase(t_hslider* x,t_glist* glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ t_canvas *canvas=glist_getcanvas(glist); sys_vgui(".x%x.c delete %xBASE\n", canvas, x); @@ -129,10 +155,15 @@ static void hslider_draw_erase(t_hslider* x,t_glist* glist) sys_vgui(".x%x.c delete %xOUT%d\n", canvas, x, 0); if(!x->x_gui.x_fsf.x_rcv_able) sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); +#endif /* ROCKBOX */ } static void hslider_draw_config(t_hslider* x,t_glist* glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ t_canvas *canvas=glist_getcanvas(glist); sys_vgui(".x%x.c itemconfigure %xLABEL -font {%s %d bold} -fill #%6.6x -text {%s} \n", @@ -141,10 +172,16 @@ static void hslider_draw_config(t_hslider* x,t_glist* glist) strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:""); sys_vgui(".x%x.c itemconfigure %xKNOB -fill #%6.6x\n", canvas, x, x->x_gui.x_fcol); sys_vgui(".x%x.c itemconfigure %xBASE -fill #%6.6x\n", canvas, x, x->x_gui.x_bcol); +#endif /* ROCKBOX */ } static void hslider_draw_io(t_hslider* x,t_glist* glist, int old_snd_rcv_flags) { +#ifdef ROCKBOX + (void) x; + (void) glist; + (void) old_snd_rcv_flags; +#else /* ROCKBOX */ int xpos=text_xpix(&x->x_gui.x_obj, glist); int ypos=text_ypix(&x->x_gui.x_obj, glist); t_canvas *canvas=glist_getcanvas(glist); @@ -161,10 +198,15 @@ static void hslider_draw_io(t_hslider* x,t_glist* glist, int old_snd_rcv_flags) xpos+4, ypos+1, x, 0); if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able) sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); +#endif /* ROCKBOX */ } static void hslider_draw_select(t_hslider* x,t_glist* glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ t_canvas *canvas=glist_getcanvas(glist); if(x->x_gui.x_fsf.x_selected) @@ -177,6 +219,7 @@ static void hslider_draw_select(t_hslider* x,t_glist* glist) sys_vgui(".x%x.c itemconfigure %xBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL); sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol); } +#endif /* ROCKBOX */ } void hslider_draw(t_hslider *x, t_glist *glist, int mode) @@ -279,6 +322,10 @@ void hslider_check_minmax(t_hslider *x, double min, double max) static void hslider_properties(t_gobj *z, t_glist *owner) { +#ifdef ROCKBOX + (void) z; + (void) owner; +#else /* ROCKBOX */ t_hslider *x = (t_hslider *)z; char buf[800]; t_symbol *srl[3]; @@ -300,6 +347,7 @@ static void hslider_properties(t_gobj *z, t_glist *owner) x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize, 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol); gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); +#endif /* ROCKBOX */ } static void hslider_set(t_hslider *x, t_floatarg f) /* bugfix */ @@ -355,6 +403,10 @@ static void hslider_dialog(t_hslider *x, t_symbol *s, int argc, t_atom *argv) int steady = (int)atom_getintarg(17, argc, argv); int sr_flags; +#ifdef ROCKBOX + (void) s; +#endif + if(lilo != 0) lilo = 1; x->x_lin0_log1 = lilo; if(steady) @@ -375,6 +427,10 @@ static void hslider_motion(t_hslider *x, t_floatarg dx, t_floatarg dy) { int old = x->x_val; +#ifdef ROCKBOX + (void) dy; +#endif + if(x->x_gui.x_fsf.x_finemoved) x->x_pos += (int)dx; else @@ -402,6 +458,11 @@ static void hslider_motion(t_hslider *x, t_floatarg dx, t_floatarg dy) static void hslider_click(t_hslider *x, t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl, t_floatarg alt) { +#ifdef ROCKBOX + (void) shift; + (void) ctrl; + (void) alt; +#endif if(!x->x_steady) x->x_val = (int)(100.0 * (xpos - text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist))); if(x->x_val > (100*x->x_gui.x_w - 100)) @@ -420,6 +481,11 @@ static int hslider_newclick(t_gobj *z, struct _glist *glist, { t_hslider* x = (t_hslider *)z; +#ifdef ROCKBOX + (void) glist; + (void) dbl; +#endif + if(doit) { hslider_click( x, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift, @@ -434,6 +500,9 @@ static int hslider_newclick(t_gobj *z, struct _glist *glist, static void hslider_size(t_hslider *x, t_symbol *s, int ac, t_atom *av) { +#ifdef ROCKBOX + (void) s; +#endif hslider_check_width(x, (int)atom_getintarg(0, ac, av)); if(ac > 1) x->x_gui.x_h = iemgui_clip_size((int)atom_getintarg(1, ac, av)); @@ -448,6 +517,9 @@ static void hslider_pos(t_hslider *x, t_symbol *s, int ac, t_atom *av) static void hslider_range(t_hslider *x, t_symbol *s, int ac, t_atom *av) { +#ifdef ROCKBOX + (void) s; +#endif hslider_check_minmax(x, (double)atom_getfloatarg(0, ac, av), (double)atom_getfloatarg(1, ac, av)); } @@ -525,10 +597,20 @@ static void *hslider_new(t_symbol *s, int argc, t_atom *argv) t_hslider *x = (t_hslider *)pd_new(hslider_class); int bflcol[]={-262144, -1, -1}; int w=IEM_SL_DEFAULTSIZE, h=IEM_GUI_DEFAULTSIZE; +#ifdef ROCKBOX + int lilo=0, ldx=-2, ldy=-6, v=0, steady=1; +#else int lilo=0, ldx=-2, ldy=-6, f=0, v=0, steady=1; +#endif int fs=8; double min=0.0, max=(double)(IEM_SL_DEFAULTSIZE-1); +#ifndef ROCKBOX char str[144]; +#endif + +#ifdef ROCKBOX + (void) s; +#endif iem_inttosymargs(&x->x_gui.x_isa, 0); iem_inttofstyle(&x->x_gui.x_fsf, 0); @@ -607,7 +689,9 @@ static void hslider_free(t_hslider *x) { if(x->x_gui.x_fsf.x_rcv_able) pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); +#ifndef ROCKBOX gfxstub_deleteforkey(x); +#endif } void g_hslider_setup(void) diff --git a/apps/plugins/pdbox/PDa/src/g_io.c b/apps/plugins/pdbox/PDa/src/g_io.c index db69543a87..3df518717b 100644 --- a/apps/plugins/pdbox/PDa/src/g_io.c +++ b/apps/plugins/pdbox/PDa/src/g_io.c @@ -22,9 +22,17 @@ life elsewhere. */ * */ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#include "m_pd.h" +#include "g_canvas.h" +#else #include "m_pd.h" #include "g_canvas.h" #include +#endif + void signal_setborrowed(t_signal *sig, t_signal *sig2); void signal_makereusable(t_signal *sig); @@ -51,6 +59,9 @@ typedef struct _vinlet static void *vinlet_new(t_symbol *s) { +#ifdef ROCKBOX + (void) s; +#endif t_vinlet *x = (t_vinlet *)pd_new(vinlet_class); x->x_canvas = canvas_getcurrent(); x->x_inlet = canvas_addinlet(x->x_canvas, &x->x_obj.ob_pd, 0); @@ -108,7 +119,9 @@ int vinlet_issignal(t_vinlet *x) return (x->x_buf != 0); } +#ifndef ROCKBOX static int tot; +#endif t_int *vinlet_perform(t_int *w) { @@ -176,7 +189,13 @@ void vinlet_dspprolog(t_vinlet *x, t_signal **parentsigs, int myvecsize, int phase, int period, int frequency, int downsample, int upsample/* IOhannes */, int reblock, int switched) { +#ifdef ROCKBOX + t_signal *insig; + (void) frequency; + (void) switched; +#else t_signal *insig, *outsig; +#endif x->x_updown.downsample = downsample; x->x_updown.upsample = upsample; @@ -318,6 +337,9 @@ typedef struct _voutlet static void *voutlet_new(t_symbol *s) { +#ifdef ROCKBOX + (void) s; +#endif t_voutlet *x = (t_voutlet *)pd_new(voutlet_class); x->x_canvas = canvas_getcurrent(); x->x_parentoutlet = canvas_addoutlet(x->x_canvas, &x->x_obj.ob_pd, 0); @@ -445,6 +467,12 @@ void voutlet_dspprolog(t_voutlet *x, t_signal **parentsigs, int myvecsize, int phase, int period, int frequency, int downsample, int upsample /* IOhannes */, int reblock, int switched) { +#ifdef ROCKBOX + (void) myvecsize; + (void) phase; + (void) period; + (void) frequency; +#endif x->x_updown.downsample=downsample; x->x_updown.upsample=upsample; /* IOhannes */ x->x_justcopyout = (switched && !reblock); if (reblock) @@ -488,7 +516,11 @@ void voutlet_dspepilog(t_voutlet *x, t_signal **parentsigs, x->x_updown.downsample=downsample; x->x_updown.upsample=upsample; /* IOhannes */ if (reblock) { +#ifdef ROCKBOX + t_signal *outsig; +#else t_signal *insig, *outsig; +#endif int parentvecsize, bufsize, oldbufsize; int re_parentvecsize; /* IOhannes */ int bigperiod, epilogphase, blockphase; diff --git a/apps/plugins/pdbox/PDa/src/g_mycanvas.c b/apps/plugins/pdbox/PDa/src/g_mycanvas.c index 92615e912f..a00b1bf642 100644 --- a/apps/plugins/pdbox/PDa/src/g_mycanvas.c +++ b/apps/plugins/pdbox/PDa/src/g_mycanvas.c @@ -6,6 +6,13 @@ /* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#include "m_pd.h" +#include "g_canvas.h" +#include "g_all_guis.h" +#else /* ROCKBOX */ #include #include #include @@ -21,6 +28,7 @@ #else #include #endif +#endif /* ROCKBOX */ /* ---------- cnv my gui-canvas for a window ---------------- */ @@ -31,6 +39,10 @@ static t_class *my_canvas_class; void my_canvas_draw_new(t_my_canvas *x, t_glist *glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ int xpos=text_xpix(&x->x_gui.x_obj, glist); int ypos=text_ypix(&x->x_gui.x_obj, glist); t_canvas *canvas=glist_getcanvas(glist); @@ -48,10 +60,15 @@ void my_canvas_draw_new(t_my_canvas *x, t_glist *glist) canvas, xpos+x->x_gui.x_ldx, ypos+x->x_gui.x_ldy, strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:"", x->x_gui.x_font, x->x_gui.x_fontsize, x->x_gui.x_lcol, x); +#endif /* ROCKBOX */ } void my_canvas_draw_move(t_my_canvas *x, t_glist *glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ int xpos=text_xpix(&x->x_gui.x_obj, glist); int ypos=text_ypix(&x->x_gui.x_obj, glist); t_canvas *canvas=glist_getcanvas(glist); @@ -65,19 +82,29 @@ void my_canvas_draw_move(t_my_canvas *x, t_glist *glist) sys_vgui(".x%x.c coords %xLABEL %d %d\n", canvas, x, xpos+x->x_gui.x_ldx, ypos+x->x_gui.x_ldy); +#endif /* ROCKBOX */ } void my_canvas_draw_erase(t_my_canvas* x, t_glist* glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ t_canvas *canvas=glist_getcanvas(glist); sys_vgui(".x%x.c delete %xBASE\n", canvas, x); sys_vgui(".x%x.c delete %xRECT\n", canvas, x); sys_vgui(".x%x.c delete %xLABEL\n", canvas, x); +#endif /* ROCKBOX */ } void my_canvas_draw_config(t_my_canvas* x, t_glist* glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ t_canvas *canvas=glist_getcanvas(glist); sys_vgui(".x%x.c itemconfigure %xRECT -fill #%6.6x -outline #%6.6x\n", canvas, x, @@ -87,10 +114,15 @@ void my_canvas_draw_config(t_my_canvas* x, t_glist* glist) sys_vgui(".x%x.c itemconfigure %xLABEL -font {%s %d bold} -fill #%6.6x -text {%s} \n", canvas, x, x->x_gui.x_font, x->x_gui.x_fontsize, x->x_gui.x_lcol, strcmp(x->x_gui.x_lab->s_name, "empty")?x->x_gui.x_lab->s_name:""); +#endif /* ROCKBOX */ } void my_canvas_draw_select(t_my_canvas* x, t_glist* glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ t_canvas *canvas=glist_getcanvas(glist); if(x->x_gui.x_fsf.x_selected) @@ -101,6 +133,7 @@ void my_canvas_draw_select(t_my_canvas* x, t_glist* glist) { sys_vgui(".x%x.c itemconfigure %xBASE -outline #%6.6x\n", canvas, x, x->x_gui.x_bcol); } +#endif /* ROCKBOX */ } void my_canvas_draw(t_my_canvas *x, t_glist *glist, int mode) @@ -147,6 +180,10 @@ static void my_canvas_save(t_gobj *z, t_binbuf *b) static void my_canvas_properties(t_gobj *z, t_glist *owner) { +#ifdef ROCKBOX + (void) z; + (void) owner; +#else /* ROCKBOX */ t_my_canvas *x = (t_my_canvas *)z; char buf[800]; t_symbol *srl[3]; @@ -168,6 +205,7 @@ static void my_canvas_properties(t_gobj *z, t_glist *owner) x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize, 0xffffff & x->x_gui.x_bcol, -1/*no frontcolor*/, 0xffffff & x->x_gui.x_lcol); gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); +#endif /* ROCKBOX */ } static void my_canvas_get_pos(t_my_canvas *x) @@ -182,11 +220,19 @@ static void my_canvas_get_pos(t_my_canvas *x) static void my_canvas_dialog(t_my_canvas *x, t_symbol *s, int argc, t_atom *argv) { +#ifndef ROCKBOX t_symbol *srl[3]; +#endif int a = (int)atom_getintarg(0, argc, argv); int w = (int)atom_getintarg(2, argc, argv); int h = (int)atom_getintarg(3, argc, argv); +#ifndef ROCKBOX int sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv); +#endif + +#ifdef ROCKBOX + (void) s; +#endif x->x_gui.x_isa.x_loadinit = 0; if(a < 1) @@ -207,6 +253,10 @@ static void my_canvas_size(t_my_canvas *x, t_symbol *s, int ac, t_atom *av) { int i = (int)atom_getintarg(0, ac, av); +#ifdef ROCKBOX + (void) s; +#endif + if(i < 1) i = 1; x->x_gui.x_w = i; @@ -224,6 +274,10 @@ static void my_canvas_vis_size(t_my_canvas *x, t_symbol *s, int ac, t_atom *av) { int i; +#ifdef ROCKBOX + (void) s; +#endif + i = (int)atom_getintarg(0, ac, av); if(i < 1) i = 1; @@ -262,9 +316,19 @@ static void *my_canvas_new(t_symbol *s, int argc, t_atom *argv) t_my_canvas *x = (t_my_canvas *)pd_new(my_canvas_class); int bflcol[]={-233017, -1, -66577}; int a=IEM_GUI_DEFAULTSIZE, w=100, h=60; +#ifdef ROCKBOX + int ldx=20, ldy=12, i=0; +#else int ldx=20, ldy=12, f=2, i=0; +#endif int fs=14; +#ifndef ROCKBOX char str[144]; +#endif + +#ifdef ROCKBOX + (void) s; +#endif iem_inttosymargs(&x->x_gui.x_isa, 0); iem_inttofstyle(&x->x_gui.x_fsf, 0); @@ -350,7 +414,9 @@ static void my_canvas_ff(t_my_canvas *x) { if(x->x_gui.x_fsf.x_rcv_able) pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); +#ifndef ROCKBOX gfxstub_deleteforkey(x); +#endif } void g_mycanvas_setup(void) diff --git a/apps/plugins/pdbox/PDa/src/g_numbox.c b/apps/plugins/pdbox/PDa/src/g_numbox.c index 1c4dbb5e48..a5e0a447dc 100644 --- a/apps/plugins/pdbox/PDa/src/g_numbox.c +++ b/apps/plugins/pdbox/PDa/src/g_numbox.c @@ -4,6 +4,13 @@ /* my_numbox.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#include "m_pd.h" +#include "g_canvas.h" +#include "g_all_guis.h" +#else /* ROCKBOX */ #include #include #include @@ -19,6 +26,7 @@ #else #include #endif +#endif /* ROCKBOX */ /*------------------ global varaibles -------------------------*/ @@ -76,7 +84,11 @@ void my_numbox_ftoa(t_my_numbox *x) double f=x->x_val; int bufsize, is_exp=0, i, idecimal; +#ifdef ROCKBOX + ftoan(f, x->x_buf, 10); +#else sprintf(x->x_buf, "%g", f); +#endif bufsize = strlen(x->x_buf); if(bufsize >= 5)/* if it is in exponential mode */ { @@ -130,6 +142,10 @@ void my_numbox_ftoa(t_my_numbox *x) static void my_numbox_draw_update(t_my_numbox *x, t_glist *glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ if (glist_isvisible(glist)) { if(x->x_gui.x_fsf.x_change) @@ -169,10 +185,15 @@ static void my_numbox_draw_update(t_my_numbox *x, t_glist *glist) x->x_buf[0] = 0; } } +#endif /* ROCKBOX */ } static void my_numbox_draw_new(t_my_numbox *x, t_glist *glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ int half=x->x_gui.x_h/2, d=1+x->x_gui.x_h/34; int xpos=text_xpix(&x->x_gui.x_obj, glist); int ypos=text_ypix(&x->x_gui.x_obj, glist); @@ -215,10 +236,15 @@ static void my_numbox_draw_new(t_my_numbox *x, t_glist *glist) xpos, ypos, xpos+IOWIDTH, ypos+1, x, 0); +#endif /* ROCKBOX */ } static void my_numbox_draw_move(t_my_numbox *x, t_glist *glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ int half = x->x_gui.x_h/2, d=1+x->x_gui.x_h/34; int xpos=text_xpix(&x->x_gui.x_obj, glist); int ypos=text_ypix(&x->x_gui.x_obj, glist); @@ -248,10 +274,15 @@ static void my_numbox_draw_move(t_my_numbox *x, t_glist *glist) canvas, x, 0, xpos, ypos, xpos+IOWIDTH, ypos+1); +#endif /* ROCKBOX */ } static void my_numbox_draw_erase(t_my_numbox* x,t_glist* glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ t_canvas *canvas=glist_getcanvas(glist); sys_vgui(".x%x.c delete %xBASE1\n", canvas, x); @@ -262,10 +293,15 @@ static void my_numbox_draw_erase(t_my_numbox* x,t_glist* glist) sys_vgui(".x%x.c delete %xOUT%d\n", canvas, x, 0); if(!x->x_gui.x_fsf.x_rcv_able) sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); +#endif /* ROCKBOX */ } static void my_numbox_draw_config(t_my_numbox* x,t_glist* glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ t_canvas *canvas=glist_getcanvas(glist); sys_vgui(".x%x.c itemconfigure %xLABEL -font {%s %d bold} -fill #%6.6x -text {%s} \n", @@ -279,10 +315,16 @@ static void my_numbox_draw_config(t_my_numbox* x,t_glist* glist) x, x->x_gui.x_bcol); sys_vgui(".x%x.c itemconfigure %xBASE2 -fill #%6.6x\n", canvas, x, x->x_gui.x_fsf.x_selected?IEM_GUI_COLOR_SELECTED:x->x_gui.x_fcol); +#endif /* ROCKBOX */ } static void my_numbox_draw_io(t_my_numbox* x,t_glist* glist, int old_snd_rcv_flags) { +#ifdef ROCKBOX + (void) x; + (void) glist; + (void) old_snd_rcv_flags; +#else /* ROCKBOX */ int xpos=text_xpix(&x->x_gui.x_obj, glist); int ypos=text_ypix(&x->x_gui.x_obj, glist); t_canvas *canvas=glist_getcanvas(glist); @@ -303,10 +345,15 @@ static void my_numbox_draw_io(t_my_numbox* x,t_glist* glist, int old_snd_rcv_fla x, 0); if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able) sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); +#endif /* ROCKBOX */ } static void my_numbox_draw_select(t_my_numbox *x, t_glist *glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ t_canvas *canvas=glist_getcanvas(glist); if(x->x_gui.x_fsf.x_selected) @@ -338,6 +385,7 @@ static void my_numbox_draw_select(t_my_numbox *x, t_glist *glist) sys_vgui(".x%x.c itemconfigure %xNUMBER -fill #%6.6x\n", canvas, x, x->x_gui.x_fcol); } +#endif /* ROCKBOX */ } void my_numbox_draw(t_my_numbox *x, t_glist *glist, int mode) @@ -440,6 +488,10 @@ int my_numbox_check_minmax(t_my_numbox *x, double min, double max) static void my_numbox_properties(t_gobj *z, t_glist *owner) { +#ifdef ROCKBOX + (void) z; + (void) owner; +#else /* ROCKBOX */ t_my_numbox *x = (t_my_numbox *)z; char buf[800]; t_symbol *srl[3]; @@ -471,6 +523,7 @@ static void my_numbox_properties(t_gobj *z, t_glist *owner) 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol); gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); +#endif /* ROCKBOX */ } static void my_numbox_bang(t_my_numbox *x) @@ -492,6 +545,10 @@ static void my_numbox_dialog(t_my_numbox *x, t_symbol *s, int argc, int log_height = (int)atom_getintarg(6, argc, argv); int sr_flags; +#ifdef ROCKBOX + (void) s; +#endif + if(lilo != 0) lilo = 1; x->x_lin0_log1 = lilo; sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv); @@ -519,6 +576,10 @@ static void my_numbox_motion(t_my_numbox *x, t_floatarg dx, t_floatarg dy) { double k2=1.0; +#ifdef ROCKBOX + (void) dx; +#endif + if(x->x_gui.x_fsf.x_finemoved) k2 = 0.01; if(x->x_lin0_log1) @@ -534,6 +595,11 @@ static void my_numbox_motion(t_my_numbox *x, t_floatarg dx, t_floatarg dy) static void my_numbox_click(t_my_numbox *x, t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl, t_floatarg alt) { +#ifdef ROCKBOX + (void) shift; + (void) ctrl; + (void) alt; +#endif glist_grab(x->x_gui.x_glist, &x->x_gui.x_obj.te_g, (t_glistmotionfn)my_numbox_motion, my_numbox_key, xpos, ypos); } @@ -543,6 +609,11 @@ static int my_numbox_newclick(t_gobj *z, struct _glist *glist, { t_my_numbox* x = (t_my_numbox *)z; +#ifdef ROCKBOX + (void) glist; + (void) dbl; +#endif + if(doit) { my_numbox_click( x, (t_floatarg)xpix, (t_floatarg)ypix, @@ -603,6 +674,10 @@ static void my_numbox_size(t_my_numbox *x, t_symbol *s, int ac, t_atom *av) { int h, w; +#ifdef ROCKBOX + (void) s; +#endif + w = (int)atom_getintarg(0, ac, av); if(w < 1) w = 1; @@ -626,6 +701,9 @@ static void my_numbox_pos(t_my_numbox *x, t_symbol *s, int ac, t_atom *av) static void my_numbox_range(t_my_numbox *x, t_symbol *s, int ac, t_atom *av) { +#ifdef ROCKBOX + (void) s; +#endif if(my_numbox_check_minmax(x, (double)atom_getfloatarg(0, ac, av), (double)atom_getfloatarg(1, ac, av))) { @@ -742,6 +820,9 @@ static void my_numbox_key(void *z, t_floatarg fkey) static void my_numbox_list(t_my_numbox *x, t_symbol *s, int ac, t_atom *av) { +#ifdef ROCKBOX + (void) s; +#endif if (IS_A_FLOAT(av,0)) { my_numbox_set(x, atom_getfloatarg(0, ac, av)); @@ -754,11 +835,21 @@ static void *my_numbox_new(t_symbol *s, int argc, t_atom *argv) t_my_numbox *x = (t_my_numbox *)pd_new(my_numbox_class); int bflcol[]={-262144, -1, -1}; int w=5, h=14; +#ifdef ROCKBOX + int lilo=0, ldx=0, ldy=-6; +#else int lilo=0, f=0, ldx=0, ldy=-6; +#endif int fs=10; int log_height=256; double min=-1.0e+37, max=1.0e+37,v=0.0; +#ifndef ROCKBOX char str[144]; +#endif + +#ifdef ROCKBOX + (void) s; +#endif if((argc >= 17)&&IS_A_FLOAT(argv,0)&&IS_A_FLOAT(argv,1) &&IS_A_FLOAT(argv,2)&&IS_A_FLOAT(argv,3) @@ -843,7 +934,9 @@ static void my_numbox_free(t_my_numbox *x) pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); clock_free(x->x_clock_reset); clock_free(x->x_clock_wait); +#ifndef ROCKBOX gfxstub_deleteforkey(x); +#endif } void g_numbox_setup(void) diff --git a/apps/plugins/pdbox/PDa/src/g_readwrite.c b/apps/plugins/pdbox/PDa/src/g_readwrite.c index 55759dbf1a..81bf02e512 100644 --- a/apps/plugins/pdbox/PDa/src/g_readwrite.c +++ b/apps/plugins/pdbox/PDa/src/g_readwrite.c @@ -8,18 +8,29 @@ collection of "scalar" objects. Routines here can save collections of scalars into a file and reload them; also, support is included here for */ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#include "m_pd.h" +#include "g_canvas.h" +#else /* ROCKBOX */ #include #include #include "m_pd.h" #include "g_canvas.h" #include +#endif /* ROCKBOX */ /* the following routines read "scalars" from a file into a canvas. */ static int canvas_scanbinbuf(int natoms, t_atom *vec, int *p_indexout, int *p_next) { +#ifdef ROCKBOX + int i; +#else int i, j; +#endif int indexwas = *p_next; *p_indexout = indexwas; if (indexwas >= natoms) @@ -38,6 +49,9 @@ int glist_readscalar(t_glist *x, int natoms, t_atom *vec, static void canvas_readerror(int natoms, t_atom *vec, int message, int nline, char *s) { +#ifdef ROCKBOX + (void) natoms; +#endif error(s); startpost("line was:"); postatom(nline, vec + message); @@ -49,7 +63,11 @@ static void canvas_readerror(int natoms, t_atom *vec, int message, static void glist_readatoms(t_glist *x, int natoms, t_atom *vec, int *p_nextmsg, t_symbol *templatesym, t_word *w, int argc, t_atom *argv) { +#ifdef ROCKBOX + int message, n, i; +#else int message, nline, n, i; +#endif t_template *template = template_findbyname(templatesym); if (!template) @@ -64,7 +82,9 @@ static void glist_readatoms(t_glist *x, int natoms, t_atom *vec, { if (template->t_vec[i].ds_type == DT_ARRAY) { +#ifndef ROCKBOX int j; +#endif t_array *a = w[i].w_array; int elemsize = a->a_elemsize, nitems = 0; t_symbol *arraytemplatesym = template->t_vec[i].ds_arraytemplate; @@ -104,7 +124,11 @@ static void glist_readatoms(t_glist *x, int natoms, t_atom *vec, int glist_readscalar(t_glist *x, int natoms, t_atom *vec, int *p_nextmsg, int selectit) { +#ifdef ROCKBOX + int message, nline; +#else int message, i, j, nline; +#endif t_template *template; t_symbol *templatesym; t_scalar *sc; @@ -159,10 +183,16 @@ int glist_readscalar(t_glist *x, int natoms, t_atom *vec, void glist_readfrombinbuf(t_glist *x, t_binbuf *b, char *filename, int selectem) { +#ifdef ROCKBOX + int natoms, nline, message, nextmsg = 0; +#else t_canvas *canvas = glist_getcanvas(x); int cr = 0, natoms, nline, message, nextmsg = 0, i, j, nitems; +#endif t_atom *vec; +#ifndef ROCKBOX t_gobj *gobj; +#endif natoms = binbuf_getnatom(b); vec = binbuf_getvec(b); @@ -244,8 +274,12 @@ static void glist_doread(t_glist *x, t_symbol *filename, t_symbol *format, t_binbuf *b = binbuf_new(); t_canvas *canvas = glist_getcanvas(x); int wasvis = glist_isvisible(canvas); +#ifdef ROCKBOX + int cr = 0; +#else int cr = 0, natoms, nline, message, nextmsg = 0, i, j; t_atom *vec; +#endif if (!strcmp(format->s_name, "cr")) cr = 1; @@ -302,7 +336,7 @@ void canvas_dataproperties(t_canvas *x, t_scalar *sc, t_binbuf *b) /* take the new object off the list */ if (ntotal) { - for (y = x->gl_list, nnew = 1; y2 = y->g_next; + for(y = x->gl_list, nnew = 1; (y2 = y->g_next); y = y2, nnew++) if (nnew == ntotal) { @@ -360,7 +394,9 @@ static void glist_writelist(t_gobj *y, t_binbuf *b); void canvas_writescalar(t_symbol *templatesym, t_word *w, t_binbuf *b, int amarrayelement) { +#ifndef ROCKBOX t_dataslot *ds; +#endif t_template *template = template_findbyname(templatesym); t_atom *a = (t_atom *)t_getbytes(0); int i, n = template->t_n, natom = 0; @@ -532,12 +568,18 @@ t_binbuf *glist_writetobinbuf(t_glist *x, int wholething) static void glist_write(t_glist *x, t_symbol *filename, t_symbol *format) { +#ifdef ROCKBOX + int cr = 0; +#else int cr = 0, i; +#endif t_binbuf *b; char buf[MAXPDSTRING]; +#ifndef ROCKBOX t_symbol **templatevec = getbytes(0); int ntemplates = 0; t_gobj *y; +#endif t_canvas *canvas = glist_getcanvas(x); canvas_makefilename(canvas, filename->s_name, buf, MAXPDSTRING); if (!strcmp(format->s_name, "cr")) @@ -586,7 +628,7 @@ static void canvas_saveto(t_canvas *x, t_binbuf *b) gobj_save(y, b); linetraverser_start(&t, x); - while (oc = linetraverser_next(&t)) + while((oc = linetraverser_next(&t))) { int srcno = canvas_getindex(x, &t.tr_ob->ob_g); int sinkno = canvas_getindex(x, &t.tr_ob2->ob_g); @@ -629,7 +671,9 @@ static void canvas_savetemplatesto(t_canvas *x, t_binbuf *b, int wholething) { t_symbol **templatevec = getbytes(0); int i, ntemplates = 0; +#ifndef ROCKBOX t_gobj *y; +#endif canvas_collecttemplatesfor(x, &ntemplates, &templatevec, wholething); for (i = 0; i < ntemplates; i++) { @@ -687,9 +731,13 @@ static void canvas_savetofile(t_canvas *x, t_symbol *filename, t_symbol *dir) static void canvas_menusaveas(t_canvas *x) { +#ifdef ROCKBOX + (void) x; +#else /* ROCKBOX */ t_canvas *x2 = canvas_getrootfor(x); sys_vgui("pdtk_canvas_saveas .x%x \"%s\" \"%s\"\n", x2, x2->gl_name->s_name, canvas_getdir(x2)->s_name); +#endif /* ROCKBOX */ } static void canvas_menusave(t_canvas *x) diff --git a/apps/plugins/pdbox/PDa/src/g_rtext.c b/apps/plugins/pdbox/PDa/src/g_rtext.c index 05c31a9ea7..03aea97e9b 100644 --- a/apps/plugins/pdbox/PDa/src/g_rtext.c +++ b/apps/plugins/pdbox/PDa/src/g_rtext.c @@ -6,6 +6,14 @@ /* have to insert gui-objects into editor-list */ /* all changes are labeled with iemlib */ +#ifdef ROCKBOX +#include "plugin.h" +#include "ctype.h" +#include "pdbox.h" +#include "m_pd.h" +#include "g_canvas.h" +#define snprintf rb->snprintf +#else /* ROCKBOX */ #include #include #include @@ -14,6 +22,7 @@ #include "s_stuff.h" #include "g_canvas.h" #include "t_tk.h" +#endif /* ROCKBOX */ #define LMARGIN 1 #define RMARGIN 1 @@ -44,7 +53,9 @@ struct _rtext t_rtext *rtext_new(t_glist *glist, t_text *who) { t_rtext *x = (t_rtext *)getbytes(sizeof *x); +#ifndef ROCKBOX int w = 0, h = 0, indx; +#endif x->x_height = -1; x->x_text = who; x->x_glist = glist; @@ -53,8 +64,13 @@ t_rtext *rtext_new(t_glist *glist, t_text *who) x->x_drawnwidth = x->x_drawnheight = 0; binbuf_gettext(who->te_binbuf, &x->x_buf, &x->x_bufsize); glist->gl_editor->e_rtext = x; +#ifdef ROCKBOX + snprintf(x->x_tag, strlen(x->x_tag), + ".x%x.t%x", (t_int)glist_getcanvas(x->x_glist), (t_int)x); +#else /* ROCKBOX */ sprintf(x->x_tag, ".x%x.t%x", (t_int)glist_getcanvas(x->x_glist), (t_int)x); +#endif /* ROCKBOX */ return (x); } @@ -149,12 +165,18 @@ static void rtext_senditup(t_rtext *x, int action, int *widthp, int *heightp, char tempbuf[UPBUFSIZE], *tp = tempbuf, *bp = x->x_buf; int outchars, inchars = x->x_bufsize, nlines = 0, ncolumns = 0, pixwide, pixhigh; +#ifdef ROCKBOX + int fontwidth = 8, fontheight = 10; +#else int font = glist_getfont(x->x_glist); int fontwidth = sys_fontwidth(font), fontheight = sys_fontheight(font); +#endif int findx = (*widthp + (fontwidth/2)) / fontwidth, findy = *heightp / fontheight; int reportedindex = 0; +#ifndef ROCKBOX t_canvas *canvas = glist_getcanvas(x->x_glist); +#endif int widthspec = x->x_text->te_width; int widthlimit = (widthspec ? widthspec : BOXWIDTH); while (inchars) @@ -214,16 +236,22 @@ static void rtext_senditup(t_rtext *x, int action, int *widthp, int *heightp, pixhigh = nlines * fontheight + (TMARGIN + BMARGIN); if (action == SEND_FIRST) +#ifdef ROCKBOX + ; +#else /* ROCKBOX */ sys_vgui("pdtk_text_new .x%x.c %s %f %f {%.*s} %d %s\n", canvas, x->x_tag, dispx + LMARGIN, dispy + TMARGIN, outchars, tempbuf, sys_hostfontsize(font), (glist_isselected(x->x_glist, &x->x_glist->gl_gobj)? "blue" : "black")); +#endif /* ROCKBOX */ else if (action == SEND_UPDATE) { +#ifndef ROCKBOX sys_vgui("pdtk_text_set .x%x.c %s {%.*s}\n", canvas, x->x_tag, outchars, tempbuf); +#endif if (pixwide != x->x_drawnwidth || pixhigh != x->x_drawnheight) text_drawborder(x->x_text, x->x_glist, x->x_tag, pixwide, pixhigh, 0); @@ -231,18 +259,22 @@ static void rtext_senditup(t_rtext *x, int action, int *widthp, int *heightp, { if (x->x_selend > x->x_selstart) { +#ifndef ROCKBOX sys_vgui(".x%x.c select from %s %d\n", canvas, x->x_tag, x->x_selstart); sys_vgui(".x%x.c select to %s %d\n", canvas, x->x_tag, x->x_selend + (sys_oldtclversion ? 0 : -1)); sys_vgui(".x%x.c focus \"\"\n", canvas); +#endif } else { +#ifndef ROCKBOX sys_vgui(".x%x.c select clear\n", canvas); sys_vgui(".x%x.c icursor %s %d\n", canvas, x->x_tag, x->x_selstart); sys_vgui(".x%x.c focus %s\n", canvas, x->x_tag); +#endif } } } @@ -273,7 +305,9 @@ void rtext_retext(t_rtext *x) int wantreduce = bufsize - text->te_width; char *decimal = 0, *nextchar, *ebuf = x->x_buf + bufsize, *s1, *s2; +#ifndef ROCKBOX int ndecimals; +#endif for (decimal = x->x_buf; decimal < ebuf; decimal++) if (*decimal == '.') break; @@ -339,21 +373,35 @@ void rtext_draw(t_rtext *x) void rtext_erase(t_rtext *x) { +#ifdef ROCKBOX + (void) x; +#else sys_vgui(".x%x.c delete %s\n", glist_getcanvas(x->x_glist), x->x_tag); +#endif } void rtext_displace(t_rtext *x, int dx, int dy) { +#ifdef ROCKBOX + (void) x; + (void) dx; + (void) dy; +#else /* ROCKBOX */ sys_vgui(".x%x.c move %s %d %d\n", glist_getcanvas(x->x_glist), x->x_tag, dx, dy); +#endif /* ROCKBOX */ } void rtext_select(t_rtext *x, int state) { t_glist *glist = x->x_glist; t_canvas *canvas = glist_getcanvas(glist); +#ifdef ROCKBOX + (void) state; +#else /* ROCKBOX */ sys_vgui(".x%x.c itemconfigure %s -fill %s\n", canvas, x->x_tag, (state? "blue" : "black")); +#endif /* ROCKBOX */ canvas_editing = canvas; } @@ -361,10 +409,14 @@ void rtext_activate(t_rtext *x, int state) { int w = 0, h = 0, indx; t_glist *glist = x->x_glist; +#ifndef ROCKBOX t_canvas *canvas = glist_getcanvas(glist); +#endif if (state) { +#ifndef ROCKBOX sys_vgui(".x%x.c focus %s\n", canvas, x->x_tag); +#endif glist->gl_editor->e_textedfor = x; glist->gl_editor->e_textdirty = 0; x->x_dragfrom = x->x_selstart = 0; @@ -373,8 +425,10 @@ void rtext_activate(t_rtext *x, int state) } else { +#ifndef ROCKBOX sys_vgui("selection clear .x%x.c\n", canvas); sys_vgui(".x%x.c focus \"\"\n", canvas); +#endif if (glist->gl_editor->e_textedfor == x) glist->gl_editor->e_textedfor = 0; x->x_active = 0; @@ -385,7 +439,9 @@ void rtext_activate(t_rtext *x, int state) void rtext_key(t_rtext *x, int keynum, t_symbol *keysym) { int w = 0, h = 0, indx, i, newsize, ndel; +#ifndef ROCKBOX char *s1, *s2; +#endif if (keynum) { int n = keynum; diff --git a/apps/plugins/pdbox/PDa/src/g_scalar.c b/apps/plugins/pdbox/PDa/src/g_scalar.c index 329003e63e..8f9b5609d5 100644 --- a/apps/plugins/pdbox/PDa/src/g_scalar.c +++ b/apps/plugins/pdbox/PDa/src/g_scalar.c @@ -19,11 +19,18 @@ control their appearances by adding stuff to draw. * added Krzysztof Czajas fix to avoid crashing... */ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#include "m_pd.h" +#include "g_canvas.h" +#else /* ROCKBOX */ #include #include #include /* for read/write to files */ #include "m_pd.h" #include "g_canvas.h" +#endif /* ROCKBOX */ t_class *scalar_class; @@ -139,6 +146,9 @@ void glist_scalar(t_glist *glist, t_binbuf *b; int natoms, nextmsg = 0; t_atom *vec; +#ifdef ROCKBOX + (void) classname; +#endif if (!template_findbyname(templatesym)) { pd_error(glist, "%s: no such template", @@ -167,7 +177,9 @@ static void scalar_getrect(t_gobj *z, t_glist *owner, int *xp1, int *yp1, int *xp2, int *yp2) { t_scalar *x = (t_scalar *)z; +#ifndef ROCKBOX int hit = 0; +#endif t_template *template = template_findbyname(x->sc_template); t_canvas *templatecanvas = template_findcanvas(template); int x1 = 0x7fffffff, x2 = -0x7fffffff, y1 = 0x7fffffff, y2 = -0x7fffffff; @@ -213,7 +225,9 @@ static void scalar_getrect(t_gobj *z, t_glist *owner, static void scalar_select(t_gobj *z, t_glist *owner, int state) { +#ifndef ROCKBOX t_scalar *x = (t_scalar *)z; +#endif /* post("scalar_select %d", state); */ /* later */ if (state) @@ -221,12 +235,16 @@ static void scalar_select(t_gobj *z, t_glist *owner, int state) int x1, y1, x2, y2; scalar_getrect(z, owner, &x1, &y1, &x2, &y2); x1--; x2++; y1--; y2++; +#ifndef ROCKBOX sys_vgui(".x%x.c create line %d %d %d %d %d %d %d %d %d %d \ -width 0 -fill blue -tags select%x\n", glist_getcanvas(owner), x1, y1, x1, y2, x2, y2, x2, y1, x1, y1, x); +#endif } +#ifndef ROCKBOX else sys_vgui(".x%x.c delete select%x\n", glist_getcanvas(owner), x); +#endif } static void scalar_displace(t_gobj *z, t_glist *glist, int dx, int dy) @@ -263,12 +281,21 @@ static void scalar_displace(t_gobj *z, t_glist *glist, int dx, int dy) static void scalar_activate(t_gobj *z, t_glist *owner, int state) { +#ifdef ROCKBOX + (void) z; + (void) owner; + (void) state; +#endif /* post("scalar_activate %d", state); */ /* later */ } static void scalar_delete(t_gobj *z, t_glist *glist) { +#ifdef ROCKBOX + (void) z; + (void) glist; +#endif /* nothing to do */ } @@ -285,12 +312,16 @@ static void scalar_vis(t_gobj *z, t_glist *owner, int vis) { if (vis) { +#ifndef ROCKBOX int x1 = glist_xtopixels(owner, basex); int y1 = glist_ytopixels(owner, basey); sys_vgui(".x%x.c create rectangle %d %d %d %d -tags scalar%x\n", glist_getcanvas(owner), x1-1, y1-1, x1+1, y1+1, x); +#endif } +#ifndef ROCKBOX else sys_vgui(".x%x.c delete scalar%x\n", glist_getcanvas(owner), x); +#endif return; } @@ -316,9 +347,9 @@ static int scalar_click(t_gobj *z, struct _glist *owner, { t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd); if (!wb) continue; - if (hit = (*wb->w_parentclickfn)(y, owner, + if((hit = (*wb->w_parentclickfn)(y, owner, x, template, basex, basey, - xpix, ypix, shift, alt, dbl, doit)) + xpix, ypix, shift, alt, dbl, doit))) return (hit); } return (0); @@ -331,8 +362,10 @@ static void scalar_save(t_gobj *z, t_binbuf *b) { t_scalar *x = (t_scalar *)z; t_binbuf *b2 = binbuf_new(); +#ifndef ROCKBOX t_atom a, *argv; int i, argc; +#endif canvas_writescalar(x->sc_template, x->sc_vec, b2, 0); binbuf_addv(b, "ss", &s__X, gensym("scalar")); binbuf_addbinbuf(b, b2); @@ -342,6 +375,10 @@ static void scalar_save(t_gobj *z, t_binbuf *b) static void scalar_properties(t_gobj *z, struct _glist *owner) { +#ifdef ROCKBOX + (void) z; + (void) owner; +#else /* ROCKBOX */ t_scalar *x = (t_scalar *)z; char *buf, buf2[80]; int bufsize; @@ -358,6 +395,7 @@ static void scalar_properties(t_gobj *z, struct _glist *owner) sys_gui(buf); sys_gui("}\n"); t_freebytes(buf, bufsize+1); +#endif /* ROCKBOX */ } static t_widgetbehavior scalar_widgetbehavior = @@ -373,8 +411,10 @@ static t_widgetbehavior scalar_widgetbehavior = static void scalar_free(t_scalar *x) { +#ifndef ROCKBOX int i; t_dataslot *datatypes, *dt; +#endif t_symbol *templatesym = x->sc_template; t_template *template = template_findbyname(templatesym); if (!template) @@ -383,7 +423,9 @@ static void scalar_free(t_scalar *x) return; } word_free(x->sc_vec, template); +#ifndef ROCKBOX gfxstub_deleteforkey(x); +#endif /* the "size" field in the class is zero, so Pd doesn't try to free us automatically (see pd_free()) */ freebytes(x, sizeof(t_scalar) + (template->t_n - 1) * sizeof(*x->sc_vec)); diff --git a/apps/plugins/pdbox/PDa/src/g_template.c b/apps/plugins/pdbox/PDa/src/g_template.c index 9e62c0f1d2..deb47c3129 100644 --- a/apps/plugins/pdbox/PDa/src/g_template.c +++ b/apps/plugins/pdbox/PDa/src/g_template.c @@ -2,6 +2,14 @@ * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#include "m_pd.h" +#include "s_stuff.h" +#include "g_canvas.h" +#define snprintf rb->snprintf +#else /* ROCKBOX */ #include #include #include @@ -9,6 +17,7 @@ #include "m_pd.h" #include "s_stuff.h" /* for sys_hostfontsize */ #include "g_canvas.h" +#endif /* ROCKBOX */ /* This file contains text objects you would put in a canvas to define a @@ -140,7 +149,9 @@ int template_size(t_template *x) int template_find_field(t_template *x, t_symbol *name, int *p_onset, int *p_type, t_symbol **p_arraytype) { +#ifndef ROCKBOX t_template *t; +#endif int i, n; if (!x) { @@ -262,7 +273,13 @@ elements might still be old ones. static void template_conformwords(t_template *tfrom, t_template *tto, int *conformaction, t_word *wfrom, t_word *wto) { +#ifdef ROCKBOX + int nto = tto->t_n, i; + + (void) tfrom; +#else int nfrom = tfrom->t_n, nto = tto->t_n, i; +#endif for (i = 0; i < nto; i++) { if (conformaction[i] >= 0) @@ -282,7 +299,11 @@ static t_scalar *template_conformscalar(t_template *tfrom, t_template *tto, { t_scalar *x; t_gpointer gp; +#ifdef ROCKBOX + int i; +#else int nto = tto->t_n, nfrom = tfrom->t_n, i; +#endif t_template *scalartemplate; /* post("conform scalar"); */ /* possibly replace the scalar */ @@ -311,7 +332,7 @@ static t_scalar *template_conformscalar(t_template *tfrom, t_template *tto, else { t_gobj *y, *y2; - for (y = glist->gl_list; y2 = y->g_next; y = y2) + for (y = glist->gl_list; (y2 = y->g_next); y = y2) if (y2 == &scfrom->sc_gobj) { x->sc_gobj.g_next = y2->g_next; @@ -447,7 +468,9 @@ void template_conform(t_template *tfrom, t_template *tto) t_template *template_findbyname(t_symbol *s) { +#ifndef ROCKBOX int i; +#endif if (s == &s_float) return (&template_float); else return ((t_template *)pd_findbyclass(s, template_class)); @@ -477,6 +500,10 @@ static void *template_usetemplate(void *dummy, t_symbol *s, t_template *x; t_symbol *templatesym = canvas_makebindsym(atom_getsymbolarg(0, argc, argv)); +#ifdef ROCKBOX + (void) dummy; + (void) s; +#endif if (!argc) return (0); argc--; argv++; @@ -540,7 +567,9 @@ static void *gtemplate_donew(t_symbol *sym, int argc, t_atom *argv) t_gtemplate *x = (t_gtemplate *)pd_new(gtemplate_class); t_template *t = template_findbyname(sym); int i; +#ifndef ROCKBOX t_symbol *sx = gensym("x"); +#endif x->x_owner = canvas_getcurrent(); x->x_next = 0; x->x_sym = sym; @@ -559,7 +588,7 @@ static void *gtemplate_donew(t_symbol *sym, int argc, t_atom *argv) if (t->t_list) { t_gtemplate *x2, *x3; - for (x2 = x->x_template->t_list; x3 = x2->x_next; x2 = x3) + for(x2 = x->x_template->t_list; (x3 = x2->x_next); x2 = x3) ; x2->x_next = x; post("template %s: warning: already exists.", sym->s_name); @@ -593,8 +622,13 @@ static void *gtemplate_donew(t_symbol *sym, int argc, t_atom *argv) static void *gtemplate_new(t_symbol *s, int argc, t_atom *argv) { +#ifndef ROCKBOX t_gtemplate *x = (t_gtemplate *)pd_new(gtemplate_class); +#endif t_symbol *sym = atom_getsymbolarg(0, argc, argv); +#ifdef ROCKBOX + (void) s; +#endif if (argc >= 1) argc--; argv++; return (gtemplate_donew(canvas_makebindsym(sym), argc, argv)); @@ -603,9 +637,14 @@ static void *gtemplate_new(t_symbol *s, int argc, t_atom *argv) /* old version (0.34) -- delete 2003 or so */ static void *gtemplate_new_old(t_symbol *s, int argc, t_atom *argv) { +#ifndef ROCKBOX t_gtemplate *x = (t_gtemplate *)pd_new(gtemplate_class); +#endif t_symbol *sym = canvas_makebindsym(canvas_getcurrent()->gl_name); static int warned; +#ifdef ROCKBOX + (void) s; +#endif if (!warned) { post("warning -- 'template' (%s) is obsolete; replace with 'struct'", @@ -643,7 +682,7 @@ static void gtemplate_free(t_gtemplate *x) else { t_gtemplate *x2, *x3; - for (x2 = t->t_list; x3 = x2->x_next; x2 = x3) + for(x2 = t->t_list; (x3 = x2->x_next); x2 = x3) { if (x == x3) { @@ -829,6 +868,16 @@ static void curve_displace(t_gobj *z, t_glist *glist, t_word *data, t_template *template, float basex, float basey, int dx, int dy) { +#ifdef ROCKBOX + (void) z; + (void) glist; + (void) data; + (void) template; + (void) basex; + (void) basey; + (void) dx; + (void) dy; +#endif /* refuse */ } @@ -836,6 +885,15 @@ static void curve_select(t_gobj *z, t_glist *glist, t_word *data, t_template *template, float basex, float basey, int state) { +#ifdef ROCKBOX + (void) z; + (void) glist; + (void) data; + (void) template; + (void) basex; + (void) basey; + (void) state; +#endif /* fill in later */ } @@ -843,6 +901,15 @@ static void curve_activate(t_gobj *z, t_glist *glist, t_word *data, t_template *template, float basex, float basey, int state) { +#ifdef ROCKBOX + (void) z; + (void) glist; + (void) data; + (void) template; + (void) basex; + (void) basey; + (void) state; +#endif /* fill in later */ } @@ -861,8 +928,13 @@ static void numbertocolor(int n, char *s) red = n / 100; blue = ((n / 10) % 10); green = n % 10; +#ifdef ROCKBOX + snprintf(s, 8, "#%2.2x%2.2x%2.2x", + rangecolor(red), rangecolor(blue), rangecolor(green)); +#else sprintf(s, "#%2.2x%2.2x%2.2x", rangecolor(red), rangecolor(blue), rangecolor(green)); +#endif } static void curve_vis(t_gobj *z, t_glist *glist, @@ -872,12 +944,22 @@ static void curve_vis(t_gobj *z, t_glist *glist, t_curve *x = (t_curve *)z; int i, n = x->x_npoints; t_fielddesc *f = x->x_vec; + +#ifdef ROCKBOX + (void) glist; + (void) basex; + (void) basey; +#endif if (vis) { if (n > 1) { +#ifdef ROCKBOX + int flags = x->x_flags; +#else int flags = x->x_flags, closed = (flags & CLOSED); +#endif float width = fielddesc_getfloat(&x->x_width, template, data, 1); char outline[20], fill[20]; if (width < 1) width = 1; @@ -889,19 +971,26 @@ static void curve_vis(t_gobj *z, t_glist *glist, numbertocolor( fielddesc_getfloat(&x->x_fillcolor, template, data, 1), fill); +#ifndef ROCKBOX sys_vgui(".x%x.c create polygon\\\n", glist_getcanvas(glist)); +#endif } +#ifndef ROCKBOX else sys_vgui(".x%x.c create line\\\n", glist_getcanvas(glist)); +#endif for (i = 0, f = x->x_vec; i < n; i++, f += 2) { +#ifndef ROCKBOX float xloc = glist_xtopixels(glist, basex + fielddesc_getfloat(f, template, data, 1)); float yloc = glist_ytopixels(glist, basey + fielddesc_getfloat(f+1, template, data, 1)); sys_vgui("%d %d\\\n", (int)xloc, (int)yloc); +#endif } +#ifndef ROCKBOX sys_vgui("-width %f\\\n", fielddesc_getfloat(&x->x_width, template, data, 1)); if (flags & CLOSED) sys_vgui("-fill %s -outline %s\\\n", @@ -909,13 +998,16 @@ static void curve_vis(t_gobj *z, t_glist *glist, else sys_vgui("-fill %s\\\n", outline); if (flags & BEZ) sys_vgui("-smooth 1\\\n"); sys_vgui("-tags curve%x\n", data); +#endif } else post("warning: curves need at least two points to be graphed"); } else { +#ifndef ROCKBOX if (n > 1) sys_vgui(".x%x.c delete curve%x\n", glist_getcanvas(glist), data); +#endif } } @@ -969,6 +1061,13 @@ static int curve_click(t_gobj *z, t_glist *glist, int besterror = 0x7fffffff; t_fielddesc *f = x->x_vec; t_word *data = sc->sc_vec; + +#ifdef ROCKBOX + (void) shift; + (void) alt; + (void) dbl; +#endif + for (i = 0, f = x->x_vec; i < n; i++, f += 2) { int xloc = glist_xtopixels(glist, @@ -1060,9 +1159,16 @@ static void *plot_new(t_symbol *classsym, t_int argc, t_atom *argv) { t_plot *x = (t_plot *)pd_new(plot_class); int flags = 0; +#ifndef ROCKBOX int nxy, i; t_fielddesc *fd; +#endif t_symbol *firstarg = atom_getsymbolarg(0, argc, argv); + +#ifdef ROCKBOX + (void) classsym; +#endif + if (!strcmp(firstarg->s_name, "curve")) { flags |= BEZ; @@ -1132,7 +1238,11 @@ int array_getfields(t_symbol *elemtemplatesym, t_template **elemtemplatep, int *elemsizep, int *xonsetp, int *yonsetp, int *wonsetp) { +#ifdef ROCKBOX + int elemsize, yonset, wonset, xonset, type; +#else int arrayonset, elemsize, yonset, wonset, xonset, type; +#endif t_template *elemtemplate; t_symbol *dummy; t_canvas *elemtemplatecanvas = 0; @@ -1219,6 +1329,16 @@ static void plot_displace(t_gobj *z, t_glist *glist, t_word *data, t_template *template, float basex, float basey, int dx, int dy) { +#ifdef ROCKBOX + (void) z; + (void) glist; + (void) data; + (void) template; + (void) basex; + (void) basey; + (void) dx; + (void) dy; +#endif /* not yet */ } @@ -1226,6 +1346,15 @@ static void plot_select(t_gobj *z, t_glist *glist, t_word *data, t_template *template, float basex, float basey, int state) { +#ifdef ROCKBOX + (void) z; + (void) glist; + (void) data; + (void) template; + (void) basex; + (void) basey; + (void) state; +#endif /* not yet */ } @@ -1233,6 +1362,15 @@ static void plot_activate(t_gobj *z, t_glist *glist, t_word *data, t_template *template, float basex, float basey, int state) { +#ifdef ROCKBOX + (void) z; + (void) glist; + (void) data; + (void) template; + (void) basex; + (void) basey; + (void) state; +#endif /* not yet */ } @@ -1270,8 +1408,10 @@ static void plot_vis(t_gobj *z, t_glist *glist, { /* found "w" field which controls linewidth. The trace is a filled polygon with 2n points. */ +#ifndef ROCKBOX sys_vgui(".x%x.c create polygon \\\n", glist_getcanvas(glist)); +#endif for (i = 0, xsum = xloc; i < nelem; i++) { @@ -1287,9 +1427,11 @@ static void plot_vis(t_gobj *z, t_glist *glist, ixpix = xpix + 0.5; if (xonset >= 0 || ixpix != lastpixel) { +#ifndef ROCKBOX sys_vgui("%d %f \\\n", ixpix, glist_ytopixels(glist, basey + yloc + yval - wval)); +#endif ndrawn++; } lastpixel = ixpix; @@ -1310,8 +1452,10 @@ static void plot_vis(t_gobj *z, t_glist *glist, ixpix = xpix + 0.5; if (xonset >= 0 || ixpix != lastpixel) { +#ifndef ROCKBOX sys_vgui("%d %f \\\n", ixpix, glist_ytopixels(glist, basey + yloc + yval + wval)); +#endif ndrawn++; } lastpixel = ixpix; @@ -1321,23 +1465,31 @@ static void plot_vis(t_gobj *z, t_glist *glist, should be at least two already. */ if (ndrawn < 4) { +#ifndef ROCKBOX sys_vgui("%d %f \\\n", ixpix + 10, glist_ytopixels(glist, basey + yloc + yval + wval)); sys_vgui("%d %f \\\n", ixpix + 10, glist_ytopixels(glist, basey + yloc + yval - wval)); +#endif } ouch: +#ifdef ROCKBOX + ; +#else /* ROCKBOX */ sys_vgui(" -width 1 -fill %s -outline %s\\\n", outline, outline); if (x->x_flags & BEZ) sys_vgui("-smooth 1\\\n"); sys_vgui("-tags plot%x\n", data); +#endif /* ROCKBOX */ } else if (linewidth > 0) { /* no "w" field. If the linewidth is positive, draw a segmented line with the requested width; otherwise don't draw the trace at all. */ +#ifndef ROCKBOX sys_vgui(".x%x.c create line \\\n", glist_getcanvas(glist)); +#endif for (xsum = xloc, i = 0; i < nelem; i++) { @@ -1352,14 +1504,17 @@ static void plot_vis(t_gobj *z, t_glist *glist, ixpix = xpix + 0.5; if (xonset >= 0 || ixpix != lastpixel) { +#ifndef ROCKBOX sys_vgui("%d %f \\\n", ixpix, glist_ytopixels(glist, basey + yloc + yval)); +#endif ndrawn++; } lastpixel = ixpix; if (ndrawn >= 1000) break; } /* TK will complain if there aren't at least 2 points... */ +#ifndef ROCKBOX if (ndrawn == 0) sys_vgui("0 0 0 0 \\\n"); else if (ndrawn == 1) sys_vgui("%d %f \\\n", ixpix + 10, glist_ytopixels(glist, basey + yloc + yval)); @@ -1369,6 +1524,7 @@ static void plot_vis(t_gobj *z, t_glist *glist, if (x->x_flags & BEZ) sys_vgui("-smooth 1\\\n"); sys_vgui("-tags plot%x\n", data); +#endif } /* We're done with the outline; now draw all the points. This code is inefficient since the template has to be @@ -1413,8 +1569,10 @@ static void plot_vis(t_gobj *z, t_glist *glist, } } /* and then the trace */ +#ifndef ROCKBOX sys_vgui(".x%x.c delete plot%x\n", - glist_getcanvas(glist), data); + glist_getcanvas(glist), data); +#endif } } @@ -1526,8 +1684,12 @@ static void drawnumber_getrect(t_gobj *z, t_glist *glist, basex + fielddesc_getfloat(&x->x_xloc, template, data, 0)); int yloc = glist_ytopixels(glist, basey + fielddesc_getfloat(&x->x_yloc, template, data, 0)); +#ifdef ROCKBOX + int fontwidth = 8, fontheight = 10; +#else int font = glist_getfont(glist); int fontwidth = sys_fontwidth(font), fontheight = sys_fontheight(font); +#endif char buf[DRAWNUMBER_BUFSIZE]; if (x->x_flags & DRAW_SYMBOL) SETSYMBOL(&at, fielddesc_getsymbol(&x->x_value, template, data, 0)); @@ -1543,6 +1705,16 @@ static void drawnumber_displace(t_gobj *z, t_glist *glist, t_word *data, t_template *template, float basex, float basey, int dx, int dy) { +#ifdef ROCKBOX + (void) z; + (void) glist; + (void) data; + (void) template; + (void) basex; + (void) basey; + (void) dx; + (void) dy; +#endif /* refuse */ } @@ -1550,6 +1722,14 @@ static void drawnumber_select(t_gobj *z, t_glist *glist, t_word *data, t_template *template, float basex, float basey, int state) { +#ifdef ROCKBOX + (void) z; + (void) glist; + (void) data; + (void) template; + (void) basex; + (void) basey; +#endif post("drawnumber_select %d", state); /* fill in later */ } @@ -1558,6 +1738,14 @@ static void drawnumber_activate(t_gobj *z, t_glist *glist, t_word *data, t_template *template, float basex, float basey, int state) { +#ifdef ROCKBOX + (void) z; + (void) glist; + (void) data; + (void) template; + (void) basex; + (void) basey; +#endif post("drawnumber_activate %d", state); } @@ -1566,14 +1754,22 @@ static void drawnumber_vis(t_gobj *z, t_glist *glist, int vis) { t_drawnumber *x = (t_drawnumber *)z; - + +#ifdef ROCKBOX + (void) glist; + (void) basex; + (void) basey; +#endif + if (vis) { t_atom at; +#ifndef ROCKBOX int xloc = glist_xtopixels(glist, basex + fielddesc_getfloat(&x->x_xloc, template, data, 0)); int yloc = glist_ytopixels(glist, basey + fielddesc_getfloat(&x->x_yloc, template, data, 0)); +#endif char colorstring[20], buf[DRAWNUMBER_BUFSIZE]; numbertocolor(fielddesc_getfloat(&x->x_color, template, data, 1), colorstring); @@ -1581,13 +1777,17 @@ static void drawnumber_vis(t_gobj *z, t_glist *glist, SETSYMBOL(&at, fielddesc_getsymbol(&x->x_value, template, data, 0)); else SETFLOAT(&at, fielddesc_getfloat(&x->x_value, template, data, 0)); drawnumber_sprintf(x, buf, &at); +#ifndef ROCKBOX sys_vgui(".x%x.c create text %d %d -anchor nw -fill %s -text {%s}", glist_getcanvas(glist), xloc, yloc, colorstring, buf); sys_vgui(" -font -*-courier-bold--normal--%d-*", sys_hostfontsize(glist_getfont(glist))); sys_vgui(" -tags drawnumber%x\n", data); +#endif } +#ifndef ROCKBOX else sys_vgui(".x%x.c delete drawnumber%x\n", glist_getcanvas(glist), data); +#endif } static float drawnumber_motion_ycumulative; @@ -1604,6 +1804,9 @@ static void drawnumber_motion(void *z, t_floatarg dx, t_floatarg dy) t_drawnumber *x = (t_drawnumber *)z; t_fielddesc *f = &x->x_value; drawnumber_motion_ycumulative -= dy; +#ifdef ROCKBOX + (void) dx; +#endif template_setfloat(drawnumber_motion_template, f->fd_un.fd_varsym, drawnumber_motion_wp, @@ -1619,6 +1822,11 @@ static int drawnumber_click(t_gobj *z, t_glist *glist, t_drawnumber *x = (t_drawnumber *)z; int x1, y1, x2, y2; t_word *data = sc->sc_vec; +#ifdef ROCKBOX + (void) shift; + (void) alt; + (void) dbl; +#endif drawnumber_getrect(z, glist, sc->sc_vec, template, basex, basey, &x1, &y1, &x2, &y2); @@ -1652,6 +1860,9 @@ t_parentwidgetbehavior drawnumber_widgetbehavior = static void drawnumber_free(t_drawnumber *x) { +#ifdef ROCKBOX + (void) x; +#endif } static void drawnumber_setup(void) @@ -1678,3 +1889,4 @@ void g_template_setup(void) } + diff --git a/apps/plugins/pdbox/PDa/src/g_text.c b/apps/plugins/pdbox/PDa/src/g_text.c index f1fbb7f719..98b3fb74f8 100644 --- a/apps/plugins/pdbox/PDa/src/g_text.c +++ b/apps/plugins/pdbox/PDa/src/g_text.c @@ -6,15 +6,21 @@ /* the methods for calling the gui-objects from menu are implemented */ /* all changes are labeled with iemlib */ -#include #include "m_pd.h" #include "m_imp.h" #include "s_stuff.h" #include "t_tk.h" #include "g_canvas.h" + +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#else /* ROCKBOX */ +#include #include #include #include +#endif /* ROCKBOX */ static t_class *text_class; static t_class *message_class; @@ -39,6 +45,11 @@ void glist_text(t_glist *gl, t_symbol *s, int argc, t_atom *argv) { t_text *x = (t_text *)pd_new(text_class); t_atom at; + +#ifdef ROCKBOX + (void) s; +#endif + x->te_width = 0; /* don't know it yet. */ x->te_type = T_TEXT; x->te_binbuf = binbuf_new(); @@ -138,7 +149,12 @@ static void canvas_objtext(t_glist *gl, int xpix, int ypix, int selected, void canvas_obj(t_glist *gl, t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; +#else t_text *x; +#endif + if (argc >= 2) { t_binbuf *b = binbuf_new(); @@ -178,56 +194,111 @@ void canvas_iemguis(t_glist *gl, t_symbol *guiobjname) void canvas_bng(t_glist *gl, t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; + (void) argc; + (void) argv; +#endif canvas_iemguis(gl, gensym("bng")); } void canvas_toggle(t_glist *gl, t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; + (void) argc; + (void) argv; +#endif canvas_iemguis(gl, gensym("tgl")); } void canvas_vslider(t_glist *gl, t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; + (void) argc; + (void) argv; +#endif canvas_iemguis(gl, gensym("vsl")); } void canvas_hslider(t_glist *gl, t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; + (void) argc; + (void) argv; +#endif canvas_iemguis(gl, gensym("hsl")); } void canvas_hdial(t_glist *gl, t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; + (void) argc; + (void) argv; +#endif canvas_iemguis(gl, gensym("hdl")); } void canvas_vdial(t_glist *gl, t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; + (void) argc; + (void) argv; +#endif canvas_iemguis(gl, gensym("vdl")); } void canvas_hradio(t_glist *gl, t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; + (void) argc; + (void) argv; +#endif canvas_iemguis(gl, gensym("hradio")); } void canvas_vradio(t_glist *gl, t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; + (void) argc; + (void) argv; +#endif canvas_iemguis(gl, gensym("vradio")); } void canvas_vumeter(t_glist *gl, t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; + (void) argc; + (void) argv; +#endif canvas_iemguis(gl, gensym("vu")); } void canvas_mycnv(t_glist *gl, t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; + (void) argc; + (void) argv; +#endif canvas_iemguis(gl, gensym("cnv")); } void canvas_numbox(t_glist *gl, t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; + (void) argc; + (void) argv; +#endif canvas_iemguis(gl, gensym("nbx")); } @@ -310,11 +381,17 @@ static void message_symbol(t_message *x, t_symbol *s) static void message_list(t_message *x, t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; +#endif binbuf_eval(x->m_text.te_binbuf, &x->m_messresponder.mr_pd, argc, argv); } static void message_set(t_message *x, t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; +#endif binbuf_clear(x->m_text.te_binbuf); binbuf_add(x->m_text.te_binbuf, argc, argv); glist_retext(x->m_glist, &x->m_text); @@ -322,12 +399,18 @@ static void message_set(t_message *x, t_symbol *s, int argc, t_atom *argv) static void message_add2(t_message *x, t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; +#endif binbuf_add(x->m_text.te_binbuf, argc, argv); glist_retext(x->m_glist, &x->m_text); } static void message_add(t_message *x, t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; +#endif binbuf_add(x->m_text.te_binbuf, argc, argv); binbuf_addsemi(x->m_text.te_binbuf); glist_retext(x->m_glist, &x->m_text); @@ -337,12 +420,21 @@ static void message_click(t_message *x, t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl, t_floatarg alt) { +#ifdef ROCKBOX + (void) xpos; + (void) ypos; + (void) shift; + (void) ctrl; + (void) alt; +#endif message_float(x, 0); if (glist_isvisible(x->m_glist)) { +#ifndef ROCKBOX t_rtext *y = glist_findrtext(x->m_glist, &x->m_text); sys_vgui(".x%x.c itemconfigure %sR -width 5\n", glist_getcanvas(x->m_glist), rtext_gettag(y)); +#endif clock_delay(x->m_clock, 120); } } @@ -351,9 +443,11 @@ static void message_tick(t_message *x) { if (glist_isvisible(x->m_glist)) { +#ifndef ROCKBOX t_rtext *y = glist_findrtext(x->m_glist, &x->m_text); sys_vgui(".x%x.c itemconfigure %sR -width 1\n", glist_getcanvas(x->m_glist), rtext_gettag(y)); +#endif } } @@ -364,6 +458,9 @@ static void message_free(t_message *x) void canvas_msg(t_glist *gl, t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; +#endif t_message *x = (t_message *)pd_new(message_class); x->m_messresponder.mr_pd = messresponder_class; x->m_messresponder.mr_outlet = outlet_new(&x->m_text, &s_float); @@ -467,6 +564,9 @@ static void gatom_set(t_gatom *x, t_symbol *s, int argc, t_atom *argv) { t_atom oldatom = x->a_atom; int senditup = 0; +#ifdef ROCKBOX + (void) s; +#endif if (!argc) return; if (x->a_atom.a_type == A_FLOAT) x->a_atom.a_w.w_float = atom_getfloat(argv), @@ -538,6 +638,9 @@ static void gatom_symbol(t_gatom *x, t_symbol *s) static void gatom_motion(void *z, t_floatarg dx, t_floatarg dy) { +#ifdef ROCKBOX + (void) dx; +#endif t_gatom *x = (t_gatom *)z; if (dy == 0) return; if (x->a_atom.a_type == A_FLOAT) @@ -597,7 +700,7 @@ static void gatom_key(void *z, t_floatarg f) { /* for numbers, only let reasonable characters through */ if ((x->a_atom.a_type == A_SYMBOL) || - (c >= '0' && c <= '9' || c == '.' || c == '-' + ((c >= '0' && c <= '9') || c == '.' || c == '-' || c == 'e' || c == 'E')) { x->a_buf[len] = c; @@ -608,7 +711,11 @@ static void gatom_key(void *z, t_floatarg f) return; redraw: /* LATER figure out how to avoid creating all these symbols! */ +#ifdef ROCKBOX + snprintf(sbuf, sizeof(sbuf)-1, "%s...", x->a_buf); +#else /* ROCKBOX */ sprintf(sbuf, "%s...", x->a_buf); +#endif SETSYMBOL(&at, gensym(sbuf)); binbuf_clear(x->a_text.te_binbuf); binbuf_add(x->a_text.te_binbuf, 1, &at); @@ -619,6 +726,9 @@ static void gatom_click(t_gatom *x, t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl, t_floatarg alt) { +#ifdef ROCKBOX + (void) ctrl; +#endif if (x->a_text.te_width == 1) { if (x->a_atom.a_type == A_FLOAT) @@ -655,6 +765,10 @@ static void gatom_param(t_gatom *x, t_symbol *sel, int argc, t_atom *argv) t_symbol *symfrom = gatom_unescapit(atom_getsymbolarg(5, argc, argv)); t_symbol *symto = gatom_unescapit(atom_getsymbolarg(6, argc, argv)); +#ifdef ROCKBOX + (void) sel; +#endif + gobj_vis(&x->a_text.te_g, x->a_glist, 0); if (!*symfrom->s_name && *x->a_symfrom->s_name) inlet_new(&x->a_text, &x->a_text.te_pd, 0, 0); @@ -708,7 +822,11 @@ static void gatom_getwherelabel(t_gatom *x, t_glist *glist, int *xp, int *yp) { *xp = x1 - 3 - strlen(canvas_realizedollar(x->a_glist, x->a_label)->s_name) * +#ifdef ROCKBOX + 8; +#else sys_fontwidth(glist_getfont(glist)); +#endif *yp = y1 + 2; } else if (x->a_wherelabel == ATOM_LABELRIGHT) @@ -719,7 +837,11 @@ static void gatom_getwherelabel(t_gatom *x, t_glist *glist, int *xp, int *yp) else if (x->a_wherelabel == ATOM_LABELUP) { *xp = x1 - 1; +#ifdef ROCKBOX + *yp = y1 - 1 - 10; +#else *yp = y1 - 1 - sys_fontheight(glist_getfont(glist));; +#endif } else { @@ -731,10 +853,14 @@ static void gatom_getwherelabel(t_gatom *x, t_glist *glist, int *xp, int *yp) static void gatom_displace(t_gobj *z, t_glist *glist, int dx, int dy) { +#ifndef ROCKBOX t_gatom *x = (t_gatom*)z; +#endif text_displace(z, glist, dx, dy); +#ifndef ROCKBOX sys_vgui(".x%x.c move %x.l %d %d\n", glist_getcanvas(glist), x, dx, dy); +#endif } static void gatom_vis(t_gobj *z, t_glist *glist, int vis) @@ -747,14 +873,18 @@ static void gatom_vis(t_gobj *z, t_glist *glist, int vis) { int x1, y1; gatom_getwherelabel(x, glist, &x1, &y1); +#ifndef ROCKBOX sys_vgui("pdtk_text_new .x%x.c %x.l %f %f {%s} %d %s\n", glist_getcanvas(glist), x, (double)x1, (double)y1, canvas_realizedollar(x->a_glist, x->a_label)->s_name, sys_hostfontsize(glist_getfont(glist)), "black"); +#endif } +#ifndef ROCKBOX else sys_vgui(".x%x.c delete %x.l\n", glist_getcanvas(glist), x); +#endif } } @@ -763,6 +893,11 @@ void canvas_atom(t_glist *gl, t_atomtype type, { t_gatom *x = (t_gatom *)pd_new(gatom_class); t_atom at; + +#ifdef ROCKBOX + (void) s; +#endif + x->a_text.te_width = 0; /* don't know it yet. */ x->a_text.te_type = T_ATOM; x->a_text.te_binbuf = binbuf_new(); @@ -850,11 +985,17 @@ static void gatom_free(t_gatom *x) if (*x->a_symfrom->s_name) pd_unbind(&x->a_text.te_pd, canvas_realizedollar(x->a_glist, x->a_symfrom)); +#ifndef ROCKBOX gfxstub_deleteforkey(x); +#endif } static void gatom_properties(t_gobj *z, t_glist *owner) { +#ifdef ROCKBOX + (void) z; + (void) owner; +#else /* ROCKBOX */ t_gatom *x = (t_gatom *)z; char buf[200]; sprintf(buf, "pdtk_gatom_dialog %%s %d %g %g %d %s %s %s\n", @@ -863,6 +1004,7 @@ static void gatom_properties(t_gobj *z, t_glist *owner) gatom_escapit(x->a_symfrom)->s_name, gatom_escapit(x->a_symto)->s_name); gfxstub_new(&x->a_text.te_pd, x, buf); +#endif /* ROCKBOX */ } @@ -880,8 +1022,12 @@ static void text_getrect(t_gobj *z, t_glist *glist, if (x->te_type == T_ATOM && x->te_width > 0) { +#ifdef ROCKBOX + int fontwidth = 8, fontheight = 10; +#else int font = glist_getfont(glist); int fontwidth = sys_fontwidth(font), fontheight = sys_fontheight(font); +#endif width = (x->te_width > 0 ? x->te_width : 6) * fontwidth + 2; height = fontheight + 1; /* borrowed from TMARGIN, etc, in g_rtext.c */ } @@ -933,8 +1079,13 @@ static void text_select(t_gobj *z, t_glist *glist, int state) t_rtext *y = glist_findrtext(glist, x); rtext_select(y, state); if (glist_isvisible(glist) && text_shouldvis(x, glist)) +#ifdef ROCKBOX + { + } +#else /* ROCKBOX */ sys_vgui(".x%x.c itemconfigure %sR -fill %s\n", glist, rtext_gettag(y), (state? "blue" : "black")); +#endif /* ROCKBOX */ } static void text_activate(t_gobj *z, t_glist *glist, int state) @@ -988,6 +1139,10 @@ static void text_vis(t_gobj *z, t_glist *glist, int vis) static int text_click(t_gobj *z, struct _glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit) { +#ifdef ROCKBOX + (void) glist; + (void) dbl; +#endif t_text *x = (t_text *)z; if (x->te_type == T_OBJECT) { @@ -1111,9 +1266,20 @@ void glist_drawiofor(t_glist *glist, t_object *ob, int firsttime, char *tag, int x1, int y1, int x2, int y2) { int n = obj_noutlets(ob), nplus = (n == 1 ? 1 : n-1), i; +#ifdef ROCKBOX + (void) glist; + (void) firsttime; + (void) tag; + (void) x1; + (void) y1; + (void) x2; + (void) y2; +#else /* ROCKBOX */ int width = x2 - x1; +#endif /* ROCKBOX */ for (i = 0; i < n; i++) { +#ifndef ROCKBOX int onset = x1 + (width - IOWIDTH) * i / nplus; if (firsttime) sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %so%d\n", @@ -1126,11 +1292,13 @@ void glist_drawiofor(t_glist *glist, t_object *ob, int firsttime, glist_getcanvas(glist), tag, i, onset, y2 - 1, onset + IOWIDTH, y2); +#endif /* ROCKBOX */ } n = obj_ninlets(ob); nplus = (n == 1 ? 1 : n-1); for (i = 0; i < n; i++) { +#ifndef ROCKBOX int onset = x1 + (width - IOWIDTH) * i / nplus; if (firsttime) sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %si%d\n", @@ -1143,6 +1311,7 @@ void glist_drawiofor(t_glist *glist, t_object *ob, int firsttime, glist_getcanvas(glist), tag, i, onset, y1, onset + IOWIDTH, y1 + EXTRAPIX); +#endif /* ROCKBOX */ } } @@ -1151,11 +1320,18 @@ void text_drawborder(t_text *x, t_glist *glist, { t_object *ob; int x1, y1, x2, y2, width, height; + +#ifdef ROCKBOX + (void) width2; + (void) height2; +#endif + text_getrect(&x->te_g, glist, &x1, &y1, &x2, &y2); width = x2 - x1; height = y2 - y1; if (x->te_type == T_OBJECT) { +#ifndef ROCKBOX if (firsttime) sys_vgui(".x%x.c create line\ %d %d %d %d %d %d %d %d %d %d -tags %sR\n", @@ -1166,9 +1342,11 @@ void text_drawborder(t_text *x, t_glist *glist, %d %d %d %d %d %d %d %d %d %d\n", glist_getcanvas(glist), tag, x1, y1, x2, y1, x2, y2, x1, y2, x1, y1); +#endif } else if (x->te_type == T_MESSAGE) { +#ifndef ROCKBOX if (firsttime) sys_vgui(".x%x.c create line\ %d %d %d %d %d %d %d %d %d %d %d %d %d %d -tags %sR\n", @@ -1182,9 +1360,11 @@ void text_drawborder(t_text *x, t_glist *glist, glist_getcanvas(glist), tag, x1, y1, x2+4, y1, x2, y1+4, x2, y2-4, x2+4, y2, x1, y2, x1, y1); +#endif } else if (x->te_type == T_ATOM) { +#ifndef ROCKBOX if (firsttime) sys_vgui(".x%x.c create line\ %d %d %d %d %d %d %d %d %d %d %d %d -tags %sR\n", @@ -1196,31 +1376,46 @@ void text_drawborder(t_text *x, t_glist *glist, %d %d %d %d %d %d %d %d %d %d %d %d\n", glist_getcanvas(glist), tag, x1, y1, x2-4, y1, x2, y1+4, x2, y2, x1, y2, x1, y1); +#endif } /* draw inlets/outlets */ - if (ob = pd_checkobject(&x->te_pd)) + if ((ob = pd_checkobject(&x->te_pd))) glist_drawiofor(glist, ob, firsttime, tag, x1, y1, x2, y2); } void glist_eraseiofor(t_glist *glist, t_object *ob, char *tag) { int i, n; +#ifdef ROCKBOX + (void) glist; + (void) tag; +#endif n = obj_noutlets(ob); for (i = 0; i < n; i++) +#ifdef ROCKBOX + ; +#else /* ROCKBOX */ sys_vgui(".x%x.c delete %so%d\n", glist_getcanvas(glist), tag, i); +#endif /* ROCKBOX */ n = obj_ninlets(ob); for (i = 0; i < n; i++) +#ifdef ROCKBOX + ; +#else /* ROCKBOX */ sys_vgui(".x%x.c delete %si%d\n", glist_getcanvas(glist), tag, i); +#endif /* ROCKBOX */ } void text_eraseborder(t_text *x, t_glist *glist, char *tag) { if (x->te_type == T_TEXT) return; +#ifndef ROCKBOX sys_vgui(".x%x.c delete %sR\n", glist_getcanvas(glist), tag); +#endif glist_eraseiofor(glist, x, tag); } diff --git a/apps/plugins/pdbox/PDa/src/g_toggle.c b/apps/plugins/pdbox/PDa/src/g_toggle.c index 5a3401ffa8..e3e2f05098 100644 --- a/apps/plugins/pdbox/PDa/src/g_toggle.c +++ b/apps/plugins/pdbox/PDa/src/g_toggle.c @@ -6,6 +6,13 @@ /* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#include "m_pd.h" +#include "g_canvas.h" +#include "g_all_guis.h" +#else /* ROCKBOX */ #include #include #include @@ -21,6 +28,7 @@ #else #include #endif +#endif /* ROCKBOX */ /* --------------- tgl gui-toggle ------------------------- */ @@ -31,6 +39,10 @@ static t_class *toggle_class; void toggle_draw_update(t_toggle *x, t_glist *glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ if(glist_isvisible(glist)) { t_canvas *canvas=glist_getcanvas(glist); @@ -40,10 +52,15 @@ void toggle_draw_update(t_toggle *x, t_glist *glist) sys_vgui(".x%x.c itemconfigure %xX2 -fill #%6.6x\n", canvas, x, (x->x_on!=0.0)?x->x_gui.x_fcol:x->x_gui.x_bcol); } +#endif /* ROCKBOX */ } void toggle_draw_new(t_toggle *x, t_glist *glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ t_canvas *canvas=glist_getcanvas(glist); int w=1, xx=text_xpix(&x->x_gui.x_obj, glist), yy=text_ypix(&x->x_gui.x_obj, glist); @@ -72,10 +89,15 @@ void toggle_draw_new(t_toggle *x, t_glist *glist) if(!x->x_gui.x_fsf.x_rcv_able) sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xIN%d\n", canvas, xx, yy, xx + IOWIDTH, yy+1, x, 0); +#endif /* ROCKBOX */ } void toggle_draw_move(t_toggle *x, t_glist *glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ t_canvas *canvas=glist_getcanvas(glist); int w=1, xx=text_xpix(&x->x_gui.x_obj, glist), yy=text_ypix(&x->x_gui.x_obj, glist); @@ -100,10 +122,15 @@ void toggle_draw_move(t_toggle *x, t_glist *glist) if(!x->x_gui.x_fsf.x_rcv_able) sys_vgui(".x%x.c coords %xIN%d %d %d %d %d\n", canvas, x, 0, xx, yy, xx + IOWIDTH, yy+1); +#endif /* ROCKBOX */ } void toggle_draw_erase(t_toggle* x, t_glist* glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ t_canvas *canvas=glist_getcanvas(glist); sys_vgui(".x%x.c delete %xBASE\n", canvas, x); @@ -114,10 +141,15 @@ void toggle_draw_erase(t_toggle* x, t_glist* glist) sys_vgui(".x%x.c delete %xOUT%d\n", canvas, x, 0); if(!x->x_gui.x_fsf.x_rcv_able) sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); +#endif /* ROCKBOX */ } void toggle_draw_config(t_toggle* x, t_glist* glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ t_canvas *canvas=glist_getcanvas(glist); sys_vgui(".x%x.c itemconfigure %xLABEL -font {%s %d bold} -fill #%6.6x -text {%s} \n", @@ -130,10 +162,16 @@ void toggle_draw_config(t_toggle* x, t_glist* glist) x->x_on?x->x_gui.x_fcol:x->x_gui.x_bcol); sys_vgui(".x%x.c itemconfigure %xX2 -fill #%6.6x\n", canvas, x, x->x_on?x->x_gui.x_fcol:x->x_gui.x_bcol); +#endif /* ROCKBOX */ } void toggle_draw_io(t_toggle* x, t_glist* glist, int old_snd_rcv_flags) { +#ifdef ROCKBOX + (void) x; + (void) glist; + (void) old_snd_rcv_flags; +#else /* ROCKBOX */ int xpos=text_xpix(&x->x_gui.x_obj, glist); int ypos=text_ypix(&x->x_gui.x_obj, glist); t_canvas *canvas=glist_getcanvas(glist); @@ -151,10 +189,15 @@ void toggle_draw_io(t_toggle* x, t_glist* glist, int old_snd_rcv_flags) xpos + IOWIDTH, ypos+1, x, 0); if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able) sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); +#endif /* ROCKBOX */ } void toggle_draw_select(t_toggle* x, t_glist* glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ t_canvas *canvas=glist_getcanvas(glist); if(x->x_gui.x_fsf.x_selected) @@ -167,6 +210,7 @@ void toggle_draw_select(t_toggle* x, t_glist* glist) sys_vgui(".x%x.c itemconfigure %xBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL); sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol); } +#endif /* ROCKBOX */ } void toggle_draw(t_toggle *x, t_glist *glist, int mode) @@ -220,6 +264,10 @@ static void toggle_save(t_gobj *z, t_binbuf *b) static void toggle_properties(t_gobj *z, t_glist *owner) { +#ifdef ROCKBOX + (void) z; + (void) owner; +#else /* ROCKBOX */ t_toggle *x = (t_toggle *)z; char buf[800]; t_symbol *srl[3]; @@ -241,6 +289,7 @@ static void toggle_properties(t_gobj *z, t_glist *owner) x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize, 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol); gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); +#endif } static void toggle_bang(t_toggle *x) @@ -259,6 +308,10 @@ static void toggle_dialog(t_toggle *x, t_symbol *s, int argc, t_atom *argv) float nonzero = (float)atom_getfloatarg(2, argc, argv); int sr_flags; +#ifdef ROCKBOX + (void) s; +#endif + if(nonzero == 0.0) nonzero = 1.0; x->x_nonzero = nonzero; @@ -274,10 +327,26 @@ static void toggle_dialog(t_toggle *x, t_symbol *s, int argc, t_atom *argv) } static void toggle_click(t_toggle *x, t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl, t_floatarg alt) +#ifdef ROCKBOX +{ + (void) xpos; + (void) ypos; + (void) shift; + (void) alt; + (void) ctrl; + + toggle_bang(x); +} +#else /* ROCKBOX */ {toggle_bang(x);} +#endif /* ROCKBOX */ static int toggle_newclick(t_gobj *z, struct _glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit) { +#ifdef ROCKBOX + (void) glist; + (void) dbl; +#endif if(doit) toggle_click((t_toggle *)z, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift, 0, (t_floatarg)alt); return (1); @@ -318,6 +387,9 @@ static void toggle_loadbang(t_toggle *x) static void toggle_size(t_toggle *x, t_symbol *s, int ac, t_atom *av) { +#ifdef ROCKBOX + (void) s; +#endif x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av)); x->x_gui.x_h = x->x_gui.x_w; iemgui_size((void *)x, &x->x_gui); @@ -362,11 +434,21 @@ static void *toggle_new(t_symbol *s, int argc, t_atom *argv) { t_toggle *x = (t_toggle *)pd_new(toggle_class); int bflcol[]={-262144, -1, -1}; +#ifdef ROCKBOX + int a=IEM_GUI_DEFAULTSIZE; +#else int a=IEM_GUI_DEFAULTSIZE, f=0; +#endif int ldx=0, ldy=-6; int fs=8; float on=0.0, nonzero=1.0; +#ifndef ROCKBOX char str[144]; +#endif + +#ifdef ROCKBOX + (void) s; +#endif iem_inttosymargs(&x->x_gui.x_isa, 0); iem_inttofstyle(&x->x_gui.x_fsf, 0); @@ -433,7 +515,9 @@ static void toggle_ff(t_toggle *x) { if(x->x_gui.x_fsf.x_rcv_able) pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); +#ifndef ROCKBOX gfxstub_deleteforkey(x); +#endif } void g_toggle_setup(void) diff --git a/apps/plugins/pdbox/PDa/src/g_traversal.c b/apps/plugins/pdbox/PDa/src/g_traversal.c index 0e2c6855b4..b6ac2d110e 100644 --- a/apps/plugins/pdbox/PDa/src/g_traversal.c +++ b/apps/plugins/pdbox/PDa/src/g_traversal.c @@ -16,11 +16,18 @@ sublist - get a pointer into a list which is an element of another scalar */ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#include "m_pd.h" +#include "g_canvas.h" +#else /* ROCKBOX */ #include #include #include /* for read/write to files */ #include "m_pd.h" #include "g_canvas.h" +#endif /* ROCKBOX */ /* ------------- gstubs and gpointers - safe pointing --------------- */ @@ -135,7 +142,7 @@ void gpointer_copy(const t_gpointer *gpfrom, t_gpointer *gpto) void gpointer_unset(t_gpointer *gp) { t_gstub *gs; - if (gs = gp->gp_stub) + if((gs = gp->gp_stub)) { gstub_dis(gs); gp->gp_stub = 0; @@ -145,7 +152,7 @@ void gpointer_unset(t_gpointer *gp) void gpointer_setglist(t_gpointer *gp, t_glist *glist, t_scalar *x) { t_gstub *gs; - if (gs = gp->gp_stub) gstub_dis(gs); + if((gs = gp->gp_stub)) gstub_dis(gs); gp->gp_stub = gs = glist->gl_stub; gp->gp_valid = glist->gl_valid; gp->gp_un.gp_scalar = x; @@ -155,7 +162,7 @@ void gpointer_setglist(t_gpointer *gp, t_glist *glist, t_scalar *x) static void gpointer_setarray(t_gpointer *gp, t_array *array, t_word *w) { t_gstub *gs; - if (gs = gp->gp_stub) gstub_dis(gs); + if((gs = gp->gp_stub)) gstub_dis(gs); gp->gp_stub = gs = array->a_stub; gp->gp_valid = array->a_valid; gp->gp_un.gp_w = w; @@ -194,6 +201,9 @@ static void *ptrobj_new(t_symbol *classname, int argc, t_atom *argv) t_ptrobj *x = (t_ptrobj *)pd_new(ptrobj_class); t_typedout *to; int n; +#ifdef ROCKBOX + (void) classname; +#endif gpointer_init(&x->x_gp); x->x_typedout = to = (t_typedout *)getbytes(argc * sizeof (*to)); x->x_ntypedout = n = argc; @@ -285,10 +295,14 @@ static void ptrobj_next(t_ptrobj *x) static void ptrobj_sendwindow(t_ptrobj *x, t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; +#else /* ROCKBOX */ t_scalar *sc; t_symbol *templatesym; int n; t_typedout *to; +#endif /* ROCKBOX */ t_glist *glist; t_pd *canvas; t_gstub *gs; @@ -388,6 +402,9 @@ static void *get_new(t_symbol *why, int argc, t_atom *argv) int i; t_getvariable *sp; x->x_templatesym = canvas_makebindsym(atom_getsymbolarg(0, argc, argv)); +#ifdef ROCKBOX + (void) why; +#endif if (argc) argc--, argv++; x->x_variables = (t_getvariable *)getbytes(argc * sizeof (*x->x_variables)); @@ -468,6 +485,9 @@ static void *set_new(t_symbol *why, int argc, t_atom *argv) int i; t_setvariable *sp; x->x_templatesym = canvas_makebindsym(atom_getsymbolarg(0, argc, argv)); +#ifdef ROCKBOX + (void) why; +#endif if (argc) argc--, argv++; x->x_variables = (t_setvariable *)getbytes(argc * sizeof (*x->x_variables)); @@ -634,6 +654,9 @@ static void elem_float(t_elem *x, t_float f) static void elem_free(t_elem *x, t_gpointer *gp) { +#ifdef ROCKBOX + (void) gp; +#endif gpointer_unset(&x->x_gp); gpointer_unset(&x->x_gparent); } @@ -667,13 +690,19 @@ static void *getsize_new(t_symbol *templatesym, t_symbol *fieldsym) static void getsize_pointer(t_getsize *x, t_gpointer *gp) { +#ifdef ROCKBOX + int onset, type; +#else /* ROCKBOX */ int nitems, onset, type; +#endif /* ROCKBOX */ t_symbol *templatesym = x->x_templatesym, *fieldsym = x->x_fieldsym, *elemtemplatesym; t_template *template = template_findbyname(templatesym); t_word *w; t_array *array; +#ifndef ROCKBOX int elemsize; +#endif t_gstub *gs = gp->gp_stub; if (!template) { @@ -731,6 +760,9 @@ typedef struct _setsize static void *setsize_new(t_symbol *templatesym, t_symbol *fieldsym, t_floatarg newsize) { +#ifdef ROCKBOX + (void) newsize; +#endif t_setsize *x = (t_setsize *)pd_new(setsize_class); x->x_templatesym = canvas_makebindsym(templatesym); x->x_fieldsym = fieldsym; @@ -748,7 +780,9 @@ static void setsize_float(t_setsize *x, t_float f) t_template *template = template_findbyname(templatesym); t_template *elemtemplate; t_word *w; +#ifndef ROCKBOX t_atom at; +#endif t_array *array; int elemsize; int newsize = f; @@ -830,7 +864,11 @@ static void setsize_float(t_setsize *x, t_float f) if (newsize > nitems) { char *newelem = ((char *)array->a_vec) + nitems * elemsize; +#ifdef ROCKBOX + int nnew = newsize - nitems; +#else /* ROCKBOX */ int i = 0, nnew = newsize - nitems; +#endif /* ROCKBOX */ while (nnew--) { @@ -896,6 +934,9 @@ static void *append_new(t_symbol *why, int argc, t_atom *argv) int i; t_appendvariable *sp; x->x_templatesym = canvas_makebindsym(atom_getsymbolarg(0, argc, argv)); +#ifdef ROCKBOX + (void) why; +#endif if (argc) argc--, argv++; x->x_variables = (t_appendvariable *)getbytes(argc * sizeof (*x->x_variables)); @@ -1023,8 +1064,10 @@ static void sublist_pointer(t_sublist *x, t_gpointer *gp) t_symbol *templatesym = x->x_templatesym, *dummy; t_template *template = template_findbyname(templatesym); t_gstub *gs = gp->gp_stub; - t_word *vec; +#ifndef ROCKBOX + t_word *vec; t_getvariable *vp; +#endif int onset, type; t_word *w; @@ -1059,6 +1102,9 @@ static void sublist_pointer(t_sublist *x, t_gpointer *gp) static void sublist_free(t_sublist *x, t_gpointer *gp) { +#ifdef ROCKBOX + (void) gp; +#endif gpointer_unset(&x->x_gp); } diff --git a/apps/plugins/pdbox/PDa/src/g_vdial.c b/apps/plugins/pdbox/PDa/src/g_vdial.c index 47ac3d19bb..bf026c697f 100644 --- a/apps/plugins/pdbox/PDa/src/g_vdial.c +++ b/apps/plugins/pdbox/PDa/src/g_vdial.c @@ -7,6 +7,13 @@ /* name change to vradio by MSP (it's a radio button really) and changed to put out a "float" as in sliders, toggles, etc. */ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#include "m_pd.h" +#include "g_canvas.h" +#include "g_all_guis.h" +#else /* ROCKBOX */ #include #include #include @@ -16,6 +23,7 @@ put out a "float" as in sliders, toggles, etc. */ #include "t_tk.h" #include "g_all_guis.h" #include +#endif /* ROCKBOX */ /*------------------ global variables -------------------------*/ @@ -34,6 +42,10 @@ static t_class *vradio_class, *vradio_old_class; void vradio_draw_update(t_vradio *x, t_glist *glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ if(glist_isvisible(glist)) { t_canvas *canvas=glist_getcanvas(glist); @@ -45,10 +57,15 @@ void vradio_draw_update(t_vradio *x, t_glist *glist) canvas, x, x->x_on, x->x_gui.x_fcol, x->x_gui.x_fcol); } +#endif /* ROCKBOX */ } void vradio_draw_new(t_vradio *x, t_glist *glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ t_canvas *canvas=glist_getcanvas(glist); int n=x->x_number, i, dy=x->x_gui.x_h, s4=dy/4; int yy11b=text_ypix(&x->x_gui.x_obj, glist); @@ -83,10 +100,15 @@ void vradio_draw_new(t_vradio *x, t_glist *glist) if(!x->x_gui.x_fsf.x_rcv_able) sys_vgui(".x%x.c create rectangle %d %d %d %d -tags %xIN%d\n", canvas, xx11, yy11b, xx11 + IOWIDTH, yy11b+1, x, 0); +#endif /* ROCKBOX */ } void vradio_draw_move(t_vradio *x, t_glist *glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ t_canvas *canvas=glist_getcanvas(glist); int n=x->x_number, i, dy=x->x_gui.x_h, s4=dy/4; int yy11b=text_ypix(&x->x_gui.x_obj, glist); @@ -114,10 +136,15 @@ void vradio_draw_move(t_vradio *x, t_glist *glist) if(!x->x_gui.x_fsf.x_rcv_able) sys_vgui(".x%x.c coords %xIN%d %d %d %d %d\n", canvas, x, 0, xx11, yy11b, xx11 + IOWIDTH, yy11b+1); +#endif /* ROCKBOX */ } void vradio_draw_erase(t_vradio* x, t_glist* glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ t_canvas *canvas=glist_getcanvas(glist); int n=x->x_number, i; @@ -131,10 +158,15 @@ void vradio_draw_erase(t_vradio* x, t_glist* glist) sys_vgui(".x%x.c delete %xOUT%d\n", canvas, x, 0); if(!x->x_gui.x_fsf.x_rcv_able) sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); +#endif /* ROCKBOX */ } void vradio_draw_config(t_vradio* x, t_glist* glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ t_canvas *canvas=glist_getcanvas(glist); int n=x->x_number, i; @@ -150,10 +182,16 @@ void vradio_draw_config(t_vradio* x, t_glist* glist) (x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol, (x->x_on==i)?x->x_gui.x_fcol:x->x_gui.x_bcol); } +#endif /* ROCKBOX */ } void vradio_draw_io(t_vradio* x, t_glist* glist, int old_snd_rcv_flags) { +#ifdef ROCKBOX + (void) x; + (void) glist; + (void) old_snd_rcv_flags; +#else /* ROCKBOX */ t_canvas *canvas=glist_getcanvas(glist); int xpos=text_xpix(&x->x_gui.x_obj, glist); int ypos=text_ypix(&x->x_gui.x_obj, glist); @@ -173,10 +211,15 @@ void vradio_draw_io(t_vradio* x, t_glist* glist, int old_snd_rcv_flags) x, 0); if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able) sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); +#endif /* ROCKBOX */ } void vradio_draw_select(t_vradio* x, t_glist* glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ t_canvas *canvas=glist_getcanvas(glist); int n=x->x_number, i; @@ -199,6 +242,7 @@ void vradio_draw_select(t_vradio* x, t_glist* glist) sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol); } +#endif /* ROCKBOX */ } void vradio_draw(t_vradio *x, t_glist *glist, int mode) @@ -254,6 +298,10 @@ static void vradio_save(t_gobj *z, t_binbuf *b) static void vradio_properties(t_gobj *z, t_glist *owner) { +#ifdef ROCKBOX + (void) z; + (void) owner; +#else /* ROCKBOX */ t_vradio *x = (t_vradio *)z; char buf[800]; t_symbol *srl[3]; @@ -278,6 +326,7 @@ static void vradio_properties(t_gobj *z, t_glist *owner) x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize, 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol); gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); +#endif /* ROCKBOX */ } static void vradio_dialog(t_vradio *x, t_symbol *s, int argc, t_atom *argv) @@ -288,6 +337,10 @@ static void vradio_dialog(t_vradio *x, t_symbol *s, int argc, t_atom *argv) int num = (int)atom_getintarg(6, argc, argv); int sr_flags; +#ifdef ROCKBOX + (void) s; +#endif + if(chg != 0) chg = 1; x->x_change = chg; sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv); @@ -463,12 +516,23 @@ static void vradio_click(t_vradio *x, t_floatarg xpos, t_floatarg ypos, { int yy = (int)ypos - text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist); +#ifdef ROCKBOX + (void) xpos; + (void) shift; + (void) ctrl; + (void) alt; +#endif + vradio_fout(x, (float)(yy / x->x_gui.x_h)); } static int vradio_newclick(t_gobj *z, struct _glist *glist, int xpix, int ypix, int shift, int alt, int dbl, int doit) { +#ifdef ROCKBOX + (void) glist; + (void) dbl; +#endif if(doit) vradio_click((t_vradio *)z, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift, 0, (t_floatarg)alt); @@ -502,6 +566,9 @@ static void vradio_number(t_vradio *x, t_floatarg num) static void vradio_size(t_vradio *x, t_symbol *s, int ac, t_atom *av) { +#ifdef ROCKBOX + (void) s; +#endif x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av)); x->x_gui.x_h = x->x_gui.x_w; iemgui_size((void *)x, &x->x_gui); @@ -546,11 +613,21 @@ static void *vradio_donew(t_symbol *s, int argc, t_atom *argv, int old) { t_vradio *x = (t_vradio *)pd_new(old? vradio_old_class : vradio_class); int bflcol[]={-262144, -1, -1}; +#ifdef ROCKBOX + int a=IEM_GUI_DEFAULTSIZE, on=0; +#else int a=IEM_GUI_DEFAULTSIZE, on=0, f=0; +#endif int ldx=0, ldy=-6, chg=1, num=8; int fs=8; +#ifndef ROCKBOX int ftbreak=IEM_BNG_DEFAULTBREAKFLASHTIME, fthold=IEM_BNG_DEFAULTHOLDFLASHTIME; char str[144]; +#endif + +#ifdef ROCKBOX + (void) s; +#endif if((argc == 15)&&IS_A_FLOAT(argv,0)&&IS_A_FLOAT(argv,1)&&IS_A_FLOAT(argv,2) &&IS_A_FLOAT(argv,3) @@ -632,7 +709,9 @@ static void vradio_ff(t_vradio *x) { if(x->x_gui.x_fsf.x_rcv_able) pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); +#ifndef ROCKBOX gfxstub_deleteforkey(x); +#endif } void g_vradio_setup(void) diff --git a/apps/plugins/pdbox/PDa/src/g_vslider.c b/apps/plugins/pdbox/PDa/src/g_vslider.c index ee02236769..f01dcfdf6d 100644 --- a/apps/plugins/pdbox/PDa/src/g_vslider.c +++ b/apps/plugins/pdbox/PDa/src/g_vslider.c @@ -6,6 +6,13 @@ /* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#include "m_pd.h" +#include "g_canvas.h" +#include "g_all_guis.h" +#else /* ROCKBOX */ #include #include #include @@ -21,6 +28,7 @@ #else #include #endif +#endif /* ROCKBOX */ /* ------------ vsl gui-vertical slider ----------------------- */ @@ -32,6 +40,10 @@ static t_class *vslider_class; static void vslider_draw_update(t_vslider *x, t_glist *glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ if (glist_isvisible(glist)) { int r = text_ypix(&x->x_gui.x_obj, glist) + x->x_gui.x_h - (x->x_val + 50)/100; @@ -41,10 +53,15 @@ static void vslider_draw_update(t_vslider *x, t_glist *glist) glist_getcanvas(glist), x, xpos+1, r, xpos + x->x_gui.x_w, r); } +#endif /* ROCKBOX */ } static void vslider_draw_new(t_vslider *x, t_glist *glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ int xpos=text_xpix(&x->x_gui.x_obj, glist); int ypos=text_ypix(&x->x_gui.x_obj, glist); int r = ypos + x->x_gui.x_h - (x->x_val + 50)/100; @@ -74,10 +91,15 @@ static void vslider_draw_new(t_vslider *x, t_glist *glist) xpos, ypos-2, xpos+7, ypos-1, x, 0); +#endif /* ROCKBOX */ } static void vslider_draw_move(t_vslider *x, t_glist *glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ int xpos=text_xpix(&x->x_gui.x_obj, glist); int ypos=text_ypix(&x->x_gui.x_obj, glist); int r = ypos + x->x_gui.x_h - (x->x_val + 50)/100; @@ -102,10 +124,15 @@ static void vslider_draw_move(t_vslider *x, t_glist *glist) canvas, x, 0, xpos, ypos-2, xpos+7, ypos-1); +#endif /* ROCKBOX */ } static void vslider_draw_erase(t_vslider* x,t_glist* glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ t_canvas *canvas=glist_getcanvas(glist); sys_vgui(".x%x.c delete %xBASE\n", canvas, x); @@ -115,10 +142,15 @@ static void vslider_draw_erase(t_vslider* x,t_glist* glist) sys_vgui(".x%x.c delete %xOUT%d\n", canvas, x, 0); if(!x->x_gui.x_fsf.x_rcv_able) sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); +#endif /* ROCKBOX */ } static void vslider_draw_config(t_vslider* x,t_glist* glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ t_canvas *canvas=glist_getcanvas(glist); sys_vgui(".x%x.c itemconfigure %xLABEL -font {%s %d bold} -fill #%6.6x -text {%s} \n", @@ -129,10 +161,16 @@ static void vslider_draw_config(t_vslider* x,t_glist* glist) x, x->x_gui.x_fcol); sys_vgui(".x%x.c itemconfigure %xBASE -fill #%6.6x\n", canvas, x, x->x_gui.x_bcol); +#endif /* ROCKBOX */ } static void vslider_draw_io(t_vslider* x,t_glist* glist, int old_snd_rcv_flags) { +#ifdef ROCKBOX + (void) x; + (void) glist; + (void) old_snd_rcv_flags; +#else /* ROCKBOX */ int xpos=text_xpix(&x->x_gui.x_obj, glist); int ypos=text_ypix(&x->x_gui.x_obj, glist); t_canvas *canvas=glist_getcanvas(glist); @@ -153,10 +191,15 @@ static void vslider_draw_io(t_vslider* x,t_glist* glist, int old_snd_rcv_flags) x, 0); if(!(old_snd_rcv_flags & IEM_GUI_OLD_RCV_FLAG) && x->x_gui.x_fsf.x_rcv_able) sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); +#endif /* ROCKBOX */ } static void vslider_draw_select(t_vslider *x, t_glist *glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ t_canvas *canvas=glist_getcanvas(glist); if(x->x_gui.x_fsf.x_selected) @@ -169,6 +212,7 @@ static void vslider_draw_select(t_vslider *x, t_glist *glist) sys_vgui(".x%x.c itemconfigure %xBASE -outline #%6.6x\n", canvas, x, IEM_GUI_COLOR_NORMAL); sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol); } +#endif /* ROCKBOX */ } void vslider_draw(t_vslider *x, t_glist *glist, int mode) @@ -270,6 +314,10 @@ void vslider_check_minmax(t_vslider *x, double min, double max) static void vslider_properties(t_gobj *z, t_glist *owner) { +#ifdef ROCKBOX + (void) z; + (void) owner; +#else /* ROCKBOX */ t_vslider *x = (t_vslider *)z; char buf[800]; t_symbol *srl[3]; @@ -292,6 +340,7 @@ static void vslider_properties(t_gobj *z, t_glist *owner) x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize, 0xffffff & x->x_gui.x_bcol, 0xffffff & x->x_gui.x_fcol, 0xffffff & x->x_gui.x_lcol); gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); +#endif } static void vslider_bang(t_vslider *x) @@ -321,6 +370,10 @@ static void vslider_dialog(t_vslider *x, t_symbol *s, int argc, t_atom *argv) int steady = (int)atom_getintarg(17, argc, argv); int sr_flags; +#ifdef ROCKBOX + (void) s; +#endif + if(lilo != 0) lilo = 1; x->x_lin0_log1 = lilo; if(steady) @@ -341,6 +394,10 @@ static void vslider_motion(t_vslider *x, t_floatarg dx, t_floatarg dy) { int old = x->x_val; +#ifdef ROCKBOX + (void) dx; +#endif + if(x->x_gui.x_fsf.x_finemoved) x->x_pos -= (int)dy; else @@ -368,6 +425,11 @@ static void vslider_motion(t_vslider *x, t_floatarg dx, t_floatarg dy) static void vslider_click(t_vslider *x, t_floatarg xpos, t_floatarg ypos, t_floatarg shift, t_floatarg ctrl, t_floatarg alt) { +#ifdef ROCKBOX + (void) shift; + (void) ctrl; + (void) alt; +#endif if(!x->x_steady) x->x_val = (int)(100.0 * (x->x_gui.x_h + text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist) - ypos)); if(x->x_val > (100*x->x_gui.x_h - 100)) @@ -386,6 +448,11 @@ static int vslider_newclick(t_gobj *z, struct _glist *glist, { t_vslider* x = (t_vslider *)z; +#ifdef ROCKBOX + (void) glist; + (void) dbl; +#endif + if(doit) { vslider_click( x, (t_floatarg)xpix, (t_floatarg)ypix, (t_floatarg)shift, @@ -434,6 +501,9 @@ static void vslider_float(t_vslider *x, t_floatarg f) static void vslider_size(t_vslider *x, t_symbol *s, int ac, t_atom *av) { +#ifdef ROCKBOX + (void) s; +#endif x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av)); if(ac > 1) vslider_check_height(x, (int)atom_getintarg(1, ac, av)); @@ -448,6 +518,9 @@ static void vslider_pos(t_vslider *x, t_symbol *s, int ac, t_atom *av) static void vslider_range(t_vslider *x, t_symbol *s, int ac, t_atom *av) { +#ifdef ROCKBOX + (void) s; +#endif vslider_check_minmax(x, (double)atom_getfloatarg(0, ac, av), (double)atom_getfloatarg(1, ac, av)); } @@ -506,10 +579,20 @@ static void *vslider_new(t_symbol *s, int argc, t_atom *argv) t_vslider *x = (t_vslider *)pd_new(vslider_class); int bflcol[]={-262144, -1, -1}; int w=IEM_GUI_DEFAULTSIZE, h=IEM_SL_DEFAULTSIZE; +#ifdef ROCKBOX + int lilo=0, ldx=0, ldy=-8; +#else int lilo=0, f=0, ldx=0, ldy=-8; +#endif int fs=8, v=0, steady=1; double min=0.0, max=(double)(IEM_SL_DEFAULTSIZE-1); +#ifndef ROCKBOX char str[144]; +#endif + +#ifdef ROCKBOX + (void) s; +#endif iem_inttosymargs(&x->x_gui.x_isa, 0); iem_inttofstyle(&x->x_gui.x_fsf, 0); @@ -581,7 +664,9 @@ static void vslider_free(t_vslider *x) { if(x->x_gui.x_fsf.x_rcv_able) pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); +#ifndef ROCKBOX gfxstub_deleteforkey(x); +#endif } void g_vslider_setup(void) diff --git a/apps/plugins/pdbox/PDa/src/g_vumeter.c b/apps/plugins/pdbox/PDa/src/g_vumeter.c index fb3a8fafa4..2c43fbd120 100644 --- a/apps/plugins/pdbox/PDa/src/g_vumeter.c +++ b/apps/plugins/pdbox/PDa/src/g_vumeter.c @@ -5,7 +5,13 @@ /* g_7_guis.c written by Thomas Musil (c) IEM KUG Graz Austria 2000-2001 */ /* thanks to Miller Puckette, Guenther Geiger and Krzystof Czaja */ - +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#include "m_pd.h" +#include "g_canvas.h" +#include "g_all_guis.h" +#else /* ROCKBOX */ #include #include #include @@ -21,6 +27,7 @@ #else #include #endif +#endif /* ROCKBOX */ /* ----- vu gui-peak- & rms- vu-meter-display ---------- */ @@ -31,6 +38,10 @@ static t_class *vu_class; static void vu_update_rms(t_vu *x, t_glist *glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ if(glist_isvisible(glist)) { int w4=x->x_gui.x_w/4, off=text_ypix(&x->x_gui.x_obj, glist)-1; @@ -40,10 +51,15 @@ static void vu_update_rms(t_vu *x, t_glist *glist) glist_getcanvas(glist), x, quad1, off, quad3, off + (x->x_led_size+1)*(IEM_VU_STEPS-x->x_rms)); } +#endif /* ROCKBOX */ } static void vu_update_peak(t_vu *x, t_glist *glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ t_canvas *canvas=glist_getcanvas(glist); if(glist_isvisible(glist)) @@ -74,10 +90,15 @@ static void vu_update_peak(t_vu *x, t_glist *glist) mid, ypos+20); } } +#endif /* ROCKBOX */ } static void vu_draw_new(t_vu *x, t_glist *glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ t_canvas *canvas=glist_getcanvas(glist); int xpos=text_xpix(&x->x_gui.x_obj, glist); @@ -151,11 +172,16 @@ static void vu_draw_new(t_vu *x, t_glist *glist) xpos+x->x_gui.x_w+1, ypos-1, x, 1); } +#endif /* ROCKBOX */ } static void vu_draw_move(t_vu *x, t_glist *glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ t_canvas *canvas=glist_getcanvas(glist); int xpos=text_xpix(&x->x_gui.x_obj, glist); @@ -212,10 +238,15 @@ static void vu_draw_move(t_vu *x, t_glist *glist) xpos+x->x_gui.x_w+1-IOWIDTH, ypos-2, xpos+x->x_gui.x_w+1, ypos-1); } +#endif /* ROCKBOX */ } static void vu_draw_erase(t_vu* x,t_glist* glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ int i; t_canvas *canvas=glist_getcanvas(glist); @@ -244,10 +275,15 @@ static void vu_draw_erase(t_vu* x,t_glist* glist) sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 1); } +#endif /* ROCKBOX */ } static void vu_draw_config(t_vu* x, t_glist* glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ int i; t_canvas *canvas=glist_getcanvas(glist); @@ -277,10 +313,16 @@ static void vu_draw_config(t_vu* x, t_glist* glist) x, x->x_gui.x_bcol, x->x_gui.x_bcol); sys_vgui(".x%x.c itemconfigure %xPLED -width %d\n", canvas, x, x->x_led_size); +#endif /* ROCKBOX */ } static void vu_draw_io(t_vu* x, t_glist* glist, int old_snd_rcv_flags) { +#ifdef ROCKBOX + (void) x; + (void) glist; + (void) old_snd_rcv_flags; +#else /* ROCKBOX */ int xpos=text_xpix(&x->x_gui.x_obj, glist); int ypos=text_ypix(&x->x_gui.x_obj, glist); t_canvas *canvas=glist_getcanvas(glist); @@ -321,10 +363,15 @@ static void vu_draw_io(t_vu* x, t_glist* glist, int old_snd_rcv_flags) sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 0); sys_vgui(".x%x.c delete %xIN%d\n", canvas, x, 1); } +#endif /* ROCKBOX */ } static void vu_draw_select(t_vu* x,t_glist* glist) { +#ifdef ROCKBOX + (void) x; + (void) glist; +#else /* ROCKBOX */ int i; t_canvas *canvas=glist_getcanvas(glist); @@ -362,6 +409,7 @@ static void vu_draw_select(t_vu* x,t_glist* glist) } sys_vgui(".x%x.c itemconfigure %xLABEL -fill #%6.6x\n", canvas, x, x->x_gui.x_lcol); } +#endif /* ROCKBOX */ } void vu_draw(t_vu *x, t_glist *glist, int mode) @@ -425,6 +473,10 @@ void vu_check_height(t_vu *x, int h) static void vu_scale(t_vu *x, t_floatarg fscale) { +#ifdef ROCKBOX + (void) x; + (void) fscale; +#else /* ROCKBOX */ int i, scale = (int)fscale; if(scale != 0) scale = 1; @@ -446,7 +498,11 @@ static void vu_scale(t_vu *x, t_floatarg fscale) } if(!x->x_scale && scale) { +#ifdef ROCKBOX + int end=text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist)+x->x_gui.x_w+4; +#else /* ROCKBOX */ int w4=x->x_gui.x_w/4, end=text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist)+x->x_gui.x_w+4; +#endif /* ROCKBOX */ int k1=x->x_led_size+1, k2=IEM_VU_STEPS+1, k3=k1/2; int yyy, k4=text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist)-k3; t_canvas *canvas=glist_getcanvas(x->x_gui.x_glist); @@ -471,10 +527,15 @@ static void vu_scale(t_vu *x, t_floatarg fscale) x->x_gui.x_lcol, x, i); } } +#endif /* ROCKBOX */ } static void vu_properties(t_gobj *z, t_glist *owner) { +#ifdef ROCKBOX + (void) z; + (void) owner; +#else /* ROCKBOX */ t_vu *x = (t_vu *)z; char buf[800]; t_symbol *srl[3]; @@ -496,6 +557,7 @@ static void vu_properties(t_gobj *z, t_glist *owner) x->x_gui.x_fsf.x_font_style, x->x_gui.x_fontsize, 0xffffff & x->x_gui.x_bcol, -1/*no front-color*/, 0xffffff & x->x_gui.x_lcol); gfxstub_new(&x->x_gui.x_obj.ob_pd, x, buf); +#endif /* ROCKBOX */ } static void vu_dialog(t_vu *x, t_symbol *s, int argc, t_atom *argv) @@ -506,6 +568,10 @@ static void vu_dialog(t_vu *x, t_symbol *s, int argc, t_atom *argv) int scale = (int)atom_getintarg(4, argc, argv); int sr_flags; +#ifdef ROCKBOX + (void) s; +#endif + srl[0] = gensym("empty"); sr_flags = iemgui_dialog(&x->x_gui, srl, argc, argv); x->x_gui.x_fsf.x_snd_able = 0; @@ -523,6 +589,9 @@ static void vu_dialog(t_vu *x, t_symbol *s, int argc, t_atom *argv) static void vu_size(t_vu *x, t_symbol *s, int ac, t_atom *av) { +#ifdef ROCKBOX + (void) s; +#endif x->x_gui.x_w = iemgui_clip_size((int)atom_getintarg(0, ac, av)); if(ac > 1) vu_check_height(x, (int)atom_getintarg(1, ac, av)); @@ -608,9 +677,14 @@ static void *vu_new(t_symbol *s, int argc, t_atom *argv) t_vu *x = (t_vu *)pd_new(vu_class); int bflcol[]={-66577, -1, -1}; int w=IEM_GUI_DEFAULTSIZE, h=IEM_VU_STEPS*IEM_VU_DEFAULTSIZE; +#ifdef ROCKBOX + int ldx=-1, ldy=-8, fs=8, scale=1; + (void) s; +#else /* ROCKBOX */ int ldx=-1, ldy=-8, f=0, fs=8, scale=1; int ftbreak=IEM_BNG_DEFAULTBREAKFLASHTIME, fthold=IEM_BNG_DEFAULTHOLDFLASHTIME; char str[144]; +#endif /* ROCKBOX */ iem_inttosymargs(&x->x_gui.x_isa, 0); iem_inttofstyle(&x->x_gui.x_fsf, 0); @@ -678,7 +752,9 @@ static void vu_free(t_vu *x) { if(x->x_gui.x_fsf.x_rcv_able) pd_unbind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv); +#ifndef ROCKBOX gfxstub_deleteforkey(x); +#endif } void g_vumeter_setup(void) diff --git a/apps/plugins/pdbox/PDa/src/m_atom.c b/apps/plugins/pdbox/PDa/src/m_atom.c index f2ed3a0b65..4d30c1b3de 100644 --- a/apps/plugins/pdbox/PDa/src/m_atom.c +++ b/apps/plugins/pdbox/PDa/src/m_atom.c @@ -3,8 +3,14 @@ * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ #include "m_pd.h" + +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#else /* ROCKBOX */ #include #include +#endif /* ROCKBOX */ /* convenience routines for checking and getting values of atoms. There's no "pointer" version since there's nothing @@ -23,7 +29,9 @@ t_int atom_getint(t_atom *a) t_symbol *atom_getsymbol(t_atom *a) /* LATER think about this more carefully */ { +#ifndef ROCKBOX char buf[30]; +#endif if (a->a_type == A_SYMBOL) return (a->a_w.w_symbol); else return (&s_float); } @@ -33,7 +41,11 @@ t_symbol *atom_gensym(t_atom *a) /* this works better for graph labels */ char buf[30]; if (a->a_type == A_SYMBOL) return (a->a_w.w_symbol); else if (a->a_type == A_FLOAT) +#ifdef ROCKBOX + ftoan(a->a_w.w_float, buf, sizeof(buf)-1); +#else sprintf(buf, "%g", a->a_w.w_float); +#endif else strcpy(buf, "???"); return (gensym(buf)); } @@ -76,7 +88,11 @@ void atom_string(t_atom *a, char *buf, unsigned int bufsize) strcpy(buf, "(pointer)"); break; case A_FLOAT: +#ifdef ROCKBOX + ftoan(a->a_w.w_float, tbuf, sizeof(tbuf)-1); +#else sprintf(tbuf, "%g", a->a_w.w_float); +#endif if (strlen(tbuf) < bufsize-1) strcpy(buf, tbuf); else if (a->a_w.w_float < 0) strcpy(buf, "-"); else strcat(buf, "+"); @@ -118,10 +134,10 @@ void atom_string(t_atom *a, char *buf, unsigned int bufsize) } break; case A_DOLLAR: - sprintf(buf, "$%d", a->a_w.w_index); + snprintf(buf, bufsize-1, "$%d", a->a_w.w_index); break; case A_DOLLSYM: - sprintf(buf, "$%s", a->a_w.w_symbol->s_name); + snprintf(buf, bufsize-1, "$%s", a->a_w.w_symbol->s_name); break; default: bug("atom_string"); diff --git a/apps/plugins/pdbox/PDa/src/m_binbuf.c b/apps/plugins/pdbox/PDa/src/m_binbuf.c index 03a560db7b..224d269559 100644 --- a/apps/plugins/pdbox/PDa/src/m_binbuf.c +++ b/apps/plugins/pdbox/PDa/src/m_binbuf.c @@ -10,9 +10,15 @@ * change marked with IOhannes */ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#ifdef SIMULATOR +int printf(const char *fmt, ...); +void perror(const char*); +#endif +#else /* ROCKBOX */ #include -#include "m_pd.h" -#include "s_stuff.h" #include #ifdef UNIX #include @@ -21,8 +27,13 @@ #include #endif #include + #include #include +#endif /* ROCKBOX */ + +#include "m_pd.h" +#include "s_stuff.h" struct _binbuf { @@ -72,7 +83,9 @@ void binbuf_text(t_binbuf *x, char *text, size_t size) x->b_n = 0; while (1) { +#ifndef ROCKBOX int type; +#endif /* skip leading space */ while ((textp != etext) && (*textp == ' ' || *textp == '\n' || *textp == '\r' || *textp == '\t')) textp++; @@ -158,6 +171,7 @@ void binbuf_text(t_binbuf *x, char *text, size_t size) #if 0 post("buf %s", buf); #endif + if (*buf == '$' && buf[1] >= '0' && buf[1] <= '9' && !firstslash) { for (bufp = buf+2; *bufp; bufp++) @@ -219,7 +233,7 @@ void binbuf_gettext(t_binbuf *x, char **bufp, int *lengthp) } if (length && buf[length-1] == ' ') { - if (newbuf = t_resizebytes(buf, length, length-1)) + if((newbuf = t_resizebytes(buf, length, length-1))) { buf = newbuf; length--; @@ -236,8 +250,8 @@ void binbuf_add(t_binbuf *x, int argc, t_atom *argv) { int newsize = x->b_n + argc, i; t_atom *ap; - if (ap = t_resizebytes(x->b_vec, x->b_n * sizeof(*x->b_vec), - newsize * sizeof(*x->b_vec))) + if((ap = t_resizebytes(x->b_vec, x->b_n * sizeof(*x->b_vec), + newsize * sizeof(*x->b_vec)))) x->b_vec = ap; else { @@ -310,11 +324,19 @@ void binbuf_addbinbuf(t_binbuf *x, t_binbuf *y) SETSYMBOL(ap, gensym(",")); break; case A_DOLLAR: +#ifdef ROCKBOX + snprintf(tbuf, sizeof(tbuf)-1, "$%d", ap->a_w.w_index); +#else /* ROCKBOX */ sprintf(tbuf, "$%d", ap->a_w.w_index); +#endif /* ROCKBOX */ SETSYMBOL(ap, gensym(tbuf)); break; case A_DOLLSYM: +#ifdef ROCKBOX + snprintf(tbuf, sizeof(tbuf)-1, "$%s", ap->a_w.w_symbol->s_name); +#else /* ROCKBOX */ sprintf(tbuf, "$%s", ap->a_w.w_symbol->s_name); +#endif /* ROCKBOX */ SETSYMBOL(ap, gensym(tbuf)); break; case A_SYMBOL: @@ -346,8 +368,8 @@ void binbuf_restore(t_binbuf *x, int argc, t_atom *argv) { int newsize = x->b_n + argc, i; t_atom *ap; - if (ap = t_resizebytes(x->b_vec, x->b_n * sizeof(*x->b_vec), - newsize * sizeof(*x->b_vec))) + if((ap = t_resizebytes(x->b_vec, x->b_n * sizeof(*x->b_vec), + newsize * sizeof(*x->b_vec)))) x->b_vec = ap; else { @@ -374,7 +396,11 @@ void binbuf_restore(t_binbuf *x, int argc, t_atom *argv) else { int dollar = 0; +#ifdef ROCKBOX + dollar = atoi(argv->a_w.w_symbol->s_name + 1); +#else sscanf(argv->a_w.w_symbol->s_name + 1, "%d", &dollar); +#endif SETDOLLAR(ap, dollar); } } @@ -430,10 +456,18 @@ t_symbol *binbuf_realizedollsym(t_symbol *s, int ac, t_atom *av, int tonew) { if (!tonew) return (0); +#ifdef ROCKBOX + else snprintf(buf, sizeof(buf)-1, "$%d", argno); +#else /* ROCKBOX */ else sprintf(buf, "$%d", argno); +#endif /* ROCKBOX */ } else if (argno == 0) +#ifdef ROCKBOX + snprintf(buf, sizeof(buf)-1, "%d", canvas_getdollarzero()); +#else /* ROCKBOX */ sprintf(buf, "%d", canvas_getdollarzero()); +#endif /* ROCKBOX */ else atom_string(av+(argno-1), buf, MAXPDSTRING/2-1); strncat(buf, sp, MAXPDSTRING/2-1); @@ -582,6 +616,10 @@ void binbuf_eval(t_binbuf *x, t_pd *target, int argc, t_atom *argv) if (nargs == 1) pd_float(target, stackwas->a_w.w_float); else pd_list(target, 0, nargs, stackwas); break; +#ifdef ROCKBOX + default: + break; +#endif } } msp = stackwas; @@ -606,12 +644,14 @@ static int binbuf_doopen(char *s, int mode) return (open(namebuf, mode)); } +#ifndef ROCKBOX static FILE *binbuf_dofopen(char *s, char *mode) { char namebuf[MAXPDSTRING]; sys_bashfilename(s, namebuf); return (fopen(namebuf, mode)); } +#endif int binbuf_read(t_binbuf *b, char *filename, char *dirname, int crflag) { @@ -620,30 +660,51 @@ int binbuf_read(t_binbuf *b, char *filename, char *dirname, int crflag) int readret; char *buf; char namebuf[MAXPDSTRING]; - + namebuf[0] = 0; if (*dirname) strcat(namebuf, dirname), strcat(namebuf, "/"); strcat(namebuf, filename); - + if ((fd = binbuf_doopen(namebuf, 0)) < 0) { +#ifdef ROCKBOX +#ifdef SIMULATOR + printf("open: "); + perror(namebuf); +#endif /* SIMULATOR */ +#else /* ROCKBOX */ fprintf(stderr, "open: "); perror(namebuf); +#endif /* ROCKBOX */ return (1); } if ((length = lseek(fd, 0, SEEK_END)) < 0 || lseek(fd, 0, SEEK_SET) < 0 || !(buf = t_getbytes(length))) { +#ifdef ROCKBOX +#ifdef SIMULATOR + printf("lseek: "); + perror(namebuf); +#endif /* SIMULATOR */ +#else /* ROCKBOX */ fprintf(stderr, "lseek: "); perror(namebuf); +#endif /* ROCKBOX */ close(fd); return(1); } if ((readret = read(fd, buf, length)) < length) { +#ifdef ROCKBOX +#ifdef SIMULATOR + printf("read (%d %ld) -> %d\n", fd, length, readret); + perror(namebuf); +#endif /* SIMULATOR */ +#else /* ROCKBOX */ fprintf(stderr, "read (%d %ld) -> %d\n", fd, length, readret); perror(namebuf); +#endif /* ROCKBOX */ close(fd); t_freebytes(buf, length); return(1); @@ -691,7 +752,11 @@ static t_binbuf *binbuf_convert(t_binbuf *oldb, int maxtopd); semicolons. */ int binbuf_write(t_binbuf *x, char *filename, char *dir, int crflag) { +#ifdef ROCKBOX + int f = 0; +#else /* ROCKBOX */ FILE *f = 0; +#endif /* ROCKBOX */ char sbuf[WBUFSIZE], fbuf[MAXPDSTRING], *bp = sbuf, *ep = sbuf + WBUFSIZE; t_atom *ap; int indx, deleteit = 0; @@ -707,9 +772,19 @@ int binbuf_write(t_binbuf *x, char *filename, char *dir, int crflag) deleteit = 1; } +#ifdef ROCKBOX + if(!(f = binbuf_doopen(fbuf, O_WRONLY|O_CREAT|O_TRUNC))) +#else /* ROCKBOX */ if (!(f = binbuf_dofopen(fbuf, "w"))) +#endif /* ROCKBOX */ { +#ifdef ROCKBOX +#ifdef SIMULATOR + printf("open: "); +#endif /* SIMULATOR */ +#else /* ROCKBOX */ fprintf(stderr, "open: "); +#endif /* ROCKBOX */ sys_unixerror(fbuf); goto fail; } @@ -723,7 +798,11 @@ int binbuf_write(t_binbuf *x, char *filename, char *dir, int crflag) else length = 40; if (ep - bp < length) { +#ifdef ROCKBOX + if(write(f, sbuf, bp-sbuf) < 1) +#else /* ROCKBOX */ if (fwrite(sbuf, bp-sbuf, 1, f) < 1) +#endif /* ROCKBOX */ { sys_unixerror(fbuf); goto fail; @@ -750,20 +829,32 @@ int binbuf_write(t_binbuf *x, char *filename, char *dir, int crflag) ncolumn++; } } +#ifdef ROCKBOX + if(write(f, sbuf, bp-sbuf) < 1) +#else /* ROCKBOX */ if (fwrite(sbuf, bp-sbuf, 1, f) < 1) +#endif /* ROCKBOX */ { sys_unixerror(fbuf); goto fail; } if (deleteit) binbuf_free(x); +#ifdef ROCKBOX + close(f); +#else /* ROCKBOX */ fclose(f); +#endif /* ROCKBOX */ return (0); fail: if (deleteit) binbuf_free(x); if (f) - fclose(f); +#ifdef ROCKBOX + close(f); +#else /* ROCKBOX */ + fclose(f); +#endif /* ROCKBOX */ return (1); } @@ -816,13 +907,21 @@ static t_binbuf *binbuf_convert(t_binbuf *oldb, int maxtopd) if (nextmess[i].a_type == A_DOLLAR) { char buf[100]; +#ifdef ROCKBOX + snprintf(buf, sizeof(buf)-1, "$%d", nextmess[i].a_w.w_index); +#else /* ROCKBOX */ sprintf(buf, "$%d", nextmess[i].a_w.w_index); +#endif /* ROCKBOX */ SETSYMBOL(nextmess+i, gensym(buf)); } else if (nextmess[i].a_type == A_DOLLSYM) { char buf[100]; +#ifdef ROCKBOX + snprintf(buf, sizeof(buf)-1, "$%s", nextmess[i].a_w.w_symbol->s_name); +#else /* ROCKBOX */ sprintf(buf, "$%s", nextmess[i].a_w.w_symbol->s_name); +#endif /* ROCKBOX */ SETSYMBOL(nextmess+i, gensym(buf)); } } @@ -846,7 +945,11 @@ static t_binbuf *binbuf_convert(t_binbuf *oldb, int maxtopd) atom_getfloatarg(2, natom, nextmess), atom_getfloatarg(5, natom, nextmess) - atom_getfloatarg(3, natom, nextmess), +#ifdef ROCKBOX + 10.0); +#else (float)sys_defaultfont); +#endif } } if (!strcmp(first, "#P")) @@ -1157,13 +1260,13 @@ int binbuf_match(t_binbuf *inbuf, t_binbuf *searchbuf) t_atom *a1 = &inbuf->b_vec[indexin + nmatched], *a2 = &searchbuf->b_vec[nmatched]; if (a1->a_type != a2->a_type || - a1->a_type == A_SYMBOL && a1->a_w.w_symbol != a2->a_w.w_symbol + (a1->a_type == A_SYMBOL && a1->a_w.w_symbol != a2->a_w.w_symbol) || - a1->a_type == A_FLOAT && a1->a_w.w_float != a2->a_w.w_float + (a1->a_type == A_FLOAT && a1->a_w.w_float != a2->a_w.w_float) || - a1->a_type == A_DOLLAR && a1->a_w.w_index != a2->a_w.w_index + (a1->a_type == A_DOLLAR && a1->a_w.w_index != a2->a_w.w_index) || - a1->a_type == A_DOLLSYM && a1->a_w.w_symbol != a2->a_w.w_symbol) + (a1->a_type == A_DOLLSYM && a1->a_w.w_symbol != a2->a_w.w_symbol)) goto nomatch; } return (1); @@ -1183,9 +1286,12 @@ void binbuf_evalfile(t_symbol *name, t_symbol *dir) /* set filename so that new canvases can pick them up */ int dspstate = canvas_suspend_dsp(); glob_setfilename(0, name, dir); + if (binbuf_read(b, name->s_name, dir->s_name, 0)) { +#if !defined(ROCKBOX) || (defined(ROCKBOX) && defined(SIMULATOR)) perror(name->s_name); +#endif } else { @@ -1205,6 +1311,10 @@ void binbuf_evalfile(t_symbol *name, t_symbol *dir) void glob_evalfile(t_pd *ignore, t_symbol *name, t_symbol *dir) { t_pd *x = 0; + +#ifdef ROCKBOX + (void) ignore; +#endif /* even though binbuf_evalfile appears to take care of dspstate, we have to do it again here, because canvas_startdsp() assumes that all toplevel canvases are visible. LATER check if this diff --git a/apps/plugins/pdbox/PDa/src/m_class.c b/apps/plugins/pdbox/PDa/src/m_class.c index 66cb34d921..98fe9be23d 100644 --- a/apps/plugins/pdbox/PDa/src/m_class.c +++ b/apps/plugins/pdbox/PDa/src/m_class.c @@ -2,10 +2,23 @@ * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ +#if 0 +//#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#endif + #define PD_CLASS_DEF #include "m_pd.h" #include "m_imp.h" #include "s_stuff.h" + +#ifdef ROCKBOX + +#include "plugin.h" +#include "pdbox.h" + +#else /* ROCKBOX */ #include #ifdef UNIX #include @@ -16,6 +29,7 @@ #include #include +#endif /* ROCKBOX */ static t_symbol *class_loadsym; /* name under which an extern is invoked */ static void pd_defaultfloat(t_pd *x, t_float f); @@ -27,6 +41,10 @@ static t_symbol *class_extern_dir = &s_; static void pd_defaultanything(t_pd *x, t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) argc; + (void) argv; +#endif pd_error(x, "%s: no method for '%s'", (*x)->c_name->s_name, s->s_name); } @@ -422,6 +440,10 @@ char *class_gethelpdir(t_class *c) static void class_nosavefn(t_gobj *z, t_binbuf *b) { +#ifdef ROCKBOX + (void) z; + (void) b; +#endif bug("save function called but not defined"); } @@ -465,7 +487,7 @@ t_symbol *dogensym(char *s, t_symbol *oldsym) s2++; } sym1 = symhash + (hash2 & (HASHSIZE-1)); - while (sym2 = *sym1) + while ((sym2 = *sym1)) { if (!strcmp(sym2->s_name, s)) return(sym2); sym1 = &sym2->s_next; @@ -485,10 +507,14 @@ t_symbol *dogensym(char *s, t_symbol *oldsym) t_symbol *gensym(char *s) { +printf("gensym: %s\n", s); return(dogensym(s, 0)); } -static t_symbol *addfileextent(t_symbol *s) +#ifndef ROCKBOX +static +#endif +t_symbol *addfileextent(t_symbol *s) { char namebuf[MAXPDSTRING], *str = s->s_name; int ln = strlen(str); @@ -608,7 +634,9 @@ typedef t_pd *(*t_fun6)(t_int i1, t_int i2, t_int i3, t_int i4, t_int i5, t_int void pd_typedmess(t_pd *x, t_symbol *s, int argc, t_atom *argv) { +#ifndef ROCKBOX t_method *f; +#endif t_class *c = *x; t_methodentry *m; t_atomtype *wp, wanttype; @@ -617,7 +645,7 @@ void pd_typedmess(t_pd *x, t_symbol *s, int argc, t_atom *argv) t_floatarg ad[MAXPDARG+1], *dp = ad; int narg = 0; t_pd *bonzo; - + /* check for messages that are handled by fixed slots in the class structure. We don't catch "pointer" though so that sending "pointer" to pd_objectmaker doesn't require that we supply a pointer value. */ @@ -658,9 +686,10 @@ void pd_typedmess(t_pd *x, t_symbol *s, int argc, t_atom *argv) else (*((t_messgimme)(m->me_fun)))(x, s, argc, argv); return; } + if (argc > MAXPDARG) argc = MAXPDARG; if (x != &pd_objectmaker) *(ap++) = (t_int)x, narg++; - while (wanttype = *wp++) + while((wanttype = *wp++)) { switch (wanttype) { @@ -712,6 +741,11 @@ void pd_typedmess(t_pd *x, t_symbol *s, int argc, t_atom *argv) } narg++; ap++; +#ifdef ROCKBOX + break; + default: + break; +#endif } } switch (narg) diff --git a/apps/plugins/pdbox/PDa/src/m_conf.c b/apps/plugins/pdbox/PDa/src/m_conf.c index a3f1c70ec4..6f3fe7f795 100644 --- a/apps/plugins/pdbox/PDa/src/m_conf.c +++ b/apps/plugins/pdbox/PDa/src/m_conf.c @@ -51,6 +51,9 @@ void d_osc_setup(void); void d_soundfile_setup(void); void d_ugen_setup(void); +/* PD anywhere specific. -- W.B. */ +void d_intern_setup(void); + void conf_init(void) { g_array_setup(); @@ -81,11 +84,15 @@ void conf_init(void) x_time_setup(); x_arithmetic_setup(); +#ifndef ROCKBOX x_midi_setup(); +#endif x_misc_setup(); x_net_setup(); x_qlist_setup(); +#ifndef ROCKBOX x_gui_setup(); +#endif d_arithmetic_setup(); d_dac_setup(); d_fft_setup(); diff --git a/apps/plugins/pdbox/PDa/src/m_fixed.c b/apps/plugins/pdbox/PDa/src/m_fixed.c index 7beaa8077a..374f92cbca 100644 --- a/apps/plugins/pdbox/PDa/src/m_fixed.c +++ b/apps/plugins/pdbox/PDa/src/m_fixed.c @@ -1,9 +1,14 @@ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#else /* ROCKBOX */ #include #include #include #include #include +#endif /* ROCKBOX */ #include "m_pd.h" #include "m_imp.h" @@ -21,8 +26,19 @@ static t_int x_fd = -1; -static void ipod_connect() +static void ipod_connect(void) { +#ifdef ROCKBOX + if (x_fd >= 0) + { + error("ipod_connect: already connected"); + return; + } + else + { + x_fd++; + } +#else /* ROCKBOX */ struct sockaddr_in server; struct hostent *hp; int sockfd; @@ -65,6 +81,7 @@ static void ipod_connect() } post("connected %s %d",hostname,portno); x_fd = sockfd; +#endif /* ROCKBOX */ } @@ -72,8 +89,13 @@ static void ipod_connect() static void ipod_bang(t_ipod *x) { static char sendme[200]; +#ifdef ROCKBOX + snprintf(sendme, sizeof(sendme)-1, "%s bang;\n", x->x_what->s_name); + SEND_FROM_CORE(sendme); +#else /* ROCKBOX */ sprintf(sendme,"%s bang;\n",x->x_what->s_name); send(x_fd,sendme,strlen(sendme),0); +#endif /*ROCKBOX */ // if (x->x_sym->s_thing) pd_bang(x->x_sym->s_thing); } @@ -81,9 +103,19 @@ static void ipod_bang(t_ipod *x) static void ipod_float(t_ipod *x, t_float f) { static char sendme[200]; +#ifdef ROCKBOX + char f_buf[32]; + + ftoan(f, f_buf, sizeof(f_buf)-1); + strcpy(sendme, x->x_what->s_name); + strcat(sendme, " "); + strcat(sendme, f_buf); + SEND_FROM_CORE(sendme); +#else /* ROCKBOX */ sprintf(sendme,"%s %f;\n",x->x_what->s_name,f); send(x_fd,sendme,strlen(sendme),0); +#endif /* ROCKBOX */ // post("forwarding float %s",x->x_what->s_name); // if (x->x_sym->s_thing) pd_float(x->x_sym->s_thing, f); diff --git a/apps/plugins/pdbox/PDa/src/m_glob.c b/apps/plugins/pdbox/PDa/src/m_glob.c index 2ec584a33d..9a036a984e 100644 --- a/apps/plugins/pdbox/PDa/src/m_glob.c +++ b/apps/plugins/pdbox/PDa/src/m_glob.c @@ -83,6 +83,7 @@ void glob_init(void) gensym("audiostatus"), 0); class_addmethod(glob_pdobject, (t_method)glob_finderror, gensym("finderror"), 0); +#ifndef ROCKBOX class_addmethod(glob_pdobject, (t_method)glob_audio_properties, gensym("audio-properties"), A_DEFFLOAT, 0); class_addmethod(glob_pdobject, (t_method)glob_audio_dialog, @@ -93,6 +94,7 @@ void glob_init(void) gensym("midi-properties"), A_DEFFLOAT, 0); class_addmethod(glob_pdobject, (t_method)glob_midi_dialog, gensym("midi-dialog"), A_GIMME, 0); +#endif /* ROCKBOX */ class_addmethod(glob_pdobject, (t_method)glob_start_path_dialog, gensym("start-path-dialog"), A_DEFFLOAT, 0); class_addmethod(glob_pdobject, (t_method)glob_path_dialog, diff --git a/apps/plugins/pdbox/PDa/src/m_memory.c b/apps/plugins/pdbox/PDa/src/m_memory.c index f9ee378f87..2a05d72d2d 100644 --- a/apps/plugins/pdbox/PDa/src/m_memory.c +++ b/apps/plugins/pdbox/PDa/src/m_memory.c @@ -4,7 +4,7 @@ #ifdef ROCKBOX #include "plugin.h" -#define memset rb->memset +#include "pdbox.h" #else /* ROCKBOX */ #include #include diff --git a/apps/plugins/pdbox/PDa/src/m_obj.c b/apps/plugins/pdbox/PDa/src/m_obj.c index 785fd240bf..fa17a9052b 100644 --- a/apps/plugins/pdbox/PDa/src/m_obj.c +++ b/apps/plugins/pdbox/PDa/src/m_obj.c @@ -53,9 +53,9 @@ t_inlet *inlet_new(t_object *owner, t_pd *dest, t_symbol *s1, t_symbol *s2) else x->i_symto = s2; x->i_symfrom = s1; x->i_next = 0; - if (y = owner->ob_inlet) + if((y = owner->ob_inlet)) { - while (y2 = y->i_next) y = y2; + while((y2 = y->i_next)) y = y2; y->i_next = x; } else owner->ob_inlet = x; @@ -106,7 +106,9 @@ static void inlet_symbol(t_inlet *x, t_symbol *s) static void inlet_list(t_inlet *x, t_symbol *s, int argc, t_atom *argv) { +#ifndef ROCKBOX t_atom at; +#endif if (x->i_symfrom == &s_list || x->i_symfrom == &s_float || x->i_symfrom == &s_symbol || x->i_symfrom == &s_pointer) typedmess(x->i_dest, x->i_symto, argc, argv); @@ -154,9 +156,9 @@ t_inlet *pointerinlet_new(t_object *owner, t_gpointer *gp) x->i_symfrom = &s_pointer; x->i_pointerslot = gp; x->i_next = 0; - if (y = owner->ob_inlet) + if((y = owner->ob_inlet)) { - while (y2 = y->i_next) y = y2; + while((y2 = y->i_next)) y = y2; y->i_next = x; } else owner->ob_inlet = x; @@ -176,9 +178,9 @@ t_inlet *floatinlet_new(t_object *owner, t_float *fp) x->i_symfrom = &s_float; x->i_floatslot = fp; x->i_next = 0; - if (y = owner->ob_inlet) + if((y = owner->ob_inlet)) { - while (y2 = y->i_next) y = y2; + while((y2 = y->i_next)) y = y2; y->i_next = x; } else owner->ob_inlet = x; @@ -198,9 +200,9 @@ t_inlet *symbolinlet_new(t_object *owner, t_symbol **sp) x->i_symfrom = &s_symbol; x->i_symslot = sp; x->i_next = 0; - if (y = owner->ob_inlet) + if((y = owner->ob_inlet)) { - while (y2 = y->i_next) y = y2; + while((y2 = y->i_next)) y = y2; y->i_next = x; } else owner->ob_inlet = x; @@ -217,6 +219,11 @@ void obj_list(t_object *x, t_symbol *s, int argc, t_atom *argv) t_atom *ap; int count; t_inlet *ip = ((t_object *)x)->ob_inlet; + +#ifdef ROCKBOX + (void) s; +#endif + if (!argc) return; for (count = argc-1, ap = argv+1; ip && count--; ap++, ip = ip->i_next) { @@ -296,9 +303,9 @@ t_outlet *outlet_new(t_object *owner, t_symbol *s) t_outlet *x = (t_outlet *)getbytes(sizeof(*x)), *y, *y2; x->o_owner = owner; x->o_next = 0; - if (y = owner->ob_outlet) + if((y = owner->ob_outlet)) { - while (y2 = y->o_next) y = y2; + while((y2 = y->o_next)) y = y2; y->o_next = x; } else owner->ob_outlet = x; @@ -474,7 +481,7 @@ doit: freebytes(oc, sizeof(*oc)); goto done; } - while (oc2 = oc->oc_next) + while((oc2 = oc->oc_next)) { if (oc2->oc_to == to) { diff --git a/apps/plugins/pdbox/PDa/src/m_pd.c b/apps/plugins/pdbox/PDa/src/m_pd.c index e686c2cb52..25f5f2d212 100644 --- a/apps/plugins/pdbox/PDa/src/m_pd.c +++ b/apps/plugins/pdbox/PDa/src/m_pd.c @@ -2,10 +2,15 @@ * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ -#include #include "m_pd.h" #include "m_imp.h" +#ifdef ROCKBOX +void pd_checkgui(t_pd *x, t_symbol *s); +#else /* ROCKBOX */ +#include +#endif /* ROCKBOX */ + /* FIXME no out-of-memory testing yet! */ t_pd *pd_new(t_class *c) @@ -166,7 +171,7 @@ void pd_unbind(t_pd *x, t_symbol *s) b->b_list = e->e_next; freebytes(e, sizeof(t_bindelem)); } - else for (e = b->b_list; e2 = e->e_next; e = e2) + else for (e = b->b_list; (e2 = e->e_next); e = e2) if (e2->e_who == x) { e->e_next = e2->e_next; @@ -194,8 +199,13 @@ t_pd *pd_findbyclass(t_symbol *s, t_class *c) if (*s->s_thing == bindlist_class) { t_bindlist *b = (t_bindlist *)s->s_thing; +#ifdef ROCKBOX + t_bindelem *e; +#else /* ROCKBOX */ t_bindelem *e, *e2; +#endif /* ROCKBOX */ int warned = 0; + for (e = b->b_list; e; e = e->e_next) if (*e->e_who == c) { @@ -288,6 +298,9 @@ void pd_symbol(t_pd *x, t_symbol *s) void pd_list(t_pd *x, t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; +#endif (*(*x)->c_listmethod)(x, &s_list, argc, argv); } diff --git a/apps/plugins/pdbox/PDa/src/m_sched.c b/apps/plugins/pdbox/PDa/src/m_sched.c index 9d3bed828a..104cc66c70 100644 --- a/apps/plugins/pdbox/PDa/src/m_sched.c +++ b/apps/plugins/pdbox/PDa/src/m_sched.c @@ -2,6 +2,11 @@ * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#endif + /* scheduling stuff */ #include "m_pd.h" @@ -14,13 +19,21 @@ /* T.Grill - enable PD global thread locking - sys_lock, sys_unlock, sys_trylock functions */ -#define THREAD_LOCKING +#ifndef ROCKBOX +#define THREAD_LOCKING #include "pthread.h" +#endif static int sys_quit; -static t_time sys_time; -static t_time sys_time_per_msec = TIMEUNITPERSEC / 1000.; +#ifndef ROCKBOX +static +#endif +t_time sys_time; +#ifndef ROCKBOX +static +#endif +t_time sys_time_per_msec = TIMEUNITPERSEC / 1000.; int sys_schedblocksize = DEFDACBLKSIZE; int sys_usecsincelastsleep(void); @@ -133,9 +146,12 @@ static int sys_bin[] = {0, 2, 5, 10, 20, 30, 50, 100, 1000}; #define NBIN (sizeof(sys_bin)/sizeof(*sys_bin)) #define NHIST 10 static int sys_histogram[NHIST][NBIN]; +#ifndef ROCKBOX static t_time sys_histtime; +#endif static int sched_diddsp, sched_didpoll, sched_didnothing; +#ifndef ROCKBOX static void sys_clearhist( void) { unsigned int i, j; @@ -144,6 +160,7 @@ static void sys_clearhist( void) sys_histtime = sys_getrealtime(); sched_diddsp = sched_didpoll = sched_didnothing = 0; } +#endif void sys_printhist( void) { @@ -169,10 +186,15 @@ void sys_printhist( void) sched_diddsp, sched_didpoll, sched_didnothing); } +#ifndef ROCKBOX static int sys_histphase; +#endif int sys_addhist(int phase) { +#ifdef ROCKBOX + (void) phase; +#endif #ifndef FIXEDPOINT int i, j, phasewas = sys_histphase; t_time newtime = sys_getrealtime(); @@ -216,7 +238,11 @@ static char *(oss_errornames[]) = { void glob_audiostatus(void) { +#ifdef ROCKBOX + int nresync, nresyncphase, i; +#else int dev, nresync, nresyncphase, i; +#endif nresync = (oss_nresync >= NRESYNC ? NRESYNC : oss_nresync); nresyncphase = oss_resyncphase - 1; post("audio I/O error history:"); @@ -251,7 +277,9 @@ void sys_log_error(int type) if (type != ERR_NOTHING && !sched_diored && (sched_diddsp >= sched_dioredtime)) { +#ifndef ROCKBOX sys_vgui("pdtk_pd_dio 1\n"); +#endif sched_diored = 1; } sched_dioredtime = @@ -263,6 +291,7 @@ static int sched_lastinclip, sched_lastoutclip, void glob_ping(t_pd *dummy); +#ifndef ROCKBOX static void sched_pollformeters( void) { int inclip, outclip, indb, outdb; @@ -313,9 +342,13 @@ static void sched_pollformeters( void) sched_nextmeterpolltime = sched_diddsp + (int)(sys_dacsr /(double)sys_schedblocksize); } +#endif /* ROCKBOX */ void glob_meters(void *dummy, float f) { +#ifdef ROCKBOX + (void) dummy; +#endif if (f == 0) sys_getmeters(0, 0); sched_meterson = (f != 0); @@ -335,7 +368,10 @@ void dsp_tick(void); static int sched_usedacs = 1; static t_time sched_referencerealtime, sched_referencelogicaltime; -static t_time sys_time_per_dsp_tick; +#ifndef ROCKBOX +static +#endif +t_time sys_time_per_dsp_tick; void sched_set_using_dacs(int flag) { @@ -344,14 +380,24 @@ void sched_set_using_dacs(int flag) { sched_referencerealtime = sys_getrealtime(); sched_referencelogicaltime = clock_getlogicaltime(); +#ifndef ROCKBOX post("schedsetuding"); +#endif } sys_time_per_dsp_tick = (TIMEUNITPERSEC) * ((double)sys_schedblocksize) / sys_dacsr; +/* +#ifdef SIMULATOR +printf("%f\n%f\n%f\n%f\n", (double)sys_time_per_dsp_tick, (double)TIMEUNITPERSEC, (double) sys_schedblocksize, (double)sys_dacsr); +#endif +*/ } /* take the scheduler forward one DSP tick, also handling clock timeouts */ -static void sched_tick(t_time next_sys_time) +#ifndef ROCKBOX +static +#endif +void sched_tick(t_time next_sys_time) { int countdown = 5000; while (clock_setlist && clock_setlist->c_settime < next_sys_time) @@ -364,7 +410,9 @@ static void sched_tick(t_time next_sys_time) if (!countdown--) { countdown = 5000; +#ifndef ROCKBOX sys_pollgui(); +#endif } if (sys_quit) return; @@ -388,9 +436,11 @@ the audio I/O system is still busy with previous transfers. void sys_pollmidiqueue( void); void sys_initmidiqueue( void); +#ifndef ROCKBOX int m_scheduler_pda( void) { int idlecount = 0; + sys_time_per_dsp_tick = (TIMEUNITPERSEC) * ((double)sys_schedblocksize) / sys_dacsr; @@ -402,13 +452,18 @@ int m_scheduler_pda( void) sys_sleepgrain = 100; else if (sys_sleepgrain > 5000) sys_sleepgrain = 5000; + sys_initmidiqueue(); + while (!sys_quit) { + int didsomething = 0; + int timeforward; sys_addhist(0); + waitfortick: if (sched_usedacs) { @@ -564,7 +619,7 @@ int sys_trylock(void) void sys_lock(void) {} void sys_unlock(void) {} -int sys_trylock(void) {} +int sys_trylock(void) { return 0; } #endif @@ -580,3 +635,4 @@ void sys_exit(void) sys_quit = 1; } +#endif /* ROCKBOX */ diff --git a/apps/plugins/pdbox/PDa/src/s_audio.c b/apps/plugins/pdbox/PDa/src/s_audio.c index 5f27d98671..61d1caa583 100644 --- a/apps/plugins/pdbox/PDa/src/s_audio.c +++ b/apps/plugins/pdbox/PDa/src/s_audio.c @@ -6,6 +6,13 @@ audio settings from argparse routine and from dialog window. */ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#include "m_pd.h" +#include "s_stuff.h" +#define snprintf rb->snprintf +#else /* ROCKBOX */ #include "m_pd.h" #include "s_stuff.h" #include @@ -17,6 +24,7 @@ #include #include #include +#endif /* ROCKBOX */ #define SYS_DEFAULTCH 2 #define SYS_MAXCH 100 @@ -116,7 +124,11 @@ static void sys_save_audio_params( void oss_init(void); #endif +#ifdef ROCKBOX +static void pd_audio_init(void) +#else static void audio_init( void) +#endif { static int initted = 0; if (initted) @@ -131,7 +143,9 @@ static void audio_init( void) static void sys_setchsr(int chin, int chout, int sr) { +#ifndef ROCKBOX int nblk; +#endif int inbytes = (chin ? chin : 2) * (DEFDACBLKSIZE*sizeof(float)); int outbytes = (chout ? chout : 2) * (DEFDACBLKSIZE*sizeof(float)); @@ -144,12 +158,20 @@ static void sys_setchsr(int chin, int chout, int sr) if (sys_soundin) free(sys_soundin); +#ifdef ROCKBOX + sys_soundin = (t_sample*) malloc(inbytes); +#else sys_soundin = (t_float *)malloc(inbytes); +#endif memset(sys_soundin, 0, inbytes); if (sys_soundout) free(sys_soundout); +#ifdef ROCKBOX + sys_soundout = (t_sample*) malloc(outbytes); +#else sys_soundout = (t_float *)malloc(outbytes); +#endif memset(sys_soundout, 0, outbytes); if (sys_verbose) @@ -169,12 +191,20 @@ void sys_open_audio(int naudioindev, int *audioindev, int nchindev, int *chindev, int naudiooutdev, int *audiooutdev, int nchoutdev, int *choutdev, int rate, int advance, int enable) { +#ifdef ROCKBOX + int i; +#else int i, *ip; +#endif int defaultchannels = SYS_DEFAULTCH; int inchans, outchans; if (rate < 1) rate = SYS_DEFAULTSRATE; +#ifdef ROCKBOX + pd_audio_init(); +#else audio_init(); +#endif /* Since the channel vector might be longer than the audio device vector, or vice versa, we fill the shorter one in to match the longer one. Also, if both are empty, we fill in @@ -329,6 +359,11 @@ else mmio_open_audio(naudioindev, audioindev, nchindev, chindev, naudiooutdev, audiooutdev, nchoutdev, choutdev, rate); else +#endif +#ifdef USEAPI_ROCKBOX + if (sys_audioapi == API_ROCKBOX) + rockbox_open_audio(rate); + else #endif post("unknown audio API specified"); } @@ -337,7 +372,9 @@ else if (sys_inchannels == 0 && sys_outchannels == 0) enable = 0; audio_state = enable; +#ifndef ROCKBOX sys_vgui("set pd_whichapi %d\n", (audio_isopen() ? sys_audioapi : 0)); +#endif sched_set_using_dacs(enable); } @@ -369,6 +406,11 @@ void sys_close_audio(void) if (sys_audioapi == API_MMIO) mmio_close_audio(); else +#endif +#ifdef USEAPI_ROCKBOX + if (sys_audioapi == API_ROCKBOX) + rockbox_close_audio(); + else #endif post("sys_close_audio: unknown API %d", sys_audioapi); sys_inchannels = sys_outchannels = 0; @@ -434,6 +476,11 @@ int sys_send_dacs(void) if (sys_audioapi == API_MMIO) return (mmio_send_dacs()); else +#endif +#ifdef USEAPI_ROCKBOX + if (sys_audioapi == API_ROCKBOX) + return (rockbox_send_dacs()); + else #endif post("unknown API"); return (0); @@ -482,11 +529,17 @@ void sys_reportidle(void) #define MAXNDEV 20 #define DEVDESCSIZE 80 +#ifndef ROCKBOX static void audio_getdevs(char *indevlist, int *nindevs, char *outdevlist, int *noutdevs, int *canmulti, int maxndev, int devdescsize) { +#ifdef ROCKBOX + (void) maxndev; + pd_audio_init(); +#else audio_init(); +#endif /* ROCKBOX */ #ifdef USEAPI_OSS if (sys_audioapi == API_OSS) { @@ -518,6 +571,13 @@ static void audio_getdevs(char *indevlist, int *nindevs, maxndev, devdescsize); } else +#endif +#ifdef USEAPI_ROCKBOX + if (sys_audioapi == API_ROCKBOX) + { + /* Rockbox devices are known in advance. (?) */ + } + else #endif { /* this shouldn't happen once all the above get filled in. */ @@ -531,6 +591,7 @@ static void audio_getdevs(char *indevlist, int *nindevs, *canmulti = 0; } } +#endif #ifdef MSW #define DEVONSET 0 /* microsoft device list starts at 0 (the "mapper"). */ @@ -538,6 +599,7 @@ static void audio_getdevs(char *indevlist, int *nindevs, #define DEVONSET 1 /* To agree with command line flags, normally start at 1 */ #endif +#ifndef ROCKBOX static void sys_listaudiodevs(void ) { char indevlist[MAXNDEV*DEVDESCSIZE], outdevlist[MAXNDEV*DEVDESCSIZE]; @@ -564,8 +626,10 @@ static void sys_listaudiodevs(void ) } post("API number %d\n", sys_audioapi); } +#endif /* start an audio settings dialog window */ +#ifndef ROCKBOX void glob_audio_properties(t_pd *dummy, t_floatarg flongform) { char buf[1024 + 2 * MAXNDEV*(DEVDESCSIZE+4)]; @@ -645,8 +709,10 @@ void glob_audio_properties(t_pd *dummy, t_floatarg flongform) gfxstub_deleteforkey(0); gfxstub_new(&glob_pdobject, glob_audio_properties, buf); } +#endif /* new values from dialog window */ +#ifndef ROCKBOX void glob_audio_dialog(t_pd *dummy, t_symbol *s, int argc, t_atom *argv) { int naudioindev, audioindev[MAXAUDIOINDEV], chindev[MAXAUDIOINDEV]; @@ -696,6 +762,7 @@ void glob_audio_dialog(t_pd *dummy, t_symbol *s, int argc, t_atom *argv) noutdev, newaudiooutdev, noutdev, newaudiooutchan, newrate, newadvance, 1); } +#endif void sys_listdevs(void ) { @@ -723,6 +790,13 @@ void sys_listdevs(void ) if (sys_audioapi == API_ALSA) sys_listaudiodevs(); else +#endif +#ifdef USEAPI_ROCKBOX + if (sys_audioapi == API_ROCKBOX) + { + /* Nothing to list, IMO. */ + } + else #endif post("unknown API"); @@ -746,9 +820,11 @@ void sys_set_audio_api(int which) post("sys_audioapi %d", sys_audioapi); } +#ifndef ROCKBOX void glob_audio_setapi(void *dummy, t_floatarg f) { int newapi = f; + if (newapi) { if (newapi == sys_audioapi) @@ -775,6 +851,7 @@ void glob_audio_setapi(void *dummy, t_floatarg f) sched_set_using_dacs(0); } } +#endif /* start or stop the audio hardware */ void sys_set_audio_state(int onoff) @@ -842,6 +919,10 @@ void alsa_printstate( void); void glob_foo(void *dummy, t_symbol *s, int argc, t_atom *argv) { t_symbol *arg = atom_getsymbolarg(0, argc, argv); +#ifdef ROCKBOX + (void) dummy; + (void) s; +#endif if (arg == gensym("restart")) { int naudioindev, audioindev[MAXAUDIOINDEV], chindev[MAXAUDIOINDEV]; diff --git a/apps/plugins/pdbox/PDa/src/s_audio_rockbox.c b/apps/plugins/pdbox/PDa/src/s_audio_rockbox.c new file mode 100644 index 0000000000..7f9b0e03e1 --- /dev/null +++ b/apps/plugins/pdbox/PDa/src/s_audio_rockbox.c @@ -0,0 +1,144 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2009 Wincent Balin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include "plugin.h" +#include "pdbox.h" + +#include "m_pd.h" +#include "s_stuff.h" + +/* Sound output buffer. */ +#define AUDIO_OUTPUT_BLOCKS 3 +static struct pdbox_audio_block audio_output[AUDIO_OUTPUT_BLOCKS]; +static unsigned int output_head; +static unsigned int output_tail; +static unsigned int output_fill; + +/* Open audio. */ +void rockbox_open_audio(int rate) +{ + unsigned int i; + + /* Initialize output buffer. */ + for(i = 0; i < AUDIO_OUTPUT_BLOCKS; i++) + audio_output[i].fill = 0; + + output_head = 0; + output_tail = 0; + output_fill = 0; + +#if INPUT_SRC_CAPS != 0 + /* Select playback */ + rb->audio_set_input_source(AUDIO_SRC_PLAYBACK, SRCF_PLAYBACK); + rb->audio_set_output_source(AUDIO_SRC_PLAYBACK); +#endif + + /* Set sample rate of the audio buffer. */ + rb->pcm_set_frequency(rate); +} + +/* Close audio. */ +void rockbox_close_audio(void) +{ + /* Stop playback. */ + rb->pcm_play_stop(); + + /* Restore default sampling rate. */ + rb->pcm_set_frequency(HW_SAMPR_DEFAULT); +} + +/* Rockbox audio callback. */ +void pdbox_get_more(unsigned char** start, size_t* size) +{ + if(output_fill > 0) + { + /* Store output data address and size. */ + *start = (unsigned char*) audio_output[output_tail].data; + *size = audio_output[output_tail].fill; + + /* Advance tail index. */ + audio_output[output_tail].fill = 0; + output_fill--; + if(output_tail == AUDIO_OUTPUT_BLOCKS-1) + output_tail = 0; + else + output_tail++; + } + else + { + /* Nothing to play. */ + *start = NULL; + *size = 0; + return; + } +} + +/* Audio I/O. */ +int rockbox_send_dacs(void) +{ + + + /* Start playback if needed and possible. */ + if(output_fill > 1 && + audio_output[output_tail].fill == PD_AUDIO_BLOCK_SIZE) + { + /* Start playback. */ + rb->pcm_play_data(pdbox_get_more, + (unsigned char*) audio_output[output_tail].data, + PD_AUDIO_BLOCK_SIZE); + + /* Advance tail index. */ + audio_output[output_tail].fill = PD_AUDIO_BLOCK_SIZE; + output_fill--; + if(output_tail == AUDIO_OUTPUT_BLOCKS-1) + output_tail = 0; + else + output_tail++; + } + + + + +#if 0 + if (sys_getrealtime() > timebefore + 0.002) + { + /* post("slept"); */ + return (SENDDACS_SLEPT); + } + else +#endif + return (SENDDACS_YES); +} + +/* Placeholder. */ +void rockbox_listdevs(void) +{ +} + +#if 0 +/* Scanning for devices */ +void rockbox_getdevs(char *indevlist, int *nindevs, + char *outdevlist, int *noutdevs, int *canmulti, + int maxndev, int devdescsize) +{ +} +#endif + diff --git a/apps/plugins/pdbox/PDa/src/s_file.c b/apps/plugins/pdbox/PDa/src/s_file.c index 27825d5948..f98741cf2a 100644 --- a/apps/plugins/pdbox/PDa/src/s_file.c +++ b/apps/plugins/pdbox/PDa/src/s_file.c @@ -6,14 +6,32 @@ * this file contains file-handling routines. */ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#include "m_pd.h" +#include "s_stuff.h" +#else /* ROCKBOX */ #include "m_pd.h" #include "s_stuff.h" #include #include +#endif /* ROCKBOX */ /* LATER delete this? -- replaced by find_via_path() in s_path.c */ int sys_isreadablefile(const char *s) { +#ifdef ROCKBOX + int fd; + + if((fd = open(s, O_RDONLY))) + { + close(fd); + return 1; + } + else + return 0; +#else /* ROCKBOX */ struct stat statbuf; int mode; if (stat(s, &statbuf) < 0) return (0); @@ -22,13 +40,14 @@ int sys_isreadablefile(const char *s) if (S_ISDIR(mode)) return (0); #endif return (1); +#endif /* ROCKBOX */ } /* change '/' characters to the system's native file separator */ void sys_bashfilename(const char *from, char *to) { char c; - while (c = *from++) + while((c = *from++)) { #ifdef MSW if (c == '/') c = '\\'; @@ -43,7 +62,7 @@ void sys_bashfilename(const char *from, char *to) void sys_unbashfilename(const char *from, char *to) { char c; - while (c = *from++) + while((c = *from++)) { #ifdef MSW if (c == '\\') c = '/'; diff --git a/apps/plugins/pdbox/PDa/src/s_loader.c b/apps/plugins/pdbox/PDa/src/s_loader.c index c5a8677f71..7f47b1f8f8 100644 --- a/apps/plugins/pdbox/PDa/src/s_loader.c +++ b/apps/plugins/pdbox/PDa/src/s_loader.c @@ -2,6 +2,10 @@ * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#else /* ROCKBOX */ #ifdef DL_OPEN #include #endif @@ -17,12 +21,14 @@ #include #endif #include +#include +#endif /* ROCKBOX */ #include "m_pd.h" #include "s_stuff.h" -#include typedef void (*t_xxx)(void); +#ifndef ROCKBOX static char sys_dllextent[] = #ifdef __FreeBSD__ ".pd_freebsd"; @@ -43,12 +49,22 @@ static char sys_dllextent[] = #ifdef MSW ".dll"; #endif +#endif /* ROCKBOX */ void class_set_extern_dir(t_symbol *s); #ifdef STATIC int sys_load_lib(char *dirname, char *classname) +#ifdef ROCKBOX +{ + (void) dirname; + (void) classname; + + return 0; +} +#else /* ROCKBOX */ { return 0;} +#endif /* ROCKBOX */ #else int sys_load_lib(char *dirname, char *classname) { diff --git a/apps/plugins/pdbox/PDa/src/s_path.c b/apps/plugins/pdbox/PDa/src/s_path.c index f40f1f6e49..da4fc94782 100644 --- a/apps/plugins/pdbox/PDa/src/s_path.c +++ b/apps/plugins/pdbox/PDa/src/s_path.c @@ -14,6 +14,26 @@ #define DEBUG(x) void readsf_banana( void); /* debugging */ +#ifdef ROCKBOX + +#include "plugin.h" +#include "pdbox.h" + +#include "m_pd.h" +#include "m_imp.h" +#include "s_stuff.h" + +#define open rb->open +#define close rb->close +#define strcpy rb->strcpy +#define strcat rb->strcat +#define strlen rb->strlen +#define strcmp rb->strcmp +#define strncpy rb->strncpy +#define strrchr rb->strrchr +#define strncat rb_strncat + +#else /* ROCKBOX */ #include #ifdef UNIX #include @@ -29,6 +49,7 @@ void readsf_banana( void); /* debugging */ #include "s_stuff.h" #include #include +#endif /* ROCKBOX */ static t_namelist *pd_path, *pd_helppath; @@ -85,6 +106,10 @@ t_namelist *namelist_append(t_namelist *listwas, const char *s) char temp[MAXPDSTRING]; t_namelist *nl = listwas, *rtn = listwas; +#ifdef ROCKBOX + (void) rtn; +#endif + npos = s; do { @@ -138,6 +163,10 @@ int open_via_path(const char *dir, const char *name, const char* ext, int fd = -1; char listbuf[MAXPDSTRING]; +#ifdef ROCKBOX + (void) bin; +#endif + if (name[0] == '/' #ifdef MSW || (name[1] == ':' && name[2] == '/') @@ -191,6 +220,7 @@ int open_via_path(const char *dir, const char *name, const char* ext, char *slash; if (sys_verbose) post("tried %s and succeeded", dirresult); sys_unbashfilename(dirresult, dirresult); + slash = strrchr(dirresult, '/'); if (slash) { @@ -199,7 +229,7 @@ int open_via_path(const char *dir, const char *name, const char* ext, } else *nameresult = dirresult; - return (fd); + return (fd); } } else @@ -245,7 +275,9 @@ static int do_open_via_helppath(const char *realname, t_namelist *listp) else #endif { +#ifndef ROCKBOX char *slash; +#endif if (sys_verbose) post("tried %s and succeeded", dirresult); sys_unbashfilename(dirresult, dirresult); close (fd); @@ -266,8 +298,12 @@ static int do_open_via_helppath(const char *realname, t_namelist *listp) search attempts. */ void open_via_helppath(const char *name, const char *dir) { +#ifdef ROCKBOX + t_namelist thislist, *listp; +#else /*ROCKBOX */ t_namelist *nl, thislist, *listp; int fd = -1; +#endif /* ROCKBOX */ char dirbuf2[MAXPDSTRING], realname[MAXPDSTRING]; /* if directory is supplied, put it at head of search list. */ @@ -380,6 +416,10 @@ int sys_rcfile(void) /* start an audio settings dialog window */ void glob_start_path_dialog(t_pd *dummy, t_floatarg flongform) { +#ifdef ROCKBOX + (void) dummy; + (void) flongform; +#else /* ROCKBOX */ char buf[MAXPDSTRING]; int i; t_namelist *nl; @@ -391,12 +431,19 @@ void glob_start_path_dialog(t_pd *dummy, t_floatarg flongform) sprintf(buf, "pdtk_path_dialog %%s\n"); gfxstub_new(&glob_pdobject, glob_start_path_dialog, buf); +#endif /* ROCKBOX */ } /* new values from dialog window */ void glob_path_dialog(t_pd *dummy, t_symbol *s, int argc, t_atom *argv) { int i; + +#ifdef ROCKBOX + (void) dummy; + (void) s; +#endif /* ROCKBOX */ + namelist_free(pd_path); pd_path = 0; for (i = 0; i < argc; i++) diff --git a/apps/plugins/pdbox/PDa/src/s_print.c b/apps/plugins/pdbox/PDa/src/s_print.c index 40f881f00e..c71dcb7845 100644 --- a/apps/plugins/pdbox/PDa/src/s_print.c +++ b/apps/plugins/pdbox/PDa/src/s_print.c @@ -79,7 +79,7 @@ void poststring(char *s) #ifdef SIMULATOR printf(" %s", s); #else /* SIMULATOR */ - (void)s; + (void) s; #endif /* SIMULATOR */ #else /* ROCKBOX */ fprintf(stderr, " %s", s); @@ -167,7 +167,7 @@ void pd_error(void *object, char *fmt, ...) saidit = 1; } #else /* SIMULATOR */ - (void)object; + (void) object; (void) fmt; #endif /* SIMULATOR */ #else /* ROCKBOX */ @@ -191,7 +191,7 @@ void pd_error(void *object, char *fmt, ...) void glob_finderror(t_pd *dummy) { #ifdef ROCKBOX - (void)dummy; + (void) dummy; #endif /* ROCKBOX */ if (!error_object) post("no findable error yet."); @@ -250,8 +250,12 @@ void sys_logerror(char *object, char *s) void sys_unixerror(char *object) { +#ifdef ROCKBOX + (void) object; +#else errobject = object; errstring = strerror(errno); +#endif /* ROCKBOX */ } void sys_ouch(void) diff --git a/apps/plugins/pdbox/PDa/src/s_stuff.h b/apps/plugins/pdbox/PDa/src/s_stuff.h index 2c7ae8b209..566df34773 100644 --- a/apps/plugins/pdbox/PDa/src/s_stuff.h +++ b/apps/plugins/pdbox/PDa/src/s_stuff.h @@ -130,8 +130,9 @@ void sys_setvirtualalarm( void); #define API_MMIO 3 #define API_PORTAUDIO 4 #define API_JACK 5 +#define API_ROCKBOX 6 -#ifdef __linux__ +#if defined(__linux__) && !defined(ROCKBOX) #define API_DEFAULT API_OSS #define API_DEFSTRING "OSS" #endif @@ -143,6 +144,10 @@ void sys_setvirtualalarm( void); #define API_DEFAULT API_PORTAUDIO #define API_DEFSTRING "portaudio" #endif +#ifdef ROCKBOX +#define API_DEFAULT API_ROCKBOX +#define API_DEFSTRING "Rockbox" +#endif #define DEFAULTAUDIODEV 0 #define MAXAUDIOINDEV 4 @@ -204,6 +209,11 @@ void mmio_getdevs(char *indevlist, int *nindevs, char *outdevlist, int *noutdevs, int *canmulti, int maxndev, int devdescsize); +void rockbox_open_audio(int rate); +void rockbox_close_audio(void); +int rockbox_send_dacs(void); +void rockbox_getdevs(void); + void sys_listmididevs(void); void sys_set_audio_api(int whichapi); void sys_get_audio_apis(char *buf); diff --git a/apps/plugins/pdbox/PDa/src/x_acoustics.c b/apps/plugins/pdbox/PDa/src/x_acoustics.c index 9c5cd07495..cb2b01fe41 100644 --- a/apps/plugins/pdbox/PDa/src/x_acoustics.c +++ b/apps/plugins/pdbox/PDa/src/x_acoustics.c @@ -5,6 +5,11 @@ /* utility functions for signals */ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#endif + #include "m_pd.h" #include #define LOGTEN 2.302585092994 diff --git a/apps/plugins/pdbox/PDa/src/x_arithmetic.c b/apps/plugins/pdbox/PDa/src/x_arithmetic.c index f060f2fd49..3ac5b5f075 100644 --- a/apps/plugins/pdbox/PDa/src/x_arithmetic.c +++ b/apps/plugins/pdbox/PDa/src/x_arithmetic.c @@ -6,6 +6,11 @@ done on floats; the logical and bitwise binops convert their inputs to int and their outputs back to float. */ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#endif + #include "m_pd.h" #include diff --git a/apps/plugins/pdbox/PDa/src/x_connective.c b/apps/plugins/pdbox/PDa/src/x_connective.c index 52bc0920a1..8ad2f605cf 100644 --- a/apps/plugins/pdbox/PDa/src/x_connective.c +++ b/apps/plugins/pdbox/PDa/src/x_connective.c @@ -4,10 +4,18 @@ /* connective objects */ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#endif + #include "m_pd.h" +#ifndef ROCKBOX #include #include +#endif + extern t_pd *newest; /* -------------------------- int ------------------------------ */ @@ -62,6 +70,9 @@ typedef struct _pdfloat static void *pdfloat_new(t_pd *dummy, t_float f) { +#ifdef ROCKBOX + (void) dummy; +#endif t_pdfloat *x = (t_pdfloat *)pd_new(pdfloat_class); x->x_f = f; outlet_new(&x->x_obj, &s_float); @@ -105,6 +116,9 @@ typedef struct _pdsymbol static void *pdsymbol_new(t_pd *dummy, t_symbol *s) { +#ifdef ROCKBOX + (void) dummy; +#endif t_pdsymbol *x = (t_pdsymbol *)pd_new(pdsymbol_class); x->x_s = s; outlet_new(&x->x_obj, &s_symbol); @@ -125,6 +139,10 @@ static void pdsymbol_symbol(t_pdsymbol *x, t_symbol *s) static void pdsymbol_anything(t_pdsymbol *x, t_symbol *s, int ac, t_atom *av) { +#ifdef ROCKBOX + (void) ac; + (void) av; +#endif outlet_symbol(x->x_obj.ob_outlet, x->x_s = s); } @@ -147,6 +165,9 @@ typedef struct _bang static void *bang_new(t_pd *dummy) { +#ifdef ROCKBOX + (void) dummy; +#endif t_bang *x = (t_bang *)pd_new(bang_class); outlet_new(&x->x_obj, &s_bang); newest = &x->x_obj.ob_pd; @@ -155,6 +176,9 @@ static void *bang_new(t_pd *dummy) static void *bang_new2(t_bang f) { +#ifdef ROCKBOX + (void) f; +#endif return (bang_new(0)); } @@ -383,6 +407,9 @@ static void sel2_free(t_sel2 *x) static void *select_new(t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; +#endif t_atom a; if (argc == 0) { @@ -484,6 +511,9 @@ static void route_anything(t_route *x, t_symbol *sel, int argc, t_atom *argv) static void route_list(t_route *x, t_symbol *sel, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) sel; +#endif t_routeelement *e; int nelement; if (x->x_type == A_FLOAT) @@ -562,6 +592,9 @@ static void route_free(t_route *x) static void *route_new(t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; +#endif int n; t_routeelement *e; t_route *x = (t_route *)pd_new(route_class); @@ -610,6 +643,9 @@ typedef struct _pack static void *pack_new(t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; +#endif t_pack *x = (t_pack *)pd_new(pack_class); t_atom defarg[2], *ap, *vec, *vp; t_gpointer *gp; @@ -737,6 +773,9 @@ static void pack_symbol(t_pack *x, t_symbol *s) static void pack_list(t_pack *x, t_symbol *s, int ac, t_atom *av) { +#ifdef ROCKBOX + (void) s; +#endif obj_list(&x->x_obj, 0, ac, av); } @@ -793,6 +832,9 @@ typedef struct _unpack static void *unpack_new(t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; +#endif t_unpack *x = (t_unpack *)pd_new(unpack_class); t_atom defarg[2], *ap; t_unpackout *u; @@ -841,6 +883,9 @@ static void *unpack_new(t_symbol *s, int argc, t_atom *argv) static void unpack_list(t_unpack *x, t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; +#endif t_atom *ap; t_unpackout *u; int i; @@ -907,6 +952,9 @@ typedef struct _trigger static void *trigger_new(t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; +#endif t_trigger *x = (t_trigger *)pd_new(trigger_class); t_atom defarg[2], *ap; t_triggerout *u; @@ -953,6 +1001,9 @@ static void *trigger_new(t_symbol *s, int argc, t_atom *argv) static void trigger_list(t_trigger *x, t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; +#endif t_triggerout *u; int i; t_atom at; @@ -1204,14 +1255,22 @@ static void *makefilename_new(t_symbol *s) static void makefilename_float(t_makefilename *x, t_floatarg f) { char buf[MAXPDSTRING]; +#ifdef ROCKBOX + snprintf(buf, sizeof(buf), x->x_format->s_name, (int)f); +#else sprintf(buf, x->x_format->s_name, (int)f); +#endif outlet_symbol(x->x_obj.ob_outlet, gensym(buf)); } static void makefilename_symbol(t_makefilename *x, t_symbol *s) { char buf[MAXPDSTRING]; +#ifdef ROCKBOX + snprintf(buf, sizeof(buf), x->x_format->s_name, s->s_name); +#else sprintf(buf, x->x_format->s_name, s->s_name); +#endif outlet_symbol(x->x_obj.ob_outlet, gensym(buf)); } diff --git a/apps/plugins/pdbox/PDa/src/x_interface.c b/apps/plugins/pdbox/PDa/src/x_interface.c index 227ca0f4fd..9939c6bdf0 100644 --- a/apps/plugins/pdbox/PDa/src/x_interface.c +++ b/apps/plugins/pdbox/PDa/src/x_interface.c @@ -30,6 +30,9 @@ static void print_bang(t_print *x) static void print_pointer(t_print *x, t_gpointer *gp) { +#ifdef ROCKBOX + (void) gp; +#endif post("%s(gpointer)", x->x_sym->s_name); } @@ -40,8 +43,12 @@ static void print_float(t_print *x, t_float f) static void print_list(t_print *x, t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; +#else int i; char buf[80]; +#endif if (argc && argv->a_type != A_SYMBOL) startpost("%s:", x->x_sym->s_name); else startpost("%s%s", x->x_sym->s_name, (argc > 1 ? s_list.s_name : (argc == 1 ? s_symbol.s_name : @@ -52,8 +59,10 @@ static void print_list(t_print *x, t_symbol *s, int argc, t_atom *argv) static void print_anything(t_print *x, t_symbol *s, int argc, t_atom *argv) { +#ifndef ROCKBOX int i; char buf[80]; +#endif startpost("%s%s", x->x_sym->s_name, s->s_name); postatom(argc, argv); endpost(); diff --git a/apps/plugins/pdbox/PDa/src/x_misc.c b/apps/plugins/pdbox/PDa/src/x_misc.c index e7d0005421..e929646e7c 100644 --- a/apps/plugins/pdbox/PDa/src/x_misc.c +++ b/apps/plugins/pdbox/PDa/src/x_misc.c @@ -4,6 +4,13 @@ /* misc. */ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#include "m_pd.h" +#include "s_stuff.h" +extern uint64_t runningtime; +#else /* ROCKBOX */ #include "m_pd.h" #include "s_stuff.h" #include @@ -19,6 +26,7 @@ #include #include #endif +#endif /* ROCKBOX */ #if defined (MACOSX) || defined (__FreeBSD__) #define HZ CLK_TCK @@ -68,6 +76,9 @@ static void random_bang(t_random *x) static void random_seed(t_random *x, float f, float glob) { +#ifdef ROCKBOX + (void) glob; +#endif x->x_state = f; } @@ -155,6 +166,10 @@ typedef struct _serial static void serial_float(t_serial *x, t_float f) { +#ifdef ROCKBOX + (void) x; + (void) f; +#else /* ROCKBOX */ int n = f; char message[MAXSERIAL * 4 + 100]; if (!x->x_open) @@ -164,6 +179,7 @@ static void serial_float(t_serial *x, t_float f) } sprintf(message, "com%d_send \"\\%3.3o\"\n", x->x_portno, n); sys_gui(message); +#endif /* ROCKBOX */ } static void *serial_new(t_floatarg fportno) @@ -190,6 +206,9 @@ static t_class *cputime_class; typedef struct _cputime { t_object x_obj; +#ifdef ROCKBOX + uint64_t x_runningtime; +#endif #ifdef UNIX struct tms x_setcputime; #endif @@ -202,6 +221,9 @@ typedef struct _cputime static void cputime_bang(t_cputime *x) { +#ifdef ROCKBOX + x->x_runningtime = runningtime; +#endif #ifdef UNIX times(&x->x_setcputime); #endif @@ -221,9 +243,16 @@ static void cputime_bang(t_cputime *x) #endif } +#ifndef ROCKBOX #define HZ 100 +#endif static void cputime_bang2(t_cputime *x) { +#ifdef ROCKBOX + float elapsedcpu = 1000 * + (runningtime - x->x_runningtime) / HZ; + outlet_float(x->x_obj.ob_outlet, elapsedcpu); +#endif #ifdef UNIX float elapsedcpu; struct tms newcputime; diff --git a/apps/plugins/pdbox/PDa/src/x_net.c b/apps/plugins/pdbox/PDa/src/x_net.c index c4a004cc5c..aa19f78ec0 100644 --- a/apps/plugins/pdbox/PDa/src/x_net.c +++ b/apps/plugins/pdbox/PDa/src/x_net.c @@ -2,11 +2,17 @@ * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#endif + /* network */ #include "m_pd.h" #include "s_stuff.h" +#ifndef ROCKBOX #include #include #ifdef UNIX @@ -19,6 +25,7 @@ #else #include #endif +#endif /* ROCKBOX */ static t_class *netsend_class; @@ -31,16 +38,27 @@ typedef struct _netsend static void *netsend_new(t_floatarg udpflag) { +#ifdef ROCKBOX + (void) udpflag; +#endif + t_netsend *x = (t_netsend *)pd_new(netsend_class); outlet_new(&x->x_obj, &s_float); x->x_fd = -1; +#ifndef ROCKBOX x->x_protocol = (udpflag != 0 ? SOCK_DGRAM : SOCK_STREAM); +#endif return (x); } static void netsend_connect(t_netsend *x, t_symbol *hostname, t_floatarg fportno) { +#ifdef ROCKBOX + (void) x; + (void) hostname; + (void) fportno; +#else /* ROCKBOX */ struct sockaddr_in server; struct hostent *hp; int sockfd; @@ -100,13 +118,16 @@ static void netsend_connect(t_netsend *x, t_symbol *hostname, } x->x_fd = sockfd; outlet_float(x->x_obj.ob_outlet, 1); +#endif /* ROCKBOX */ } static void netsend_disconnect(t_netsend *x) { if (x->x_fd >= 0) { +#ifndef ROCKBOX sys_closesocket(x->x_fd); +#endif x->x_fd = -1; outlet_float(x->x_obj.ob_outlet, 0); } @@ -114,6 +135,12 @@ static void netsend_disconnect(t_netsend *x) static void netsend_send(t_netsend *x, t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) x; + (void) s; + (void) argc; + (void) argv; +#else /* ROCKBOX */ if (x->x_fd >= 0) { t_binbuf *b = binbuf_new(); @@ -159,11 +186,16 @@ static void netsend_send(t_netsend *x, t_symbol *s, int argc, t_atom *argv) binbuf_free(b); } else error("netsend: not connected"); +#endif /* ROCKBOX */ } static void netsend_free(t_netsend *x) { +#ifdef ROCKBOX + (void) x; +#else netsend_disconnect(x); +#endif } static void netsend_setup(void) @@ -193,14 +225,23 @@ typedef struct _netreceive int x_udp; } t_netreceive; +#ifdef ROCKBOX +static t_netreceive* receiver; +static int receiver_port; +#endif /* ROCKBOX */ + +#ifndef ROCKBOX static void netreceive_notify(t_netreceive *x) { outlet_float(x->x_connectout, --x->x_nconnections); } +#endif /* ROCKBOX */ static void netreceive_doit(void *z, t_binbuf *b) { +#ifndef ROCKBOX t_atom messbuf[1024]; +#endif t_netreceive *x = (t_netreceive *)z; int msg, natom = binbuf_getnatom(b); t_atom *at = binbuf_getvec(b); @@ -234,6 +275,7 @@ static void netreceive_doit(void *z, t_binbuf *b) } } +#ifndef ROCKBOX static void netreceive_connectpoll(t_netreceive *x) { int fd = accept(x->x_connectsocket, 0, 0); @@ -247,11 +289,41 @@ static void netreceive_connectpoll(t_netreceive *x) outlet_float(x->x_connectout, ++x->x_nconnections); } } +#endif static void *netreceive_new(t_symbol *compatflag, t_floatarg fportno, t_floatarg udpflag) { t_netreceive *x; + +#ifdef ROCKBOX + int portno = fportno, udp = (udpflag != 0); + + (void) compatflag; + + /* Look whether callback is already taken. */ + if(receiver) + { + post("Receiver callback already taken!\n"); + return NULL; + } + + /* Look whether TCP sockets are thought to exist. */ + if(!udp) + { + post("Trying to create TCP socket!\n"); + return NULL; + } + + x = (t_netreceive *) pd_new(netreceive_class); + x->x_msgout = outlet_new(&x->x_obj, &s_anything); + x->x_nconnections = 0; + x->x_udp = udp; + + receiver = x; + receiver_port = portno; + +#else /* ROCKBOX */ struct sockaddr_in server; int sockfd, portno = fportno, udp = (udpflag != 0); int old = !strcmp(compatflag->s_name , "old"); @@ -333,20 +405,62 @@ static void *netreceive_new(t_symbol *compatflag, x->x_connectsocket = sockfd; x->x_nconnections = 0; x->x_udp = udp; +#endif /* ROCKBOX */ return (x); } static void netreceive_free(t_netreceive *x) { +#ifdef ROCKBOX + if(receiver && receiver == x) + receiver = NULL; +#else /* ROCKBOX */ /* LATER make me clean up open connections */ if (x->x_connectsocket >= 0) { sys_rmpollfn(x->x_connectsocket); sys_closesocket(x->x_connectsocket); } +#endif /* ROCKBOX */ } +#ifdef ROCKBOX +/* Basically a reimplementation of socketreceiver_getudp() + from s_inter.c */ +t_binbuf* inbinbuf; +void outlet_setstacklim(void); + +void rockbox_receive_callback(struct datagram* dg) +{ + /* Check whether there is a receiver. */ + if(!receiver) + return; + + /* Limit string. */ + dg->data[dg->size] = '\0'; + + /* If complete line... */ + if(dg->data[dg->size-1] == '\n') + { + char* semi = strchr(dg->data, ';'); + + /* Limit message. */ + if(semi) + *semi = '\0'; + + /* Create binary buffer. */ + binbuf_text(inbinbuf, dg->data, strlen(dg->data)); + + /* Limit outlet stack. */ + outlet_setstacklim(); + + /* Execute receive function. */ + netreceive_doit(receiver, inbinbuf); + } +} +#endif /* ROCKBOX */ + static void netreceive_setup(void) { netreceive_class = class_new(gensym("netreceive"), @@ -360,5 +474,3 @@ void x_net_setup(void) netsend_setup(); netreceive_setup(); } - - diff --git a/apps/plugins/pdbox/PDa/src/x_qlist.c b/apps/plugins/pdbox/PDa/src/x_qlist.c index 7dbec5e7b4..fc7866ff41 100644 --- a/apps/plugins/pdbox/PDa/src/x_qlist.c +++ b/apps/plugins/pdbox/PDa/src/x_qlist.c @@ -2,7 +2,14 @@ * For information on usage and redistribution, and for a DISCLAIMER OF ALL * WARRANTIES, see the file, "LICENSE.txt," in this distribution. */ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#endif + #include "m_pd.h" + +#ifndef ROCKBOX #include #ifdef UNIX #include @@ -10,6 +17,7 @@ #ifdef MSW #include #endif +#endif /* ROCKBOX */ typedef struct _qlist { @@ -32,7 +40,9 @@ static t_class *qlist_class; static void *qlist_new( void) { +#ifndef ROCKBOX t_symbol *name, *filename = 0; +#endif t_qlist *x = (t_qlist *)pd_new(qlist_class); x->x_binbuf = binbuf_new(); x->x_clock = clock_new(x, (t_method)qlist_tick); @@ -151,6 +161,9 @@ static void qlist_tick(t_qlist *x) static void qlist_add(t_qlist *x, t_symbol *s, int ac, t_atom *av) { +#ifdef ROCKBOX + (void) s; +#endif t_atom a; SETSEMI(&a); binbuf_add(x->x_binbuf, ac, av); @@ -159,6 +172,9 @@ static void qlist_add(t_qlist *x, t_symbol *s, int ac, t_atom *av) static void qlist_add2(t_qlist *x, t_symbol *s, int ac, t_atom *av) { +#ifdef ROCKBOX + (void) s; +#endif binbuf_add(x->x_binbuf, ac, av); } @@ -239,7 +255,9 @@ typedef t_qlist t_textfile; static void *textfile_new( void) { +#ifndef ROCKBOX t_symbol *name, *filename = 0; +#endif t_textfile *x = (t_textfile *)pd_new(textfile_class); x->x_binbuf = binbuf_new(); outlet_new(&x->x_ob, &s_list); @@ -257,7 +275,11 @@ static void *textfile_new( void) static void textfile_bang(t_textfile *x) { int argc = binbuf_getnatom(x->x_binbuf), +#ifdef ROCKBOX + onset = x->x_onset, onset2; +#else count, onset = x->x_onset, onset2; +#endif t_atom *argv = binbuf_getvec(x->x_binbuf); t_atom *ap = argv + onset, *ap2; while (onset < argc && diff --git a/apps/plugins/pdbox/PDa/src/x_time.c b/apps/plugins/pdbox/PDa/src/x_time.c index 4cab8bc364..2d38369aa5 100644 --- a/apps/plugins/pdbox/PDa/src/x_time.c +++ b/apps/plugins/pdbox/PDa/src/x_time.c @@ -266,6 +266,9 @@ static void timer_bang2(t_timer *x) static void *timer_new(t_floatarg f) { +#ifdef ROCKBOX + (void) f; +#endif t_timer *x = (t_timer *)pd_new(timer_class); timer_bang(x); outlet_new(&x->x_obj, gensym("float")); @@ -314,6 +317,9 @@ typedef struct _pipe static void *pipe_new(t_symbol *s, int argc, t_atom *argv) { +#ifdef ROCKBOX + (void) s; +#endif t_pipe *x = (t_pipe *)pd_new(pipe_class); t_atom defarg, *ap; t_pipeout *vec, *vp; @@ -412,7 +418,7 @@ static void hang_tick(t_hang *h) int i; union word *w; if (x->x_hang == h) x->x_hang = h->h_next; - else for (h2 = x->x_hang; h3 = h2->h_next; h2 = h3) + else for (h2 = x->x_hang; (h3 = h2->h_next); h2 = h3) { if (h3 == h) { @@ -432,6 +438,9 @@ static void hang_tick(t_hang *h) outlet_pointer(p->p_outlet, w->w_gpointer); else post("pipe: stale pointer"); break; +#ifdef ROCKBOX + default: break; +#endif } } hang_free(h); @@ -439,6 +448,9 @@ static void hang_tick(t_hang *h) static void pipe_list(t_pipe *x, t_symbol *s, int ac, t_atom *av) { +#ifdef ROCKBOX + (void) s; +#endif t_hang *h = (t_hang *) getbytes(sizeof(*h) + (x->x_n - 1) * sizeof(*h->h_vec)); t_gpointer *gp, *gp2; @@ -465,6 +477,10 @@ static void pipe_list(t_pipe *x, t_symbol *s, int ac, t_atom *av) if (gp->gp_stub) gp->gp_stub->gs_refcount++; } gp++; +#ifdef ROCKBOX + break; + default: break; +#endif } } for (i = 0, gp = x->x_gp, gp2 = h->h_gp, p = x->x_vec, w = h->h_vec; @@ -493,7 +509,7 @@ static void pipe_flush(t_pipe *x) static void pipe_clear(t_pipe *x) { t_hang *hang; - while (hang = x->x_hang) + while ((hang = x->x_hang)) { x->x_hang = hang->h_next; hang_free(hang); diff --git a/apps/plugins/pdbox/SOURCES b/apps/plugins/pdbox/SOURCES index fa4aa92b1d..9f54273877 100644 --- a/apps/plugins/pdbox/SOURCES +++ b/apps/plugins/pdbox/SOURCES @@ -1,17 +1,18 @@ pdbox.c pdbox-net.c +pdbox-func.c dbestfit-3.3/bmalloc.c dbestfit-3.3/bysize.c dbestfit-3.3/dmalloc.c -/* +PDa/src/s_audio_rockbox.c + + PDa/src/g_canvas.c PDa/src/g_graph.c PDa/src/g_text.c -*/ -/* PDa/src/g_rtext.c Does not compile */ -/* +PDa/src/g_rtext.c PDa/src/g_array.c PDa/src/g_template.c PDa/src/g_io.c @@ -34,27 +35,25 @@ PDa/src/m_pd.c PDa/src/m_class.c PDa/src/m_obj.c PDa/src/m_atom.c -*/ PDa/src/m_memory.c -/* PDa/src/m_binbuf.c Does not compile, file handling stuff */ -/* +PDa/src/m_binbuf.c PDa/src/m_conf.c PDa/src/m_glob.c PDa/src/m_sched.c -*/ /* PDa/src/s_main.c Does not compile, system reasons */ /* PDa/src/s_inter.c Does not compile, BSD sockets */ -/* PDa/src/s_file.c Does not compile, file handling stuff */ +PDa/src/s_file.c PDa/src/s_print.c -/* PDa/src/s_loader.c -*/ -/* PDa/src/s_path.c Does not compile, file handling stuff */ +PDa/src/s_path.c /* PDa/src/s_entry.c +*/ PDa/src/s_audio.c +/* PDa/src/s_midi.c +*/ PDa/src/d_ugen.c PDa/src/d_arithmetic.c PDa/src/d_dac.c @@ -65,35 +64,30 @@ PDa/src/d_fftroutine.c PDa/src/d_global.c PDa/src/d_resample.c PDa/src/d_ctl.c -*/ -/* PDa/src/d_soundfile.c Does not compile, file handling stuff */ -/* +PDa/src/d_soundfile.c PDa/src/x_arithmetic.c PDa/src/x_connective.c PDa/src/x_interface.c +/* PDa/src/x_midi.c +*/ PDa/src/x_misc.c PDa/src/x_time.c PDa/src/x_acoustics.c -*/ -/* PDa/src/x_net.c Does not compile, BSD sockets */ -/* +PDa/src/x_net.c PDa/src/x_qlist.c +/* PDa/src/x_gui.c */ -/* PDa/src/d_imayer_fft.c -*/ -/* PDa/src/m_fixed.c -*/ -/* PDa/intern/biquad~.c PDa/intern/bp~.c PDa/intern/clip~.c PDa/intern/cos~.c +PDa/intern/cos_table.c PDa/intern/dbtopow~.c PDa/intern/dbtorms~.c PDa/intern/delread~.c @@ -113,11 +107,11 @@ PDa/intern/print~.c PDa/intern/rmstodb~.c PDa/intern/rsqrt~.c PDa/intern/samphold~.c -*/ -/* PDa/intern/sfread~.c Does not compile, file handling stuff */ -/* PDa/intern/sfwrite~.c Does not compile, file handling stuff */ +PDa/intern/sfread~.c +PDa/intern/sfwrite~.c /* PDa/intern/sig~.c +*/ PDa/intern/snapshot~.c PDa/intern/sqrt~.c PDa/intern/tabosc4~.c @@ -135,14 +129,10 @@ PDa/intern/vd~.c PDa/intern/vline~.c PDa/intern/vsnapshot~.c PDa/intern/wrap~.c -*/ -/* PDa/extra/OSCroute.c PDa/extra/bandpass.c -*/ /* PDa/extra/dumpOSC.c Does not compile, file handling stuff */ -/* PDa/extra/equalizer.c PDa/extra/gcanvas.c PDa/extra/highpass.c @@ -153,12 +143,10 @@ PDa/extra/lowpass.c PDa/extra/lowshelf.c PDa/extra/moog~.c PDa/extra/notch.c -*/ /* PDa/extra/sendOSC.c Does not compile, file handling stuff */ /* PDa/extra/shell.c PDa/extra/slider.c PDa/extra/sliderh.c -PDa/extra/zerox~.c */ - +PDa/extra/zerox~.c diff --git a/apps/plugins/pdbox/dbestfit-3.3/dmalloc.c b/apps/plugins/pdbox/dbestfit-3.3/dmalloc.c index bfc6bdb356..b46d4af926 100644 --- a/apps/plugins/pdbox/dbestfit-3.3/dmalloc.c +++ b/apps/plugins/pdbox/dbestfit-3.3/dmalloc.c @@ -26,6 +26,7 @@ #ifdef ROCKBOX #include "plugin.h" #define memset rb->memset +#define memcpy rb->memcpy #else /* ROCKBOX */ #include #include diff --git a/apps/plugins/pdbox/math.h b/apps/plugins/pdbox/math.h new file mode 100644 index 0000000000..dc0e25b1e4 --- /dev/null +++ b/apps/plugins/pdbox/math.h @@ -0,0 +1,59 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2009 Wincent Balin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +/* Everything taken from -- W.B. */ + +#ifndef MATH_H +#define MATH_H + +/* Useful constants. */ +# define M_E 2.7182818284590452354 /* e */ +# define M_LOG2E 1.4426950408889634074 /* log_2 e */ +# define M_LOG10E 0.43429448190325182765 /* log_10 e */ +# define M_LN2 0.69314718055994530942 /* log_e 2 */ +# define M_LN10 2.30258509299404568402 /* log_e 10 */ +# define M_PI 3.14159265358979323846 /* pi */ +# define M_PI_2 1.57079632679489661923 /* pi/2 */ +# define M_PI_4 0.78539816339744830962 /* pi/4 */ +# define M_1_PI 0.31830988618379067154 /* 1/pi */ +# define M_2_PI 0.63661977236758134308 /* 2/pi */ +# define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */ +# define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ +# define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ + + +# define M_El 2.7182818284590452353602874713526625L /* e */ +# define M_LOG2El 1.4426950408889634073599246810018921L /* log_2 e */ +# define M_LOG10El 0.4342944819032518276511289189166051L /* log_10 e */ +# define M_LN2l 0.6931471805599453094172321214581766L /* log_e 2 */ +# define M_LN10l 2.3025850929940456840179914546843642L /* log_e 10 */ +# define M_PIl 3.1415926535897932384626433832795029L /* pi */ +# define M_PI_2l 1.5707963267948966192313216916397514L /* pi/2 */ +# define M_PI_4l 0.7853981633974483096156608458198757L /* pi/4 */ +# define M_1_PIl 0.3183098861837906715377675267450287L /* 1/pi */ +# define M_2_PIl 0.6366197723675813430755350534900574L /* 2/pi */ +# define M_2_SQRTPIl 1.1283791670955125738961589031215452L /* 2/sqrt(pi) */ +# define M_SQRT2l 1.4142135623730950488016887242096981L /* sqrt(2) */ +# define M_SQRT1_2l 0.7071067811865475244008443621048490L /* 1/sqrt(2) */ + + + +#endif /* MATH_H */ diff --git a/apps/plugins/pdbox/pdbox-func.c b/apps/plugins/pdbox/pdbox-func.c new file mode 100644 index 0000000000..ee4a8fd166 --- /dev/null +++ b/apps/plugins/pdbox/pdbox-func.c @@ -0,0 +1,2428 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id$ + * + * Copyright (C) 2009 Wincent Balin + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ****************************************************************************/ + +#include "plugin.h" +#include "pdbox.h" +#include "ctype.h" + +#include "m_pd.h" +#include "s_stuff.h" + + +/* This implementation of strncat is taken from lua plug-in. */ + +/* gcc is broken and has a non-SUSv2 compliant internal prototype. + * This causes it to warn about a type mismatch here. Ignore it. */ +char *rb_strncat(char *s, const char *t, size_t n) +{ + char *dest = s; + register char *max; + s += strlen(s); + + if((max = s + n) == s) + goto strncat_fini; + + while(true) + { + if(!(*s = *t)) + break; + if(++s == max) + break; + ++t; + +#ifndef WANT_SMALL_STRING_ROUTINES + if(!(*s = *t)) + break; + if(++s == max) + break; + ++t; + if(!(*s = *t)) + break; + if(++s == max) + break; + ++t; + if(!(*s = *t)) + break; + if(++s == max) + break; + ++t; +#endif + } + + *s = 0; + +strncat_fini: + return dest; +} + + +/* Implementation of floor, original. */ +float rb_floor(float value) +{ + /* If value is negative, decrement value to match function's definition. */ + if(value < 0.0) + { + value -= 1.0; + } + + /* Truncate fractional part (convert to integer) + and afterwards convert back to double. */ + return (float) ((int) value); +} + + +/* Implementation of strtod() and atof(), + taken from SanOS (http://www.jbox.dk/sanos/). */ +static int rb_errno = 0; + +double rb_strtod(const char *str, char **endptr) +{ + double number; + int exponent; + int negative; + char *p = (char *) str; + double p10; + int n; + int num_digits; + int num_decimals; + + /* Reset Rockbox errno -- W.B. */ +#ifdef ROCKBOX + rb_errno = 0; +#endif + + // Skip leading whitespace + while (isspace(*p)) p++; + + // Handle optional sign + negative = 0; + switch (*p) + { + case '-': negative = 1; // Fall through to increment position + case '+': p++; + } + + number = 0.; + exponent = 0; + num_digits = 0; + num_decimals = 0; + + // Process string of digits + while (isdigit(*p)) + { + number = number * 10. + (*p - '0'); + p++; + num_digits++; + } + + // Process decimal part + if (*p == '.') + { + p++; + + while (isdigit(*p)) + { + number = number * 10. + (*p - '0'); + p++; + num_digits++; + num_decimals++; + } + + exponent -= num_decimals; + } + + if (num_digits == 0) + { +#ifdef ROCKBOX + rb_errno = 1; +#else + errno = ERANGE; +#endif + return 0.0; + } + + // Correct for sign + if (negative) number = -number; + + // Process an exponent string + if (*p == 'e' || *p == 'E') + { + // Handle optional sign + negative = 0; + switch(*++p) + { + case '-': negative = 1; // Fall through to increment pos + case '+': p++; + } + + // Process string of digits + n = 0; + while (isdigit(*p)) + { + n = n * 10 + (*p - '0'); + p++; + } + + if (negative) + exponent -= n; + else + exponent += n; + } + +#ifndef ROCKBOX + if (exponent < DBL_MIN_EXP || exponent > DBL_MAX_EXP) + { + errno = ERANGE; + return HUGE_VAL; + } +#endif + + // Scale the result + p10 = 10.; + n = exponent; + if (n < 0) n = -n; + while (n) + { + if (n & 1) + { + if (exponent < 0) + number /= p10; + else + number *= p10; + } + n >>= 1; + p10 *= p10; + } + +#ifndef ROCKBOX + if (number == HUGE_VAL) errno = ERANGE; +#endif + if (endptr) *endptr = p; + + return number; +} + +double rb_atof(const char *str) +{ + return rb_strtod(str, NULL); +} + + +/* Implementation of ftoa(), original. */ +void rb_ftoan(float f, char* out, int size) +{ + #define SBUFSIZE 12 + char sbuf[SBUFSIZE]; + + /* Zero out string. */ + *out = '\0'; + size--; + + /* Handle negative numbers. */ + if(f < 0.0) + { + f = -f; + strcat(out, "-"); + size--; + } + + /* Find and convert integer part. */ + int int_part = (int) f; + snprintf(sbuf, SBUFSIZE-1, "%d", int_part); + int int_part_len = strlen(sbuf); + if(size < int_part_len) + return; + + /* Append integral part to output string. */ + strcat(out, sbuf); + size -= int_part_len; + + /* Check whether further content is possible. */ + if(size <= 0) + return; + + /* Append decimal point. */ + strcat(out, "."); + size--; + + /* Calculate first rest and convert it. */ + float rest1 = (f - (float) int_part) * 1000000000.0; + int irest1 = (int) rest1; + snprintf(sbuf, SBUFSIZE-1, "%09d", irest1); + + /* Append first rest to output string. */ + int rest1_len = strlen(sbuf); + int rest1_minlen = MIN(size, rest1_len); + strncat(out, sbuf, rest1_minlen); + size -= rest1_minlen; + + /* Check whether output string still has enough space. */ + if(size <= 0) + return; + + /* Calculate second rest and convert it. */ + float rest2 = (rest1 - (float) irest1) * 1000000000.0; + int irest2 = (int) rest2; + snprintf(sbuf, SBUFSIZE-1, "%09d", irest2); + + /* Append second rest to the output string. */ + int rest2_len = strlen(sbuf); + int rest2_minlen = MIN(size, rest2_len); + strncat(out, sbuf, rest2_minlen); +} + + +/* Implementation of atol(), adapted from + the atoi() implementation in Rockbox. */ +long rb_atol(const char* str) +{ + long value = 0L; + long sign = 1L; + + while (isspace(*str)) + { + str++; + } + + if ('-' == *str) + { + sign = -1L; + str++; + } + else if ('+' == *str) + { + str++; + } + + while ('0' == *str) + { + str++; + } + + while (isdigit(*str)) + { + value = (value * 10L) + (*str - '0'); + str++; + } + + return value * sign; +} + + +/* Implementation of sin() and cos(), + adapted from http://lab.polygonal.de/2007/07/18/fast-and-accurate-sinecosine-approximation/ +*/ + +float rb_sin(float rad) +{ + /* Trim input value to -PI..PI interval. */ + if(rad < -3.14159265) + rad += 6.28318531; + else if(rad > 3.14159265) + rad -= 6.28318531; + + if(rad < 0) + return (1.27323954 * rad + 0.405284735 * rad * rad); + else + return (1.27323954 * rad - 0.405284735 * rad * rad); +} + +float rb_cos(float rad) +{ + /* Compute cosine: sin(x + PI/2) = cos(x) */ + rad += 1.57079632; + if(rad > 3.14159265) + rad -= 6.28318531; + + return rb_sin(rad); +} + + +/* Emulation of fscanf(fd, "%f", (float*) xxx); + Basically a reimplementation of rb_strtod() above. */ +int rb_fscanf_f(int fd, float* f) +{ + #define FSCANF_F_BUFSIZE 64 + char buf[FSCANF_F_BUFSIZE]; + + /* Read line from file. */ + int bytes_read = rb->read_line(fd, buf, FSCANF_F_BUFSIZE-1); + + /* Terminate string. */ + if(bytes_read >= FSCANF_F_BUFSIZE) + buf[FSCANF_F_BUFSIZE-1] = '\0'; + else + buf[bytes_read-1] = '\0'; + + /* Convert buffer to float. */ + *f = rb_atof(buf); + + /* If there was an error, no float was read. */ + if(rb_errno) + return 0; + + return 1; +} + +/* Emulation of fprintf(fd, "%f\n", (float*) xxx); */ +int rb_fprintf_f(int fd, float f) +{ + #define FPRINTF_F_BUFSIZE 64 + char buf[FPRINTF_F_BUFSIZE]; + const char* next_line = "\n"; + + /* Convert float to string. */ + rb_ftoan(f, buf, sizeof(buf)-1); + + /* Add next line character. */ + strcat(buf, next_line); + + /* Write string into file. */ + return write(fd, buf, strlen(buf)); +} + + +/* Natural logarithm. + Taken from glibc-2.8 */ +static const float +ln2_hi = 6.9313812256e-01, /* 0x3f317180 */ +ln2_lo = 9.0580006145e-06, /* 0x3717f7d1 */ +two25 = 3.355443200e+07, /* 0x4c000000 */ +Lg1 = 6.6666668653e-01, /* 3F2AAAAB */ +Lg2 = 4.0000000596e-01, /* 3ECCCCCD */ +Lg3 = 2.8571429849e-01, /* 3E924925 */ +Lg4 = 2.2222198546e-01, /* 3E638E29 */ +Lg5 = 1.8183572590e-01, /* 3E3A3325 */ +Lg6 = 1.5313838422e-01, /* 3E1CD04F */ +Lg7 = 1.4798198640e-01; /* 3E178897 */ + +static const float zero = 0.0; + +/* A union which permits us to convert between a float and a 32 bit + int. */ + +typedef union +{ + float value; + uint32_t word; +} ieee_float_shape_type; + +/* Get a 32 bit int from a float. */ + +#define GET_FLOAT_WORD(i,d) \ +do { \ + ieee_float_shape_type gf_u; \ + gf_u.value = (d); \ + (i) = gf_u.word; \ +} while (0) + +/* Set a float from a 32 bit int. */ + +#define SET_FLOAT_WORD(d,i) \ +do { \ + ieee_float_shape_type sf_u; \ + sf_u.word = (i); \ + (d) = sf_u.value; \ +} while (0) + + +float rb_log(float x) +{ + float hfsq, f, s, z, R, w, t1, t2, dk; + int32_t k, ix, i, j; + + GET_FLOAT_WORD(ix,x); + + k=0; + if (ix < 0x00800000) { /* x < 2**-126 */ + if ((ix&0x7fffffff)==0) + return -two25/(x-x); /* log(+-0)=-inf */ + if (ix<0) return (x-x)/(x-x); /* log(-#) = NaN */ + k -= 25; x *= two25; /* subnormal number, scale up x */ + GET_FLOAT_WORD(ix,x); + } + if (ix >= 0x7f800000) return x+x; + k += (ix>>23)-127; + ix &= 0x007fffff; + i = (ix+(0x95f64<<3))&0x800000; + SET_FLOAT_WORD(x,ix|(i^0x3f800000)); /* normalize x or x/2 */ + k += (i>>23); + f = x-(float)1.0; + if((0x007fffff&(15+ix))<16) { /* |f| < 2**-20 */ + if(f==zero) { + if(k==0) + return zero; + else + { + dk=(float)k; + return dk*ln2_hi+dk*ln2_lo; + } + } + R = f*f*((float)0.5-(float)0.33333333333333333*f); + if(k==0) + return f-R; + else + { + dk=(float)k; + return dk*ln2_hi-((R-dk*ln2_lo)-f); + } + } + s = f/((float)2.0+f); + dk = (float)k; + z = s*s; + i = ix-(0x6147a<<3); + w = z*z; + j = (0x6b851<<3)-ix; + t1= w*(Lg2+w*(Lg4+w*Lg6)); + t2= z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7))); + i |= j; + R = t2+t1; + if(i>0) { + hfsq=(float)0.5*f*f; + if(k==0) + return f-(hfsq-s*(hfsq+R)); + else + return dk*ln2_hi-((hfsq-(s*(hfsq+R)+dk*ln2_lo))-f); + } else { + if(k==0) + return f-s*(f-R); + else + return dk*ln2_hi-((s*(f-R)-dk*ln2_lo)-f); + } +} + + +/* Logarithm for 10th base, + taken from glibc-2.8 */ + +static const float +ivln10 = 4.3429449201e-01, /* 0x3ede5bd9 */ +log10_2hi = 3.0102920532e-01, /* 0x3e9a2080 */ +log10_2lo = 7.9034151668e-07; /* 0x355427db */ + +float rb_log10(float x) +{ + float y,z; + int32_t i,k,hx; + + GET_FLOAT_WORD(hx,x); + + k=0; + if (hx < 0x00800000) { /* x < 2**-126 */ + if ((hx&0x7fffffff)==0) + return -two25/(x-x); /* log(+-0)=-inf */ + if (hx<0) return (x-x)/(x-x); /* log(-#) = NaN */ + k -= 25; x *= two25; /* subnormal number, scale up x */ + GET_FLOAT_WORD(hx,x); + } + if (hx >= 0x7f800000) return x+x; + k += (hx>>23)-127; + i = ((uint32_t)k&0x80000000)>>31; + hx = (hx&0x007fffff)|((0x7f-i)<<23); + y = (float)(k+i); + SET_FLOAT_WORD(x,hx); + z = y*log10_2lo + ivln10*rb_log(x); + return z+y*log10_2hi; +} + + +/* Power function, + Taken from glibc-2.8 */ + +int rb_isinf(float x) +{ + int32_t ix, t; + GET_FLOAT_WORD(ix,x); + t = ix & 0x7fffffff; + t ^= 0x7f800000; + t |= -t; + return ~(t >> 31) & (ix >> 30); +} + +float rb_copysignf(float x, float y) +{ + uint32_t ix, iy; + GET_FLOAT_WORD(ix,x); + GET_FLOAT_WORD(iy,y); + SET_FLOAT_WORD(x,(ix&0x7fffffff)|(iy&0x80000000)); + return x; +} + +static const float +huge = 1.0e+30, +tiny = 1.0e-30, +twom25 = 2.9802322388e-08; /* 0x33000000 */ + +float rb_scalbnf(float x, int n) +{ + int32_t k, ix; + GET_FLOAT_WORD(ix,x); + k = (ix&0x7f800000)>>23; /* extract exponent */ + if (k==0) { /* 0 or subnormal x */ + if ((ix&0x7fffffff)==0) return x; /* +-0 */ + x *= two25; + GET_FLOAT_WORD(ix,x); + k = ((ix&0x7f800000)>>23) - 25; + } + if (k==0xff) return x+x; /* NaN or Inf */ + k = k+n; + if (n> 50000 || k > 0xfe) + return huge*rb_copysignf(huge,x); /* overflow */ + if (n< -50000) + return tiny*rb_copysignf(tiny,x); /*underflow*/ + if (k > 0) /* normal result */ + {SET_FLOAT_WORD(x,(ix&0x807fffff)|(k<<23)); return x;} + if (k <= -25) + return tiny*rb_copysignf(tiny,x); /*underflow*/ + k += 25; /* subnormal result */ + SET_FLOAT_WORD(x,(ix&0x807fffff)|(k<<23)); + return x*twom25; +} + + +static const float +bp[] = {1.0, 1.5,}, +dp_h[] = { 0.0, 5.84960938e-01,}, /* 0x3f15c000 */ +dp_l[] = { 0.0, 1.56322085e-06,}, /* 0x35d1cfdc */ +one = 1.0, +two = 2.0, +two24 = 16777216.0, /* 0x4b800000 */ + /* poly coefs for (3/2)*(log(x)-2s-2/3*s**3 */ +L1 = 6.0000002384e-01, /* 0x3f19999a */ +L2 = 4.2857143283e-01, /* 0x3edb6db7 */ +L3 = 3.3333334327e-01, /* 0x3eaaaaab */ +L4 = 2.7272811532e-01, /* 0x3e8ba305 */ +L5 = 2.3066075146e-01, /* 0x3e6c3255 */ +L6 = 2.0697501302e-01, /* 0x3e53f142 */ +P1 = 1.6666667163e-01, /* 0x3e2aaaab */ +P2 = -2.7777778450e-03, /* 0xbb360b61 */ +P3 = 6.6137559770e-05, /* 0x388ab355 */ +P4 = -1.6533901999e-06, /* 0xb5ddea0e */ +P5 = 4.1381369442e-08; /* 0x3331bb4c */ + +static const float +lg2 = 6.9314718246e-01, /* 0x3f317218 */ +lg2_h = 6.93145752e-01, /* 0x3f317200 */ +lg2_l = 1.42860654e-06, /* 0x35bfbe8c */ +ovt = 4.2995665694e-08, /* -(128-log2(ovfl+.5ulp)) */ +cp = 9.6179670095e-01, /* 0x3f76384f =2/(3ln2) */ +cp_h = 9.6179199219e-01, /* 0x3f763800 =head of cp */ +cp_l = 4.7017383622e-06, /* 0x369dc3a0 =tail of cp_h */ +ivln2 = 1.4426950216e+00, /* 0x3fb8aa3b =1/ln2 */ +ivln2_h = 1.4426879883e+00, /* 0x3fb8aa00 =16b 1/ln2*/ +ivln2_l = 7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/ + +float rb_pow(float x, float y) +{ + float z, ax, z_h, z_l, p_h, p_l; + float y1, t1, t2, r, s, t, u, v, w; + int32_t i, j, k, yisint, n; + int32_t hx, hy, ix, iy, is; + + GET_FLOAT_WORD(hx,x); + GET_FLOAT_WORD(hy,y); + ix = hx&0x7fffffff; + iy = hy&0x7fffffff; + + /* y==zero: x**0 = 1 */ + if(iy==0) return one; + + /* x==+-1 */ + if(x == 1.0) return one; + if(x == -1.0 && rb_isinf(y)) return one; + + /* +-NaN return x+y */ + if(ix > 0x7f800000 || iy > 0x7f800000) + return x+y; + + /* determine if y is an odd int when x < 0 + * yisint = 0 ... y is not an integer + * yisint = 1 ... y is an odd int + * yisint = 2 ... y is an even int + */ + yisint = 0; + if(hx<0) { + if(iy>=0x4b800000) yisint = 2; /* even integer y */ + else if(iy>=0x3f800000) { + k = (iy>>23)-0x7f; /* exponent */ + j = iy>>(23-k); + if((j<<(23-k))==iy) yisint = 2-(j&1); + } + } + + /* special value of y */ + if (iy==0x7f800000) { /* y is +-inf */ + if (ix==0x3f800000) + return y - y; /* inf**+-1 is NaN */ + else if (ix > 0x3f800000)/* (|x|>1)**+-inf = inf,0 */ + return (hy>=0)? y: zero; + else /* (|x|<1)**-,+inf = inf,0 */ + return (hy<0)?-y: zero; + } + if(iy==0x3f800000) { /* y is +-1 */ + if(hy<0) return one/x; else return x; + } + if(hy==0x40000000) return x*x; /* y is 2 */ + if(hy==0x3f000000) { /* y is 0.5 */ + if(hx>=0) /* x >= +0 */ + return rb_sqrt(x); + } + + ax = rb_fabs(x); + /* special value of x */ + if(ix==0x7f800000||ix==0||ix==0x3f800000){ + z = ax; /*x is +-0,+-inf,+-1*/ + if(hy<0) z = one/z; /* z = (1/|x|) */ + if(hx<0) { + if(((ix-0x3f800000)|yisint)==0) { + z = (z-z)/(z-z); /* (-1)**non-int is NaN */ + } else if(yisint==1) + z = -z; /* (x<0)**odd = -(|x|**odd) */ + } + return z; + } + + /* (x<0)**(non-int) is NaN */ + if(((((uint32_t)hx>>31)-1)|yisint)==0) return (x-x)/(x-x); + + /* |y| is huge */ + if(iy>0x4d000000) { /* if |y| > 2**27 */ + /* over/underflow if x is not close to one */ + if(ix<0x3f7ffff8) return (hy<0)? huge*huge:tiny*tiny; + if(ix>0x3f800007) return (hy>0)? huge*huge:tiny*tiny; + /* now |1-x| is tiny <= 2**-20, suffice to compute + log(x) by x-x^2/2+x^3/3-x^4/4 */ + t = x-1; /* t has 20 trailing zeros */ + w = (t*t)*((float)0.5-t*((float)0.333333333333-t*(float)0.25)); + u = ivln2_h*t; /* ivln2_h has 16 sig. bits */ + v = t*ivln2_l-w*ivln2; + t1 = u+v; + GET_FLOAT_WORD(is,t1); + SET_FLOAT_WORD(t1,is&0xfffff000); + t2 = v-(t1-u); + } else { + float s2, s_h, s_l, t_h, t_l; + n = 0; + /* take care subnormal number */ + if(ix<0x00800000) + {ax *= two24; n -= 24; GET_FLOAT_WORD(ix,ax); } + n += ((ix)>>23)-0x7f; + j = ix&0x007fffff; + /* determine interval */ + ix = j|0x3f800000; /* normalize ix */ + if(j<=0x1cc471) k=0; /* |x|>1)|0x20000000)+0x0040000+(k<<21)); + t_l = ax - (t_h-bp[k]); + s_l = v*((u-s_h*t_h)-s_h*t_l); + /* compute log(ax) */ + s2 = s*s; + r = s2*s2*(L1+s2*(L2+s2*(L3+s2*(L4+s2*(L5+s2*L6))))); + r += s_l*(s_h+s); + s2 = s_h*s_h; + t_h = (float)3.0+s2+r; + GET_FLOAT_WORD(is,t_h); + SET_FLOAT_WORD(t_h,is&0xfffff000); + t_l = r-((t_h-(float)3.0)-s2); + /* u+v = s*(1+...) */ + u = s_h*t_h; + v = s_l*t_h+t_l*s; + /* 2/(3log2)*(s+...) */ + p_h = u+v; + GET_FLOAT_WORD(is,p_h); + SET_FLOAT_WORD(p_h,is&0xfffff000); + p_l = v-(p_h-u); + z_h = cp_h*p_h; /* cp_h+cp_l = 2/(3*log2) */ + z_l = cp_l*p_h+p_l*cp+dp_l[k]; + /* log2(ax) = (s+..)*2/(3*log2) = n + dp_h + z_h + z_l */ + t = (float)n; + t1 = (((z_h+z_l)+dp_h[k])+t); + GET_FLOAT_WORD(is,t1); + SET_FLOAT_WORD(t1,is&0xfffff000); + t2 = z_l-(((t1-t)-dp_h[k])-z_h); + } + + s = one; /* s (sign of result -ve**odd) = -1 else = 1 */ + if(((((uint32_t)hx>>31)-1)|(yisint-1))==0) + s = -one; /* (-ve)**(odd int) */ + + /* split up y into y1+y2 and compute (y1+y2)*(t1+t2) */ + GET_FLOAT_WORD(is,y); + SET_FLOAT_WORD(y1,is&0xfffff000); + p_l = (y-y1)*t1+y*t2; + p_h = y1*t1; + z = p_l+p_h; + GET_FLOAT_WORD(j,z); + if (j>0x43000000) /* if z > 128 */ + return s*huge*huge; /* overflow */ + else if (j==0x43000000) { /* if z == 128 */ + if(p_l+ovt>z-p_h) return s*huge*huge; /* overflow */ + } + else if ((j&0x7fffffff)>0x43160000) /* z <= -150 */ + return s*tiny*tiny; /* underflow */ + else if ((uint32_t) j==0xc3160000){ /* z == -150 */ + if(p_l<=z-p_h) return s*tiny*tiny; /* underflow */ + } + /* + * compute 2**(p_h+p_l) + */ + i = j&0x7fffffff; + k = (i>>23)-0x7f; + n = 0; + if(i>0x3f000000) { /* if |z| > 0.5, set n = [z+0.5] */ + n = j+(0x00800000>>(k+1)); + k = ((n&0x7fffffff)>>23)-0x7f; /* new k for n */ + SET_FLOAT_WORD(t,n&~(0x007fffff>>k)); + n = ((n&0x007fffff)|0x00800000)>>(23-k); + if(j<0) n = -n; + p_h -= t; + } + t = p_l+p_h; + GET_FLOAT_WORD(is,t); + SET_FLOAT_WORD(t,is&0xfffff000); + u = t*lg2_h; + v = (p_l-(t-p_h))*lg2+t*lg2_l; + z = u+v; + w = v-(z-u); + t = z*z; + t1 = z - t*(P1+t*(P2+t*(P3+t*(P4+t*P5)))); + r = (z*t1)/(t1-two)-(w+z*w); + z = one-(r-z); + GET_FLOAT_WORD(j,z); + j += (n<<23); + if((j>>23)<=0) z = rb_scalbnf(z,n); /* subnormal output */ + else SET_FLOAT_WORD(z,j); + return s*z; +} + + + +/* Square root function, original. */ +float rb_sqrt(float x) +{ + float z; + int32_t sign = (int)0x80000000; + int32_t ix,s,q,m,t,i; + uint32_t r; + + GET_FLOAT_WORD(ix,x); + + /* take care of Inf and NaN */ + if((ix&0x7f800000)==0x7f800000) { + return x*x+x; /* sqrt(NaN)=NaN, sqrt(+inf)=+inf + sqrt(-inf)=sNaN */ + } + /* take care of zero */ + if(ix<=0) { + if((ix&(~sign))==0) return x;/* sqrt(+-0) = +-0 */ + else if(ix<0) + return (x-x)/(x-x); /* sqrt(-ve) = sNaN */ + } + /* normalize x */ + m = (ix>>23); + if(m==0) { /* subnormal x */ + for(i=0;(ix&0x00800000)==0;i++) ix<<=1; + m -= i-1; + } + m -= 127; /* unbias exponent */ + ix = (ix&0x007fffff)|0x00800000; + if(m&1) /* odd m, double x to make it even */ + ix += ix; + m >>= 1; /* m = [m/2] */ + + /* generate sqrt(x) bit by bit */ + ix += ix; + q = s = 0; /* q = sqrt(x) */ + r = 0x01000000; /* r = moving bit from right to left */ + + while(r!=0) { + t = s+r; + if(t<=ix) { + s = t+r; + ix -= t; + q += r; + } + ix += ix; + r>>=1; + } + + /* use floating add to find out rounding direction */ + if(ix!=0) { + z = one-tiny; /* trigger inexact flag */ + if (z>=one) { + z = one+tiny; + if (z>one) + q += 2; + else + q += (q&1); + } + } + ix = (q>>1)+0x3f000000; + ix += (m <<23); + SET_FLOAT_WORD(z,ix); + return z; +} + +/* Absolute value, + taken from glibc-2.8 */ +float rb_fabs(float x) +{ + uint32_t ix; + GET_FLOAT_WORD(ix,x); + SET_FLOAT_WORD(x,ix&0x7fffffff); + return x; +} + +/* Arc tangent, + taken from glibc-2.8. */ + +static const float atanhi[] = { + 4.6364760399e-01, /* atan(0.5)hi 0x3eed6338 */ + 7.8539812565e-01, /* atan(1.0)hi 0x3f490fda */ + 9.8279368877e-01, /* atan(1.5)hi 0x3f7b985e */ + 1.5707962513e+00, /* atan(inf)hi 0x3fc90fda */ +}; + +static const float atanlo[] = { + 5.0121582440e-09, /* atan(0.5)lo 0x31ac3769 */ + 3.7748947079e-08, /* atan(1.0)lo 0x33222168 */ + 3.4473217170e-08, /* atan(1.5)lo 0x33140fb4 */ + 7.5497894159e-08, /* atan(inf)lo 0x33a22168 */ +}; + +static const float aT[] = { + 3.3333334327e-01, /* 0x3eaaaaaa */ + -2.0000000298e-01, /* 0xbe4ccccd */ + 1.4285714924e-01, /* 0x3e124925 */ + -1.1111110449e-01, /* 0xbde38e38 */ + 9.0908870101e-02, /* 0x3dba2e6e */ + -7.6918758452e-02, /* 0xbd9d8795 */ + 6.6610731184e-02, /* 0x3d886b35 */ + -5.8335702866e-02, /* 0xbd6ef16b */ + 4.9768779427e-02, /* 0x3d4bda59 */ + -3.6531571299e-02, /* 0xbd15a221 */ + 1.6285819933e-02, /* 0x3c8569d7 */ +}; + + +float rb_atan(float x) +{ + float w,s1,s2,z; + int32_t ix,hx,id; + + GET_FLOAT_WORD(hx,x); + ix = hx&0x7fffffff; + if(ix>=0x50800000) { /* if |x| >= 2^34 */ + if(ix>0x7f800000) + return x+x; /* NaN */ + if(hx>0) return atanhi[3]+atanlo[3]; + else return -atanhi[3]-atanlo[3]; + } if (ix < 0x3ee00000) { /* |x| < 0.4375 */ + if (ix < 0x31000000) { /* |x| < 2^-29 */ + if(huge+x>one) return x; /* raise inexact */ + } + id = -1; + } else { + x = rb_fabs(x); + if (ix < 0x3f980000) { /* |x| < 1.1875 */ + if (ix < 0x3f300000) { /* 7/16 <=|x|<11/16 */ + id = 0; x = ((float)2.0*x-one)/((float)2.0+x); + } else { /* 11/16<=|x|< 19/16 */ + id = 1; x = (x-one)/(x+one); + } + } else { + if (ix < 0x401c0000) { /* |x| < 2.4375 */ + id = 2; x = (x-(float)1.5)/(one+(float)1.5*x); + } else { /* 2.4375 <= |x| < 2^66 */ + id = 3; x = -(float)1.0/x; + } + }} + /* end of argument reduction */ + z = x*x; + w = z*z; + /* break sum from i=0 to 10 aT[i]z**(i+1) into odd and even poly */ + s1 = z*(aT[0]+w*(aT[2]+w*(aT[4]+w*(aT[6]+w*(aT[8]+w*aT[10]))))); + s2 = w*(aT[1]+w*(aT[3]+w*(aT[5]+w*(aT[7]+w*aT[9])))); + if (id<0) return x - x*(s1+s2); + else { + z = atanhi[id] - ((x*(s1+s2) - atanlo[id]) - x); + return (hx<0)? -z:z; + } +} + +/* Arc tangent from two variables, original. */ + +static const float +pi_o_4 = 7.8539818525e-01, /* 0x3f490fdb */ +pi_o_2 = 1.5707963705e+00, /* 0x3fc90fdb */ +pi = 3.1415927410e+00, /* 0x40490fdb */ +pi_lo = -8.7422776573e-08; /* 0xb3bbbd2e */ + +float rb_atan2(float x, float y) +{ + float z; + int32_t k,m,hx,hy,ix,iy; + + GET_FLOAT_WORD(hx,x); + ix = hx&0x7fffffff; + GET_FLOAT_WORD(hy,y); + iy = hy&0x7fffffff; + if((ix>0x7f800000)|| + (iy>0x7f800000)) /* x or y is NaN */ + return x+y; + if(hx==0x3f800000) return rb_atan(y); /* x=1.0 */ + m = ((hy>>31)&1)|((hx>>30)&2); /* 2*sign(x)+sign(y) */ + + /* when y = 0 */ + if(iy==0) { + switch(m) { + case 0: + case 1: return y; /* atan(+-0,+anything)=+-0 */ + case 2: return pi+tiny;/* atan(+0,-anything) = pi */ + case 3: return -pi-tiny;/* atan(-0,-anything) =-pi */ + } + } + /* when x = 0 */ + if(ix==0) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny; + + /* when x is INF */ + if(ix==0x7f800000) { + if(iy==0x7f800000) { + switch(m) { + case 0: return pi_o_4+tiny;/* atan(+INF,+INF) */ + case 1: return -pi_o_4-tiny;/* atan(-INF,+INF) */ + case 2: return (float)3.0*pi_o_4+tiny;/*atan(+INF,-INF)*/ + case 3: return (float)-3.0*pi_o_4-tiny;/*atan(-INF,-INF)*/ + } + } else { + switch(m) { + case 0: return zero ; /* atan(+...,+INF) */ + case 1: return -zero ; /* atan(-...,+INF) */ + case 2: return pi+tiny ; /* atan(+...,-INF) */ + case 3: return -pi-tiny ; /* atan(-...,-INF) */ + } + } + } + /* when y is INF */ + if(iy==0x7f800000) return (hy<0)? -pi_o_2-tiny: pi_o_2+tiny; + + /* compute y/x */ + k = (iy-ix)>>23; + if(k > 60) z=pi_o_2+(float)0.5*pi_lo; /* |y/x| > 2**60 */ + else if(hx<0&&k<-60) z=0.0; /* |y|/x < -2**60 */ + else z=rb_atan(rb_fabs(y/x)); /* safe to do y/x */ + switch (m) { + case 0: return z ; /* atan(+,+) */ + case 1: { + uint32_t zh; + GET_FLOAT_WORD(zh,z); + SET_FLOAT_WORD(z,zh ^ 0x80000000); + } + return z ; /* atan(-,+) */ + case 2: return pi-(z-pi_lo);/* atan(+,-) */ + default: /* case 3 */ + return (z-pi_lo)-pi;/* atan(-,-) */ + } +} + + +/* Sine hyperbolic, + taken from glibc-2.8 */ + +static const float +o_threshold = 8.8721679688e+01,/* 0x42b17180 */ +invln2 = 1.4426950216e+00,/* 0x3fb8aa3b */ + /* scaled coefficients related to expm1 */ +Q1 = -3.3333335072e-02, /* 0xbd088889 */ +Q2 = 1.5873016091e-03, /* 0x3ad00d01 */ +Q3 = -7.9365076090e-05, /* 0xb8a670cd */ +Q4 = 4.0082177293e-06, /* 0x36867e54 */ +Q5 = -2.0109921195e-07; /* 0xb457edbb */ + +float rb_expm1(float x) +{ + float y,hi,lo,c=0,t,e,hxs,hfx,r1; + int32_t k,xsb; + uint32_t hx; + + GET_FLOAT_WORD(hx,x); + xsb = hx&0x80000000; /* sign bit of x */ + if(xsb==0) y=x; else y= -x; /* y = |x| */ + hx &= 0x7fffffff; /* high word of |x| */ + + /* filter out huge and non-finite argument */ + if(hx >= 0x4195b844) { /* if |x|>=27*ln2 */ + if(hx >= 0x42b17218) { /* if |x|>=88.721... */ + if(hx>0x7f800000) + return x+x; /* NaN */ + if(hx==0x7f800000) + return (xsb==0)? x:-1.0;/* exp(+-inf)={inf,-1} */ + if(x > o_threshold) return huge*huge; /* overflow */ + } + if(xsb!=0) { /* x < -27*ln2, return -1.0 with inexact */ + if(x+tiny<(float)0.0) /* raise inexact */ + return tiny-one; /* return -1 */ + } + } + + /* argument reduction */ + if(hx > 0x3eb17218) { /* if |x| > 0.5 ln2 */ + if(hx < 0x3F851592) { /* and |x| < 1.5 ln2 */ + if(xsb==0) + {hi = x - ln2_hi; lo = ln2_lo; k = 1;} + else + {hi = x + ln2_hi; lo = -ln2_lo; k = -1;} + } else { + k = invln2*x+((xsb==0)?(float)0.5:(float)-0.5); + t = k; + hi = x - t*ln2_hi; /* t*ln2_hi is exact here */ + lo = t*ln2_lo; + } + x = hi - lo; + c = (hi-x)-lo; + } + else if(hx < 0x33000000) { /* when |x|<2**-25, return x */ + t = huge+x; /* return x with inexact flags when x!=0 */ + return x - (t-(huge+x)); + } + else k = 0; + + /* x is now in primary range */ + hfx = (float)0.5*x; + hxs = x*hfx; + r1 = one+hxs*(Q1+hxs*(Q2+hxs*(Q3+hxs*(Q4+hxs*Q5)))); + t = (float)3.0-r1*hfx; + e = hxs*((r1-t)/((float)6.0 - x*t)); + if(k==0) return x - (x*e-hxs); /* c is 0 */ + else { + e = (x*(e-c)-c); + e -= hxs; + if(k== -1) return (float)0.5*(x-e)-(float)0.5; + if(k==1) { + if(x < (float)-0.25) return -(float)2.0*(e-(x+(float)0.5)); + else return one+(float)2.0*(x-e); + } + if (k <= -2 || k>56) { /* suffice to return exp(x)-1 */ + int32_t i; + y = one-(e-x); + GET_FLOAT_WORD(i,y); + SET_FLOAT_WORD(y,i+(k<<23)); /* add k to y's exponent */ + return y-one; + } + t = one; + if(k<23) { + int32_t i; + SET_FLOAT_WORD(t,0x3f800000 - (0x1000000>>k)); /* t=1-2^-k */ + y = t-(e-x); + GET_FLOAT_WORD(i,y); + SET_FLOAT_WORD(y,i+(k<<23)); /* add k to y's exponent */ + } else { + int32_t i; + SET_FLOAT_WORD(t,((0x7f-k)<<23)); /* 2^-k */ + y = x-(e+t); + y += one; + GET_FLOAT_WORD(i,y); + SET_FLOAT_WORD(y,i+(k<<23)); /* add k to y's exponent */ + } + } + return y; +} + +static const float shuge = 1.0e37; + +float rb_sinh(float x) +{ + float t,w,h; + int32_t ix,jx; + + GET_FLOAT_WORD(jx,x); + ix = jx&0x7fffffff; + + /* x is INF or NaN */ + if(ix>=0x7f800000) return x+x; + + h = 0.5; + if (jx<0) h = -h; + /* |x| in [0,22], return sign(x)*0.5*(E+E/(E+1))) */ + if (ix < 0x41b00000) { /* |x|<22 */ + if (ix<0x31800000) /* |x|<2**-28 */ + if(shuge+x>one) return x;/* sinh(tiny) = tiny with inexact */ + t = rb_expm1(rb_fabs(x)); + if(ix<0x3f800000) return h*((float)2.0*t-t*t/(t+one)); + return h*(t+t/(t+one)); + } + + /* |x| in [22, log(maxdouble)] return 0.5*exp(|x|) */ + if (ix < 0x42b17180) return h*rb_exp(rb_fabs(x)); + + /* |x| in [log(maxdouble), overflowthresold] */ + if (ix<=0x42b2d4fc) { + w = rb_exp((float)0.5*rb_fabs(x)); + t = h*w; + return t*w; + } + + /* |x| > overflowthresold, sinh(x) overflow */ + return x*shuge; +} + + +/* Tangent, + taken from glibc-2.8 */ + +static const float +pio4 = 7.8539812565e-01, /* 0x3f490fda */ +pio4lo= 3.7748947079e-08, /* 0x33222168 */ +T[] = { + 3.3333334327e-01, /* 0x3eaaaaab */ + 1.3333334029e-01, /* 0x3e088889 */ + 5.3968254477e-02, /* 0x3d5d0dd1 */ + 2.1869488060e-02, /* 0x3cb327a4 */ + 8.8632395491e-03, /* 0x3c11371f */ + 3.5920790397e-03, /* 0x3b6b6916 */ + 1.4562094584e-03, /* 0x3abede48 */ + 5.8804126456e-04, /* 0x3a1a26c8 */ + 2.4646313977e-04, /* 0x398137b9 */ + 7.8179444245e-05, /* 0x38a3f445 */ + 7.1407252108e-05, /* 0x3895c07a */ + -1.8558637748e-05, /* 0xb79bae5f */ + 2.5907305826e-05, /* 0x37d95384 */ +}; + +float kernel_tan(float x, float y, int iy) +{ + float z,r,v,w,s; + int32_t ix,hx; + GET_FLOAT_WORD(hx,x); + ix = hx&0x7fffffff; /* high word of |x| */ + if(ix<0x31800000) /* x < 2**-28 */ + {if((int)x==0) { /* generate inexact */ + if((ix|(iy+1))==0) return one/rb_fabs(x); + else return (iy==1)? x: -one/x; + } + } + if(ix>=0x3f2ca140) { /* |x|>=0.6744 */ + if(hx<0) {x = -x; y = -y;} + z = pio4-x; + w = pio4lo-y; + x = z+w; y = 0.0; + } + z = x*x; + w = z*z; + /* Break x^5*(T[1]+x^2*T[2]+...) into + * x^5(T[1]+x^4*T[3]+...+x^20*T[11]) + + * x^5(x^2*(T[2]+x^4*T[4]+...+x^22*[T12])) + */ + r = T[1]+w*(T[3]+w*(T[5]+w*(T[7]+w*(T[9]+w*T[11])))); + v = z*(T[2]+w*(T[4]+w*(T[6]+w*(T[8]+w*(T[10]+w*T[12]))))); + s = z*x; + r = y + z*(s*(r+v)+y); + r += T[0]*s; + w = x+r; + if(ix>=0x3f2ca140) { + v = (float)iy; + return (float)(1-((hx>>30)&2))*(v-(float)2.0*(x-(w*w/(w+v)-r))); + } + if(iy==1) return w; + else { /* if allow error up to 2 ulp, + simply return -1.0/(x+r) here */ + /* compute -1.0/(x+r) accurately */ + float a,t; + int32_t i; + z = w; + GET_FLOAT_WORD(i,z); + SET_FLOAT_WORD(z,i&0xfffff000); + v = r-(z - x); /* z+v = r+x */ + t = a = -(float)1.0/w; /* a = -1.0/w */ + GET_FLOAT_WORD(i,t); + SET_FLOAT_WORD(t,i&0xfffff000); + s = (float)1.0+t*z; + return t+a*(s+t*v); + } +} + + + +static const int init_jk[] = {4,7,9}; /* initial value for jk */ + +static const float PIo2[] = { + 1.5703125000e+00, /* 0x3fc90000 */ + 4.5776367188e-04, /* 0x39f00000 */ + 2.5987625122e-05, /* 0x37da0000 */ + 7.5437128544e-08, /* 0x33a20000 */ + 6.0026650317e-11, /* 0x2e840000 */ + 7.3896444519e-13, /* 0x2b500000 */ + 5.3845816694e-15, /* 0x27c20000 */ + 5.6378512969e-18, /* 0x22d00000 */ + 8.3009228831e-20, /* 0x1fc40000 */ + 3.2756352257e-22, /* 0x1bc60000 */ + 6.3331015649e-25, /* 0x17440000 */ +}; + +static const float +two8 = 2.5600000000e+02, /* 0x43800000 */ +twon8 = 3.9062500000e-03; /* 0x3b800000 */ + +int kernel_rem_pio2(float *x, float *y, int e0, int nx, int prec, const int32_t *ipio2) +{ + int32_t jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih; + float z,fw,f[20],fq[20],q[20]; + + /* initialize jk*/ + jk = init_jk[prec]; + jp = jk; + + /* determine jx,jv,q0, note that 3>q0 */ + jx = nx-1; + jv = (e0-3)/8; if(jv<0) jv=0; + q0 = e0-8*(jv+1); + + /* set up f[0] to f[jx+jk] where f[jx+jk] = ipio2[jv+jk] */ + j = jv-jx; m = jx+jk; + for(i=0;i<=m;i++,j++) f[i] = (j<0)? zero : (float) ipio2[j]; + + /* compute q[0],q[1],...q[jk] */ + for (i=0;i<=jk;i++) { + for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; q[i] = fw; + } + + jz = jk; +recompute: + /* distill q[] into iq[] reversingly */ + for(i=0,j=jz,z=q[jz];j>0;i++,j--) { + fw = (float)((int32_t)(twon8* z)); + iq[i] = (int32_t)(z-two8*fw); + z = q[j-1]+fw; + } + + /* compute n */ + z = rb_scalbnf(z,q0); /* actual value of z */ + z -= (float)8.0*rb_floor(z*(float)0.125); /* trim off integer >= 8 */ + n = (int32_t) z; + z -= (float)n; + ih = 0; + if(q0>0) { /* need iq[jz-1] to determine n */ + i = (iq[jz-1]>>(8-q0)); n += i; + iq[jz-1] -= i<<(8-q0); + ih = iq[jz-1]>>(7-q0); + } + else if(q0==0) ih = iq[jz-1]>>8; + else if(z>=(float)0.5) ih=2; + + if(ih>0) { /* q > 0.5 */ + n += 1; carry = 0; + for(i=0;i0) { /* rare case: chance is 1 in 12 */ + switch(q0) { + case 1: + iq[jz-1] &= 0x7f; break; + case 2: + iq[jz-1] &= 0x3f; break; + } + } + if(ih==2) { + z = one - z; + if(carry!=0) z -= rb_scalbnf(one,q0); + } + } + + /* check if recomputation is needed */ + if(z==zero) { + j = 0; + for (i=jz-1;i>=jk;i--) j |= iq[i]; + if(j==0) { /* need recomputation */ + for(k=1;iq[jk-k]==0;k++); /* k = no. of terms needed */ + + for(i=jz+1;i<=jz+k;i++) { /* add q[jz+1] to q[jz+k] */ + f[jx+i] = (float) ipio2[jv+i]; + for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; + q[i] = fw; + } + jz += k; + goto recompute; + } + } + + /* chop off zero terms */ + if(z==(float)0.0) { + jz -= 1; q0 -= 8; + while(iq[jz]==0) { jz--; q0-=8;} + } else { /* break z into 8-bit if necessary */ + z = rb_scalbnf(z,-q0); + if(z>=two8) { + fw = (float)((int32_t)(twon8*z)); + iq[jz] = (int32_t)(z-two8*fw); + jz += 1; q0 += 8; + iq[jz] = (int32_t) fw; + } else iq[jz] = (int32_t) z ; + } + + /* convert integer "bit" chunk to floating-point value */ + fw = rb_scalbnf(one,q0); + for(i=jz;i>=0;i--) { + q[i] = fw*(float)iq[i]; fw*=twon8; + } + + /* compute PIo2[0,...,jp]*q[jz,...,0] */ + for(i=jz;i>=0;i--) { + for(fw=0.0,k=0;k<=jp&&k<=jz-i;k++) fw += PIo2[k]*q[i+k]; + fq[jz-i] = fw; + } + + /* compress fq[] into y[] */ + switch(prec) { + case 0: + fw = 0.0; + for (i=jz;i>=0;i--) fw += fq[i]; + y[0] = (ih==0)? fw: -fw; + break; + case 1: + case 2: + fw = 0.0; + for (i=jz;i>=0;i--) fw += fq[i]; + y[0] = (ih==0)? fw: -fw; + fw = fq[0]-fw; + for (i=1;i<=jz;i++) fw += fq[i]; + y[1] = (ih==0)? fw: -fw; + break; + case 3: /* painful */ + for (i=jz;i>0;i--) { + fw = fq[i-1]+fq[i]; + fq[i] += fq[i-1]-fw; + fq[i-1] = fw; + } + for (i=jz;i>1;i--) { + fw = fq[i-1]+fq[i]; + fq[i] += fq[i-1]-fw; + fq[i-1] = fw; + } + for (fw=0.0,i=jz;i>=2;i--) fw += fq[i]; + if(ih==0) { + y[0] = fq[0]; y[1] = fq[1]; y[2] = fw; + } else { + y[0] = -fq[0]; y[1] = -fq[1]; y[2] = -fw; + } + } + return n&7; +} + + +static const int32_t two_over_pi[] = { +0xA2, 0xF9, 0x83, 0x6E, 0x4E, 0x44, 0x15, 0x29, 0xFC, +0x27, 0x57, 0xD1, 0xF5, 0x34, 0xDD, 0xC0, 0xDB, 0x62, +0x95, 0x99, 0x3C, 0x43, 0x90, 0x41, 0xFE, 0x51, 0x63, +0xAB, 0xDE, 0xBB, 0xC5, 0x61, 0xB7, 0x24, 0x6E, 0x3A, +0x42, 0x4D, 0xD2, 0xE0, 0x06, 0x49, 0x2E, 0xEA, 0x09, +0xD1, 0x92, 0x1C, 0xFE, 0x1D, 0xEB, 0x1C, 0xB1, 0x29, +0xA7, 0x3E, 0xE8, 0x82, 0x35, 0xF5, 0x2E, 0xBB, 0x44, +0x84, 0xE9, 0x9C, 0x70, 0x26, 0xB4, 0x5F, 0x7E, 0x41, +0x39, 0x91, 0xD6, 0x39, 0x83, 0x53, 0x39, 0xF4, 0x9C, +0x84, 0x5F, 0x8B, 0xBD, 0xF9, 0x28, 0x3B, 0x1F, 0xF8, +0x97, 0xFF, 0xDE, 0x05, 0x98, 0x0F, 0xEF, 0x2F, 0x11, +0x8B, 0x5A, 0x0A, 0x6D, 0x1F, 0x6D, 0x36, 0x7E, 0xCF, +0x27, 0xCB, 0x09, 0xB7, 0x4F, 0x46, 0x3F, 0x66, 0x9E, +0x5F, 0xEA, 0x2D, 0x75, 0x27, 0xBA, 0xC7, 0xEB, 0xE5, +0xF1, 0x7B, 0x3D, 0x07, 0x39, 0xF7, 0x8A, 0x52, 0x92, +0xEA, 0x6B, 0xFB, 0x5F, 0xB1, 0x1F, 0x8D, 0x5D, 0x08, +0x56, 0x03, 0x30, 0x46, 0xFC, 0x7B, 0x6B, 0xAB, 0xF0, +0xCF, 0xBC, 0x20, 0x9A, 0xF4, 0x36, 0x1D, 0xA9, 0xE3, +0x91, 0x61, 0x5E, 0xE6, 0x1B, 0x08, 0x65, 0x99, 0x85, +0x5F, 0x14, 0xA0, 0x68, 0x40, 0x8D, 0xFF, 0xD8, 0x80, +0x4D, 0x73, 0x27, 0x31, 0x06, 0x06, 0x15, 0x56, 0xCA, +0x73, 0xA8, 0xC9, 0x60, 0xE2, 0x7B, 0xC0, 0x8C, 0x6B, +}; + +static const int32_t npio2_hw[] = { +0x3fc90f00, 0x40490f00, 0x4096cb00, 0x40c90f00, 0x40fb5300, 0x4116cb00, +0x412fed00, 0x41490f00, 0x41623100, 0x417b5300, 0x418a3a00, 0x4196cb00, +0x41a35c00, 0x41afed00, 0x41bc7e00, 0x41c90f00, 0x41d5a000, 0x41e23100, +0x41eec200, 0x41fb5300, 0x4203f200, 0x420a3a00, 0x42108300, 0x4216cb00, +0x421d1400, 0x42235c00, 0x4229a500, 0x422fed00, 0x42363600, 0x423c7e00, +0x4242c700, 0x42490f00 +}; + +/* + * invpio2: 24 bits of 2/pi + * pio2_1: first 17 bit of pi/2 + * pio2_1t: pi/2 - pio2_1 + * pio2_2: second 17 bit of pi/2 + * pio2_2t: pi/2 - (pio2_1+pio2_2) + * pio2_3: third 17 bit of pi/2 + * pio2_3t: pi/2 - (pio2_1+pio2_2+pio2_3) + */ + +static const float +half = 5.0000000000e-01, /* 0x3f000000 */ +invpio2 = 6.3661980629e-01, /* 0x3f22f984 */ +pio2_1 = 1.5707855225e+00, /* 0x3fc90f80 */ +pio2_1t = 1.0804334124e-05, /* 0x37354443 */ +pio2_2 = 1.0804273188e-05, /* 0x37354400 */ +pio2_2t = 6.0770999344e-11, /* 0x2e85a308 */ +pio2_3 = 6.0770943833e-11, /* 0x2e85a300 */ +pio2_3t = 6.1232342629e-17; /* 0x248d3132 */ + +int32_t rem_pio2(float x, float *y) +{ + float z,w,t,r,fn; + float tx[3]; + int32_t e0,i,j,nx,n,ix,hx; + + GET_FLOAT_WORD(hx,x); + ix = hx&0x7fffffff; + if(ix<=0x3f490fd8) /* |x| ~<= pi/4 , no need for reduction */ + {y[0] = x; y[1] = 0; return 0;} + if(ix<0x4016cbe4) { /* |x| < 3pi/4, special case with n=+-1 */ + if(hx>0) { + z = x - pio2_1; + if((ix&0xfffffff0)!=0x3fc90fd0) { /* 24+24 bit pi OK */ + y[0] = z - pio2_1t; + y[1] = (z-y[0])-pio2_1t; + } else { /* near pi/2, use 24+24+24 bit pi */ + z -= pio2_2; + y[0] = z - pio2_2t; + y[1] = (z-y[0])-pio2_2t; + } + return 1; + } else { /* negative x */ + z = x + pio2_1; + if((ix&0xfffffff0)!=0x3fc90fd0) { /* 24+24 bit pi OK */ + y[0] = z + pio2_1t; + y[1] = (z-y[0])+pio2_1t; + } else { /* near pi/2, use 24+24+24 bit pi */ + z += pio2_2; + y[0] = z + pio2_2t; + y[1] = (z-y[0])+pio2_2t; + } + return -1; + } + } + if(ix<=0x43490f80) { /* |x| ~<= 2^7*(pi/2), medium size */ + t = rb_fabs(x); + n = (int32_t) (t*invpio2+half); + fn = (float)n; + r = t-fn*pio2_1; + w = fn*pio2_1t; /* 1st round good to 40 bit */ + if(n<32&&(int32_t)(ix&0xffffff00)!=npio2_hw[n-1]) { + y[0] = r-w; /* quick check no cancellation */ + } else { + uint32_t high; + j = ix>>23; + y[0] = r-w; + GET_FLOAT_WORD(high,y[0]); + i = j-((high>>23)&0xff); + if(i>8) { /* 2nd iteration needed, good to 57 */ + t = r; + w = fn*pio2_2; + r = t-w; + w = fn*pio2_2t-((t-r)-w); + y[0] = r-w; + GET_FLOAT_WORD(high,y[0]); + i = j-((high>>23)&0xff); + if(i>25) { /* 3rd iteration need, 74 bits acc */ + t = r; /* will cover all possible cases */ + w = fn*pio2_3; + r = t-w; + w = fn*pio2_3t-((t-r)-w); + y[0] = r-w; + } + } + } + y[1] = (r-y[0])-w; + if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;} + else return n; + } + /* + * all other (large) arguments + */ + if(ix>=0x7f800000) { /* x is inf or NaN */ + y[0]=y[1]=x-x; return 0; + } + /* set z = scalbn(|x|,ilogb(x)-7) */ + e0 = (ix>>23)-134; /* e0 = ilogb(z)-7; */ + SET_FLOAT_WORD(z, ix - ((int32_t)(e0<<23))); + for(i=0;i<2;i++) { + tx[i] = (float)((int32_t)(z)); + z = (z-tx[i])*two8; + } + tx[2] = z; + nx = 3; + while(tx[nx-1]==zero) nx--; /* skip zero term */ + n = kernel_rem_pio2(tx,y,e0,nx,2,two_over_pi); + if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;} + return n; +} + +float rb_tan(float x) +{ + float y[2],z=0.0; + int32_t n, ix; + + GET_FLOAT_WORD(ix,x); + + /* |x| ~< pi/4 */ + ix &= 0x7fffffff; + if(ix <= 0x3f490fda) return kernel_tan(x,z,1); + + /* tan(Inf or NaN) is NaN */ + else if (ix>=0x7f800000) return x-x; /* NaN */ + + /* argument reduction needed */ + else { + n = rem_pio2(x,y); + return kernel_tan(y[0],y[1],1-((n&1)<<1)); /* 1 -- n even + -1 -- n odd */ + } +} + + + +/* Exponential function, + taken from glibc-2.8 + As it uses double values and udefines some symbols, + it was moved to the end of the source code */ + +#define W52 (2.22044605e-16) +#define W55 (2.77555756e-17) +#define W58 (3.46944695e-18) +#define W59 (1.73472348e-18) +#define W60 (8.67361738e-19) +const float __exp_deltatable[178] = { + 0*W60, 16558714*W60, -10672149*W59, 1441652*W60, + -15787963*W55, 462888*W60, 7291806*W60, 1698880*W60, + -14375103*W58, -2021016*W60, 728829*W60, -3759654*W60, + 3202123*W60, -10916019*W58, -251570*W60, -1043086*W60, + 8207536*W60, -409964*W60, -5993931*W60, -475500*W60, + 2237522*W60, 324170*W60, -244117*W60, 32077*W60, + 123907*W60, -1019734*W60, -143*W60, 813077*W60, + 743345*W60, 462461*W60, 629794*W60, 2125066*W60, + -2339121*W60, -337951*W60, 9922067*W60, -648704*W60, + 149407*W60, -2687209*W60, -631608*W60, 2128280*W60, + -4882082*W60, 2001360*W60, 175074*W60, 2923216*W60, + -538947*W60, -1212193*W60, -1920926*W60, -1080577*W60, + 3690196*W60, 2643367*W60, 2911937*W60, 671455*W60, + -1128674*W60, 593282*W60, -5219347*W60, -1941490*W60, + 11007953*W60, 239609*W60, -2969658*W60, -1183650*W60, + 942998*W60, 699063*W60, 450569*W60, -329250*W60, + -7257875*W60, -312436*W60, 51626*W60, 555877*W60, + -641761*W60, 1565666*W60, 884327*W60, -10960035*W60, + -2004679*W60, -995793*W60, -2229051*W60, -146179*W60, + -510327*W60, 1453482*W60, -3778852*W60, -2238056*W60, + -4895983*W60, 3398883*W60, -252738*W60, 1230155*W60, + 346918*W60, 1109352*W60, 268941*W60, -2930483*W60, + -1036263*W60, -1159280*W60, 1328176*W60, 2937642*W60, + -9371420*W60, -6902650*W60, -1419134*W60, 1442904*W60, + -1319056*W60, -16369*W60, 696555*W60, -279987*W60, + -7919763*W60, 252741*W60, 459711*W60, -1709645*W60, + 354913*W60, 6025867*W60, -421460*W60, -853103*W60, + -338649*W60, 962151*W60, 955965*W60, 784419*W60, + -3633653*W60, 2277133*W60, -8847927*W52, 1223028*W60, + 5907079*W60, 623167*W60, 5142888*W60, 2599099*W60, + 1214280*W60, 4870359*W60, 593349*W60, -57705*W60, + 7761209*W60, -5564097*W60, 2051261*W60, 6216869*W60, + 4692163*W60, 601691*W60, -5264906*W60, 1077872*W60, + -3205949*W60, 1833082*W60, 2081746*W60, -987363*W60, + -1049535*W60, 2015244*W60, 874230*W60, 2168259*W60, + -1740124*W60, -10068269*W60, -18242*W60, -3013583*W60, + 580601*W60, -2547161*W60, -535689*W60, 2220815*W60, + 1285067*W60, 2806933*W60, -983086*W60, -1729097*W60, + -1162985*W60, -2561904*W60, 801988*W60, 244351*W60, + 1441893*W60, -7517981*W60, 271781*W60, -15021588*W60, + -2341588*W60, -919198*W60, 1642232*W60, 4771771*W60, + -1220099*W60, -3062372*W60, 628624*W60, 1278114*W60, + 13083513*W60, -10521925*W60, 3180310*W60, -1659307*W60, + 3543773*W60, 2501203*W60, 4151*W60, -340748*W60, + -2285625*W60, 2495202*W60 +}; + +const double __exp_atable[355] /* __attribute__((mode(DF))) */ = { + 0.707722561055888932371, /* 0x0.b52d4e46605c27ffd */ + 0.709106182438804188967, /* 0x0.b587fb96f75097ffb */ + 0.710492508843861281234, /* 0x0.b5e2d649899167ffd */ + 0.711881545564593931623, /* 0x0.b63dde74d36bdfffe */ + 0.713273297897442870573, /* 0x0.b699142f945f87ffc */ + 0.714667771153751463236, /* 0x0.b6f477909c4ea0001 */ + 0.716064970655995725059, /* 0x0.b75008aec758f8004 */ + 0.717464901723956938193, /* 0x0.b7abc7a0eea7e0002 */ + 0.718867569715736398602, /* 0x0.b807b47e1586c7ff8 */ + 0.720272979947266023271, /* 0x0.b863cf5d10e380003 */ + 0.721681137825144314297, /* 0x0.b8c01855195c37ffb */ + 0.723092048691992950199, /* 0x0.b91c8f7d213740004 */ + 0.724505717938892290800, /* 0x0.b97934ec5002d0007 */ + 0.725922150953176470431, /* 0x0.b9d608b9c92ea7ffc */ + 0.727341353138962865022, /* 0x0.ba330afcc29e98003 */ + 0.728763329918453162104, /* 0x0.ba903bcc8618b7ffc */ + 0.730188086709957051568, /* 0x0.baed9b40591ba0000 */ + 0.731615628948127705309, /* 0x0.bb4b296f931e30002 */ + 0.733045962086486091436, /* 0x0.bba8e671a05617ff9 */ + 0.734479091556371366251, /* 0x0.bc06d25dd49568001 */ + 0.735915022857225542529, /* 0x0.bc64ed4bce8f6fff9 */ + 0.737353761441304711410, /* 0x0.bcc33752f915d7ff9 */ + 0.738795312814142124419, /* 0x0.bd21b08af98e78005 */ + 0.740239682467211168593, /* 0x0.bd80590b65e9a8000 */ + 0.741686875913991849885, /* 0x0.bddf30ebec4a10000 */ + 0.743136898669507939299, /* 0x0.be3e38443c84e0007 */ + 0.744589756269486091620, /* 0x0.be9d6f2c1d32a0002 */ + 0.746045454254026796384, /* 0x0.befcd5bb59baf8004 */ + 0.747503998175051087583, /* 0x0.bf5c6c09ca84c0003 */ + 0.748965393601880857739, /* 0x0.bfbc322f5b18b7ff8 */ + 0.750429646104262104698, /* 0x0.c01c2843f776fffff */ + 0.751896761271877989160, /* 0x0.c07c4e5fa18b88002 */ + 0.753366744698445112140, /* 0x0.c0dca49a5fb18fffd */ + 0.754839601988627206827, /* 0x0.c13d2b0c444db0005 */ + 0.756315338768691947122, /* 0x0.c19de1cd798578006 */ + 0.757793960659406629066, /* 0x0.c1fec8f623723fffd */ + 0.759275473314173443536, /* 0x0.c25fe09e8a0f47ff8 */ + 0.760759882363831851927, /* 0x0.c2c128dedc88f8000 */ + 0.762247193485956486805, /* 0x0.c322a1cf7d6e7fffa */ + 0.763737412354726363781, /* 0x0.c3844b88cb9347ffc */ + 0.765230544649828092739, /* 0x0.c3e626232bd8f7ffc */ + 0.766726596071518051729, /* 0x0.c44831b719bf18002 */ + 0.768225572321911687194, /* 0x0.c4aa6e5d12d078001 */ + 0.769727479119219348810, /* 0x0.c50cdc2da64a37ffb */ + 0.771232322196981678892, /* 0x0.c56f7b41744490001 */ + 0.772740107296721268087, /* 0x0.c5d24bb1259e70004 */ + 0.774250840160724651565, /* 0x0.c6354d95640dd0007 */ + 0.775764526565368872643, /* 0x0.c6988106fec447fff */ + 0.777281172269557396602, /* 0x0.c6fbe61eb1bd0ffff */ + 0.778800783068235302750, /* 0x0.c75f7cf560942fffc */ + 0.780323364758801041312, /* 0x0.c7c345a3f1983fffe */ + 0.781848923151573727006, /* 0x0.c8274043594cb0002 */ + 0.783377464064598849602, /* 0x0.c88b6cec94b3b7ff9 */ + 0.784908993312207869935, /* 0x0.c8efcbb89cba27ffe */ + 0.786443516765346961618, /* 0x0.c9545cc0a88c70003 */ + 0.787981040257604625744, /* 0x0.c9b9201dc643bfffa */ + 0.789521569657452682047, /* 0x0.ca1e15e92a5410007 */ + 0.791065110849462849192, /* 0x0.ca833e3c1ae510005 */ + 0.792611669712891875319, /* 0x0.cae8992fd84667ffd */ + 0.794161252150049179450, /* 0x0.cb4e26ddbc207fff8 */ + 0.795713864077794763584, /* 0x0.cbb3e75f301b60003 */ + 0.797269511407239561694, /* 0x0.cc19dacd978cd8002 */ + 0.798828200086368567220, /* 0x0.cc8001427e55d7ffb */ + 0.800389937624300440456, /* 0x0.cce65ade24d360006 */ + 0.801954725261124767840, /* 0x0.cd4ce7a5de839fffb */ + 0.803522573691593189330, /* 0x0.cdb3a7c79a678fffd */ + 0.805093487311204114563, /* 0x0.ce1a9b563965ffffc */ + 0.806667472122675088819, /* 0x0.ce81c26b838db8000 */ + 0.808244534127439906441, /* 0x0.cee91d213f8428002 */ + 0.809824679342317166307, /* 0x0.cf50ab9144d92fff9 */ + 0.811407913793616542005, /* 0x0.cfb86dd5758c2ffff */ + 0.812994243520784198882, /* 0x0.d0206407c20e20005 */ + 0.814583674571603966162, /* 0x0.d0888e4223facfff9 */ + 0.816176213022088536960, /* 0x0.d0f0ec9eb3f7c8002 */ + 0.817771864936188586101, /* 0x0.d1597f377d6768002 */ + 0.819370636400374108252, /* 0x0.d1c24626a46eafff8 */ + 0.820972533518165570298, /* 0x0.d22b41865ff1e7ff9 */ + 0.822577562404315121269, /* 0x0.d2947170f32ec7ff9 */ + 0.824185729164559344159, /* 0x0.d2fdd60097795fff8 */ + 0.825797039949601741075, /* 0x0.d3676f4fb796d0001 */ + 0.827411500902565544264, /* 0x0.d3d13d78b5f68fffb */ + 0.829029118181348834154, /* 0x0.d43b40960546d8001 */ + 0.830649897953322891022, /* 0x0.d4a578c222a058000 */ + 0.832273846408250750368, /* 0x0.d50fe617a3ba78005 */ + 0.833900969738858188772, /* 0x0.d57a88b1218e90002 */ + 0.835531274148056613016, /* 0x0.d5e560a94048f8006 */ + 0.837164765846411529371, /* 0x0.d6506e1aac8078003 */ + 0.838801451086016225394, /* 0x0.d6bbb1204074e0001 */ + 0.840441336100884561780, /* 0x0.d72729d4c28518004 */ + 0.842084427144139224814, /* 0x0.d792d8530e12b0001 */ + 0.843730730487052604790, /* 0x0.d7febcb61273e7fff */ + 0.845380252404570153833, /* 0x0.d86ad718c308dfff9 */ + 0.847032999194574087728, /* 0x0.d8d727962c69d7fff */ + 0.848688977161248581090, /* 0x0.d943ae49621ce7ffb */ + 0.850348192619261200615, /* 0x0.d9b06b4d832ef8005 */ + 0.852010651900976245816, /* 0x0.da1d5ebdc22220005 */ + 0.853676361342631029337, /* 0x0.da8a88b555baa0006 */ + 0.855345327311054837175, /* 0x0.daf7e94f965f98004 */ + 0.857017556155879489641, /* 0x0.db6580a7c98f7fff8 */ + 0.858693054267390953857, /* 0x0.dbd34ed9617befff8 */ + 0.860371828028939855647, /* 0x0.dc4153ffc8b65fff9 */ + 0.862053883854957292436, /* 0x0.dcaf90368bfca8004 */ + 0.863739228154875360306, /* 0x0.dd1e0399328d87ffe */ + 0.865427867361348468455, /* 0x0.dd8cae435d303fff9 */ + 0.867119807911702289458, /* 0x0.ddfb9050b1cee8006 */ + 0.868815056264353846599, /* 0x0.de6aa9dced8448001 */ + 0.870513618890481399881, /* 0x0.ded9fb03db7320006 */ + 0.872215502247877139094, /* 0x0.df4983e1380657ff8 */ + 0.873920712852848668986, /* 0x0.dfb94490ffff77ffd */ + 0.875629257204025623884, /* 0x0.e0293d2f1cb01fff9 */ + 0.877341141814212965880, /* 0x0.e0996dd786fff0007 */ + 0.879056373217612985183, /* 0x0.e109d6a64f5d57ffc */ + 0.880774957955916648615, /* 0x0.e17a77b78e72a7ffe */ + 0.882496902590150900078, /* 0x0.e1eb5127722cc7ff8 */ + 0.884222213673356738383, /* 0x0.e25c63121fb0c8006 */ + 0.885950897802399772740, /* 0x0.e2cdad93ec5340003 */ + 0.887682961567391237685, /* 0x0.e33f30c925fb97ffb */ + 0.889418411575228162725, /* 0x0.e3b0ecce2d05ffff9 */ + 0.891157254447957902797, /* 0x0.e422e1bf727718006 */ + 0.892899496816652704641, /* 0x0.e4950fb9713fc7ffe */ + 0.894645145323828439008, /* 0x0.e50776d8b0e60fff8 */ + 0.896394206626591749641, /* 0x0.e57a1739c8fadfffc */ + 0.898146687421414902124, /* 0x0.e5ecf0f97c5798007 */ + 0.899902594367530173098, /* 0x0.e660043464e378005 */ + 0.901661934163603406867, /* 0x0.e6d3510747e150006 */ + 0.903424713533971135418, /* 0x0.e746d78f06cd97ffd */ + 0.905190939194458810123, /* 0x0.e7ba97e879c91fffc */ + 0.906960617885092856864, /* 0x0.e82e92309390b0007 */ + 0.908733756358986566306, /* 0x0.e8a2c6845544afffa */ + 0.910510361377119825629, /* 0x0.e9173500c8abc7ff8 */ + 0.912290439722343249336, /* 0x0.e98bddc30f98b0002 */ + 0.914073998177417412765, /* 0x0.ea00c0e84bc4c7fff */ + 0.915861043547953501680, /* 0x0.ea75de8db8094fffe */ + 0.917651582652244779397, /* 0x0.eaeb36d09d3137ffe */ + 0.919445622318405764159, /* 0x0.eb60c9ce4ed3dffff */ + 0.921243169397334638073, /* 0x0.ebd697a43995b0007 */ + 0.923044230737526172328, /* 0x0.ec4ca06fc7768fffa */ + 0.924848813220121135342, /* 0x0.ecc2e44e865b6fffb */ + 0.926656923710931002014, /* 0x0.ed39635df34e70006 */ + 0.928468569126343790092, /* 0x0.edb01dbbc2f5b7ffa */ + 0.930283756368834757725, /* 0x0.ee2713859aab57ffa */ + 0.932102492359406786818, /* 0x0.ee9e44d9342870004 */ + 0.933924784042873379360, /* 0x0.ef15b1d4635438005 */ + 0.935750638358567643520, /* 0x0.ef8d5a94f60f50007 */ + 0.937580062297704630580, /* 0x0.f0053f38f345cffff */ + 0.939413062815381727516, /* 0x0.f07d5fde3a2d98001 */ + 0.941249646905368053689, /* 0x0.f0f5bca2d481a8004 */ + 0.943089821583810716806, /* 0x0.f16e55a4e497d7ffe */ + 0.944933593864477061592, /* 0x0.f1e72b028a2827ffb */ + 0.946780970781518460559, /* 0x0.f2603cd9fb5430001 */ + 0.948631959382661205081, /* 0x0.f2d98b497d2a87ff9 */ + 0.950486566729423554277, /* 0x0.f353166f63e3dffff */ + 0.952344799896018723290, /* 0x0.f3ccde6a11ae37ffe */ + 0.954206665969085765512, /* 0x0.f446e357f66120000 */ + 0.956072172053890279009, /* 0x0.f4c12557964f0fff9 */ + 0.957941325265908139014, /* 0x0.f53ba48781046fffb */ + 0.959814132734539637840, /* 0x0.f5b66106555d07ffa */ + 0.961690601603558903308, /* 0x0.f6315af2c2027fffc */ + 0.963570739036113010927, /* 0x0.f6ac926b8aeb80004 */ + 0.965454552202857141381, /* 0x0.f728078f7c5008002 */ + 0.967342048278315158608, /* 0x0.f7a3ba7d66a908001 */ + 0.969233234469444204768, /* 0x0.f81fab543e1897ffb */ + 0.971128118008140250896, /* 0x0.f89bda33122c78007 */ + 0.973026706099345495256, /* 0x0.f9184738d4cf97ff8 */ + 0.974929006031422851235, /* 0x0.f994f284d3a5c0008 */ + 0.976835024947348973265, /* 0x0.fa11dc35bc7820002 */ + 0.978744770239899142285, /* 0x0.fa8f046b4fb7f8007 */ + 0.980658249138918636210, /* 0x0.fb0c6b449ab1cfff9 */ + 0.982575468959622777535, /* 0x0.fb8a10e1088fb7ffa */ + 0.984496437054508843888, /* 0x0.fc07f5602d79afffc */ + 0.986421160608523028820, /* 0x0.fc8618e0e55e47ffb */ + 0.988349647107594098099, /* 0x0.fd047b83571b1fffa */ + 0.990281903873210800357, /* 0x0.fd831d66f4c018002 */ + 0.992217938695037382475, /* 0x0.fe01fead3320bfff8 */ + 0.994157757657894713987, /* 0x0.fe811f703491e8006 */ + 0.996101369488558541238, /* 0x0.ff007fd5744490005 */ + 0.998048781093141101932, /* 0x0.ff801ffa9b9280007 */ + 1.000000000000000000000, /* 0x1.00000000000000000 */ + 1.001955033605393285965, /* 0x1.0080200565d29ffff */ + 1.003913889319761887310, /* 0x1.0100802aa0e80fff0 */ + 1.005876574715736104818, /* 0x1.01812090377240007 */ + 1.007843096764807100351, /* 0x1.020201541aad7fff6 */ + 1.009813464316352327214, /* 0x1.0283229c4c9820007 */ + 1.011787683565730677817, /* 0x1.030484836910a000e */ + 1.013765762469146736174, /* 0x1.0386272b9c077fffe */ + 1.015747708536026694351, /* 0x1.04080ab526304fff0 */ + 1.017733529475172815584, /* 0x1.048a2f412375ffff0 */ + 1.019723232714418781378, /* 0x1.050c94ef7ad5e000a */ + 1.021716825883923762690, /* 0x1.058f3be0f1c2d0004 */ + 1.023714316605201180057, /* 0x1.06122436442e2000e */ + 1.025715712440059545995, /* 0x1.06954e0fec63afff2 */ + 1.027721021151397406936, /* 0x1.0718b98f41c92fff6 */ + 1.029730250269221158939, /* 0x1.079c66d49bb2ffff1 */ + 1.031743407506447551857, /* 0x1.082056011a9230009 */ + 1.033760500517691527387, /* 0x1.08a487359ebd50002 */ + 1.035781537016238873464, /* 0x1.0928fa93490d4fff3 */ + 1.037806524719013578963, /* 0x1.09adb03b3e5b3000d */ + 1.039835471338248051878, /* 0x1.0a32a84e9e5760004 */ + 1.041868384612101516848, /* 0x1.0ab7e2eea5340ffff */ + 1.043905272300907460835, /* 0x1.0b3d603ca784f0009 */ + 1.045946142174331239262, /* 0x1.0bc3205a042060000 */ + 1.047991002016745332165, /* 0x1.0c4923682a086fffe */ + 1.050039859627715177527, /* 0x1.0ccf698898f3a000d */ + 1.052092722826109660856, /* 0x1.0d55f2dce5d1dfffb */ + 1.054149599440827866881, /* 0x1.0ddcbf86b09a5fff6 */ + 1.056210497317612961855, /* 0x1.0e63cfa7abc97fffd */ + 1.058275424318780855142, /* 0x1.0eeb23619c146fffb */ + 1.060344388322010722446, /* 0x1.0f72bad65714bffff */ + 1.062417397220589476718, /* 0x1.0ffa9627c38d30004 */ + 1.064494458915699715017, /* 0x1.1082b577d0eef0003 */ + 1.066575581342167566880, /* 0x1.110b18e893a90000a */ + 1.068660772440545025953, /* 0x1.1193c09c267610006 */ + 1.070750040138235936705, /* 0x1.121cacb4959befff6 */ + 1.072843392435016474095, /* 0x1.12a5dd543cf36ffff */ + 1.074940837302467588937, /* 0x1.132f529d59552000b */ + 1.077042382749654914030, /* 0x1.13b90cb250d08fff5 */ + 1.079148036789447484528, /* 0x1.14430bb58da3dfff9 */ + 1.081257807444460983297, /* 0x1.14cd4fc984c4a000e */ + 1.083371702785017154417, /* 0x1.1557d910df9c7000e */ + 1.085489730853784307038, /* 0x1.15e2a7ae292d30002 */ + 1.087611899742884524772, /* 0x1.166dbbc422d8c0004 */ + 1.089738217537583819804, /* 0x1.16f9157586772ffff */ + 1.091868692357631731528, /* 0x1.1784b4e533cacfff0 */ + 1.094003332327482702577, /* 0x1.18109a360fc23fff2 */ + 1.096142145591650907149, /* 0x1.189cc58b155a70008 */ + 1.098285140311341168136, /* 0x1.1929370751ea50002 */ + 1.100432324652149906842, /* 0x1.19b5eecdd79cefff0 */ + 1.102583706811727015711, /* 0x1.1a42ed01dbdba000e */ + 1.104739294993289488947, /* 0x1.1ad031c69a2eafff0 */ + 1.106899097422573863281, /* 0x1.1b5dbd3f66e120003 */ + 1.109063122341542140286, /* 0x1.1beb8f8fa8150000b */ + 1.111231377994659874592, /* 0x1.1c79a8dac6ad0fff4 */ + 1.113403872669181282605, /* 0x1.1d0809445a97ffffc */ + 1.115580614653132185460, /* 0x1.1d96b0effc9db000e */ + 1.117761612217810673898, /* 0x1.1e25a001332190000 */ + 1.119946873713312474002, /* 0x1.1eb4d69bdb2a9fff1 */ + 1.122136407473298902480, /* 0x1.1f4454e3bfae00006 */ + 1.124330221845670330058, /* 0x1.1fd41afcbb48bfff8 */ + 1.126528325196519908506, /* 0x1.2064290abc98c0001 */ + 1.128730725913251964394, /* 0x1.20f47f31c9aa7000f */ + 1.130937432396844410880, /* 0x1.21851d95f776dfff0 */ + 1.133148453059692917203, /* 0x1.2216045b6784efffa */ + 1.135363796355857157764, /* 0x1.22a733a6692ae0004 */ + 1.137583470716100553249, /* 0x1.2338ab9b3221a0004 */ + 1.139807484614418608939, /* 0x1.23ca6c5e27aadfff7 */ + 1.142035846532929888057, /* 0x1.245c7613b7f6c0004 */ + 1.144268564977221958089, /* 0x1.24eec8e06b035000c */ + 1.146505648458203463465, /* 0x1.258164e8cea85fff8 */ + 1.148747105501412235671, /* 0x1.26144a5180d380009 */ + 1.150992944689175123667, /* 0x1.26a7793f5de2efffa */ + 1.153243174560058870217, /* 0x1.273af1d712179000d */ + 1.155497803703682491111, /* 0x1.27ceb43d81d42fff1 */ + 1.157756840726344771440, /* 0x1.2862c097a3d29000c */ + 1.160020294239811677834, /* 0x1.28f7170a74cf4fff1 */ + 1.162288172883275239058, /* 0x1.298bb7bb0faed0004 */ + 1.164560485298402170388, /* 0x1.2a20a2ce920dffff4 */ + 1.166837240167474476460, /* 0x1.2ab5d86a4631ffff6 */ + 1.169118446164539637555, /* 0x1.2b4b58b36d5220009 */ + 1.171404112007080167155, /* 0x1.2be123cf786790002 */ + 1.173694246390975415341, /* 0x1.2c7739e3c0aac000d */ + 1.175988858069749065617, /* 0x1.2d0d9b15deb58fff6 */ + 1.178287955789017793514, /* 0x1.2da4478b627040002 */ + 1.180591548323240091978, /* 0x1.2e3b3f69fb794fffc */ + 1.182899644456603782686, /* 0x1.2ed282d76421d0004 */ + 1.185212252993012693694, /* 0x1.2f6a11f96c685fff3 */ + 1.187529382762033236513, /* 0x1.3001ecf60082ffffa */ + 1.189851042595508889847, /* 0x1.309a13f30f28a0004 */ + 1.192177241354644978669, /* 0x1.31328716a758cfff7 */ + 1.194507987909589896687, /* 0x1.31cb4686e1e85fffb */ + 1.196843291137896336843, /* 0x1.32645269dfd04000a */ + 1.199183159977805113226, /* 0x1.32fdaae604c39000f */ + 1.201527603343041317132, /* 0x1.339750219980dfff3 */ + 1.203876630171082595692, /* 0x1.3431424300e480007 */ + 1.206230249419600664189, /* 0x1.34cb8170b3fee000e */ + 1.208588470077065268869, /* 0x1.35660dd14dbd4fffc */ + 1.210951301134513435915, /* 0x1.3600e78b6bdfc0005 */ + 1.213318751604272271958, /* 0x1.369c0ec5c38ebfff2 */ + 1.215690830512196507537, /* 0x1.373783a718d29000f */ + 1.218067546930756250870, /* 0x1.37d3465662f480007 */ + 1.220448909901335365929, /* 0x1.386f56fa770fe0008 */ + 1.222834928513994334780, /* 0x1.390bb5ba5fc540004 */ + 1.225225611877684750397, /* 0x1.39a862bd3c7a8fff3 */ + 1.227620969111500981433, /* 0x1.3a455e2a37bcafffd */ + 1.230021009336254911271, /* 0x1.3ae2a8287dfbefff6 */ + 1.232425741726685064472, /* 0x1.3b8040df76f39fffa */ + 1.234835175450728295084, /* 0x1.3c1e287682e48fff1 */ + 1.237249319699482263931, /* 0x1.3cbc5f151b86bfff8 */ + 1.239668183679933477545, /* 0x1.3d5ae4e2cc0a8000f */ + 1.242091776620540377629, /* 0x1.3df9ba07373bf0006 */ + 1.244520107762172811399, /* 0x1.3e98deaa0d8cafffe */ + 1.246953186383919165383, /* 0x1.3f3852f32973efff0 */ + 1.249391019292643401078, /* 0x1.3fd816ffc72b90001 */ + 1.251833623164381181797, /* 0x1.40782b17863250005 */ + 1.254280999953110153911, /* 0x1.41188f42caf400000 */ + 1.256733161434815393410, /* 0x1.41b943b42945bfffd */ + 1.259190116985283935980, /* 0x1.425a4893e5f10000a */ + 1.261651875958665236542, /* 0x1.42fb9e0a2df4c0009 */ + 1.264118447754797758244, /* 0x1.439d443f608c4fff9 */ + 1.266589841787181258708, /* 0x1.443f3b5bebf850008 */ + 1.269066067469190262045, /* 0x1.44e183883e561fff7 */ + 1.271547134259576328224, /* 0x1.45841cecf7a7a0001 */ + 1.274033051628237434048, /* 0x1.462707b2c43020009 */ + 1.276523829025464573684, /* 0x1.46ca44023aa410007 */ + 1.279019475999373156531, /* 0x1.476dd2045d46ffff0 */ + 1.281520002043128991825, /* 0x1.4811b1e1f1f19000b */ + 1.284025416692967214122, /* 0x1.48b5e3c3edd74fff4 */ + 1.286535729509738823464, /* 0x1.495a67d3613c8fff7 */ + 1.289050950070396384145, /* 0x1.49ff3e396e19d000b */ + 1.291571087985403654081, /* 0x1.4aa4671f5b401fff1 */ + 1.294096152842774794011, /* 0x1.4b49e2ae56d19000d */ + 1.296626154297237043484, /* 0x1.4befb10fd84a3fff4 */ + 1.299161101984141142272, /* 0x1.4c95d26d41d84fff8 */ + 1.301701005575179204100, /* 0x1.4d3c46f01d9f0fff3 */ + 1.304245874766450485904, /* 0x1.4de30ec21097d0003 */ + 1.306795719266019562007, /* 0x1.4e8a2a0ccce3d0002 */ + 1.309350548792467483458, /* 0x1.4f3198fa10346fff5 */ + 1.311910373099227200545, /* 0x1.4fd95bb3be8cffffd */ + 1.314475201942565174546, /* 0x1.50817263bf0e5fffb */ + 1.317045045107389400535, /* 0x1.5129dd3418575000e */ + 1.319619912422941299109, /* 0x1.51d29c4f01c54ffff */ + 1.322199813675649204855, /* 0x1.527bafde83a310009 */ + 1.324784758729532718739, /* 0x1.5325180cfb8b3fffd */ + 1.327374757430096474625, /* 0x1.53ced504b2bd0fff4 */ + 1.329969819671041886272, /* 0x1.5478e6f02775e0001 */ + 1.332569955346704748651, /* 0x1.55234df9d8a59fff8 */ + 1.335175174370685002822, /* 0x1.55ce0a4c5a6a9fff6 */ + 1.337785486688218616860, /* 0x1.56791c1263abefff7 */ + 1.340400902247843806217, /* 0x1.57248376aef21fffa */ + 1.343021431036279800211, /* 0x1.57d040a420c0bfff3 */ + 1.345647083048053138662, /* 0x1.587c53c5a630f0002 */ + 1.348277868295411074918, /* 0x1.5928bd063fd7bfff9 */ + 1.350913796821875845231, /* 0x1.59d57c9110ad60006 */ + 1.353554878672557082439, /* 0x1.5a8292913d68cfffc */ + 1.356201123929036356254, /* 0x1.5b2fff3212db00007 */ + 1.358852542671913132777, /* 0x1.5bddc29edcc06fff3 */ + 1.361509145047255398051, /* 0x1.5c8bdd032ed16000f */ + 1.364170941142184734180, /* 0x1.5d3a4e8a5bf61fff4 */ + 1.366837941171020309735, /* 0x1.5de9176042f1effff */ + 1.369510155261156381121, /* 0x1.5e9837b062f4e0005 */ + 1.372187593620959988833, /* 0x1.5f47afa69436cfff1 */ + 1.374870266463378287715, /* 0x1.5ff77f6eb3f8cfffd */ + 1.377558184010425845733, /* 0x1.60a7a734a9742fff9 */ + 1.380251356531521533853, /* 0x1.6158272490016000c */ + 1.382949794301995272203, /* 0x1.6208ff6a8978a000f */ + 1.385653507605306700170, /* 0x1.62ba3032c0a280004 */ + 1.388362506772382154503, /* 0x1.636bb9a994784000f */ + 1.391076802081129493127, /* 0x1.641d9bfb29a7bfff6 */ + 1.393796403973427855412, /* 0x1.64cfd7545928b0002 */ + 1.396521322756352656542, /* 0x1.65826be167badfff8 */ + 1.399251568859207761660, /* 0x1.663559cf20826000c */ + 1.401987152677323100733, /* 0x1.66e8a14a29486fffc */ + 1.404728084651919228815, /* 0x1.679c427f5a4b6000b */ + 1.407474375243217723560, /* 0x1.68503d9ba0add000f */ + 1.410226034922914983815, /* 0x1.690492cbf6303fff9 */ + 1.412983074197955213304, /* 0x1.69b9423d7b548fff6 */ +}; + +/* All floating-point numbers can be put in one of these categories. */ +enum + { + FP_NAN, +# define FP_NAN FP_NAN + FP_INFINITE, +# define FP_INFINITE FP_INFINITE + FP_ZERO, +# define FP_ZERO FP_ZERO + FP_SUBNORMAL, +# define FP_SUBNORMAL FP_SUBNORMAL + FP_NORMAL +# define FP_NORMAL FP_NORMAL + }; + + +int +__fpclassifyf (float x) +{ + uint32_t wx; + int retval = FP_NORMAL; + + GET_FLOAT_WORD (wx, x); + wx &= 0x7fffffff; + if (wx == 0) + retval = FP_ZERO; + else if (wx < 0x800000) + retval = FP_SUBNORMAL; + else if (wx >= 0x7f800000) + retval = wx > 0x7f800000 ? FP_NAN : FP_INFINITE; + + return retval; +} + + +int +__isinff (float x) +{ + int32_t ix,t; + GET_FLOAT_WORD(ix,x); + t = ix & 0x7fffffff; + t ^= 0x7f800000; + t |= -t; + return ~(t >> 31) & (ix >> 30); +} + +/* Return nonzero value if arguments are unordered. */ +# define fpclassify(x) \ + (sizeof (x) == sizeof (float) ? __fpclassifyf (x) : __fpclassifyf (x)) + +# ifndef isunordered +# define isunordered(u, v) \ + (__extension__ \ + ({ __typeof__(u) __u = (u); __typeof__(v) __v = (v); \ + fpclassify (__u) == FP_NAN || fpclassify (__v) == FP_NAN; })) +# endif + +/* Return nonzero value if X is less than Y. */ +# ifndef isless +# define isless(x, y) \ + (__extension__ \ + ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \ + !isunordered (__x, __y) && __x < __y; })) +# endif + +/* Return nonzero value if X is greater than Y. */ +# ifndef isgreater +# define isgreater(x, y) \ + (__extension__ \ + ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \ + !isunordered (__x, __y) && __x > __y; })) +# endif + +union ieee754_double + { + double d; + + /* This is the IEEE 754 double-precision format. */ + struct + { +#if defined(ROCKBOX_BIG_ENDIAN) + unsigned int negative:1; + unsigned int exponent:11; + /* Together these comprise the mantissa. */ + unsigned int mantissa0:20; + unsigned int mantissa1:32; +#else +# if __FLOAT_WORD_ORDER == __BIG_ENDIAN + unsigned int mantissa0:20; + unsigned int exponent:11; + unsigned int negative:1; + unsigned int mantissa1:32; +# else + /* Together these comprise the mantissa. */ + unsigned int mantissa1:32; + unsigned int mantissa0:20; + unsigned int exponent:11; + unsigned int negative:1; +# endif +#endif /* Little endian. */ + } ieee; + + /* This format makes it easier to see if a NaN is a signalling NaN. */ + struct + { +#if defined(ROCKBOX_BIG_ENDIAN) + unsigned int negative:1; + unsigned int exponent:11; + unsigned int quiet_nan:1; + /* Together these comprise the mantissa. */ + unsigned int mantissa0:19; + unsigned int mantissa1:32; +#else +# if __FLOAT_WORD_ORDER == __BIG_ENDIAN + unsigned int mantissa0:19; + unsigned int quiet_nan:1; + unsigned int exponent:11; + unsigned int negative:1; + unsigned int mantissa1:32; +# else + /* Together these comprise the mantissa. */ + unsigned int mantissa1:32; + unsigned int mantissa0:19; + unsigned int quiet_nan:1; + unsigned int exponent:11; + unsigned int negative:1; +# endif +#endif + } ieee_nan; + }; + + +static const volatile float TWOM100 = 7.88860905e-31; +static const volatile float TWO127 = 1.7014118346e+38; + +float rb_exp(float x) +{ + static const float himark = 88.72283935546875; + static const float lomark = -103.972084045410; + /* Check for usual case. */ + if (isless (x, himark) && isgreater (x, lomark)) + { + static const float THREEp42 = 13194139533312.0; + static const float THREEp22 = 12582912.0; + /* 1/ln(2). */ +#undef M_1_LN2 + static const float M_1_LN2 = 1.44269502163f; + /* ln(2) */ +#undef M_LN2 + static const double M_LN2 = .6931471805599452862; + + int tval; + double x22, t, result, dx; + float n, delta; + union ieee754_double ex2_u; +#ifndef ROCKBOX + fenv_t oldenv; + + feholdexcept (&oldenv); +#endif + +#ifdef FE_TONEAREST + fesetround (FE_TONEAREST); +#endif + + /* Calculate n. */ + n = x * M_1_LN2 + THREEp22; + n -= THREEp22; + dx = x - n*M_LN2; + + /* Calculate t/512. */ + t = dx + THREEp42; + t -= THREEp42; + dx -= t; + + /* Compute tval = t. */ + tval = (int) (t * 512.0); + + if (t >= 0) + delta = - __exp_deltatable[tval]; + else + delta = __exp_deltatable[-tval]; + + /* Compute ex2 = 2^n e^(t/512+delta[t]). */ + ex2_u.d = __exp_atable[tval+177]; + ex2_u.ieee.exponent += (int) n; + + /* Approximate e^(dx+delta) - 1, using a second-degree polynomial, + with maximum error in [-2^-10-2^-28,2^-10+2^-28] + less than 5e-11. */ + x22 = (0.5000000496709180453 * dx + 1.0000001192102037084) * dx + delta; + + /* Return result. */ +#ifndef ROCKBOX + fesetenv (&oldenv); +#endif + + result = x22 * ex2_u.d + ex2_u.d; + return (float) result; + } + /* Exceptional cases: */ + else if (isless (x, himark)) + { + if (__isinff (x)) + /* e^-inf == 0, with no error. */ + return 0; + else + /* Underflow */ + return TWOM100 * TWOM100; + } + else + /* Return x, if x is a NaN or Inf; or overflow, otherwise. */ + return TWO127*x; +} + + +/* Division with rest, original. */ +div_t div(int x, int y) +{ + div_t result; + + result.quot = x / y; + result.rem = x % y; + + /* Addition from glibc-2.8: */ + if(x >= 0 && result.rem < 0) + { + result.quot += 1; + result.rem -= y; + } + + return result; +} + + +/* Placeholder function. */ +/* Originally defined in s_midi.c */ +void sys_listmididevs(void) +{ +} + +/* Placeholder function, + as we do sleep in the core thread + and not in the scheduler function. */ +/* Originally defined in s_inter.c */ +void sys_microsleep(int microsec) +{ + (void) microsec; +} + +/* Get running time in milliseconds. */ +/* Originally defined in s_inter.c */ +extern uint64_t runningtime; +t_time sys_getrealtime(void) +{ + return runningtime; +} + +/* Place holder, as we do no IPC. */ +/* Originally defined in s_inter.c */ +void glob_ping(void* dummy) +{ + (void) dummy; +} + +/* Call to quit. */ +/* Originally defined in s_inter.c */ +extern bool quit; +void glob_quit(void* dummy) +{ + (void) dummy; + + static bool reentered = false; + + if(!reentered) + { + reentered = true; + + /* Close audio subsystem. */ + sys_close_audio(); + + /* Stop main loop. */ + quit = true; + } +} + +/* Open file. Originally in s_main.c */ +void glob_evalfile(t_pd *ignore, t_symbol *name, t_symbol *dir); +void openit(const char *dirname, const char *filename) +{ + char dirbuf[MAXPDSTRING], *nameptr; + + /* Workaround: If the file resides in the root directory, + add a trailing slash to prevent directory part + of the filename from being removed. */ + char ffilename[MAXPDSTRING]; + ffilename[0] = '/'; + ffilename[1] = '\0'; + strcat(ffilename, filename); + + int fd = open_via_path(dirname, ffilename, "", dirbuf, &nameptr, + MAXPDSTRING, 0); + if (fd) + { + close (fd); + glob_evalfile(0, gensym(nameptr), gensym(dirbuf)); + } + else + error("%s: can't open", filename); +} + + +/* Get current working directory. */ +extern char* filename; +char* rb_getcwd(char* buf, ssize_t size) +{ + char* end_of_dir = strrchr(filename, '/'); + + /* Check whether buffer may hold enough data. */ + if(size < end_of_dir - filename) + return NULL; + + /* Copy current working directory to buffer. */ + strncpy(buf, filename, end_of_dir - filename); + return buf; +} + + +/* Execute instructions supplied on command-line. + Basically a placeholder, because the only + command line argument we get is the name of the .pd file. */ +/* Originally defined in s_main.c */ +extern t_namelist* sys_openlist; +void glob_initfromgui(void *dummy, t_symbol *s, int argc, t_atom *argv) +{ + (void) dummy; + (void) s; + (void) argc; + (void) argv; + + t_namelist *nl; + char cwd[MAXPDSTRING]; + + /* Get current working directory. */ + rb_getcwd(cwd, MAXPDSTRING); + + /* open patches specifies with "-open" args */ + for(nl = sys_openlist; nl; nl = nl->nl_next) + openit(cwd, nl->nl_string); + namelist_free(sys_openlist); + sys_openlist = 0; +} + +/* Fake GUI start. Originally in s_inter.c */ +static int defaultfontshit[] = { + 8, 5, 9, 10, 6, 10, 12, 7, 13, 14, 9, 17, 16, 10, 19, 24, 15, 28, + 24, 15, 28}; +extern t_binbuf* inbinbuf; +int sys_startgui(const char *guidir) +{ + unsigned int i; + t_atom zz[23]; + char cmdbuf[4*MAXPDSTRING]; + + (void) guidir; + + inbinbuf = binbuf_new(); + + if(!rb_getcwd(cmdbuf, MAXPDSTRING)) + strcpy(cmdbuf, "."); + SETSYMBOL(zz, gensym(cmdbuf)); + for (i = 1; i < 22; i++) + SETFLOAT(zz + i, defaultfontshit[i-1]); + SETFLOAT(zz+22,0); + + glob_initfromgui(0, 0, 23, zz); + + return 0; +} + +/* Return default DAC block size. */ +/* Originally defined in s_main.c */ +int sys_getblksize(void) +{ + return (DEFDACBLKSIZE); +} + +/* Find library directory and set it. */ +void sys_findlibdir(const char* filename) +{ + char sbuf[MAXPDSTRING]; + + (void) filename; + + /* Make current working directory the system library directory. */ + rb_getcwd(sbuf, MAXPDSTRING); + sys_libdir = gensym(sbuf); +} diff --git a/apps/plugins/pdbox/pdbox-net.c b/apps/plugins/pdbox/pdbox-net.c index 83d9bd3b7d..f0f7013488 100644 --- a/apps/plugins/pdbox/pdbox-net.c +++ b/apps/plugins/pdbox/pdbox-net.c @@ -68,7 +68,7 @@ bool send_datagram(struct event_queue* route, return false; /* Copy datagram to the buffer. */ - rb->memcpy(datagrams[i].data, data, size); + memcpy(datagrams[i].data, data, size); datagrams[i].size = size; /* Mark datagram buffer as used. */ @@ -101,7 +101,7 @@ bool receive_datagram(struct event_queue* route, return false; /* Copy datagram. */ - rb->memcpy(buffer, (struct datagram*) event.data, sizeof(struct datagram)); + memcpy(buffer, (struct datagram*) event.data, sizeof(struct datagram)); /* Free datagram buffer. */ ((struct datagram*) event.data)->used = false; diff --git a/apps/plugins/pdbox/pdbox.c b/apps/plugins/pdbox/pdbox.c index d6e25ca3fa..0f3728e586 100644 --- a/apps/plugins/pdbox/pdbox.c +++ b/apps/plugins/pdbox/pdbox.c @@ -22,31 +22,76 @@ #include "plugin.h" #include "pdbox.h" +#include "m_pd.h" +#include "s_stuff.h" + /* Welcome to the PDBox plugin */ PLUGIN_HEADER PLUGIN_IRAM_DECLARE +/* Name of the file to open. */ +char* filename; + +/* Running time. */ +uint64_t runningtime = 0; + +/* Variables for Pure Data. */ +int sys_verbose; +int sys_noloadbang; +t_symbol *sys_libdir; +t_namelist *sys_openlist; +int sys_nsoundin = 0; +int sys_soundindevlist[MAXAUDIOINDEV]; +int sys_nchin = 0; +int sys_chinlist[MAXAUDIOINDEV]; +int sys_nsoundout = 1; +int sys_soundoutdevlist[MAXAUDIOOUTDEV]; +int sys_nchout = 2; +int sys_choutlist[MAXAUDIOOUTDEV]; +static int sys_main_srate = PD_SAMPLERATE; +static int sys_main_advance = PD_SAMPLES_PER_HZ; + +/* References for scheduler variables and functions. */ +extern t_time sys_time; +extern t_time sys_time_per_dsp_tick; +extern void sched_tick(t_time next_sys_time); + +#define SAMPLES_SIZE 1000 +t_sample samples[SAMPLES_SIZE]; + /* Quit flag. */ bool quit = false; /* Thread IDs. */ unsigned int core_thread_id; unsigned int gui_thread_id; +unsigned int time_thread_id; /* Stacks for threads. */ #define STACK_SIZE 16384 uint32_t core_stack[STACK_SIZE / sizeof(uint32_t)]; uint32_t gui_stack[STACK_SIZE / sizeof(uint32_t)]; +uint32_t time_stack[256 / sizeof(uint32_t)]; -/* Core thread */ +/* Core thread, scheduler. */ void core_thread(void) { - struct datagram ping; +/* struct datagram ping; */ + + /* LATER consider making this variable. It's now the LCM of all sample + rates we expect to see: 32000, 44100, 48000, 88200, 96000. */ + #define TIMEUNITPERSEC (32.*441000.) + + sys_time = 0; + sys_time_per_dsp_tick = (TIMEUNITPERSEC) * + ((double)sys_schedblocksize) / sys_dacsr; + /* Main loop */ while(!quit) { +#if 0 /* Wait for request. */ while(!RECEIVE_TO_CORE(&ping)) rb->yield(); @@ -56,8 +101,13 @@ void core_thread(void) SEND_FROM_CORE("Pong!"); break; } +#endif + + /* Use sys_send_dacs() function as timer. */ + if(sys_send_dacs() != SENDDACS_NO) + sched_tick(sys_time + sys_time_per_dsp_tick); - rb->yield(); + rb->sleep(1); } rb->thread_exit(); @@ -66,11 +116,12 @@ void core_thread(void) /* GUI thread */ void gui_thread(void) { - struct datagram pong; +/* struct datagram pong; */ /* GUI loop */ while(!quit) { +#if 0 /* Send ping to the core. */ SEND_TO_CORE("Ping!"); rb->splash(HZ, "Sent ping."); @@ -86,8 +137,22 @@ void gui_thread(void) quit = true; break; } +#endif + + rb->sleep(1); + } + + rb->thread_exit(); +} - rb->yield(); +/* Running time thread. */ +void time_thread(void) +{ + while(!quit) + { + /* Add time slice in milliseconds. */ + runningtime += (1000 / HZ); + rb->sleep(1); } rb->thread_exit(); @@ -99,11 +164,12 @@ enum plugin_status plugin_start(const void* parameter) { PLUGIN_IRAM_INIT(rb) + /* Memory pool variables. */ size_t mem_size; void* mem_pool; /* Get the file name. */ - const char* filename = (const char*) parameter; + filename = (char*) parameter; /* Allocate memory; check it's size; add to the pool. */ mem_pool = rb->plugin_get_audio_buffer(&mem_size); @@ -117,7 +183,35 @@ enum plugin_status plugin_start(const void* parameter) /* Initialize net. */ net_init(); + /* Initialize Pure Data, as does sys_main in s_main.c */ + pd_init(); + + /* Add the directory the called .pd resides in to lib directories. */ + sys_findlibdir(filename); + + /* Open the parameter file. */ + sys_openlist = namelist_append(sys_openlist, filename); + + /* Set audio API. */ + sys_set_audio_api(API_ROCKBOX); + + /* Fake a GUI start. */ + sys_startgui(NULL); + + /* Initialize audio subsystem. */ + sys_open_audio(sys_nsoundin, sys_soundindevlist, sys_nchin, sys_chinlist, + sys_nsoundout, sys_soundoutdevlist, sys_nchout, sys_choutlist, + sys_main_srate, sys_main_advance, 1); + /* Start threads. */ + time_thread_id = + rb->create_thread(&time_thread, + time_stack, + sizeof(time_stack), + 0, /* FIXME Which flags? */ + "PD running time" + IF_PRIO(, PRIORITY_REALTIME) + IF_COP(, COP)); core_thread_id = rb->create_thread(&core_thread, core_stack, @@ -142,11 +236,12 @@ enum plugin_status plugin_start(const void* parameter) /* Wait for quit flag. */ while(!quit) - rb->yield(); + yield(); /* Wait for threads to complete. */ rb->thread_wait(gui_thread_id); rb->thread_wait(core_thread_id); + rb->thread_wait(time_thread_id); /* Destroy net. */ net_destroy(); diff --git a/apps/plugins/pdbox/pdbox.h b/apps/plugins/pdbox/pdbox.h index 640bc43aca..fbca4989dc 100644 --- a/apps/plugins/pdbox/pdbox.h +++ b/apps/plugins/pdbox/pdbox.h @@ -26,9 +26,69 @@ #include "bmalloc.h" #include "dmalloc.h" +/* Pure Data */ +#include "m_pd.h" + + +/* dbestfit declarations. */ + /* Minimal memory size. */ #define MIN_MEM_SIZE (4 * 1024 * 1024) + +/* Audio declarations. */ +#define PD_SAMPLERATE 32000 +#define PD_SAMPLES_QUOT (PD_SAMPLERATE / HZ) +#define PD_SAMPLES_REM (PD_SAMPLERATE % HZ) +#if PD_SAMPLES_REM == 0 + #define PD_SAMPLES_PER_HZ (PD_SAMPLES_QUOT) +#else + #define PD_SAMPLES_PER_HZ (PD_SAMPLES_QUOT + 1) +#endif + +/* Audio data types. */ +#define PD_AUDIO_BLOCK_SIZE PD_SAMPLES_PER_HZ +struct pdbox_audio_block +{ + unsigned int fill; + int32_t data[PD_AUDIO_BLOCK_SIZE]; +}; + + +/* Additional functions. */ +char *rb_strncat(char *s, const char *t, size_t n); +double rb_strtod(const char*, char**); +double rb_atof(const char*); +void rb_ftoan(float, char*, int); +float rb_floor(float); +long rb_atol(const char* s); +float rb_sin(float rad); +float rb_cos(float rad); +int rb_fscanf_f(int fd, float* f); +int rb_fprintf_f(int fd, float f); +float rb_log10(float); +float rb_log(float); +float rb_exp(float); +float rb_pow(float, float); +float rb_sqrt(float); +float rb_fabs(float); +float rb_atan(float); +float rb_atan2(float, float); +float rb_sinh(float); +float rb_tan(float); +typedef struct +{ + int quot; + int rem; +} +div_t; +div_t div(int x, int y); +void sys_findlibdir(const char* filename); +int sys_startgui(const char *guidir); + + +/* Network declarations. */ + /* Maximal size of the datagram. */ #define MAX_DATAGRAM_SIZE 255 @@ -40,7 +100,7 @@ struct datagram char data[MAX_DATAGRAM_SIZE]; }; -/* Network functions prototypes. */ +/* Prototypes of network functions. */ void net_init(void); void net_destroy(void); bool send_datagram(struct event_queue* route, int port, @@ -58,13 +118,43 @@ extern struct event_queue core_to_gui; /* Convinience macros. */ #define SEND_TO_CORE(data) \ - send_datagram(&gui_to_core, PD_CORE_PORT, data, rb->strlen(data)) + send_datagram(&gui_to_core, PD_CORE_PORT, data, strlen(data)) #define RECEIVE_TO_CORE(buffer) \ receive_datagram(&gui_to_core, PD_CORE_PORT, buffer) #define SEND_FROM_CORE(data) \ - send_datagram(&core_to_gui, PD_GUI_PORT, data, rb->strlen(data)) + send_datagram(&core_to_gui, PD_GUI_PORT, data, strlen(data)) #define RECEIVE_FROM_CORE(buffer) \ receive_datagram(&core_to_gui, PD_GUI_PORT, buffer) -#endif +/* PD core message callback. */ +void rockbox_receive_callback(struct datagram* dg); + + +/* Pure Data declarations. */ +/* Pure Data function prototypes. */ +void pd_init(void); + + +/* Redefinitons of ANSI C functions. */ +#include "lib/wrappers.h" + +#define strncat rb_strncat +#define floor rb_floor +#define atof rb_atof +#define atol rb_atol +#define ftoan rb_ftoan +#define sin rb_sin +#define cos rb_cos +#define log10 rb_log10 +#define log rb_log +#define exp rb_exp +#define pow rb_pow +#define sqrt rb_sqrt +#define fabs rb_fabs +#define atan rb_atan +#define atan2 rb_atan2 +#define sinh rb_sinh +#define tan rb_tan + +#endif diff --git a/apps/plugins/pdbox/pdbox.make b/apps/plugins/pdbox/pdbox.make index f2a3e4c646..83147bbbae 100644 --- a/apps/plugins/pdbox/pdbox.make +++ b/apps/plugins/pdbox/pdbox.make @@ -16,17 +16,17 @@ PDBOX_SRC := $(call preprocess, $(PDBOXSRCDIR)/SOURCES) PDBOX_OBJ := $(call c2obj, $(PDBOX_SRC)) # add source files to OTHERSRC to get automatic dependencies -OTHER_SRC += $(PDBOX_SRC) +OTHERSRC += $(PDBOX_SRC) $(PDBOXBUILDDIR)/pdbox.rock: $(PDBOX_OBJ) PDBOXFLAGS = $(PLUGINFLAGS) \ - -DFIXEDPOINT -DSTATIC -DPD \ + -DFIXEDPOINT -DSTATIC -DPD -DUSEAPI_ROCKBOX \ -I$(PDBOXSRCDIR) -I$(PDBOXSRCDIR)/PDa/src \ -DBMALLOC -I$(PDBOXSRCDIR)/dbestfit-3.3 # Compile PDBox with extra flags (adapted from ZXBox) -$(PDBOXBUILDDIR)/%.o: $(PDBOXSRCDIR)/%.c $(PDBOXSRCDIR)/pdbox.h $(PDBOXSRCDIR)/pdbox.make +$(PDBOXBUILDDIR)/%.o: $(PDBOXSRCDIR)/%.c $(PLUGINBITMAPLIB) $(PDBOXSRCDIR)/pdbox.make $(SILENT)mkdir -p $(dir $@) $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) -I$(dir $<) $(PDBOXFLAGS) -c $< -o $@ -- cgit v1.2.3