aboutsummaryrefslogtreecommitdiff
path: root/pd
diff options
context:
space:
mode:
Diffstat (limited to 'pd')
-rw-r--r--pd/doc/5.reference/spigot-help.pd34
-rw-r--r--pd/doc/7.stuff/tools/testtone.pd124
-rw-r--r--pd/extra/bonk~/bonk~.c956
-rw-r--r--pd/extra/choice/choice.c52
-rw-r--r--pd/extra/expr~/fts_to_pd.h16
-rw-r--r--pd/extra/expr~/makefile2
-rw-r--r--pd/extra/expr~/vexp.c3432
-rw-r--r--pd/extra/expr~/vexp.h258
-rw-r--r--pd/extra/expr~/vexp_fun.c1590
-rw-r--r--pd/extra/expr~/vexp_if.c1696
-rw-r--r--pd/extra/fiddle~/fiddle~.c1527
-rw-r--r--pd/extra/loop~/loop~.c98
-rw-r--r--pd/extra/lrshift~/lrshift~.c24
-rw-r--r--pd/extra/pique/pique.c222
-rw-r--r--pd/portaudio/pa_common/pa_allocation.obin1744 -> 0 bytes
-rw-r--r--pd/portaudio/pa_common/pa_converters.obin20384 -> 0 bytes
-rw-r--r--pd/portaudio/pa_common/pa_cpuload.obin1452 -> 0 bytes
-rw-r--r--pd/portaudio/pa_common/pa_dither.obin1136 -> 0 bytes
-rw-r--r--pd/portaudio/pa_common/pa_front.obin12576 -> 0 bytes
-rw-r--r--pd/portaudio/pa_common/pa_process.obin10192 -> 0 bytes
-rw-r--r--pd/portaudio/pa_common/pa_skeleton.obin3468 -> 0 bytes
-rw-r--r--pd/portaudio/pa_common/pa_stream.obin1059 -> 0 bytes
-rw-r--r--pd/portaudio/pa_common/pa_trace.obin584 -> 0 bytes
-rw-r--r--pd/portaudio/pa_linux_alsa/pa_linux_alsa.obin10728 -> 0 bytes
-rw-r--r--pd/portaudio/pa_unix/pa_unix_hostapis.obin768 -> 0 bytes
-rw-r--r--pd/portaudio/pa_unix/pa_unix_util.obin1096 -> 0 bytes
-rw-r--r--pd/portaudio/pa_unix_oss/pa_unix_oss.obin8548 -> 0 bytes
-rw-r--r--pd/portmidi_osx/README2
-rw-r--r--pd/portmidi_osx/pmdarwin.c2
-rw-r--r--pd/portmidi_osx/pmmacosx.c2
-rw-r--r--pd/portmidi_osx/ptdarwin.c2
-rwxr-xr-xpd/src/configure3289
-rw-r--r--pd/src/configure.in2
-rw-r--r--pd/src/d_array.c2
-rw-r--r--pd/src/g_canvas.c15
-rw-r--r--pd/src/g_editor.c21
-rw-r--r--pd/src/g_graph.c18
-rw-r--r--pd/src/g_hdial.c3
-rw-r--r--pd/src/g_io.c4
-rw-r--r--pd/src/g_text.c11
-rw-r--r--pd/src/m_binbuf.c2
-rw-r--r--pd/src/m_pd.h3
-rw-r--r--pd/src/m_sched.c14
-rw-r--r--pd/src/makefile189
-rw-r--r--pd/src/makefile.in3
-rw-r--r--pd/src/notes.txt5
-rw-r--r--pd/src/s_audio.c2
-rw-r--r--pd/src/s_audio_alsa.c28
-rw-r--r--pd/src/s_audio_alsamm.c39
-rw-r--r--pd/src/s_audio_pa.c4
-rw-r--r--pd/src/s_audio_pablio.c14
-rw-r--r--pd/src/s_file.c14
-rw-r--r--pd/src/s_inter.c18
-rw-r--r--pd/src/s_main.c2
-rw-r--r--pd/src/s_midi.c2
-rw-r--r--pd/src/s_path.c4
-rw-r--r--pd/src/t_tkcmd.c2
-rw-r--r--pd/src/u_main.tk39
-rw-r--r--pd/src/x_connective.c6
59 files changed, 7589 insertions, 6205 deletions
diff --git a/pd/doc/5.reference/spigot-help.pd b/pd/doc/5.reference/spigot-help.pd
index 3daf9157..10ff1569 100644
--- a/pd/doc/5.reference/spigot-help.pd
+++ b/pd/doc/5.reference/spigot-help.pd
@@ -1,21 +1,25 @@
-#N canvas 349 223 586 335 12;
-#X msg 25 157 0.5 1000;
-#X floatatom 74 242 1 0 0;
-#X obj 25 267 spigot;
-#X obj 25 300 print;
-#X msg 38 210 walk the cat;
-#X msg 31 182 bang;
+#N canvas 59 19 612 342 12;
#X obj 35 11 spigot;
#X text 100 12 - pass or block messages;
-#X text 99 242 control: nonzero to pass messages \, zero to stop them
-;
-#X text 333 303 updated for Pd version 0.33;
#X text 35 63 Spigot passes messages from its left inlet to its outlet
\, as long as a nonzero number is sent to its right inlet. When its
right inlet gets zero \, incoming messages are "blocked \, " i.e. \,
ignored.;
-#X connect 0 0 2 0;
-#X connect 1 0 2 1;
-#X connect 2 0 3 0;
-#X connect 4 0 2 0;
-#X connect 5 0 2 0;
+#X msg 25 157 0.5 1000;
+#X obj 25 300 print;
+#X msg 38 210 walk the cat;
+#X msg 31 182 bang;
+#X text 128 240 control: nonzero to pass messages \, zero to stop them
+;
+#X obj 25 267 spigot 0;
+#X text 349 310 updated for Pd version 0.38;
+#X obj 92 244 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1
+;
+#X text 450 267;
+#X text 125 267 optional arg sets the initial state (0 by default)
+;
+#X connect 3 0 8 0;
+#X connect 5 0 8 0;
+#X connect 6 0 8 0;
+#X connect 8 0 4 0;
+#X connect 10 0 8 1;
diff --git a/pd/doc/7.stuff/tools/testtone.pd b/pd/doc/7.stuff/tools/testtone.pd
index 30ed70cc..257422f9 100644
--- a/pd/doc/7.stuff/tools/testtone.pd
+++ b/pd/doc/7.stuff/tools/testtone.pd
@@ -56,7 +56,7 @@ started" in the Help menu.;
#X connect 21 0 20 0;
#X restore 236 308 pd midi;
#X floatatom 139 185 3 0 0 0 - - -;
-#X floatatom 172 185 3 0 0 0 - - -;
+#X floatatom 171 185 3 0 0 0 - - -;
#X text 24 341 PD is COPYRIGHT 1997-2002 by Miller Puckette and others
but is free for you to use for any reasonable purpose. See the file
\, LICENSE.txt in the distribution.;
@@ -100,17 +100,29 @@ but is free for you to use for any reasonable purpose. See the file
1 1;
#X obj 260 117 tgl 20 0 tone-ch6 tone-ch6 6 5 -8 0 12 -262144 -1 -1
1 1;
-#X obj 294 108 bng 15 250 50 0 tone-all empty ALL 20 8 0 12 -262144
+#X obj 331 108 bng 15 250 50 0 tone-all empty ALL 20 8 0 12 -262144
-1 -1;
-#X obj 294 129 bng 15 250 50 0 tone-none empty NONE 20 8 0 12 -262144
+#X obj 331 129 bng 15 250 50 0 tone-none empty NONE 20 8 0 12 -262144
-1 -1;
-#X floatatom 205 185 3 0 0 0 - - -;
-#X floatatom 238 185 3 0 0 0 - - -;
-#X floatatom 271 186 3 0 0 0 - - -;
-#X floatatom 305 186 3 0 0 0 - - -;
+#X floatatom 204 185 3 0 0 0 - - -;
+#X floatatom 237 185 3 0 0 0 - - -;
+#X floatatom 269 186 3 0 0 0 - - -;
+#X floatatom 302 186 3 0 0 0 - - -;
#X text 154 210 AUDIO INPUT (RMS dB);
#X text 45 62 TEST;
-#N canvas 162 353 903 462 -------audio---- 0;
+#X text 72 174 noise;
+#X text 71 191 tone;
+#X text 44 80 SIGNAL;
+#X text 131 78 test signal channels:;
+#X obj 52 174 vradio 15 1 0 2 tone-type tone-type-set empty 0 -6 0
+8 -262144 -1 -1 1;
+#X obj 51 104 vradio 15 1 0 3 tone-radio tone-radio-set empty 0 -6
+0 8 -262144 -1 -1 2;
+#X obj 379 220 adc~;
+#X obj 379 256 print~;
+#X obj 438 227 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
+#N canvas 162 353 903 462 -------audio----------- 0;
#X obj 186 95 hip~ 5;
#X obj 194 172 outlet;
#X obj 194 146 int;
@@ -284,6 +296,36 @@ but is free for you to use for any reasonable purpose. See the file
#X connect 27 0 20 0;
#X connect 28 0 16 0;
#X restore 24 68 pd tone-generator;
+#X obj 899 96 hip~ 5;
+#X obj 907 173 outlet;
+#X obj 907 147 int;
+#X obj 907 121 env~ 8192;
+#X obj 909 196 r~ tone-mon;
+#X obj 918 331 line~;
+#X obj 899 221 *~;
+#X obj 918 304 pack 0 50;
+#X obj 909 251 r~ tone-osc;
+#X obj 909 356 *~;
+#X obj 899 386 +~;
+#X obj 907 69 r tone-hip;
+#X obj 1019 95 hip~ 5;
+#X obj 1027 172 outlet;
+#X obj 1027 146 int;
+#X obj 1027 120 env~ 8192;
+#X obj 1029 195 r~ tone-mon;
+#X obj 1038 330 line~;
+#X obj 1019 220 *~;
+#X obj 1038 303 pack 0 50;
+#X obj 1029 250 r~ tone-osc;
+#X obj 1029 355 *~;
+#X obj 1019 385 +~;
+#X obj 1027 68 r tone-hip;
+#X obj 918 278 r tone-ch5;
+#X obj 1038 277 r tone-ch6;
+#X obj 899 43 adc~ 7;
+#X obj 1019 42 adc~ 8;
+#X obj 899 411 dac~ 7;
+#X obj 1019 410 dac~ 8;
#X connect 0 0 7 0;
#X connect 0 0 3 0;
#X connect 2 0 1 0;
@@ -373,19 +415,41 @@ but is free for you to use for any reasonable purpose. See the file
#X connect 91 0 57 0;
#X connect 92 0 69 0;
#X connect 93 0 81 0;
-#X restore 139 159 pd -------audio----;
-#X text 72 174 noise;
-#X text 71 191 tone;
-#X text 44 80 SIGNAL;
-#X text 131 78 test signal channels:;
-#X obj 52 174 vradio 15 1 0 2 tone-type tone-type-set empty 0 -6 0
-8 -262144 -1 -1 1;
-#X obj 51 104 vradio 15 1 0 3 tone-radio tone-radio-set empty 0 -6
-0 8 -262144 -1 -1 2;
-#X obj 379 220 adc~;
-#X obj 379 256 print~;
-#X obj 438 227 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
--1;
+#X connect 99 0 105 0;
+#X connect 99 0 102 0;
+#X connect 101 0 100 0;
+#X connect 102 0 101 0;
+#X connect 103 0 105 1;
+#X connect 104 0 108 1;
+#X connect 105 0 109 0;
+#X connect 106 0 104 0;
+#X connect 107 0 108 0;
+#X connect 108 0 109 1;
+#X connect 109 0 127 0;
+#X connect 110 0 99 1;
+#X connect 111 0 117 0;
+#X connect 111 0 114 0;
+#X connect 113 0 112 0;
+#X connect 114 0 113 0;
+#X connect 115 0 117 1;
+#X connect 116 0 120 1;
+#X connect 117 0 121 0;
+#X connect 118 0 116 0;
+#X connect 119 0 120 0;
+#X connect 120 0 121 1;
+#X connect 121 0 128 0;
+#X connect 122 0 111 1;
+#X connect 123 0 106 0;
+#X connect 124 0 118 0;
+#X connect 125 0 99 0;
+#X connect 126 0 111 0;
+#X restore 139 159 pd -------audio-----------;
+#X floatatom 335 186 3 0 0 0 - - -;
+#X floatatom 368 186 3 0 0 0 - - -;
+#X obj 283 117 tgl 20 0 tone-ch7 tone-ch7 7 5 -8 0 12 -262144 -1 -1
+0 1;
+#X obj 308 117 tgl 20 0 tone-ch8 tone-ch8 8 5 -8 0 12 -262144 -1 -1
+0 1;
#X connect 1 0 2 0;
#X connect 1 1 2 1;
#X connect 2 0 3 0;
@@ -393,11 +457,13 @@ but is free for you to use for any reasonable purpose. See the file
#X connect 9 0 8 0;
#X connect 9 1 7 0;
#X connect 16 0 10 0;
-#X connect 35 0 11 0;
-#X connect 35 1 12 0;
-#X connect 35 2 29 0;
-#X connect 35 3 30 0;
-#X connect 35 4 31 0;
-#X connect 35 5 32 0;
-#X connect 42 0 43 0;
-#X connect 44 0 43 0;
+#X connect 41 0 42 0;
+#X connect 43 0 42 0;
+#X connect 44 0 11 0;
+#X connect 44 1 12 0;
+#X connect 44 2 29 0;
+#X connect 44 3 30 0;
+#X connect 44 4 31 0;
+#X connect 44 5 32 0;
+#X connect 44 6 45 0;
+#X connect 44 7 46 0;
diff --git a/pd/extra/bonk~/bonk~.c b/pd/extra/bonk~/bonk~.c
index 6b8cfa76..209ddbcc 100644
--- a/pd/extra/bonk~/bonk~.c
+++ b/pd/extra/bonk~/bonk~.c
@@ -19,12 +19,10 @@ IN CONNECTION WITH THIS SOFTWARE!
#include "ext.h"
#include "z_dsp.h"
#include "math.h"
-//#include "stdio.h"
#include "ext_support.h"
-//#include "ext_strings.h"
#include "ext_proto.h"
-typedef double t_floatarg; // from m_pd.h
+typedef double t_floatarg; /* from m_pd.h */
#define flog log
#define fexp exp
#define fsqrt sqrt
@@ -34,8 +32,8 @@ typedef double t_floatarg; // from m_pd.h
#define fexp exp
#define fsqrt sqrt
-#define FILE_DIALOG 1 /* use dialogs to get file name */
-#define FILE_NAMED 2 /* symbol specifies file name */
+#define FILE_DIALOG 1 /* use dialogs to get file name */
+#define FILE_NAMED 2 /* symbol specifies file name */
#define DUMTAB1SIZE 256
#define DUMTAB2SIZE 1024
@@ -74,7 +72,7 @@ typedef struct _filterkernel
float *k_stuff;
} t_filterkernel;
-#if 0 /* this is the design for 1.0: */
+#if 0 /* this is the design for 1.0: */
static t_filterkernel bonk_filterkernels[] =
{{256, 2, .01562}, {256, 4, .01562}, {256, 6, .01562}, {180, 6, .02222},
{128, 6, .01803}, {90, 6, .02222}, {64, 6, .02362}, {46, 6, .02773},
@@ -108,15 +106,15 @@ typedef struct template
typedef struct _insig
{
- t_hist g_hist[NFILTERS]; /* history for each filter */
+ t_hist g_hist[NFILTERS]; /* history for each filter */
#ifdef PD
- t_outlet *g_outlet; /* outlet for raw data */
+ t_outlet *g_outlet; /* outlet for raw data */
#endif
#ifdef MSP
- void *g_outlet; /* outlet for raw data */
+ void *g_outlet; /* outlet for raw data */
#endif
- float *g_inbuf; /* buffered input samples */
- t_float *g_invec; /* new input samples */
+ float *g_inbuf; /* buffered input samples */
+ t_float *g_invec; /* new input samples */
} t_insig;
typedef struct _bonk
@@ -128,14 +126,14 @@ typedef struct _bonk
#endif /* PD */
#ifdef MSP
t_pxobject x_obj;
- void *x_cookedout; // t_outlet *x_cookedout;
- void *x_clock; // t_clock *x_clock;
- short x_vol; // to store the volume reference number.
+ void *x_cookedout;
+ void *x_clock;
+ short x_vol;
#endif /* MSP */
t_hist x_hist[NFILTERS];
t_template *x_template;
- t_insig *x_insig;
+ t_insig *x_insig;
int x_ninsig;
int x_ntemplate;
int x_infill;
@@ -148,10 +146,10 @@ typedef struct _bonk
int x_masktime;
float x_maskdecay;
int x_learn;
- double x_learndebounce; /* debounce time for "learn" mode */
- int x_learncount; /* countup for "learn" mode */
+ double x_learndebounce; /* debounce time for "learn" mode */
+ int x_learncount; /* countup for "learn" mode */
float x_debouncedecay;
- float x_minvel; /* minimum velocity we output */
+ float x_minvel; /* minimum velocity we output */
float x_debouncevel;
} t_bonk;
@@ -193,11 +191,11 @@ static void bonk_donew(t_bonk *x, int period, int nsig)
for (j = 0, g = x->x_insig; j < nsig; j++, g++)
{
- for (i = 0, h = g->g_hist; i--; h++)
- h->h_power = h->h_mask = h->h_before = 0, h->h_countup = 0;
- /* we ought to check for failure to allocate memory here */
- g->g_inbuf = (float *)getbytes(NPOINTS * sizeof(float));
- for (i = NPOINTS, fp = g->g_inbuf; i--; fp++) *fp = 0;
+ for (i = 0, h = g->g_hist; i--; h++)
+ h->h_power = h->h_mask = h->h_before = 0, h->h_countup = 0;
+ /* we ought to check for failure to allocate memory here */
+ g->g_inbuf = (float *)getbytes(NPOINTS * sizeof(float));
+ for (i = NPOINTS, fp = g->g_inbuf; i--; fp++) *fp = 0;
}
x->x_ninsig = nsig;
x->x_template = (t_template *)getbytes(0);
@@ -239,135 +237,135 @@ static void bonk_dotick(t_bonk *x, int hit)
for (i = ninsig, pp = powerout, gp = x->x_insig; i--; gp++)
{
- for (j = 0, h = gp->g_hist; j < NFILTERS; j++, h++, pp++)
- {
- float power = (hit ? h->h_mask - h->h_before : h->h_power);
- float intensity = *pp =
- (power > 0 ? 100. * qrsqrt(qrsqrt(power)) : 0);
- vel += intensity;
- temperature += intensity * (float)j;
- }
+ for (j = 0, h = gp->g_hist; j < NFILTERS; j++, h++, pp++)
+ {
+ float power = (hit ? h->h_mask - h->h_before : h->h_power);
+ float intensity = *pp =
+ (power > 0 ? 100. * qrsqrt(qrsqrt(power)) : 0);
+ vel += intensity;
+ temperature += intensity * (float)j;
+ }
}
if (vel > 0) temperature /= vel;
else temperature = 0;
- vel *= 0.5 / ninsig; /* fudge factor */
+ vel *= 0.5 / ninsig; /* fudge factor */
if (hit)
{
- /* if hit nonzero it's a clock callback. if in "learn" mode update the
- template list; in any event match the hit to known templates. */
-
- if (vel < x->x_debouncevel)
- {
- if (x->x_debug)
- post("bounce cancelled: vel %f debounce %f",
- vel, x->x_debouncevel);
- return;
- }
- if (vel < x->x_minvel)
- {
- if (x->x_debug)
- post("low velocity cancelled: vel %f, minvel %f",
- vel, x->x_minvel);
- return;
- }
- x->x_debouncevel = vel;
- if (x->x_learn)
- {
- double lasttime = x->x_learndebounce;
- double msec = clock_gettimesince(lasttime);
- if ((!ntemplate) || (msec > 200))
- {
- int countup = x->x_learncount;
- /* normalize to 100 */
- float norm;
- for (i = NFILTERS * ninsig, norm = 0, pp = powerout; i--; pp++)
- norm += *pp * *pp;
- if (norm < 1.0e-15) norm = 1.0e-15;
- norm = 100.f * qrsqrt(norm);
- /* check if this is the first strike for a new template */
- if (!countup)
- {
- int oldn = ntemplate;
- x->x_ntemplate = ntemplate = oldn + ninsig;
- x->x_template = (t_template *)t_resizebytes(x->x_template,
- oldn * sizeof(x->x_template[0]),
- ntemplate * sizeof(x->x_template[0]));
- for (i = ninsig, pp = powerout; i--; oldn++)
- for (j = NFILTERS, fp = x->x_template[oldn].t_amp; j--;
- pp++, fp++)
- *fp = *pp * norm;
- }
- else
- {
- int oldn = ntemplate - ninsig;
- if (oldn < 0) post("bonk_tick bug");
- for (i = ninsig, pp = powerout; i--; oldn++)
- {
- for (j = NFILTERS, fp = x->x_template[oldn].t_amp; j--;
- pp++, fp++)
- *fp = (countup * *fp + *pp * norm)
- /(countup + 1.0f);
- }
- }
- countup++;
- if (countup == x->x_learn) countup = 0;
- x->x_learncount = countup;
- }
- else return;
- }
- x->x_learndebounce = clock_getsystime();
- if (ntemplate)
- {
- float bestfit = -1e30;
- int templatecount;
- nfit = -1;
- for (i = 0, templatecount = 0, tp = x->x_template;
- templatecount < ntemplate; i++)
- {
- float dotprod = 0;
- for (k = 0, pp = powerout;
- k < ninsig && templatecount < ntemplate;
- k++, tp++, templatecount++)
- {
- for (j = NFILTERS, fp = tp->t_amp;
- j--; fp++, pp++)
- {
- if (*fp < 0 || *pp < 0) post("bonk_tick bug 2");
- dotprod += *fp * *pp;
- }
- }
- if (dotprod > bestfit)
- {
- bestfit = dotprod;
- nfit = i;
- }
- }
- if (nfit < 0) post("bonk_tick bug");
- }
- else nfit = 0;
+ /* if hit nonzero it's a clock callback. if in "learn" mode update the
+ template list; in any event match the hit to known templates. */
+
+ if (vel < x->x_debouncevel)
+ {
+ if (x->x_debug)
+ post("bounce cancelled: vel %f debounce %f",
+ vel, x->x_debouncevel);
+ return;
+ }
+ if (vel < x->x_minvel)
+ {
+ if (x->x_debug)
+ post("low velocity cancelled: vel %f, minvel %f",
+ vel, x->x_minvel);
+ return;
+ }
+ x->x_debouncevel = vel;
+ if (x->x_learn)
+ {
+ double lasttime = x->x_learndebounce;
+ double msec = clock_gettimesince(lasttime);
+ if ((!ntemplate) || (msec > 200))
+ {
+ int countup = x->x_learncount;
+ /* normalize to 100 */
+ float norm;
+ for (i = NFILTERS * ninsig, norm = 0, pp = powerout; i--; pp++)
+ norm += *pp * *pp;
+ if (norm < 1.0e-15) norm = 1.0e-15;
+ norm = 100.f * qrsqrt(norm);
+ /* check if this is the first strike for a new template */
+ if (!countup)
+ {
+ int oldn = ntemplate;
+ x->x_ntemplate = ntemplate = oldn + ninsig;
+ x->x_template = (t_template *)t_resizebytes(x->x_template,
+ oldn * sizeof(x->x_template[0]),
+ ntemplate * sizeof(x->x_template[0]));
+ for (i = ninsig, pp = powerout; i--; oldn++)
+ for (j = NFILTERS, fp = x->x_template[oldn].t_amp; j--;
+ pp++, fp++)
+ *fp = *pp * norm;
+ }
+ else
+ {
+ int oldn = ntemplate - ninsig;
+ if (oldn < 0) post("bonk_tick bug");
+ for (i = ninsig, pp = powerout; i--; oldn++)
+ {
+ for (j = NFILTERS, fp = x->x_template[oldn].t_amp; j--;
+ pp++, fp++)
+ *fp = (countup * *fp + *pp * norm)
+ /(countup + 1.0f);
+ }
+ }
+ countup++;
+ if (countup == x->x_learn) countup = 0;
+ x->x_learncount = countup;
+ }
+ else return;
+ }
+ x->x_learndebounce = clock_getsystime();
+ if (ntemplate)
+ {
+ float bestfit = -1e30;
+ int templatecount;
+ nfit = -1;
+ for (i = 0, templatecount = 0, tp = x->x_template;
+ templatecount < ntemplate; i++)
+ {
+ float dotprod = 0;
+ for (k = 0, pp = powerout;
+ k < ninsig && templatecount < ntemplate;
+ k++, tp++, templatecount++)
+ {
+ for (j = NFILTERS, fp = tp->t_amp;
+ j--; fp++, pp++)
+ {
+ if (*fp < 0 || *pp < 0) post("bonk_tick bug 2");
+ dotprod += *fp * *pp;
+ }
+ }
+ if (dotprod > bestfit)
+ {
+ bestfit = dotprod;
+ nfit = i;
+ }
+ }
+ if (nfit < 0) post("bonk_tick bug");
+ }
+ else nfit = 0;
}
- else nfit = -1; /* hit is zero; this is the "bang" method. */
+ else nfit = -1; /* hit is zero; this is the "bang" method. */
if (x->x_debug)
- post("bonk out: number %d, vel %f, temperature %f",
- nfit, vel, temperature);
+ post("bonk out: number %d, vel %f, temperature %f",
+ nfit, vel, temperature);
SETFLOAT(at2, nfit);
SETFLOAT(at2+1, vel);
SETFLOAT(at2+2, temperature);
outlet_list(x->x_cookedout, 0, 3, at2);
for (n = 0, gp = x->x_insig + (ninsig-1),
- pp = powerout + NFILTERS * (ninsig-1);
- n < ninsig; n++, gp--, pp -= NFILTERS)
+ pp = powerout + NFILTERS * (ninsig-1);
+ n < ninsig; n++, gp--, pp -= NFILTERS)
{
- float *pp2;
- for (i = 0, ap = at, pp2 = pp; i < NFILTERS;
- i++, ap++, pp2++)
- {
- ap->a_type = A_FLOAT;
- ap->a_w.w_float = *pp2;
- }
- outlet_list(gp->g_outlet, 0, NFILTERS, at);
+ float *pp2;
+ for (i = 0, ap = at, pp2 = pp; i < NFILTERS;
+ i++, ap++, pp2++)
+ {
+ ap->a_type = A_FLOAT;
+ ap->a_w.w_float = *pp2;
+ }
+ outlet_list(gp->g_outlet, 0, NFILTERS, at);
}
}
@@ -389,88 +387,88 @@ static void bonk_doit(t_bonk *x)
for (n = 0, gp = x->x_insig; n < ninsig; n++, gp++)
{
- for (i = NPOINTS, fp1 = gp->g_inbuf, fp2 = bonk_hanningwindow,
- fp3 = windowbuf; i--; fp1++, fp2++, fp3++)
- *fp3 = *fp1 * *fp2;
-
- for (i = 0, k = bonk_filterkernels, h = gp->g_hist;
- i < NFILTERS; i++, k++, h++)
- {
- float power = 0, maskpow = h->h_mask;
- int countup = h->h_countup;
- int npoints = k->k_npoints;
- /* special case: the fourth filter is centered */
- float *inbuf = gp->g_inbuf +
- (i == 3 ? ((NPOINTS - npoints) / 2) : 0);
-
- /* run the filter repeatedly, sliding it forward by half its
- length, stopping when it runs past the end of the buffer */
- for (fp1 = inbuf, fp2 = fp1 + NPOINTS - k->k_npoints;
- fp1 <= fp2; fp1 += npoints/2)
- {
- float rsum = 0, isum = 0;
- for (fp3 = fp1, fp4 = k->k_stuff, j = npoints; j--;)
- {
- float g = *fp3++;
- rsum += g * *fp4++;
- isum += g * *fp4++;
- }
- power += rsum * rsum + isum * isum;
- }
-
- if (!x->x_willattack) h->h_before = maskpow;
-
- if (power > maskpow)
- growth += power/(maskpow + 1.0e-15) - 1.f;
- if (!x->x_willattack && countup >= x->x_masktime)
- maskpow *= x->x_maskdecay;
-
- if (power > maskpow)
- {
- maskpow = power;
- countup = 0;
- }
- countup++;
- h->h_countup = countup;
- h->h_mask = maskpow;
- h->h_power = power;
- }
+ for (i = NPOINTS, fp1 = gp->g_inbuf, fp2 = bonk_hanningwindow,
+ fp3 = windowbuf; i--; fp1++, fp2++, fp3++)
+ *fp3 = *fp1 * *fp2;
+
+ for (i = 0, k = bonk_filterkernels, h = gp->g_hist;
+ i < NFILTERS; i++, k++, h++)
+ {
+ float power = 0, maskpow = h->h_mask;
+ int countup = h->h_countup;
+ int npoints = k->k_npoints;
+ /* special case: the fourth filter is centered */
+ float *inbuf = gp->g_inbuf +
+ (i == 3 ? ((NPOINTS - npoints) / 2) : 0);
+
+ /* run the filter repeatedly, sliding it forward by half its
+ length, stopping when it runs past the end of the buffer */
+ for (fp1 = inbuf, fp2 = fp1 + NPOINTS - k->k_npoints;
+ fp1 <= fp2; fp1 += npoints/2)
+ {
+ float rsum = 0, isum = 0;
+ for (fp3 = fp1, fp4 = k->k_stuff, j = npoints; j--;)
+ {
+ float g = *fp3++;
+ rsum += g * *fp4++;
+ isum += g * *fp4++;
+ }
+ power += rsum * rsum + isum * isum;
+ }
+
+ if (!x->x_willattack) h->h_before = maskpow;
+
+ if (power > maskpow)
+ growth += power/(maskpow + 1.0e-15) - 1.f;
+ if (!x->x_willattack && countup >= x->x_masktime)
+ maskpow *= x->x_maskdecay;
+
+ if (power > maskpow)
+ {
+ maskpow = power;
+ countup = 0;
+ }
+ countup++;
+ h->h_countup = countup;
+ h->h_mask = maskpow;
+ h->h_power = power;
+ }
}
if (x->x_willattack > 4)
{
- /* if it takes more than 4 analyses for the energy to stop growing,
- forget it; we would rather miss the note than report it late. */
- if (x->x_debug) post("soft attack cancelled");
- x->x_willattack = 0;
+ /* if it takes more than 4 analyses for the energy to stop growing,
+ forget it; we would rather miss the note than report it late. */
+ if (x->x_debug) post("soft attack cancelled");
+ x->x_willattack = 0;
}
else if (x->x_willattack)
{
- if (growth < x->x_lothresh)
- clock_delay(x->x_clock, 0);
- else x->x_willattack++;
+ if (growth < x->x_lothresh)
+ clock_delay(x->x_clock, 0);
+ else x->x_willattack++;
}
else if (growth > x->x_hithresh)
{
- if (x->x_debug) post("attack; growth = %f", growth);
- x->x_willattack = 1;
- for (n = 0, gp = x->x_insig; n < ninsig; n++, gp++)
- for (i = NFILTERS, h = gp->g_hist; i--; h++)
- h->h_mask = h->h_power, h->h_countup = 0;
+ if (x->x_debug) post("attack; growth = %f", growth);
+ x->x_willattack = 1;
+ for (n = 0, gp = x->x_insig; n < ninsig; n++, gp++)
+ for (i = NFILTERS, h = gp->g_hist; i--; h++)
+ h->h_mask = h->h_power, h->h_countup = 0;
}
x->x_debouncevel *= x->x_debouncedecay;
- /* shift the input buffer and update counters */
+ /* shift the input buffer and update counters */
if (x->x_period > NPOINTS) x->x_countdown = x->x_period - NPOINTS;
else x->x_countdown = 0;
if (x->x_period < NPOINTS)
{
- int overlap = NPOINTS - x->x_period;
-
- for (n = 0, gp = x->x_insig; n < ninsig; n++, gp++)
- for (i = overlap, fp1 = gp->g_inbuf, fp2 = fp1 + x->x_period; i--;)
- *fp1++ = *fp2++;
- x->x_infill = overlap;
+ int overlap = NPOINTS - x->x_period;
+
+ for (n = 0, gp = x->x_insig; n < ninsig; n++, gp++)
+ for (i = overlap, fp1 = gp->g_inbuf, fp2 = fp1 + x->x_period; i--;)
+ *fp1++ = *fp2++;
+ x->x_infill = overlap;
}
else x->x_infill = 0;
poodle = 1;
@@ -484,18 +482,18 @@ static t_int *bonk_perform(t_int *w)
if (x->x_countdown > 0) x->x_countdown -= n;
else
{
- int i, j, infill = x->x_infill, ninsig = x->x_ninsig;
- t_insig *gp;
- for (i = 0, gp = x->x_insig; i < ninsig; i++, gp++)
- {
- float *fp = gp->g_inbuf + infill;
- t_float *in1 = gp->g_invec + onset;
- for (j = 0; j < n; j++)
- *fp++ = *in1++;
- }
- infill += n;
- x->x_infill = infill;
- if (infill == NPOINTS) bonk_doit(x);
+ int i, j, infill = x->x_infill, ninsig = x->x_ninsig;
+ t_insig *gp;
+ for (i = 0, gp = x->x_insig; i < ninsig; i++, gp++)
+ {
+ float *fp = gp->g_inbuf + infill;
+ t_float *in1 = gp->g_invec + onset;
+ for (j = 0; j < n; j++)
+ *fp++ = *in1++;
+ }
+ infill += n;
+ x->x_infill = infill;
+ if (infill == NPOINTS) bonk_doit(x);
}
return (w+4);
}
@@ -507,16 +505,16 @@ static void bonk_dsp(t_bonk *x, t_signal **sp)
if (vsize > n) vsize = n;
for (i = 0, gp = x->x_insig; i < ninsig; i++, gp++)
- gp->g_invec = (*(sp++))->s_vec;
+ gp->g_invec = (*(sp++))->s_vec;
for (i = 0; i < n; i += vsize)
- dsp_add(bonk_perform, 3, x, vsize, i);
+ dsp_add(bonk_perform, 3, x, vsize, i);
}
static void bonk_thresh(t_bonk *x, t_floatarg f1, t_floatarg f2)
{
if (f1 > f2)
- post("bonk: warning: low threshold greater than hi threshold");
+ post("bonk: warning: low threshold greater than hi threshold");
x->x_lothresh = f1;
x->x_hithresh = f2;
}
@@ -553,36 +551,36 @@ static void bonk_print(t_bonk *x, t_floatarg f)
post("minvel %f", x->x_minvel);
if (x->x_ntemplate)
{
- post("templates:");
- for (i = 0; i < x->x_ntemplate; i++)
- post("%2d \
+ post("templates:");
+ for (i = 0; i < x->x_ntemplate; i++)
+ post("%2d \
%5.2f %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f", i,
- x->x_template[i].t_amp[0],
- x->x_template[i].t_amp[1],
- x->x_template[i].t_amp[2],
- x->x_template[i].t_amp[3],
- x->x_template[i].t_amp[4],
- x->x_template[i].t_amp[5],
- x->x_template[i].t_amp[6],
- x->x_template[i].t_amp[7],
- x->x_template[i].t_amp[8],
- x->x_template[i].t_amp[9],
- x->x_template[i].t_amp[10]);
+ x->x_template[i].t_amp[0],
+ x->x_template[i].t_amp[1],
+ x->x_template[i].t_amp[2],
+ x->x_template[i].t_amp[3],
+ x->x_template[i].t_amp[4],
+ x->x_template[i].t_amp[5],
+ x->x_template[i].t_amp[6],
+ x->x_template[i].t_amp[7],
+ x->x_template[i].t_amp[8],
+ x->x_template[i].t_amp[9],
+ x->x_template[i].t_amp[10]);
}
else post("no templates");
if (x->x_learn) post("learn mode");
if (f != 0)
{
- int j, ninsig = x->x_ninsig;
- t_insig *gp;
- for (j = 0, gp = x->x_insig; j < ninsig; j++, gp++)
- {
- t_hist *h;
- if (ninsig > 1) post("input %d:", j+1);
- for (i = NFILTERS, h = gp->g_hist; i--; h++)
- post("pow %f mask %f before %f count %d",
- h->h_power, h->h_mask, h->h_before, h->h_countup);
- }
+ int j, ninsig = x->x_ninsig;
+ t_insig *gp;
+ for (j = 0, gp = x->x_insig; j < ninsig; j++, gp++)
+ {
+ t_hist *h;
+ if (ninsig > 1) post("input %d:", j+1);
+ for (i = NFILTERS, h = gp->g_hist; i--; h++)
+ post("pow %f mask %f before %f count %d",
+ h->h_power, h->h_mask, h->h_before, h->h_countup);
+ }
}
if (x->x_debug) post("debug mode");
}
@@ -598,9 +596,9 @@ static void bonk_learn(t_bonk *x, t_floatarg f)
if (n < 0) n = 0;
if (n)
{
- x->x_template = (t_template *)t_resizebytes(x->x_template,
- x->x_ntemplate * sizeof(x->x_template[0]), 0);
- x->x_ntemplate = 0;
+ x->x_template = (t_template *)t_resizebytes(x->x_template,
+ x->x_ntemplate * sizeof(x->x_template[0]), 0);
+ x->x_ntemplate = 0;
}
x->x_learn = n;
x->x_learncount = 0;
@@ -611,8 +609,8 @@ static void bonk_forget(t_bonk *x)
int ntemplate = x->x_ntemplate, newn = ntemplate - x->x_ninsig;
if (newn < 0) newn = 0;
x->x_template = (t_template *)t_resizebytes(x->x_template,
- x->x_ntemplate * sizeof(x->x_template[0]),
- newn * sizeof(x->x_template[0]));
+ x->x_ntemplate * sizeof(x->x_template[0]),
+ newn * sizeof(x->x_template[0]));
x->x_ntemplate = newn;
x->x_learncount = 0;
}
@@ -630,12 +628,12 @@ static void bonk_bang(t_bonk *x)
outlet_list(x->x_cookedout, 0L, 3, at2);
for (i = 0, gp = x->x_insig + (ninsig-1); i < ninsig; i++, gp--)
{
- for (j = 0; j < NFILTERS; j++)
- {
- at[j].a_type = A_FLOAT;
- at[j].a_w.w_float = 100 * qrsqrt(qrsqrt(gp->g_hist[j].h_power));
- }
- outlet_list(gp->g_outlet, 0L, NFILTERS, at);
+ for (j = 0; j < NFILTERS; j++)
+ {
+ at[j].a_type = A_FLOAT;
+ at[j].a_w.w_float = 100 * qrsqrt(qrsqrt(gp->g_hist[j].h_power));
+ }
+ outlet_list(gp->g_outlet, 0L, NFILTERS, at);
}
}
#endif
@@ -651,22 +649,22 @@ static void bonk_setupkernels(void)
float *fp;
for (i = 0; i < NFILTERS; i++)
{
- int npoints = bonk_filterkernels[i].k_npoints;
- float freq = bonk_filterkernels[i].k_freq;
- float normalize = bonk_filterkernels[i].k_normalize;
- float phaseinc = (2.f * 3.14159f) / npoints;
- bonk_filterkernels[i].k_stuff =
- (float *)getbytes(2 * sizeof(float) * npoints);
- for (fp = bonk_filterkernels[i].k_stuff, j = npoints; j--;)
- {
- float phase = j * phaseinc;
- float window = normalize * (0.5f - 0.5f * cos(phase));
- *fp++ = window * cos(freq * phase);
- *fp++ = window * sin(freq * phase);
- }
+ int npoints = bonk_filterkernels[i].k_npoints;
+ float freq = bonk_filterkernels[i].k_freq;
+ float normalize = bonk_filterkernels[i].k_normalize;
+ float phaseinc = (2.f * 3.14159f) / npoints;
+ bonk_filterkernels[i].k_stuff =
+ (float *)getbytes(2 * sizeof(float) * npoints);
+ for (fp = bonk_filterkernels[i].k_stuff, j = npoints; j--;)
+ {
+ float phase = j * phaseinc;
+ float window = normalize * (0.5f - 0.5f * cos(phase));
+ *fp++ = window * cos(freq * phase);
+ *fp++ = window * sin(freq * phase);
+ }
}
for (i = 0; i < NPOINTS; i++)
- bonk_hanningwindow[i] = (0.5f - 0.5f * cos(i * (2*3.14159)/NPOINTS));
+ bonk_hanningwindow[i] = (0.5f - 0.5f * cos(i * (2*3.14159)/NPOINTS));
}
#ifdef PD
@@ -678,31 +676,31 @@ static void bonk_read(t_bonk *x, t_symbol *s)
float *fp, *fp2;
if (!fd)
{
- post("%s: open failed", s->s_name);
- return;
+ post("%s: open failed", s->s_name);
+ return;
}
x->x_template = (t_template *)t_resizebytes(x->x_template,
- x->x_ntemplate * sizeof(t_template), 0);
+ x->x_ntemplate * sizeof(t_template), 0);
while (1)
{
- for (i = NFILTERS, fp = vec; i--; fp++)
- if (fscanf(fd, "%f", fp) < 1) goto nomore;
- x->x_template = (t_template *)t_resizebytes(x->x_template,
- ntemplate * sizeof(t_template),
- (ntemplate + 1) * sizeof(t_template));
- for (i = NFILTERS, fp = vec,
- fp2 = x->x_template[ntemplate].t_amp; i--;)
- *fp2++ = *fp++;
- ntemplate++;
+ for (i = NFILTERS, fp = vec; i--; fp++)
+ if (fscanf(fd, "%f", fp) < 1) goto nomore;
+ x->x_template = (t_template *)t_resizebytes(x->x_template,
+ ntemplate * sizeof(t_template),
+ (ntemplate + 1) * sizeof(t_template));
+ for (i = NFILTERS, fp = vec,
+ fp2 = x->x_template[ntemplate].t_amp; i--;)
+ *fp2++ = *fp++;
+ ntemplate++;
}
nomore:
if (remaining = (ntemplate % x->x_ninsig))
{
- post("bonk_read: %d templates not a multiple of %d; dropping extras");
- x->x_template = (t_template *)t_resizebytes(x->x_template,
- ntemplate * sizeof(t_template),
- (ntemplate - remaining) * sizeof(t_template));
- ntemplate = ntemplate - remaining;
+ post("bonk_read: %d templates not a multiple of %d; dropping extras");
+ x->x_template = (t_template *)t_resizebytes(x->x_template,
+ ntemplate * sizeof(t_template),
+ (ntemplate - remaining) * sizeof(t_template));
+ ntemplate = ntemplate - remaining;
}
post("bonk: read %d templates\n", ntemplate);
x->x_ntemplate = ntemplate;
@@ -711,7 +709,7 @@ nomore:
#endif /* PD */
#ifdef MSP
-static void bonk_read(t_bonk *x, t_symbol *s) // MSP
+static void bonk_read(t_bonk *x, t_symbol *s)
{
SFTypeList types;
short vol = 0;
@@ -723,125 +721,122 @@ static void bonk_read(t_bonk *x, t_symbol *s) // MSP
int i, ntemplate = 0;
float vec[NFILTERS];
float *fp, *fp2;
- if (s->s_name[0]) // if it is named
+ if (s->s_name[0])
{
- vol = defvolume();
- strcpy (name, s->s_name);
-
- if (readtohandle (name, vol, &buf, &size) != 0)
-
- {
- post("bonk~: problem with reading file.");
- return;
-
- }
- else
- {
- post("bonk~: template read successfully.");
- //post("bonk~: size of file is %d", size);
- }
- for (eaten = 0; ;)
- {
- for (i = NFILTERS, fp = vec; i--; fp++)
- {
- while (eaten < size && (
- (*buf)[eaten] == ' ' ||
- (*buf)[eaten] == '\t' ||
- (*buf)[eaten] == '\n' ||
- (*buf)[eaten] == ';' ||
- (*buf)[eaten] == '\r'))
- eaten++;
- if (eaten >= size) goto nomore;
- if (sscanf(&(*buf)[eaten], "%f", fp) < 1) goto nomore;
-
- while (eaten < size && !(
- (*buf)[eaten] == ' ' ||
- (*buf)[eaten] == '\t' ||
- (*buf)[eaten] == '\n' ||
- (*buf)[eaten] == ';' ||
- (*buf)[eaten] == '\r'))
- eaten++;
- }
- x->x_template = (t_template *)t_resizebytes(x->x_template,
-
- ntemplate * sizeof(t_template),
- (ntemplate + 1) * sizeof(t_template));
-
- for (i = NFILTERS, fp = vec,
- fp2 = x->x_template[ntemplate].t_amp; i--;)
- *fp2++ = *fp++;
- ntemplate++;
- post("bonk~: fp = %f", fp);
- }
+ vol = defvolume();
+ strcpy (name, s->s_name);
+
+ if (readtohandle (name, vol, &buf, &size) != 0)
+
+ {
+ post("bonk~: problem with reading file.");
+ return;
+
+ }
+ else
+ {
+ post("bonk~: template read successfully.");
+ }
+ for (eaten = 0; ;)
+ {
+ for (i = NFILTERS, fp = vec; i--; fp++)
+ {
+ while (eaten < size && (
+ (*buf)[eaten] == ' ' ||
+ (*buf)[eaten] == '\t' ||
+ (*buf)[eaten] == '\n' ||
+ (*buf)[eaten] == ';' ||
+ (*buf)[eaten] == '\r'))
+ eaten++;
+ if (eaten >= size) goto nomore;
+ if (sscanf(&(*buf)[eaten], "%f", fp) < 1) goto nomore;
+
+ while (eaten < size && !(
+ (*buf)[eaten] == ' ' ||
+ (*buf)[eaten] == '\t' ||
+ (*buf)[eaten] == '\n' ||
+ (*buf)[eaten] == ';' ||
+ (*buf)[eaten] == '\r'))
+ eaten++;
+ }
+ x->x_template = (t_template *)t_resizebytes(x->x_template,
+
+ ntemplate * sizeof(t_template),
+ (ntemplate + 1) * sizeof(t_template));
+
+ for (i = NFILTERS, fp = vec,
+ fp2 = x->x_template[ntemplate].t_amp; i--;)
+ *fp2++ = *fp++;
+ ntemplate++;
+ post("bonk~: fp = %f", fp);
+ }
}
else
{
- name[0] = 0;
- types[0]='TEXT';
- types[1]='maxb';
-
- open_promptset("Select template for reading.");
-
- if (open_dialog(name, &vol, &type, types, 2))
- {
- post("bonk~: open canceled");
- return;
- }
- x->x_template = (t_template *)t_resizebytes(x->x_template,
-
- x->x_ntemplate * sizeof(t_template), 0);
-
- // post("bonk~: the file name is %s", name);
-
- if (readtohandle (name, vol, &buf, &size) != 0)
-
- {
- post("bonk~: problem with reading file.");
- return;
-
- }
- else
- {
- post("bonk~: template read successfully.");
- // post("bonk~: size of file is %d", size);
- }
- for (eaten = 0; ;)
- {
- for (i = NFILTERS, fp = vec; i--; fp++)
- {
- while (eaten < size && (
- (*buf)[eaten] == ' ' ||
- (*buf)[eaten] == '\t' ||
- (*buf)[eaten] == '\n' ||
- (*buf)[eaten] == ';' ||
- (*buf)[eaten] == '\r'))
- eaten++;
- if (eaten >= size) goto nomore;
- if (sscanf(&(*buf)[eaten], "%f", fp) < 1) goto nomore;
-
- while (eaten < size && !(
- (*buf)[eaten] == ' ' ||
- (*buf)[eaten] == '\t' ||
- (*buf)[eaten] == '\n' ||
- (*buf)[eaten] == ';' ||
- (*buf)[eaten] == '\r'))
- eaten++;
- }
- x->x_template = (t_template *)t_resizebytes(x->x_template,
-
- ntemplate * sizeof(t_template),
- (ntemplate + 1) * sizeof(t_template));
-
- for (i = NFILTERS, fp = vec,
- fp2 = x->x_template[ntemplate].t_amp; i--;)
- *fp2++ = *fp++;
- ntemplate++;
- }
- nomore:
- post("bonk~: read %d templates", ntemplate);
-
- x->x_ntemplate = ntemplate;
- } // end of else
+ name[0] = 0;
+ types[0]='TEXT';
+ types[1]='maxb';
+
+ open_promptset("Select template for reading.");
+
+ if (open_dialog(name, &vol, &type, types, 2))
+ {
+ post("bonk~: open canceled");
+ return;
+ }
+ x->x_template = (t_template *)t_resizebytes(x->x_template,
+
+ x->x_ntemplate * sizeof(t_template), 0);
+
+
+ if (readtohandle (name, vol, &buf, &size) != 0)
+
+ {
+ post("bonk~: problem with reading file.");
+ return;
+
+ }
+ else
+ {
+ post("bonk~: template read successfully.");
+ }
+ for (eaten = 0; ;)
+ {
+ for (i = NFILTERS, fp = vec; i--; fp++)
+ {
+ while (eaten < size && (
+ (*buf)[eaten] == ' ' ||
+ (*buf)[eaten] == '\t' ||
+ (*buf)[eaten] == '\n' ||
+ (*buf)[eaten] == ';' ||
+ (*buf)[eaten] == '\r'))
+ eaten++;
+ if (eaten >= size) goto nomore;
+ if (sscanf(&(*buf)[eaten], "%f", fp) < 1) goto nomore;
+
+ while (eaten < size && !(
+ (*buf)[eaten] == ' ' ||
+ (*buf)[eaten] == '\t' ||
+ (*buf)[eaten] == '\n' ||
+ (*buf)[eaten] == ';' ||
+ (*buf)[eaten] == '\r'))
+ eaten++;
+ }
+ x->x_template = (t_template *)t_resizebytes(x->x_template,
+
+ ntemplate * sizeof(t_template),
+ (ntemplate + 1) * sizeof(t_template));
+
+ for (i = NFILTERS, fp = vec,
+ fp2 = x->x_template[ntemplate].t_amp; i--;)
+ *fp2++ = *fp++;
+ ntemplate++;
+ }
+ nomore:
+ post("bonk~: read %d templates", ntemplate);
+
+ x->x_ntemplate = ntemplate;
+ }
}
#endif /* MSP */
@@ -854,14 +849,14 @@ static void bonk_write(t_bonk *x, t_symbol *s)
float *fp;
if (!fd)
{
- post("%s: couldn't create", s->s_name);
- return;
+ post("%s: couldn't create", s->s_name);
+ return;
}
for (; ntemplate--; tp++)
{
- for (i = NFILTERS, fp = tp->t_amp; i--; fp++)
- fprintf(fd, "%6.2f ", *fp);
- fprintf(fd, "\n");
+ for (i = NFILTERS, fp = tp->t_amp; i--; fp++)
+ fprintf(fd, "%6.2f ", *fp);
+ fprintf(fd, "\n");
}
post("bonk: wrote %d templates\n", x->x_ntemplate);
fclose(fd);
@@ -869,54 +864,54 @@ static void bonk_write(t_bonk *x, t_symbol *s)
#endif /* PD */
#ifdef MSP
-static void bonk_write(t_bonk *x, t_symbol *s) // MSP
+static void bonk_write(t_bonk *x, t_symbol *s)
{
char fn[236];
short vol;
- short bin = 0; // 0 = text
+ short bin = 0;
void* b;
int i, ntemplate = x->x_ntemplate;
t_template *tp = x->x_template;
- if (s->s_name[0]) // if it is named
+ if (s->s_name[0])
{
- strcpy (fn, s->s_name);
- vol = defvolume();
- b = binbuf_new();
- for (; ntemplate--; tp++)
- {
- int i;
- Atom at[11];
- for (i = 0; i < 11; i++)
- at[i].a_type = A_FLOAT, at[i].a_w.w_float = tp->t_amp[i];
- binbuf_insert(b, 0L, 11, at);
- }
- binbuf_write(b, fn, vol, bin);
- freeobject(b);
- post("bonk~: wrote file %s", fn);
+ strcpy (fn, s->s_name);
+ vol = defvolume();
+ b = binbuf_new();
+ for (; ntemplate--; tp++)
+ {
+ int i;
+ Atom at[11];
+ for (i = 0; i < 11; i++)
+ at[i].a_type = A_FLOAT, at[i].a_w.w_float = tp->t_amp[i];
+ binbuf_insert(b, 0L, 11, at);
+ }
+ binbuf_write(b, fn, vol, bin);
+ freeobject(b);
+ post("bonk~: wrote file %s", fn);
}
else
{
- saveas_promptset("Save Template file as");
- strcpy(fn, "");
- if (!saveas_dialog(fn, &vol, 0L))
- {
- b = binbuf_new();
- for (; ntemplate--; tp++)
- {
- int i;
- Atom at[11];
- for (i = 0; i < 11; i++)
- at[i].a_type = A_FLOAT, at[i].a_w.w_float =
- tp->t_amp[i];
- binbuf_insert(b, 0L, 11, at);
- }
- binbuf_write(b, fn, vol, bin);
- freeobject(b);
- post("bonk~: wrote file %s", fn);
- }
- } // end of else
+ saveas_promptset("Save Template file as");
+ strcpy(fn, "");
+ if (!saveas_dialog(fn, &vol, 0L))
+ {
+ b = binbuf_new();
+ for (; ntemplate--; tp++)
+ {
+ int i;
+ Atom at[11];
+ for (i = 0; i < 11; i++)
+ at[i].a_type = A_FLOAT, at[i].a_w.w_float =
+ tp->t_amp[i];
+ binbuf_insert(b, 0L, 11, at);
+ }
+ binbuf_write(b, fn, vol, bin);
+ freeobject(b);
+ post("bonk~: wrote file %s", fn);
+ }
+ }
}
#endif /* MSP */
@@ -925,7 +920,7 @@ static void bonk_free(t_bonk *x)
int i, ninsig = x->x_ninsig;
t_insig *gp = x->x_insig;
for (i = 0, gp = x->x_insig; i < ninsig; i++, gp++)
- freebytes(gp->g_inbuf, NPOINTS * sizeof(float));
+ freebytes(gp->g_inbuf, NPOINTS * sizeof(float));
clock_free(x->x_clock);
}
@@ -944,9 +939,9 @@ static void *bonk_new(t_floatarg fperiod, t_floatarg fnsig)
x->x_insig = (t_insig *)getbytes(nsig * sizeof(*x->x_insig));
for (j = 0, g = x->x_insig; j < nsig; j++, g++)
{
- g->g_outlet = outlet_new(&x->x_obj, gensym("list"));
- if (j)
- inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
+ g->g_outlet = outlet_new(&x->x_obj, gensym("list"));
+ if (j)
+ inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
}
x->x_cookedout = outlet_new(&x->x_obj, gensym("list"));
bonk_donew(x, fperiod, nsig);
@@ -956,29 +951,29 @@ static void *bonk_new(t_floatarg fperiod, t_floatarg fnsig)
void bonk_tilde_setup(void)
{
bonk_class = class_new(gensym("bonk~"), (t_newmethod)bonk_new, 0,
- sizeof(t_bonk), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
+ sizeof(t_bonk), 0, A_DEFFLOAT, A_DEFFLOAT, 0);
class_addmethod(bonk_class, nullfn, gensym("signal"), 0);
class_addmethod(bonk_class, (t_method)bonk_dsp, gensym("dsp"), 0);
class_addbang(bonk_class, bonk_bang);
class_addmethod(bonk_class, (t_method)bonk_learn, gensym("learn"),
- A_FLOAT, 0);
+ A_FLOAT, 0);
class_addmethod(bonk_class, (t_method)bonk_forget, gensym("forget"), 0);
class_addmethod(bonk_class, (t_method)bonk_thresh, gensym("thresh"),
- A_FLOAT, A_FLOAT, 0);
+ A_FLOAT, A_FLOAT, 0);
class_addmethod(bonk_class, (t_method)bonk_mask, gensym("mask"),
- A_FLOAT, A_FLOAT, 0);
+ A_FLOAT, A_FLOAT, 0);
class_addmethod(bonk_class, (t_method)bonk_debounce, gensym("debounce"),
- A_FLOAT, 0);
+ A_FLOAT, 0);
class_addmethod(bonk_class, (t_method)bonk_minvel, gensym("minvel"),
- A_FLOAT, 0);
+ A_FLOAT, 0);
class_addmethod(bonk_class, (t_method)bonk_print, gensym("print"),
- A_DEFFLOAT, 0);
+ A_DEFFLOAT, 0);
class_addmethod(bonk_class, (t_method)bonk_debug, gensym("debug"),
- A_DEFFLOAT, 0);
+ A_DEFFLOAT, 0);
class_addmethod(bonk_class, (t_method)bonk_read, gensym("read"),
- A_SYMBOL, 0);
+ A_SYMBOL, 0);
class_addmethod(bonk_class, (t_method)bonk_write, gensym("write"),
- A_SYMBOL, 0);
+ A_SYMBOL, 0);
bonk_setupkernels();
post("bonk version 1.1 TEST 3");
}
@@ -992,8 +987,8 @@ static int ilog2(int n)
int ret = -1;
while (n)
{
- n >>= 1;
- ret++;
+ n >>= 1;
+ ret++;
}
return (ret);
}
@@ -1003,7 +998,7 @@ static char *strcpy(char *s1, const char *s2)
char *ret = s1;
while ((*s1++ = *s2++) != 0)
- ;
+ ;
return ret;
}
@@ -1019,11 +1014,11 @@ static void *bonk_new(int period, int nsig)
if (nsig < 1) nsig = 1;
if (nsig > MAXCHANNELS) nsig = MAXCHANNELS;
x->x_insig = (t_insig *)getbytes(nsig * sizeof(*x->x_insig));
- dsp_setup((t_pxobject *)x, nsig); // nsig inputs
+ dsp_setup((t_pxobject *)x, nsig);
x->x_cookedout = listout((t_object *)x);
for (j = 0, g = x->x_insig + nsig-1; j < nsig; j++, g--)
{
- g->g_outlet = listout((t_object *)x);
+ g->g_outlet = listout((t_object *)x);
}
x->x_cookedout = listout((t_object *)x);
x->x_clock = clock_new(x, (method)bonk_tick);
@@ -1034,31 +1029,30 @@ static void *bonk_new(int period, int nsig)
void main()
{
- setup(&bonk_class, bonk_new, (method)bonk_free,
- (short)sizeof(t_bonk), 0L, A_DEFLONG, A_DEFLONG, 0);
- addmess((method)bonk_dsp, "dsp", 0);
- addbang((method)bonk_bang);
- addmess((method)bonk_forget, "forget", 0);
- addmess((method)bonk_learn, "learn", A_FLOAT, 0);
- addmess((method)bonk_thresh, "thresh", A_FLOAT, A_FLOAT, 0);
- addmess((method)bonk_mask, "mask", A_FLOAT, A_FLOAT, 0);
- addmess((method)bonk_minvel, "minvel", A_FLOAT, 0);
- addmess((method)bonk_debounce, "debounce", A_FLOAT, 0);
- addmess((method)bonk_print, "print", A_DEFFLOAT, 0);
- addmess((method)bonk_read, "read", A_DEFSYM, 0);
- addmess((method)bonk_write, "write", A_DEFSYM, 0);
- addmess((method)bonk_assist, "assist", A_CANT, 0);
- addmess((method)bonk_debug, "debug", A_FLOAT, 0);
- bonk_setupkernels();
-// post("bonk~ v1.00 Miller Puckette, Ted Apel");
- post("bonk~ v1.00");
- dsp_initclass();
- rescopy('STR#',3747);
+ setup(&bonk_class, bonk_new, (method)bonk_free,
+ (short)sizeof(t_bonk), 0L, A_DEFLONG, A_DEFLONG, 0);
+ addmess((method)bonk_dsp, "dsp", 0);
+ addbang((method)bonk_bang);
+ addmess((method)bonk_forget, "forget", 0);
+ addmess((method)bonk_learn, "learn", A_FLOAT, 0);
+ addmess((method)bonk_thresh, "thresh", A_FLOAT, A_FLOAT, 0);
+ addmess((method)bonk_mask, "mask", A_FLOAT, A_FLOAT, 0);
+ addmess((method)bonk_minvel, "minvel", A_FLOAT, 0);
+ addmess((method)bonk_debounce, "debounce", A_FLOAT, 0);
+ addmess((method)bonk_print, "print", A_DEFFLOAT, 0);
+ addmess((method)bonk_read, "read", A_DEFSYM, 0);
+ addmess((method)bonk_write, "write", A_DEFSYM, 0);
+ addmess((method)bonk_assist, "assist", A_CANT, 0);
+ addmess((method)bonk_debug, "debug", A_FLOAT, 0);
+ bonk_setupkernels();
+ post("bonk~ v1.00");
+ dsp_initclass();
+ rescopy('STR#',3747);
}
void bonk_assist(t_bonk *x, void *b, long m, long a, char *s)
{
- assist_string(3747,m,a,1,2,s);
+ assist_string(3747,m,a,1,2,s);
}
/* get current system time */
@@ -1077,7 +1071,7 @@ double clock_gettimesince(double prevsystime)
float qrsqrt(float f)
{
- return 1/sqrt(f);
+ return 1/sqrt(f);
}
#endif /* MSP */
diff --git a/pd/extra/choice/choice.c b/pd/extra/choice/choice.c
index 002dac40..b7bf23ab 100644
--- a/pd/extra/choice/choice.c
+++ b/pd/extra/choice/choice.c
@@ -50,12 +50,12 @@ static void choice_print(t_choice *x)
int j;
for (j = 0; j < x->x_n; j++)
{
- t_elem *e = x->x_vec + j;
- t_float *w = e->e_weight;
- post("%2d age %2d \
+ t_elem *e = x->x_vec + j;
+ t_float *w = e->e_weight;
+ post("%2d age %2d \
w %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f %5.2f",
- j, (int)(e->e_age), w[0], w[1], w[2], w[3], w[4], w[5],
- w[6], w[7], w[8], w[9]);
+ j, (int)(e->e_age), w[0], w[1], w[2], w[3], w[4], w[5],
+ w[6], w[7], w[8], w[9]);
}
}
@@ -65,20 +65,20 @@ static void choice_add(t_choice *x, t_symbol *s, int argc, t_atom *argv)
t_elem *e;
float sum, normal;
x->x_vec = (t_elem *)resizebytes(x->x_vec, oldn * sizeof(t_elem),
- newn * sizeof(t_elem));
+ newn * sizeof(t_elem));
x->x_n = newn;
e = x->x_vec + oldn;
e->e_age = 2;
for (i = 0, sum = 0; i < DIMENSION; i++)
{
- float f = atom_getfloatarg(i, argc, argv);
- e->e_weight[i] = f;
- sum += f*f;
+ float f = atom_getfloatarg(i, argc, argv);
+ e->e_weight[i] = f;
+ sum += f*f;
}
normal = (float)(sum > 0 ? 1./sqrt(sum) : 1);
for (i = 0; i < DIMENSION; i++)
- e->e_weight[i] *= normal;
+ e->e_weight[i] *= normal;
}
static void choice_list(t_choice *x, t_symbol *s, int argc, t_atom *argv)
@@ -88,26 +88,26 @@ static void choice_list(t_choice *x, t_symbol *s, int argc, t_atom *argv)
int bestindex = -1;
t_float invec[DIMENSION];
for (i = 0; i < DIMENSION; i++)
- invec[i] = atom_getfloatarg(i, argc, argv);
+ invec[i] = atom_getfloatarg(i, argc, argv);
for (j = 0; j < x->x_n; j++)
{
- t_elem *e = x->x_vec + j;
- float sum;
- for (i = 0, sum = 0; i < DIMENSION; i++)
- sum += e->e_weight[i] * invec[i];
- if (x->x_nonrepeat) sum *= (float)(log(e->e_age));
- if (sum > bestsum)
- {
- bestsum = sum;
- sum = 1;
- bestindex = j;
- }
+ t_elem *e = x->x_vec + j;
+ float sum;
+ for (i = 0, sum = 0; i < DIMENSION; i++)
+ sum += e->e_weight[i] * invec[i];
+ if (x->x_nonrepeat) sum *= (float)(log(e->e_age));
+ if (sum > bestsum)
+ {
+ bestsum = sum;
+ sum = 1;
+ bestindex = j;
+ }
}
if (bestindex >= 0)
{
- for (j = 0; j < x->x_n; j++)
- x->x_vec[j].e_age += 1.;
- x->x_vec[bestindex].e_age = 1;
+ for (j = 0; j < x->x_n; j++)
+ x->x_vec[j].e_age += 1.;
+ x->x_vec[bestindex].e_age = 1;
}
outlet_float(x->x_obj.ob_outlet, (float)bestindex);
}
@@ -120,7 +120,7 @@ static void choice_free(t_choice *x)
void choice_setup(void)
{
choice_class = class_new(gensym("choice"), (t_newmethod)choice_new,
- (t_method)choice_free, sizeof(t_choice), 0, A_DEFFLOAT, 0);
+ (t_method)choice_free, sizeof(t_choice), 0, A_DEFFLOAT, 0);
class_addmethod(choice_class, (t_method)choice_add, gensym("add"), A_GIMME, 0);
class_addmethod(choice_class, (t_method)choice_clear, gensym("clear"), 0);
class_addmethod(choice_class, (t_method)choice_print, gensym("print"), 0);
diff --git a/pd/extra/expr~/fts_to_pd.h b/pd/extra/expr~/fts_to_pd.h
index 57b0382c..9ca2fc42 100644
--- a/pd/extra/expr~/fts_to_pd.h
+++ b/pd/extra/expr~/fts_to_pd.h
@@ -14,14 +14,14 @@ permission is granted to use this file for any purpose.
typedef t_symbol *fts_symbol_t;
#ifdef MSP
-#define t_atom Atom
-#define t_symbol Symbol
-#define pd_new(x) newobject(x);
-#define pd_free(x) freeobject(x);
-#define t_outlet void
-#define t_binbuf void
-typedef t_class *t_pd;
-typedef float t_floatarg;
+#define t_atom Atom
+#define t_symbol Symbol
+#define pd_new(x) newobject(x);
+#define pd_free(x) freeobject(x);
+#define t_outlet void
+#define t_binbuf void
+typedef t_class *t_pd;
+typedef float t_floatarg;
#include <stdlib.h>
#include <stdio.h>
diff --git a/pd/extra/expr~/makefile b/pd/extra/expr~/makefile
index 042380dd..ff1dae4b 100644
--- a/pd/extra/expr~/makefile
+++ b/pd/extra/expr~/makefile
@@ -81,7 +81,7 @@ LINUXOBJ = vexp.pd_linux_o vexp_fun.pd_linux_o vexp_if.pd_linux_o
LINUXCFLAGS = -DPD -O2 -funroll-loops -fomit-frame-pointer -fPIC \
-Wall -W -Wshadow -Wstrict-prototypes \
- -Wno-unused -Wno-parentheses -Wno-switch $(CFLAGS)
+ -Wno-unused -Wno-parentheses -Wno-switch
LINUXINCLUDE = -I../../src
diff --git a/pd/extra/expr~/vexp.c b/pd/extra/expr~/vexp.c
index c0001e1f..7d4d7b52 100644
--- a/pd/extra/expr~/vexp.c
+++ b/pd/extra/expr~/vexp.c
@@ -28,16 +28,16 @@
/* "expr~" and "fexpr~" conversion by Shahrokh Yadegari c. 1999,2000 */
/*
- * Feb 2002 - added access to variables
- * multiple expression support
- * new short hand forms for fexpr~
- * now $y or $y1 = $y1[-1] and $y2 = $y2[-1]
- * --sdy
+ * Feb 2002 - added access to variables
+ * multiple expression support
+ * new short hand forms for fexpr~
+ * now $y or $y1 = $y1[-1] and $y2 = $y2[-1]
+ * --sdy
*
* July 2002
- * fixed bugs introduced in last changes in store and ET_EQ
- * --sdy
- *
+ * fixed bugs introduced in last changes in store and ET_EQ
+ * --sdy
+ *
*/
/*
@@ -73,7 +73,7 @@
#include "vexp.h"
#ifdef MSP
#undef isdigit
-#define isdigit(x) (x >= '0' && x <= '9')
+#define isdigit(x) (x >= '0' && x <= '9')
#endif
char *atoif(char *s, long int *value, long int *type);
@@ -81,30 +81,30 @@ char *atoif(char *s, long int *value, long int *type);
static struct ex_ex *ex_lex(struct expr *expr, long int *n);
struct ex_ex *ex_match(struct ex_ex *eptr, long int op);
struct ex_ex *ex_parse(struct expr *expr, struct ex_ex *iptr,
- struct ex_ex *optr, long int *argc);
+ struct ex_ex *optr, long int *argc);
struct ex_ex *ex_eval(struct expr *expr, struct ex_ex *eptr,
- struct ex_ex *optr, int i);
+ struct ex_ex *optr, int i);
int expr_donew(struct expr *exprr, int ac, t_atom *av);
struct ex_ex *eval_func(struct expr *expr,struct ex_ex *eptr,
- struct ex_ex *optr, int i);
+ struct ex_ex *optr, int i);
struct ex_ex *eval_tab(struct expr *expr, struct ex_ex *eptr,
- struct ex_ex *optr, int i);
+ struct ex_ex *optr, int i);
struct ex_ex *eval_var(struct expr *expr, struct ex_ex *eptr,
- struct ex_ex *optr, int i);
+ struct ex_ex *optr, int i);
struct ex_ex *eval_store(struct expr *expr, struct ex_ex *eptr,
- struct ex_ex *optr, int i);
+ struct ex_ex *optr, int i);
struct ex_ex *eval_sigidx(struct expr *expr, struct ex_ex *eptr,
- struct ex_ex *optr, int i);
-static int cal_sigidx(struct ex_ex *optr, /* The output value */
- int i, float rem_i, /* integer and fractinal part of index */
- int idx, /* index of current fexpr~ processing */
- int vsize, /* vector size */
- float *curvec, float *prevec); /* current and previous table */
+ struct ex_ex *optr, int i);
+static int cal_sigidx(struct ex_ex *optr, /* The output value */
+ int i, float rem_i, /* integer and fractinal part of index */
+ int idx, /* index of current fexpr~ processing */
+ int vsize, /* vector size */
+ float *curvec, float *prevec); /* current and previous table */
t_ex_func *find_func(char *s);
void ex_dzdetect(struct expr *expr);
-#define MAX_ARGS 10
+#define MAX_ARGS 10
extern t_ex_func ex_funcs[];
struct ex_ex nullex;
@@ -181,7 +181,7 @@ void atom_string(t_atom *a, char *buf, unsigned int bufsize)
break;
case A_DOLLSYM:
sprintf(buf, "$%s", a->a_w.w_symbol->s_name);
- break;
+ break;
#else /* MAX */
case A_DOLLAR:
sprintf(buf, "$%s", a->a_w.w_symbol->s_name);
@@ -194,24 +194,24 @@ void atom_string(t_atom *a, char *buf, unsigned int bufsize)
#endif /* MSP */
/*
* expr_donew -- create a new "expr" object.
- * returns 1 on failure, 0 on success.
+ * returns 1 on failure, 0 on success.
*/
int
expr_donew(struct expr *expr, int ac, t_atom *av)
{
- struct ex_ex *list;
- struct ex_ex *ret;
- long max_node = 0; /* maximum number of nodes needed */
- char *exp_string;
- int exp_strlen;
- t_binbuf *b;
- int i;
-
- memset(expr->exp_var, 0, MAX_VARS * sizeof (*expr->exp_var));
+ struct ex_ex *list;
+ struct ex_ex *ret;
+ long max_node = 0; /* maximum number of nodes needed */
+ char *exp_string;
+ int exp_strlen;
+ t_binbuf *b;
+ int i;
+
+ memset(expr->exp_var, 0, MAX_VARS * sizeof (*expr->exp_var));
#ifdef PD
- b = binbuf_new();
- binbuf_add(b, ac, av);
- binbuf_gettext(b, &exp_string, &exp_strlen);
+ b = binbuf_new();
+ binbuf_add(b, ac, av);
+ binbuf_gettext(b, &exp_string, &exp_strlen);
#else /* MSP */
{
@@ -246,657 +246,657 @@ expr_donew(struct expr *expr, int ac, t_atom *av)
exp_strlen = length;
}
#endif
- exp_string = (char *)t_resizebytes(exp_string, exp_strlen,exp_strlen+1);
- exp_string[exp_strlen] = 0;
- expr->exp_string = exp_string;
- expr->exp_str = exp_string;
- expr->exp_nexpr = 0;
- ret = (struct ex_ex *) 0;
- /*
- * if ret == 0 it means that we have no expression
- * so we let the pass go through to build a single null stack
- */
- while (*expr->exp_str || !ret) {
- list = ex_lex(expr, &max_node);
- if (!list) { /* syntax error */
- goto error;
- }
- expr->exp_stack[expr->exp_nexpr] =
- (struct ex_ex *)fts_malloc(max_node * sizeof (struct ex_ex));
- expr->exp_nexpr++;
- ret = ex_match(list, (long)0);
- if (!ret) /* syntax error */
- goto error;
- ret = ex_parse(expr,
- list, expr->exp_stack[expr->exp_nexpr - 1], (long *)0);
- if (!ret)
- goto error;
- }
- *ret = nullex;
- t_freebytes(exp_string, exp_strlen+1);
- return (0);
+ exp_string = (char *)t_resizebytes(exp_string, exp_strlen,exp_strlen+1);
+ exp_string[exp_strlen] = 0;
+ expr->exp_string = exp_string;
+ expr->exp_str = exp_string;
+ expr->exp_nexpr = 0;
+ ret = (struct ex_ex *) 0;
+ /*
+ * if ret == 0 it means that we have no expression
+ * so we let the pass go through to build a single null stack
+ */
+ while (*expr->exp_str || !ret) {
+ list = ex_lex(expr, &max_node);
+ if (!list) { /* syntax error */
+ goto error;
+ }
+ expr->exp_stack[expr->exp_nexpr] =
+ (struct ex_ex *)fts_malloc(max_node * sizeof (struct ex_ex));
+ expr->exp_nexpr++;
+ ret = ex_match(list, (long)0);
+ if (!ret) /* syntax error */
+ goto error;
+ ret = ex_parse(expr,
+ list, expr->exp_stack[expr->exp_nexpr - 1], (long *)0);
+ if (!ret)
+ goto error;
+ }
+ *ret = nullex;
+ t_freebytes(exp_string, exp_strlen+1);
+ return (0);
error:
- for (i = 0; i < expr->exp_nexpr; i++) {
- fts_free(expr->exp_stack[i]);
- expr->exp_stack[i] = 0;
- }
- expr->exp_nexpr = 0;
- if (list)
- fts_free(list);
- t_freebytes(exp_string, exp_strlen+1);
- return (1);
+ for (i = 0; i < expr->exp_nexpr; i++) {
+ fts_free(expr->exp_stack[i]);
+ expr->exp_stack[i] = 0;
+ }
+ expr->exp_nexpr = 0;
+ if (list)
+ fts_free(list);
+ t_freebytes(exp_string, exp_strlen+1);
+ return (1);
}
/*
* ex_lex -- This routine is a bit more than a lexical parser since it will
- * also do some syntax checking. It reads the string s and will
- * return a linked list of struct ex_ex.
- * It will also put the number of the nodes in *n.
+ * also do some syntax checking. It reads the string s and will
+ * return a linked list of struct ex_ex.
+ * It will also put the number of the nodes in *n.
*/
struct ex_ex *
ex_lex(struct expr *expr, long int *n)
{
- struct ex_ex *list_arr;
- struct ex_ex *exptr;
- long non = 0; /* number of nodes */
- long maxnode = 0;
-
- list_arr = (struct ex_ex *)fts_malloc(sizeof (struct ex_ex) * MINODES);
- if (! list_arr) {
- post("ex_lex: no mem\n");
- return ((struct ex_ex *)0);
- }
- exptr = list_arr;
- maxnode = MINODES;
-
- while (8)
- {
- if (non >= maxnode) {
- maxnode += MINODES;
-
- list_arr = fts_realloc((void *)list_arr,
- sizeof (struct ex_ex) * maxnode);
- if (!list_arr) {
- post("ex_lex: no mem\n");
- return ((struct ex_ex *)0);
- }
- exptr = &(list_arr)[non];
- }
-
- if (getoken(expr, exptr)) {
- fts_free(list_arr);
- return ((struct ex_ex *)0);
- }
- non++;
-
- if (!exptr->ex_type)
- break;
-
- exptr++;
- }
- *n = non;
-
- return list_arr;
+ struct ex_ex *list_arr;
+ struct ex_ex *exptr;
+ long non = 0; /* number of nodes */
+ long maxnode = 0;
+
+ list_arr = (struct ex_ex *)fts_malloc(sizeof (struct ex_ex) * MINODES);
+ if (! list_arr) {
+ post("ex_lex: no mem\n");
+ return ((struct ex_ex *)0);
+ }
+ exptr = list_arr;
+ maxnode = MINODES;
+
+ while (8)
+ {
+ if (non >= maxnode) {
+ maxnode += MINODES;
+
+ list_arr = fts_realloc((void *)list_arr,
+ sizeof (struct ex_ex) * maxnode);
+ if (!list_arr) {
+ post("ex_lex: no mem\n");
+ return ((struct ex_ex *)0);
+ }
+ exptr = &(list_arr)[non];
+ }
+
+ if (getoken(expr, exptr)) {
+ fts_free(list_arr);
+ return ((struct ex_ex *)0);
+ }
+ non++;
+
+ if (!exptr->ex_type)
+ break;
+
+ exptr++;
+ }
+ *n = non;
+
+ return list_arr;
}
/*
* ex_match -- this routine walks through the eptr and matches the
* perentheses and brackets, it also converts the function
- * names to a pointer to the describing structure of the
- * specified function
+ * names to a pointer to the describing structure of the
+ * specified function
*/
/* operator to match */
struct ex_ex *
ex_match(struct ex_ex *eptr, long int op)
{
- int firstone = 1;
- struct ex_ex *ret;
- t_ex_func *fun;
-
- for (; 8; eptr++, firstone = 0) {
- switch (eptr->ex_type) {
- case 0:
- if (!op)
- return (eptr);
- post("expr syntax error: an open %s not matched\n",
- op == OP_RP ? "parenthesis" : "bracket");
- return (exNULL);
- case ET_INT:
- case ET_FLT:
- case ET_II:
- case ET_FI:
- case ET_SI:
- case ET_VI:
- case ET_SYM:
- case ET_VSYM:
- continue;
- case ET_YO:
- if (eptr[1].ex_type != ET_OP || eptr[1].ex_op != OP_LB)
- eptr->ex_type = ET_YOM1;
- continue;
- case ET_XI:
- if (eptr[1].ex_type != ET_OP || eptr[1].ex_op != OP_LB)
- eptr->ex_type = ET_XI0;
- continue;
- case ET_TBL:
- case ET_FUNC:
- case ET_LP:
- /* CHANGE
- case ET_RP:
- */
- case ET_LB:
- /* CHANGE
- case ET_RB:
- */
- post("ex_match: unexpected type, %ld\n", eptr->ex_type);
- return (exNULL);
- case ET_OP:
- if (op == eptr->ex_op)
- return (eptr);
- /*
- * if we are looking for a right peranthesis
- * or a right bracket and find the other kind,
- * it has to be a syntax error
- */
- if ((eptr->ex_op == OP_RP && op == OP_RB) ||
- (eptr->ex_op == OP_RB && op == OP_RP)) {
- post("expr syntax error: prenthesis or brackets not matched\n");
- return (exNULL);
- }
- /*
- * Up to now we have marked the unary minuses as
- * subrtacts. Any minus that is the first one in
- * chain or is preceeded by anything except ')' and
- * ']' is a unary minus.
- */
- if (eptr->ex_op == OP_SUB) {
- ret = eptr - 1;
- if (firstone || (ret->ex_type == ET_OP &&
- ret->ex_op != OP_RB && ret->ex_op != OP_RP))
- eptr->ex_op = OP_UMINUS;
- } else if (eptr->ex_op == OP_LP) {
- ret = ex_match(eptr + 1, OP_RP);
- if (!ret)
- return (ret);
- eptr->ex_type = ET_LP;
- eptr->ex_ptr = (char *) ret;
- eptr = ret;
- } else if (eptr->ex_op == OP_LB) {
- ret = ex_match(eptr + 1, OP_RB);
- if (!ret)
- return (ret);
- eptr->ex_type = ET_LB;
- eptr->ex_ptr = (char *) ret;
- eptr = ret;
- }
- continue;
- case ET_STR:
- if (eptr[1].ex_op == OP_LB) {
- char *tmp;
-
- eptr->ex_type = ET_TBL;
- tmp = eptr->ex_ptr;
- if (ex_getsym(tmp, (t_symbol **)&(eptr->ex_ptr))) {
- post("expr: syntax error: problms with ex_getsym\n");
- return (exNULL);
- }
- fts_free((void *)tmp);
- } else if (eptr[1].ex_op == OP_LP) {
- fun = find_func(eptr->ex_ptr);
- if (!fun) {
- post(
- "expr: error: function %s not found\n",
- eptr->ex_ptr);
- return (exNULL);
- }
- eptr->ex_type = ET_FUNC;
- eptr->ex_ptr = (char *) fun;
- } else {
- char *tmp;
-
- if (eptr[1].ex_type && eptr[1].ex_type!=ET_OP){
- post("expr: syntax error: bad string '%s'\n", eptr->ex_ptr);
- return (exNULL);
- }
- /* it is a variable */
- eptr->ex_type = ET_VAR;
- tmp = eptr->ex_ptr;
- if (ex_getsym(tmp,
- (t_symbol **)&(eptr->ex_ptr))) {
- post("expr: variable '%s' not found",tmp);
- return (exNULL);
- }
- }
- continue;
- default:
- post("ex_match: bad type\n");
- return (exNULL);
- }
- }
- /* NOTREACHED */
+ int firstone = 1;
+ struct ex_ex *ret;
+ t_ex_func *fun;
+
+ for (; 8; eptr++, firstone = 0) {
+ switch (eptr->ex_type) {
+ case 0:
+ if (!op)
+ return (eptr);
+ post("expr syntax error: an open %s not matched\n",
+ op == OP_RP ? "parenthesis" : "bracket");
+ return (exNULL);
+ case ET_INT:
+ case ET_FLT:
+ case ET_II:
+ case ET_FI:
+ case ET_SI:
+ case ET_VI:
+ case ET_SYM:
+ case ET_VSYM:
+ continue;
+ case ET_YO:
+ if (eptr[1].ex_type != ET_OP || eptr[1].ex_op != OP_LB)
+ eptr->ex_type = ET_YOM1;
+ continue;
+ case ET_XI:
+ if (eptr[1].ex_type != ET_OP || eptr[1].ex_op != OP_LB)
+ eptr->ex_type = ET_XI0;
+ continue;
+ case ET_TBL:
+ case ET_FUNC:
+ case ET_LP:
+ /* CHANGE
+ case ET_RP:
+ */
+ case ET_LB:
+ /* CHANGE
+ case ET_RB:
+ */
+ post("ex_match: unexpected type, %ld\n", eptr->ex_type);
+ return (exNULL);
+ case ET_OP:
+ if (op == eptr->ex_op)
+ return (eptr);
+ /*
+ * if we are looking for a right peranthesis
+ * or a right bracket and find the other kind,
+ * it has to be a syntax error
+ */
+ if ((eptr->ex_op == OP_RP && op == OP_RB) ||
+ (eptr->ex_op == OP_RB && op == OP_RP)) {
+ post("expr syntax error: prenthesis or brackets not matched\n");
+ return (exNULL);
+ }
+ /*
+ * Up to now we have marked the unary minuses as
+ * subrtacts. Any minus that is the first one in
+ * chain or is preceeded by anything except ')' and
+ * ']' is a unary minus.
+ */
+ if (eptr->ex_op == OP_SUB) {
+ ret = eptr - 1;
+ if (firstone || (ret->ex_type == ET_OP &&
+ ret->ex_op != OP_RB && ret->ex_op != OP_RP))
+ eptr->ex_op = OP_UMINUS;
+ } else if (eptr->ex_op == OP_LP) {
+ ret = ex_match(eptr + 1, OP_RP);
+ if (!ret)
+ return (ret);
+ eptr->ex_type = ET_LP;
+ eptr->ex_ptr = (char *) ret;
+ eptr = ret;
+ } else if (eptr->ex_op == OP_LB) {
+ ret = ex_match(eptr + 1, OP_RB);
+ if (!ret)
+ return (ret);
+ eptr->ex_type = ET_LB;
+ eptr->ex_ptr = (char *) ret;
+ eptr = ret;
+ }
+ continue;
+ case ET_STR:
+ if (eptr[1].ex_op == OP_LB) {
+ char *tmp;
+
+ eptr->ex_type = ET_TBL;
+ tmp = eptr->ex_ptr;
+ if (ex_getsym(tmp, (t_symbol **)&(eptr->ex_ptr))) {
+ post("expr: syntax error: problms with ex_getsym\n");
+ return (exNULL);
+ }
+ fts_free((void *)tmp);
+ } else if (eptr[1].ex_op == OP_LP) {
+ fun = find_func(eptr->ex_ptr);
+ if (!fun) {
+ post(
+ "expr: error: function %s not found\n",
+ eptr->ex_ptr);
+ return (exNULL);
+ }
+ eptr->ex_type = ET_FUNC;
+ eptr->ex_ptr = (char *) fun;
+ } else {
+ char *tmp;
+
+ if (eptr[1].ex_type && eptr[1].ex_type!=ET_OP){
+ post("expr: syntax error: bad string '%s'\n", eptr->ex_ptr);
+ return (exNULL);
+ }
+ /* it is a variable */
+ eptr->ex_type = ET_VAR;
+ tmp = eptr->ex_ptr;
+ if (ex_getsym(tmp,
+ (t_symbol **)&(eptr->ex_ptr))) {
+ post("expr: variable '%s' not found",tmp);
+ return (exNULL);
+ }
+ }
+ continue;
+ default:
+ post("ex_match: bad type\n");
+ return (exNULL);
+ }
+ }
+ /* NOTREACHED */
}
/*
* ex_parse -- This function if called when we have already done some
- * parsing on the expression, and we have already matched
- * our brackets and parenthesis. The main job of this
- * function is to convert the infix expression to the
- * prefix form.
- * First we find the operator with the lowest precedence and
- * put it on the stack ('optr', it is really just an array), then
- * we call ourself (ex_parse()), on its arguments (unary operators
- * only have one operator.)
- * When "argc" is set it means that we are parsing the arguments
- * of a function and we will increment *argc anytime we find
- * a a segment that can qualify as an argument (counting commas).
+ * parsing on the expression, and we have already matched
+ * our brackets and parenthesis. The main job of this
+ * function is to convert the infix expression to the
+ * prefix form.
+ * First we find the operator with the lowest precedence and
+ * put it on the stack ('optr', it is really just an array), then
+ * we call ourself (ex_parse()), on its arguments (unary operators
+ * only have one operator.)
+ * When "argc" is set it means that we are parsing the arguments
+ * of a function and we will increment *argc anytime we find
+ * a a segment that can qualify as an argument (counting commas).
*
- * returns 0 on syntax error
+ * returns 0 on syntax error
*/
/* number of argument separated by comma */
struct ex_ex *
ex_parse(struct expr *x, struct ex_ex *iptr, struct ex_ex *optr, long int *argc)
{
- struct ex_ex *eptr;
- struct ex_ex *lowpre = 0; /* pointer to the lowest precedence */
- struct ex_ex savex;
- long pre = HI_PRE;
- long count;
-
- if (!iptr) {
- post("ex_parse: input is null, iptr = 0x%lx\n", iptr);
- return (exNULL);
- }
- if (!iptr->ex_type)
- return (exNULL);
-
- /*
- * the following loop finds the lowest precedence operator in the
- * the input token list, comma is explicitly checked here since
- * that is a special operator and is only legal in functions
- */
- for (eptr = iptr, count = 0; eptr->ex_type; eptr++, count++)
- switch (eptr->ex_type) {
- case ET_SYM:
- case ET_VSYM:
- if (!argc) {
- post("expr: syntax error: symbols allowed for functions only\n");
- ex_print(eptr);
- return (exNULL);
- }
- case ET_INT:
- case ET_FLT:
- case ET_II:
- case ET_FI:
- case ET_XI0:
- case ET_YOM1:
- case ET_VI:
- case ET_VAR:
- if (!count && !eptr[1].ex_type) {
- *optr++ = *eptr;
- return (optr);
- }
- break;
- case ET_XI:
- case ET_YO:
- case ET_SI:
- case ET_TBL:
- if (eptr[1].ex_type != ET_LB) {
- post("expr: syntax error: brackets missing\n");
- ex_print(eptr);
- return (exNULL);
- }
- /* if this table is the only token, parse the table */
- if (!count &&
- !((struct ex_ex *) eptr[1].ex_ptr)[1].ex_type) {
- savex = *((struct ex_ex *) eptr[1].ex_ptr);
- *((struct ex_ex *) eptr[1].ex_ptr) = nullex;
- *optr++ = *eptr;
- lowpre = ex_parse(x, &eptr[2], optr, (long *)0);
- *((struct ex_ex *) eptr[1].ex_ptr) = savex;
- return(lowpre);
- }
- eptr = (struct ex_ex *) eptr[1].ex_ptr;
- break;
- case ET_OP:
- if (eptr->ex_op == OP_COMMA) {
- if (!argc || !count || !eptr[1].ex_type) {
- post("expr: syntax error: illegal comma\n");
- ex_print(eptr[1].ex_type ? eptr : iptr);
- return (exNULL);
- }
- }
- if (!eptr[1].ex_type) {
- post("expr: syntax error: missing operand\n");
- ex_print(iptr);
- return (exNULL);
- }
- if ((eptr->ex_op & PRE_MASK) <= pre) {
- pre = eptr->ex_op & PRE_MASK;
- lowpre = eptr;
- }
- break;
- case ET_FUNC:
- if (eptr[1].ex_type != ET_LP) {
- post("expr: ex_parse: no parenthesis\n");
- return (exNULL);
- }
- /* if this function is the only token, parse it */
- if (!count &&
- !((struct ex_ex *) eptr[1].ex_ptr)[1].ex_type) {
- long ac;
-
- if (eptr[1].ex_ptr == (char *) &eptr[2]) {
- post("expr: syntax error: missing argument\n");
- ex_print(eptr);
- return (exNULL);
- }
- ac = 0;
- savex = *((struct ex_ex *) eptr[1].ex_ptr);
- *((struct ex_ex *) eptr[1].ex_ptr) = nullex;
- *optr++ = *eptr;
- lowpre = ex_parse(x, &eptr[2], optr, &ac);
- if (!lowpre)
- return (exNULL);
- ac++;
- if (ac !=
- ((t_ex_func *)eptr->ex_ptr)->f_argc){
- post("expr: syntax error: function '%s' needs %ld arguments\n",
- ((t_ex_func *)eptr->ex_ptr)->f_name,
- ((t_ex_func *)eptr->ex_ptr)->f_argc);
- return (exNULL);
- }
- *((struct ex_ex *) eptr[1].ex_ptr) = savex;
- return (lowpre);
- }
- eptr = (struct ex_ex *) eptr[1].ex_ptr;
- break;
- case ET_LP:
- case ET_LB:
- if (!count &&
- !((struct ex_ex *) eptr->ex_ptr)[1].ex_type) {
- if (eptr->ex_ptr == (char *)(&eptr[1])) {
- post("expr: syntax error: empty '%s'\n",
- eptr->ex_type==ET_LP?"()":"[]");
- ex_print(eptr);
- return (exNULL);
- }
- savex = *((struct ex_ex *) eptr->ex_ptr);
- *((struct ex_ex *) eptr->ex_ptr) = nullex;
- lowpre = ex_parse(x, &eptr[1], optr, (long *)0);
- *((struct ex_ex *) eptr->ex_ptr) = savex;
- return (lowpre);
- }
- eptr = (struct ex_ex *)eptr->ex_ptr;
- break;
- case ET_STR:
- default:
- ex_print(eptr);
- post("expr: ex_parse: type = 0x%lx\n", eptr->ex_type);
- return (exNULL);
- }
-
- if (pre == HI_PRE) {
- post("expr: syntax error: missing operation\n");
- ex_print(iptr);
- return (exNULL);
- }
- if (count < 2) {
- post("expr: syntax error: mission operand\n");
- ex_print(iptr);
- return (exNULL);
- }
- if (count == 2) {
- if (lowpre != iptr) {
- post("expr: ex_parse: unary operator should be first\n");
- return (exNULL);
- }
- if (!unary_op(lowpre->ex_op)) {
- post("expr: syntax error: not a uniary operator\n");
- ex_print(iptr);
- return (exNULL);
- }
- *optr++ = *lowpre;
- eptr = ex_parse(x, &lowpre[1], optr, argc);
- return (eptr);
- }
- if (lowpre == iptr) {
- post("expr: syntax error: mission operand\n");
- ex_print(iptr);
- return (exNULL);
- }
- savex = *lowpre;
- *lowpre = nullex;
- if (savex.ex_op != OP_COMMA)
- *optr++ = savex;
- else
- (*argc)++;
- eptr = ex_parse(x, iptr, optr, argc);
- if (eptr) {
- eptr = ex_parse(x, &lowpre[1], eptr, argc);
- *lowpre = savex;
- }
- return (eptr);
+ struct ex_ex *eptr;
+ struct ex_ex *lowpre = 0; /* pointer to the lowest precedence */
+ struct ex_ex savex;
+ long pre = HI_PRE;
+ long count;
+
+ if (!iptr) {
+ post("ex_parse: input is null, iptr = 0x%lx\n", iptr);
+ return (exNULL);
+ }
+ if (!iptr->ex_type)
+ return (exNULL);
+
+ /*
+ * the following loop finds the lowest precedence operator in the
+ * the input token list, comma is explicitly checked here since
+ * that is a special operator and is only legal in functions
+ */
+ for (eptr = iptr, count = 0; eptr->ex_type; eptr++, count++)
+ switch (eptr->ex_type) {
+ case ET_SYM:
+ case ET_VSYM:
+ if (!argc) {
+ post("expr: syntax error: symbols allowed for functions only\n");
+ ex_print(eptr);
+ return (exNULL);
+ }
+ case ET_INT:
+ case ET_FLT:
+ case ET_II:
+ case ET_FI:
+ case ET_XI0:
+ case ET_YOM1:
+ case ET_VI:
+ case ET_VAR:
+ if (!count && !eptr[1].ex_type) {
+ *optr++ = *eptr;
+ return (optr);
+ }
+ break;
+ case ET_XI:
+ case ET_YO:
+ case ET_SI:
+ case ET_TBL:
+ if (eptr[1].ex_type != ET_LB) {
+ post("expr: syntax error: brackets missing\n");
+ ex_print(eptr);
+ return (exNULL);
+ }
+ /* if this table is the only token, parse the table */
+ if (!count &&
+ !((struct ex_ex *) eptr[1].ex_ptr)[1].ex_type) {
+ savex = *((struct ex_ex *) eptr[1].ex_ptr);
+ *((struct ex_ex *) eptr[1].ex_ptr) = nullex;
+ *optr++ = *eptr;
+ lowpre = ex_parse(x, &eptr[2], optr, (long *)0);
+ *((struct ex_ex *) eptr[1].ex_ptr) = savex;
+ return(lowpre);
+ }
+ eptr = (struct ex_ex *) eptr[1].ex_ptr;
+ break;
+ case ET_OP:
+ if (eptr->ex_op == OP_COMMA) {
+ if (!argc || !count || !eptr[1].ex_type) {
+ post("expr: syntax error: illegal comma\n");
+ ex_print(eptr[1].ex_type ? eptr : iptr);
+ return (exNULL);
+ }
+ }
+ if (!eptr[1].ex_type) {
+ post("expr: syntax error: missing operand\n");
+ ex_print(iptr);
+ return (exNULL);
+ }
+ if ((eptr->ex_op & PRE_MASK) <= pre) {
+ pre = eptr->ex_op & PRE_MASK;
+ lowpre = eptr;
+ }
+ break;
+ case ET_FUNC:
+ if (eptr[1].ex_type != ET_LP) {
+ post("expr: ex_parse: no parenthesis\n");
+ return (exNULL);
+ }
+ /* if this function is the only token, parse it */
+ if (!count &&
+ !((struct ex_ex *) eptr[1].ex_ptr)[1].ex_type) {
+ long ac;
+
+ if (eptr[1].ex_ptr == (char *) &eptr[2]) {
+ post("expr: syntax error: missing argument\n");
+ ex_print(eptr);
+ return (exNULL);
+ }
+ ac = 0;
+ savex = *((struct ex_ex *) eptr[1].ex_ptr);
+ *((struct ex_ex *) eptr[1].ex_ptr) = nullex;
+ *optr++ = *eptr;
+ lowpre = ex_parse(x, &eptr[2], optr, &ac);
+ if (!lowpre)
+ return (exNULL);
+ ac++;
+ if (ac !=
+ ((t_ex_func *)eptr->ex_ptr)->f_argc){
+ post("expr: syntax error: function '%s' needs %ld arguments\n",
+ ((t_ex_func *)eptr->ex_ptr)->f_name,
+ ((t_ex_func *)eptr->ex_ptr)->f_argc);
+ return (exNULL);
+ }
+ *((struct ex_ex *) eptr[1].ex_ptr) = savex;
+ return (lowpre);
+ }
+ eptr = (struct ex_ex *) eptr[1].ex_ptr;
+ break;
+ case ET_LP:
+ case ET_LB:
+ if (!count &&
+ !((struct ex_ex *) eptr->ex_ptr)[1].ex_type) {
+ if (eptr->ex_ptr == (char *)(&eptr[1])) {
+ post("expr: syntax error: empty '%s'\n",
+ eptr->ex_type==ET_LP?"()":"[]");
+ ex_print(eptr);
+ return (exNULL);
+ }
+ savex = *((struct ex_ex *) eptr->ex_ptr);
+ *((struct ex_ex *) eptr->ex_ptr) = nullex;
+ lowpre = ex_parse(x, &eptr[1], optr, (long *)0);
+ *((struct ex_ex *) eptr->ex_ptr) = savex;
+ return (lowpre);
+ }
+ eptr = (struct ex_ex *)eptr->ex_ptr;
+ break;
+ case ET_STR:
+ default:
+ ex_print(eptr);
+ post("expr: ex_parse: type = 0x%lx\n", eptr->ex_type);
+ return (exNULL);
+ }
+
+ if (pre == HI_PRE) {
+ post("expr: syntax error: missing operation\n");
+ ex_print(iptr);
+ return (exNULL);
+ }
+ if (count < 2) {
+ post("expr: syntax error: mission operand\n");
+ ex_print(iptr);
+ return (exNULL);
+ }
+ if (count == 2) {
+ if (lowpre != iptr) {
+ post("expr: ex_parse: unary operator should be first\n");
+ return (exNULL);
+ }
+ if (!unary_op(lowpre->ex_op)) {
+ post("expr: syntax error: not a uniary operator\n");
+ ex_print(iptr);
+ return (exNULL);
+ }
+ *optr++ = *lowpre;
+ eptr = ex_parse(x, &lowpre[1], optr, argc);
+ return (eptr);
+ }
+ if (lowpre == iptr) {
+ post("expr: syntax error: mission operand\n");
+ ex_print(iptr);
+ return (exNULL);
+ }
+ savex = *lowpre;
+ *lowpre = nullex;
+ if (savex.ex_op != OP_COMMA)
+ *optr++ = savex;
+ else
+ (*argc)++;
+ eptr = ex_parse(x, iptr, optr, argc);
+ if (eptr) {
+ eptr = ex_parse(x, &lowpre[1], eptr, argc);
+ *lowpre = savex;
+ }
+ return (eptr);
}
/*
* this is the devide zero check for a a non devide operator
*/
-#define DZC(ARG1,OPR,ARG2) (ARG1 OPR ARG2)
-
-#define EVAL(OPR); \
-eptr = ex_eval(expr, ex_eval(expr, eptr, &left, idx), &right, idx); \
-switch (left.ex_type) { \
-case ET_INT: \
- switch(right.ex_type) { \
- case ET_INT: \
- if (optr->ex_type == ET_VEC) { \
- op = optr->ex_vec; \
- scalar = (float)DZC(left.ex_int, OPR, right.ex_int); \
- for (j = 0; j < expr->exp_vsize; j++) \
- *op++ = scalar; \
- } else { \
- optr->ex_type = ET_INT; \
- optr->ex_int = DZC(left.ex_int, OPR, right.ex_int); \
- } \
- break; \
- case ET_FLT: \
- if (optr->ex_type == ET_VEC) { \
- op = optr->ex_vec; \
- scalar = DZC(((float)left.ex_int), OPR, right.ex_flt);\
- for (j = 0; j < expr->exp_vsize; j++) \
- *op++ = scalar; \
- } else { \
- optr->ex_type = ET_FLT; \
- optr->ex_flt = DZC(((float)left.ex_int), OPR, \
- right.ex_flt); \
- } \
- break; \
- case ET_VEC: \
- case ET_VI: \
- if (optr->ex_type != ET_VEC) { \
- if (optr->ex_type == ET_VI) { \
- post("expr~: Int. error %d", __LINE__); \
- abort(); \
- } \
- optr->ex_type = ET_VEC; \
- optr->ex_vec = (t_float *) \
- fts_malloc(sizeof (t_float)*expr->exp_vsize); \
- } \
- scalar = left.ex_int; \
- rp = right.ex_vec; \
- op = optr->ex_vec; \
- for (i = 0; i < expr->exp_vsize; i++) { \
- *op++ = DZC (scalar, OPR, *rp); \
- rp++; \
- } \
- break; \
- case ET_SYM: \
- default: \
- post_error((fts_object_t *) expr, \
- "expr: ex_eval(%d): bad right type %ld\n", \
- __LINE__, right.ex_type); \
- nullret = 1; \
- } \
- break; \
-case ET_FLT: \
- switch(right.ex_type) { \
- case ET_INT: \
- if (optr->ex_type == ET_VEC) { \
- op = optr->ex_vec; \
- scalar = DZC((float) left.ex_flt, OPR, right.ex_int); \
- for (j = 0; j < expr->exp_vsize; j++) \
- *op++ = scalar; \
- } else { \
- optr->ex_type = ET_FLT; \
- optr->ex_flt = DZC(left.ex_flt, OPR, right.ex_int); \
- } \
- break; \
- case ET_FLT: \
- if (optr->ex_type == ET_VEC) { \
- op = optr->ex_vec; \
- scalar = DZC(left.ex_flt, OPR, right.ex_flt); \
- for (j = 0; j < expr->exp_vsize; j++) \
- *op++ = scalar; \
- } else { \
- optr->ex_type = ET_FLT; \
- optr->ex_flt= DZC(left.ex_flt, OPR, right.ex_flt); \
- } \
- break; \
- case ET_VEC: \
- case ET_VI: \
- if (optr->ex_type != ET_VEC) { \
- if (optr->ex_type == ET_VI) { \
- post("expr~: Int. error %d", __LINE__); \
- abort(); \
- } \
- optr->ex_type = ET_VEC; \
- optr->ex_vec = (t_float *) \
- fts_malloc(sizeof (t_float)*expr->exp_vsize); \
- } \
- scalar = left.ex_flt; \
- rp = right.ex_vec; \
- op = optr->ex_vec; \
- for (i = 0; i < expr->exp_vsize; i++) { \
- *op++ = DZC(scalar, OPR, *rp); \
- rp++; \
- } \
- break; \
- case ET_SYM: \
- default: \
- post_error((fts_object_t *) expr, \
- "expr: ex_eval(%d): bad right type %ld\n", \
- __LINE__, right.ex_type); \
- nullret = 1; \
- } \
- break; \
-case ET_VEC: \
-case ET_VI: \
- if (optr->ex_type != ET_VEC) { \
- if (optr->ex_type == ET_VI) { \
- post("expr~: Int. error %d", __LINE__); \
- abort(); \
- } \
- optr->ex_type = ET_VEC; \
- optr->ex_vec = (t_float *) \
- fts_malloc(sizeof (t_float)*expr->exp_vsize); \
- } \
- op = optr->ex_vec; \
- lp = left.ex_vec; \
- switch(right.ex_type) { \
- case ET_INT: \
- scalar = right.ex_int; \
- for (i = 0; i < expr->exp_vsize; i++) { \
- *op++ = DZC(*lp, OPR, scalar); \
- lp++; \
- } \
- break; \
- case ET_FLT: \
- scalar = right.ex_flt; \
- for (i = 0; i < expr->exp_vsize; i++) { \
- *op++ = DZC(*lp, OPR, scalar); \
- lp++; \
- } \
- break; \
- case ET_VEC: \
- case ET_VI: \
- rp = right.ex_vec; \
- for (i = 0; i < expr->exp_vsize; i++) { \
- /* \
- * on a RISC processor one could copy \
- * 8 times in each round to get a considerable \
- * improvement \
- */ \
- *op++ = DZC(*lp, OPR, *rp); \
- rp++; lp++; \
- } \
- break; \
- case ET_SYM: \
- default: \
- post_error((fts_object_t *) expr, \
- "expr: ex_eval(%d): bad right type %ld\n", \
- __LINE__, right.ex_type); \
- nullret = 1; \
- } \
- break; \
-case ET_SYM: \
-default: \
- post_error((fts_object_t *) expr, \
- "expr: ex_eval(%d): bad left type %ld\n", \
- __LINE__, left.ex_type); \
-} \
+#define DZC(ARG1,OPR,ARG2) (ARG1 OPR ARG2)
+
+#define EVAL(OPR); \
+eptr = ex_eval(expr, ex_eval(expr, eptr, &left, idx), &right, idx); \
+switch (left.ex_type) { \
+case ET_INT: \
+ switch(right.ex_type) { \
+ case ET_INT: \
+ if (optr->ex_type == ET_VEC) { \
+ op = optr->ex_vec; \
+ scalar = (float)DZC(left.ex_int, OPR, right.ex_int); \
+ for (j = 0; j < expr->exp_vsize; j++) \
+ *op++ = scalar; \
+ } else { \
+ optr->ex_type = ET_INT; \
+ optr->ex_int = DZC(left.ex_int, OPR, right.ex_int); \
+ } \
+ break; \
+ case ET_FLT: \
+ if (optr->ex_type == ET_VEC) { \
+ op = optr->ex_vec; \
+ scalar = DZC(((float)left.ex_int), OPR, right.ex_flt);\
+ for (j = 0; j < expr->exp_vsize; j++) \
+ *op++ = scalar; \
+ } else { \
+ optr->ex_type = ET_FLT; \
+ optr->ex_flt = DZC(((float)left.ex_int), OPR, \
+ right.ex_flt); \
+ } \
+ break; \
+ case ET_VEC: \
+ case ET_VI: \
+ if (optr->ex_type != ET_VEC) { \
+ if (optr->ex_type == ET_VI) { \
+ post("expr~: Int. error %d", __LINE__); \
+ abort(); \
+ } \
+ optr->ex_type = ET_VEC; \
+ optr->ex_vec = (t_float *) \
+ fts_malloc(sizeof (t_float)*expr->exp_vsize); \
+ } \
+ scalar = left.ex_int; \
+ rp = right.ex_vec; \
+ op = optr->ex_vec; \
+ for (i = 0; i < expr->exp_vsize; i++) { \
+ *op++ = DZC (scalar, OPR, *rp); \
+ rp++; \
+ } \
+ break; \
+ case ET_SYM: \
+ default: \
+ post_error((fts_object_t *) expr, \
+ "expr: ex_eval(%d): bad right type %ld\n", \
+ __LINE__, right.ex_type); \
+ nullret = 1; \
+ } \
+ break; \
+case ET_FLT: \
+ switch(right.ex_type) { \
+ case ET_INT: \
+ if (optr->ex_type == ET_VEC) { \
+ op = optr->ex_vec; \
+ scalar = DZC((float) left.ex_flt, OPR, right.ex_int); \
+ for (j = 0; j < expr->exp_vsize; j++) \
+ *op++ = scalar; \
+ } else { \
+ optr->ex_type = ET_FLT; \
+ optr->ex_flt = DZC(left.ex_flt, OPR, right.ex_int); \
+ } \
+ break; \
+ case ET_FLT: \
+ if (optr->ex_type == ET_VEC) { \
+ op = optr->ex_vec; \
+ scalar = DZC(left.ex_flt, OPR, right.ex_flt); \
+ for (j = 0; j < expr->exp_vsize; j++) \
+ *op++ = scalar; \
+ } else { \
+ optr->ex_type = ET_FLT; \
+ optr->ex_flt= DZC(left.ex_flt, OPR, right.ex_flt); \
+ } \
+ break; \
+ case ET_VEC: \
+ case ET_VI: \
+ if (optr->ex_type != ET_VEC) { \
+ if (optr->ex_type == ET_VI) { \
+ post("expr~: Int. error %d", __LINE__); \
+ abort(); \
+ } \
+ optr->ex_type = ET_VEC; \
+ optr->ex_vec = (t_float *) \
+ fts_malloc(sizeof (t_float)*expr->exp_vsize); \
+ } \
+ scalar = left.ex_flt; \
+ rp = right.ex_vec; \
+ op = optr->ex_vec; \
+ for (i = 0; i < expr->exp_vsize; i++) { \
+ *op++ = DZC(scalar, OPR, *rp); \
+ rp++; \
+ } \
+ break; \
+ case ET_SYM: \
+ default: \
+ post_error((fts_object_t *) expr, \
+ "expr: ex_eval(%d): bad right type %ld\n", \
+ __LINE__, right.ex_type); \
+ nullret = 1; \
+ } \
+ break; \
+case ET_VEC: \
+case ET_VI: \
+ if (optr->ex_type != ET_VEC) { \
+ if (optr->ex_type == ET_VI) { \
+ post("expr~: Int. error %d", __LINE__); \
+ abort(); \
+ } \
+ optr->ex_type = ET_VEC; \
+ optr->ex_vec = (t_float *) \
+ fts_malloc(sizeof (t_float)*expr->exp_vsize); \
+ } \
+ op = optr->ex_vec; \
+ lp = left.ex_vec; \
+ switch(right.ex_type) { \
+ case ET_INT: \
+ scalar = right.ex_int; \
+ for (i = 0; i < expr->exp_vsize; i++) { \
+ *op++ = DZC(*lp, OPR, scalar); \
+ lp++; \
+ } \
+ break; \
+ case ET_FLT: \
+ scalar = right.ex_flt; \
+ for (i = 0; i < expr->exp_vsize; i++) { \
+ *op++ = DZC(*lp, OPR, scalar); \
+ lp++; \
+ } \
+ break; \
+ case ET_VEC: \
+ case ET_VI: \
+ rp = right.ex_vec; \
+ for (i = 0; i < expr->exp_vsize; i++) { \
+ /* \
+ * on a RISC processor one could copy \
+ * 8 times in each round to get a considerable \
+ * improvement \
+ */ \
+ *op++ = DZC(*lp, OPR, *rp); \
+ rp++; lp++; \
+ } \
+ break; \
+ case ET_SYM: \
+ default: \
+ post_error((fts_object_t *) expr, \
+ "expr: ex_eval(%d): bad right type %ld\n", \
+ __LINE__, right.ex_type); \
+ nullret = 1; \
+ } \
+ break; \
+case ET_SYM: \
+default: \
+ post_error((fts_object_t *) expr, \
+ "expr: ex_eval(%d): bad left type %ld\n", \
+ __LINE__, left.ex_type); \
+} \
break;
/*
* evaluate a unary operator, TYPE is applied to float operands
*/
-#define EVAL_UNARY(OPR, TYPE) \
- eptr = ex_eval(expr, eptr, &left, idx); \
- switch(left.ex_type) { \
- case ET_INT: \
- if (optr->ex_type == ET_VEC) { \
- ex_mkvector(optr->ex_vec,(float)(OPR left.ex_int),\
- expr->exp_vsize);\
- break; \
- } \
- optr->ex_type = ET_INT; \
- optr->ex_int = OPR left.ex_int; \
- break; \
- case ET_FLT: \
- if (optr->ex_type == ET_VEC) { \
- ex_mkvector(optr->ex_vec, OPR (TYPE left.ex_flt),\
- expr->exp_vsize);\
- break; \
- } \
- optr->ex_type = ET_FLT; \
- optr->ex_flt = OPR (TYPE left.ex_flt); \
- break; \
- case ET_VI: \
- case ET_VEC: \
- j = expr->exp_vsize; \
- if (optr->ex_type != ET_VEC) { \
- optr->ex_type = ET_VEC; \
- optr->ex_vec = (t_float *) \
- fts_malloc(sizeof (t_float)*expr->exp_vsize); \
- } \
- op = optr->ex_vec; \
- lp = left.ex_vec; \
- j = expr->exp_vsize; \
- for (i = 0; i < j; i++) \
- *op++ = OPR (TYPE *lp++); \
- break; \
- default: \
- post_error((fts_object_t *) expr, \
- "expr: ex_eval(%d): bad left type %ld\n", \
- __LINE__, left.ex_type); \
- nullret++; \
- } \
- break;
+#define EVAL_UNARY(OPR, TYPE) \
+ eptr = ex_eval(expr, eptr, &left, idx); \
+ switch(left.ex_type) { \
+ case ET_INT: \
+ if (optr->ex_type == ET_VEC) { \
+ ex_mkvector(optr->ex_vec,(float)(OPR left.ex_int),\
+ expr->exp_vsize);\
+ break; \
+ } \
+ optr->ex_type = ET_INT; \
+ optr->ex_int = OPR left.ex_int; \
+ break; \
+ case ET_FLT: \
+ if (optr->ex_type == ET_VEC) { \
+ ex_mkvector(optr->ex_vec, OPR (TYPE left.ex_flt),\
+ expr->exp_vsize);\
+ break; \
+ } \
+ optr->ex_type = ET_FLT; \
+ optr->ex_flt = OPR (TYPE left.ex_flt); \
+ break; \
+ case ET_VI: \
+ case ET_VEC: \
+ j = expr->exp_vsize; \
+ if (optr->ex_type != ET_VEC) { \
+ optr->ex_type = ET_VEC; \
+ optr->ex_vec = (t_float *) \
+ fts_malloc(sizeof (t_float)*expr->exp_vsize); \
+ } \
+ op = optr->ex_vec; \
+ lp = left.ex_vec; \
+ j = expr->exp_vsize; \
+ for (i = 0; i < j; i++) \
+ *op++ = OPR (TYPE *lp++); \
+ break; \
+ default: \
+ post_error((fts_object_t *) expr, \
+ "expr: ex_eval(%d): bad left type %ld\n", \
+ __LINE__, left.ex_type); \
+ nullret++; \
+ } \
+ break;
void
ex_mkvector(t_float *fp, t_float x, int size)
{
- while (size--)
- *fp++ = x;
+ while (size--)
+ *fp++ = x;
}
/*
@@ -905,29 +905,29 @@ ex_mkvector(t_float *fp, t_float x, int size)
void
ex_dzdetect(struct expr *expr)
{
- char *etype;
-
- if (!expr->exp_error & EE_DZ) {
- if (IS_EXPR(expr))
- etype = "expr";
- else if (IS_EXPR_TILDE(expr))
- etype = "expr~";
- else if (IS_FEXPR_TILDE(expr))
- etype = "fexpr~";
- else {
- post ("expr -- ex_dzdetect internal error");
- etype = "";
- }
- post ("%s divide by zero detected", etype);
- expr->exp_error |= EE_DZ;
- }
+ char *etype;
+
+ if (!expr->exp_error & EE_DZ) {
+ if (IS_EXPR(expr))
+ etype = "expr";
+ else if (IS_EXPR_TILDE(expr))
+ etype = "expr~";
+ else if (IS_FEXPR_TILDE(expr))
+ etype = "fexpr~";
+ else {
+ post ("expr -- ex_dzdetect internal error");
+ etype = "";
+ }
+ post ("%s divide by zero detected", etype);
+ expr->exp_error |= EE_DZ;
+ }
}
-
+
/*
* ex_eval -- evaluate the array of prefix expression
- * ex_eval returns the pointer to the first unevaluated node
- * in the array. This is a recursive routine.
+ * ex_eval returns the pointer to the first unevaluated node
+ * in the array. This is a recursive routine.
*/
/* SDY
@@ -944,270 +944,270 @@ ex_eval(struct expr *expr, struct ex_ex *eptr, struct ex_ex *optr, int idx)
/* the result pointer */
/* the sample numnber processed for fexpr~ */
{
- int i, j;
- t_float *lp, *rp, *op; /* left, right, and out pointer to vectors */
- t_float scalar;
- int nullret = 0; /* did we have an error */
- struct ex_ex left, right; /* left and right operands */
-
- left.ex_type = 0;
- left.ex_int = 0;
- right.ex_type = 0;
- right.ex_int = 0;
-
- if (!eptr)
- return (exNULL);
- switch (eptr->ex_type) {
- case ET_INT:
- if (optr->ex_type == ET_VEC)
- ex_mkvector(optr->ex_vec, (float) eptr->ex_int,
- expr->exp_vsize);
- else
- *optr = *eptr;
- return (++eptr);
-
- case ET_FLT:
-
- if (optr->ex_type == ET_VEC)
- ex_mkvector(optr->ex_vec, eptr->ex_flt, expr->exp_vsize);
- else
- *optr = *eptr;
- return (++eptr);
-
- case ET_SYM:
- if (optr->ex_type == ET_VEC) {
- post_error((fts_object_t *) expr,
- "expr: ex_eval: cannot turn string to vector\n");
- return (exNULL);
- }
- *optr = *eptr;
- return (++eptr);
- case ET_II:
- if (eptr->ex_int == -1) {
- post_error((fts_object_t *) expr,
- "expr: ex_eval: inlet number not set\n");
- return (exNULL);
- }
- if (optr->ex_type == ET_VEC) {
- ex_mkvector(optr->ex_vec,
- (t_float)expr->exp_var[eptr->ex_int].ex_int,
- expr->exp_vsize);
- } else {
- optr->ex_type = ET_INT;
- optr->ex_int = expr->exp_var[eptr->ex_int].ex_int;
- }
- return (++eptr);
- case ET_FI:
- if (eptr->ex_int == -1) {
- post_error((fts_object_t *) expr,
- "expr: ex_eval: inlet number not set\n");
- return (exNULL);
- }
- if (optr->ex_type == ET_VEC) {
- ex_mkvector(optr->ex_vec,
- expr->exp_var[eptr->ex_int].ex_flt, expr->exp_vsize);
- } else {
- optr->ex_type = ET_FLT;
- optr->ex_flt = expr->exp_var[eptr->ex_int].ex_flt;
- }
- return (++eptr);
-
- case ET_VSYM:
- if (optr->ex_type == ET_VEC) {
- post_error((fts_object_t *) expr,
- "expr: IntErr. vsym in for vec out\n");
- return (exNULL);
- }
- if (eptr->ex_int == -1) {
- post_error((fts_object_t *) expr,
- "expr: ex_eval: inlet number not set\n");
- return (exNULL);
- }
- optr->ex_type = ET_SYM;
- optr->ex_ptr = expr->exp_var[eptr->ex_int].ex_ptr;
- return(++eptr);
-
- case ET_VI:
- if (optr->ex_type != ET_VEC)
- *optr = expr->exp_var[eptr->ex_int];
- else if (optr->ex_vec != expr->exp_var[eptr->ex_int].ex_vec)
- memcpy(optr->ex_vec, expr->exp_var[eptr->ex_int].ex_vec,
- expr->exp_vsize * sizeof (t_float));
- return(++eptr);
- case ET_VEC:
- if (optr->ex_type != ET_VEC) {
- optr->ex_type = ET_VEC;
- optr->ex_vec = eptr->ex_vec;
- eptr->ex_type = ET_INT;
- eptr->ex_int = 0;
- } else if (optr->ex_vec != eptr->ex_vec) {
- memcpy(optr->ex_vec, eptr->ex_vec,
- expr->exp_vsize * sizeof (t_float));
+ int i, j;
+ t_float *lp, *rp, *op; /* left, right, and out pointer to vectors */
+ t_float scalar;
+ int nullret = 0; /* did we have an error */
+ struct ex_ex left, right; /* left and right operands */
+
+ left.ex_type = 0;
+ left.ex_int = 0;
+ right.ex_type = 0;
+ right.ex_int = 0;
+
+ if (!eptr)
+ return (exNULL);
+ switch (eptr->ex_type) {
+ case ET_INT:
+ if (optr->ex_type == ET_VEC)
+ ex_mkvector(optr->ex_vec, (float) eptr->ex_int,
+ expr->exp_vsize);
+ else
+ *optr = *eptr;
+ return (++eptr);
+
+ case ET_FLT:
+
+ if (optr->ex_type == ET_VEC)
+ ex_mkvector(optr->ex_vec, eptr->ex_flt, expr->exp_vsize);
+ else
+ *optr = *eptr;
+ return (++eptr);
+
+ case ET_SYM:
+ if (optr->ex_type == ET_VEC) {
+ post_error((fts_object_t *) expr,
+ "expr: ex_eval: cannot turn string to vector\n");
+ return (exNULL);
+ }
+ *optr = *eptr;
+ return (++eptr);
+ case ET_II:
+ if (eptr->ex_int == -1) {
+ post_error((fts_object_t *) expr,
+ "expr: ex_eval: inlet number not set\n");
+ return (exNULL);
+ }
+ if (optr->ex_type == ET_VEC) {
+ ex_mkvector(optr->ex_vec,
+ (t_float)expr->exp_var[eptr->ex_int].ex_int,
+ expr->exp_vsize);
+ } else {
+ optr->ex_type = ET_INT;
+ optr->ex_int = expr->exp_var[eptr->ex_int].ex_int;
+ }
+ return (++eptr);
+ case ET_FI:
+ if (eptr->ex_int == -1) {
+ post_error((fts_object_t *) expr,
+ "expr: ex_eval: inlet number not set\n");
+ return (exNULL);
+ }
+ if (optr->ex_type == ET_VEC) {
+ ex_mkvector(optr->ex_vec,
+ expr->exp_var[eptr->ex_int].ex_flt, expr->exp_vsize);
+ } else {
+ optr->ex_type = ET_FLT;
+ optr->ex_flt = expr->exp_var[eptr->ex_int].ex_flt;
+ }
+ return (++eptr);
+
+ case ET_VSYM:
+ if (optr->ex_type == ET_VEC) {
+ post_error((fts_object_t *) expr,
+ "expr: IntErr. vsym in for vec out\n");
+ return (exNULL);
+ }
+ if (eptr->ex_int == -1) {
+ post_error((fts_object_t *) expr,
+ "expr: ex_eval: inlet number not set\n");
+ return (exNULL);
+ }
+ optr->ex_type = ET_SYM;
+ optr->ex_ptr = expr->exp_var[eptr->ex_int].ex_ptr;
+ return(++eptr);
+
+ case ET_VI:
+ if (optr->ex_type != ET_VEC)
+ *optr = expr->exp_var[eptr->ex_int];
+ else if (optr->ex_vec != expr->exp_var[eptr->ex_int].ex_vec)
+ memcpy(optr->ex_vec, expr->exp_var[eptr->ex_int].ex_vec,
+ expr->exp_vsize * sizeof (t_float));
+ return(++eptr);
+ case ET_VEC:
+ if (optr->ex_type != ET_VEC) {
+ optr->ex_type = ET_VEC;
+ optr->ex_vec = eptr->ex_vec;
+ eptr->ex_type = ET_INT;
+ eptr->ex_int = 0;
+ } else if (optr->ex_vec != eptr->ex_vec) {
+ memcpy(optr->ex_vec, eptr->ex_vec,
+ expr->exp_vsize * sizeof (t_float));
/* do we need to free here? or can we free higher up */
/* SDY the next lines do not make sense */
post("calling fts_free\n");
abort();
- fts_free(optr->ex_vec);
- optr->ex_type = ET_INT;
- eptr->ex_int = 0;
- } else { /* this should not happen */
- post("expr int. error, optr->ex_vec = %d",optr->ex_vec);
- abort();
- }
- return(++eptr);
- case ET_XI0:
- /* short hand for $x?[0] */
-
- /* SDY delete the following check */
- if (!IS_FEXPR_TILDE(expr) || optr->ex_type==ET_VEC) {
- post("%d:exp->exp_flags = %d", __LINE__,expr->exp_flags);
- abort();
- }
- optr->ex_type = ET_FLT;
- optr->ex_flt = expr->exp_var[eptr->ex_int].ex_vec[idx];
- return(++eptr);
- case ET_YOM1:
- /*
- * short hand for $y?[-1]
- * if we are calculating the first sample of the vector
- * we need to look at the previous results buffer
- */
- optr->ex_type = ET_FLT;
- if (idx == 0)
- optr->ex_flt =
- expr->exp_p_res[eptr->ex_int][expr->exp_vsize - 1];
- else
- optr->ex_flt=expr->exp_tmpres[eptr->ex_int][idx-1];
- return(++eptr);
-
- case ET_YO:
- case ET_XI:
- /* SDY delete the following */
- if (!IS_FEXPR_TILDE(expr) || optr->ex_type==ET_VEC) {
- post("%d:expr->exp_flags = %d", __LINE__,expr->exp_flags);
- abort();
- }
- return (eval_sigidx(expr, eptr, optr, idx));
-
- case ET_TBL:
- case ET_SI:
- return (eval_tab(expr, eptr, optr, idx));
- case ET_FUNC:
- return (eval_func(expr, eptr, optr, idx));
- case ET_VAR:
- return (eval_var(expr, eptr, optr, idx));
- case ET_OP:
- break;
- case ET_STR:
- case ET_LP:
- case ET_LB:
- default:
- post_error((fts_object_t *) expr,
- "expr: ex_eval: unexpected type %d\n", eptr->ex_type);
- return (exNULL);
- }
- if (!eptr[1].ex_type) {
- post_error((fts_object_t *) expr,
- "expr: ex_eval: not enough nodes 1\n");
- return (exNULL);
- }
- if (!unary_op(eptr->ex_op) && !eptr[2].ex_type) {
- post_error((fts_object_t *) expr,
- "expr: ex_eval: not enough nodes 2\n");
- return (exNULL);
- }
-
- switch((eptr++)->ex_op) {
- case OP_STORE:
- return (eval_store(expr, eptr, optr, idx));
- case OP_NOT:
- EVAL_UNARY(!, +);
- case OP_NEG:
- EVAL_UNARY(~, (long));
- case OP_UMINUS:
- EVAL_UNARY(-, +);
- case OP_MUL:
- EVAL(*);
- case OP_ADD:
- EVAL(+);
- case OP_SUB:
- EVAL(-);
- case OP_LT:
- EVAL(<);
- case OP_LE:
- EVAL(<=);
- case OP_GT:
- EVAL(>);
- case OP_GE:
- EVAL(>=);
- case OP_EQ:
- EVAL(==);
- case OP_NE:
- EVAL(!=);
+ fts_free(optr->ex_vec);
+ optr->ex_type = ET_INT;
+ eptr->ex_int = 0;
+ } else { /* this should not happen */
+ post("expr int. error, optr->ex_vec = %d",optr->ex_vec);
+ abort();
+ }
+ return(++eptr);
+ case ET_XI0:
+ /* short hand for $x?[0] */
+
+ /* SDY delete the following check */
+ if (!IS_FEXPR_TILDE(expr) || optr->ex_type==ET_VEC) {
+ post("%d:exp->exp_flags = %d", __LINE__,expr->exp_flags);
+ abort();
+ }
+ optr->ex_type = ET_FLT;
+ optr->ex_flt = expr->exp_var[eptr->ex_int].ex_vec[idx];
+ return(++eptr);
+ case ET_YOM1:
+ /*
+ * short hand for $y?[-1]
+ * if we are calculating the first sample of the vector
+ * we need to look at the previous results buffer
+ */
+ optr->ex_type = ET_FLT;
+ if (idx == 0)
+ optr->ex_flt =
+ expr->exp_p_res[eptr->ex_int][expr->exp_vsize - 1];
+ else
+ optr->ex_flt=expr->exp_tmpres[eptr->ex_int][idx-1];
+ return(++eptr);
+
+ case ET_YO:
+ case ET_XI:
+ /* SDY delete the following */
+ if (!IS_FEXPR_TILDE(expr) || optr->ex_type==ET_VEC) {
+ post("%d:expr->exp_flags = %d", __LINE__,expr->exp_flags);
+ abort();
+ }
+ return (eval_sigidx(expr, eptr, optr, idx));
+
+ case ET_TBL:
+ case ET_SI:
+ return (eval_tab(expr, eptr, optr, idx));
+ case ET_FUNC:
+ return (eval_func(expr, eptr, optr, idx));
+ case ET_VAR:
+ return (eval_var(expr, eptr, optr, idx));
+ case ET_OP:
+ break;
+ case ET_STR:
+ case ET_LP:
+ case ET_LB:
+ default:
+ post_error((fts_object_t *) expr,
+ "expr: ex_eval: unexpected type %d\n", eptr->ex_type);
+ return (exNULL);
+ }
+ if (!eptr[1].ex_type) {
+ post_error((fts_object_t *) expr,
+ "expr: ex_eval: not enough nodes 1\n");
+ return (exNULL);
+ }
+ if (!unary_op(eptr->ex_op) && !eptr[2].ex_type) {
+ post_error((fts_object_t *) expr,
+ "expr: ex_eval: not enough nodes 2\n");
+ return (exNULL);
+ }
+
+ switch((eptr++)->ex_op) {
+ case OP_STORE:
+ return (eval_store(expr, eptr, optr, idx));
+ case OP_NOT:
+ EVAL_UNARY(!, +);
+ case OP_NEG:
+ EVAL_UNARY(~, (long));
+ case OP_UMINUS:
+ EVAL_UNARY(-, +);
+ case OP_MUL:
+ EVAL(*);
+ case OP_ADD:
+ EVAL(+);
+ case OP_SUB:
+ EVAL(-);
+ case OP_LT:
+ EVAL(<);
+ case OP_LE:
+ EVAL(<=);
+ case OP_GT:
+ EVAL(>);
+ case OP_GE:
+ EVAL(>=);
+ case OP_EQ:
+ EVAL(==);
+ case OP_NE:
+ EVAL(!=);
/*
* following operators convert their argument to integer
*/
#undef DZC
-#define DZC(ARG1,OPR,ARG2) (((int)ARG1) OPR ((int)ARG2))
- case OP_SL:
- EVAL(<<);
- case OP_SR:
- EVAL(>>);
- case OP_AND:
- EVAL(&);
- case OP_XOR:
- EVAL(^);
- case OP_OR:
- EVAL(|);
- case OP_LAND:
- EVAL(&&);
- case OP_LOR:
- EVAL(||);
+#define DZC(ARG1,OPR,ARG2) (((int)ARG1) OPR ((int)ARG2))
+ case OP_SL:
+ EVAL(<<);
+ case OP_SR:
+ EVAL(>>);
+ case OP_AND:
+ EVAL(&);
+ case OP_XOR:
+ EVAL(^);
+ case OP_OR:
+ EVAL(|);
+ case OP_LAND:
+ EVAL(&&);
+ case OP_LOR:
+ EVAL(||);
/*
* for modulo we need to convert to integer and check for divide by zero
*/
#undef DZC
-#define DZC(ARG1,OPR,ARG2) (((ARG2)?(((int)ARG1) OPR ((int)ARG2)) \
- : (ex_dzdetect(expr),0)))
- case OP_MOD:
- EVAL(%);
+#define DZC(ARG1,OPR,ARG2) (((ARG2)?(((int)ARG1) OPR ((int)ARG2)) \
+ : (ex_dzdetect(expr),0)))
+ case OP_MOD:
+ EVAL(%);
/*
* define the divide by zero check for divide
*/
#undef DZC
-#define DZC(ARG1,OPR,ARG2) (((ARG2)?(ARG1 OPR ARG2):(ex_dzdetect(expr),0)))
- case OP_DIV:
- EVAL(/);
- case OP_LP:
- case OP_RP:
- case OP_LB:
- case OP_RB:
- case OP_COMMA:
- case OP_SEMI:
- default:
- post_error((fts_object_t *) expr, "expr: ex_print: bad op 0x%x\n", eptr->ex_op);
- return (exNULL);
- }
-
-
- /*
- * the left and right nodes could have been transformed to vectors
- * down the chain
- */
- if (left.ex_type == ET_VEC)
- fts_free(left.ex_vec);
- if (right.ex_type == ET_VEC)
- fts_free(right.ex_vec);
- if (nullret)
- return (exNULL);
- else
- return (eptr);
+#define DZC(ARG1,OPR,ARG2) (((ARG2)?(ARG1 OPR ARG2):(ex_dzdetect(expr),0)))
+ case OP_DIV:
+ EVAL(/);
+ case OP_LP:
+ case OP_RP:
+ case OP_LB:
+ case OP_RB:
+ case OP_COMMA:
+ case OP_SEMI:
+ default:
+ post_error((fts_object_t *) expr, "expr: ex_print: bad op 0x%x\n", eptr->ex_op);
+ return (exNULL);
+ }
+
+
+ /*
+ * the left and right nodes could have been transformed to vectors
+ * down the chain
+ */
+ if (left.ex_type == ET_VEC)
+ fts_free(left.ex_vec);
+ if (right.ex_type == ET_VEC)
+ fts_free(right.ex_vec);
+ if (nullret)
+ return (exNULL);
+ else
+ return (eptr);
}
/*
* eval_func -- evaluate a function, call ex_eval() on all the arguments
- * so that all of them are terminal nodes. The call the
- * appropriate function
+ * so that all of them are terminal nodes. The call the
+ * appropriate function
*/
struct ex_ex *
eval_func(struct expr *expr, struct ex_ex *eptr, struct ex_ex *optr, int idx)
@@ -1215,37 +1215,37 @@ eval_func(struct expr *expr, struct ex_ex *eptr, struct ex_ex *optr, int idx)
/* the operation stack */
/* the result pointer */
{
- int i;
- struct ex_ex args[MAX_ARGS];
- t_ex_func *f;
-
- f = (t_ex_func *)(eptr++)->ex_ptr;
- if (!f || !f->f_name) {
- return (exNULL);
- }
- if (f->f_argc > MAX_ARGS) {
- post_error((fts_object_t *) expr, "expr: eval_func: asking too many arguments\n");
- return (exNULL);
- }
-
- for (i = 0; i < f->f_argc; i++) {
- args[i].ex_type = 0;
- args[i].ex_int = 0;
- eptr = ex_eval(expr, eptr, &args[i], idx);
- }
- (*f->f_func)(expr, f->f_argc, args, optr);
- for (i = 0; i < f->f_argc; i++) {
- if (args[i].ex_type == ET_VEC)
- fts_free(args[i].ex_vec);
- }
- return (eptr);
+ int i;
+ struct ex_ex args[MAX_ARGS];
+ t_ex_func *f;
+
+ f = (t_ex_func *)(eptr++)->ex_ptr;
+ if (!f || !f->f_name) {
+ return (exNULL);
+ }
+ if (f->f_argc > MAX_ARGS) {
+ post_error((fts_object_t *) expr, "expr: eval_func: asking too many arguments\n");
+ return (exNULL);
+ }
+
+ for (i = 0; i < f->f_argc; i++) {
+ args[i].ex_type = 0;
+ args[i].ex_int = 0;
+ eptr = ex_eval(expr, eptr, &args[i], idx);
+ }
+ (*f->f_func)(expr, f->f_argc, args, optr);
+ for (i = 0; i < f->f_argc; i++) {
+ if (args[i].ex_type == ET_VEC)
+ fts_free(args[i].ex_vec);
+ }
+ return (eptr);
}
/*
* eval_store -- evaluate the '=' operator,
- * make sure the first operator is a legal left operator
- * and call ex_eval on the right operator
+ * make sure the first operator is a legal left operator
+ * and call ex_eval on the right operator
*/
struct ex_ex *
eval_store(struct expr *expr, struct ex_ex *eptr, struct ex_ex *optr, int idx)
@@ -1253,11 +1253,11 @@ eval_store(struct expr *expr, struct ex_ex *eptr, struct ex_ex *optr, int idx)
/* the operation stack */
/* the result pointer */
{
- struct ex_ex arg;
- int isvalue;
- char *tbl = (char *) 0;
- char *var = (char *) 0;
- int badleft = 0;
+ struct ex_ex arg;
+ int isvalue;
+ char *tbl = (char *) 0;
+ char *var = (char *) 0;
+ int badleft = 0;
post("store called\n");
ex_print(eptr);
@@ -1265,41 +1265,41 @@ eptr = ex_eval(expr, ++eptr, optr, idx);
return (eptr);
#ifdef notdef /* SDY */
- arg.ex_type = ET_INT;
- arg.ex_int = 0;
- if (eptr->ex_type == ET_VAR) {
- var = (char *) eptr->ex_ptr;
-
- eptr = ex_eval(expr, ++eptr, &arg, idx);
- (void)max_ex_var_store(expr, (t_symbol *)var, &arg, optr);
- if (arg.ex_type == ET_VEC)
- fts_free(arg.ex_vec);
- }
-
-
- if (eptr->ex_type == ET_SI) {
- eptr++;
- if (eptr->ex_type =
- }
-
- /* the left operator should either be a value or a array member */
- switch (eptr->ex_type) {
- case ET_SI:
- if ((eptr + 1)->ex_type == OP_LB) {
- }
- if (!expr->exp_var[eptr->ex_int].ex_ptr) {
- if (!(expr->exp_error & EE_NOTABLE)) {
- post("expr: syntax error: no string for inlet %d", eptr->ex_int + 1);
- post("expr: No more table errors will be reported");
- post("expr: till the next reset");
- expr->exp_error |= EE_NOTABLE;
- }
- badleft++;
- } else
- tbl = (char *) expr->exp_var[eptr->ex_int].ex_ptr;
- break;
- case ET_TBL:
- }
+ arg.ex_type = ET_INT;
+ arg.ex_int = 0;
+ if (eptr->ex_type == ET_VAR) {
+ var = (char *) eptr->ex_ptr;
+
+ eptr = ex_eval(expr, ++eptr, &arg, idx);
+ (void)max_ex_var_store(expr, (t_symbol *)var, &arg, optr);
+ if (arg.ex_type == ET_VEC)
+ fts_free(arg.ex_vec);
+ }
+
+
+ if (eptr->ex_type == ET_SI) {
+ eptr++;
+ if (eptr->ex_type =
+ }
+
+ /* the left operator should either be a value or a array member */
+ switch (eptr->ex_type) {
+ case ET_SI:
+ if ((eptr + 1)->ex_type == OP_LB) {
+ }
+ if (!expr->exp_var[eptr->ex_int].ex_ptr) {
+ if (!(expr->exp_error & EE_NOTABLE)) {
+ post("expr: syntax error: no string for inlet %d", eptr->ex_int + 1);
+ post("expr: No more table errors will be reported");
+ post("expr: till the next reset");
+ expr->exp_error |= EE_NOTABLE;
+ }
+ badleft++;
+ } else
+ tbl = (char *) expr->exp_var[eptr->ex_int].ex_ptr;
+ break;
+ case ET_TBL:
+ }
#endif /* SDY */
}
@@ -1312,43 +1312,43 @@ eval_tab(struct expr *expr, struct ex_ex *eptr, struct ex_ex *optr, int idx)
/* the operation stack */
/* the result pointer */
{
- struct ex_ex arg;
- char *tbl = (char *) 0;
- int notable = 0;
-
- if (eptr->ex_type == ET_SI) {
- if (!expr->exp_var[eptr->ex_int].ex_ptr) {
+ struct ex_ex arg;
+ char *tbl = (char *) 0;
+ int notable = 0;
+
+ if (eptr->ex_type == ET_SI) {
+ if (!expr->exp_var[eptr->ex_int].ex_ptr) {
/* SDY post_error() does not work in MAX/MSP yet
- post_error((fts_object_t *) expr,
- "expr: syntax error: no string for inlet %d\n", eptr->ex_int + 1);
+ post_error((fts_object_t *) expr,
+ "expr: syntax error: no string for inlet %d\n", eptr->ex_int + 1);
*/
- if (!(expr->exp_error & EE_NOTABLE)) {
- post("expr: syntax error: no string for inlet %d", eptr->ex_int + 1);
- post("expr: No more table errors will be reported");
- post("expr: till the next reset");
- expr->exp_error |= EE_NOTABLE;
- }
- notable++;
- } else
- tbl = (char *) expr->exp_var[eptr->ex_int].ex_ptr;
- } else if (eptr->ex_type == ET_TBL)
- tbl = (char *) eptr->ex_ptr;
- else {
- post_error((fts_object_t *) expr, "expr: eval_tbl: bad type %ld\n", eptr->ex_type);
- notable++;
-
- }
- arg.ex_type = 0;
- arg.ex_int = 0;
- eptr = ex_eval(expr, ++eptr, &arg, idx);
-
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- if (!notable)
- (void)max_ex_tab(expr, (t_symbol *)tbl, &arg, optr);
- if (arg.ex_type == ET_VEC)
- fts_free(arg.ex_vec);
- return (eptr);
+ if (!(expr->exp_error & EE_NOTABLE)) {
+ post("expr: syntax error: no string for inlet %d", eptr->ex_int + 1);
+ post("expr: No more table errors will be reported");
+ post("expr: till the next reset");
+ expr->exp_error |= EE_NOTABLE;
+ }
+ notable++;
+ } else
+ tbl = (char *) expr->exp_var[eptr->ex_int].ex_ptr;
+ } else if (eptr->ex_type == ET_TBL)
+ tbl = (char *) eptr->ex_ptr;
+ else {
+ post_error((fts_object_t *) expr, "expr: eval_tbl: bad type %ld\n", eptr->ex_type);
+ notable++;
+
+ }
+ arg.ex_type = 0;
+ arg.ex_int = 0;
+ eptr = ex_eval(expr, ++eptr, &arg, idx);
+
+ optr->ex_type = ET_INT;
+ optr->ex_int = 0;
+ if (!notable)
+ (void)max_ex_tab(expr, (t_symbol *)tbl, &arg, optr);
+ if (arg.ex_type == ET_VEC)
+ fts_free(arg.ex_vec);
+ return (eptr);
}
/*
@@ -1360,38 +1360,38 @@ eval_var(struct expr *expr, struct ex_ex *eptr, struct ex_ex *optr, int idx)
/* the operation stack */
/* the result pointer */
{
- struct ex_ex arg;
- char *var = (char *) 0;
- int novar = 0;
-
- if (eptr->ex_type == ET_SI) {
- if (!expr->exp_var[eptr->ex_int].ex_ptr) {
+ struct ex_ex arg;
+ char *var = (char *) 0;
+ int novar = 0;
+
+ if (eptr->ex_type == ET_SI) {
+ if (!expr->exp_var[eptr->ex_int].ex_ptr) {
/* SDY post_error() does not work in MAX/MSP yet
post_error((fts_object_t *) expr,
"expr: syntax error: no string for inlet %d\n", eptr->ex_int + 1);
*/
- if (!(expr->exp_error & EE_NOVAR)) {
- post("expr: syntax error: no string for inlet %d", eptr->ex_int + 1);
- post("expr: No more table errors will be reported");
- post("expr: till the next reset");
- expr->exp_error |= EE_NOVAR;
- }
- novar++;
- } else
- var = (char *) expr->exp_var[eptr->ex_int].ex_ptr;
- } else if (eptr->ex_type == ET_VAR)
- var = (char *) eptr->ex_ptr;
- else {
- post_error((fts_object_t *) expr, "expr: eval_tbl: bad type %ld\n", eptr->ex_type);
- novar++;
-
- }
-
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- if (!novar)
- (void)max_ex_var(expr, (t_symbol *)var, optr);
- return (++eptr);
+ if (!(expr->exp_error & EE_NOVAR)) {
+ post("expr: syntax error: no string for inlet %d", eptr->ex_int + 1);
+ post("expr: No more table errors will be reported");
+ post("expr: till the next reset");
+ expr->exp_error |= EE_NOVAR;
+ }
+ novar++;
+ } else
+ var = (char *) expr->exp_var[eptr->ex_int].ex_ptr;
+ } else if (eptr->ex_type == ET_VAR)
+ var = (char *) eptr->ex_ptr;
+ else {
+ post_error((fts_object_t *) expr, "expr: eval_tbl: bad type %ld\n", eptr->ex_type);
+ novar++;
+
+ }
+
+ optr->ex_type = ET_INT;
+ optr->ex_int = 0;
+ if (!novar)
+ (void)max_ex_var(expr, (t_symbol *)var, optr);
+ return (++eptr);
}
/*
@@ -1404,148 +1404,148 @@ eval_sigidx(struct expr *expr, struct ex_ex *eptr, struct ex_ex *optr, int idx)
/* the result pointer */
/* the index */
{
- struct ex_ex arg;
- struct ex_ex *reteptr;
- int i = 0, j = 0;
- float fi = 0, /* index in float */
- rem_i = 0; /* remains of the float */
- char *tbl;
-
- arg.ex_type = 0;
- arg.ex_int = 0;
- reteptr = ex_eval(expr, eptr + 1, &arg, idx);
- if (arg.ex_type == ET_FLT) {
- fi = arg.ex_flt; /* float index */
- i = (int) arg.ex_flt; /* integer index */
- rem_i = arg.ex_flt - i; /* remains of integer */
- } else if (arg.ex_type == ET_INT) {
- fi = arg.ex_int; /* float index */
- i = arg.ex_int;
- rem_i = 0;
- } else {
- post("eval_sigidx: bad res type (%d)", arg.ex_type);
- }
- optr->ex_type = ET_FLT;
- /*
- * indexing an input vector
- */
- if (eptr->ex_type == ET_XI) {
- if (fi > 0) {
- if (!(expr->exp_error & EE_BI_INPUT)) {
- expr->exp_error |= EE_BI_INPUT;
- post("expr: input vector index > 0, (vector x%d[%f])",
- eptr->ex_int + 1, i + rem_i);
- post("fexpr~: index assumed to be = 0");
- post("fexpr~: no error report till next reset");
- ex_print(eptr);
- }
- /* just replace it with zero */
- i = 0;
- rem_i = 0;
- }
- if (cal_sigidx(optr, i, rem_i, idx, expr->exp_vsize,
- expr->exp_var[eptr->ex_int].ex_vec,
- expr->exp_p_var[eptr->ex_int])) {
- if (!(expr->exp_error & EE_BI_INPUT)) {
- expr->exp_error |= EE_BI_INPUT;
- post("expr: input vector index < -VectorSize, (vector x%d[%f])", eptr->ex_int + 1, fi);
- ex_print(eptr);
- post("fexpr~: index assumed to be = -%d",
- expr->exp_vsize);
- post("fexpr~: no error report till next reset");
- }
- }
-
- /*
- * indexing an output vector
- */
- } else if (eptr->ex_type == ET_YO) {
- /* for output vectors index of zero is not legal */
- if (fi >= 0) {
- if (!(expr->exp_error & EE_BI_OUTPUT)) {
- expr->exp_error |= EE_BI_OUTPUT;
- post("fexpr~: bad output index, (%f)", fi);
- ex_print(eptr);
- post("fexpr~: no error report till next reset");
- post("fexpr~: index assumed to be = -1");
- }
- i = -1;
- }
- if (eptr->ex_int >= expr->exp_nexpr) {
- post("fexpr~: $y%d illegal: not that many exprs",
- eptr->ex_int);
- optr->ex_flt = 0;
- return (reteptr);
- }
- if (cal_sigidx(optr, i, rem_i, idx, expr->exp_vsize,
- expr->exp_tmpres[eptr->ex_int],
- expr->exp_p_res[eptr->ex_int])) {
- if (!(expr->exp_error & EE_BI_OUTPUT)) {
- expr->exp_error |= EE_BI_OUTPUT;
- post("fexpr~: bad output index, (%f)", fi);
- ex_print(eptr);
- post("fexpr~: index assumed to be = -%d",
- expr->exp_vsize);
- }
- }
- } else {
- optr->ex_flt = 0;
- post("fexpr~:eval_sigidx: internal error - unknown vector (%d)",
- eptr->ex_type);
- }
- return (reteptr);
+ struct ex_ex arg;
+ struct ex_ex *reteptr;
+ int i = 0, j = 0;
+ float fi = 0, /* index in float */
+ rem_i = 0; /* remains of the float */
+ char *tbl;
+
+ arg.ex_type = 0;
+ arg.ex_int = 0;
+ reteptr = ex_eval(expr, eptr + 1, &arg, idx);
+ if (arg.ex_type == ET_FLT) {
+ fi = arg.ex_flt; /* float index */
+ i = (int) arg.ex_flt; /* integer index */
+ rem_i = arg.ex_flt - i; /* remains of integer */
+ } else if (arg.ex_type == ET_INT) {
+ fi = arg.ex_int; /* float index */
+ i = arg.ex_int;
+ rem_i = 0;
+ } else {
+ post("eval_sigidx: bad res type (%d)", arg.ex_type);
+ }
+ optr->ex_type = ET_FLT;
+ /*
+ * indexing an input vector
+ */
+ if (eptr->ex_type == ET_XI) {
+ if (fi > 0) {
+ if (!(expr->exp_error & EE_BI_INPUT)) {
+ expr->exp_error |= EE_BI_INPUT;
+ post("expr: input vector index > 0, (vector x%d[%f])",
+ eptr->ex_int + 1, i + rem_i);
+ post("fexpr~: index assumed to be = 0");
+ post("fexpr~: no error report till next reset");
+ ex_print(eptr);
+ }
+ /* just replace it with zero */
+ i = 0;
+ rem_i = 0;
+ }
+ if (cal_sigidx(optr, i, rem_i, idx, expr->exp_vsize,
+ expr->exp_var[eptr->ex_int].ex_vec,
+ expr->exp_p_var[eptr->ex_int])) {
+ if (!(expr->exp_error & EE_BI_INPUT)) {
+ expr->exp_error |= EE_BI_INPUT;
+ post("expr: input vector index < -VectorSize, (vector x%d[%f])", eptr->ex_int + 1, fi);
+ ex_print(eptr);
+ post("fexpr~: index assumed to be = -%d",
+ expr->exp_vsize);
+ post("fexpr~: no error report till next reset");
+ }
+ }
+
+ /*
+ * indexing an output vector
+ */
+ } else if (eptr->ex_type == ET_YO) {
+ /* for output vectors index of zero is not legal */
+ if (fi >= 0) {
+ if (!(expr->exp_error & EE_BI_OUTPUT)) {
+ expr->exp_error |= EE_BI_OUTPUT;
+ post("fexpr~: bad output index, (%f)", fi);
+ ex_print(eptr);
+ post("fexpr~: no error report till next reset");
+ post("fexpr~: index assumed to be = -1");
+ }
+ i = -1;
+ }
+ if (eptr->ex_int >= expr->exp_nexpr) {
+ post("fexpr~: $y%d illegal: not that many exprs",
+ eptr->ex_int);
+ optr->ex_flt = 0;
+ return (reteptr);
+ }
+ if (cal_sigidx(optr, i, rem_i, idx, expr->exp_vsize,
+ expr->exp_tmpres[eptr->ex_int],
+ expr->exp_p_res[eptr->ex_int])) {
+ if (!(expr->exp_error & EE_BI_OUTPUT)) {
+ expr->exp_error |= EE_BI_OUTPUT;
+ post("fexpr~: bad output index, (%f)", fi);
+ ex_print(eptr);
+ post("fexpr~: index assumed to be = -%d",
+ expr->exp_vsize);
+ }
+ }
+ } else {
+ optr->ex_flt = 0;
+ post("fexpr~:eval_sigidx: internal error - unknown vector (%d)",
+ eptr->ex_type);
+ }
+ return (reteptr);
}
/*
* cal_sigidx -- given two tables (one current one previous) calculate an
* evaluation of a float index into the vectors by linear
- * interpolation
- * return 0 on success, 1 on failure (index out of bound)
+ * interpolation
+ * return 0 on success, 1 on failure (index out of bound)
*/
static int
-cal_sigidx(struct ex_ex *optr, /* The output value */
- int i, float rem_i, /* integer and fractinal part of index */
- int idx, /* index of current fexpr~ processing */
- int vsize, /* vector size */
- float *curvec, float *prevec) /* current and previous table */
+cal_sigidx(struct ex_ex *optr, /* The output value */
+ int i, float rem_i, /* integer and fractinal part of index */
+ int idx, /* index of current fexpr~ processing */
+ int vsize, /* vector size */
+ float *curvec, float *prevec) /* current and previous table */
{
- int n;
-
- n = i + idx;
- if (n > 0) {
- /* from the curvec */
- if (rem_i)
- optr->ex_flt = curvec[n] +
- rem_i * (curvec[n] - curvec[n - 1]);
- else
- optr->ex_flt = curvec[n];
- return (0);
- }
- if (n == 0) {
- /*
- * this is the case that the remaining float
- * is between two tables
- */
- if (rem_i)
- optr->ex_flt = *curvec +
- rem_i * (*curvec - prevec[vsize - 1]);
- else
- optr->ex_flt = *curvec;
- return (0);
- }
- /* find the index in the saved buffer */
- n = vsize + n;
- if (n > 0) {
- if (rem_i)
- optr->ex_flt = prevec[n] +
- rem_i * (prevec[n] - prevec[n - 1]);
- else
- optr->ex_flt = prevec[n];
- return (0);
- }
- /* out of bound */
- optr->ex_flt = *prevec;
- return (1);
+ int n;
+
+ n = i + idx;
+ if (n > 0) {
+ /* from the curvec */
+ if (rem_i)
+ optr->ex_flt = curvec[n] +
+ rem_i * (curvec[n] - curvec[n - 1]);
+ else
+ optr->ex_flt = curvec[n];
+ return (0);
+ }
+ if (n == 0) {
+ /*
+ * this is the case that the remaining float
+ * is between two tables
+ */
+ if (rem_i)
+ optr->ex_flt = *curvec +
+ rem_i * (*curvec - prevec[vsize - 1]);
+ else
+ optr->ex_flt = *curvec;
+ return (0);
+ }
+ /* find the index in the saved buffer */
+ n = vsize + n;
+ if (n > 0) {
+ if (rem_i)
+ optr->ex_flt = prevec[n] +
+ rem_i * (prevec[n] - prevec[n - 1]);
+ else
+ optr->ex_flt = prevec[n];
+ return (0);
+ }
+ /* out of bound */
+ optr->ex_flt = *prevec;
+ return (1);
}
/*
@@ -1554,314 +1554,314 @@ cal_sigidx(struct ex_ex *optr, /* The output value */
int
getoken(struct expr *expr, struct ex_ex *eptr)
{
- char *p;
- long i;
+ char *p;
+ long i;
- if (!expr->exp_str) {
- post("expr: getoken: expression string not set\n");
- return (0);
- }
+ if (!expr->exp_str) {
+ post("expr: getoken: expression string not set\n");
+ return (0);
+ }
retry:
- if (!*expr->exp_str) {
- eptr->ex_type = 0;
- eptr->ex_int = 0;
- return (0);
- }
- if (*expr->exp_str == ';') {
- expr->exp_str++;
- eptr->ex_type = 0;
- eptr->ex_int = 0;
- return (0);
- }
- eptr->ex_type = ET_OP;
- switch (*expr->exp_str++) {
- case '\\':
- case ' ':
- case '\t':
- goto retry;
- case ';':
- post("expr: syntax error: ';' not implemented\n");
- return (1);
- case ',':
- eptr->ex_op = OP_COMMA;
- break;
- case '(':
- eptr->ex_op = OP_LP;
- break;
- case ')':
- eptr->ex_op = OP_RP;
- break;
- case ']':
- eptr->ex_op = OP_RB;
- break;
- case '~':
- eptr->ex_op = OP_NEG;
- break;
- /* we will take care of unary minus later */
- case '*':
- eptr->ex_op = OP_MUL;
- break;
- case '/':
- eptr->ex_op = OP_DIV;
- break;
- case '%':
- eptr->ex_op = OP_MOD;
- break;
- case '+':
- eptr->ex_op = OP_ADD;
- break;
- case '-':
- eptr->ex_op = OP_SUB;
- break;
- case '^':
- eptr->ex_op = OP_XOR;
- break;
- case '[':
- eptr->ex_op = OP_LB;
- break;
- case '!':
- if (*expr->exp_str == '=') {
- eptr->ex_op = OP_NE;
- expr->exp_str++;
- } else
- eptr->ex_op = OP_NOT;
- break;
- case '<':
- switch (*expr->exp_str) {
- case '<':
- eptr->ex_op = OP_SL;
- expr->exp_str++;
- break;
- case '=':
- eptr->ex_op = OP_LE;
- expr->exp_str++;
- break;
- default:
- eptr->ex_op = OP_LT;
- break;
- }
- break;
- case '>':
- switch (*expr->exp_str) {
- case '>':
- eptr->ex_op = OP_SR;
- expr->exp_str++;
- break;
- case '=':
- eptr->ex_op = OP_GE;
- expr->exp_str++;
- break;
- default:
- eptr->ex_op = OP_GT;
- break;
- }
- break;
- case '=':
- if (*expr->exp_str++ != '=') {
- post("expr: syntax error: =\n");
- return (1);
- }
- eptr->ex_op = OP_EQ;
- break;
+ if (!*expr->exp_str) {
+ eptr->ex_type = 0;
+ eptr->ex_int = 0;
+ return (0);
+ }
+ if (*expr->exp_str == ';') {
+ expr->exp_str++;
+ eptr->ex_type = 0;
+ eptr->ex_int = 0;
+ return (0);
+ }
+ eptr->ex_type = ET_OP;
+ switch (*expr->exp_str++) {
+ case '\\':
+ case ' ':
+ case '\t':
+ goto retry;
+ case ';':
+ post("expr: syntax error: ';' not implemented\n");
+ return (1);
+ case ',':
+ eptr->ex_op = OP_COMMA;
+ break;
+ case '(':
+ eptr->ex_op = OP_LP;
+ break;
+ case ')':
+ eptr->ex_op = OP_RP;
+ break;
+ case ']':
+ eptr->ex_op = OP_RB;
+ break;
+ case '~':
+ eptr->ex_op = OP_NEG;
+ break;
+ /* we will take care of unary minus later */
+ case '*':
+ eptr->ex_op = OP_MUL;
+ break;
+ case '/':
+ eptr->ex_op = OP_DIV;
+ break;
+ case '%':
+ eptr->ex_op = OP_MOD;
+ break;
+ case '+':
+ eptr->ex_op = OP_ADD;
+ break;
+ case '-':
+ eptr->ex_op = OP_SUB;
+ break;
+ case '^':
+ eptr->ex_op = OP_XOR;
+ break;
+ case '[':
+ eptr->ex_op = OP_LB;
+ break;
+ case '!':
+ if (*expr->exp_str == '=') {
+ eptr->ex_op = OP_NE;
+ expr->exp_str++;
+ } else
+ eptr->ex_op = OP_NOT;
+ break;
+ case '<':
+ switch (*expr->exp_str) {
+ case '<':
+ eptr->ex_op = OP_SL;
+ expr->exp_str++;
+ break;
+ case '=':
+ eptr->ex_op = OP_LE;
+ expr->exp_str++;
+ break;
+ default:
+ eptr->ex_op = OP_LT;
+ break;
+ }
+ break;
+ case '>':
+ switch (*expr->exp_str) {
+ case '>':
+ eptr->ex_op = OP_SR;
+ expr->exp_str++;
+ break;
+ case '=':
+ eptr->ex_op = OP_GE;
+ expr->exp_str++;
+ break;
+ default:
+ eptr->ex_op = OP_GT;
+ break;
+ }
+ break;
+ case '=':
+ if (*expr->exp_str++ != '=') {
+ post("expr: syntax error: =\n");
+ return (1);
+ }
+ eptr->ex_op = OP_EQ;
+ break;
/* do not allow the store till the function is fixed
- if (*expr->exp_str != '=')
- eptr->ex_op = OP_STORE;
- else {
- expr->exp_str++;
- eptr->ex_op = OP_EQ;
- }
- break;
+ if (*expr->exp_str != '=')
+ eptr->ex_op = OP_STORE;
+ else {
+ expr->exp_str++;
+ eptr->ex_op = OP_EQ;
+ }
+ break;
*/
- case '&':
- if (*expr->exp_str == '&') {
- expr->exp_str++;
- eptr->ex_op = OP_LAND;
- } else
- eptr->ex_op = OP_AND;
- break;
-
- case '|':
- if ((*expr->exp_str == '|')) {
- expr->exp_str++;
- eptr->ex_op = OP_LOR;
- } else
- eptr->ex_op = OP_OR;
- break;
- case '$':
- switch (*expr->exp_str++) {
- case 'I':
- case 'i':
- eptr->ex_type = ET_II;
- break;
- case 'F':
- case 'f':
- eptr->ex_type = ET_FI;
- break;
- case 'S':
- case 's':
- eptr->ex_type = ET_SI;
- break;
- case 'V':
- case 'v':
- if (IS_EXPR_TILDE(expr)) {
- eptr->ex_type = ET_VI;
- break;
- }
- post("$v? works only for expr~");
- post("expr: syntax error: %s\n", &expr->exp_str[-2]);
- return (1);
- case 'X':
- case 'x':
- if (IS_FEXPR_TILDE(expr)) {
- eptr->ex_type = ET_XI;
- if (isdigit(*expr->exp_str))
- break;
- /* for $x[] is a shorhand for $x1[] */
- eptr->ex_int = 0;
- goto noinletnum;
- }
- post("$x? works only for fexpr~");
- post("expr: syntax error: %s\n", &expr->exp_str[-2]);
- return (1);
- case 'y':
- case 'Y':
- if (IS_FEXPR_TILDE(expr)) {
- eptr->ex_type = ET_YO;
- /*$y takes no number */
- if (isdigit(*expr->exp_str))
- break;
- /* for $y[] is a shorhand for $y1[] */
- eptr->ex_int = 0;
- goto noinletnum;
- }
- post("$y works only for fexpr~");
- default:
- post("expr: syntax error: %s\n", &expr->exp_str[-2]);
- return (1);
- }
- p = atoif(expr->exp_str, &eptr->ex_op, &i);
- if (!p) {
- post("expr: syntax error: %s\n", &expr->exp_str[-2]);
- return (1);
- }
- if (i != ET_INT) {
- post("expr: syntax error: %s\n", expr->exp_str);
- return (1);
- }
- /*
- * make the user inlets one based rather than zero based
- * therefore we decrement the number that user has supplied
- */
- if (!eptr->ex_op || (eptr->ex_op)-- > MAX_VARS) {
- post("expr: syntax error: inlet or outlet out of range: %s\n",
- expr->exp_str);
- return (1);
- }
-
- /*
- * until we can change the input type of inlets on
- * the fly (at pd_new()
- * time) the first input to expr~ is always a vectore
- * and $f1 or $i1 is
- * illegal for fexr~
- */
- if (eptr->ex_op == 0 &&
- (IS_FEXPR_TILDE(expr) || IS_EXPR_TILDE(expr)) &&
- (eptr->ex_type==ET_II || eptr->ex_type==ET_FI ||
- eptr->ex_type==ET_SI)) {
- post("first inlet of expr~/fexpr~ can only be a vector");
- return (1);
- }
- /* record the inlet or outlet type and check for consistency */
- if (eptr->ex_type == ET_YO ) {
- /* it is an outlet for fexpr~*/
- /* no need to do anything */
- ;
- } else if (!expr->exp_var[eptr->ex_op].ex_type)
- expr->exp_var[eptr->ex_op].ex_type = eptr->ex_type;
- else if (expr->exp_var[eptr->ex_op].ex_type != eptr->ex_type) {
- post("expr: syntax error: inlets can only have one type: %s\n", expr->exp_str);
- return (1);
- }
- expr->exp_str = p;
+ case '&':
+ if (*expr->exp_str == '&') {
+ expr->exp_str++;
+ eptr->ex_op = OP_LAND;
+ } else
+ eptr->ex_op = OP_AND;
+ break;
+
+ case '|':
+ if ((*expr->exp_str == '|')) {
+ expr->exp_str++;
+ eptr->ex_op = OP_LOR;
+ } else
+ eptr->ex_op = OP_OR;
+ break;
+ case '$':
+ switch (*expr->exp_str++) {
+ case 'I':
+ case 'i':
+ eptr->ex_type = ET_II;
+ break;
+ case 'F':
+ case 'f':
+ eptr->ex_type = ET_FI;
+ break;
+ case 'S':
+ case 's':
+ eptr->ex_type = ET_SI;
+ break;
+ case 'V':
+ case 'v':
+ if (IS_EXPR_TILDE(expr)) {
+ eptr->ex_type = ET_VI;
+ break;
+ }
+ post("$v? works only for expr~");
+ post("expr: syntax error: %s\n", &expr->exp_str[-2]);
+ return (1);
+ case 'X':
+ case 'x':
+ if (IS_FEXPR_TILDE(expr)) {
+ eptr->ex_type = ET_XI;
+ if (isdigit(*expr->exp_str))
+ break;
+ /* for $x[] is a shorhand for $x1[] */
+ eptr->ex_int = 0;
+ goto noinletnum;
+ }
+ post("$x? works only for fexpr~");
+ post("expr: syntax error: %s\n", &expr->exp_str[-2]);
+ return (1);
+ case 'y':
+ case 'Y':
+ if (IS_FEXPR_TILDE(expr)) {
+ eptr->ex_type = ET_YO;
+ /*$y takes no number */
+ if (isdigit(*expr->exp_str))
+ break;
+ /* for $y[] is a shorhand for $y1[] */
+ eptr->ex_int = 0;
+ goto noinletnum;
+ }
+ post("$y works only for fexpr~");
+ default:
+ post("expr: syntax error: %s\n", &expr->exp_str[-2]);
+ return (1);
+ }
+ p = atoif(expr->exp_str, &eptr->ex_op, &i);
+ if (!p) {
+ post("expr: syntax error: %s\n", &expr->exp_str[-2]);
+ return (1);
+ }
+ if (i != ET_INT) {
+ post("expr: syntax error: %s\n", expr->exp_str);
+ return (1);
+ }
+ /*
+ * make the user inlets one based rather than zero based
+ * therefore we decrement the number that user has supplied
+ */
+ if (!eptr->ex_op || (eptr->ex_op)-- > MAX_VARS) {
+ post("expr: syntax error: inlet or outlet out of range: %s\n",
+ expr->exp_str);
+ return (1);
+ }
+
+ /*
+ * until we can change the input type of inlets on
+ * the fly (at pd_new()
+ * time) the first input to expr~ is always a vectore
+ * and $f1 or $i1 is
+ * illegal for fexr~
+ */
+ if (eptr->ex_op == 0 &&
+ (IS_FEXPR_TILDE(expr) || IS_EXPR_TILDE(expr)) &&
+ (eptr->ex_type==ET_II || eptr->ex_type==ET_FI ||
+ eptr->ex_type==ET_SI)) {
+ post("first inlet of expr~/fexpr~ can only be a vector");
+ return (1);
+ }
+ /* record the inlet or outlet type and check for consistency */
+ if (eptr->ex_type == ET_YO ) {
+ /* it is an outlet for fexpr~*/
+ /* no need to do anything */
+ ;
+ } else if (!expr->exp_var[eptr->ex_op].ex_type)
+ expr->exp_var[eptr->ex_op].ex_type = eptr->ex_type;
+ else if (expr->exp_var[eptr->ex_op].ex_type != eptr->ex_type) {
+ post("expr: syntax error: inlets can only have one type: %s\n", expr->exp_str);
+ return (1);
+ }
+ expr->exp_str = p;
noinletnum:
- break;
- case '"':
- {
- struct ex_ex ex;
-
- p = expr->exp_str;
- if (!*expr->exp_str || *expr->exp_str == '"') {
- post("expr: syntax error: empty symbol: %s\n", --expr->exp_str);
- return (1);
- }
- if (getoken(expr, &ex))
- return (1);
- switch (ex.ex_type) {
- case ET_STR:
- if (ex_getsym(ex.ex_ptr, (t_symbol **)&(eptr->ex_ptr))) {
- post("expr: syntax error: getoken: problms with ex_getsym\n");
- return (1);
- }
- eptr->ex_type = ET_SYM;
- break;
- case ET_SI:
- *eptr = ex;
- eptr->ex_type = ET_VSYM;
- break;
- default:
- post("expr: syntax error: bad symbol name: %s\n", p);
- return (1);
- }
- if (*expr->exp_str++ != '"') {
- post("expr: syntax error: missing '\"'\n");
- return (1);
- }
- break;
- }
- case '.':
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- p = atoif(--expr->exp_str, &eptr->ex_int, &eptr->ex_type);
- if (!p)
- return (1);
- expr->exp_str = p;
- break;
-
- default:
- /*
- * has to be a string, it should either be a
- * function or a table
- */
- p = --expr->exp_str;
- for (i = 0; name_ok(*p); i++)
- p++;
- if (!i) {
- post("expr: syntax error: %s\n", expr->exp_str);
- return (1);
- }
- eptr->ex_ptr = (char *)fts_malloc(i + 1);
- strncpy(eptr->ex_ptr, expr->exp_str, (int) i);
- (eptr->ex_ptr)[i] = 0;
- expr->exp_str = p;
- /*
- * we mark this as a string and later we will change this
- * to either a function or a table
- */
- eptr->ex_type = ET_STR;
- break;
- }
- return (0);
+ break;
+ case '"':
+ {
+ struct ex_ex ex;
+
+ p = expr->exp_str;
+ if (!*expr->exp_str || *expr->exp_str == '"') {
+ post("expr: syntax error: empty symbol: %s\n", --expr->exp_str);
+ return (1);
+ }
+ if (getoken(expr, &ex))
+ return (1);
+ switch (ex.ex_type) {
+ case ET_STR:
+ if (ex_getsym(ex.ex_ptr, (t_symbol **)&(eptr->ex_ptr))) {
+ post("expr: syntax error: getoken: problms with ex_getsym\n");
+ return (1);
+ }
+ eptr->ex_type = ET_SYM;
+ break;
+ case ET_SI:
+ *eptr = ex;
+ eptr->ex_type = ET_VSYM;
+ break;
+ default:
+ post("expr: syntax error: bad symbol name: %s\n", p);
+ return (1);
+ }
+ if (*expr->exp_str++ != '"') {
+ post("expr: syntax error: missing '\"'\n");
+ return (1);
+ }
+ break;
+ }
+ case '.':
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ p = atoif(--expr->exp_str, &eptr->ex_int, &eptr->ex_type);
+ if (!p)
+ return (1);
+ expr->exp_str = p;
+ break;
+
+ default:
+ /*
+ * has to be a string, it should either be a
+ * function or a table
+ */
+ p = --expr->exp_str;
+ for (i = 0; name_ok(*p); i++)
+ p++;
+ if (!i) {
+ post("expr: syntax error: %s\n", expr->exp_str);
+ return (1);
+ }
+ eptr->ex_ptr = (char *)fts_malloc(i + 1);
+ strncpy(eptr->ex_ptr, expr->exp_str, (int) i);
+ (eptr->ex_ptr)[i] = 0;
+ expr->exp_str = p;
+ /*
+ * we mark this as a string and later we will change this
+ * to either a function or a table
+ */
+ eptr->ex_type = ET_STR;
+ break;
+ }
+ return (0);
}
/*
@@ -1870,100 +1870,100 @@ noinletnum:
char *
atoif(char *s, long int *value, long int *type)
{
- char *p;
- long int_val = 0;
- int flt = 0;
- float pos = 0;
- float flt_val = 0;
- int base = 10;
-
- p = s;
- if (*p == '0' && (p[1] == 'x' || p[1] == 'X')) {
- base = 16;
- p += 2;
- }
- while (8) {
- switch (*p) {
- case '.':
- if (flt || base != 10) {
- post("expr: syntax error: %s\n", s);
- return ((char *) 0);
- }
- flt++;
- pos = 10;
- flt_val = int_val;
- break;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- if (flt) {
- flt_val += (*p - '0') / pos;
- pos *= 10;
- } else {
- int_val *= base;
- int_val += (*p - '0');
- }
- break;
- case 'a':
- case 'b':
- case 'c':
- case 'd':
- case 'e':
- case 'f':
- if (base != 16 || flt) {
- post("expr: syntax error: %s\n", s);
- return ((char *) 0);
- }
- int_val *= base;
- int_val += (*p - 'a' + 10);
- break;
- case 'A':
- case 'B':
- case 'C':
- case 'D':
- case 'E':
- case 'F':
- if (base != 16 || flt) {
- post("expr: syntax error: %s\n", s);
- return ((char *) 0);
- }
- int_val *= base;
- int_val += (*p - 'A' + 10);
- break;
- default:
- if (flt) {
- *type = ET_FLT;
- *((float *) value) = flt_val;
- } else {
- *type = ET_INT;
- *value = int_val;
- }
- return (p);
- }
- p++;
- }
+ char *p;
+ long int_val = 0;
+ int flt = 0;
+ float pos = 0;
+ float flt_val = 0;
+ int base = 10;
+
+ p = s;
+ if (*p == '0' && (p[1] == 'x' || p[1] == 'X')) {
+ base = 16;
+ p += 2;
+ }
+ while (8) {
+ switch (*p) {
+ case '.':
+ if (flt || base != 10) {
+ post("expr: syntax error: %s\n", s);
+ return ((char *) 0);
+ }
+ flt++;
+ pos = 10;
+ flt_val = int_val;
+ break;
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ if (flt) {
+ flt_val += (*p - '0') / pos;
+ pos *= 10;
+ } else {
+ int_val *= base;
+ int_val += (*p - '0');
+ }
+ break;
+ case 'a':
+ case 'b':
+ case 'c':
+ case 'd':
+ case 'e':
+ case 'f':
+ if (base != 16 || flt) {
+ post("expr: syntax error: %s\n", s);
+ return ((char *) 0);
+ }
+ int_val *= base;
+ int_val += (*p - 'a' + 10);
+ break;
+ case 'A':
+ case 'B':
+ case 'C':
+ case 'D':
+ case 'E':
+ case 'F':
+ if (base != 16 || flt) {
+ post("expr: syntax error: %s\n", s);
+ return ((char *) 0);
+ }
+ int_val *= base;
+ int_val += (*p - 'A' + 10);
+ break;
+ default:
+ if (flt) {
+ *type = ET_FLT;
+ *((float *) value) = flt_val;
+ } else {
+ *type = ET_INT;
+ *value = int_val;
+ }
+ return (p);
+ }
+ p++;
+ }
}
/*
* find_func -- returns a pointer to the found function structure
- * otherwise it returns 0
+ * otherwise it returns 0
*/
t_ex_func *
find_func(char *s)
{
- t_ex_func *f;
+ t_ex_func *f;
- for (f = ex_funcs; f->f_name; f++)
- if (!strcmp(f->f_name, s))
- return (f);
- return ((t_ex_func *) 0);
+ for (f = ex_funcs; f->f_name; f++)
+ if (!strcmp(f->f_name, s))
+ return (f);
+ return ((t_ex_func *) 0);
}
@@ -1975,166 +1975,166 @@ void
ex_print(struct ex_ex *eptr)
{
- while (eptr->ex_type) {
- switch (eptr->ex_type) {
- case ET_INT:
- post("%ld ", eptr->ex_int);
- break;
- case ET_FLT:
- post("%f ", eptr->ex_flt);
- break;
- case ET_STR:
- post("%s ", eptr->ex_ptr);
- break;
- case ET_TBL:
- case ET_VAR:
- post("%s ", ex_symname((fts_symbol_t )eptr->ex_ptr));
- break;
- case ET_SYM:
- post("\"%s\" ", ex_symname((fts_symbol_t )eptr->ex_ptr));
- break;
- case ET_VSYM:
- post("\"$s%ld\" ", eptr->ex_int + 1);
- break;
- case ET_FUNC:
- post("%s ",
- ((t_ex_func *)eptr->ex_ptr)->f_name);
- break;
- case ET_LP:
- post("%c", '(');
- break;
- /* CHANGE
- case ET_RP:
- post("%c ", ')');
- break;
- */
- case ET_LB:
- post("%c", '[');
- break;
- /* CHANGE
- case ET_RB:
- post("%c ", ']');
- break;
- */
- case ET_II:
- post("$i%ld ", eptr->ex_int + 1);
- break;
- case ET_FI:
- post("$f%ld ", eptr->ex_int + 1);
- break;
- case ET_SI:
- post("$s%lx ", eptr->ex_ptr);
- break;
- case ET_VI:
- post("$v%lx ", eptr->ex_vec);
- break;
- case ET_VEC:
- post("vec = %ld ", eptr->ex_vec);
- break;
- case ET_YOM1:
- case ET_YO:
- post("$y%d", eptr->ex_int + 1);
- break;
- case ET_XI:
- case ET_XI0:
- post("$x%d", eptr->ex_int + 1);
- break;
- case ET_OP:
- switch (eptr->ex_op) {
- case OP_LP:
- post("%c", '(');
- break;
- case OP_RP:
- post("%c ", ')');
- break;
- case OP_LB:
- post("%c", '[');
- break;
- case OP_RB:
- post("%c ", ']');
- break;
- case OP_NOT:
- post("%c", '!');
- break;
- case OP_NEG:
- post("%c", '~');
- break;
- case OP_UMINUS:
- post("%c", '-');
- break;
- case OP_MUL:
- post("%c", '*');
- break;
- case OP_DIV:
- post("%c", '/');
- break;
- case OP_MOD:
- post("%c", '%');
- break;
- case OP_ADD:
- post("%c", '+');
- break;
- case OP_SUB:
- post("%c", '-');
- break;
- case OP_SL:
- post("%s", "<<");
- break;
- case OP_SR:
- post("%s", ">>");
- break;
- case OP_LT:
- post("%c", '<');
- break;
- case OP_LE:
- post("%s", "<=");
- break;
- case OP_GT:
- post("%c", '>');
- break;
- case OP_GE:
- post("%s", ">=");
- break;
- case OP_EQ:
- post("%s", "==");
- break;
- case OP_STORE:
- post("%s", "=");
- break;
- case OP_NE:
- post("%s", "!=");
- break;
- case OP_AND:
- post("%c", '&');
- break;
- case OP_XOR:
- post("%c", '^');
- break;
- case OP_OR:
- post("%c", '|');
- break;
- case OP_LAND:
- post("%s", "&&");
- break;
- case OP_LOR:
- post("%s", "||");
- break;
- case OP_COMMA:
- post("%c", ',');
- break;
- case OP_SEMI:
- post("%c", ';');
- break;
- default:
- post("expr: ex_print: bad op 0x%lx\n", eptr->ex_op);
- }
- break;
- default:
- post("expr: ex_print: bad type 0x%lx\n", eptr->ex_type);
- }
- eptr++;
- }
- post("\n");
+ while (eptr->ex_type) {
+ switch (eptr->ex_type) {
+ case ET_INT:
+ post("%ld ", eptr->ex_int);
+ break;
+ case ET_FLT:
+ post("%f ", eptr->ex_flt);
+ break;
+ case ET_STR:
+ post("%s ", eptr->ex_ptr);
+ break;
+ case ET_TBL:
+ case ET_VAR:
+ post("%s ", ex_symname((fts_symbol_t )eptr->ex_ptr));
+ break;
+ case ET_SYM:
+ post("\"%s\" ", ex_symname((fts_symbol_t )eptr->ex_ptr));
+ break;
+ case ET_VSYM:
+ post("\"$s%ld\" ", eptr->ex_int + 1);
+ break;
+ case ET_FUNC:
+ post("%s ",
+ ((t_ex_func *)eptr->ex_ptr)->f_name);
+ break;
+ case ET_LP:
+ post("%c", '(');
+ break;
+ /* CHANGE
+ case ET_RP:
+ post("%c ", ')');
+ break;
+ */
+ case ET_LB:
+ post("%c", '[');
+ break;
+ /* CHANGE
+ case ET_RB:
+ post("%c ", ']');
+ break;
+ */
+ case ET_II:
+ post("$i%ld ", eptr->ex_int + 1);
+ break;
+ case ET_FI:
+ post("$f%ld ", eptr->ex_int + 1);
+ break;
+ case ET_SI:
+ post("$s%lx ", eptr->ex_ptr);
+ break;
+ case ET_VI:
+ post("$v%lx ", eptr->ex_vec);
+ break;
+ case ET_VEC:
+ post("vec = %ld ", eptr->ex_vec);
+ break;
+ case ET_YOM1:
+ case ET_YO:
+ post("$y%d", eptr->ex_int + 1);
+ break;
+ case ET_XI:
+ case ET_XI0:
+ post("$x%d", eptr->ex_int + 1);
+ break;
+ case ET_OP:
+ switch (eptr->ex_op) {
+ case OP_LP:
+ post("%c", '(');
+ break;
+ case OP_RP:
+ post("%c ", ')');
+ break;
+ case OP_LB:
+ post("%c", '[');
+ break;
+ case OP_RB:
+ post("%c ", ']');
+ break;
+ case OP_NOT:
+ post("%c", '!');
+ break;
+ case OP_NEG:
+ post("%c", '~');
+ break;
+ case OP_UMINUS:
+ post("%c", '-');
+ break;
+ case OP_MUL:
+ post("%c", '*');
+ break;
+ case OP_DIV:
+ post("%c", '/');
+ break;
+ case OP_MOD:
+ post("%c", '%');
+ break;
+ case OP_ADD:
+ post("%c", '+');
+ break;
+ case OP_SUB:
+ post("%c", '-');
+ break;
+ case OP_SL:
+ post("%s", "<<");
+ break;
+ case OP_SR:
+ post("%s", ">>");
+ break;
+ case OP_LT:
+ post("%c", '<');
+ break;
+ case OP_LE:
+ post("%s", "<=");
+ break;
+ case OP_GT:
+ post("%c", '>');
+ break;
+ case OP_GE:
+ post("%s", ">=");
+ break;
+ case OP_EQ:
+ post("%s", "==");
+ break;
+ case OP_STORE:
+ post("%s", "=");
+ break;
+ case OP_NE:
+ post("%s", "!=");
+ break;
+ case OP_AND:
+ post("%c", '&');
+ break;
+ case OP_XOR:
+ post("%c", '^');
+ break;
+ case OP_OR:
+ post("%c", '|');
+ break;
+ case OP_LAND:
+ post("%s", "&&");
+ break;
+ case OP_LOR:
+ post("%s", "||");
+ break;
+ case OP_COMMA:
+ post("%c", ',');
+ break;
+ case OP_SEMI:
+ post("%c", ';');
+ break;
+ default:
+ post("expr: ex_print: bad op 0x%lx\n", eptr->ex_op);
+ }
+ break;
+ default:
+ post("expr: ex_print: bad type 0x%lx\n", eptr->ex_type);
+ }
+ eptr++;
+ }
+ post("\n");
}
#ifdef NT
diff --git a/pd/extra/expr~/vexp.h b/pd/extra/expr~/vexp.h
index e90c8409..92dfb06e 100644
--- a/pd/extra/expr~/vexp.h
+++ b/pd/extra/expr~/vexp.h
@@ -43,9 +43,9 @@
/* This is put in fts_to_pd.h
#ifdef MSP
-#define t_atom Atom
-#define t_symbol Symbol
-#define pd_new(x) newobject(x);
+#define t_atom Atom
+#define t_symbol Symbol
+#define pd_new(x) newobject(x);
#define t_outlet void
#endif
*/
@@ -55,8 +55,8 @@
* is 10.
*/
-#define MAX_VARS 9
-#define MINODES 10 /* was 200 */
+#define MAX_VARS 9
+#define MINODES 10 /* was 200 */
/* terminal defines */
@@ -67,156 +67,156 @@
* separators are defines as operators just for convenience
*/
-#define OP_SEMI ((long)(1<<16|1)) /* ; */
-#define OP_COMMA ((long)(2<<16|2)) /* , */
-#define OP_LOR ((long)(3<<16|3)) /* || */
-#define OP_LAND ((long)(4<<16|4)) /* && */
-#define OP_OR ((long)(5<<16|5)) /* | */
-#define OP_XOR ((long)(6<<16|6)) /* ^ */
-#define OP_AND ((long)(7<<16|7)) /* & */
-#define OP_NE ((long)(8<<16|8)) /* != */
-#define OP_EQ ((long)(8<<16|9)) /* == */
-#define OP_GE ((long)(9<<16|10)) /* >= */
-#define OP_GT ((long)(9<<16|11)) /* > */
-#define OP_LE ((long)(9<<16|12)) /* <= */
-#define OP_LT ((long)(9<<16|13)) /* < */
-#define OP_SR ((long)(10<<16|14)) /* >> */
-#define OP_SL ((long)(10<<16|15)) /* << */
-#define OP_SUB ((long)(11<<16|16)) /* - */
-#define OP_ADD ((long)(11<<16|17)) /* + */
-#define OP_MOD ((long)(12<<16|18)) /* % */
-#define OP_DIV ((long)(12<<16|19)) /* / */
-#define OP_MUL ((long)(12<<16|20)) /* * */
-#define OP_UMINUS ((long)(13<<16|21)) /* - unary minus */
-#define OP_NEG ((long)(13<<16|22)) /* ~ one complement */
-#define OP_NOT ((long)(13<<16|23)) /* ! */
-#define OP_RB ((long)(14<<16|24)) /* ] */
-#define OP_LB ((long)(14<<16|25)) /* [ */
-#define OP_RP ((long)(14<<16|26)) /* ) */
-#define OP_LP ((long)(14<<16|27)) /* ( */
-#define OP_STORE ((long)(15<<16|28)) /* = */
-#define HI_PRE ((long)(100<<16)) /* infinite precedence */
-#define PRE_MASK ((long)0xffff0000) /* precedence level mask */
+#define OP_SEMI ((long)(1<<16|1)) /* ; */
+#define OP_COMMA ((long)(2<<16|2)) /* , */
+#define OP_LOR ((long)(3<<16|3)) /* || */
+#define OP_LAND ((long)(4<<16|4)) /* && */
+#define OP_OR ((long)(5<<16|5)) /* | */
+#define OP_XOR ((long)(6<<16|6)) /* ^ */
+#define OP_AND ((long)(7<<16|7)) /* & */
+#define OP_NE ((long)(8<<16|8)) /* != */
+#define OP_EQ ((long)(8<<16|9)) /* == */
+#define OP_GE ((long)(9<<16|10)) /* >= */
+#define OP_GT ((long)(9<<16|11)) /* > */
+#define OP_LE ((long)(9<<16|12)) /* <= */
+#define OP_LT ((long)(9<<16|13)) /* < */
+#define OP_SR ((long)(10<<16|14)) /* >> */
+#define OP_SL ((long)(10<<16|15)) /* << */
+#define OP_SUB ((long)(11<<16|16)) /* - */
+#define OP_ADD ((long)(11<<16|17)) /* + */
+#define OP_MOD ((long)(12<<16|18)) /* % */
+#define OP_DIV ((long)(12<<16|19)) /* / */
+#define OP_MUL ((long)(12<<16|20)) /* * */
+#define OP_UMINUS ((long)(13<<16|21)) /* - unary minus */
+#define OP_NEG ((long)(13<<16|22)) /* ~ one complement */
+#define OP_NOT ((long)(13<<16|23)) /* ! */
+#define OP_RB ((long)(14<<16|24)) /* ] */
+#define OP_LB ((long)(14<<16|25)) /* [ */
+#define OP_RP ((long)(14<<16|26)) /* ) */
+#define OP_LP ((long)(14<<16|27)) /* ( */
+#define OP_STORE ((long)(15<<16|28)) /* = */
+#define HI_PRE ((long)(100<<16)) /* infinite precedence */
+#define PRE_MASK ((long)0xffff0000) /* precedence level mask */
struct ex_ex;
-#define name_ok(c) (((c)=='_') || ((c)>='a' && (c)<='z') || \
- ((c)>='A' && (c)<='Z') || ((c) >= '0' && (c) <= '9'))
-#define unary_op(x) ((x) == OP_NOT || (x) == OP_NEG || (x) == OP_UMINUS)
+#define name_ok(c) (((c)=='_') || ((c)>='a' && (c)<='z') || \
+ ((c)>='A' && (c)<='Z') || ((c) >= '0' && (c) <= '9'))
+#define unary_op(x) ((x) == OP_NOT || (x) == OP_NEG || (x) == OP_UMINUS)
struct ex_ex {
- union {
- long v_int;
- float v_flt;
- t_float *v_vec; /* this is an for allocated vector */
- long op;
- char *ptr;
- } ex_cont; /* content */
-#define ex_int ex_cont.v_int
-#define ex_flt ex_cont.v_flt
-#define ex_vec ex_cont.v_vec
-#define ex_op ex_cont.op
-#define ex_ptr ex_cont.ptr
- long ex_type; /* type of the node */
+ union {
+ long v_int;
+ float v_flt;
+ t_float *v_vec; /* this is an for allocated vector */
+ long op;
+ char *ptr;
+ } ex_cont; /* content */
+#define ex_int ex_cont.v_int
+#define ex_flt ex_cont.v_flt
+#define ex_vec ex_cont.v_vec
+#define ex_op ex_cont.op
+#define ex_ptr ex_cont.ptr
+ long ex_type; /* type of the node */
};
-#define exNULL ((struct ex_ex *)0)
+#define exNULL ((struct ex_ex *)0)
/* defines for ex_type */
-#define ET_INT 1 /* an int */
-#define ET_FLT 2 /* a float */
-#define ET_OP 3 /* operator */
-#define ET_STR 4 /* string */
-#define ET_TBL 5 /* a table, the content is a pointer */
-#define ET_FUNC 6 /* a function */
-#define ET_SYM 7 /* symbol ("string") */
-#define ET_VSYM 8 /* variable symbol ("$s?") */
- /* we treat parenthesis and brackets */
- /* special to keep a pointer to their */
- /* match in the content */
-#define ET_LP 9 /* left parenthesis */
-#define ET_LB 10 /* left bracket */
-#define ET_II 11 /* and integer inlet */
-#define ET_FI 12 /* float inlet */
-#define ET_SI 13 /* string inlet */
-#define ET_VI 14 /* signal inlet */
-#define ET_VEC 15 /* allocated signal vector */
- /* special types for fexpr~ */
-#define ET_YO 16 /* vector output for fexpr~ */
-#define ET_YOM1 17 /* shorthand for $y?[-1] */
-#define ET_XI 18 /* vector input for fexpr~ */
-#define ET_XI0 20 /* shorthand for $x?[0] */
-#define ET_VAR 21 /* variable */
+#define ET_INT 1 /* an int */
+#define ET_FLT 2 /* a float */
+#define ET_OP 3 /* operator */
+#define ET_STR 4 /* string */
+#define ET_TBL 5 /* a table, the content is a pointer */
+#define ET_FUNC 6 /* a function */
+#define ET_SYM 7 /* symbol ("string") */
+#define ET_VSYM 8 /* variable symbol ("$s?") */
+ /* we treat parenthesis and brackets */
+ /* special to keep a pointer to their */
+ /* match in the content */
+#define ET_LP 9 /* left parenthesis */
+#define ET_LB 10 /* left bracket */
+#define ET_II 11 /* and integer inlet */
+#define ET_FI 12 /* float inlet */
+#define ET_SI 13 /* string inlet */
+#define ET_VI 14 /* signal inlet */
+#define ET_VEC 15 /* allocated signal vector */
+ /* special types for fexpr~ */
+#define ET_YO 16 /* vector output for fexpr~ */
+#define ET_YOM1 17 /* shorthand for $y?[-1] */
+#define ET_XI 18 /* vector input for fexpr~ */
+#define ET_XI0 20 /* shorthand for $x?[0] */
+#define ET_VAR 21 /* variable */
/* defines for ex_flags */
-#define EF_TYPE_MASK 0x07 /* first three bits define the type of expr */
-#define EF_EXPR 0x01 /* expr - control in and out */
-#define EF_EXPR_TILDE 0x02 /* expr~ signal and control in, signal out */
-#define EF_FEXPR_TILDE 0x04 /* fexpr~ filter expression */
+#define EF_TYPE_MASK 0x07 /* first three bits define the type of expr */
+#define EF_EXPR 0x01 /* expr - control in and out */
+#define EF_EXPR_TILDE 0x02 /* expr~ signal and control in, signal out */
+#define EF_FEXPR_TILDE 0x04 /* fexpr~ filter expression */
-#define EF_STOP 0x08 /* is it stopped used for expr~ and fexpr~ */
-#define EF_VERBOSE 0x10 /* verbose mode */
+#define EF_STOP 0x08 /* is it stopped used for expr~ and fexpr~ */
+#define EF_VERBOSE 0x10 /* verbose mode */
-#define IS_EXPR(x) ((((x)->exp_flags&EF_TYPE_MASK)|EF_EXPR) == EF_EXPR)
-#define IS_EXPR_TILDE(x) \
+#define IS_EXPR(x) ((((x)->exp_flags&EF_TYPE_MASK)|EF_EXPR) == EF_EXPR)
+#define IS_EXPR_TILDE(x) \
((((x)->exp_flags&EF_TYPE_MASK)|EF_EXPR_TILDE)==EF_EXPR_TILDE)
-#define IS_FEXPR_TILDE(x) \
+#define IS_FEXPR_TILDE(x) \
((((x)->exp_flags&EF_TYPE_MASK)|EF_FEXPR_TILDE)==EF_FEXPR_TILDE)
-#define SET_EXPR(x) (x)->exp_flags |= EF_EXPR; \
- (x)->exp_flags &= ~EF_EXPR_TILDE; \
- (x)->exp_flags &= ~EF_FEXPR_TILDE;
+#define SET_EXPR(x) (x)->exp_flags |= EF_EXPR; \
+ (x)->exp_flags &= ~EF_EXPR_TILDE; \
+ (x)->exp_flags &= ~EF_FEXPR_TILDE;
-#define SET_EXPR_TILDE(x) (x)->exp_flags &= ~EF_EXPR; \
- (x)->exp_flags |= EF_EXPR_TILDE; \
- (x)->exp_flags &= ~EF_FEXPR_TILDE;
+#define SET_EXPR_TILDE(x) (x)->exp_flags &= ~EF_EXPR; \
+ (x)->exp_flags |= EF_EXPR_TILDE; \
+ (x)->exp_flags &= ~EF_FEXPR_TILDE;
-#define SET_FEXPR_TILDE(x) (x)->exp_flags &= ~EF_EXPR; \
- (x)->exp_flags &= ~EF_EXPR_TILDE; \
- (x)->exp_flags |= EF_FEXPR_TILDE;
+#define SET_FEXPR_TILDE(x) (x)->exp_flags &= ~EF_EXPR; \
+ (x)->exp_flags &= ~EF_EXPR_TILDE; \
+ (x)->exp_flags |= EF_FEXPR_TILDE;
/*
* defines for expr_error
*/
-#define EE_DZ 0x01 /* divide by zero error */
-#define EE_BI_OUTPUT 0x02 /* Bad output index */
-#define EE_BI_INPUT 0x04 /* Bad input index */
-#define EE_NOTABLE 0x08 /* NO TABLE */
-#define EE_NOVAR 0x10 /* NO VARIABLE */
+#define EE_DZ 0x01 /* divide by zero error */
+#define EE_BI_OUTPUT 0x02 /* Bad output index */
+#define EE_BI_INPUT 0x04 /* Bad input index */
+#define EE_NOTABLE 0x08 /* NO TABLE */
+#define EE_NOVAR 0x10 /* NO VARIABLE */
typedef struct expr {
#ifdef PD
- t_object exp_ob;
+ t_object exp_ob;
#else /* MSP */
- t_pxobject exp_ob;
+ t_pxobject exp_ob;
#endif
- int exp_flags; /* are we expr~, fexpr~, or expr */
- int exp_error; /* reported errors */
- int exp_nexpr; /* number of expressions */
- char *exp_string; /* the full expression string */
- char *exp_str; /* current parsing position */
- t_outlet *exp_outlet[MAX_VARS];
+ int exp_flags; /* are we expr~, fexpr~, or expr */
+ int exp_error; /* reported errors */
+ int exp_nexpr; /* number of expressions */
+ char *exp_string; /* the full expression string */
+ char *exp_str; /* current parsing position */
+ t_outlet *exp_outlet[MAX_VARS];
#ifdef PD
- struct _exprproxy *exp_proxy;
+ struct _exprproxy *exp_proxy;
#else /* MAX */
- void *exp_proxy[MAX_VARS];
- long exp_proxy_id;
+ void *exp_proxy[MAX_VARS];
+ long exp_proxy_id;
#endif
- struct ex_ex *exp_stack[MAX_VARS];
- struct ex_ex exp_var[MAX_VARS];
- struct ex_ex exp_res[MAX_VARS]; /* the evluation result */
- t_float *exp_p_var[MAX_VARS];
- t_float *exp_p_res[MAX_VARS]; /* the previous evaluation result */
- t_float *exp_tmpres[MAX_VARS]; /* temporty result for fexpr~ */
- int exp_vsize; /* the size of the signal vector */
- int exp_nivec; /* # of vector inlets */
- float exp_f; /* control value to be transformed to signal */
+ struct ex_ex *exp_stack[MAX_VARS];
+ struct ex_ex exp_var[MAX_VARS];
+ struct ex_ex exp_res[MAX_VARS]; /* the evluation result */
+ t_float *exp_p_var[MAX_VARS];
+ t_float *exp_p_res[MAX_VARS]; /* the previous evaluation result */
+ t_float *exp_tmpres[MAX_VARS]; /* temporty result for fexpr~ */
+ int exp_vsize; /* the size of the signal vector */
+ int exp_nivec; /* # of vector inlets */
+ float exp_f; /* control value to be transformed to signal */
} t_expr;
typedef struct ex_funcs {
- char *f_name; /* function name */
- void (*f_func)(t_expr *, long, struct ex_ex *, struct ex_ex *);
- /* the real function performing the function (void, no return!!!) */
- long f_argc; /* number of arguments */
+ char *f_name; /* function name */
+ void (*f_func)(t_expr *, long, struct ex_ex *, struct ex_ex *);
+ /* the real function performing the function (void, no return!!!) */
+ long f_argc; /* number of arguments */
} t_ex_func;
/* function prototypes for pd-related functions called withing vexp.h */
@@ -227,12 +227,12 @@ extern int ex_getsym(char *p, t_symbol **s);
extern const char *ex_symname(t_symbol *s);
void ex_mkvector(t_float *fp, t_float x, int size);
extern void ex_size(t_expr *expr, long int argc, struct ex_ex *argv,
- struct ex_ex *optr);
-extern void ex_sum(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-extern void ex_Sum(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-extern void ex_avg(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-extern void ex_Avg(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
-extern void ex_store(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
+ struct ex_ex *optr);
+extern void ex_sum(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
+extern void ex_Sum(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
+extern void ex_avg(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
+extern void ex_Avg(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
+extern void ex_store(t_expr *expr, long int argc, struct ex_ex *argv, struct ex_ex *optr);
int value_getonly(t_symbol *s, t_float *f);
diff --git a/pd/extra/expr~/vexp_fun.c b/pd/extra/expr~/vexp_fun.c
index 53e9092f..fba49b18 100644
--- a/pd/extra/expr~/vexp_fun.c
+++ b/pd/extra/expr~/vexp_fun.c
@@ -27,55 +27,55 @@
/* "expr" was written by Shahrokh Yadegari c. 1989. -msp
*
* Nov. 2001 --sdy
- * conversion for expr~
+ * conversion for expr~
*
* Jan, 2002 --sdy
- * added fmod()
+ * added fmod()
*
* May 2002
- * added floor and ceil for expr -- Orm Finnendahl
+ * added floor and ceil for expr -- Orm Finnendahl
*
* July 2002 --sdy
- * added the following math funtions:
- * cbrt - cube root
- * erf - error function
- * erfc - complementary error function
- * expm1 - exponential minus 1,
- * log1p - logarithm of 1 plus
- * isinf - is the value infinite,
- * finite - is the value finite
- * isnan -- is the resut a nan (Not a number)
- * copysign - copy sign of a number
- * ldexp - multiply floating-point number by integral power of 2
- * imodf - get signed integral value from floating-point number
- * modf - get signed fractional value from floating-point number
- * drem - floating-point remainder function
+ * added the following math funtions:
+ * cbrt - cube root
+ * erf - error function
+ * erfc - complementary error function
+ * expm1 - exponential minus 1,
+ * log1p - logarithm of 1 plus
+ * isinf - is the value infinite,
+ * finite - is the value finite
+ * isnan -- is the resut a nan (Not a number)
+ * copysign - copy sign of a number
+ * ldexp - multiply floating-point number by integral power of 2
+ * imodf - get signed integral value from floating-point number
+ * modf - get signed fractional value from floating-point number
+ * drem - floating-point remainder function
*
- * The following are done but not popular enough in math libss
- * to be included yet
- * hypoth - Euclidean distance function
- * trunc
- * round
- * nearbyint -
+ * The following are done but not popular enough in math libss
+ * to be included yet
+ * hypoth - Euclidean distance function
+ * trunc
+ * round
+ * nearbyint -
*/
/*
* vexp_func.c -- this file include all the functions for vexp.
- * the first two arguments to the function are the number
- * of argument and an array of arguments (argc, argv)
- * the last argument is a pointer to a struct ex_ex for
- * the result. Up do this point, the content of the
- * struct ex_ex that these functions receive are either
- * ET_INT (long), ET_FLT (float), or ET_SYM (char **, it is
- * char ** and not char * since NewHandle of Mac returns
- * a char ** for relocatability.) The common practice in
- * these functions is that they figure out the type of their
- * result according to the type of the arguments. In general
- * the ET_SYM is used an ET_INT when we expect a value.
- * It is the users responsibility not to pass strings to the
- * function.
+ * the first two arguments to the function are the number
+ * of argument and an array of arguments (argc, argv)
+ * the last argument is a pointer to a struct ex_ex for
+ * the result. Up do this point, the content of the
+ * struct ex_ex that these functions receive are either
+ * ET_INT (long), ET_FLT (float), or ET_SYM (char **, it is
+ * char ** and not char * since NewHandle of Mac returns
+ * a char ** for relocatability.) The common practice in
+ * these functions is that they figure out the type of their
+ * result according to the type of the arguments. In general
+ * the ET_SYM is used an ET_INT when we expect a value.
+ * It is the users responsibility not to pass strings to the
+ * function.
*/
#include <stdlib.h>
@@ -145,68 +145,68 @@ static void ex_hypoth(t_expr *expr, long argc, struct ex_ex *argv, struct ex_ex
t_ex_func ex_funcs[] = {
- {"min", ex_min, 2},
- {"max", ex_max, 2},
- {"int", ex_toint, 1},
- {"rint", ex_rint, 1},
- {"float", ex_tofloat, 1},
- {"fmod", ex_fmod, 2},
- {"floor", ex_floor, 2},
- {"ceil", ex_ceil, 2},
- {"pow", ex_pow, 2},
- {"sqrt", ex_sqrt, 1},
- {"exp", ex_exp, 1},
- {"log10", ex_log, 1},
- {"ln", ex_ln, 1},
- {"log", ex_ln, 1},
- {"sin", ex_sin, 1},
- {"cos", ex_cos, 1},
- {"tan", ex_tan, 1},
- {"asin", ex_asin, 1},
- {"acos", ex_acos, 1},
- {"atan", ex_atan, 1},
- {"atan2", ex_atan2, 2},
- {"sinh", ex_sinh, 1},
- {"cosh", ex_cosh, 1},
- {"tanh", ex_tanh, 1},
- {"fact", ex_fact, 1},
- {"random", ex_random, 2}, /* random number */
- {"abs", ex_abs, 1},
- {"if", ex_if, 3},
- {"ldexp ", ex_ldexp, 1},
- {"imodf ", ex_imodf, 1},
- {"modf", ex_modf, 1},
+ {"min", ex_min, 2},
+ {"max", ex_max, 2},
+ {"int", ex_toint, 1},
+ {"rint", ex_rint, 1},
+ {"float", ex_tofloat, 1},
+ {"fmod", ex_fmod, 2},
+ {"floor", ex_floor, 2},
+ {"ceil", ex_ceil, 2},
+ {"pow", ex_pow, 2},
+ {"sqrt", ex_sqrt, 1},
+ {"exp", ex_exp, 1},
+ {"log10", ex_log, 1},
+ {"ln", ex_ln, 1},
+ {"log", ex_ln, 1},
+ {"sin", ex_sin, 1},
+ {"cos", ex_cos, 1},
+ {"tan", ex_tan, 1},
+ {"asin", ex_asin, 1},
+ {"acos", ex_acos, 1},
+ {"atan", ex_atan, 1},
+ {"atan2", ex_atan2, 2},
+ {"sinh", ex_sinh, 1},
+ {"cosh", ex_cosh, 1},
+ {"tanh", ex_tanh, 1},
+ {"fact", ex_fact, 1},
+ {"random", ex_random, 2}, /* random number */
+ {"abs", ex_abs, 1},
+ {"if", ex_if, 3},
+ {"ldexp ", ex_ldexp, 1},
+ {"imodf ", ex_imodf, 1},
+ {"modf", ex_modf, 1},
#ifndef NT
- {"cbrt", ex_cbrt, 1},
- {"erf", ex_erf, 1},
- {"erfc", ex_erfc, 1},
- {"expm1", ex_expm1, 1},
- {"log1p", ex_log1p, 1},
- {"isinf", ex_isinf, 1},
- {"finite", ex_finite, 1},
- {"isnan", ex_isnan, 1},
- {"copysig", ex_copysign, 1},
- {"drem", ex_drem, 1},
- {"asinh", ex_asinh, 1},
- {"acosh", ex_acosh, 1},
- {"atanh", ex_atanh, 1}, /* hyperbolic atan */
+ {"cbrt", ex_cbrt, 1},
+ {"erf", ex_erf, 1},
+ {"erfc", ex_erfc, 1},
+ {"expm1", ex_expm1, 1},
+ {"log1p", ex_log1p, 1},
+ {"isinf", ex_isinf, 1},
+ {"finite", ex_finite, 1},
+ {"isnan", ex_isnan, 1},
+ {"copysig", ex_copysign, 1},
+ {"drem", ex_drem, 1},
+ {"asinh", ex_asinh, 1},
+ {"acosh", ex_acosh, 1},
+ {"atanh", ex_atanh, 1}, /* hyperbolic atan */
#endif
#ifdef PD
- {"size", ex_size, 1},
- {"sum", ex_sum, 1},
- {"Sum", ex_Sum, 3},
- {"avg", ex_avg, 1},
- {"Avg", ex_Avg, 3},
- {"store", ex_store, 3},
+ {"size", ex_size, 1},
+ {"sum", ex_sum, 1},
+ {"Sum", ex_Sum, 3},
+ {"avg", ex_avg, 1},
+ {"Avg", ex_Avg, 3},
+ {"store", ex_store, 3},
#endif
#ifdef notdef
/* the following will be added once they are more popular in math libraries */
- {"round", ex_round, 1},
- {"trunc", ex_trunc, 1},
- {"nearbyint", ex_nearbyint, 1},
- {"hypoth", ex_hypoth, 1},
+ {"round", ex_round, 1},
+ {"trunc", ex_trunc, 1},
+ {"nearbyint", ex_nearbyint, 1},
+ {"hypoth", ex_hypoth, 1},
#endif
- {0, 0, 0}
+ {0, 0, 0}
};
/*
@@ -214,189 +214,189 @@ t_ex_func ex_funcs[] = {
* if fltret is set return float
* otherwise return value based on regular typechecking,
*/
-#define FUNC_EVAL(left, right, func, leftfuncast, rightfuncast, optr, fltret) \
-switch (left->ex_type) { \
-case ET_INT: \
- switch(right->ex_type) { \
- case ET_INT: \
- if (optr->ex_type == ET_VEC) { \
- op = optr->ex_vec; \
- scalar = (float)func(leftfuncast left->ex_int, \
- rightfuncast right->ex_int); \
- j = e->exp_vsize; \
- while (j--) \
- *op++ = scalar; \
- } else { \
- if (fltret) { \
- optr->ex_type = ET_FLT; \
- optr->ex_flt = (float)func(leftfuncast \
- left->ex_int, rightfuncast right->ex_int); \
- } else { \
- optr->ex_type = ET_INT; \
- optr->ex_int = (int)func(leftfuncast \
- left->ex_int, rightfuncast right->ex_int); \
- } \
- } \
- break; \
- case ET_FLT: \
- if (optr->ex_type == ET_VEC) { \
- op = optr->ex_vec; \
- scalar = (float)func(leftfuncast left->ex_int, \
- rightfuncast right->ex_flt); \
- j = e->exp_vsize; \
- while (j--) \
- *op++ = scalar; \
- } else { \
- optr->ex_type = ET_FLT; \
- optr->ex_flt = (float)func(leftfuncast left->ex_int, \
- rightfuncast right->ex_flt); \
- } \
- break; \
- case ET_VEC: \
- case ET_VI: \
- if (optr->ex_type != ET_VEC) { \
- if (optr->ex_type == ET_VI) { \
- post("expr~: Int. error %d", __LINE__); \
- abort(); \
- } \
- optr->ex_type = ET_VEC; \
- optr->ex_vec = (t_float *) \
- fts_malloc(sizeof (t_float)*e->exp_vsize); \
- } \
- scalar = left->ex_int; \
- rp = right->ex_vec; \
- op = optr->ex_vec; \
- j = e->exp_vsize; \
- while (j--) { \
- *op++ = (float)func(leftfuncast scalar, \
- rightfuncast *rp); \
- rp++; \
- } \
- break; \
- case ET_SYM: \
- default: \
- post_error((fts_object_t *) e, \
- "expr: FUNC_EVAL(%d): bad right type %ld\n", \
- __LINE__, right->ex_type);\
- } \
- break; \
-case ET_FLT: \
- switch(right->ex_type) { \
- case ET_INT: \
- if (optr->ex_type == ET_VEC) { \
- op = optr->ex_vec; \
- scalar = (float)func(leftfuncast left->ex_flt, \
- rightfuncast right->ex_int); \
- j = e->exp_vsize; \
- while (j--) \
- *op++ = scalar; \
- } else { \
- optr->ex_type = ET_FLT; \
- optr->ex_flt = (float)func(leftfuncast left->ex_flt, \
- rightfuncast right->ex_int); \
- } \
- break; \
- case ET_FLT: \
- if (optr->ex_type == ET_VEC) { \
- op = optr->ex_vec; \
- scalar = (float)func(leftfuncast left->ex_flt, \
- rightfuncast right->ex_flt); \
- j = e->exp_vsize; \
- while (j--) \
- *op++ = scalar; \
- } else { \
- optr->ex_type = ET_FLT; \
- optr->ex_flt = (float)func(leftfuncast left->ex_flt, \
- rightfuncast right->ex_flt); \
- } \
- break; \
- case ET_VEC: \
- case ET_VI: \
- if (optr->ex_type != ET_VEC) { \
- if (optr->ex_type == ET_VI) { \
- post("expr~: Int. error %d", __LINE__); \
- abort(); \
- } \
- optr->ex_type = ET_VEC; \
- optr->ex_vec = (t_float *) \
- fts_malloc(sizeof (t_float) * e->exp_vsize);\
- } \
- scalar = left->ex_flt; \
- rp = right->ex_vec; \
- op = optr->ex_vec; \
- j = e->exp_vsize; \
- while (j--) { \
- *op++ = (float)func(leftfuncast scalar, \
- rightfuncast *rp); \
- rp++; \
- } \
- break; \
- case ET_SYM: \
- default: \
- post_error((fts_object_t *) e, \
- "expr: FUNC_EVAL(%d): bad right type %ld\n", \
- __LINE__, right->ex_type);\
- } \
- break; \
-case ET_VEC: \
-case ET_VI: \
- if (optr->ex_type != ET_VEC) { \
- if (optr->ex_type == ET_VI) { \
- post("expr~: Int. error %d", __LINE__); \
- abort(); \
- } \
- optr->ex_type = ET_VEC; \
- optr->ex_vec = (t_float *) \
- fts_malloc(sizeof (t_float) * e->exp_vsize); \
- } \
- op = optr->ex_vec; \
- lp = left->ex_vec; \
- switch(right->ex_type) { \
- case ET_INT: \
- scalar = right->ex_int; \
- j = e->exp_vsize; \
- while (j--) { \
- *op++ = (float)func(leftfuncast *lp, \
- rightfuncast scalar); \
- lp++; \
- } \
- break; \
- case ET_FLT: \
- scalar = right->ex_flt; \
- j = e->exp_vsize; \
- while (j--) { \
- *op++ = (float)func(leftfuncast *lp, \
- rightfuncast scalar); \
- lp++; \
- } \
- break; \
- case ET_VEC: \
- case ET_VI: \
- rp = right->ex_vec; \
- j = e->exp_vsize; \
- while (j--) { \
- /* \
- * on a RISC processor one could copy \
- * 8 times in each round to get a considerable \
- * improvement \
- */ \
- *op++ = (float)func(leftfuncast *lp, \
- rightfuncast *rp); \
- rp++; lp++; \
- } \
- break; \
- case ET_SYM: \
- default: \
- post_error((fts_object_t *) e, \
- "expr: FUNC_EVAL(%d): bad right type %ld\n", \
- __LINE__, right->ex_type);\
- } \
- break; \
-case ET_SYM: \
-default: \
- post_error((fts_object_t *) e, \
- "expr: FUNC_EVAL(%d): bad left type %ld\n", \
- __LINE__, left->ex_type); \
+#define FUNC_EVAL(left, right, func, leftfuncast, rightfuncast, optr, fltret) \
+switch (left->ex_type) { \
+case ET_INT: \
+ switch(right->ex_type) { \
+ case ET_INT: \
+ if (optr->ex_type == ET_VEC) { \
+ op = optr->ex_vec; \
+ scalar = (float)func(leftfuncast left->ex_int, \
+ rightfuncast right->ex_int); \
+ j = e->exp_vsize; \
+ while (j--) \
+ *op++ = scalar; \
+ } else { \
+ if (fltret) { \
+ optr->ex_type = ET_FLT; \
+ optr->ex_flt = (float)func(leftfuncast \
+ left->ex_int, rightfuncast right->ex_int); \
+ } else { \
+ optr->ex_type = ET_INT; \
+ optr->ex_int = (int)func(leftfuncast \
+ left->ex_int, rightfuncast right->ex_int); \
+ } \
+ } \
+ break; \
+ case ET_FLT: \
+ if (optr->ex_type == ET_VEC) { \
+ op = optr->ex_vec; \
+ scalar = (float)func(leftfuncast left->ex_int, \
+ rightfuncast right->ex_flt); \
+ j = e->exp_vsize; \
+ while (j--) \
+ *op++ = scalar; \
+ } else { \
+ optr->ex_type = ET_FLT; \
+ optr->ex_flt = (float)func(leftfuncast left->ex_int, \
+ rightfuncast right->ex_flt); \
+ } \
+ break; \
+ case ET_VEC: \
+ case ET_VI: \
+ if (optr->ex_type != ET_VEC) { \
+ if (optr->ex_type == ET_VI) { \
+ post("expr~: Int. error %d", __LINE__); \
+ abort(); \
+ } \
+ optr->ex_type = ET_VEC; \
+ optr->ex_vec = (t_float *) \
+ fts_malloc(sizeof (t_float)*e->exp_vsize); \
+ } \
+ scalar = left->ex_int; \
+ rp = right->ex_vec; \
+ op = optr->ex_vec; \
+ j = e->exp_vsize; \
+ while (j--) { \
+ *op++ = (float)func(leftfuncast scalar, \
+ rightfuncast *rp); \
+ rp++; \
+ } \
+ break; \
+ case ET_SYM: \
+ default: \
+ post_error((fts_object_t *) e, \
+ "expr: FUNC_EVAL(%d): bad right type %ld\n", \
+ __LINE__, right->ex_type);\
+ } \
+ break; \
+case ET_FLT: \
+ switch(right->ex_type) { \
+ case ET_INT: \
+ if (optr->ex_type == ET_VEC) { \
+ op = optr->ex_vec; \
+ scalar = (float)func(leftfuncast left->ex_flt, \
+ rightfuncast right->ex_int); \
+ j = e->exp_vsize; \
+ while (j--) \
+ *op++ = scalar; \
+ } else { \
+ optr->ex_type = ET_FLT; \
+ optr->ex_flt = (float)func(leftfuncast left->ex_flt, \
+ rightfuncast right->ex_int); \
+ } \
+ break; \
+ case ET_FLT: \
+ if (optr->ex_type == ET_VEC) { \
+ op = optr->ex_vec; \
+ scalar = (float)func(leftfuncast left->ex_flt, \
+ rightfuncast right->ex_flt); \
+ j = e->exp_vsize; \
+ while (j--) \
+ *op++ = scalar; \
+ } else { \
+ optr->ex_type = ET_FLT; \
+ optr->ex_flt = (float)func(leftfuncast left->ex_flt, \
+ rightfuncast right->ex_flt); \
+ } \
+ break; \
+ case ET_VEC: \
+ case ET_VI: \
+ if (optr->ex_type != ET_VEC) { \
+ if (optr->ex_type == ET_VI) { \
+ post("expr~: Int. error %d", __LINE__); \
+ abort(); \
+ } \
+ optr->ex_type = ET_VEC; \
+ optr->ex_vec = (t_float *) \
+ fts_malloc(sizeof (t_float) * e->exp_vsize);\
+ } \
+ scalar = left->ex_flt; \
+ rp = right->ex_vec; \
+ op = optr->ex_vec; \
+ j = e->exp_vsize; \
+ while (j--) { \
+ *op++ = (float)func(leftfuncast scalar, \
+ rightfuncast *rp); \
+ rp++; \
+ } \
+ break; \
+ case ET_SYM: \
+ default: \
+ post_error((fts_object_t *) e, \
+ "expr: FUNC_EVAL(%d): bad right type %ld\n", \
+ __LINE__, right->ex_type);\
+ } \
+ break; \
+case ET_VEC: \
+case ET_VI: \
+ if (optr->ex_type != ET_VEC) { \
+ if (optr->ex_type == ET_VI) { \
+ post("expr~: Int. error %d", __LINE__); \
+ abort(); \
+ } \
+ optr->ex_type = ET_VEC; \
+ optr->ex_vec = (t_float *) \
+ fts_malloc(sizeof (t_float) * e->exp_vsize); \
+ } \
+ op = optr->ex_vec; \
+ lp = left->ex_vec; \
+ switch(right->ex_type) { \
+ case ET_INT: \
+ scalar = right->ex_int; \
+ j = e->exp_vsize; \
+ while (j--) { \
+ *op++ = (float)func(leftfuncast *lp, \
+ rightfuncast scalar); \
+ lp++; \
+ } \
+ break; \
+ case ET_FLT: \
+ scalar = right->ex_flt; \
+ j = e->exp_vsize; \
+ while (j--) { \
+ *op++ = (float)func(leftfuncast *lp, \
+ rightfuncast scalar); \
+ lp++; \
+ } \
+ break; \
+ case ET_VEC: \
+ case ET_VI: \
+ rp = right->ex_vec; \
+ j = e->exp_vsize; \
+ while (j--) { \
+ /* \
+ * on a RISC processor one could copy \
+ * 8 times in each round to get a considerable \
+ * improvement \
+ */ \
+ *op++ = (float)func(leftfuncast *lp, \
+ rightfuncast *rp); \
+ rp++; lp++; \
+ } \
+ break; \
+ case ET_SYM: \
+ default: \
+ post_error((fts_object_t *) e, \
+ "expr: FUNC_EVAL(%d): bad right type %ld\n", \
+ __LINE__, right->ex_type);\
+ } \
+ break; \
+case ET_SYM: \
+default: \
+ post_error((fts_object_t *) e, \
+ "expr: FUNC_EVAL(%d): bad left type %ld\n", \
+ __LINE__, left->ex_type); \
}
/*
@@ -404,124 +404,124 @@ default: \
* if fltret is set return float
* otherwise return value based on regular typechecking,
*/
-#define FUNC_EVAL_UNARY(left, func, leftcast, optr, fltret) \
-switch(left->ex_type) { \
-case ET_INT: \
- if (optr->ex_type == ET_VEC) { \
- ex_mkvector(optr->ex_vec, \
- (float)(func (leftcast left->ex_int)), e->exp_vsize);\
- break; \
- } \
- if (fltret) { \
- optr->ex_type = ET_FLT; \
- optr->ex_flt = (float) func(leftcast left->ex_int); \
- break; \
- } \
- optr->ex_type = ET_INT; \
- optr->ex_int = (int) func(leftcast left->ex_int); \
- break; \
-case ET_FLT: \
- if (optr->ex_type == ET_VEC) { \
- ex_mkvector(optr->ex_vec, \
- (float)(func (leftcast left->ex_flt)), e->exp_vsize);\
- break; \
- } \
- optr->ex_type = ET_FLT; \
- optr->ex_flt = (float) func(leftcast left->ex_flt); \
- break; \
-case ET_VI: \
-case ET_VEC: \
- if (optr->ex_type != ET_VEC) { \
- optr->ex_type = ET_VEC; \
- optr->ex_vec = (t_float *) \
- fts_malloc(sizeof (t_float)*e->exp_vsize); \
- } \
- op = optr->ex_vec; \
- lp = left->ex_vec; \
- j = e->exp_vsize; \
- while (j--) \
- *op++ = (float)(func (leftcast *lp++)); \
- break; \
-default: \
- post_error((fts_object_t *) e, \
- "expr: FUNV_EVAL_UNARY(%d): bad left type %ld\n",\
- __LINE__, left->ex_type); \
+#define FUNC_EVAL_UNARY(left, func, leftcast, optr, fltret) \
+switch(left->ex_type) { \
+case ET_INT: \
+ if (optr->ex_type == ET_VEC) { \
+ ex_mkvector(optr->ex_vec, \
+ (float)(func (leftcast left->ex_int)), e->exp_vsize);\
+ break; \
+ } \
+ if (fltret) { \
+ optr->ex_type = ET_FLT; \
+ optr->ex_flt = (float) func(leftcast left->ex_int); \
+ break; \
+ } \
+ optr->ex_type = ET_INT; \
+ optr->ex_int = (int) func(leftcast left->ex_int); \
+ break; \
+case ET_FLT: \
+ if (optr->ex_type == ET_VEC) { \
+ ex_mkvector(optr->ex_vec, \
+ (float)(func (leftcast left->ex_flt)), e->exp_vsize);\
+ break; \
+ } \
+ optr->ex_type = ET_FLT; \
+ optr->ex_flt = (float) func(leftcast left->ex_flt); \
+ break; \
+case ET_VI: \
+case ET_VEC: \
+ if (optr->ex_type != ET_VEC) { \
+ optr->ex_type = ET_VEC; \
+ optr->ex_vec = (t_float *) \
+ fts_malloc(sizeof (t_float)*e->exp_vsize); \
+ } \
+ op = optr->ex_vec; \
+ lp = left->ex_vec; \
+ j = e->exp_vsize; \
+ while (j--) \
+ *op++ = (float)(func (leftcast *lp++)); \
+ break; \
+default: \
+ post_error((fts_object_t *) e, \
+ "expr: FUNV_EVAL_UNARY(%d): bad left type %ld\n",\
+ __LINE__, left->ex_type); \
}
#undef min
#undef max
-#define min(x,y) (x > y ? y : x)
-#define max(x,y) (x > y ? x : y)
+#define min(x,y) (x > y ? y : x)
+#define max(x,y) (x > y ? x : y)
-#define FUNC_DEF(ex_func, func, castleft, castright, fltret); \
-static void \
+#define FUNC_DEF(ex_func, func, castleft, castright, fltret); \
+static void \
ex_func(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)\
-{ \
- struct ex_ex *left, *right; \
- float *op; /* output pointer */ \
- float *lp, *rp; /* left and right vector pointers */ \
- float scalar; \
- int j; \
- \
- left = argv++; \
- right = argv; \
- FUNC_EVAL(left, right, func, castleft, castright, optr, fltret); \
+{ \
+ struct ex_ex *left, *right; \
+ float *op; /* output pointer */ \
+ float *lp, *rp; /* left and right vector pointers */ \
+ float scalar; \
+ int j; \
+ \
+ left = argv++; \
+ right = argv; \
+ FUNC_EVAL(left, right, func, castleft, castright, optr, fltret); \
}
-#define FUNC_DEF_UNARY(ex_func, func, cast, fltret); \
-static void \
+#define FUNC_DEF_UNARY(ex_func, func, cast, fltret); \
+static void \
ex_func(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)\
-{ \
- struct ex_ex *left; \
- float *op; /* output pointer */ \
- float *lp, *rp; /* left and right vector pointers */ \
- float scalar; \
- int j; \
- \
- left = argv++; \
- \
- FUNC_EVAL_UNARY(left, func, cast, optr, fltret); \
+{ \
+ struct ex_ex *left; \
+ float *op; /* output pointer */ \
+ float *lp, *rp; /* left and right vector pointers */ \
+ float scalar; \
+ int j; \
+ \
+ left = argv++; \
+ \
+ FUNC_EVAL_UNARY(left, func, cast, optr, fltret); \
}
/*
* ex_min -- if any of the arguments are or the output are vectors, a vector
- * of floats is generated otherwise the type of the result is the
- * type of the smaller value
+ * of floats is generated otherwise the type of the result is the
+ * type of the smaller value
*/
static void
ex_min(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
- struct ex_ex *left, *right;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
- int j;
+ struct ex_ex *left, *right;
+ float *op; /* output pointer */
+ float *lp, *rp; /* left and right vector pointers */
+ float scalar;
+ int j;
- left = argv++;
- right = argv;
+ left = argv++;
+ right = argv;
- FUNC_EVAL(left, right, min, (double), (double), optr, 0);
+ FUNC_EVAL(left, right, min, (double), (double), optr, 0);
}
/*
* ex_max -- if any of the arguments are or the output are vectors, a vector
- * of floats is generated otherwise the type of the result is the
- * type of the larger value
+ * of floats is generated otherwise the type of the result is the
+ * type of the larger value
*/
static void
ex_max(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
- struct ex_ex *left, *right;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
- int j;
+ struct ex_ex *left, *right;
+ float *op; /* output pointer */
+ float *lp, *rp; /* left and right vector pointers */
+ float scalar;
+ int j;
- left = argv++;
- right = argv;
+ left = argv++;
+ right = argv;
- FUNC_EVAL(left, right, max, (double), (double), optr, 0);
+ FUNC_EVAL(left, right, max, (double), (double), optr, 0);
}
/*
@@ -530,17 +530,17 @@ ex_max(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
static void
ex_toint(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
- struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
- int j;
+ struct ex_ex *left;
+ float *op; /* output pointer */
+ float *lp, *rp; /* left and right vector pointers */
+ float scalar;
+ int j;
- left = argv++;
+ left = argv++;
-#define toint(x) ((int)(x))
- FUNC_EVAL_UNARY(left, toint, (int), optr, 0);
- }
+#define toint(x) ((int)(x))
+ FUNC_EVAL_UNARY(left, toint, (int), optr, 0);
+ }
#ifdef NT
/* No rint in NT land ??? */
@@ -549,27 +549,27 @@ double rint(double x);
double
rint(double x)
{
- return (floor(x + 0.5));
+ return (floor(x + 0.5));
}
#endif
/*
* ex_rint -- rint() round to the nearest int according to the common
- * rounding mechanism
+ * rounding mechanism
*/
static void
ex_rint(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
- struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
- int j;
+ struct ex_ex *left;
+ float *op; /* output pointer */
+ float *lp, *rp; /* left and right vector pointers */
+ float scalar;
+ int j;
- left = argv++;
+ left = argv++;
- FUNC_EVAL_UNARY(left, rint, (double), optr, 1);
+ FUNC_EVAL_UNARY(left, rint, (double), optr, 1);
}
/*
@@ -578,16 +578,16 @@ ex_rint(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
static void
ex_tofloat(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
- struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
- int j;
+ struct ex_ex *left;
+ float *op; /* output pointer */
+ float *lp, *rp; /* left and right vector pointers */
+ float scalar;
+ int j;
- left = argv++;
+ left = argv++;
-#define tofloat(x) ((float)(x))
- FUNC_EVAL_UNARY(left, tofloat, (int), optr, 1);
+#define tofloat(x) ((float)(x))
+ FUNC_EVAL_UNARY(left, tofloat, (int), optr, 1);
}
@@ -597,15 +597,15 @@ ex_tofloat(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
static void
ex_pow(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
- struct ex_ex *left, *right;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
- int j;
-
- left = argv++;
- right = argv;
- FUNC_EVAL(left, right, pow, (double), (double), optr, 1);
+ struct ex_ex *left, *right;
+ float *op; /* output pointer */
+ float *lp, *rp; /* left and right vector pointers */
+ float scalar;
+ int j;
+
+ left = argv++;
+ right = argv;
+ FUNC_EVAL(left, right, pow, (double), (double), optr, 1);
}
/*
@@ -614,15 +614,15 @@ ex_pow(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
static void
ex_sqrt(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
- struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
- int j;
+ struct ex_ex *left;
+ float *op; /* output pointer */
+ float *lp, *rp; /* left and right vector pointers */
+ float scalar;
+ int j;
- left = argv++;
+ left = argv++;
- FUNC_EVAL_UNARY(left, sqrt, (double), optr, 1);
+ FUNC_EVAL_UNARY(left, sqrt, (double), optr, 1);
}
/*
@@ -631,15 +631,15 @@ ex_sqrt(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
static void
ex_exp(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
- struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
- int j;
+ struct ex_ex *left;
+ float *op; /* output pointer */
+ float *lp, *rp; /* left and right vector pointers */
+ float scalar;
+ int j;
- left = argv++;
+ left = argv++;
- FUNC_EVAL_UNARY(left, exp, (double), optr, 1);
+ FUNC_EVAL_UNARY(left, exp, (double), optr, 1);
}
/*
@@ -648,15 +648,15 @@ ex_exp(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
static void
ex_log(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
- struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
- int j;
+ struct ex_ex *left;
+ float *op; /* output pointer */
+ float *lp, *rp; /* left and right vector pointers */
+ float scalar;
+ int j;
- left = argv++;
+ left = argv++;
- FUNC_EVAL_UNARY(left, log10, (double), optr, 1);
+ FUNC_EVAL_UNARY(left, log10, (double), optr, 1);
}
/*
@@ -665,101 +665,101 @@ ex_log(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
static void
ex_ln(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
- struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
- int j;
+ struct ex_ex *left;
+ float *op; /* output pointer */
+ float *lp, *rp; /* left and right vector pointers */
+ float scalar;
+ int j;
- left = argv++;
+ left = argv++;
- FUNC_EVAL_UNARY(left, log, (double), optr, 1);
+ FUNC_EVAL_UNARY(left, log, (double), optr, 1);
}
static void
ex_sin(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
- struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
- int j;
+ struct ex_ex *left;
+ float *op; /* output pointer */
+ float *lp, *rp; /* left and right vector pointers */
+ float scalar;
+ int j;
- left = argv++;
+ left = argv++;
- FUNC_EVAL_UNARY(left, sin, (double), optr, 1);
+ FUNC_EVAL_UNARY(left, sin, (double), optr, 1);
}
static void
ex_cos(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
- struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
- int j;
+ struct ex_ex *left;
+ float *op; /* output pointer */
+ float *lp, *rp; /* left and right vector pointers */
+ float scalar;
+ int j;
- left = argv++;
+ left = argv++;
- FUNC_EVAL_UNARY(left, cos, (double), optr, 1);
+ FUNC_EVAL_UNARY(left, cos, (double), optr, 1);
}
static void
ex_tan(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
- struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
- int j;
+ struct ex_ex *left;
+ float *op; /* output pointer */
+ float *lp, *rp; /* left and right vector pointers */
+ float scalar;
+ int j;
- left = argv++;
+ left = argv++;
- FUNC_EVAL_UNARY(left, tan, (double), optr, 1);
+ FUNC_EVAL_UNARY(left, tan, (double), optr, 1);
}
static void
ex_asin(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
- struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
- int j;
+ struct ex_ex *left;
+ float *op; /* output pointer */
+ float *lp, *rp; /* left and right vector pointers */
+ float scalar;
+ int j;
- left = argv++;
+ left = argv++;
- FUNC_EVAL_UNARY(left, asin, (double), optr, 1);
+ FUNC_EVAL_UNARY(left, asin, (double), optr, 1);
}
static void
ex_acos(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
- struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
- int j;
+ struct ex_ex *left;
+ float *op; /* output pointer */
+ float *lp, *rp; /* left and right vector pointers */
+ float scalar;
+ int j;
- left = argv++;
+ left = argv++;
- FUNC_EVAL_UNARY(left, acos, (double), optr, 1);
+ FUNC_EVAL_UNARY(left, acos, (double), optr, 1);
}
static void
ex_atan(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
- struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
- int j;
+ struct ex_ex *left;
+ float *op; /* output pointer */
+ float *lp, *rp; /* left and right vector pointers */
+ float scalar;
+ int j;
- left = argv++;
+ left = argv++;
- FUNC_EVAL_UNARY(left, atan, (double), optr, 1);
+ FUNC_EVAL_UNARY(left, atan, (double), optr, 1);
}
/*
@@ -768,15 +768,15 @@ ex_atan(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
static void
ex_atan2(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
- struct ex_ex *left, *right;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
- int j;
-
- left = argv++;
- right = argv;
- FUNC_EVAL(left, right, atan2, (double), (double), optr, 1);
+ struct ex_ex *left, *right;
+ float *op; /* output pointer */
+ float *lp, *rp; /* left and right vector pointers */
+ float scalar;
+ int j;
+
+ left = argv++;
+ right = argv;
+ FUNC_EVAL(left, right, atan2, (double), (double), optr, 1);
}
/*
@@ -785,15 +785,15 @@ ex_atan2(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
static void
ex_fmod(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
- struct ex_ex *left, *right;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
- int j;
-
- left = argv++;
- right = argv;
- FUNC_EVAL(left, right, fmod, (double), (double), optr, 1);
+ struct ex_ex *left, *right;
+ float *op; /* output pointer */
+ float *lp, *rp; /* left and right vector pointers */
+ float scalar;
+ int j;
+
+ left = argv++;
+ right = argv;
+ FUNC_EVAL(left, right, fmod, (double), (double), optr, 1);
}
@@ -803,14 +803,14 @@ ex_fmod(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
static void
ex_floor(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
- struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
- int j;
-
- left = argv++;
- FUNC_EVAL_UNARY(left, floor, (double), optr, 1);
+ struct ex_ex *left;
+ float *op; /* output pointer */
+ float *lp, *rp; /* left and right vector pointers */
+ float scalar;
+ int j;
+
+ left = argv++;
+ FUNC_EVAL_UNARY(left, floor, (double), optr, 1);
}
@@ -820,57 +820,57 @@ ex_floor(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
static void
ex_ceil(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
- struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
- int j;
-
- left = argv++;
- FUNC_EVAL_UNARY(left, ceil, (double), optr, 1);
+ struct ex_ex *left;
+ float *op; /* output pointer */
+ float *lp, *rp; /* left and right vector pointers */
+ float scalar;
+ int j;
+
+ left = argv++;
+ FUNC_EVAL_UNARY(left, ceil, (double), optr, 1);
}
static void
ex_sinh(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
- struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
- int j;
+ struct ex_ex *left;
+ float *op; /* output pointer */
+ float *lp, *rp; /* left and right vector pointers */
+ float scalar;
+ int j;
- left = argv++;
+ left = argv++;
- FUNC_EVAL_UNARY(left, sinh, (double), optr, 1);
+ FUNC_EVAL_UNARY(left, sinh, (double), optr, 1);
}
static void
ex_cosh(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
- struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
- int j;
+ struct ex_ex *left;
+ float *op; /* output pointer */
+ float *lp, *rp; /* left and right vector pointers */
+ float scalar;
+ int j;
- left = argv++;
+ left = argv++;
- FUNC_EVAL_UNARY(left, cosh, (double), optr, 1);
+ FUNC_EVAL_UNARY(left, cosh, (double), optr, 1);
}
static void
ex_tanh(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
- struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
- int j;
+ struct ex_ex *left;
+ float *op; /* output pointer */
+ float *lp, *rp; /* left and right vector pointers */
+ float scalar;
+ int j;
- left = argv++;
+ left = argv++;
- FUNC_EVAL_UNARY(left, tanh, (double), optr, 1);
+ FUNC_EVAL_UNARY(left, tanh, (double), optr, 1);
}
@@ -878,81 +878,81 @@ ex_tanh(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
static void
ex_asinh(t_expr *e, long argc, struct ex_ex *argv, struct ex_ex *optr)
{
- struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
- int j;
+ struct ex_ex *left;
+ float *op; /* output pointer */
+ float *lp, *rp; /* left and right vector pointers */
+ float scalar;
+ int j;
- left = argv++;
+ left = argv++;
- FUNC_EVAL_UNARY(left, asinh, (double), optr, 1);
+ FUNC_EVAL_UNARY(left, asinh, (double), optr, 1);
}
static void
ex_acosh(t_expr *e, long argc, struct ex_ex *argv, struct ex_ex *optr)
{
- struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
- int j;
+ struct ex_ex *left;
+ float *op; /* output pointer */
+ float *lp, *rp; /* left and right vector pointers */
+ float scalar;
+ int j;
- left = argv++;
+ left = argv++;
- FUNC_EVAL_UNARY(left, acosh, (double), optr, 1);
+ FUNC_EVAL_UNARY(left, acosh, (double), optr, 1);
}
static void
ex_atanh(t_expr *e, long argc, struct ex_ex *argv, struct ex_ex *optr)
{
- struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
- int j;
+ struct ex_ex *left;
+ float *op; /* output pointer */
+ float *lp, *rp; /* left and right vector pointers */
+ float scalar;
+ int j;
- left = argv++;
+ left = argv++;
- FUNC_EVAL_UNARY(left, atanh, (double), optr, 1);
+ FUNC_EVAL_UNARY(left, atanh, (double), optr, 1);
}
#endif
static int
ex_dofact(int i)
{
- int ret = 0;
+ int ret = 0;
- if (i)
- ret = 1;
- else
- return (0);
+ if (i)
+ ret = 1;
+ else
+ return (0);
- do {
- ret *= i;
- } while (--i);
+ do {
+ ret *= i;
+ } while (--i);
- return(ret);
+ return(ret);
}
static void
ex_fact(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
- struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
- int j;
+ struct ex_ex *left;
+ float *op; /* output pointer */
+ float *lp, *rp; /* left and right vector pointers */
+ float scalar;
+ int j;
- left = argv++;
+ left = argv++;
- FUNC_EVAL_UNARY(left, ex_dofact, (int), optr, 0);
+ FUNC_EVAL_UNARY(left, ex_dofact, (int), optr, 0);
}
static int
ex_dorandom(int i1, int i2)
{
- return(i1 + (((i2 - i1) * (rand() & 0x7fffL)) >> 15));
+ return(i1 + (((i2 - i1) * (rand() & 0x7fffL)) >> 15));
}
/*
* ex_random -- return a random number
@@ -960,30 +960,30 @@ ex_dorandom(int i1, int i2)
static void
ex_random(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
- struct ex_ex *left, *right;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
- int j;
-
- left = argv++;
- right = argv;
- FUNC_EVAL(left, right, ex_dorandom, (int), (int), optr, 0);
+ struct ex_ex *left, *right;
+ float *op; /* output pointer */
+ float *lp, *rp; /* left and right vector pointers */
+ float scalar;
+ int j;
+
+ left = argv++;
+ right = argv;
+ FUNC_EVAL(left, right, ex_dorandom, (int), (int), optr, 0);
}
static void
ex_abs(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
- struct ex_ex *left;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float scalar;
- int j;
+ struct ex_ex *left;
+ float *op; /* output pointer */
+ float *lp, *rp; /* left and right vector pointers */
+ float scalar;
+ int j;
- left = argv++;
+ left = argv++;
- FUNC_EVAL_UNARY(left, fabs, (double), optr, 0);
+ FUNC_EVAL_UNARY(left, fabs, (double), optr, 0);
}
/*
@@ -992,231 +992,231 @@ ex_abs(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
static void
ex_if(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
- struct ex_ex *left, *right, *cond, *res;
- float *op; /* output pointer */
- float *lp, *rp; /* left and right vector pointers */
- float *cp; /* condition pointer */
- float leftvalue, rightvalue;
- int j;
-
- cond = argv++;
- left = argv++;
- right = argv;
-
- switch (cond->ex_type) {
- case ET_VEC:
- case ET_VI:
- if (optr->ex_type != ET_VEC) {
- if (optr->ex_type == ET_VI) {
- /* SDY remove this test */
- post("expr~: Int. error %d", __LINE__);
- return;
- }
- optr->ex_type = ET_VEC;
- optr->ex_vec = (t_float *)
- fts_malloc(sizeof (t_float) * e->exp_vsize);
- }
- op = optr->ex_vec;
- j = e->exp_vsize;
- cp = cond->ex_vec;
- switch (left->ex_type) {
- case ET_INT:
- leftvalue = left->ex_int;
- switch (right->ex_type) {
- case ET_INT:
- rightvalue = right->ex_int;
- while (j--) {
- if (*cp++)
- *op++ = leftvalue;
- else
- *op++ = rightvalue;
- }
- return;
- case ET_FLT:
- rightvalue = right->ex_flt;
- while (j--) {
- if (*cp++)
- *op++ = leftvalue;
- else
- *op++ = rightvalue;
- }
- return;
- case ET_VEC:
- case ET_VI:
- rp = right->ex_vec;
- while (j--) {
- if (*cp++)
- *op++ = leftvalue;
- else
- *op++ = *rp;
- rp++;
- }
- return;
- case ET_SYM:
- default:
- post_error((fts_object_t *) e,
- "expr: FUNC_EVAL(%d): bad right type %ld\n",
- __LINE__, right->ex_type);
- return;
- }
- case ET_FLT:
- leftvalue = left->ex_flt;
- switch (right->ex_type) {
- case ET_INT:
- rightvalue = right->ex_int;
- while (j--) {
- if (*cp++)
- *op++ = leftvalue;
- else
- *op++ = rightvalue;
- }
- return;
- case ET_FLT:
- rightvalue = right->ex_flt;
- while (j--) {
- if (*cp++)
- *op++ = leftvalue;
- else
- *op++ = rightvalue;
- }
- return;
- case ET_VEC:
- case ET_VI:
- rp = right->ex_vec;
- while (j--) {
- if (*cp++)
- *op++ = leftvalue;
- else
- *op++ = *rp;
- rp++;
- }
- return;
- case ET_SYM:
- default:
- post_error((fts_object_t *) e,
- "expr: FUNC_EVAL(%d): bad right type %ld\n",
- __LINE__, right->ex_type);
- return;
- }
- case ET_VEC:
- case ET_VI:
- lp = left->ex_vec;
- switch (right->ex_type) {
- case ET_INT:
- rightvalue = right->ex_int;
- while (j--) {
- if (*cp++)
- *op++ = *lp;
- else
- *op++ = rightvalue;
- lp++;
- }
- return;
- case ET_FLT:
- rightvalue = right->ex_flt;
- while (j--) {
- if (*cp++)
- *op++ = *lp;
- else
- *op++ = rightvalue;
- lp++;
- }
- return;
- case ET_VEC:
- case ET_VI:
- rp = right->ex_vec;
- while (j--) {
- if (*cp++)
- *op++ = *lp;
- else
- *op++ = *rp;
- lp++; rp++;
- }
- return;
- case ET_SYM:
- default:
- post_error((fts_object_t *) e,
- "expr: FUNC_EVAL(%d): bad right type %ld\n",
- __LINE__, right->ex_type);
- return;
- }
- case ET_SYM:
- default:
- post_error((fts_object_t *) e,
- "expr: FUNC_EVAL(%d): bad left type %ld\n",
- __LINE__, left->ex_type);
- return;
- }
- case ET_INT:
- if (cond->ex_int)
- res = left;
- else
- res = right;
- break;
- case ET_FLT:
- if (cond->ex_flt)
- res = left;
- else
- res = right;
- break;
- case ET_SYM:
- default:
- post_error((fts_object_t *) e,
- "expr: FUNC_EVAL(%d): bad condition type %ld\n",
- __LINE__, cond->ex_type);
- return;
- }
- switch(res->ex_type) {
- case ET_INT:
- if (optr->ex_type == ET_VEC) {
- ex_mkvector(optr->ex_vec, (float)res->ex_int,
- e->exp_vsize);
- return;
- }
- *optr = *res;
- return;
- case ET_FLT:
- if (optr->ex_type == ET_VEC) {
- ex_mkvector(optr->ex_vec, (float)res->ex_flt,
- e->exp_vsize);
- return;
- }
- *optr = *res;
- return;
- case ET_VEC:
- case ET_VI:
- if (optr->ex_type != ET_VEC) {
- if (optr->ex_type == ET_VI) {
- /* SDY remove this test */
- post("expr~: Int. error %d", __LINE__);
- return;
- }
- optr->ex_type = ET_VEC;
- optr->ex_vec = (t_float *)
- fts_malloc(sizeof (t_float) * e->exp_vsize);
- }
- memcpy(optr->ex_vec, res->ex_vec, e->exp_vsize*sizeof(t_float));
- return;
- case ET_SYM:
- default:
- post_error((fts_object_t *) e,
- "expr: FUNC_EVAL(%d): bad res type %ld\n",
- __LINE__, res->ex_type);
- return;
- }
-
+ struct ex_ex *left, *right, *cond, *res;
+ float *op; /* output pointer */
+ float *lp, *rp; /* left and right vector pointers */
+ float *cp; /* condition pointer */
+ float leftvalue, rightvalue;
+ int j;
+
+ cond = argv++;
+ left = argv++;
+ right = argv;
+
+ switch (cond->ex_type) {
+ case ET_VEC:
+ case ET_VI:
+ if (optr->ex_type != ET_VEC) {
+ if (optr->ex_type == ET_VI) {
+ /* SDY remove this test */
+ post("expr~: Int. error %d", __LINE__);
+ return;
+ }
+ optr->ex_type = ET_VEC;
+ optr->ex_vec = (t_float *)
+ fts_malloc(sizeof (t_float) * e->exp_vsize);
+ }
+ op = optr->ex_vec;
+ j = e->exp_vsize;
+ cp = cond->ex_vec;
+ switch (left->ex_type) {
+ case ET_INT:
+ leftvalue = left->ex_int;
+ switch (right->ex_type) {
+ case ET_INT:
+ rightvalue = right->ex_int;
+ while (j--) {
+ if (*cp++)
+ *op++ = leftvalue;
+ else
+ *op++ = rightvalue;
+ }
+ return;
+ case ET_FLT:
+ rightvalue = right->ex_flt;
+ while (j--) {
+ if (*cp++)
+ *op++ = leftvalue;
+ else
+ *op++ = rightvalue;
+ }
+ return;
+ case ET_VEC:
+ case ET_VI:
+ rp = right->ex_vec;
+ while (j--) {
+ if (*cp++)
+ *op++ = leftvalue;
+ else
+ *op++ = *rp;
+ rp++;
+ }
+ return;
+ case ET_SYM:
+ default:
+ post_error((fts_object_t *) e,
+ "expr: FUNC_EVAL(%d): bad right type %ld\n",
+ __LINE__, right->ex_type);
+ return;
+ }
+ case ET_FLT:
+ leftvalue = left->ex_flt;
+ switch (right->ex_type) {
+ case ET_INT:
+ rightvalue = right->ex_int;
+ while (j--) {
+ if (*cp++)
+ *op++ = leftvalue;
+ else
+ *op++ = rightvalue;
+ }
+ return;
+ case ET_FLT:
+ rightvalue = right->ex_flt;
+ while (j--) {
+ if (*cp++)
+ *op++ = leftvalue;
+ else
+ *op++ = rightvalue;
+ }
+ return;
+ case ET_VEC:
+ case ET_VI:
+ rp = right->ex_vec;
+ while (j--) {
+ if (*cp++)
+ *op++ = leftvalue;
+ else
+ *op++ = *rp;
+ rp++;
+ }
+ return;
+ case ET_SYM:
+ default:
+ post_error((fts_object_t *) e,
+ "expr: FUNC_EVAL(%d): bad right type %ld\n",
+ __LINE__, right->ex_type);
+ return;
+ }
+ case ET_VEC:
+ case ET_VI:
+ lp = left->ex_vec;
+ switch (right->ex_type) {
+ case ET_INT:
+ rightvalue = right->ex_int;
+ while (j--) {
+ if (*cp++)
+ *op++ = *lp;
+ else
+ *op++ = rightvalue;
+ lp++;
+ }
+ return;
+ case ET_FLT:
+ rightvalue = right->ex_flt;
+ while (j--) {
+ if (*cp++)
+ *op++ = *lp;
+ else
+ *op++ = rightvalue;
+ lp++;
+ }
+ return;
+ case ET_VEC:
+ case ET_VI:
+ rp = right->ex_vec;
+ while (j--) {
+ if (*cp++)
+ *op++ = *lp;
+ else
+ *op++ = *rp;
+ lp++; rp++;
+ }
+ return;
+ case ET_SYM:
+ default:
+ post_error((fts_object_t *) e,
+ "expr: FUNC_EVAL(%d): bad right type %ld\n",
+ __LINE__, right->ex_type);
+ return;
+ }
+ case ET_SYM:
+ default:
+ post_error((fts_object_t *) e,
+ "expr: FUNC_EVAL(%d): bad left type %ld\n",
+ __LINE__, left->ex_type);
+ return;
+ }
+ case ET_INT:
+ if (cond->ex_int)
+ res = left;
+ else
+ res = right;
+ break;
+ case ET_FLT:
+ if (cond->ex_flt)
+ res = left;
+ else
+ res = right;
+ break;
+ case ET_SYM:
+ default:
+ post_error((fts_object_t *) e,
+ "expr: FUNC_EVAL(%d): bad condition type %ld\n",
+ __LINE__, cond->ex_type);
+ return;
+ }
+ switch(res->ex_type) {
+ case ET_INT:
+ if (optr->ex_type == ET_VEC) {
+ ex_mkvector(optr->ex_vec, (float)res->ex_int,
+ e->exp_vsize);
+ return;
+ }
+ *optr = *res;
+ return;
+ case ET_FLT:
+ if (optr->ex_type == ET_VEC) {
+ ex_mkvector(optr->ex_vec, (float)res->ex_flt,
+ e->exp_vsize);
+ return;
+ }
+ *optr = *res;
+ return;
+ case ET_VEC:
+ case ET_VI:
+ if (optr->ex_type != ET_VEC) {
+ if (optr->ex_type == ET_VI) {
+ /* SDY remove this test */
+ post("expr~: Int. error %d", __LINE__);
+ return;
+ }
+ optr->ex_type = ET_VEC;
+ optr->ex_vec = (t_float *)
+ fts_malloc(sizeof (t_float) * e->exp_vsize);
+ }
+ memcpy(optr->ex_vec, res->ex_vec, e->exp_vsize*sizeof(t_float));
+ return;
+ case ET_SYM:
+ default:
+ post_error((fts_object_t *) e,
+ "expr: FUNC_EVAL(%d): bad res type %ld\n",
+ __LINE__, res->ex_type);
+ return;
+ }
+
}
/*
- * ex_imodf - extract signed integral value from floating-point number
+ * ex_imodf - extract signed integral value from floating-point number
*/
static double
imodf(double x)
{
- double xx;
+ double xx;
- modf(x, &xx);
- return (xx);
+ modf(x, &xx);
+ return (xx);
}
FUNC_DEF_UNARY(ex_imodf, imodf, (double), 1);
@@ -1228,9 +1228,9 @@ FUNC_DEF_UNARY(ex_imodf, imodf, (double), 1);
static double
fracmodf(double x)
{
- double xx;
+ double xx;
- return(modf(x, &xx));
+ return(modf(x, &xx));
}
FUNC_DEF_UNARY(ex_modf, fracmodf, (double), 1);
diff --git a/pd/extra/expr~/vexp_if.c b/pd/extra/expr~/vexp_if.c
index b183b620..08dc55c3 100644
--- a/pd/extra/expr~/vexp_if.c
+++ b/pd/extra/expr~/vexp_if.c
@@ -30,8 +30,8 @@
/*
* Feb 2002 - added access to variables
* multiple expression support
- * new short hand forms for fexpr~
- * now $y or $y1 = $y1[-1] and $y2 = $y2[-1]
+ * new short hand forms for fexpr~
+ * now $y or $y1 = $y1[-1] and $y2 = $y2[-1]
* --sdy
*/
@@ -44,7 +44,7 @@
static char *exp_version = "0.4";
extern struct ex_ex *ex_eval(struct expr *expr, struct ex_ex *eptr,
- struct ex_ex *optr, int n);
+ struct ex_ex *optr, int n);
#ifdef PD
static t_class *expr_class;
@@ -68,51 +68,51 @@ t_int *expr_perform(t_int *w);
static void
expr_list(t_expr *x, t_symbol *s, int argc, const fts_atom_t *argv)
{
- int i;
-
- if (argc > MAX_VARS) argc = MAX_VARS;
-
- for (i = 0; i < argc; i++)
- {
- if (argv[i].a_type == A_FLOAT)
- {
- if (x->exp_var[i].ex_type == ET_FI)
- x->exp_var[i].ex_flt = argv[i].a_w.w_float;
- else if (x->exp_var[i].ex_type == ET_II)
- x->exp_var[i].ex_int = argv[i].a_w.w_float;
- else if (x->exp_var[i].ex_type)
- pd_error(x, "expr: type mismatch");
- }
- else if (argv[i].a_type == A_SYMBOL)
- {
- if (x->exp_var[i].ex_type == ET_SI)
- x->exp_var[i].ex_ptr = (char *)argv[i].a_w.w_symbol;
- else if (x->exp_var[i].ex_type)
- pd_error(x, "expr: type mismatch");
- }
- }
- expr_bang(x);
+ int i;
+
+ if (argc > MAX_VARS) argc = MAX_VARS;
+
+ for (i = 0; i < argc; i++)
+ {
+ if (argv[i].a_type == A_FLOAT)
+ {
+ if (x->exp_var[i].ex_type == ET_FI)
+ x->exp_var[i].ex_flt = argv[i].a_w.w_float;
+ else if (x->exp_var[i].ex_type == ET_II)
+ x->exp_var[i].ex_int = argv[i].a_w.w_float;
+ else if (x->exp_var[i].ex_type)
+ pd_error(x, "expr: type mismatch");
+ }
+ else if (argv[i].a_type == A_SYMBOL)
+ {
+ if (x->exp_var[i].ex_type == ET_SI)
+ x->exp_var[i].ex_ptr = (char *)argv[i].a_w.w_symbol;
+ else if (x->exp_var[i].ex_type)
+ pd_error(x, "expr: type mismatch");
+ }
+ }
+ expr_bang(x);
}
static void
expr_flt(t_expr *x, t_float f, int in)
{
- if (in > MAX_VARS)
- return;
+ if (in > MAX_VARS)
+ return;
- if (x->exp_var[in].ex_type == ET_FI)
- x->exp_var[in].ex_flt = f;
- else if (x->exp_var[in].ex_type == ET_II)
- x->exp_var[in].ex_int = f;
+ if (x->exp_var[in].ex_type == ET_FI)
+ x->exp_var[in].ex_flt = f;
+ else if (x->exp_var[in].ex_type == ET_II)
+ x->exp_var[in].ex_int = f;
}
static t_class *exprproxy_class;
typedef struct _exprproxy {
- t_pd p_pd;
- int p_index;
- t_expr *p_owner;
- struct _exprproxy *p_next;
+ t_pd p_pd;
+ int p_index;
+ t_expr *p_owner;
+ struct _exprproxy *p_next;
} t_exprproxy;
t_exprproxy *exprproxy_new(t_expr *owner, int indx);
@@ -121,63 +121,63 @@ void exprproxy_float(t_exprproxy *p, t_floatarg f);
t_exprproxy *
exprproxy_new(t_expr *owner, int indx)
{
- t_exprproxy *x = (t_exprproxy *)pd_new(exprproxy_class);
- x->p_owner = owner;
- x->p_index = indx;
- x->p_next = owner->exp_proxy;
- owner->exp_proxy = x;
- return (x);
+ t_exprproxy *x = (t_exprproxy *)pd_new(exprproxy_class);
+ x->p_owner = owner;
+ x->p_index = indx;
+ x->p_next = owner->exp_proxy;
+ owner->exp_proxy = x;
+ return (x);
}
void
exprproxy_float(t_exprproxy *p, t_floatarg f)
{
- t_expr *x = p->p_owner;
- int in = p->p_index;
+ t_expr *x = p->p_owner;
+ int in = p->p_index;
- if (in > MAX_VARS)
- return;
+ if (in > MAX_VARS)
+ return;
- if (x->exp_var[in].ex_type == ET_FI)
- x->exp_var[in].ex_flt = f;
- else if (x->exp_var[in].ex_type == ET_II)
- x->exp_var[in].ex_int = f;
+ if (x->exp_var[in].ex_type == ET_FI)
+ x->exp_var[in].ex_flt = f;
+ else if (x->exp_var[in].ex_type == ET_II)
+ x->exp_var[in].ex_int = f;
}
/* method definitions */
static void
expr_ff(t_expr *x)
{
- t_exprproxy *y;
- int i;
-
- y = x->exp_proxy;
- while (y)
- {
- x->exp_proxy = y->p_next;
+ t_exprproxy *y;
+ int i;
+
+ y = x->exp_proxy;
+ while (y)
+ {
+ x->exp_proxy = y->p_next;
#ifdef PD
- pd_free(&y->p_pd);
+ pd_free(&y->p_pd);
#else /*MSP */
- /* SDY find out what needs to be called for MSP */
+ /* SDY find out what needs to be called for MSP */
#endif
- y = x->exp_proxy;
- }
- for (i = 0 ; i < x->exp_nexpr; i++);
- if (x->exp_stack[i])
- fts_free(x->exp_stack[i]);
+ y = x->exp_proxy;
+ }
+ for (i = 0 ; i < x->exp_nexpr; i++);
+ if (x->exp_stack[i])
+ fts_free(x->exp_stack[i]);
/*
* SDY free all the allocated buffers here for expr~ and fexpr~
* check to see if there are others
*/
- for (i = 0; i < MAX_VARS; i++) {
- if (x->exp_p_var[i])
- fts_free(x->exp_p_var[i]);
- if (x->exp_p_res[i])
- fts_free(x->exp_p_res[i]);
- if (x->exp_tmpres[i])
- fts_free(x->exp_tmpres[i]);
- }
+ for (i = 0; i < MAX_VARS; i++) {
+ if (x->exp_p_var[i])
+ fts_free(x->exp_p_var[i]);
+ if (x->exp_p_res[i])
+ fts_free(x->exp_p_res[i]);
+ if (x->exp_tmpres[i])
+ fts_free(x->exp_tmpres[i]);
+ }
}
@@ -185,61 +185,61 @@ expr_ff(t_expr *x)
static void
expr_bang(t_expr *x)
{
- int i;
+ int i;
#ifdef EXPR_DEBUG
- {
- struct ex_ex *eptr;
-
- for (i = 0, eptr = x->exp_var; ; eptr++, i++)
- {
- if (!eptr->ex_type)
- break;
- switch (eptr->ex_type)
- {
- case ET_II:
- fprintf(stderr,"ET_II: %d \n", eptr->ex_int);
- break;
-
- case ET_FI:
- fprintf(stderr,"ET_FT: %f \n", eptr->ex_flt);
- break;
-
- default:
- fprintf(stderr,"oups\n");
- }
- }
- }
+ {
+ struct ex_ex *eptr;
+
+ for (i = 0, eptr = x->exp_var; ; eptr++, i++)
+ {
+ if (!eptr->ex_type)
+ break;
+ switch (eptr->ex_type)
+ {
+ case ET_II:
+ fprintf(stderr,"ET_II: %d \n", eptr->ex_int);
+ break;
+
+ case ET_FI:
+ fprintf(stderr,"ET_FT: %f \n", eptr->ex_flt);
+ break;
+
+ default:
+ fprintf(stderr,"oups\n");
+ }
+ }
+ }
#endif
- /* banging a signal or filter object means nothing */
- if (!IS_EXPR(x))
- return;
-
- for (i = x->exp_nexpr - 1; i > -1 ; i--) {
- if (!ex_eval(x, x->exp_stack[i], &x->exp_res[i], 0)) {
- /*fprintf(stderr,"expr_bang(error evaluation)\n"); */
- /* SDY now that we have mutiple ones, on error we should
- * continue
- return;
- */
- }
- switch(x->exp_res[i].ex_type) {
- case ET_INT:
- outlet_float(x->exp_outlet[i],
- (t_float) x->exp_res[i].ex_int);
- break;
-
- case ET_FLT:
- outlet_float(x->exp_outlet[i], x->exp_res[i].ex_flt);
- break;
-
- case ET_SYM:
- /* CHANGE this will have to be taken care of */
-
- default:
- post("expr: bang: unrecognized result %ld\n", x->exp_res[i].ex_type);
- }
- }
+ /* banging a signal or filter object means nothing */
+ if (!IS_EXPR(x))
+ return;
+
+ for (i = x->exp_nexpr - 1; i > -1 ; i--) {
+ if (!ex_eval(x, x->exp_stack[i], &x->exp_res[i], 0)) {
+ /*fprintf(stderr,"expr_bang(error evaluation)\n"); */
+ /* SDY now that we have mutiple ones, on error we should
+ * continue
+ return;
+ */
+ }
+ switch(x->exp_res[i].ex_type) {
+ case ET_INT:
+ outlet_float(x->exp_outlet[i],
+ (t_float) x->exp_res[i].ex_int);
+ break;
+
+ case ET_FLT:
+ outlet_float(x->exp_outlet[i], x->exp_res[i].ex_flt);
+ break;
+
+ case ET_SYM:
+ /* CHANGE this will have to be taken care of */
+
+ default:
+ post("expr: bang: unrecognized result %ld\n", x->exp_res[i].ex_type);
+ }
+ }
}
static t_expr *
@@ -249,320 +249,320 @@ expr_new(t_symbol *s, int ac, t_atom *av)
Nexpr_new(t_symbol *s, int ac, t_atom *av)
#endif
{
- struct expr *x;
- int i, ninlet;
- struct ex_ex *eptr;
- t_atom fakearg;
- int dsp_index; /* keeping track of the dsp inlets */
+ struct expr *x;
+ int i, ninlet;
+ struct ex_ex *eptr;
+ t_atom fakearg;
+ int dsp_index; /* keeping track of the dsp inlets */
/*
* SDY - we may need to call dsp_setup() in this function
*/
- if (!ac)
- {
- ac = 1;
- av = &fakearg;
- SETFLOAT(&fakearg, 0);
- }
+ if (!ac)
+ {
+ ac = 1;
+ av = &fakearg;
+ SETFLOAT(&fakearg, 0);
+ }
#ifdef PD
- /*
- * figure out if we are expr, expr~, or fexpr~
- */
- if (!strcmp("expr", s->s_name)) {
- x = (t_expr *)pd_new(expr_class);
- SET_EXPR(x);
- } else if (!strcmp("expr~", s->s_name)) {
- x = (t_expr *)pd_new(expr_tilde_class);
- SET_EXPR_TILDE(x);
- } else if (!strcmp("fexpr~", s->s_name)) {
- x = (t_expr *)pd_new(fexpr_tilde_class);
- SET_FEXPR_TILDE(x);
- } else {
- post("expr_new: bad object name '%s'");
- /* assume expr */
- x = (t_expr *)pd_new(expr_class);
- SET_EXPR(x);
- }
+ /*
+ * figure out if we are expr, expr~, or fexpr~
+ */
+ if (!strcmp("expr", s->s_name)) {
+ x = (t_expr *)pd_new(expr_class);
+ SET_EXPR(x);
+ } else if (!strcmp("expr~", s->s_name)) {
+ x = (t_expr *)pd_new(expr_tilde_class);
+ SET_EXPR_TILDE(x);
+ } else if (!strcmp("fexpr~", s->s_name)) {
+ x = (t_expr *)pd_new(fexpr_tilde_class);
+ SET_FEXPR_TILDE(x);
+ } else {
+ post("expr_new: bad object name '%s'");
+ /* assume expr */
+ x = (t_expr *)pd_new(expr_class);
+ SET_EXPR(x);
+ }
#else /* MSP */
- /* for now assume an expr~ */
- x = (t_expr *)pd_new(expr_tilde_class);
- SET_EXPR_TILDE(x);
-#endif
-
- /*
- * initialize the newly allocated object
- */
- x->exp_proxy = 0;
- x->exp_nivec = 0;
- x->exp_nexpr = 0;
- x->exp_error = 0;
- for (i = 0; i < MAX_VARS; i++) {
- x->exp_stack[i] = (struct ex_ex *)0;
- x->exp_outlet[i] = (t_outlet *)0;
- x->exp_res[i].ex_type = 0;
- x->exp_res[i].ex_int = 0;
- x->exp_p_res[i] = (t_float *)0;
- x->exp_var[i].ex_type = 0;
- x->exp_var[i].ex_int = 0;
- x->exp_p_var[i] = (t_float *)0;
- x->exp_tmpres[i] = (t_float *)0;
- x->exp_vsize = 0;
- }
- x->exp_f = 0; /* save the control value to be transformed to signal */
-
-
- if (expr_donew(x, ac, av))
- {
- pd_error(x, "expr: syntax error");
+ /* for now assume an expr~ */
+ x = (t_expr *)pd_new(expr_tilde_class);
+ SET_EXPR_TILDE(x);
+#endif
+
+ /*
+ * initialize the newly allocated object
+ */
+ x->exp_proxy = 0;
+ x->exp_nivec = 0;
+ x->exp_nexpr = 0;
+ x->exp_error = 0;
+ for (i = 0; i < MAX_VARS; i++) {
+ x->exp_stack[i] = (struct ex_ex *)0;
+ x->exp_outlet[i] = (t_outlet *)0;
+ x->exp_res[i].ex_type = 0;
+ x->exp_res[i].ex_int = 0;
+ x->exp_p_res[i] = (t_float *)0;
+ x->exp_var[i].ex_type = 0;
+ x->exp_var[i].ex_int = 0;
+ x->exp_p_var[i] = (t_float *)0;
+ x->exp_tmpres[i] = (t_float *)0;
+ x->exp_vsize = 0;
+ }
+ x->exp_f = 0; /* save the control value to be transformed to signal */
+
+
+ if (expr_donew(x, ac, av))
+ {
+ pd_error(x, "expr: syntax error");
/*
SDY the following coredumps why?
- pd_free(&x->exp_ob.ob_pd);
+ pd_free(&x->exp_ob.ob_pd);
*/
- return (0);
- }
-
- ninlet = 1;
- for (i = 0, eptr = x->exp_var; i < MAX_VARS ; i++, eptr++)
- if (eptr->ex_type) {
- ninlet = i + 1;
- }
-
- /*
- * create the new inlets
- */
- for (i = 1, eptr = x->exp_var + 1, dsp_index=1; i<ninlet ; i++, eptr++)
- {
- t_exprproxy *p;
- switch (eptr->ex_type)
- {
- case 0:
- /* nothing is using this inlet */
- if (i < ninlet)
+ return (0);
+ }
+
+ ninlet = 1;
+ for (i = 0, eptr = x->exp_var; i < MAX_VARS ; i++, eptr++)
+ if (eptr->ex_type) {
+ ninlet = i + 1;
+ }
+
+ /*
+ * create the new inlets
+ */
+ for (i = 1, eptr = x->exp_var + 1, dsp_index=1; i<ninlet ; i++, eptr++)
+ {
+ t_exprproxy *p;
+ switch (eptr->ex_type)
+ {
+ case 0:
+ /* nothing is using this inlet */
+ if (i < ninlet)
#ifdef PD
- floatinlet_new(&x->exp_ob, &eptr->ex_flt);
+ floatinlet_new(&x->exp_ob, &eptr->ex_flt);
#else /* MSP */
- inlet_new(&x->exp_ob, "float");
+ inlet_new(&x->exp_ob, "float");
#endif
- break;
+ break;
- case ET_II:
- case ET_FI:
- p = exprproxy_new(x, i);
+ case ET_II:
+ case ET_FI:
+ p = exprproxy_new(x, i);
#ifdef PD
- inlet_new(&x->exp_ob, &p->p_pd, &s_float, &s_float);
+ inlet_new(&x->exp_ob, &p->p_pd, &s_float, &s_float);
#else /* MSP */
- inlet_new(&x->exp_ob, "float");
+ inlet_new(&x->exp_ob, "float");
#endif
- break;
+ break;
- case ET_SI:
+ case ET_SI:
#ifdef PD
- symbolinlet_new(&x->exp_ob, (t_symbol **)&eptr->ex_ptr);
+ symbolinlet_new(&x->exp_ob, (t_symbol **)&eptr->ex_ptr);
#else /* MSP */
- inlet_new(&x->exp_ob, "symbol");
+ inlet_new(&x->exp_ob, "symbol");
#endif
- break;
+ break;
- case ET_XI:
- case ET_VI:
- if (!IS_EXPR(x)) {
- dsp_index++;
+ case ET_XI:
+ case ET_VI:
+ if (!IS_EXPR(x)) {
+ dsp_index++;
#ifdef PD
- inlet_new(&x->exp_ob, &x->exp_ob.ob_pd,
- &s_signal, &s_signal);
+ inlet_new(&x->exp_ob, &x->exp_ob.ob_pd,
+ &s_signal, &s_signal);
#else /* MSP */
- inlet_new(&x->exp_ob, "signal");
+ inlet_new(&x->exp_ob, "signal");
#endif
- break;
- } else
- post("expr: internal error expr_new");
- default:
- pd_error(x, "expr: bad type (%lx) inlet = %d\n",
- eptr->ex_type, i + 1, 0, 0, 0);
- break;
- }
- }
- if (IS_EXPR(x)) {
- for (i = 0; i < x->exp_nexpr; i++)
- x->exp_outlet[i] = outlet_new(&x->exp_ob, 0);
- } else {
- for (i = 0; i < x->exp_nexpr; i++)
- x->exp_outlet[i] = outlet_new(&x->exp_ob,
- gensym("signal"));
- x->exp_nivec = dsp_index;
- }
- /*
- * for now assume a 64 sample size block but this may change once
- * expr_dsp is called
- */
- x->exp_vsize = 64;
- for (i = 0; i < x->exp_nexpr; i++) {
- x->exp_p_res[i] = fts_calloc(x->exp_vsize, sizeof (t_float));
- x->exp_tmpres[i] = fts_calloc(x->exp_vsize, sizeof (t_float));
- }
- for (i = 0; i < MAX_VARS; i++)
- x->exp_p_var[i] = fts_calloc(x->exp_vsize, sizeof (t_float));
-
- return (x);
+ break;
+ } else
+ post("expr: internal error expr_new");
+ default:
+ pd_error(x, "expr: bad type (%lx) inlet = %d\n",
+ eptr->ex_type, i + 1, 0, 0, 0);
+ break;
+ }
+ }
+ if (IS_EXPR(x)) {
+ for (i = 0; i < x->exp_nexpr; i++)
+ x->exp_outlet[i] = outlet_new(&x->exp_ob, 0);
+ } else {
+ for (i = 0; i < x->exp_nexpr; i++)
+ x->exp_outlet[i] = outlet_new(&x->exp_ob,
+ gensym("signal"));
+ x->exp_nivec = dsp_index;
+ }
+ /*
+ * for now assume a 64 sample size block but this may change once
+ * expr_dsp is called
+ */
+ x->exp_vsize = 64;
+ for (i = 0; i < x->exp_nexpr; i++) {
+ x->exp_p_res[i] = fts_calloc(x->exp_vsize, sizeof (t_float));
+ x->exp_tmpres[i] = fts_calloc(x->exp_vsize, sizeof (t_float));
+ }
+ for (i = 0; i < MAX_VARS; i++)
+ x->exp_p_var[i] = fts_calloc(x->exp_vsize, sizeof (t_float));
+
+ return (x);
}
t_int *
expr_perform(t_int *w)
{
- int i, j;
- t_expr *x = (t_expr *)w[1];
- struct ex_ex res;
- int n;
-
- /* sanity check */
- if (IS_EXPR(x)) {
- post("expr_perform: bad x->exp_flags = %d", x->exp_flags);
- abort();
- }
-
- if (x->exp_flags & EF_STOP) {
- for (i = 0; i < x->exp_nexpr; i++)
- memset(x->exp_res[i].ex_vec, 0,
- x->exp_vsize * sizeof (float));
- return (w + 2);
- }
-
- if (IS_EXPR_TILDE(x)) {
- /*
- * if we have only one expression, we can right on
- * on the output directly, otherwise we have to copy
- * the data because, outputs could be the same buffer as
- * inputs
- */
- if ( x->exp_nexpr == 1)
- ex_eval(x, x->exp_stack[0], &x->exp_res[0], 0);
- else {
- res.ex_type = ET_VEC;
- for (i = 0; i < x->exp_nexpr; i++) {
- res.ex_vec = x->exp_tmpres[i];
- ex_eval(x, x->exp_stack[i], &res, 0);
- }
- n = x->exp_vsize * sizeof(t_float);
- for (i = 0; i < x->exp_nexpr; i++)
- memcpy(x->exp_res[i].ex_vec, x->exp_tmpres[i],
- n);
- }
- return (w + 2);
- }
-
- if (!IS_FEXPR_TILDE(x)) {
- post("expr_perform: bad x->exp_flags = %d - expecting fexpr",
- x->exp_flags);
- return (w + 2);
- }
- /*
- * since the output buffer could be the same as one of the inputs
- * we need to keep the output in a different buffer
- */
- for (i = 0; i < x->exp_vsize; i++) for (j = 0; j < x->exp_nexpr; j++) {
- res.ex_type = 0;
- res.ex_int = 0;
- ex_eval(x, x->exp_stack[j], &res, i);
- switch (res.ex_type) {
- case ET_INT:
- x->exp_tmpres[j][i] = (t_float) res.ex_int;
- break;
- case ET_FLT:
- x->exp_tmpres[j][i] = res.ex_flt;
- break;
- default:
- post("expr_perform: bad result type %d", res.ex_type);
- }
- }
- /*
- * copy inputs and results to the save buffers
- * inputs need to be copied first as the output buffer can be
- * same as an input buffer
- */
- n = x->exp_vsize * sizeof(t_float);
- for (i = 0; i < MAX_VARS; i++)
- if (x->exp_var[i].ex_type == ET_XI)
- memcpy(x->exp_p_var[i], x->exp_var[i].ex_vec, n);
- for (i = 0; i < x->exp_nexpr; i++) {
- memcpy(x->exp_p_res[i], x->exp_tmpres[i], n);
- memcpy(x->exp_res[i].ex_vec, x->exp_tmpres[i], n);
- }
- return (w + 2);
+ int i, j;
+ t_expr *x = (t_expr *)w[1];
+ struct ex_ex res;
+ int n;
+
+ /* sanity check */
+ if (IS_EXPR(x)) {
+ post("expr_perform: bad x->exp_flags = %d", x->exp_flags);
+ abort();
+ }
+
+ if (x->exp_flags & EF_STOP) {
+ for (i = 0; i < x->exp_nexpr; i++)
+ memset(x->exp_res[i].ex_vec, 0,
+ x->exp_vsize * sizeof (float));
+ return (w + 2);
+ }
+
+ if (IS_EXPR_TILDE(x)) {
+ /*
+ * if we have only one expression, we can right on
+ * on the output directly, otherwise we have to copy
+ * the data because, outputs could be the same buffer as
+ * inputs
+ */
+ if ( x->exp_nexpr == 1)
+ ex_eval(x, x->exp_stack[0], &x->exp_res[0], 0);
+ else {
+ res.ex_type = ET_VEC;
+ for (i = 0; i < x->exp_nexpr; i++) {
+ res.ex_vec = x->exp_tmpres[i];
+ ex_eval(x, x->exp_stack[i], &res, 0);
+ }
+ n = x->exp_vsize * sizeof(t_float);
+ for (i = 0; i < x->exp_nexpr; i++)
+ memcpy(x->exp_res[i].ex_vec, x->exp_tmpres[i],
+ n);
+ }
+ return (w + 2);
+ }
+
+ if (!IS_FEXPR_TILDE(x)) {
+ post("expr_perform: bad x->exp_flags = %d - expecting fexpr",
+ x->exp_flags);
+ return (w + 2);
+ }
+ /*
+ * since the output buffer could be the same as one of the inputs
+ * we need to keep the output in a different buffer
+ */
+ for (i = 0; i < x->exp_vsize; i++) for (j = 0; j < x->exp_nexpr; j++) {
+ res.ex_type = 0;
+ res.ex_int = 0;
+ ex_eval(x, x->exp_stack[j], &res, i);
+ switch (res.ex_type) {
+ case ET_INT:
+ x->exp_tmpres[j][i] = (t_float) res.ex_int;
+ break;
+ case ET_FLT:
+ x->exp_tmpres[j][i] = res.ex_flt;
+ break;
+ default:
+ post("expr_perform: bad result type %d", res.ex_type);
+ }
+ }
+ /*
+ * copy inputs and results to the save buffers
+ * inputs need to be copied first as the output buffer can be
+ * same as an input buffer
+ */
+ n = x->exp_vsize * sizeof(t_float);
+ for (i = 0; i < MAX_VARS; i++)
+ if (x->exp_var[i].ex_type == ET_XI)
+ memcpy(x->exp_p_var[i], x->exp_var[i].ex_vec, n);
+ for (i = 0; i < x->exp_nexpr; i++) {
+ memcpy(x->exp_p_res[i], x->exp_tmpres[i], n);
+ memcpy(x->exp_res[i].ex_vec, x->exp_tmpres[i], n);
+ }
+ return (w + 2);
}
static void
expr_dsp(t_expr *x, t_signal **sp)
{
- int i, nv;
- int newsize;
-
- x->exp_error = 0; /* reset all errors */
- newsize = (x->exp_vsize != sp[0]->s_n);
- x->exp_vsize = sp[0]->s_n; /* record the vector size */
- for (i = 0; i < x->exp_nexpr; i++) {
- x->exp_res[i].ex_type = ET_VEC;
- x->exp_res[i].ex_vec = sp[x->exp_nivec + i]->s_vec;
- }
- for (i = 0, nv = 0; i < MAX_VARS; i++)
- /*
- * the first inlet is always a signal
- *
- * SDY We are warning the user till this limitation
- * is taken away from pd
- */
- if (!i || x->exp_var[i].ex_type == ET_VI ||
- x->exp_var[i].ex_type == ET_XI) {
- if (nv >= x->exp_nivec) {
- post("expr_dsp int. err nv = %d, x->exp_nive = %d",
- nv, x->exp_nivec);
- abort();
- }
- x->exp_var[i].ex_vec = sp[nv]->s_vec;
- nv++;
- }
- /* we always have one inlet but we may not use it */
- if (nv != x->exp_nivec && (nv != 0 || x->exp_nivec != 1)) {
- post("expr_dsp internal error 2 nv = %d, x->exp_nive = %d",
- nv, x->exp_nivec);
- abort();
- }
-
- dsp_add(expr_perform, 1, (t_int *) x);
-
- /*
- * The buffer are now being allocated for expr~ and fexpr~
- * because if we have more than one expression we need the
- * temporary buffers, The save buffers are not really needed
- if (!IS_FEXPR_TILDE(x))
- return;
- */
- /*
- * if we have already allocated the buffers and we have a
- * new size free all the buffers
- */
- if (x->exp_p_res[0]) {
- if (!newsize)
- return;
- /*
- * if new size, reallocate all the previous buffers for fexpr~
- */
- for (i = 0; i < x->exp_nexpr; i++) {
- fts_free(x->exp_p_res[i]);
- fts_free(x->exp_tmpres[i]);
- }
- for (i = 0; i < MAX_VARS; i++)
- fts_free(x->exp_p_var[i]);
-
- }
- for (i = 0; i < x->exp_nexpr; i++) {
- x->exp_p_res[i] = fts_calloc(x->exp_vsize, sizeof (t_float));
- x->exp_tmpres[i] = fts_calloc(x->exp_vsize, sizeof (t_float));
- }
- for (i = 0; i < MAX_VARS; i++)
- x->exp_p_var[i] = fts_calloc(x->exp_vsize, sizeof (t_float));
+ int i, nv;
+ int newsize;
+
+ x->exp_error = 0; /* reset all errors */
+ newsize = (x->exp_vsize != sp[0]->s_n);
+ x->exp_vsize = sp[0]->s_n; /* record the vector size */
+ for (i = 0; i < x->exp_nexpr; i++) {
+ x->exp_res[i].ex_type = ET_VEC;
+ x->exp_res[i].ex_vec = sp[x->exp_nivec + i]->s_vec;
+ }
+ for (i = 0, nv = 0; i < MAX_VARS; i++)
+ /*
+ * the first inlet is always a signal
+ *
+ * SDY We are warning the user till this limitation
+ * is taken away from pd
+ */
+ if (!i || x->exp_var[i].ex_type == ET_VI ||
+ x->exp_var[i].ex_type == ET_XI) {
+ if (nv >= x->exp_nivec) {
+ post("expr_dsp int. err nv = %d, x->exp_nive = %d",
+ nv, x->exp_nivec);
+ abort();
+ }
+ x->exp_var[i].ex_vec = sp[nv]->s_vec;
+ nv++;
+ }
+ /* we always have one inlet but we may not use it */
+ if (nv != x->exp_nivec && (nv != 0 || x->exp_nivec != 1)) {
+ post("expr_dsp internal error 2 nv = %d, x->exp_nive = %d",
+ nv, x->exp_nivec);
+ abort();
+ }
+
+ dsp_add(expr_perform, 1, (t_int *) x);
+
+ /*
+ * The buffer are now being allocated for expr~ and fexpr~
+ * because if we have more than one expression we need the
+ * temporary buffers, The save buffers are not really needed
+ if (!IS_FEXPR_TILDE(x))
+ return;
+ */
+ /*
+ * if we have already allocated the buffers and we have a
+ * new size free all the buffers
+ */
+ if (x->exp_p_res[0]) {
+ if (!newsize)
+ return;
+ /*
+ * if new size, reallocate all the previous buffers for fexpr~
+ */
+ for (i = 0; i < x->exp_nexpr; i++) {
+ fts_free(x->exp_p_res[i]);
+ fts_free(x->exp_tmpres[i]);
+ }
+ for (i = 0; i < MAX_VARS; i++)
+ fts_free(x->exp_p_var[i]);
+
+ }
+ for (i = 0; i < x->exp_nexpr; i++) {
+ x->exp_p_res[i] = fts_calloc(x->exp_vsize, sizeof (t_float));
+ x->exp_tmpres[i] = fts_calloc(x->exp_vsize, sizeof (t_float));
+ }
+ for (i = 0; i < MAX_VARS; i++)
+ x->exp_p_var[i] = fts_calloc(x->exp_vsize, sizeof (t_float));
}
/*
@@ -571,13 +571,13 @@ expr_dsp(t_expr *x, t_signal **sp)
static void
expr_verbose(t_expr *x)
{
- if (x->exp_flags & EF_VERBOSE) {
- x->exp_flags &= ~EF_VERBOSE;
- post ("verbose off");
- } else {
- x->exp_flags |= EF_VERBOSE;
- post ("verbose on");
- }
+ if (x->exp_flags & EF_VERBOSE) {
+ x->exp_flags &= ~EF_VERBOSE;
+ post ("verbose off");
+ } else {
+ x->exp_flags |= EF_VERBOSE;
+ post ("verbose on");
+ }
}
/*
@@ -586,7 +586,7 @@ expr_verbose(t_expr *x)
static void
expr_start(t_expr *x)
{
- x->exp_flags &= ~EF_STOP;
+ x->exp_flags &= ~EF_STOP;
}
/*
@@ -595,120 +595,120 @@ expr_start(t_expr *x)
static void
expr_stop(t_expr *x)
{
- x->exp_flags |= EF_STOP;
+ x->exp_flags |= EF_STOP;
}
static void
fexpr_set_usage(void)
{
- post("fexpr~: set val ...");
- post("fexpr~: set {xy}[#] val ...");
+ post("fexpr~: set val ...");
+ post("fexpr~: set {xy}[#] val ...");
}
/*
* fexpr_tilde_set -- set previous values of the buffers
- * set val val ... - sets the first elements of output buffers
- * set x val ... - sets the elements of the first input buffer
- * set x# val ... - sets the elements of the #th input buffers
- * set y val ... - sets the elements of the first output buffer
- * set y# val ... - sets the elements of the #th output buffers
+ * set val val ... - sets the first elements of output buffers
+ * set x val ... - sets the elements of the first input buffer
+ * set x# val ... - sets the elements of the #th input buffers
+ * set y val ... - sets the elements of the first output buffer
+ * set y# val ... - sets the elements of the #th output buffers
*/
static void
fexpr_tilde_set(t_expr *x, t_symbol *s, int argc, t_atom *argv)
{
- t_symbol *sx;
- int vecno;
- int i, nargs;
-
- if (!argc)
- return;
- sx = atom_getsymbolarg(0, argc, argv);
- switch(sx->s_name[0]) {
- case 'x':
- if (!sx->s_name[1])
- vecno = 0;
- else {
- vecno = atoi(sx->s_name + 1);
- if (!vecno) {
- post("fexpr~.set: bad set x vector number");
- fexpr_set_usage();
- return;
- }
- if (vecno >= MAX_VARS) {
- post("fexpr~.set: no more than %d inlets",
- MAX_VARS);
- return;
- }
- vecno--;
- }
- if (x->exp_var[vecno].ex_type != ET_XI) {
- post("fexpr~-set: no signal at inlet %d", vecno + 1);
- return;
- }
- nargs = argc - 1;
- if (!nargs) {
- post("fexpr~-set: no argument to set");
- return;
- }
- if (nargs > x->exp_vsize) {
- post("fexpr~.set: %d set values larger than vector size(%d)",
- nargs, x->exp_vsize);
- post("fexpr~.set: only the first %d values will be set",
- x->exp_vsize);
- nargs = x->exp_vsize;
- }
- for (i = 0; i < nargs; i++) {
- x->exp_p_var[vecno][x->exp_vsize - i - 1] =
- atom_getfloatarg(i + 1, argc, argv);
- }
- return;
- case 'y':
- if (!sx->s_name[1])
- vecno = 0;
- else {
- vecno = atoi(sx->s_name + 1);
- if (!vecno) {
- post("fexpr~.set: bad set y vector number");
- fexpr_set_usage();
- return;
- }
- vecno--;
- }
- if (vecno >= x->exp_nexpr) {
- post("fexpr~.set: only %d outlets", x->exp_nexpr);
- return;
- }
- nargs = argc - 1;
- if (!nargs) {
- post("fexpr~-set: no argument to set");
- return;
- }
- if (nargs > x->exp_vsize) {
- post("fexpr~-set: %d set values larger than vector size(%d)",
- nargs, x->exp_vsize);
- post("fexpr~.set: only the first %d values will be set",
- x->exp_vsize);
- nargs = x->exp_vsize;
- }
- for (i = 0; i < nargs; i++) {
- x->exp_p_res[vecno][x->exp_vsize - i - 1] =
- atom_getfloatarg(i + 1, argc, argv);
- }
- return;
- case 0:
- if (argc > x->exp_nexpr) {
- post("fexpr~.set: only %d outlets available",
- x->exp_nexpr);
- post("fexpr~.set: the extra set values are ignored");
- }
- for (i = 0; i < x->exp_nexpr && i < argc; i++)
- x->exp_p_res[i][x->exp_vsize - 1] =
- atom_getfloatarg(i, argc, argv);
- return;
- default:
- fexpr_set_usage();
- return;
- }
- return;
+ t_symbol *sx;
+ int vecno;
+ int i, nargs;
+
+ if (!argc)
+ return;
+ sx = atom_getsymbolarg(0, argc, argv);
+ switch(sx->s_name[0]) {
+ case 'x':
+ if (!sx->s_name[1])
+ vecno = 0;
+ else {
+ vecno = atoi(sx->s_name + 1);
+ if (!vecno) {
+ post("fexpr~.set: bad set x vector number");
+ fexpr_set_usage();
+ return;
+ }
+ if (vecno >= MAX_VARS) {
+ post("fexpr~.set: no more than %d inlets",
+ MAX_VARS);
+ return;
+ }
+ vecno--;
+ }
+ if (x->exp_var[vecno].ex_type != ET_XI) {
+ post("fexpr~-set: no signal at inlet %d", vecno + 1);
+ return;
+ }
+ nargs = argc - 1;
+ if (!nargs) {
+ post("fexpr~-set: no argument to set");
+ return;
+ }
+ if (nargs > x->exp_vsize) {
+ post("fexpr~.set: %d set values larger than vector size(%d)",
+ nargs, x->exp_vsize);
+ post("fexpr~.set: only the first %d values will be set",
+ x->exp_vsize);
+ nargs = x->exp_vsize;
+ }
+ for (i = 0; i < nargs; i++) {
+ x->exp_p_var[vecno][x->exp_vsize - i - 1] =
+ atom_getfloatarg(i + 1, argc, argv);
+ }
+ return;
+ case 'y':
+ if (!sx->s_name[1])
+ vecno = 0;
+ else {
+ vecno = atoi(sx->s_name + 1);
+ if (!vecno) {
+ post("fexpr~.set: bad set y vector number");
+ fexpr_set_usage();
+ return;
+ }
+ vecno--;
+ }
+ if (vecno >= x->exp_nexpr) {
+ post("fexpr~.set: only %d outlets", x->exp_nexpr);
+ return;
+ }
+ nargs = argc - 1;
+ if (!nargs) {
+ post("fexpr~-set: no argument to set");
+ return;
+ }
+ if (nargs > x->exp_vsize) {
+ post("fexpr~-set: %d set values larger than vector size(%d)",
+ nargs, x->exp_vsize);
+ post("fexpr~.set: only the first %d values will be set",
+ x->exp_vsize);
+ nargs = x->exp_vsize;
+ }
+ for (i = 0; i < nargs; i++) {
+ x->exp_p_res[vecno][x->exp_vsize - i - 1] =
+ atom_getfloatarg(i + 1, argc, argv);
+ }
+ return;
+ case 0:
+ if (argc > x->exp_nexpr) {
+ post("fexpr~.set: only %d outlets available",
+ x->exp_nexpr);
+ post("fexpr~.set: the extra set values are ignored");
+ }
+ for (i = 0; i < x->exp_nexpr && i < argc; i++)
+ x->exp_p_res[i][x->exp_vsize - 1] =
+ atom_getfloatarg(i, argc, argv);
+ return;
+ default:
+ fexpr_set_usage();
+ return;
+ }
+ return;
}
/*
@@ -717,74 +717,74 @@ fexpr_tilde_set(t_expr *x, t_symbol *s, int argc, t_atom *argv)
static void
fexpr_tilde_clear(t_expr *x, t_symbol *s, int argc, t_atom *argv)
{
- t_symbol *sx;
- int vecno;
- int i, nargs;
-
- /*
- * if no arguement clear all input and output buffers
- */
- if (!argc) {
- for (i = 0; i < x->exp_nexpr; i++)
- memset(x->exp_p_res[i], 0, x->exp_vsize*sizeof(float));
- for (i = 0; i < MAX_VARS; i++)
- if (x->exp_var[i].ex_type == ET_XI)
- memset(x->exp_p_var[i], 0,
- x->exp_vsize*sizeof(float));
- return;
- }
- if (argc > 1) {
- post("fexpr~ usage: 'clear' or 'clear {xy}[#]'");
- return;
- }
-
- sx = atom_getsymbolarg(0, argc, argv);
- switch(sx->s_name[0]) {
- case 'x':
- if (!sx->s_name[1])
- vecno = 0;
- else {
- vecno = atoi(sx->s_name + 1);
- if (!vecno) {
- post("fexpr~.clear: bad clear x vector number");
- return;
- }
- if (vecno >= MAX_VARS) {
- post("fexpr~.clear: no more than %d inlets",
- MAX_VARS);
- return;
- }
- vecno--;
- }
- if (x->exp_var[vecno].ex_type != ET_XI) {
- post("fexpr~-clear: no signal at inlet %d", vecno + 1);
- return;
- }
- memset(x->exp_p_var[vecno], 0, x->exp_vsize*sizeof(float));
- return;
- case 'y':
- if (!sx->s_name[1])
- vecno = 0;
- else {
- vecno = atoi(sx->s_name + 1);
- if (!vecno) {
- post("fexpr~.clear: bad clear y vector number");
- return;
- }
- vecno--;
- }
- if (vecno >= x->exp_nexpr) {
- post("fexpr~.clear: only %d outlets", x->exp_nexpr);
- return;
- }
- memset(x->exp_p_res[vecno], 0, x->exp_vsize*sizeof(float));
- return;
- return;
- default:
- post("fexpr~ usage: 'clear' or 'clear {xy}[#]'");
- return;
- }
- return;
+ t_symbol *sx;
+ int vecno;
+ int i, nargs;
+
+ /*
+ * if no arguement clear all input and output buffers
+ */
+ if (!argc) {
+ for (i = 0; i < x->exp_nexpr; i++)
+ memset(x->exp_p_res[i], 0, x->exp_vsize*sizeof(float));
+ for (i = 0; i < MAX_VARS; i++)
+ if (x->exp_var[i].ex_type == ET_XI)
+ memset(x->exp_p_var[i], 0,
+ x->exp_vsize*sizeof(float));
+ return;
+ }
+ if (argc > 1) {
+ post("fexpr~ usage: 'clear' or 'clear {xy}[#]'");
+ return;
+ }
+
+ sx = atom_getsymbolarg(0, argc, argv);
+ switch(sx->s_name[0]) {
+ case 'x':
+ if (!sx->s_name[1])
+ vecno = 0;
+ else {
+ vecno = atoi(sx->s_name + 1);
+ if (!vecno) {
+ post("fexpr~.clear: bad clear x vector number");
+ return;
+ }
+ if (vecno >= MAX_VARS) {
+ post("fexpr~.clear: no more than %d inlets",
+ MAX_VARS);
+ return;
+ }
+ vecno--;
+ }
+ if (x->exp_var[vecno].ex_type != ET_XI) {
+ post("fexpr~-clear: no signal at inlet %d", vecno + 1);
+ return;
+ }
+ memset(x->exp_p_var[vecno], 0, x->exp_vsize*sizeof(float));
+ return;
+ case 'y':
+ if (!sx->s_name[1])
+ vecno = 0;
+ else {
+ vecno = atoi(sx->s_name + 1);
+ if (!vecno) {
+ post("fexpr~.clear: bad clear y vector number");
+ return;
+ }
+ vecno--;
+ }
+ if (vecno >= x->exp_nexpr) {
+ post("fexpr~.clear: only %d outlets", x->exp_nexpr);
+ return;
+ }
+ memset(x->exp_p_res[vecno], 0, x->exp_vsize*sizeof(float));
+ return;
+ return;
+ default:
+ post("fexpr~ usage: 'clear' or 'clear {xy}[#]'");
+ return;
+ }
+ return;
}
#ifdef PD
@@ -792,68 +792,68 @@ fexpr_tilde_clear(t_expr *x, t_symbol *s, int argc, t_atom *argv)
void
expr_setup(void)
{
- /*
- * expr initialization
- */
- expr_class = class_new(gensym("expr"), (t_newmethod)expr_new,
- (t_method)expr_ff, sizeof(t_expr), 0, A_GIMME, 0);
- class_addlist(expr_class, expr_list);
- exprproxy_class = class_new(gensym("exprproxy"), 0,
- 0, sizeof(t_exprproxy), CLASS_PD, 0);
- class_addfloat(exprproxy_class, exprproxy_float);
-
- /*
- * expr~ initialization
- */
- expr_tilde_class = class_new(gensym("expr~"), (t_newmethod)expr_new,
- (t_method)expr_ff, sizeof(t_expr), 0, A_GIMME, 0);
- class_addmethod(expr_tilde_class, nullfn, gensym("signal"), 0);
- CLASS_MAINSIGNALIN(expr_tilde_class, t_expr, exp_f);
- class_addmethod(expr_tilde_class,(t_method)expr_dsp, gensym("dsp"), 0);
- class_sethelpsymbol(expr_tilde_class, gensym("expr"));
- /*
- * fexpr~ initialization
- */
- fexpr_tilde_class = class_new(gensym("fexpr~"), (t_newmethod)expr_new,
- (t_method)expr_ff, sizeof(t_expr), 0, A_GIMME, 0);
- class_addmethod(fexpr_tilde_class, nullfn, gensym("signal"), 0);
- class_addmethod(fexpr_tilde_class,(t_method)expr_start,
- gensym("start"), 0);
- class_addmethod(fexpr_tilde_class,(t_method)expr_stop,
- gensym("stop"), 0);
-
- class_addmethod(fexpr_tilde_class,(t_method)expr_dsp,gensym("dsp"), 0);
- class_addmethod(fexpr_tilde_class, (t_method)fexpr_tilde_set,
- gensym("set"), A_GIMME, 0);
- class_addmethod(fexpr_tilde_class, (t_method)fexpr_tilde_clear,
- gensym("clear"), A_GIMME, 0);
- class_addmethod(fexpr_tilde_class,(t_method)expr_verbose,
- gensym("verbose"), 0);
- class_sethelpsymbol(fexpr_tilde_class, gensym("expr"));
-
-
-
- post("expr, expr~, fexpr~ version %s under GNU General Public License ", exp_version);
+ /*
+ * expr initialization
+ */
+ expr_class = class_new(gensym("expr"), (t_newmethod)expr_new,
+ (t_method)expr_ff, sizeof(t_expr), 0, A_GIMME, 0);
+ class_addlist(expr_class, expr_list);
+ exprproxy_class = class_new(gensym("exprproxy"), 0,
+ 0, sizeof(t_exprproxy), CLASS_PD, 0);
+ class_addfloat(exprproxy_class, exprproxy_float);
+
+ /*
+ * expr~ initialization
+ */
+ expr_tilde_class = class_new(gensym("expr~"), (t_newmethod)expr_new,
+ (t_method)expr_ff, sizeof(t_expr), 0, A_GIMME, 0);
+ class_addmethod(expr_tilde_class, nullfn, gensym("signal"), 0);
+ CLASS_MAINSIGNALIN(expr_tilde_class, t_expr, exp_f);
+ class_addmethod(expr_tilde_class,(t_method)expr_dsp, gensym("dsp"), 0);
+ class_sethelpsymbol(expr_tilde_class, gensym("expr"));
+ /*
+ * fexpr~ initialization
+ */
+ fexpr_tilde_class = class_new(gensym("fexpr~"), (t_newmethod)expr_new,
+ (t_method)expr_ff, sizeof(t_expr), 0, A_GIMME, 0);
+ class_addmethod(fexpr_tilde_class, nullfn, gensym("signal"), 0);
+ class_addmethod(fexpr_tilde_class,(t_method)expr_start,
+ gensym("start"), 0);
+ class_addmethod(fexpr_tilde_class,(t_method)expr_stop,
+ gensym("stop"), 0);
+
+ class_addmethod(fexpr_tilde_class,(t_method)expr_dsp,gensym("dsp"), 0);
+ class_addmethod(fexpr_tilde_class, (t_method)fexpr_tilde_set,
+ gensym("set"), A_GIMME, 0);
+ class_addmethod(fexpr_tilde_class, (t_method)fexpr_tilde_clear,
+ gensym("clear"), A_GIMME, 0);
+ class_addmethod(fexpr_tilde_class,(t_method)expr_verbose,
+ gensym("verbose"), 0);
+ class_sethelpsymbol(fexpr_tilde_class, gensym("expr"));
+
+
+
+ post("expr, expr~, fexpr~ version %s under GNU General Public License ", exp_version);
}
void
expr_tilde_setup(void)
{
- expr_setup();
+ expr_setup();
}
void
fexpr_tilde_setup(void)
{
- expr_setup();
+ expr_setup();
}
#else /* MSP */
void
main(void)
{
setup((t_messlist **)&expr_tilde_class, (method)Nexpr_new,
- (method)expr_ff, (short)sizeof(t_expr), 0L, A_GIMME, 0);
+ (method)expr_ff, (short)sizeof(t_expr), 0L, A_GIMME, 0);
addmess((method)expr_dsp, "dsp", A_CANT, 0); // dsp method
dsp_initclass();
}
@@ -866,21 +866,21 @@ main(void)
int
ex_getsym(char *p, fts_symbol_t *s)
{
- *s = gensym(p);
- return (0);
+ *s = gensym(p);
+ return (0);
}
const char *
ex_symname(fts_symbol_t s)
{
- return (fts_symbol_name(s));
+ return (fts_symbol_name(s));
}
/*
* max_ex_tab -- evaluate this table access
- * eptr is the name of the table and arg is the index we
- * have to put the result in optr
- * return 1 on error and 0 otherwise
+ * eptr is the name of the table and arg is the index we
+ * have to put the result in optr
+ * return 1 on error and 0 otherwise
*
* Arguments:
* the expr object
@@ -893,70 +893,70 @@ max_ex_tab(struct expr *expr, fts_symbol_t s, struct ex_ex *arg,
struct ex_ex *optr)
{
#ifdef PD
- t_garray *garray;
- int size, indx;
- t_float *vec;
-
- if (!s || !(garray = (t_garray *)pd_findbyclass(s, garray_class)) ||
- !garray_getfloatarray(garray, &size, &vec))
- {
- optr->ex_type = ET_FLT;
- optr->ex_flt = 0;
- pd_error(expr, "no such table '%s'", s->s_name);
- return (1);
- }
- optr->ex_type = ET_FLT;
-
- switch (arg->ex_type) {
- case ET_INT:
- indx = arg->ex_int;
- break;
- case ET_FLT:
- /* strange interpolation code deleted here -msp */
- indx = arg->ex_flt;
- break;
-
- default: /* do something with strings */
- pd_error(expr, "expr: bad argument for table '%s'\n", fts_symbol_name(s));
- indx = 0;
- }
- if (indx < 0) indx = 0;
- else if (indx >= size) indx = size - 1;
- optr->ex_flt = vec[indx];
+ t_garray *garray;
+ int size, indx;
+ t_float *vec;
+
+ if (!s || !(garray = (t_garray *)pd_findbyclass(s, garray_class)) ||
+ !garray_getfloatarray(garray, &size, &vec))
+ {
+ optr->ex_type = ET_FLT;
+ optr->ex_flt = 0;
+ pd_error(expr, "no such table '%s'", s->s_name);
+ return (1);
+ }
+ optr->ex_type = ET_FLT;
+
+ switch (arg->ex_type) {
+ case ET_INT:
+ indx = arg->ex_int;
+ break;
+ case ET_FLT:
+ /* strange interpolation code deleted here -msp */
+ indx = arg->ex_flt;
+ break;
+
+ default: /* do something with strings */
+ pd_error(expr, "expr: bad argument for table '%s'\n", fts_symbol_name(s));
+ indx = 0;
+ }
+ if (indx < 0) indx = 0;
+ else if (indx >= size) indx = size - 1;
+ optr->ex_flt = vec[indx];
#else /* MSP */
- /*
- * table lookup not done for MSP yet
- */
- post("max_ex_tab: not complete for MSP yet!");
- optr->ex_type = ET_FLT;
- optr->ex_flt = 0;
-#endif
- return (0);
+ /*
+ * table lookup not done for MSP yet
+ */
+ post("max_ex_tab: not complete for MSP yet!");
+ optr->ex_type = ET_FLT;
+ optr->ex_flt = 0;
+#endif
+ return (0);
}
int
max_ex_var(struct expr *expr, fts_symbol_t var, struct ex_ex *optr)
{
- optr->ex_type = ET_FLT;
- if (value_getfloat(var, &(optr->ex_flt))) {
- optr->ex_type = ET_FLT;
- optr->ex_flt = 0;
- pd_error(expr, "no such var '%s'", var->s_name);
- return (1);
- }
- return (0);
+ optr->ex_type = ET_FLT;
+ if (value_getfloat(var, &(optr->ex_flt))) {
+ optr->ex_type = ET_FLT;
+ optr->ex_flt = 0;
+ pd_error(expr, "no such var '%s'", var->s_name);
+ return (1);
+ }
+ return (0);
}
#ifdef PD /* this goes to the end of this file as the following functions
* should be defined in the expr object in MSP
*/
-#define ISTABLE(sym, garray, size, vec) \
+#define ISTABLE(sym, garray, size, vec) \
if (!sym || !(garray = (t_garray *)pd_findbyclass(sym, garray_class)) || \
- !garray_getfloatarray(garray, &size, &vec)) { \
- optr->ex_type = ET_FLT; \
- optr->ex_int = 0; \
- error("no such table '%s'", sym->s_name); \
- return; \
+ !garray_getfloatarray(garray, &size, &vec)) { \
+ optr->ex_type = ET_FLT; \
+ optr->ex_int = 0; \
+ error("no such table '%s'", sym->s_name); \
+ return; \
}
/*
@@ -965,25 +965,25 @@ if (!sym || !(garray = (t_garray *)pd_findbyclass(sym, garray_class)) || \
void
ex_size(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
- t_symbol *s;
- t_garray *garray;
- int size;
- t_float *vec;
+ t_symbol *s;
+ t_garray *garray;
+ int size;
+ t_float *vec;
- if (argv->ex_type != ET_SYM)
- {
- post("expr: size: need a table name\n");
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- return;
- }
+ if (argv->ex_type != ET_SYM)
+ {
+ post("expr: size: need a table name\n");
+ optr->ex_type = ET_INT;
+ optr->ex_int = 0;
+ return;
+ }
- s = (fts_symbol_t ) argv->ex_ptr;
+ s = (fts_symbol_t ) argv->ex_ptr;
- ISTABLE(s, garray, size, vec);
+ ISTABLE(s, garray, size, vec);
- optr->ex_type = ET_INT;
- optr->ex_int = size;
+ optr->ex_type = ET_INT;
+ optr->ex_int = size;
}
/*
@@ -993,29 +993,29 @@ ex_size(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
void
ex_sum(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
- t_symbol *s;
- t_garray *garray;
- int size;
- t_float *vec, sum;
- int indx;
+ t_symbol *s;
+ t_garray *garray;
+ int size;
+ t_float *vec, sum;
+ int indx;
- if (argv->ex_type != ET_SYM)
- {
- post("expr: sum: need a table name\n");
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- return;
- }
+ if (argv->ex_type != ET_SYM)
+ {
+ post("expr: sum: need a table name\n");
+ optr->ex_type = ET_INT;
+ optr->ex_int = 0;
+ return;
+ }
- s = (fts_symbol_t ) argv->ex_ptr;
+ s = (fts_symbol_t ) argv->ex_ptr;
- ISTABLE(s, garray, size, vec);
+ ISTABLE(s, garray, size, vec);
- for (indx = 0, sum = 0; indx < size; indx++)
- sum += vec[indx];
+ for (indx = 0, sum = 0; indx < size; indx++)
+ sum += vec[indx];
- optr->ex_type = ET_FLT;
- optr->ex_flt = sum;
+ optr->ex_type = ET_FLT;
+ optr->ex_flt = sum;
}
@@ -1026,40 +1026,40 @@ ex_sum(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
void
ex_Sum(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
- t_symbol *s;
- t_garray *garray;
- int size;
- t_float *vec, sum;
- int indx, n1, n2;
-
- if (argv->ex_type != ET_SYM)
- {
- post("expr: sum: need a table name\n");
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- return;
- }
-
- s = (fts_symbol_t ) argv->ex_ptr;
-
- ISTABLE(s, garray, size, vec);
-
- if (argv->ex_type != ET_INT || argv[1].ex_type != ET_INT)
- {
- post("expr: Sum: boundries have to be fix values\n");
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- return;
- }
- n1 = argv->ex_int;
- n2 = argv[1].ex_int;
-
- for (indx = n1, sum = 0; indx < n2; indx++)
- if (indx >= 0 && indx < size)
- sum += vec[indx];
-
- optr->ex_type = ET_FLT;
- optr->ex_flt = sum;
+ t_symbol *s;
+ t_garray *garray;
+ int size;
+ t_float *vec, sum;
+ int indx, n1, n2;
+
+ if (argv->ex_type != ET_SYM)
+ {
+ post("expr: sum: need a table name\n");
+ optr->ex_type = ET_INT;
+ optr->ex_int = 0;
+ return;
+ }
+
+ s = (fts_symbol_t ) argv->ex_ptr;
+
+ ISTABLE(s, garray, size, vec);
+
+ if (argv->ex_type != ET_INT || argv[1].ex_type != ET_INT)
+ {
+ post("expr: Sum: boundries have to be fix values\n");
+ optr->ex_type = ET_INT;
+ optr->ex_int = 0;
+ return;
+ }
+ n1 = argv->ex_int;
+ n2 = argv[1].ex_int;
+
+ for (indx = n1, sum = 0; indx < n2; indx++)
+ if (indx >= 0 && indx < size)
+ sum += vec[indx];
+
+ optr->ex_type = ET_FLT;
+ optr->ex_flt = sum;
}
/*
@@ -1071,35 +1071,35 @@ ex_avg(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
/* SDY - look into this function */
#if 0
- fts_symbol_t s;
- fts_integer_vector_t *tw = 0;
-
- if (argv->ex_type != ET_SYM)
- {
- post("expr: avg: need a table name\n");
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- }
-
- s = (fts_symbol_t ) argv->ex_ptr;
-
- tw = table_integer_vector_get_by_name(s);
-
- if (tw)
- {
- optr->ex_type = ET_INT;
-
- if (! fts_integer_vector_get_size(tw))
- optr->ex_int = 0;
- else
- optr->ex_int = fts_integer_vector_get_sum(tw) / fts_integer_vector_get_size(tw);
- }
- else
- {
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- post("expr: avg: no such table %s\n", fts_symbol_name(s));
- }
+ fts_symbol_t s;
+ fts_integer_vector_t *tw = 0;
+
+ if (argv->ex_type != ET_SYM)
+ {
+ post("expr: avg: need a table name\n");
+ optr->ex_type = ET_INT;
+ optr->ex_int = 0;
+ }
+
+ s = (fts_symbol_t ) argv->ex_ptr;
+
+ tw = table_integer_vector_get_by_name(s);
+
+ if (tw)
+ {
+ optr->ex_type = ET_INT;
+
+ if (! fts_integer_vector_get_size(tw))
+ optr->ex_int = 0;
+ else
+ optr->ex_int = fts_integer_vector_get_sum(tw) / fts_integer_vector_get_size(tw);
+ }
+ else
+ {
+ optr->ex_type = ET_INT;
+ optr->ex_int = 0;
+ post("expr: avg: no such table %s\n", fts_symbol_name(s));
+ }
#endif
}
@@ -1113,50 +1113,50 @@ ex_Avg(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
/* SDY - look into this function */
#if 0
- fts_symbol_t s;
- fts_integer_vector_t *tw = 0;
-
- if (argv->ex_type != ET_SYM)
- {
- post("expr: Avg: need a table name\n");
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- }
-
- s = (fts_symbol_t ) (argv++)->ex_ptr;
-
- tw = table_integer_vector_get_by_name(s);
-
- if (! tw)
- {
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- post("expr: Avg: no such table %s\n", fts_symbol_name(s));
- return;
- }
-
- if (argv->ex_type != ET_INT || argv[1].ex_type != ET_INT)
- {
- post("expr: Avg: boundries have to be fix values\n");
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- return;
- }
-
- optr->ex_type = ET_INT;
-
- if (argv[1].ex_int - argv->ex_int <= 0)
- optr->ex_int = 0;
- else
- optr->ex_int = (fts_integer_vector_get_sub_sum(tw, argv->ex_int, argv[1].ex_int) /
- (argv[1].ex_int - argv->ex_int));
+ fts_symbol_t s;
+ fts_integer_vector_t *tw = 0;
+
+ if (argv->ex_type != ET_SYM)
+ {
+ post("expr: Avg: need a table name\n");
+ optr->ex_type = ET_INT;
+ optr->ex_int = 0;
+ }
+
+ s = (fts_symbol_t ) (argv++)->ex_ptr;
+
+ tw = table_integer_vector_get_by_name(s);
+
+ if (! tw)
+ {
+ optr->ex_type = ET_INT;
+ optr->ex_int = 0;
+ post("expr: Avg: no such table %s\n", fts_symbol_name(s));
+ return;
+ }
+
+ if (argv->ex_type != ET_INT || argv[1].ex_type != ET_INT)
+ {
+ post("expr: Avg: boundries have to be fix values\n");
+ optr->ex_type = ET_INT;
+ optr->ex_int = 0;
+ return;
+ }
+
+ optr->ex_type = ET_INT;
+
+ if (argv[1].ex_int - argv->ex_int <= 0)
+ optr->ex_int = 0;
+ else
+ optr->ex_int = (fts_integer_vector_get_sub_sum(tw, argv->ex_int, argv[1].ex_int) /
+ (argv[1].ex_int - argv->ex_int));
#endif
}
/*
* ex_store -- store a value in a table
- * if the index is greater the size of the table,
- * we will make a modulo the size of the table
+ * if the index is greater the size of the table,
+ * we will make a modulo the size of the table
*/
void
@@ -1164,35 +1164,35 @@ ex_store(t_expr *e, long int argc, struct ex_ex *argv, struct ex_ex *optr)
{
/* SDY - look into this function */
#if 0
- fts_symbol_t s;
- fts_integer_vector_t *tw = 0;
-
- if (argv->ex_type != ET_SYM)
- {
- post("expr: store: need a table name\n");
- }
-
- s = (fts_symbol_t ) (argv++)->ex_ptr;
-
- tw = table_integer_vector_get_by_name(s);
-
- if (! tw)
- {
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- post("expr: store: no such table %s\n", fts_symbol_name(s));
- return;
- }
-
- if (argv->ex_type != ET_INT || argv[1].ex_type != ET_INT)
- {
- post("expr: store: arguments have to be integer\n");
- optr->ex_type = ET_INT;
- optr->ex_int = 0;
- }
-
- fts_integer_vector_set_element(tw, argv->ex_int < 0 ? 0 : argv->ex_int % fts_integer_vector_get_size(tw), argv[1].ex_int);
- *optr = argv[1];
+ fts_symbol_t s;
+ fts_integer_vector_t *tw = 0;
+
+ if (argv->ex_type != ET_SYM)
+ {
+ post("expr: store: need a table name\n");
+ }
+
+ s = (fts_symbol_t ) (argv++)->ex_ptr;
+
+ tw = table_integer_vector_get_by_name(s);
+
+ if (! tw)
+ {
+ optr->ex_type = ET_INT;
+ optr->ex_int = 0;
+ post("expr: store: no such table %s\n", fts_symbol_name(s));
+ return;
+ }
+
+ if (argv->ex_type != ET_INT || argv[1].ex_type != ET_INT)
+ {
+ post("expr: store: arguments have to be integer\n");
+ optr->ex_type = ET_INT;
+ optr->ex_int = 0;
+ }
+
+ fts_integer_vector_set_element(tw, argv->ex_int < 0 ? 0 : argv->ex_int % fts_integer_vector_get_size(tw), argv[1].ex_int);
+ *optr = argv[1];
#endif
}
@@ -1209,7 +1209,7 @@ pd_error(void *object, char *fmt, ...)
/* SDY
vsprintf(error_string, fmt, ap);
*/ post(fmt, ap);
- va_end(ap);
+ va_end(ap);
/* SDY
fprintf(stderr, "error: %s\n", error_string);
error_object = object;
diff --git a/pd/extra/fiddle~/fiddle~.c b/pd/extra/fiddle~/fiddle~.c
index 594c2ff4..d959b00f 100644
--- a/pd/extra/fiddle~/fiddle~.c
+++ b/pd/extra/fiddle~/fiddle~.c
@@ -102,15 +102,10 @@ static fts_symbol_t *dsp_symbol = 0;
#endif /* MSP */
#ifdef MSP
-#define t_floatarg double // this is a guess based on MAX26
+#define t_floatarg double
#include "ext.h"
#include "z_dsp.h"
#include "fft_mayer.proto.h"
-//#include "fiddle_header.h"
-// #include "MacHeaders.h"
-//#include <MacHeadersPPC>
-
-//#include "fiddledoit.h"
#endif /* MSP */
@@ -129,25 +124,25 @@ static fts_symbol_t *dsp_symbol = 0;
#define MINFREQINBINS 5 /* minimum frequency in bins for reliable output */
#define MAXNPITCH 3
-#define MAXHIST 3 /* find N hottest peaks in histogram */
+#define MAXHIST 3 /* find N hottest peaks in histogram */
#define MAXPOINTS 8192
#define MINPOINTS 128
#define DEFAULTPOINTS 1024
#define HISTORY 20
-#define MAXPEAK 100 /* maximum number of peaks */
-#define DEFNPEAK 20 /* default number of peaks */
+#define MAXPEAK 100 /* maximum number of peaks */
+#define DEFNPEAK 20 /* default number of peaks */
#define MAXNPEAK (MAXLOWPEAK + MAXSTRONGPEAK)
-#define MINBW (0.03f) /* consider BW >= 0.03 FFT bins */
+#define MINBW (0.03f) /* consider BW >= 0.03 FFT bins */
-#define BINPEROCT 48 /* bins per octave */
-#define BPERO_OVER_LOG2 69.24936196f /* BINSPEROCT/log(2) */
-#define FACTORTOBINS (float)(4/0.0145453) /* 4 / (pow(2.,1/48.) - 1) */
-#define BINGUARD 10 /* extra bins to throw in front */
-#define PARTIALDEVIANCE 0.023f /* acceptable partial detuning in % */
-#define LOGTODB 4.34294481903f /* 20/log(10) */
+#define BINPEROCT 48 /* bins per octave */
+#define BPERO_OVER_LOG2 69.24936196f /* BINSPEROCT/log(2) */
+#define FACTORTOBINS (float)(4/0.0145453) /* 4 / (pow(2.,1/48.) - 1) */
+#define BINGUARD 10 /* extra bins to throw in front */
+#define PARTIALDEVIANCE 0.023f /* acceptable partial detuning in % */
+#define LOGTODB 4.34294481903f /* 20/log(10) */
#define KNOCKTHRESH 10.f /* don't know how to describe this */
@@ -207,79 +202,79 @@ sample rate. I got these by trial and error. */
#define FILT5 ((float)(.5 * 0.002533))
#define FILTSIZE 5
-typedef struct peakout /* a peak for output */
+typedef struct peakout /* a peak for output */
{
- float po_freq; /* frequency in hz */
- float po_amp; /* amplitude */
+ float po_freq; /* frequency in hz */
+ float po_amp; /* amplitude */
} t_peakout;
-typedef struct peak /* a peak for analysis */
+typedef struct peak /* a peak for analysis */
{
- float p_freq; /* frequency in bins */
- float p_width; /* peak width in bins */
- float p_pow; /* peak power */
- float p_loudness; /* 4th root of power */
- float *p_fp; /* pointer back to spectrum */
+ float p_freq; /* frequency in bins */
+ float p_width; /* peak width in bins */
+ float p_pow; /* peak power */
+ float p_loudness; /* 4th root of power */
+ float *p_fp; /* pointer back to spectrum */
} t_peak;
typedef struct histopeak
{
- float h_pitch; /* estimated pitch */
- float h_value; /* value of peak */
- float h_loud; /* combined strength of found partials */
- int h_index; /* index of bin holding peak */
- int h_used; /* true if an x_hist entry points here */
+ float h_pitch; /* estimated pitch */
+ float h_value; /* value of peak */
+ float h_loud; /* combined strength of found partials */
+ int h_index; /* index of bin holding peak */
+ int h_used; /* true if an x_hist entry points here */
} t_histopeak;
-typedef struct pitchhist /* struct for keeping history by pitch */
+typedef struct pitchhist /* struct for keeping history by pitch */
{
- float h_pitch; /* pitch to output */
- float h_amps[HISTORY]; /* past amplitudes */
- float h_pitches[HISTORY]; /* past pitches */
- float h_noted; /* last pitch output */
- int h_age; /* number of frames pitch has been there */
- t_histopeak *h_wherefrom; /* new histogram peak to incorporate */
+ float h_pitch; /* pitch to output */
+ float h_amps[HISTORY]; /* past amplitudes */
+ float h_pitches[HISTORY]; /* past pitches */
+ float h_noted; /* last pitch output */
+ int h_age; /* number of frames pitch has been there */
+ t_histopeak *h_wherefrom; /* new histogram peak to incorporate */
void *h_outlet;
} t_pitchhist;
-typedef struct sigfiddle /* instance struct */
+typedef struct sigfiddle /* instance struct */
{
#ifdef JMAX
- fts_object_t x_h; /* object header */
- fts_alarm_t x_clock; /* callback for timeouts */
+ fts_object_t x_h; /* object header */
+ fts_alarm_t x_clock; /* callback for timeouts */
#endif
#ifdef MAX26
- t_head x_h; /* header for tilde objects */
- t_sig *x_io[IN1+OUT0]; /* number of signal inputs and outputs */
- void *x_clock; /* a "clock" object */
+ t_head x_h; /* header for tilde objects */
+ t_sig *x_io[IN1+OUT0]; /* number of signal inputs and outputs */
+ void *x_clock; /* a "clock" object */
#endif
#ifdef PD
- t_object x_ob; /* object header */
- t_clock *x_clock; /* callback for timeouts */
+ t_object x_ob; /* object header */
+ t_clock *x_clock; /* callback for timeouts */
#endif
#ifdef MSP
- t_pxobject x_obj;
- void *x_clock;
- long x_downsample; // downsample feature because of
- // MSP's large sig vector sizes
+ t_pxobject x_obj;
+ void *x_clock;
+ long x_downsample; /* downsample feature because of
+ MSP's large sig vector sizes */
#endif
- float *x_inbuf; /* buffer to analyze, npoints/2 elems */
- float *x_lastanalysis; /* FT of last buffer (see main comment) */
- float *x_spiral; /* 1/4-wave complex exponential */
- t_peakout *x_peakbuf; /* spectral peaks for output */
- int x_npeakout; /* number of spectral peaks to output */
- int x_npeakanal; /* number of spectral peaks to analyze */
- int x_phase; /* number of points since last output */
- int x_histphase; /* phase into amplitude history vector */
- int x_hop; /* period of output, npoints/2 */
- float x_sr; /* sample rate */
+ float *x_inbuf; /* buffer to analyze, npoints/2 elems */
+ float *x_lastanalysis; /* FT of last buffer (see main comment) */
+ float *x_spiral; /* 1/4-wave complex exponential */
+ t_peakout *x_peakbuf; /* spectral peaks for output */
+ int x_npeakout; /* number of spectral peaks to output */
+ int x_npeakanal; /* number of spectral peaks to analyze */
+ int x_phase; /* number of points since last output */
+ int x_histphase; /* phase into amplitude history vector */
+ int x_hop; /* period of output, npoints/2 */
+ float x_sr; /* sample rate */
t_pitchhist x_hist[MAXNPITCH]; /* history of current pitches */
- int x_nprint; /* how many periods to print */
- int x_npitch; /* number of simultaneous pitches */
- float x_dbs[HISTORY]; /* DB history, indexed by "histphase" */
- float x_peaked; /* peak since last attack */
- int x_dbage; /* number of bins DB has met threshold */
- int x_auto; /* true if generating continuous output */
+ int x_nprint; /* how many periods to print */
+ int x_npitch; /* number of simultaneous pitches */
+ float x_dbs[HISTORY]; /* DB history, indexed by "histphase" */
+ float x_peaked; /* peak since last attack */
+ int x_dbage; /* number of bins DB has met threshold */
+ int x_auto; /* true if generating continuous output */
/* parameters */
float x_amplo;
float x_amphi;
@@ -303,7 +298,7 @@ float fiddle_checker[1024];
#endif
#ifdef MSP
-// Mac compiler requires prototypes for everything
+/* Mac compiler requires prototypes for everything */
int sigfiddle_ilog2(int n);
float fiddle_mtof(float f);
@@ -327,7 +322,6 @@ void sigfiddle_dsp(t_sigfiddle *x, t_signal **sp);
void sigfiddle_tick(t_sigfiddle *x);
void sigfiddle_bang(t_sigfiddle *x);
void sigfiddle_ff(t_sigfiddle *x);
-//void *sigfiddle_new(long npoints, long npitch);
void *sigfiddle_new(long npoints, long npitch,
long npeakanal, long npeakout);
void msp_fft(float *buf, long np, long inv);
@@ -340,20 +334,20 @@ int sigfiddle_ilog2(int n)
int ret = -1;
while (n)
{
- n >>= 1;
- ret++;
+ n >>= 1;
+ ret++;
}
return (ret);
}
float fiddle_mtof(float f)
{
- return (8.17579891564 * exp(.0577622650 * f));
+ return (8.17579891564 * exp(.0577622650 * f));
}
float fiddle_ftom(float f)
{
- return (17.3123405046 * log(.12231220585 * f));
+ return (17.3123405046 * log(.12231220585 * f));
}
#define ftom fiddle_ftom
#define mtof fiddle_mtof
@@ -361,7 +355,7 @@ float fiddle_ftom(float f)
void sigfiddle_doit(t_sigfiddle *x)
{
#ifdef MSP
- // prevents interrupt-level stack overflow crash with Netscape.
+ /* prevents interrupt-level stack overflow crash with Netscape. */
static float spect1[4*MAXPOINTS];
static float spect2[MAXPOINTS + 4*FILTSIZE];
#else
@@ -389,13 +383,13 @@ void sigfiddle_doit(t_sigfiddle *x)
if (newphase == HISTORY) newphase = 0;
x->x_histphase = newphase;
- /*
- * multiply the H points by a 1/4-wave complex exponential,
- * and take FFT of the result.
- */
+ /*
+ * multiply the H points by a 1/4-wave complex exponential,
+ * and take FFT of the result.
+ */
for (i = 0, fp1 = x->x_inbuf, fp2 = x->x_spiral, fp3 = spect1;
- i < hop; i++, fp1++, fp2 += 2, fp3 += 2)
- fp3[0] = fp1[0] * fp2[0], fp3[1] = fp1[0] * fp2[1];
+ i < hop; i++, fp1++, fp2 += 2, fp3 += 2)
+ fp3[0] = fp1[0] * fp2[0], fp3[1] = fp1[0] * fp2[1];
#ifdef MAX26
fft(spect1, hop, 0);
@@ -407,123 +401,123 @@ void sigfiddle_doit(t_sigfiddle *x)
fts_cfft_inplc((complex *)spect1, hop);
#endif
#ifdef MSP
- msp_fft(spect1,hop,0);
+ msp_fft(spect1,hop,0);
#endif
- /*
- * now redistribute the points to get in effect the odd-numbered
- * points of the FFT of the H points, zero padded to 4*H in length.
- */
+ /*
+ * now redistribute the points to get in effect the odd-numbered
+ * points of the FFT of the H points, zero padded to 4*H in length.
+ */
for (i = 0, fp1 = spect1, fp2 = spect2 + (2*FILTSIZE);
- i < (hop>>1); i++, fp1 += 2, fp2 += 4)
- fp2[0] = fp1[0], fp2[1] = fp1[1];
+ i < (hop>>1); i++, fp1 += 2, fp2 += 4)
+ fp2[0] = fp1[0], fp2[1] = fp1[1];
for (i = 0, fp1 = spect1 + n - 2, fp2 = spect2 + (2*FILTSIZE+2);
- i < (hop>>1); i++, fp1 -= 2, fp2 += 4)
- fp2[0] = fp1[0], fp2[1] = -fp1[1];
+ i < (hop>>1); i++, fp1 -= 2, fp2 += 4)
+ fp2[0] = fp1[0], fp2[1] = -fp1[1];
for (i = 0, fp1 = spect2 + (2*FILTSIZE), fp2 = spect2 + (2*FILTSIZE-2);
- i<FILTSIZE; i++, fp1+=2, fp2-=2)
- fp2[0] = fp1[0], fp2[1] = -fp1[1];
+ i<FILTSIZE; i++, fp1+=2, fp2-=2)
+ fp2[0] = fp1[0], fp2[1] = -fp1[1];
for (i = 0, fp1 = spect2 + (2*FILTSIZE+n-2), fp2 = spect2 + (2*FILTSIZE+n);
- i<FILTSIZE; i++, fp1-=2, fp2+=2)
- fp2[0] = fp1[0], fp2[1] = -fp1[1];
+ i<FILTSIZE; i++, fp1-=2, fp2+=2)
+ fp2[0] = fp1[0], fp2[1] = -fp1[1];
#if 0
{
- fp = spect2 + 2*FILTSIZE;
- post("x1 re %12.4f %12.4f %12.4f %12.4f %12.4f",
- fp[0], fp[2], fp[4], fp[6], fp[8]);
- post("x1 im %12.4f %12.4f %12.4f %12.4f %12.4f",
- fp[1], fp[3], fp[5], fp[7], fp[9]);
+ fp = spect2 + 2*FILTSIZE;
+ post("x1 re %12.4f %12.4f %12.4f %12.4f %12.4f",
+ fp[0], fp[2], fp[4], fp[6], fp[8]);
+ post("x1 im %12.4f %12.4f %12.4f %12.4f %12.4f",
+ fp[1], fp[3], fp[5], fp[7], fp[9]);
}
#endif
- /* spect2 is now prepared; now combine spect2 and lastanalysis into
- * spect1. Odd-numbered points of spect1 are the points of "last"
- * plus (-i, i, -i, ...) times spect1. Even-numbered points are
- * the interpolated points of "last" plus (1, -1, 1, ...) times the
- * interpolated points of spect1.
- *
- * To interpolate, take FILT1 exp(-pi/4) times
- * the previous point, FILT2*exp(-3*pi/4) times 3 bins before,
- * etc, and FILT1 exp(pi/4), FILT2 exp(3pi/4), etc., to weight
- * the +1, +3, etc., points.
- *
- * In this calculation, we take (1, i, -1, -i, 1) times the
- * -9, -7, ..., -1 points, and (i, -1, -i, 1, i) times the 1, 3,..., 9
- * points of the OLD spectrum, alternately adding and subtracting
- * the new spectrum to the old; then we multiply the whole thing
- * by exp(-i pi/4).
- */
+ /* spect2 is now prepared; now combine spect2 and lastanalysis into
+ * spect1. Odd-numbered points of spect1 are the points of "last"
+ * plus (-i, i, -i, ...) times spect1. Even-numbered points are
+ * the interpolated points of "last" plus (1, -1, 1, ...) times the
+ * interpolated points of spect1.
+ *
+ * To interpolate, take FILT1 exp(-pi/4) times
+ * the previous point, FILT2*exp(-3*pi/4) times 3 bins before,
+ * etc, and FILT1 exp(pi/4), FILT2 exp(3pi/4), etc., to weight
+ * the +1, +3, etc., points.
+ *
+ * In this calculation, we take (1, i, -1, -i, 1) times the
+ * -9, -7, ..., -1 points, and (i, -1, -i, 1, i) times the 1, 3,..., 9
+ * points of the OLD spectrum, alternately adding and subtracting
+ * the new spectrum to the old; then we multiply the whole thing
+ * by exp(-i pi/4).
+ */
for (i = 0, fp1 = spect1, fp2 = x->x_lastanalysis + 2*FILTSIZE,
- fp3 = spect2 + 2*FILTSIZE;
- i < (hop>>1); i++)
+ fp3 = spect2 + 2*FILTSIZE;
+ i < (hop>>1); i++)
{
- float re, im;
-
- re= FILT1 * ( fp2[ -2] -fp2[ 1] +fp3[ -2] -fp3[ 1]) +
- FILT2 * ( fp2[ -3] -fp2[ 2] +fp3[ -3] -fp3[ 2]) +
- FILT3 * (-fp2[ -6] +fp2[ 5] -fp3[ -6] +fp3[ 5]) +
- FILT4 * (-fp2[ -7] +fp2[ 6] -fp3[ -7] +fp3[ 6]) +
- FILT5 * ( fp2[-10] -fp2[ 9] +fp3[-10] -fp3[ 9]);
-
- im= FILT1 * ( fp2[ -1] +fp2[ 0] +fp3[ -1] +fp3[ 0]) +
- FILT2 * (-fp2[ -4] -fp2[ 3] -fp3[ -4] -fp3[ 3]) +
- FILT3 * (-fp2[ -5] -fp2[ 4] -fp3[ -5] -fp3[ 4]) +
- FILT4 * ( fp2[ -8] +fp2[ 7] +fp3[ -8] +fp3[ 7]) +
- FILT5 * ( fp2[ -9] +fp2[ 8] +fp3[ -9] +fp3[ 8]);
-
- fp1[0] = 0.7071f * (re + im);
- fp1[1] = 0.7071f * (im - re);
- fp1[4] = fp2[0] + fp3[1];
- fp1[5] = fp2[1] - fp3[0];
-
- fp1 += 8, fp2 += 2, fp3 += 2;
- re= FILT1 * ( fp2[ -2] -fp2[ 1] -fp3[ -2] +fp3[ 1]) +
- FILT2 * ( fp2[ -3] -fp2[ 2] -fp3[ -3] +fp3[ 2]) +
- FILT3 * (-fp2[ -6] +fp2[ 5] +fp3[ -6] -fp3[ 5]) +
- FILT4 * (-fp2[ -7] +fp2[ 6] +fp3[ -7] -fp3[ 6]) +
- FILT5 * ( fp2[-10] -fp2[ 9] -fp3[-10] +fp3[ 9]);
-
- im= FILT1 * ( fp2[ -1] +fp2[ 0] -fp3[ -1] -fp3[ 0]) +
- FILT2 * (-fp2[ -4] -fp2[ 3] +fp3[ -4] +fp3[ 3]) +
- FILT3 * (-fp2[ -5] -fp2[ 4] +fp3[ -5] +fp3[ 4]) +
- FILT4 * ( fp2[ -8] +fp2[ 7] -fp3[ -8] -fp3[ 7]) +
- FILT5 * ( fp2[ -9] +fp2[ 8] -fp3[ -9] -fp3[ 8]);
-
- fp1[0] = 0.7071f * (re + im);
- fp1[1] = 0.7071f * (im - re);
- fp1[4] = fp2[0] - fp3[1];
- fp1[5] = fp2[1] + fp3[0];
-
- fp1 += 8, fp2 += 2, fp3 += 2;
+ float re, im;
+
+ re= FILT1 * ( fp2[ -2] -fp2[ 1] +fp3[ -2] -fp3[ 1]) +
+ FILT2 * ( fp2[ -3] -fp2[ 2] +fp3[ -3] -fp3[ 2]) +
+ FILT3 * (-fp2[ -6] +fp2[ 5] -fp3[ -6] +fp3[ 5]) +
+ FILT4 * (-fp2[ -7] +fp2[ 6] -fp3[ -7] +fp3[ 6]) +
+ FILT5 * ( fp2[-10] -fp2[ 9] +fp3[-10] -fp3[ 9]);
+
+ im= FILT1 * ( fp2[ -1] +fp2[ 0] +fp3[ -1] +fp3[ 0]) +
+ FILT2 * (-fp2[ -4] -fp2[ 3] -fp3[ -4] -fp3[ 3]) +
+ FILT3 * (-fp2[ -5] -fp2[ 4] -fp3[ -5] -fp3[ 4]) +
+ FILT4 * ( fp2[ -8] +fp2[ 7] +fp3[ -8] +fp3[ 7]) +
+ FILT5 * ( fp2[ -9] +fp2[ 8] +fp3[ -9] +fp3[ 8]);
+
+ fp1[0] = 0.7071f * (re + im);
+ fp1[1] = 0.7071f * (im - re);
+ fp1[4] = fp2[0] + fp3[1];
+ fp1[5] = fp2[1] - fp3[0];
+
+ fp1 += 8, fp2 += 2, fp3 += 2;
+ re= FILT1 * ( fp2[ -2] -fp2[ 1] -fp3[ -2] +fp3[ 1]) +
+ FILT2 * ( fp2[ -3] -fp2[ 2] -fp3[ -3] +fp3[ 2]) +
+ FILT3 * (-fp2[ -6] +fp2[ 5] +fp3[ -6] -fp3[ 5]) +
+ FILT4 * (-fp2[ -7] +fp2[ 6] +fp3[ -7] -fp3[ 6]) +
+ FILT5 * ( fp2[-10] -fp2[ 9] -fp3[-10] +fp3[ 9]);
+
+ im= FILT1 * ( fp2[ -1] +fp2[ 0] -fp3[ -1] -fp3[ 0]) +
+ FILT2 * (-fp2[ -4] -fp2[ 3] +fp3[ -4] +fp3[ 3]) +
+ FILT3 * (-fp2[ -5] -fp2[ 4] +fp3[ -5] +fp3[ 4]) +
+ FILT4 * ( fp2[ -8] +fp2[ 7] -fp3[ -8] -fp3[ 7]) +
+ FILT5 * ( fp2[ -9] +fp2[ 8] -fp3[ -9] -fp3[ 8]);
+
+ fp1[0] = 0.7071f * (re + im);
+ fp1[1] = 0.7071f * (im - re);
+ fp1[4] = fp2[0] - fp3[1];
+ fp1[5] = fp2[1] + fp3[0];
+
+ fp1 += 8, fp2 += 2, fp3 += 2;
}
#if 0
if (x->x_nprint)
{
- for (i = 0, fp = spect1; i < 16; i++, fp+= 4)
- post("spect %d %f %f --> %f", i, fp[0], fp[1],
- sqrt(fp[0] * fp[0] + fp[1] * fp[1]));
+ for (i = 0, fp = spect1; i < 16; i++, fp+= 4)
+ post("spect %d %f %f --> %f", i, fp[0], fp[1],
+ sqrt(fp[0] * fp[0] + fp[1] * fp[1]));
}
#endif
- /* copy new spectrum out */
+ /* copy new spectrum out */
for (i = 0, fp1 = spect2, fp2 = x->x_lastanalysis;
- i < n + 4*FILTSIZE; i++) *fp2++ = *fp1++;
+ i < n + 4*FILTSIZE; i++) *fp2++ = *fp1++;
for (i = 0; i < MINBIN; i++) spect1[4*i + 2] = spect1[4*i + 3] = 0;
- /* starting at bin MINBIN, compute hanning windowed power spectrum */
+ /* starting at bin MINBIN, compute hanning windowed power spectrum */
for (i = MINBIN, fp1 = spect1+4*MINBIN, total_power = 0;
- i < n-2; i++, fp1 += 4)
+ i < n-2; i++, fp1 += 4)
{
- float re = fp1[0] - 0.5f * (fp1[-8] + fp1[8]);
- float im = fp1[1] - 0.5f * (fp1[-7] + fp1[9]);
- fp1[3] = (total_power += (fp1[2] = re * re + im * im));
+ float re = fp1[0] - 0.5f * (fp1[-8] + fp1[8]);
+ float im = fp1[1] - 0.5f * (fp1[-7] + fp1[9]);
+ fp1[3] = (total_power += (fp1[2] = re * re + im * im));
}
if (total_power > 1e-9f)
{
- total_db = (100.f - DBFUDGE) + LOGTODB * log(total_power/n);
- total_loudness = fsqrt(fsqrt(total_power));
- if (total_db < 0) total_db = 0;
+ total_db = (100.f - DBFUDGE) + LOGTODB * log(total_power/n);
+ total_loudness = fsqrt(fsqrt(total_power));
+ if (total_db < 0) total_db = 0;
}
else total_db = total_loudness = 0;
- /* store new db in history vector */
+ /* store new db in history vector */
x->x_dbs[newphase] = total_db;
if (total_db < x->x_amplo) goto nopow;
#if 1
@@ -531,467 +525,467 @@ void sigfiddle_doit(t_sigfiddle *x)
#endif
#if CHECKER
- /* verify that our FFT resampling thing is putting out good results */
+ /* verify that our FFT resampling thing is putting out good results */
for (i = 0; i < hop; i++)
{
- checker3[2*i] = fiddle_checker[i];
- checker3[2*i + 1] = 0;
- checker3[n + 2*i] = fiddle_checker[i] = x->x_inbuf[i];
- checker3[n + 2*i + 1] = 0;
+ checker3[2*i] = fiddle_checker[i];
+ checker3[2*i + 1] = 0;
+ checker3[n + 2*i] = fiddle_checker[i] = x->x_inbuf[i];
+ checker3[n + 2*i + 1] = 0;
}
for (i = 2*n; i < 4*n; i++) checker3[i] = 0;
fft(checker3, 2*n, 0);
if (x->x_nprint)
{
- for (i = 0, fp = checker3; i < 16; i++, fp += 2)
- post("spect %d %f %f --> %f", i, fp[0], fp[1],
- sqrt(fp[0] * fp[0] + fp[1] * fp[1]));
+ for (i = 0, fp = checker3; i < 16; i++, fp += 2)
+ post("spect %d %f %f --> %f", i, fp[0], fp[1],
+ sqrt(fp[0] * fp[0] + fp[1] * fp[1]));
}
#endif
npeak = 0;
- /* search for peaks */
+ /* search for peaks */
for (i = MINBIN, fp = spect1+4*MINBIN, pk1 = peaklist;
- i < n-2 && npeak < npeaktot; i++, fp += 4)
+ i < n-2 && npeak < npeaktot; i++, fp += 4)
{
- float height = fp[2], h1 = fp[-2], h2 = fp[6];
- float totalfreq, pfreq, f1, f2, m, var, stdev;
-
- if (height < h1 || height < h2 ||
- h1 < 0.00001f*total_power || h2 < 0.00001f*total_power)
- continue;
-
- /* use an informal phase vocoder to estimate the frequency.
- Do this for the two adjacent bins too. */
- pfreq= ((fp[-8] - fp[8]) * (2.0f * fp[0] - fp[8] - fp[-8]) +
- (fp[-7] - fp[9]) * (2.0f * fp[1] - fp[9] - fp[-7])) /
- (2.0f * height);
- f1= ((fp[-12] - fp[4]) * (2.0f * fp[-4] - fp[4] - fp[-12]) +
- (fp[-11] - fp[5]) * (2.0f * fp[-3] - fp[5] - fp[-11])) /
- (2.0f * h1) - 1;
- f2= ((fp[-4] - fp[12]) * (2.0f * fp[4] - fp[12] - fp[-4]) +
- (fp[-3] - fp[13]) * (2.0f * fp[5] - fp[13] - fp[-3])) /
- (2.0f * h2) + 1;
-
- /* get sample mean and variance of the three */
- m = 0.333333f * (pfreq + f1 + f2);
- var = 0.5f * ((pfreq-m)*(pfreq-m) + (f1-m)*(f1-m) + (f2-m)*(f2-m));
-
- totalfreq = i + m;
- if (var * total_power > KNOCKTHRESH * height || var < 1e-30)
- {
+ float height = fp[2], h1 = fp[-2], h2 = fp[6];
+ float totalfreq, pfreq, f1, f2, m, var, stdev;
+
+ if (height < h1 || height < h2 ||
+ h1 < 0.00001f*total_power || h2 < 0.00001f*total_power)
+ continue;
+
+ /* use an informal phase vocoder to estimate the frequency.
+ Do this for the two adjacent bins too. */
+ pfreq= ((fp[-8] - fp[8]) * (2.0f * fp[0] - fp[8] - fp[-8]) +
+ (fp[-7] - fp[9]) * (2.0f * fp[1] - fp[9] - fp[-7])) /
+ (2.0f * height);
+ f1= ((fp[-12] - fp[4]) * (2.0f * fp[-4] - fp[4] - fp[-12]) +
+ (fp[-11] - fp[5]) * (2.0f * fp[-3] - fp[5] - fp[-11])) /
+ (2.0f * h1) - 1;
+ f2= ((fp[-4] - fp[12]) * (2.0f * fp[4] - fp[12] - fp[-4]) +
+ (fp[-3] - fp[13]) * (2.0f * fp[5] - fp[13] - fp[-3])) /
+ (2.0f * h2) + 1;
+
+ /* get sample mean and variance of the three */
+ m = 0.333333f * (pfreq + f1 + f2);
+ var = 0.5f * ((pfreq-m)*(pfreq-m) + (f1-m)*(f1-m) + (f2-m)*(f2-m));
+
+ totalfreq = i + m;
+ if (var * total_power > KNOCKTHRESH * height || var < 1e-30)
+ {
#if 0
- if (x->x_nprint)
- post("cancel: %.2f hz, index %.1f, power %.5f, stdev=%.2f",
- totalfreq * hzperbin, BPERO_OVER_LOG2 * log(totalfreq) - 96,
- height, sqrt(var));
+ if (x->x_nprint)
+ post("cancel: %.2f hz, index %.1f, power %.5f, stdev=%.2f",
+ totalfreq * hzperbin, BPERO_OVER_LOG2 * log(totalfreq) - 96,
+ height, sqrt(var));
#endif
- continue;
- }
- stdev = fsqrt(var);
- if (totalfreq < 4)
- {
- if (x->x_nprint) post("oops: was %d, freq %f, m %f, stdev %f h %f",
- i, totalfreq, m, stdev, height);
- totalfreq = 4;
- }
- pk1->p_width = stdev;
-
- pk1->p_pow = height;
- pk1->p_loudness = fsqrt(fsqrt(height));
- pk1->p_fp = fp;
- pk1->p_freq = totalfreq;
- npeak++;
+ continue;
+ }
+ stdev = fsqrt(var);
+ if (totalfreq < 4)
+ {
+ if (x->x_nprint) post("oops: was %d, freq %f, m %f, stdev %f h %f",
+ i, totalfreq, m, stdev, height);
+ totalfreq = 4;
+ }
+ pk1->p_width = stdev;
+
+ pk1->p_pow = height;
+ pk1->p_loudness = fsqrt(fsqrt(height));
+ pk1->p_fp = fp;
+ pk1->p_freq = totalfreq;
+ npeak++;
#if 1
- if (x->x_nprint)
- {
- post("peak: %.2f hz. index %.1f, power %.5f, stdev=%.2f",
- pk1->p_freq * hzperbin,
- BPERO_OVER_LOG2 * log(pk1->p_freq) - 96,
- height, stdev);
- }
+ if (x->x_nprint)
+ {
+ post("peak: %.2f hz. index %.1f, power %.5f, stdev=%.2f",
+ pk1->p_freq * hzperbin,
+ BPERO_OVER_LOG2 * log(pk1->p_freq) - 96,
+ height, stdev);
+ }
#endif
- pk1++;
+ pk1++;
}
- /* prepare the raw peaks for output */
+ /* prepare the raw peaks for output */
for (i = 0, pk1 = peaklist, pk2 = x->x_peakbuf; i < npeak;
- i++, pk1++, pk2++)
+ i++, pk1++, pk2++)
{
- float loudness = pk1->p_loudness;
- if (i >= npeakout) break;
- pk2->po_freq = hzperbin * pk1->p_freq;
- pk2->po_amp = (2.f / (float)n) * (loudness * loudness);
+ float loudness = pk1->p_loudness;
+ if (i >= npeakout) break;
+ pk2->po_freq = hzperbin * pk1->p_freq;
+ pk2->po_amp = (2.f / (float)n) * (loudness * loudness);
}
for (; i < npeakout; i++, pk2++) pk2->po_amp = pk2->po_freq = 0;
- /* now, working back into spect2, make a sort of "liklihood"
- * spectrum. Proceeding in 48ths of an octave, from 2 to
- * n/2 (in bins), the likelihood of each pitch range is contributed
- * to by every peak in peaklist that's an integer multiple of it
- * in frequency.
- */
+ /* now, working back into spect2, make a sort of "liklihood"
+ * spectrum. Proceeding in 48ths of an octave, from 2 to
+ * n/2 (in bins), the likelihood of each pitch range is contributed
+ * to by every peak in peaklist that's an integer multiple of it
+ * in frequency.
+ */
if (npeak > npeakanal) npeak = npeakanal; /* max # peaks to analyze */
for (i = 0, fp1 = histogram; i < maxbin; i++) *fp1++ = 0;
for (i = 0, pk1 = peaklist; i < npeak; i++, pk1++)
{
- float pit = BPERO_OVER_LOG2 * flog(pk1->p_freq) - 96.0f;
- float binbandwidth = FACTORTOBINS * pk1->p_width/pk1->p_freq;
- float putbandwidth = (binbandwidth < 2 ? 2 : binbandwidth);
- float weightbandwidth = (binbandwidth < 1.0f ? 1.0f : binbandwidth);
- /* float weightamp = 1.0f + 3.0f * pk1->p_pow / pow; */
- float weightamp = 4. * pk1->p_loudness / total_loudness;
- for (j = 0, fp2 = sigfiddle_partialonset; j < NPARTIALONSET; j++, fp2++)
- {
- float bin = pit - *fp2;
- if (bin < maxbin)
- {
- float para, pphase, score = 30.0f * weightamp /
- ((j+x->x_npartial) * weightbandwidth);
- int firstbin = bin + 0.5f - 0.5f * putbandwidth;
- int lastbin = bin + 0.5f + 0.5f * putbandwidth;
- int ibw = lastbin - firstbin;
- if (firstbin < -BINGUARD) break;
- para = 1.0f / (putbandwidth * putbandwidth);
- for (k = 0, fp3 = histogram + firstbin,
- pphase = firstbin-bin; k <= ibw;
- k++, fp3++, pphase += 1.0f)
- {
- *fp3 += score * (1.0f - para * pphase * pphase);
- }
- }
- }
+ float pit = BPERO_OVER_LOG2 * flog(pk1->p_freq) - 96.0f;
+ float binbandwidth = FACTORTOBINS * pk1->p_width/pk1->p_freq;
+ float putbandwidth = (binbandwidth < 2 ? 2 : binbandwidth);
+ float weightbandwidth = (binbandwidth < 1.0f ? 1.0f : binbandwidth);
+ /* float weightamp = 1.0f + 3.0f * pk1->p_pow / pow; */
+ float weightamp = 4. * pk1->p_loudness / total_loudness;
+ for (j = 0, fp2 = sigfiddle_partialonset; j < NPARTIALONSET; j++, fp2++)
+ {
+ float bin = pit - *fp2;
+ if (bin < maxbin)
+ {
+ float para, pphase, score = 30.0f * weightamp /
+ ((j+x->x_npartial) * weightbandwidth);
+ int firstbin = bin + 0.5f - 0.5f * putbandwidth;
+ int lastbin = bin + 0.5f + 0.5f * putbandwidth;
+ int ibw = lastbin - firstbin;
+ if (firstbin < -BINGUARD) break;
+ para = 1.0f / (putbandwidth * putbandwidth);
+ for (k = 0, fp3 = histogram + firstbin,
+ pphase = firstbin-bin; k <= ibw;
+ k++, fp3++, pphase += 1.0f)
+ {
+ *fp3 += score * (1.0f - para * pphase * pphase);
+ }
+ }
+ }
}
#if 1
if (x->x_nprint)
{
- for (i = 0; i < 6*5; i++)
- {
- float fhz = hzperbin * exp ((8*i + 96) * (1./BPERO_OVER_LOG2));
- if (!(i % 6)) post("-- bin %d pitch %f freq %f----", 8*i,
- ftom(fhz), fhz);;
- post("%3d %3d %3d %3d %3d %3d %3d %3d",
- (int)(histogram[8*i]),
- (int)(histogram[8*i+1]),
- (int)(histogram[8*i+2]),
- (int)(histogram[8*i+3]),
- (int)(histogram[8*i+4]),
- (int)(histogram[8*i+5]),
- (int)(histogram[8*i+6]),
- (int)(histogram[8*i+7]));
- }
+ for (i = 0; i < 6*5; i++)
+ {
+ float fhz = hzperbin * exp ((8*i + 96) * (1./BPERO_OVER_LOG2));
+ if (!(i % 6)) post("-- bin %d pitch %f freq %f----", 8*i,
+ ftom(fhz), fhz);;
+ post("%3d %3d %3d %3d %3d %3d %3d %3d",
+ (int)(histogram[8*i]),
+ (int)(histogram[8*i+1]),
+ (int)(histogram[8*i+2]),
+ (int)(histogram[8*i+3]),
+ (int)(histogram[8*i+4]),
+ (int)(histogram[8*i+5]),
+ (int)(histogram[8*i+6]),
+ (int)(histogram[8*i+7]));
+ }
}
#endif
- /*
- * Next we find up to NPITCH strongest peaks in the histogram.
- * if a peak is related to a stronger one via an interval in
- * the sigfiddle_partialonset array, we suppress it.
- */
+ /*
+ * Next we find up to NPITCH strongest peaks in the histogram.
+ * if a peak is related to a stronger one via an interval in
+ * the sigfiddle_partialonset array, we suppress it.
+ */
for (npitch = 0; npitch < x->x_npitch; npitch++)
{
- int indx;
- float best;
- if (npitch)
- {
- for (best = 0, indx = -1, j=1; j < maxbin-1; j++)
- {
- if (histogram[j] > best && histogram[j] > histogram[j-1] &&
- histogram[j] > histogram[j+1])
- {
- for (k = 0; k < npitch; k++)
- if (histvec[k].h_index == j)
- goto peaknogood;
- for (k = 0; k < NPARTIALONSET; k++)
- {
- if (j - sigfiddle_intpartialonset[k] < 0) break;
- if (histogram[j - sigfiddle_intpartialonset[k]]
- > histogram[j]) goto peaknogood;
- }
- for (k = 0; k < NPARTIALONSET; k++)
- {
- if (j + sigfiddle_intpartialonset[k] >= maxbin) break;
- if (histogram[j + sigfiddle_intpartialonset[k]]
- > histogram[j]) goto peaknogood;
- }
- indx = j;
- best = histogram[j];
- }
- peaknogood: ;
- }
- }
- else
- {
- for (best = 0, indx = -1, j=0; j < maxbin; j++)
- if (histogram[j] > best)
- indx = j, best = histogram[j];
- }
- if (indx < 0) break;
- histvec[npitch].h_value = best;
- histvec[npitch].h_index = indx;
+ int indx;
+ float best;
+ if (npitch)
+ {
+ for (best = 0, indx = -1, j=1; j < maxbin-1; j++)
+ {
+ if (histogram[j] > best && histogram[j] > histogram[j-1] &&
+ histogram[j] > histogram[j+1])
+ {
+ for (k = 0; k < npitch; k++)
+ if (histvec[k].h_index == j)
+ goto peaknogood;
+ for (k = 0; k < NPARTIALONSET; k++)
+ {
+ if (j - sigfiddle_intpartialonset[k] < 0) break;
+ if (histogram[j - sigfiddle_intpartialonset[k]]
+ > histogram[j]) goto peaknogood;
+ }
+ for (k = 0; k < NPARTIALONSET; k++)
+ {
+ if (j + sigfiddle_intpartialonset[k] >= maxbin) break;
+ if (histogram[j + sigfiddle_intpartialonset[k]]
+ > histogram[j]) goto peaknogood;
+ }
+ indx = j;
+ best = histogram[j];
+ }
+ peaknogood: ;
+ }
+ }
+ else
+ {
+ for (best = 0, indx = -1, j=0; j < maxbin; j++)
+ if (histogram[j] > best)
+ indx = j, best = histogram[j];
+ }
+ if (indx < 0) break;
+ histvec[npitch].h_value = best;
+ histvec[npitch].h_index = indx;
}
#if 1
if (x->x_nprint)
{
- for (i = 0; i < npitch; i++)
- {
- post("index %d freq %f --> value %f", histvec[i].h_index,
- exp((1./BPERO_OVER_LOG2) * (histvec[i].h_index + 96)),
- histvec[i].h_value);
- post("next %f , prev %f",
- exp((1./BPERO_OVER_LOG2) * (histvec[i].h_index + 97)),
- exp((1./BPERO_OVER_LOG2) * (histvec[i].h_index + 95)) );
- }
+ for (i = 0; i < npitch; i++)
+ {
+ post("index %d freq %f --> value %f", histvec[i].h_index,
+ exp((1./BPERO_OVER_LOG2) * (histvec[i].h_index + 96)),
+ histvec[i].h_value);
+ post("next %f , prev %f",
+ exp((1./BPERO_OVER_LOG2) * (histvec[i].h_index + 97)),
+ exp((1./BPERO_OVER_LOG2) * (histvec[i].h_index + 95)) );
+ }
}
#endif
- /* for each histogram peak, we now search back through the
- * FFT peaks. A peak is a pitch if either there are several
- * harmonics that match it, or else if (a) the fundamental is
- * present, and (b) the sum of the powers of the contributing peaks
- * is at least 1/100 of the total power.
- *
- * A peak is a contributor if its frequency is within 25 cents of
- * a partial from 1 to 16.
- *
- * Finally, we have to be at least 5 bins in frequency, which
- * corresponds to 2-1/5 periods fitting in the analysis window.
- */
+ /* for each histogram peak, we now search back through the
+ * FFT peaks. A peak is a pitch if either there are several
+ * harmonics that match it, or else if (a) the fundamental is
+ * present, and (b) the sum of the powers of the contributing peaks
+ * is at least 1/100 of the total power.
+ *
+ * A peak is a contributor if its frequency is within 25 cents of
+ * a partial from 1 to 16.
+ *
+ * Finally, we have to be at least 5 bins in frequency, which
+ * corresponds to 2-1/5 periods fitting in the analysis window.
+ */
for (i = 0; i < npitch; i++)
{
- float cumpow = 0, cumstrength = 0, freqnum = 0, freqden = 0;
- int npartials = 0, nbelow8 = 0;
- /* guessed-at frequency in bins */
- float putfreq = fexp((1.0f / BPERO_OVER_LOG2) *
- (histvec[i].h_index + 96.0f));
- for (j = 0; j < npeak; j++)
- {
- float fpnum = peaklist[j].p_freq/putfreq;
- int pnum = fpnum + 0.5f;
- float fipnum = pnum;
- float deviation;
- if (pnum > 16 || pnum < 1) continue;
- deviation = 1.0f - fpnum/fipnum;
- if (deviation > -PARTIALDEVIANCE && deviation < PARTIALDEVIANCE)
- {
- /*
- * we figure this is a partial since it's within 1/4 of
- * a halftone of a multiple of the putative frequency.
- */
-
- float stdev, weight;
- npartials++;
- if (pnum < 8) nbelow8++;
- cumpow += peaklist[j].p_pow;
- cumstrength += fsqrt(fsqrt(peaklist[j].p_pow));
- stdev = (peaklist[j].p_width > MINBW ?
- peaklist[j].p_width : MINBW);
- weight = 1.0f / ((stdev*fipnum) * (stdev*fipnum));
- freqden += weight;
- freqnum += weight * peaklist[j].p_freq/fipnum;
+ float cumpow = 0, cumstrength = 0, freqnum = 0, freqden = 0;
+ int npartials = 0, nbelow8 = 0;
+ /* guessed-at frequency in bins */
+ float putfreq = fexp((1.0f / BPERO_OVER_LOG2) *
+ (histvec[i].h_index + 96.0f));
+ for (j = 0; j < npeak; j++)
+ {
+ float fpnum = peaklist[j].p_freq/putfreq;
+ int pnum = fpnum + 0.5f;
+ float fipnum = pnum;
+ float deviation;
+ if (pnum > 16 || pnum < 1) continue;
+ deviation = 1.0f - fpnum/fipnum;
+ if (deviation > -PARTIALDEVIANCE && deviation < PARTIALDEVIANCE)
+ {
+ /*
+ * we figure this is a partial since it's within 1/4 of
+ * a halftone of a multiple of the putative frequency.
+ */
+
+ float stdev, weight;
+ npartials++;
+ if (pnum < 8) nbelow8++;
+ cumpow += peaklist[j].p_pow;
+ cumstrength += fsqrt(fsqrt(peaklist[j].p_pow));
+ stdev = (peaklist[j].p_width > MINBW ?
+ peaklist[j].p_width : MINBW);
+ weight = 1.0f / ((stdev*fipnum) * (stdev*fipnum));
+ freqden += weight;
+ freqnum += weight * peaklist[j].p_freq/fipnum;
#if 1
- if (x->x_nprint)
- {
- post("peak %d partial %d f=%f w=%f",
- j, pnum, peaklist[j].p_freq/fipnum, weight);
- }
+ if (x->x_nprint)
+ {
+ post("peak %d partial %d f=%f w=%f",
+ j, pnum, peaklist[j].p_freq/fipnum, weight);
+ }
#endif
- }
+ }
#if 1
- else if (x->x_nprint) post("peak %d partial %d dev %f",
- j, pnum, deviation);
+ else if (x->x_nprint) post("peak %d partial %d dev %f",
+ j, pnum, deviation);
#endif
- }
- if ((nbelow8 < 4 || npartials < 7) && cumpow < 0.01f * total_power)
- histvec[i].h_value = 0;
- else
- {
- float pitchpow = (cumstrength * cumstrength) *
- (cumstrength * cumstrength);
- float freqinbins = freqnum/freqden;
- /* check for minimum output frequency */
-
- if (freqinbins < MINFREQINBINS)
- histvec[i].h_value = 0;
- else
- {
- /* we passed all tests... save the values we got */
- histvec[i].h_pitch = ftom(hzperbin * freqnum/freqden);
- histvec[i].h_loud = (100.0f -DBFUDGE) +
- (LOGTODB) * log(pitchpow/n);
- }
- }
+ }
+ if ((nbelow8 < 4 || npartials < 7) && cumpow < 0.01f * total_power)
+ histvec[i].h_value = 0;
+ else
+ {
+ float pitchpow = (cumstrength * cumstrength) *
+ (cumstrength * cumstrength);
+ float freqinbins = freqnum/freqden;
+ /* check for minimum output frequency */
+
+ if (freqinbins < MINFREQINBINS)
+ histvec[i].h_value = 0;
+ else
+ {
+ /* we passed all tests... save the values we got */
+ histvec[i].h_pitch = ftom(hzperbin * freqnum/freqden);
+ histvec[i].h_loud = (100.0f -DBFUDGE) +
+ (LOGTODB) * log(pitchpow/n);
+ }
+ }
}
#if 1
if (x->x_nprint)
{
- for (i = 0; i < npitch; i++)
- {
- if (histvec[i].h_value > 0)
- post("index %d pit %f loud %f", histvec[i].h_index,
- histvec[i].h_pitch, histvec[i].h_loud);
- else post("-- cancelled --");
- }
+ for (i = 0; i < npitch; i++)
+ {
+ if (histvec[i].h_value > 0)
+ post("index %d pit %f loud %f", histvec[i].h_index,
+ histvec[i].h_pitch, histvec[i].h_loud);
+ else post("-- cancelled --");
+ }
}
#endif
- /* now try to find continuous pitch tracks that match the new
- * pitches. First mark each peak unmatched.
- */
+ /* now try to find continuous pitch tracks that match the new
+ * pitches. First mark each peak unmatched.
+ */
for (i = 0, hp1 = histvec; i < npitch; i++, hp1++)
- hp1->h_used = 0;
+ hp1->h_used = 0;
- /* for each old pitch, try to match a new one to it. */
+ /* for each old pitch, try to match a new one to it. */
for (i = 0, phist = x->x_hist; i < x->x_npitch; i++, phist++)
{
- float thispitch = phist->h_pitches[oldphase];
- phist->h_pitch = 0; /* no output, thanks */
- phist->h_wherefrom = 0;
- if (thispitch == 0.0f) continue;
- for (j = 0, hp1 = histvec; j < npitch; j++, hp1++)
- if ((hp1->h_value > 0) && hp1->h_pitch > thispitch - GLISS
- && hp1->h_pitch < thispitch + GLISS)
- {
- phist->h_wherefrom = hp1;
- hp1->h_used = 1;
- }
+ float thispitch = phist->h_pitches[oldphase];
+ phist->h_pitch = 0; /* no output, thanks */
+ phist->h_wherefrom = 0;
+ if (thispitch == 0.0f) continue;
+ for (j = 0, hp1 = histvec; j < npitch; j++, hp1++)
+ if ((hp1->h_value > 0) && hp1->h_pitch > thispitch - GLISS
+ && hp1->h_pitch < thispitch + GLISS)
+ {
+ phist->h_wherefrom = hp1;
+ hp1->h_used = 1;
+ }
}
for (i = 0, hp1 = histvec; i < npitch; i++, hp1++)
- if ((hp1->h_value > 0) && !hp1->h_used)
+ if ((hp1->h_value > 0) && !hp1->h_used)
{
- for (j = 0, phist = x->x_hist; j < x->x_npitch; j++, phist++)
- if (!phist->h_wherefrom)
- {
- phist->h_wherefrom = hp1;
- phist->h_age = 0;
- phist->h_noted = 0;
- hp1->h_used = 1;
- goto happy;
- }
- break;
+ for (j = 0, phist = x->x_hist; j < x->x_npitch; j++, phist++)
+ if (!phist->h_wherefrom)
+ {
+ phist->h_wherefrom = hp1;
+ phist->h_age = 0;
+ phist->h_noted = 0;
+ hp1->h_used = 1;
+ goto happy;
+ }
+ break;
happy: ;
}
- /* copy the pitch info into the history vector */
+ /* copy the pitch info into the history vector */
for (i = 0, phist = x->x_hist; i < x->x_npitch; i++, phist++)
{
- if (phist->h_wherefrom)
- {
- phist->h_amps[newphase] = phist->h_wherefrom->h_loud;
- phist->h_pitches[newphase] =
- phist->h_wherefrom->h_pitch;
- (phist->h_age)++;
- }
- else
- {
- phist->h_age = 0;
- phist->h_amps[newphase] = phist->h_pitches[newphase] = 0;
- }
+ if (phist->h_wherefrom)
+ {
+ phist->h_amps[newphase] = phist->h_wherefrom->h_loud;
+ phist->h_pitches[newphase] =
+ phist->h_wherefrom->h_pitch;
+ (phist->h_age)++;
+ }
+ else
+ {
+ phist->h_age = 0;
+ phist->h_amps[newphase] = phist->h_pitches[newphase] = 0;
+ }
}
#if 1
if (x->x_nprint)
{
- post("vibrato %d %f", x->x_vibbins, x->x_vibdepth);
- for (i = 0, phist = x->x_hist; i < x->x_npitch; i++, phist++)
- {
- post("noted %f, age %d", phist->h_noted, phist->h_age);
+ post("vibrato %d %f", x->x_vibbins, x->x_vibdepth);
+ for (i = 0, phist = x->x_hist; i < x->x_npitch; i++, phist++)
+ {
+ post("noted %f, age %d", phist->h_noted, phist->h_age);
#ifndef I860
- post("values %f %f %f %f %f",
- phist->h_pitches[newphase],
- phist->h_pitches[(newphase + HISTORY-1)%HISTORY],
- phist->h_pitches[(newphase + HISTORY-2)%HISTORY],
- phist->h_pitches[(newphase + HISTORY-3)%HISTORY],
- phist->h_pitches[(newphase + HISTORY-4)%HISTORY]);
+ post("values %f %f %f %f %f",
+ phist->h_pitches[newphase],
+ phist->h_pitches[(newphase + HISTORY-1)%HISTORY],
+ phist->h_pitches[(newphase + HISTORY-2)%HISTORY],
+ phist->h_pitches[(newphase + HISTORY-3)%HISTORY],
+ phist->h_pitches[(newphase + HISTORY-4)%HISTORY]);
#endif
- }
+ }
}
#endif
- /* look for envelope attacks */
+ /* look for envelope attacks */
x->x_attackvalue = 0;
if (x->x_peaked)
{
- if (total_db > x->x_amphi)
- {
- int binlook = newphase - x->x_attackbins;
- if (binlook < 0) binlook += HISTORY;
- if (total_db > x->x_dbs[binlook] + x->x_attackthresh)
- {
- x->x_attackvalue = 1;
- x->x_peaked = 0;
- }
- }
+ if (total_db > x->x_amphi)
+ {
+ int binlook = newphase - x->x_attackbins;
+ if (binlook < 0) binlook += HISTORY;
+ if (total_db > x->x_dbs[binlook] + x->x_attackthresh)
+ {
+ x->x_attackvalue = 1;
+ x->x_peaked = 0;
+ }
+ }
}
else
{
- int binlook = newphase - x->x_attackbins;
- if (binlook < 0) binlook += HISTORY;
- if (x->x_dbs[binlook] > x->x_amphi && x->x_dbs[binlook] > total_db)
- x->x_peaked = 1;
+ int binlook = newphase - x->x_attackbins;
+ if (binlook < 0) binlook += HISTORY;
+ if (x->x_dbs[binlook] > x->x_amphi && x->x_dbs[binlook] > total_db)
+ x->x_peaked = 1;
}
- /* for each current frequency track, test for a new note using a
- * stability criterion. Later perhaps we should also do as in
- * pitch~ and check for unstable notes a posteriori when
- * there's a new attack with no note found since the last onset;
- * but what's an attack &/or onset when we're polyphonic?
- */
+ /* for each current frequency track, test for a new note using a
+ * stability criterion. Later perhaps we should also do as in
+ * pitch~ and check for unstable notes a posteriori when
+ * there's a new attack with no note found since the last onset;
+ * but what's an attack &/or onset when we're polyphonic?
+ */
for (i = 0, phist = x->x_hist; i < x->x_npitch; i++, phist++)
{
- /*
- * if we've found a pitch but we've now strayed from it turn
- * it off.
- */
- if (phist->h_noted)
- {
- if (phist->h_pitches[newphase] > phist->h_noted + x->x_vibdepth
- || phist->h_pitches[newphase] < phist->h_noted - x->x_vibdepth)
- phist->h_noted = 0;
- }
- else
- {
- if (phist->h_wherefrom && phist->h_age >= x->x_vibbins)
- {
- float centroid = 0;
- int not = 0;
- for (j = 0, k = newphase; j < x->x_vibbins; j++)
- {
- centroid += phist->h_pitches[k];
- k--;
- if (k < 0) k = HISTORY-1;
- }
- centroid /= x->x_vibbins;
- for (j = 0, k = newphase; j < x->x_vibbins; j++)
- {
- /* calculate deviation from norm */
- float dev = centroid - phist->h_pitches[k];
- k--;
- if (k < 0) k = HISTORY-1;
- if (dev > x->x_vibdepth ||
- -dev > x->x_vibdepth) not = 1;
- }
- if (!not)
- {
- phist->h_pitch = phist->h_noted = centroid;
- }
- }
- }
+ /*
+ * if we've found a pitch but we've now strayed from it turn
+ * it off.
+ */
+ if (phist->h_noted)
+ {
+ if (phist->h_pitches[newphase] > phist->h_noted + x->x_vibdepth
+ || phist->h_pitches[newphase] < phist->h_noted - x->x_vibdepth)
+ phist->h_noted = 0;
+ }
+ else
+ {
+ if (phist->h_wherefrom && phist->h_age >= x->x_vibbins)
+ {
+ float centroid = 0;
+ int not = 0;
+ for (j = 0, k = newphase; j < x->x_vibbins; j++)
+ {
+ centroid += phist->h_pitches[k];
+ k--;
+ if (k < 0) k = HISTORY-1;
+ }
+ centroid /= x->x_vibbins;
+ for (j = 0, k = newphase; j < x->x_vibbins; j++)
+ {
+ /* calculate deviation from norm */
+ float dev = centroid - phist->h_pitches[k];
+ k--;
+ if (k < 0) k = HISTORY-1;
+ if (dev > x->x_vibdepth ||
+ -dev > x->x_vibdepth) not = 1;
+ }
+ if (!not)
+ {
+ phist->h_pitch = phist->h_noted = centroid;
+ }
+ }
+ }
}
return;
nopow:
for (i = 0; i < x->x_npitch; i++)
{
- x->x_hist[i].h_pitch = x->x_hist[i].h_noted =
- x->x_hist[i].h_pitches[newphase] =
- x->x_hist[i].h_amps[newphase] = 0;
- x->x_hist[i].h_age = 0;
+ x->x_hist[i].h_pitch = x->x_hist[i].h_noted =
+ x->x_hist[i].h_pitches[newphase] =
+ x->x_hist[i].h_amps[newphase] = 0;
+ x->x_hist[i].h_age = 0;
}
x->x_peaked = 1;
x->x_dbage = 0;
@@ -1057,19 +1051,19 @@ static void sigfiddle_freebird(t_sigfiddle *x)
{
if (x->x_inbuf)
{
- freebytes(x->x_inbuf, sizeof(float) * x->x_hop);
- x->x_inbuf = 0;
+ freebytes(x->x_inbuf, sizeof(float) * x->x_hop);
+ x->x_inbuf = 0;
}
if (x->x_lastanalysis)
{
- freebytes(x->x_lastanalysis,
- sizeof(float) * (2 * x->x_hop + 4 * FILTSIZE));
- x->x_lastanalysis = 0;
+ freebytes(x->x_lastanalysis,
+ sizeof(float) * (2 * x->x_hop + 4 * FILTSIZE));
+ x->x_lastanalysis = 0;
}
if (x->x_spiral)
{
- freebytes(x->x_spiral, sizeof(float) * 2 * x->x_hop);
- x->x_spiral = 0;
+ freebytes(x->x_spiral, sizeof(float) * 2 * x->x_hop);
+ x->x_spiral = 0;
}
x->x_hop = 0;
}
@@ -1080,29 +1074,29 @@ int sigfiddle_setnpoints(t_sigfiddle *x, t_floatarg fnpoints)
sigfiddle_freebird(x);
if (npoints < MINPOINTS || npoints > MAXPOINTS)
{
- error("fiddle~: npoints out of range; using %d",
- npoints = DEFAULTPOINTS);
+ error("fiddle~: npoints out of range; using %d",
+ npoints = DEFAULTPOINTS);
}
if (npoints != (1 << sigfiddle_ilog2(npoints)))
{
- error("fiddle~: npoints not a power of 2; using %d",
- npoints = (1 << sigfiddle_ilog2(npoints)));
+ error("fiddle~: npoints not a power of 2; using %d",
+ npoints = (1 << sigfiddle_ilog2(npoints)));
}
x->x_hop = npoints >> 1;
if (!(x->x_inbuf = (float *)getbytes(sizeof(float) * x->x_hop)))
- goto fail;
+ goto fail;
if (!(x->x_lastanalysis = (float *)getbytes(
- sizeof(float) * (2 * x->x_hop + 4 * FILTSIZE))))
- goto fail;
+ sizeof(float) * (2 * x->x_hop + 4 * FILTSIZE))))
+ goto fail;
if (!(x->x_spiral = (float *)getbytes(sizeof(float) * 2 * x->x_hop)))
- goto fail;
+ goto fail;
for (i = 0; i < x->x_hop; i++)
- x->x_inbuf[i] = 0;
+ x->x_inbuf[i] = 0;
for (i = 0; i < npoints + 4 * FILTSIZE; i++)
- x->x_lastanalysis[i] = 0;
+ x->x_lastanalysis[i] = 0;
for (i = 0; i < x->x_hop; i++)
- x->x_spiral[2*i] = cos((3.14159*i)/(npoints)),
- x->x_spiral[2*i+1] = -sin((3.14159*i)/(npoints));
+ x->x_spiral[2*i] = cos((3.14159*i)/(npoints)),
+ x->x_spiral[2*i+1] = -sin((3.14159*i)/(npoints));
x->x_phase = 0;
return (1);
fail:
@@ -1126,36 +1120,36 @@ int sigfiddle_doinit(t_sigfiddle *x, long npoints, long npitch,
else if (npitch > MAXNPITCH) npitch = MAXNPITCH;
if (npeakanal && !npitch) npitch = 1;
if (!npoints)
- npoints = DEFAULTPOINTS;
+ npoints = DEFAULTPOINTS;
if (!sigfiddle_setnpoints(x, npoints))
{
- error("fiddle~: out of memory");
- return (0);
+ error("fiddle~: out of memory");
+ return (0);
}
if (!(buf4 = (t_peakout *)getbytes(sizeof(*buf4) * npeakout)))
{
- sigfiddle_freebird(x);
- error("fiddle~: out of memory");
- return (0);
+ sigfiddle_freebird(x);
+ error("fiddle~: out of memory");
+ return (0);
}
for (i = 0; i < npeakout; i++)
- buf4[i].po_freq = buf4[i].po_amp = 0;
+ buf4[i].po_freq = buf4[i].po_amp = 0;
x->x_peakbuf = buf4;
x->x_npeakout = npeakout;
x->x_npeakanal = npeakanal;
x->x_phase = 0;
x->x_histphase = 0;
- x->x_sr = 44100; /* this and the next are filled in later */
+ x->x_sr = 44100; /* this and the next are filled in later */
for (i = 0; i < MAXNPITCH; i++)
{
- int j;
- x->x_hist[i].h_pitch = x->x_hist[i].h_noted = 0;
- x->x_hist[i].h_age = 0;
- x->x_hist[i].h_wherefrom = 0;
- x->x_hist[i].h_outlet = 0;
- for (j = 0; j < HISTORY; j++)
- x->x_hist[i].h_amps[j] = x->x_hist[i].h_pitches[j] = 0;
+ int j;
+ x->x_hist[i].h_pitch = x->x_hist[i].h_noted = 0;
+ x->x_hist[i].h_age = 0;
+ x->x_hist[i].h_wherefrom = 0;
+ x->x_hist[i].h_outlet = 0;
+ for (j = 0; j < HISTORY; j++)
+ x->x_hist[i].h_amps[j] = x->x_hist[i].h_pitches[j] = 0;
}
x->x_nprint = 0;
x->x_npitch = npitch;
@@ -1166,10 +1160,10 @@ int sigfiddle_doinit(t_sigfiddle *x, long npoints, long npitch,
x->x_amplo = DEFAMPLO;
x->x_amphi = DEFAMPHI;
x->x_attacktime = DEFATTACKTIME;
- x->x_attackbins = 1; /* real value calculated afterward */
+ x->x_attackbins = 1; /* real value calculated afterward */
x->x_attackthresh = DEFATTACKTHRESH;
x->x_vibtime = DEFVIBTIME;
- x->x_vibbins = 1; /* real value calculated afterward */
+ x->x_vibbins = 1; /* real value calculated afterward */
x->x_vibdepth = DEFVIBDEPTH;
x->x_npartial = 7;
x->x_attackvalue = 0;
@@ -1238,15 +1232,15 @@ void ftl_sigfiddle(fts_word_t *a)
int count;
float *fp, *fp2;
for (count = 0, fp = x->x_inbuf + x->x_phase;
- count < n_tick; count++) *fp++ = *in++;
+ count < n_tick; count++) *fp++ = *in++;
if (fp == x->x_inbuf + x->x_hop)
{
- sigfiddle_doit(x);
- x->x_phase = 0;
+ sigfiddle_doit(x);
+ x->x_phase = 0;
fts_alarm_set_delay(&x->x_clock, 0L); /* output bang */
fts_alarm_arm(&x->x_clock);
- if (x->x_nprint) x->x_nprint--;
+ if (x->x_nprint) x->x_nprint--;
}
else x->x_phase += n_tick;
}
@@ -1277,14 +1271,14 @@ void sigfiddle_tick(fts_alarm_t *alarm, void *p)
fts_outlet_float(o, OUTLETpower, x->x_dbs[x->x_histphase]);
for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
{
- fts_atom_t at[2];
- fts_set_float(at, ph->h_pitches[x->x_histphase]);
- fts_set_float(at+1, ph->h_amps[x->x_histphase]);
- fts_outlet_list(o, OUTLETmicropitch3 - i, 2, at);
+ fts_atom_t at[2];
+ fts_set_float(at, ph->h_pitches[x->x_histphase]);
+ fts_set_float(at+1, ph->h_amps[x->x_histphase]);
+ fts_outlet_list(o, OUTLETmicropitch3 - i, 2, at);
}
if (x->x_attackvalue) fts_outlet_bang(o, OUTLETattack);
for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
- if (ph->h_pitch) fts_outlet_float(o, OUTLETpitch, ph->h_pitch);
+ if (ph->h_pitch) fts_outlet_float(o, OUTLETpitch, ph->h_pitch);
}
static void sigfiddle_delete(fts_object_t *o, int winlet, fts_symbol_t *s, int ac,
@@ -1310,12 +1304,12 @@ static void sigfiddle_init(fts_object_t *o, int winlet, fts_symbol_t *s, int ac,
if (!sigfiddle_doinit(x, npoints, npitch, npeakanal, npeakout))
{
- post("fiddle~: initialization failed");
- return;
+ post("fiddle~: initialization failed");
+ return;
}
hop = npoints>>1;
if (fts_fft_declaresize(hop) != fts_Success)
- post("fiddle~: bad FFT size");
+ post("fiddle~: bad FFT size");
fts_alarm_init(&(x->x_clock), 0, sigfiddle_tick, x);
dsp_list_insert(o);
@@ -1344,13 +1338,13 @@ static fts_status_t sigfiddle_instantiate(fts_class_t *cl, int ac,
fts_method_define(cl, 0, fts_new_symbol("print"), sigfiddle_print13, 0, a);
fts_method_define(cl, 0, fts_new_symbol("debug"), sigfiddle_debug13, 0, a);
fts_method_define(cl, 0, fts_new_symbol("amp-range"), sigfiddle_amprange13,
- 0, a);
+ 0, a);
fts_method_define(cl, 0, fts_new_symbol("reattack"), sigfiddle_reattack13,
- 0, a);
+ 0, a);
fts_method_define(cl, 0, fts_new_symbol("vibrato"), sigfiddle_vibrato13,
- 0, a);
+ 0, a);
fts_method_define(cl, 0, fts_new_symbol("npartial"), sigfiddle_npartial13,
- 0, a);
+ 0, a);
/* classes signal inlets */
dsp_sig_inlet(cl, 0); /* declare signal input #0 */
@@ -1385,7 +1379,7 @@ void fiddle_config(void)
fts_module_t fiddle_module =
{"fiddle", "sonic meat fiddle", fiddle_config, 0};
-#endif /* JMAX */
+#endif /* JMAX */
#ifdef PD
@@ -1397,15 +1391,15 @@ static t_int *fiddle_perform(t_int *w)
int count;
float *fp;
if (!x->x_hop)
- goto nono;
+ goto nono;
for (count = 0, fp = x->x_inbuf + x->x_phase; count < n; count++)
- *fp++ = *in++;
+ *fp++ = *in++;
if (fp == x->x_inbuf + x->x_hop)
{
- sigfiddle_doit(x);
- x->x_phase = 0;
- if (x->x_auto) clock_delay(x->x_clock, 0L);
- if (x->x_nprint) x->x_nprint--;
+ sigfiddle_doit(x);
+ x->x_phase = 0;
+ if (x->x_auto) clock_delay(x->x_clock, 0L);
+ if (x->x_nprint) x->x_nprint--;
}
else x->x_phase += n;
nono:
@@ -1430,39 +1424,39 @@ void sigfiddle_bang(t_sigfiddle *x)
t_pitchhist *ph;
if (x->x_npeakout)
{
- int npeakout = x->x_npeakout;
- t_peakout *po;
- for (i = 0, po = x->x_peakbuf; i < npeakout; i++, po++)
- {
- t_atom at[3];
- SETFLOAT(at, i+1);
- SETFLOAT(at+1, po->po_freq);
- SETFLOAT(at+2, po->po_amp);
- outlet_list(x->x_peakout, 0, 3, at);
- }
+ int npeakout = x->x_npeakout;
+ t_peakout *po;
+ for (i = 0, po = x->x_peakbuf; i < npeakout; i++, po++)
+ {
+ t_atom at[3];
+ SETFLOAT(at, i+1);
+ SETFLOAT(at+1, po->po_freq);
+ SETFLOAT(at+2, po->po_amp);
+ outlet_list(x->x_peakout, 0, 3, at);
+ }
}
outlet_float(x->x_envout, x->x_dbs[x->x_histphase]);
for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
{
- t_atom at[2];
- SETFLOAT(at, ph->h_pitches[x->x_histphase]);
- SETFLOAT(at+1, ph->h_amps[x->x_histphase]);
- outlet_list(ph->h_outlet, 0, 2, at);
+ t_atom at[2];
+ SETFLOAT(at, ph->h_pitches[x->x_histphase]);
+ SETFLOAT(at+1, ph->h_amps[x->x_histphase]);
+ outlet_list(ph->h_outlet, 0, 2, at);
}
if (x->x_attackvalue) outlet_bang(x->x_attackout);
for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
- if (ph->h_pitch) outlet_float(x->x_noteout, ph->h_pitch);
+ if (ph->h_pitch) outlet_float(x->x_noteout, ph->h_pitch);
}
-void sigfiddle_ff(t_sigfiddle *x) /* cleanup on free */
+void sigfiddle_ff(t_sigfiddle *x) /* cleanup on free */
{
if (x->x_inbuf)
{
- freebytes(x->x_inbuf, sizeof(float) * x->x_hop);
- freebytes(x->x_lastanalysis, sizeof(float) * (2*x->x_hop + 4 * FILTSIZE));
- freebytes(x->x_spiral, sizeof(float) * 2*x->x_hop);
- freebytes(x->x_peakbuf, sizeof(*x->x_peakbuf) * x->x_npeakout);
- clock_free(x->x_clock);
+ freebytes(x->x_inbuf, sizeof(float) * x->x_hop);
+ freebytes(x->x_lastanalysis, sizeof(float) * (2*x->x_hop + 4 * FILTSIZE));
+ freebytes(x->x_spiral, sizeof(float) * 2*x->x_hop);
+ freebytes(x->x_peakbuf, sizeof(*x->x_peakbuf) * x->x_npeakout);
+ clock_free(x->x_clock);
}
}
@@ -1477,19 +1471,19 @@ void *sigfiddle_new(t_floatarg npoints, t_floatarg npitch,
if (!sigfiddle_doinit(x, npoints, npitch,
- npeakanal, npeakout))
+ npeakanal, npeakout))
{
- x->x_inbuf = 0; /* prevent the free routine from cleaning up */
- pd_free(&x->x_ob.ob_pd);
- return (0);
+ x->x_inbuf = 0; /* prevent the free routine from cleaning up */
+ pd_free(&x->x_ob.ob_pd);
+ return (0);
}
x->x_noteout = outlet_new(&x->x_ob, gensym("float"));
x->x_attackout = outlet_new(&x->x_ob, gensym("bang"));
for (i = 0; i < x->x_npitch; i++)
- x->x_hist[i].h_outlet = outlet_new(&x->x_ob, gensym("list"));
+ x->x_hist[i].h_outlet = outlet_new(&x->x_ob, gensym("list"));
x->x_envout = outlet_new(&x->x_ob, gensym("float"));
if (x->x_npeakout)
- x->x_peakout = outlet_new(&x->x_ob, gensym("list"));
+ x->x_peakout = outlet_new(&x->x_ob, gensym("list"));
else x->x_peakout = 0;
x->x_clock = clock_new(&x->x_ob.ob_pd, (t_method)sigfiddle_bang);
return (x);
@@ -1498,30 +1492,30 @@ void *sigfiddle_new(t_floatarg npoints, t_floatarg npitch,
void fiddle_tilde_setup(void)
{
sigfiddle_class = class_new(gensym("fiddle~"), (t_newmethod)sigfiddle_new,
- (t_method)sigfiddle_ff, sizeof(t_sigfiddle), 0,
- A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
+ (t_method)sigfiddle_ff, sizeof(t_sigfiddle), 0,
+ A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
class_addmethod(sigfiddle_class, (t_method)sigfiddle_dsp,
- gensym("dsp"), 0);
+ gensym("dsp"), 0);
class_addmethod(sigfiddle_class, (t_method)sigfiddle_debug,
- gensym("debug"), 0);
+ gensym("debug"), 0);
class_addmethod(sigfiddle_class, (t_method)sigfiddle_setnpoints,
- gensym("npoints"), A_FLOAT, 0);
+ gensym("npoints"), A_FLOAT, 0);
class_addmethod(sigfiddle_class, (t_method)sigfiddle_amprange,
- gensym("amp-range"), A_FLOAT, A_FLOAT, 0);
+ gensym("amp-range"), A_FLOAT, A_FLOAT, 0);
class_addmethod(sigfiddle_class, (t_method)sigfiddle_reattack,
- gensym("reattack"), A_FLOAT, A_FLOAT, 0);
+ gensym("reattack"), A_FLOAT, A_FLOAT, 0);
class_addmethod(sigfiddle_class, (t_method)sigfiddle_vibrato,
- gensym("vibrato"), A_FLOAT, A_FLOAT, 0);
+ gensym("vibrato"), A_FLOAT, A_FLOAT, 0);
class_addmethod(sigfiddle_class, (t_method)sigfiddle_npartial,
- gensym("npartial"), A_FLOAT, 0);
+ gensym("npartial"), A_FLOAT, 0);
class_addmethod(sigfiddle_class, (t_method)sigfiddle_auto,
- gensym("auto"), A_FLOAT, 0);
+ gensym("auto"), A_FLOAT, 0);
class_addmethod(sigfiddle_class, (t_method)sigfiddle_print,
- gensym("print"), 0);
+ gensym("print"), 0);
class_addmethod(sigfiddle_class, nullfn, gensym("signal"), 0);
class_addbang(sigfiddle_class, sigfiddle_bang);
class_addcreator((t_newmethod)sigfiddle_new, gensym("fiddle"),
- A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
+ A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0);
post(fiddle_version);
}
@@ -1538,13 +1532,13 @@ void cu_fiddle(float *in1, t_sigfiddle *x, int n)
int count;
float *fp, *fp2;
for (count = 0, fp = x->x_inbuf + x->x_phase;
- count < n; count++) *fp++ = *in1++;
+ count < n; count++) *fp++ = *in1++;
if (fp == x->x_inbuf + x->x_hop)
{
- sigfiddle_doit(x);
- x->x_phase = 0;
- if (x->x_auto) clock_delay(x->x_clock, 0L);
- if (x->x_nprint) x->x_nprint--;
+ sigfiddle_doit(x);
+ x->x_phase = 0;
+ if (x->x_auto) clock_delay(x->x_clock, 0L);
+ if (x->x_nprint) x->x_nprint--;
}
else x->x_phase += n;
}
@@ -1553,41 +1547,41 @@ void sigfiddle_put(t_sigfiddle *x, long whether)
{
if (whether)
{
- u_stdout(x);
- x->x_sr = x->x_io[0]->s_sr;
- sigfiddle_reattack(x, x->x_attacktime, x->x_attackthresh);
- sigfiddle_vibrato(x, x->x_vibtime, x->x_vibdepth);
- dspchain_addc(cu_fiddle, 3,
- x->x_io[0]->s_shit, x, x->x_io[0]->s_n);
+ u_stdout(x);
+ x->x_sr = x->x_io[0]->s_sr;
+ sigfiddle_reattack(x, x->x_attacktime, x->x_attackthresh);
+ sigfiddle_vibrato(x, x->x_vibtime, x->x_vibdepth);
+ dspchain_addc(cu_fiddle, 3,
+ x->x_io[0]->s_shit, x, x->x_io[0]->s_n);
}
}
-void sigfiddle_tick(t_sigfiddle *x) /* callback function for the clock */
+void sigfiddle_tick(t_sigfiddle *x) /* callback function for the clock */
{
int i;
t_pitchhist *ph;
outlet_float(x->x_envout, x->x_dbs[x->x_histphase]);
for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
{
- t_atom at[2];
- SETFLOAT(at, ph->h_pitches[x->x_histphase]);
- SETFLOAT(at+1, ph->h_amps[x->x_histphase]);
- outlet_list(ph->h_outlet, NIL, 2, at);
+ t_atom at[2];
+ SETFLOAT(at, ph->h_pitches[x->x_histphase]);
+ SETFLOAT(at+1, ph->h_amps[x->x_histphase]);
+ outlet_list(ph->h_outlet, NIL, 2, at);
}
if (x->x_attackvalue) outlet_bang(x->x_attackout);
for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
- if (ph->h_pitch) outlet_float(x->x_noteout, ph->h_pitch);
+ if (ph->h_pitch) outlet_float(x->x_noteout, ph->h_pitch);
}
-void sigfiddle_ff(t_sigfiddle *x) /* cleanup on free */
+void sigfiddle_ff(t_sigfiddle *x) /* cleanup on free */
{
if (x->x_inbuf)
{
- freebytes(x->x_inbuf, sizeof(float) * x->x_hop);
- freebytes(x->x_lastanalysis, sizeof(float) * (2*x->x_hop + 4 * FILTSIZE));
- freebytes(x->x_spiral, sizeof(float) * 2*x->x_hop);
- clock_free(x->x_clock);
- u_clean(x);
+ freebytes(x->x_inbuf, sizeof(float) * x->x_hop);
+ freebytes(x->x_lastanalysis, sizeof(float) * (2*x->x_hop + 4 * FILTSIZE));
+ freebytes(x->x_spiral, sizeof(float) * 2*x->x_hop);
+ clock_free(x->x_clock);
+ u_clean(x);
}
}
@@ -1601,14 +1595,14 @@ void *sigfiddle_new(long npoints, long npitch,
if (!sigfiddle_doinit(x, npoints, npitch, npeakanal, npeakout))
{
- x->x_inbuf = 0; /* prevent the free routine from cleaning up */
- obj_free(x);
- return (0);
+ x->x_inbuf = 0; /* prevent the free routine from cleaning up */
+ obj_free(x);
+ return (0);
}
u_setup(x, IN1, OUT0);
x->x_envout = outlet_new(x, gensym("float"));
for (i = 0; i < x->x_npitch; i++)
- x->x_hist[i].h_outlet = outlet_new(x, gensym("list"));
+ x->x_hist[i].h_outlet = outlet_new(x, gensym("list"));
x->x_attackout = outlet_new(x, gensym("bang"));
x->x_noteout = outlet_new(x, gensym("float"));
x->x_clock = clock_new(x, sigfiddle_tick);
@@ -1618,8 +1612,8 @@ void *sigfiddle_new(long npoints, long npitch,
void fiddle_setup()
{
c_extern(&sigfiddle_class, sigfiddle_new, sigfiddle_ff,
- gensym("fiddle"), sizeof(t_sigfiddle), 0, A_DEFLONG, A_DEFLONG,
- A_DEFLONG, A_DEFLONG, 0);
+ gensym("fiddle"), sizeof(t_sigfiddle), 0, A_DEFLONG, A_DEFLONG,
+ A_DEFLONG, A_DEFLONG, 0);
c_addmess(sigfiddle_put, gensym("put"), A_CANT, 0);
c_addmess(sigfiddle_debug, gensym("debug"), 0);
c_addmess(sigfiddle_amprange, gensym("amp-range"), A_FLOAT, A_FLOAT, 0);
@@ -1627,7 +1621,7 @@ void fiddle_setup()
c_addmess(sigfiddle_vibrato, gensym("vibrato"), A_LONG, A_FLOAT, 0);
c_addmess(sigfiddle_npartial, gensym("npartial"), A_FLOAT, 0);
c_addmess(sigfiddle_print, gensym("print"), 0);
- u_inletmethod(0); /* one signal input */
+ u_inletmethod(0); /* one signal input */
#ifdef MAX
post(fiddle_version);
#endif
@@ -1648,17 +1642,17 @@ static t_int *fiddle_perform(t_int *w)
float *fp;
if (x->x_obj.z_disabled)
- goto skip;
+ goto skip;
for (count = 0, fp = x->x_inbuf + x->x_phase; count < n; count+=inc) {
- *fp++ = *in;
- in += inc;
+ *fp++ = *in;
+ in += inc;
}
if (fp == x->x_inbuf + x->x_hop)
{
- sigfiddle_doit(x);
- x->x_phase = 0;
- if (x->x_auto) clock_delay(x->x_clock, 0L);
- if (x->x_nprint) x->x_nprint--;
+ sigfiddle_doit(x);
+ x->x_phase = 0;
+ if (x->x_auto) clock_delay(x->x_clock, 0L);
+ if (x->x_nprint) x->x_nprint--;
}
else x->x_phase += n;
skip:
@@ -1668,147 +1662,142 @@ skip:
void sigfiddle_dsp(t_sigfiddle *x, t_signal **sp)
{
if (sp[0]->s_n > x->x_hop) {
- x->x_downsample = sp[0]->s_n / x->x_hop;
- post("* warning: fiddle~: will downsample input by %ld",x->x_downsample);
- x->x_sr = sp[0]->s_sr / x->x_downsample;
+ x->x_downsample = sp[0]->s_n / x->x_hop;
+ post("* warning: fiddle~: will downsample input by %ld",x->x_downsample);
+ x->x_sr = sp[0]->s_sr / x->x_downsample;
} else {
- x->x_downsample = 1;
- x->x_sr = sp[0]->s_sr;
- }
- sigfiddle_reattack(x, x->x_attacktime, x->x_attackthresh);
+ x->x_downsample = 1;
+ x->x_sr = sp[0]->s_sr;
+ }
+ sigfiddle_reattack(x, x->x_attacktime, x->x_attackthresh);
sigfiddle_vibrato(x, x->x_vibtime, x->x_vibdepth);
dsp_add(fiddle_perform, 3, sp[0]->s_vec, x, sp[0]->s_n);
}
-void sigfiddle_tick(t_sigfiddle *x) /* callback function for the clock MSP*/
+void sigfiddle_tick(t_sigfiddle *x) /* callback function for the clock MSP*/
{
int i;
t_pitchhist *ph;
if (x->x_npeakout)
{
- int npeakout = x->x_npeakout;
- t_peakout *po;
- for (i = 0, po = x->x_peakbuf; i < npeakout; i++, po++)
- {
- t_atom at[3];
- SETINT(at, i+1);
- SETFLOAT(at+1, po->po_freq);
- SETFLOAT(at+2, po->po_amp);
- outlet_list(x->x_peakout, 0, 3, at);
- }
+ int npeakout = x->x_npeakout;
+ t_peakout *po;
+ for (i = 0, po = x->x_peakbuf; i < npeakout; i++, po++)
+ {
+ t_atom at[3];
+ SETINT(at, i+1);
+ SETFLOAT(at+1, po->po_freq);
+ SETFLOAT(at+2, po->po_amp);
+ outlet_list(x->x_peakout, 0, 3, at);
+ }
}
outlet_float(x->x_envout, x->x_dbs[x->x_histphase]);
for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
{
- t_atom at[2];
- SETFLOAT(at, ph->h_pitches[x->x_histphase]);
- SETFLOAT(at+1, ph->h_amps[x->x_histphase]);
- outlet_list(ph->h_outlet, 0, 2, at);
+ t_atom at[2];
+ SETFLOAT(at, ph->h_pitches[x->x_histphase]);
+ SETFLOAT(at+1, ph->h_amps[x->x_histphase]);
+ outlet_list(ph->h_outlet, 0, 2, at);
}
if (x->x_attackvalue) outlet_bang(x->x_attackout);
for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
- if (ph->h_pitch) outlet_float(x->x_noteout, ph->h_pitch);
+ if (ph->h_pitch) outlet_float(x->x_noteout, ph->h_pitch);
}
-void sigfiddle_bang(t_sigfiddle *x) // MSP
+void sigfiddle_bang(t_sigfiddle *x)
{
int i;
t_pitchhist *ph;
if (x->x_npeakout)
{
- int npeakout = x->x_npeakout;
- t_peakout *po;
- for (i = 0, po = x->x_peakbuf; i < npeakout; i++, po++)
- {
- t_atom at[3];
- SETLONG(at, i+1);
- SETFLOAT(at+1, po->po_freq);
- SETFLOAT(at+2, po->po_amp);
- outlet_list(x->x_peakout, 0, 3, at);
- }
+ int npeakout = x->x_npeakout;
+ t_peakout *po;
+ for (i = 0, po = x->x_peakbuf; i < npeakout; i++, po++)
+ {
+ t_atom at[3];
+ SETLONG(at, i+1);
+ SETFLOAT(at+1, po->po_freq);
+ SETFLOAT(at+2, po->po_amp);
+ outlet_list(x->x_peakout, 0, 3, at);
+ }
}
outlet_float(x->x_envout, x->x_dbs[x->x_histphase]);
for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
{
- t_atom at[2];
- SETFLOAT(at, ph->h_pitches[x->x_histphase]);
- SETFLOAT(at+1, ph->h_amps[x->x_histphase]);
- outlet_list(ph->h_outlet, 0, 2, at);
+ t_atom at[2];
+ SETFLOAT(at, ph->h_pitches[x->x_histphase]);
+ SETFLOAT(at+1, ph->h_amps[x->x_histphase]);
+ outlet_list(ph->h_outlet, 0, 2, at);
}
if (x->x_attackvalue) outlet_bang(x->x_attackout);
for (i = 0, ph = x->x_hist; i < x->x_npitch; i++, ph++)
- if (ph->h_pitch) outlet_float(x->x_noteout, ph->h_pitch);
+ if (ph->h_pitch) outlet_float(x->x_noteout, ph->h_pitch);
}
-void sigfiddle_ff(t_sigfiddle *x) /* cleanup on free MSP */
+void sigfiddle_ff(t_sigfiddle *x) /* cleanup on free MSP */
{
if (x->x_inbuf)
{
- t_freebytes(x->x_inbuf, sizeof(float) * x->x_hop);
- t_freebytes(x->x_lastanalysis, sizeof(float) * (2*x->x_hop + 4 *
+ t_freebytes(x->x_inbuf, sizeof(float) * x->x_hop);
+ t_freebytes(x->x_lastanalysis, sizeof(float) * (2*x->x_hop + 4 *
FILTSIZE));
- t_freebytes(x->x_spiral, sizeof(float) * 2*x->x_hop);
- t_freebytes(x->x_peakbuf, sizeof(*x->x_peakbuf) * x->x_npeakout);
- //clock_free(x->x_clock);
+ t_freebytes(x->x_spiral, sizeof(float) * 2*x->x_hop);
+ t_freebytes(x->x_peakbuf, sizeof(*x->x_peakbuf) * x->x_npeakout);
}
- dsp_free((t_pxobject *)x); // Free the object
+ dsp_free((t_pxobject *)x);
}
void *sigfiddle_class;
-void *sigfiddle_new(long npoints, long npitch, // MSP
+void *sigfiddle_new(long npoints, long npitch,
long npeakanal, long npeakout)
{
t_sigfiddle *x = (t_sigfiddle *)newobject(sigfiddle_class);
int i;
if (!sigfiddle_doinit(x, npoints, npitch, npeakanal, npeakout))
- // MSP
{
- x->x_inbuf = 0; /* prevent the free routine from cleaning up */
- return (0);
+ x->x_inbuf = 0; /* prevent the free routine from cleaning up */
+ return (0);
}
- // post("npeak %d, npitch %d", npeakout, npitch);
- // set up the inlets and outlets.
- dsp_setup((t_pxobject *)x,1); // 1 input
+ dsp_setup((t_pxobject *)x,1);
x->x_clock = clock_new(x, (method)sigfiddle_tick);
if (x->x_npeakout)
- x->x_peakout = listout((t_object *)x); // listout?
+ x->x_peakout = listout((t_object *)x);
else x->x_peakout = 0;
x->x_envout = floatout((t_object *)x);
for (i = 0; i < x->x_npitch; i++)
- x->x_hist[i].h_outlet = listout((t_object *)x);
- x->x_attackout = bangout((t_object *)x);
- x->x_noteout = floatout((t_object *)x);
- return (x);
+ x->x_hist[i].h_outlet = listout((t_object *)x);
+ x->x_attackout = bangout((t_object *)x);
+ x->x_noteout = floatout((t_object *)x);
+ return (x);
}
-void main() // this can be called fiddle_setup if that name is the "Main"
-in PPC Linker prefs
+void main()
{
- setup(&sigfiddle_class, sigfiddle_new, (method)sigfiddle_ff,
- (short)sizeof(t_sigfiddle), 0L, A_DEFLONG, A_DEFLONG,
+ setup(&sigfiddle_class, sigfiddle_new, (method)sigfiddle_ff,
+ (short)sizeof(t_sigfiddle), 0L, A_DEFLONG, A_DEFLONG,
A_DEFLONG, A_DEFLONG, 0);
- addmess((method)sigfiddle_dsp, "dsp",
- A_CANT, 0);
- addmess((method)sigfiddle_debug, "debug", 0);
- addmess((method)sigfiddle_setnpoints, "npoints", A_FLOAT, 0);
- addmess((method)sigfiddle_amprange, "amp-range", A_FLOAT, A_FLOAT, 0);
- addmess((method)sigfiddle_reattack, "reattack", A_FLOAT, A_FLOAT, 0);
- addmess((method)sigfiddle_vibrato, "vibrato", A_FLOAT,
+ addmess((method)sigfiddle_dsp, "dsp",
+ A_CANT, 0);
+ addmess((method)sigfiddle_debug, "debug", 0);
+ addmess((method)sigfiddle_setnpoints, "npoints", A_FLOAT, 0);
+ addmess((method)sigfiddle_amprange, "amp-range", A_FLOAT, A_FLOAT, 0);
+ addmess((method)sigfiddle_reattack, "reattack", A_FLOAT, A_FLOAT, 0);
+ addmess((method)sigfiddle_vibrato, "vibrato", A_FLOAT,
A_FLOAT, 0);
- addmess((method)sigfiddle_npartial, "npartial", A_FLOAT, 0);
- addmess((method)sigfiddle_auto, "auto",
- A_FLOAT, 0);
- addmess((method)sigfiddle_print, "print", 0);
- addmess((method)sigfiddle_assist, "assist",
- A_CANT, 0);
- addbang((method)sigfiddle_bang);
+ addmess((method)sigfiddle_npartial, "npartial", A_FLOAT, 0);
+ addmess((method)sigfiddle_auto, "auto",
+ A_FLOAT, 0);
+ addmess((method)sigfiddle_print, "print", 0);
+ addmess((method)sigfiddle_assist, "assist",
+ A_CANT, 0);
+ addbang((method)sigfiddle_bang);
dsp_initclass();
rescopy('STR#',3748);
post(fiddle_version);
@@ -1816,39 +1805,41 @@ A_FLOAT, 0);
void sigfiddle_assist(t_sigfiddle *x, void *b, long m, long a, char *s)
{
- assist_string(3748,m,a,1,2,s);
+ assist_string(3748,m,a,1,2,s);
}
void msp_fft(float *buf, long np, long inv)
{
- float *src,*real,*rp,*imag,*ip;
- long i;
-
- // because this fft algorithm uses separate real and imaginary
- // buffers
- // we must split the real and imaginary parts into two buffers,
- // then do the opposite on output
- // a more ambitious person would either do an in-place conversion
- // or rewrite the fft algorithm
-
- real = rp = msp_ffttemp;
- imag = ip = real + MAXPOINTS;
- src = buf;
- for (i = 0; i < np; i++) {
- *rp++ = *src++;
- *ip++ = *src++;
- }
- if (inv)
- ifft(np,real,imag);
- else
- fft(np,real,imag);
- rp = real;
- ip = imag;
- src = buf;
- for (i = 0; i < np; i++) {
- *src++ = *rp++;
- *src++ = *ip++;
- }
+ float *src,*real,*rp,*imag,*ip;
+ long i;
+
+ /*
+ // because this fft algorithm uses separate real and imaginary
+ // buffers
+ // we must split the real and imaginary parts into two buffers,
+ // then do the opposite on output
+ // a more ambitious person would either do an in-place conversion
+ // or rewrite the fft algorithm
+ */
+
+ real = rp = msp_ffttemp;
+ imag = ip = real + MAXPOINTS;
+ src = buf;
+ for (i = 0; i < np; i++) {
+ *rp++ = *src++;
+ *ip++ = *src++;
+ }
+ if (inv)
+ ifft(np,real,imag);
+ else
+ fft(np,real,imag);
+ rp = real;
+ ip = imag;
+ src = buf;
+ for (i = 0; i < np; i++) {
+ *src++ = *rp++;
+ *src++ = *ip++;
+ }
}
#endif /* MSP */
diff --git a/pd/extra/loop~/loop~.c b/pd/extra/loop~/loop~.c
index 85588ba8..2f440030 100644
--- a/pd/extra/loop~/loop~.c
+++ b/pd/extra/loop~/loop~.c
@@ -24,61 +24,61 @@ typedef struct _loopctl
} t_loopctl;
static void loopctl_run(t_loopctl *x, float *transposein,
- float *windowin, float *rawout, float *windowout, int n)
+ float *windowin, float *rawout, float *windowout, int n)
{
float window, invwindow;
double phase = x->l_phase;
if (x->l_resync)
{
- window = *windowin;
- if (window < 0)
- {
- if (window > -1)
- window = -1;
- invwindow = -1/window;
- }
- else
- {
- if (window < 1)
- window = 1;
- invwindow = 1/window;
- }
- x->l_resync = 0;
+ window = *windowin;
+ if (window < 0)
+ {
+ if (window > -1)
+ window = -1;
+ invwindow = -1/window;
+ }
+ else
+ {
+ if (window < 1)
+ window = 1;
+ invwindow = 1/window;
+ }
+ x->l_resync = 0;
}
else
{
- window = x->l_window;
- phase = x->l_phase;
- invwindow = x->l_invwindow;
+ window = x->l_window;
+ phase = x->l_phase;
+ invwindow = x->l_invwindow;
}
while (n--)
{
- double phaseinc = invwindow * *transposein++;
- double newphase;
- float nwind = *windowin++;
- if (phaseinc >= 1 || phaseinc < 0)
- phaseinc = 0;
- newphase = phase + phaseinc;
- if (newphase >= 1)
- {
- window = nwind;
- if (window < 0)
- {
- if (window > -1)
- window = -1;
- invwindow = -1/window;
- }
- else
- {
- if (window < 1)
- window = 1;
- invwindow = 1/window;
- }
- newphase -= 1.;
- }
- phase = newphase;
- *rawout++ = (float)phase;
- *windowout++ = window;
+ double phaseinc = invwindow * *transposein++;
+ double newphase;
+ float nwind = *windowin++;
+ if (phaseinc >= 1 || phaseinc < 0)
+ phaseinc = 0;
+ newphase = phase + phaseinc;
+ if (newphase >= 1)
+ {
+ window = nwind;
+ if (window < 0)
+ {
+ if (window > -1)
+ window = -1;
+ invwindow = -1/window;
+ }
+ else
+ {
+ if (window < 1)
+ window = 1;
+ invwindow = 1/window;
+ }
+ newphase -= 1.;
+ }
+ phase = newphase;
+ *rawout++ = (float)phase;
+ *windowout++ = window;
}
x->l_invwindow = invwindow;
x->l_window = window;
@@ -95,7 +95,7 @@ static void loopctl_init(t_loopctl *x)
static void loopctl_set(t_loopctl *x, float val)
{
if (val < 0 || val > 1)
- val = 0;
+ val = 0;
x->l_phase = val;
x->l_resync = 1;
}
@@ -136,8 +136,8 @@ static t_int *loop_perform(t_int *w)
static void loop_dsp(t_loop *x, t_signal **sp)
{
dsp_add(loop_perform, 6,
- &x->x_loopctl, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec,
- sp[0]->s_n);
+ &x->x_loopctl, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec,
+ sp[0]->s_n);
}
static void loop_set(t_loop *x, t_floatarg val)
@@ -153,11 +153,11 @@ static void loop_bang(t_loop *x)
void loop_tilde_setup(void)
{
loop_class = class_new(gensym("loop~"), (t_newmethod)loop_new, 0,
- sizeof(t_loop), 0, 0);
+ sizeof(t_loop), 0, 0);
class_addmethod(loop_class, (t_method)loop_dsp, gensym("dsp"), A_CANT, 0);
CLASS_MAINSIGNALIN(loop_class, t_loop, x_f);
class_addmethod(loop_class, (t_method)loop_set, gensym("set"),
- A_DEFFLOAT, 0);
+ A_DEFFLOAT, 0);
class_addbang(loop_class, loop_bang);
}
diff --git a/pd/extra/lrshift~/lrshift~.c b/pd/extra/lrshift~/lrshift~.c
index 285696e2..ba1d5eeb 100644
--- a/pd/extra/lrshift~/lrshift~.c
+++ b/pd/extra/lrshift~/lrshift~.c
@@ -19,9 +19,9 @@ static t_int *leftshift_perform(t_int *w)
in += shift;
n -= shift;
while (n--)
- *out++ = *in++;
+ *out++ = *in++;
while (shift--)
- *out++ = 0;
+ *out++ = 0;
return (w+5);
}
@@ -34,9 +34,9 @@ static t_int *rightshift_perform(t_int *w)
n -= shift;
in -= shift;
while (n--)
- *--out = *--in;
+ *--out = *--in;
while (shift--)
- *--out = 0;
+ *--out = 0;
return (w+5);
}
@@ -45,14 +45,14 @@ static void lrshift_tilde_dsp(t_lrshift_tilde *x, t_signal **sp)
int n = sp[0]->s_n;
int shift = x->x_n;
if (shift > n)
- shift = n;
+ shift = n;
if (shift < -n)
- shift = -n;
+ shift = -n;
if (shift < 0)
- dsp_add(rightshift_perform, 4,
- sp[0]->s_vec + n, sp[1]->s_vec + n, n, -shift);
+ dsp_add(rightshift_perform, 4,
+ sp[0]->s_vec + n, sp[1]->s_vec + n, n, -shift);
else dsp_add(leftshift_perform, 4,
- sp[0]->s_vec, sp[1]->s_vec, n, shift);
+ sp[0]->s_vec, sp[1]->s_vec, n, shift);
}
static void *lrshift_tilde_new(t_floatarg f)
@@ -66,9 +66,9 @@ static void *lrshift_tilde_new(t_floatarg f)
void lrshift_tilde_setup(void)
{
lrshift_tilde_class = class_new(gensym("lrshift~"),
- (t_newmethod)lrshift_tilde_new, 0, sizeof(t_lrshift_tilde), 0,
- A_DEFFLOAT, 0);
+ (t_newmethod)lrshift_tilde_new, 0, sizeof(t_lrshift_tilde), 0,
+ A_DEFFLOAT, 0);
class_addmethod(lrshift_tilde_class, nullfn, gensym("signal"), 0);
class_addmethod(lrshift_tilde_class, (t_method)lrshift_tilde_dsp,
- gensym("dsp"), 0);
+ gensym("dsp"), 0);
}
diff --git a/pd/extra/pique/pique.c b/pd/extra/pique/pique.c
index aaf80350..f4cae5e1 100644
--- a/pd/extra/pique/pique.c
+++ b/pd/extra/pique/pique.c
@@ -47,7 +47,7 @@ static float hanning(float pidetune, float sinpidetune)
else if (pidetune > 3.14 && pidetune < 3.143) return (0.5);
else if (pidetune < -3.14 && pidetune > -3.143) return (0.5);
else return (sinpidetune/pidetune - 0.5 *
- (sinpidetune/(pidetune+pi) + sinpidetune/(pidetune-pi)));
+ (sinpidetune/(pidetune+pi) + sinpidetune/(pidetune-pi)));
}
static float peakerror(float *fpreal, float *fpimag, float pidetune,
@@ -57,23 +57,23 @@ static float peakerror(float *fpreal, float *fpimag, float pidetune,
float cospidetune = cos(pidetune);
float windowshould = hanning(pidetune, sinpidetune);
float realshould = windowshould * (
- peakreal * cospidetune + peakimag * sinpidetune);
+ peakreal * cospidetune + peakimag * sinpidetune);
float imagshould = windowshould * (
- peakimag * cospidetune - peakreal * sinpidetune);
+ peakimag * cospidetune - peakreal * sinpidetune);
float realgot = norm * (fpreal[0] - 0.5 * (fpreal[1] + fpreal[-1]));
float imaggot = norm * (fpimag[0] - 0.5 * (fpimag[1] + fpimag[-1]));
float realdev = realshould - realgot, imagdev = imagshould - imaggot;
/* post("real %f->%f; imag %f->%f", realshould, realgot,
- imagshould, imaggot); */
+ imagshould, imaggot); */
return (realdev * realdev + imagdev * imagdev);
}
static void pique_doit(int npts, t_float *fpreal, t_float *fpimag,
int npeak, int *nfound, t_float *fpfreq, t_float *fpamp,
- t_float *fpampre, t_float *fpampim, float errthresh)
+ t_float *fpampre, t_float *fpampim, float errthresh)
{
- float srate = sys_getsr(); /* not sure how to get this correctly */
+ float srate = sys_getsr(); /* not sure how to get this correctly */
float oneovern = 1.0/ (float)npts;
float fperbin = srate * oneovern;
float pow1, pow2 = 0, pow3 = 0, pow4 = 0, pow5 = 0;
@@ -82,91 +82,91 @@ static void pique_doit(int npts, t_float *fpreal, t_float *fpimag,
int count, peakcount = 0, n2 = (npts >> 1);
float *fp1, *fp2;
for (count = n2, fp1 = fpreal, fp2 = fpimag, powthresh = 0;
- count--; fp1++, fp2++)
- powthresh += (*fp1) * (*fp1) + (*fp2) * (*fp2) ;
+ count--; fp1++, fp2++)
+ powthresh += (*fp1) * (*fp1) + (*fp2) * (*fp2) ;
powthresh *= 0.00001;
for (count = 1; count < n2; count++)
{
- float windreal, windimag, pi = 3.14159;
- float detune, pidetune, sinpidetune, cospidetune,
- ampcorrect, freqout, ampout, ampoutreal, ampoutimag;
- float rpeak, rpeaknext, rpeakprev;
- float ipeak, ipeaknext, ipeakprev;
- float errleft, errright;
- fpreal++;
- fpimag++;
- re1 = re2;
- re2 = re3;
- re3 = *fpreal;
- im1 = im2;
- im2 = im3;
- im3 = *fpimag;
- if (count < 2) continue;
- pow1 = pow2;
- pow2 = pow3;
- pow3 = pow4;
- pow4 = pow5;
- /* get Hanning-windowed spectrum by convolution */
- windreal = re2 - 0.5 * (re1 + re3);
- windimag = im2 - 0.5 * (im1 + im3);
- pow5 = windreal * windreal + windimag * windimag;
- /* if (count < 30) post("power %f", pow5); */
- if (count < 5) continue;
- /* check for a peak. The actual bin is count-3. */
- if (pow3 <= pow2 || pow3 <= pow4 || pow3 <= pow1 || pow3 <= pow5
- || pow3 < powthresh)
- continue;
- /* go back for the raw FFT values around the peak. */
- rpeak = fpreal[-3];
- rpeaknext = fpreal[-2];
- rpeakprev = fpreal[-4];
- ipeak = fpimag[-3];
- ipeaknext = fpimag[-2];
- ipeakprev = fpimag[-4];
- /* recalculate Hanning-windowed spectrum by convolution */
- windreal = rpeak - 0.5 * (rpeaknext + rpeakprev);
- windimag = ipeak - 0.5 * (ipeaknext + ipeakprev);
-
- detune = ((rpeakprev - rpeaknext) *
- (2.0 * rpeak - rpeakprev - rpeaknext) +
- (ipeakprev - ipeaknext) *
- (2.0 * ipeak - ipeakprev - ipeaknext)) /
- (4.0 * pow3);
- /* if (count < 30) post("detune %f", detune); */
- if (detune > 0.7 || detune < -0.7) continue;
- /* the frequency is the sum of the bin frequency and detuning */
- freqout = fperbin * ((float)(count-3) + detune);
- pidetune = pi * detune;
- sinpidetune = sin(pidetune);
- cospidetune = cos(pidetune);
- ampcorrect = 1.0 / hanning(pidetune, sinpidetune);
- /* Multiply by 2 to get real-sinusoid peak amplitude
- and divide by N to normalize FFT */
- ampcorrect *= 2. * oneovern;
- /* amplitude is peak height, corrected for Hanning window shape */
+ float windreal, windimag, pi = 3.14159;
+ float detune, pidetune, sinpidetune, cospidetune,
+ ampcorrect, freqout, ampout, ampoutreal, ampoutimag;
+ float rpeak, rpeaknext, rpeakprev;
+ float ipeak, ipeaknext, ipeakprev;
+ float errleft, errright;
+ fpreal++;
+ fpimag++;
+ re1 = re2;
+ re2 = re3;
+ re3 = *fpreal;
+ im1 = im2;
+ im2 = im3;
+ im3 = *fpimag;
+ if (count < 2) continue;
+ pow1 = pow2;
+ pow2 = pow3;
+ pow3 = pow4;
+ pow4 = pow5;
+ /* get Hanning-windowed spectrum by convolution */
+ windreal = re2 - 0.5 * (re1 + re3);
+ windimag = im2 - 0.5 * (im1 + im3);
+ pow5 = windreal * windreal + windimag * windimag;
+ /* if (count < 30) post("power %f", pow5); */
+ if (count < 5) continue;
+ /* check for a peak. The actual bin is count-3. */
+ if (pow3 <= pow2 || pow3 <= pow4 || pow3 <= pow1 || pow3 <= pow5
+ || pow3 < powthresh)
+ continue;
+ /* go back for the raw FFT values around the peak. */
+ rpeak = fpreal[-3];
+ rpeaknext = fpreal[-2];
+ rpeakprev = fpreal[-4];
+ ipeak = fpimag[-3];
+ ipeaknext = fpimag[-2];
+ ipeakprev = fpimag[-4];
+ /* recalculate Hanning-windowed spectrum by convolution */
+ windreal = rpeak - 0.5 * (rpeaknext + rpeakprev);
+ windimag = ipeak - 0.5 * (ipeaknext + ipeakprev);
+
+ detune = ((rpeakprev - rpeaknext) *
+ (2.0 * rpeak - rpeakprev - rpeaknext) +
+ (ipeakprev - ipeaknext) *
+ (2.0 * ipeak - ipeakprev - ipeaknext)) /
+ (4.0 * pow3);
+ /* if (count < 30) post("detune %f", detune); */
+ if (detune > 0.7 || detune < -0.7) continue;
+ /* the frequency is the sum of the bin frequency and detuning */
+ freqout = fperbin * ((float)(count-3) + detune);
+ pidetune = pi * detune;
+ sinpidetune = sin(pidetune);
+ cospidetune = cos(pidetune);
+ ampcorrect = 1.0 / hanning(pidetune, sinpidetune);
+ /* Multiply by 2 to get real-sinusoid peak amplitude
+ and divide by N to normalize FFT */
+ ampcorrect *= 2. * oneovern;
+ /* amplitude is peak height, corrected for Hanning window shape */
- ampout = ampcorrect * sqrt(pow3);
- ampoutreal = ampcorrect *
- (windreal * cospidetune - windimag * sinpidetune);
- ampoutimag = ampcorrect *
- (windreal * sinpidetune + windimag * cospidetune);
- if (errthresh > 0)
- {
- /* post("peak %f %f", freqout, ampout); */
- errleft = peakerror(fpreal-4, fpimag-4, pidetune+pi,
- 2. * oneovern, ampoutreal, ampoutimag);
- errright = peakerror(fpreal-2, fpimag-2, pidetune-pi,
- 2. * oneovern, ampoutreal, ampoutimag);
- relativeerror = (errleft + errright)/(ampout * ampout);
- if (relativeerror > errthresh) continue;
- }
- /* post("power %f, error %f, relative %f",
- pow3, errleft + errright, relativeerror); */
- *fpfreq++ = freqout;
- *fpamp++ = ampout;
- *fpampre++ = ampoutreal;
- *fpampim++ = ampoutimag;
- if (++peakcount == npeak) break;
+ ampout = ampcorrect * sqrt(pow3);
+ ampoutreal = ampcorrect *
+ (windreal * cospidetune - windimag * sinpidetune);
+ ampoutimag = ampcorrect *
+ (windreal * sinpidetune + windimag * cospidetune);
+ if (errthresh > 0)
+ {
+ /* post("peak %f %f", freqout, ampout); */
+ errleft = peakerror(fpreal-4, fpimag-4, pidetune+pi,
+ 2. * oneovern, ampoutreal, ampoutimag);
+ errright = peakerror(fpreal-2, fpimag-2, pidetune-pi,
+ 2. * oneovern, ampoutreal, ampoutimag);
+ relativeerror = (errleft + errright)/(ampout * ampout);
+ if (relativeerror > errthresh) continue;
+ }
+ /* post("power %f, error %f, relative %f",
+ pow3, errleft + errright, relativeerror); */
+ *fpfreq++ = freqout;
+ *fpamp++ = ampout;
+ *fpampre++ = ampoutreal;
+ *fpampim++ = ampoutimag;
+ if (++peakcount == npeak) break;
}
*nfound = peakcount;
}
@@ -183,32 +183,32 @@ static void pique_list(t_pique *x, t_symbol *s, int argc, t_atom *argv)
if (npts < 8 || npeak < 1) error("pique: bad npoints or npeak");
if (npeak > x->x_n) npeak = x->x_n;
if (!(a = (t_garray *)pd_findbyclass(symreal, garray_class)) ||
- !garray_getfloatarray(a, &n, &fpreal) ||
- n < npts)
- error("%s: missing or bad array", symreal->s_name);
+ !garray_getfloatarray(a, &n, &fpreal) ||
+ n < npts)
+ error("%s: missing or bad array", symreal->s_name);
else if (!(a = (t_garray *)pd_findbyclass(symimag, garray_class)) ||
- !garray_getfloatarray(a, &n, &fpimag) ||
- n < npts)
- error("%s: missing or bad array", symimag->s_name);
+ !garray_getfloatarray(a, &n, &fpimag) ||
+ n < npts)
+ error("%s: missing or bad array", symimag->s_name);
else
{
- int nfound, i;
- float *fpfreq = x->x_freq;
- float *fpamp = x->x_amp;
- float *fpampre = x->x_ampre;
- float *fpampim = x->x_ampim;
- pique_doit(npts, fpreal, fpimag, npeak,
- &nfound, fpfreq, fpamp, fpampre, fpampim, x->x_errthresh);
- for (i = 0; i < nfound; i++, fpamp++, fpfreq++, fpampre++, fpampim++)
- {
- t_atom at[5];
- SETFLOAT(at, (float)i);
- SETFLOAT(at+1, *fpfreq);
- SETFLOAT(at+2, *fpamp);
- SETFLOAT(at+3, *fpampre);
- SETFLOAT(at+4, *fpampim);
- outlet_list(x->x_obj.ob_outlet, &s_list, 5, at);
- }
+ int nfound, i;
+ float *fpfreq = x->x_freq;
+ float *fpamp = x->x_amp;
+ float *fpampre = x->x_ampre;
+ float *fpampim = x->x_ampim;
+ pique_doit(npts, fpreal, fpimag, npeak,
+ &nfound, fpfreq, fpamp, fpampre, fpampim, x->x_errthresh);
+ for (i = 0; i < nfound; i++, fpamp++, fpfreq++, fpampre++, fpampim++)
+ {
+ t_atom at[5];
+ SETFLOAT(at, (float)i);
+ SETFLOAT(at+1, *fpfreq);
+ SETFLOAT(at+2, *fpamp);
+ SETFLOAT(at+3, *fpampre);
+ SETFLOAT(at+4, *fpampim);
+ outlet_list(x->x_obj.ob_outlet, &s_list, 5, at);
+ }
}
}
@@ -232,7 +232,7 @@ void pique_setup(void)
(t_method)pique_free, sizeof(t_pique),0, A_DEFFLOAT, 0);
class_addlist(pique_class, pique_list);
class_addmethod(pique_class, (t_method)pique_errthresh,
- gensym("errthresh"), A_FLOAT, 0);
+ gensym("errthresh"), A_FLOAT, 0);
post("pique 0.1 for PD version 23");
}
diff --git a/pd/portaudio/pa_common/pa_allocation.o b/pd/portaudio/pa_common/pa_allocation.o
deleted file mode 100644
index 43ac4148..00000000
--- a/pd/portaudio/pa_common/pa_allocation.o
+++ /dev/null
Binary files differ
diff --git a/pd/portaudio/pa_common/pa_converters.o b/pd/portaudio/pa_common/pa_converters.o
deleted file mode 100644
index 3baede8e..00000000
--- a/pd/portaudio/pa_common/pa_converters.o
+++ /dev/null
Binary files differ
diff --git a/pd/portaudio/pa_common/pa_cpuload.o b/pd/portaudio/pa_common/pa_cpuload.o
deleted file mode 100644
index bc599f45..00000000
--- a/pd/portaudio/pa_common/pa_cpuload.o
+++ /dev/null
Binary files differ
diff --git a/pd/portaudio/pa_common/pa_dither.o b/pd/portaudio/pa_common/pa_dither.o
deleted file mode 100644
index fc7a4bb4..00000000
--- a/pd/portaudio/pa_common/pa_dither.o
+++ /dev/null
Binary files differ
diff --git a/pd/portaudio/pa_common/pa_front.o b/pd/portaudio/pa_common/pa_front.o
deleted file mode 100644
index 0ce74a68..00000000
--- a/pd/portaudio/pa_common/pa_front.o
+++ /dev/null
Binary files differ
diff --git a/pd/portaudio/pa_common/pa_process.o b/pd/portaudio/pa_common/pa_process.o
deleted file mode 100644
index 3429227b..00000000
--- a/pd/portaudio/pa_common/pa_process.o
+++ /dev/null
Binary files differ
diff --git a/pd/portaudio/pa_common/pa_skeleton.o b/pd/portaudio/pa_common/pa_skeleton.o
deleted file mode 100644
index 4641670a..00000000
--- a/pd/portaudio/pa_common/pa_skeleton.o
+++ /dev/null
Binary files differ
diff --git a/pd/portaudio/pa_common/pa_stream.o b/pd/portaudio/pa_common/pa_stream.o
deleted file mode 100644
index c75789bb..00000000
--- a/pd/portaudio/pa_common/pa_stream.o
+++ /dev/null
Binary files differ
diff --git a/pd/portaudio/pa_common/pa_trace.o b/pd/portaudio/pa_common/pa_trace.o
deleted file mode 100644
index 0c160bea..00000000
--- a/pd/portaudio/pa_common/pa_trace.o
+++ /dev/null
Binary files differ
diff --git a/pd/portaudio/pa_linux_alsa/pa_linux_alsa.o b/pd/portaudio/pa_linux_alsa/pa_linux_alsa.o
deleted file mode 100644
index f79af61d..00000000
--- a/pd/portaudio/pa_linux_alsa/pa_linux_alsa.o
+++ /dev/null
Binary files differ
diff --git a/pd/portaudio/pa_unix/pa_unix_hostapis.o b/pd/portaudio/pa_unix/pa_unix_hostapis.o
deleted file mode 100644
index e8d68536..00000000
--- a/pd/portaudio/pa_unix/pa_unix_hostapis.o
+++ /dev/null
Binary files differ
diff --git a/pd/portaudio/pa_unix/pa_unix_util.o b/pd/portaudio/pa_unix/pa_unix_util.o
deleted file mode 100644
index 52868e5f..00000000
--- a/pd/portaudio/pa_unix/pa_unix_util.o
+++ /dev/null
Binary files differ
diff --git a/pd/portaudio/pa_unix_oss/pa_unix_oss.o b/pd/portaudio/pa_unix_oss/pa_unix_oss.o
deleted file mode 100644
index 604f9798..00000000
--- a/pd/portaudio/pa_unix_oss/pa_unix_oss.o
+++ /dev/null
Binary files differ
diff --git a/pd/portmidi_osx/README b/pd/portmidi_osx/README
index bbbbbfe9..7bf38b74 100644
--- a/pd/portmidi_osx/README
+++ b/pd/portmidi_osx/README
@@ -1,6 +1,6 @@
PortMidi for MacOS X / Darwin
Jon Parise <jparise@cmu.edu>
-$Date: 2004-09-06 20:20:32 $
+$Date: 2004-11-06 16:07:31 $
This is the MacOS X / Darwin port of the PortMidi library from the Carnegie
Mellon Computer Music Group. It is based on the Apple CoreAudio MIDI
diff --git a/pd/portmidi_osx/pmdarwin.c b/pd/portmidi_osx/pmdarwin.c
index 17696dad..8b0bb926 100644
--- a/pd/portmidi_osx/pmdarwin.c
+++ b/pd/portmidi_osx/pmdarwin.c
@@ -2,7 +2,7 @@
* PortMidi OS-dependent interface for Darwin (MacOS X)
* Jon Parise <jparise@cmu.edu>
*
- * $Id: pmdarwin.c,v 1.3 2004-09-06 20:20:33 millerpuckette Exp $
+ * $Id: pmdarwin.c,v 1.4 2004-11-06 16:07:31 millerpuckette Exp $
*
* CHANGE LOG:
* 03Jul03 - X. J. Scott (xjs):
diff --git a/pd/portmidi_osx/pmmacosx.c b/pd/portmidi_osx/pmmacosx.c
index de8fe59a..31a8e12c 100644
--- a/pd/portmidi_osx/pmmacosx.c
+++ b/pd/portmidi_osx/pmmacosx.c
@@ -3,7 +3,7 @@
*
* Jon Parise <jparise@cmu.edu>
*
- * $Id: pmmacosx.c,v 1.3 2004-09-06 20:20:33 millerpuckette Exp $
+ * $Id: pmmacosx.c,v 1.4 2004-11-06 16:07:31 millerpuckette Exp $
*
* 27Jun02 XJS (X. J. Scott)
* - midi_length():
diff --git a/pd/portmidi_osx/ptdarwin.c b/pd/portmidi_osx/ptdarwin.c
index 31537f1f..64e88a83 100644
--- a/pd/portmidi_osx/ptdarwin.c
+++ b/pd/portmidi_osx/ptdarwin.c
@@ -3,7 +3,7 @@
*
* Jon Parise <jparise@cmu.edu>
*
- * $Id: ptdarwin.c,v 1.3 2004-09-06 20:20:33 millerpuckette Exp $
+ * $Id: ptdarwin.c,v 1.4 2004-11-06 16:07:31 millerpuckette Exp $
*/
#include <stdio.h>
diff --git a/pd/src/configure b/pd/src/configure
index f034801a..2d10f18b 100755
--- a/pd/src/configure
+++ b/pd/src/configure
@@ -1,19 +1,10 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.53.
+# Generated by GNU Autoconf 2.59.
#
-# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
-# Free Software Foundation, Inc.
+# Copyright (C) 2003 Free Software Foundation, Inc.
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
-
-if expr a : '\(a\)' >/dev/null 2>&1; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-
## --------------------- ##
## M4sh Initialization. ##
## --------------------- ##
@@ -22,46 +13,57 @@ fi
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
set -o posix
fi
+DUALCASE=1; export DUALCASE # for MKS sh
-# NLS nuisances.
# Support unset when possible.
-if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
as_unset=unset
else
as_unset=false
fi
-(set +x; test -n "`(LANG=C; export LANG) 2>&1`") &&
- { $as_unset LANG || test "${LANG+set}" != set; } ||
- { LANG=C; export LANG; }
-(set +x; test -n "`(LC_ALL=C; export LC_ALL) 2>&1`") &&
- { $as_unset LC_ALL || test "${LC_ALL+set}" != set; } ||
- { LC_ALL=C; export LC_ALL; }
-(set +x; test -n "`(LC_TIME=C; export LC_TIME) 2>&1`") &&
- { $as_unset LC_TIME || test "${LC_TIME+set}" != set; } ||
- { LC_TIME=C; export LC_TIME; }
-(set +x; test -n "`(LC_CTYPE=C; export LC_CTYPE) 2>&1`") &&
- { $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set; } ||
- { LC_CTYPE=C; export LC_CTYPE; }
-(set +x; test -n "`(LANGUAGE=C; export LANGUAGE) 2>&1`") &&
- { $as_unset LANGUAGE || test "${LANGUAGE+set}" != set; } ||
- { LANGUAGE=C; export LANGUAGE; }
-(set +x; test -n "`(LC_COLLATE=C; export LC_COLLATE) 2>&1`") &&
- { $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set; } ||
- { LC_COLLATE=C; export LC_COLLATE; }
-(set +x; test -n "`(LC_NUMERIC=C; export LC_NUMERIC) 2>&1`") &&
- { $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set; } ||
- { LC_NUMERIC=C; export LC_NUMERIC; }
-(set +x; test -n "`(LC_MESSAGES=C; export LC_MESSAGES) 2>&1`") &&
- { $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set; } ||
- { LC_MESSAGES=C; export LC_MESSAGES; }
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ $as_unset $as_var
+ fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
# Name of the executable.
-as_me=`(basename "$0") 2>/dev/null ||
+as_me=`$as_basename "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
X"$0" : 'X\(/\)$' \| \
@@ -72,6 +74,7 @@ echo X/"$0" |
/^X\/\(\/\).*/{ s//\1/; q; }
s/.*/./; q'`
+
# PATH needs CR, and LINENO needs CR and PATH.
# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
@@ -82,15 +85,15 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits
# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conftest.sh
- echo "exit 0" >>conftest.sh
- chmod +x conftest.sh
- if (PATH=".;."; conftest.sh) >/dev/null 2>&1; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
PATH_SEPARATOR=';'
else
PATH_SEPARATOR=:
fi
- rm -f conftest.sh
+ rm -f conf$$.sh
fi
@@ -138,6 +141,8 @@ do
as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
test "x$as_lineno_1" != "x$as_lineno_2" &&
test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
+ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
CONFIG_SHELL=$as_dir/$as_base
export CONFIG_SHELL
exec "$CONFIG_SHELL" "$0" ${1+"$@"}
@@ -210,13 +215,20 @@ else
fi
rm -f conf$$ conf$$.exe conf$$.file
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
as_executable_p="test -f"
# Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
# Sed expression to map a string onto a valid variable name.
-as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
# IFS
@@ -226,7 +238,7 @@ as_nl='
IFS=" $as_nl"
# CDPATH.
-$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export CDPATH; }
+$as_unset CDPATH
# Name of the host.
@@ -240,6 +252,7 @@ exec 6>&1
# Initializations.
#
ac_default_prefix=/usr/local
+ac_config_libobj_dir=.
cross_compiling=no
subdirs=
MFLAGS=
@@ -296,6 +309,8 @@ ac_includes_default="\
# include <unistd.h>
#endif"
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS alsa jack portaudio binarymode PDLIB MORECFLAGS EXT OPT_CFLAGS USE_OPT_CFLAGS SYSSRC STRIPFLAG GUINAME GUIFLAGS OSNUMBER EXTERNTARGET CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA SET_MAKE CPP EGREP LIBOBJS LTLIBOBJS'
+ac_subst_files=''
# Initialize some variables set by options.
ac_init_help=
@@ -653,7 +668,7 @@ done
# Be sure to have absolute paths.
for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
- localstatedir libdir includedir oldincludedir infodir mandir
+ localstatedir libdir includedir oldincludedir infodir mandir
do
eval ac_val=$`echo $ac_var`
case $ac_val in
@@ -693,10 +708,10 @@ if test -z "$srcdir"; then
# Try the directory containing this script, then its parent.
ac_confdir=`(dirname "$0") 2>/dev/null ||
$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$0" : 'X\(//\)[^/]' \| \
- X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
+ X"$0" : 'X\(//\)[^/]' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
echo X"$0" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
@@ -719,6 +734,9 @@ if test ! -r $srcdir/$ac_unique_file; then
{ (exit 1); exit 1; }; }
fi
fi
+(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
+ { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
+ { (exit 1); exit 1; }; }
srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
ac_env_build_alias_set=${build_alias+set}
ac_env_build_alias_value=$build_alias
@@ -785,9 +803,9 @@ _ACEOF
cat <<_ACEOF
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
+ [$ac_default_prefix]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [PREFIX]
+ [PREFIX]
By default, \`make install' will install all the files in
\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
@@ -826,11 +844,13 @@ if test -n "$ac_init_help"; then
Optional Features:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --disable-alsa disable ALSA
+ --enable-alsa force enabling ALSA
+ --disable-alsa force disabling ALSA
--enable-jack jack audio server
--enable-portaudio portaudio
--enable-debug debugging support
--enable-static link statically
+ --enable-setuid install as setuid (linux)
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
@@ -882,12 +902,45 @@ case $srcdir in
ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
ac_top_srcdir=$ac_top_builddir$srcdir ;;
esac
-# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
-# absolute.
-ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
-ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd`
-ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
-ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+ case "$ac_dir" in
+ .) ac_abs_builddir=`pwd`;;
+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+ *) ac_abs_builddir=`pwd`/"$ac_dir";;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+ case ${ac_top_builddir}. in
+ .) ac_abs_top_builddir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+ case $ac_srcdir in
+ .) ac_abs_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+ case $ac_top_srcdir in
+ .) ac_abs_top_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+ esac;;
+esac
cd $ac_dir
# Check for guested configure; otherwise get Cygnus style configure.
@@ -898,7 +951,7 @@ ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
echo
$SHELL $ac_srcdir/configure --help=recursive
elif test -f $ac_srcdir/configure.ac ||
- test -f $ac_srcdir/configure.in; then
+ test -f $ac_srcdir/configure.in; then
echo
$ac_configure --help
else
@@ -912,8 +965,7 @@ test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
-Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
-Free Software Foundation, Inc.
+Copyright (C) 2003 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
@@ -925,7 +977,7 @@ This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by $as_me, which was
-generated by GNU Autoconf 2.53. Invocation command line was
+generated by GNU Autoconf 2.59. Invocation command line was
$ $0 $@
@@ -977,27 +1029,54 @@ _ACEOF
# Keep a trace of the command line.
# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
ac_sep=
-for ac_arg
+ac_must_keep_next=false
+for ac_pass in 1 2
do
- case $ac_arg in
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c | -n ) continue ;;
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
- continue ;;
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
- ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
- esac
- case " $ac_configure_args " in
- *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
- *) ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
- ac_sep=" " ;;
- esac
- # Get rid of the leading space.
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+ ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+ 2)
+ ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
+ # Get rid of the leading space.
+ ac_sep=" "
+ ;;
+ esac
+ done
done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
# When interrupted or exit'd, cleanup temporary files, and complete
# config.log. We remove comments because anyway the quotes in there
@@ -1008,6 +1087,7 @@ trap 'exit_status=$?
# Save into config.log some information that might help in debugging.
{
echo
+
cat <<\_ASBOX
## ---------------- ##
## Cache variables. ##
@@ -1020,16 +1100,45 @@ _ASBOX
case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
*ac_space=\ *)
sed -n \
- "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
- s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
+ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
;;
*)
sed -n \
- "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
;;
esac;
}
echo
+
+ cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=$`echo $ac_var`
+ echo "$ac_var='"'"'$ac_val'"'"'"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ cat <<\_ASBOX
+## ------------- ##
+## Output files. ##
+## ------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=$`echo $ac_var`
+ echo "$ac_var='"'"'$ac_val'"'"'"
+ done | sort
+ echo
+ fi
+
if test -s confdefs.h; then
cat <<\_ASBOX
## ----------- ##
@@ -1037,14 +1146,14 @@ _ASBOX
## ----------- ##
_ASBOX
echo
- sed "/^$/d" confdefs.h
+ sed "/^$/d" confdefs.h | sort
echo
fi
test "$ac_signal" != 0 &&
echo "$as_me: caught signal $ac_signal"
echo "$as_me: exit $exit_status"
} >&5
- rm -f core core.* *.core &&
+ rm -f core *.core &&
rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
exit $exit_status
' 0
@@ -1124,7 +1233,7 @@ fi
# value.
ac_cache_corrupted=false
for ac_var in `(set) 2>&1 |
- sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
+ sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
eval ac_old_set=\$ac_cv_env_${ac_var}_set
eval ac_new_set=\$ac_env_${ac_var}_set
eval ac_old_val="\$ac_cv_env_${ac_var}_value"
@@ -1141,13 +1250,13 @@ echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
,);;
*)
if test "x$ac_old_val" != "x$ac_new_val"; then
- { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+ { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
- { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
+ { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
echo "$as_me: former value: $ac_old_val" >&2;}
- { echo "$as_me:$LINENO: current value: $ac_new_val" >&5
+ { echo "$as_me:$LINENO: current value: $ac_new_val" >&5
echo "$as_me: current value: $ac_new_val" >&2;}
- ac_cache_corrupted=:
+ ac_cache_corrupted=:
fi;;
esac
# Pass precious variables to config.status.
@@ -1195,12 +1304,15 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
alsa=yes
jack=no
portaudio=no
+binarymode=-m755
+
@@ -1219,6 +1331,11 @@ USE_OPT_CFLAGS=yes
# Check whether --enable-alsa or --disable-alsa was given.
if test "${enable_alsa+set}" = set; then
enableval="$enable_alsa"
+ alsa="yes"
+fi;
+# Check whether --enable-alsa or --disable-alsa was given.
+if test "${enable_alsa+set}" = set; then
+ enableval="$enable_alsa"
alsa="no"
fi;
# Check whether --enable-jack or --disable-jack was given.
@@ -1241,6 +1358,11 @@ if test "${enable_static+set}" = set; then
enableval="$enable_static"
static=yes
fi;
+# Check whether --enable-setuid or --disable-setuid was given.
+if test "${enable_setuid+set}" = set; then
+ enableval="$enable_setuid"
+ setuid=yes
+fi;
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
@@ -1446,9 +1568,7 @@ if test $ac_prog_rejected = yes; then
# However, it has the same basename, so the bogon will be chosen
# first if we set CC to just the basename; use the full file name.
shift
- set dummy "$as_dir/$ac_word" ${1+"$@"}
- shift
- ac_cv_prog_CC="$@"
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
fi
fi
fi
@@ -1553,8 +1673,10 @@ fi
fi
-test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH" >&5
-echo "$as_me: error: no acceptable C compiler found in \$PATH" >&2;}
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
# Provide some information about the compiler.
@@ -1578,15 +1700,12 @@ ac_compiler=`set X $ac_compile; echo $2`
(exit $ac_status); }
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
-
-#ifdef F77_DUMMY_MAIN
-# ifdef __cplusplus
- extern "C"
-# endif
- int F77_DUMMY_MAIN() { return 1; }
-#endif
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
int
main ()
{
@@ -1596,12 +1715,12 @@ main ()
}
_ACEOF
ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files a.out a.exe"
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
# Try to create an executable without -o first, disregard a.out.
# It will help us diagnose broken compilers, and finding out an intuition
# of exeext.
-echo "$as_me:$LINENO: checking for C compiler default output" >&5
-echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6
+echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
(eval $ac_link_default) 2>&5
@@ -1615,26 +1734,39 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
# Be careful to initialize this variable, since it used to be cached.
# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
ac_cv_exeext=
-for ac_file in `ls a_out.exe a.exe conftest.exe 2>/dev/null;
- ls a.out conftest 2>/dev/null;
- ls a.* conftest.* 2>/dev/null`; do
+# b.out is created by i960 compilers.
+for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
+do
+ test -f "$ac_file" || continue
case $ac_file in
- *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb | *.xSYM ) ;;
- a.out ) # We found the default executable, but exeext='' is most
- # certainly right.
- break;;
- *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
- # FIXME: I believe we export ac_cv_exeext for Libtool --akim.
- export ac_cv_exeext
- break;;
- * ) break;;
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
+ ;;
+ conftest.$ac_ext )
+ # This is the source file.
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ # FIXME: I believe we export ac_cv_exeext for Libtool,
+ # but it would be cool to find out if it's true. Does anybody
+ # maintain Libtool? --akim.
+ export ac_cv_exeext
+ break;;
+ * )
+ break;;
esac
done
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-{ { echo "$as_me:$LINENO: error: C compiler cannot create executables" >&5
-echo "$as_me: error: C compiler cannot create executables" >&2;}
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
{ (exit 77); exit 77; }; }
fi
@@ -1661,9 +1793,11 @@ if test "$cross_compiling" != yes; then
cross_compiling=yes
else
{ { echo "$as_me:$LINENO: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'." >&5
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
echo "$as_me: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'." >&2;}
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
fi
fi
@@ -1671,7 +1805,7 @@ fi
echo "$as_me:$LINENO: result: yes" >&5
echo "${ECHO_T}yes" >&6
-rm -f a.out a.exe conftest$ac_cv_exeext
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
ac_clean_files=$ac_clean_files_save
# Check the compiler produces executables we can run. If not, either
# the compiler is broken, or we cross compile.
@@ -1691,18 +1825,21 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
# work properly (i.e., refer to `conftest.exe'), while it won't with
# `rm'.
-for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
case $ac_file in
- *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;;
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
*.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
- export ac_cv_exeext
- break;;
+ export ac_cv_exeext
+ break;;
* ) break;;
esac
done
else
- { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link" >&5
-echo "$as_me: error: cannot compute suffix of executables: cannot compile and link" >&2;}
+ { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
fi
@@ -1719,15 +1856,12 @@ if test "${ac_cv_objext+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
-
-#ifdef F77_DUMMY_MAIN
-# ifdef __cplusplus
- extern "C"
-# endif
- int F77_DUMMY_MAIN() { return 1; }
-#endif
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
int
main ()
{
@@ -1744,16 +1878,19 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(exit $ac_status); }; then
for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb ) ;;
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
*) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
break;;
esac
done
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile" >&5
-echo "$as_me: error: cannot compute suffix of object files: cannot compile" >&2;}
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
fi
@@ -1769,15 +1906,12 @@ if test "${ac_cv_c_compiler_gnu+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
-
-#ifdef F77_DUMMY_MAIN
-# ifdef __cplusplus
- extern "C"
-# endif
- int F77_DUMMY_MAIN() { return 1; }
-#endif
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
int
main ()
{
@@ -1791,11 +1925,21 @@ main ()
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
+ (eval $ac_compile) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -1804,10 +1948,11 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
ac_compiler_gnu=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_compiler_gnu=no
fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cv_c_compiler_gnu=$ac_compiler_gnu
fi
@@ -1823,15 +1968,12 @@ if test "${ac_cv_prog_cc_g+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
-
-#ifdef F77_DUMMY_MAIN
-# ifdef __cplusplus
- extern "C"
-# endif
- int F77_DUMMY_MAIN() { return 1; }
-#endif
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
int
main ()
{
@@ -1842,11 +1984,21 @@ main ()
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
+ (eval $ac_compile) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -1855,10 +2007,11 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
ac_cv_prog_cc_g=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_cv_prog_cc_g=no
fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
@@ -1877,6 +2030,121 @@ else
CFLAGS=
fi
fi
+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std1 is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std1. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX -qlanglvl=ansi
+# Ultrix and OSF/1 -std1
+# HP-UX 10.20 and later -Ae
+# HP-UX older versions -Aa -D_HPUX_SOURCE
+# SVR4 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+fi
+
+case "x$ac_cv_prog_cc_stdc" in
+ x|xno)
+ echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+ *)
+ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+ CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
# Some people use a C++ compiler to compile C. Since we use `exit',
# in C++ we need to declare it. In case someone uses the same compiler
# for both compiling C and C++ we need to have the C++ compiler decide
@@ -1888,19 +2156,28 @@ cat >conftest.$ac_ext <<_ACEOF
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
+ (eval $ac_compile) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
for ac_declaration in \
- ''\
- '#include <stdlib.h>' \
+ '' \
'extern "C" void std::exit (int) throw (); using std::exit;' \
'extern "C" void std::exit (int); using std::exit;' \
'extern "C" void exit (int) throw ();' \
@@ -1908,16 +2185,13 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
'void exit (int);'
do
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
-#include <stdlib.h>
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
$ac_declaration
-#ifdef F77_DUMMY_MAIN
-# ifdef __cplusplus
- extern "C"
-# endif
- int F77_DUMMY_MAIN() { return 1; }
-#endif
+#include <stdlib.h>
int
main ()
{
@@ -1928,11 +2202,21 @@ exit (42);
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
+ (eval $ac_compile) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -1941,20 +2225,18 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
:
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
continue
fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
$ac_declaration
-#ifdef F77_DUMMY_MAIN
-# ifdef __cplusplus
- extern "C"
-# endif
- int F77_DUMMY_MAIN() { return 1; }
-#endif
int
main ()
{
@@ -1965,11 +2247,21 @@ exit (42);
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
+ (eval $ac_compile) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -1978,9 +2270,10 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
break
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
done
rm -f conftest*
if test -n "$ac_declaration"; then
@@ -1991,9 +2284,10 @@ fi
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -2036,6 +2330,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
# AFS /usr/afsws/bin/install, which mishandles nonexistent args
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
# ./install, which can be erroneously created by make from ./install.sh.
echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
@@ -2052,6 +2347,7 @@ do
case $as_dir/ in
./ | .// | /cC/* | \
/etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
/usr/ucb/* ) ;;
*)
# OSF1 and SCO ODT 3.0 have their own names for install.
@@ -2059,20 +2355,20 @@ case $as_dir/ in
# by default.
for ac_prog in ginstall scoinst install; do
for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
- if test $ac_prog = install &&
- grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
- # AIX install. It has an incompatible calling convention.
- :
- elif test $ac_prog = install &&
- grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
- # program-specific install script used by HP pwplus--don't use.
- :
- else
- ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
- break 3
- fi
- fi
+ if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
done
done
;;
@@ -2102,15 +2398,15 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \${MAKE}" >&5
-echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6
-set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'`
+echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'`
if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.make <<\_ACEOF
all:
- @echo 'ac_maketemp="${MAKE}"'
+ @echo 'ac_maketemp="$(MAKE)"'
_ACEOF
# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=`
@@ -2154,24 +2450,34 @@ for ac_c_preproc_warn_flag in '' yes
do
# Use a header file that comes with gcc, so configuring glibc
# with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
-#include <assert.h>
- Syntax error
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
- egrep -v '^ *\+' conftest.er1 >conftest.err
+ grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
@@ -2182,7 +2488,8 @@ if test -z "$ac_cpp_err"; then
:
else
echo "$as_me: failed program was:" >&5
- cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
# Broken: fails on valid input.
continue
fi
@@ -2191,20 +2498,24 @@ rm -f conftest.err conftest.$ac_ext
# OK, works on sane cases. Now check whether non-existent headers
# can be detected and how.
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <ac_nonexistent.h>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
- egrep -v '^ *\+' conftest.er1 >conftest.err
+ grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
@@ -2216,7 +2527,8 @@ if test -z "$ac_cpp_err"; then
continue
else
echo "$as_me: failed program was:" >&5
- cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
# Passes both tests.
ac_preproc_ok=:
break
@@ -2245,24 +2557,34 @@ for ac_c_preproc_warn_flag in '' yes
do
# Use a header file that comes with gcc, so configuring glibc
# with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
-#include <assert.h>
- Syntax error
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
- egrep -v '^ *\+' conftest.er1 >conftest.err
+ grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
@@ -2273,7 +2595,8 @@ if test -z "$ac_cpp_err"; then
:
else
echo "$as_me: failed program was:" >&5
- cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
# Broken: fails on valid input.
continue
fi
@@ -2282,20 +2605,24 @@ rm -f conftest.err conftest.$ac_ext
# OK, works on sane cases. Now check whether non-existent headers
# can be detected and how.
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <ac_nonexistent.h>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
- egrep -v '^ *\+' conftest.er1 >conftest.err
+ grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
@@ -2307,7 +2634,8 @@ if test -z "$ac_cpp_err"; then
continue
else
echo "$as_me: failed program was:" >&5
- cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
# Passes both tests.
ac_preproc_ok=:
break
@@ -2320,8 +2648,10 @@ rm -f conftest.err conftest.$ac_ext
if $ac_preproc_ok; then
:
else
- { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check" >&5
-echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;}
+ { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
{ (exit 1); exit 1; }; }
fi
@@ -2333,118 +2663,18 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
-echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
-echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
-if test "${ac_cv_prog_cc_stdc+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_cv_prog_cc_stdc=no
-ac_save_CC=$CC
-cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
-#include <stdarg.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
-struct buf { int x; };
-FILE * (*rcsopen) (struct buf *, struct stat *, int);
-static char *e (p, i)
- char **p;
- int i;
-{
- return p[i];
-}
-static char *f (char * (*g) (char **, int), char **p, ...)
-{
- char *s;
- va_list v;
- va_start (v,p);
- s = g (p, va_arg (v,int));
- va_end (v);
- return s;
-}
-int test (int i, double x);
-struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};
-int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
-int argc;
-char **argv;
-#ifdef F77_DUMMY_MAIN
-# ifdef __cplusplus
- extern "C"
-# endif
- int F77_DUMMY_MAIN() { return 1; }
-#endif
-int
-main ()
-{
-return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
- ;
- return 0;
-}
-_ACEOF
-# Don't try gcc -ansi; that turns off useful extensions and
-# breaks some systems' header files.
-# AIX -qlanglvl=ansi
-# Ultrix and OSF/1 -std1
-# HP-UX 10.20 and later -Ae
-# HP-UX older versions -Aa -D_HPUX_SOURCE
-# SVR4 -Xc -D__EXTENSIONS__
-for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
-do
- CC="$ac_save_CC $ac_arg"
- rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_cv_prog_cc_stdc=$ac_arg
-break
-else
- echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-fi
-rm -f conftest.$ac_objext
-done
-rm -f conftest.$ac_ext conftest.$ac_objext
-CC=$ac_save_CC
-
-fi
-
-case "x$ac_cv_prog_cc_stdc" in
- x|xno)
- echo "$as_me:$LINENO: result: none needed" >&5
-echo "${ECHO_T}none needed" >&6 ;;
- *)
- echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
- CC="$CC $ac_cv_prog_cc_stdc" ;;
-esac
-
echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
if test "${ac_cv_c_const+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
-
-#ifdef F77_DUMMY_MAIN
-# ifdef __cplusplus
- extern "C"
-# endif
- int F77_DUMMY_MAIN() { return 1; }
-#endif
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
int
main ()
{
@@ -2501,11 +2731,21 @@ main ()
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
+ (eval $ac_compile) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -2514,10 +2754,11 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
ac_cv_c_const=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_cv_c_const=no
fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
echo "${ECHO_T}$ac_cv_c_const" >&6
@@ -2530,55 +2771,89 @@ _ACEOF
fi
+echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6
+if test "${ac_cv_prog_egrep+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+ then ac_cv_prog_egrep='grep -E'
+ else ac_cv_prog_egrep='egrep'
+ fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
+echo "${ECHO_T}$ac_cv_prog_egrep" >&6
+ EGREP=$ac_cv_prog_egrep
+
+
echo "$as_me:$LINENO: checking for ANSI C header files" >&5
echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
if test "${ac_cv_header_stdc+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <float.h>
+int
+main ()
+{
+
+ ;
+ return 0;
+}
_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
ac_status=$?
- egrep -v '^ *\+' conftest.er1 >conftest.err
+ grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_header_stdc=yes
else
echo "$as_me: failed program was:" >&5
- cat conftest.$ac_ext >&5
- ac_cv_header_stdc=no
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_stdc=no
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <string.h>
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "memchr" >/dev/null 2>&1; then
+ $EGREP "memchr" >/dev/null 2>&1; then
:
else
ac_cv_header_stdc=no
@@ -2590,13 +2865,16 @@ fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <stdlib.h>
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "free" >/dev/null 2>&1; then
+ $EGREP "free" >/dev/null 2>&1; then
:
else
ac_cv_header_stdc=no
@@ -2611,16 +2889,20 @@ if test $ac_cv_header_stdc = yes; then
:
else
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <ctype.h>
#if ((' ' & 0x0FF) == 0x020)
# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
#else
-# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \
- || ('j' <= (c) && (c) <= 'r') \
- || ('s' <= (c) && (c) <= 'z'))
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
#endif
@@ -2631,7 +2913,7 @@ main ()
int i;
for (i = 0; i < 256; i++)
if (XOR (islower (i), ISLOWER (i))
- || toupper (i) != TOUPPER (i))
+ || toupper (i) != TOUPPER (i))
exit(2);
exit (0);
}
@@ -2651,11 +2933,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
else
echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
( exit $ac_status )
ac_cv_header_stdc=no
fi
-rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
fi
@@ -2680,7 +2963,7 @@ fi
for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
- inttypes.h stdint.h unistd.h
+ inttypes.h stdint.h unistd.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_header" >&5
@@ -2689,19 +2972,32 @@ if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
$ac_includes_default
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
+ (eval $ac_compile) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -2710,10 +3006,11 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
eval "$as_ac_Header=yes"
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
eval "$as_ac_Header=no"
fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
@@ -2733,15 +3030,12 @@ if test "${ac_cv_type_pid_t+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
$ac_includes_default
-#ifdef F77_DUMMY_MAIN
-# ifdef __cplusplus
- extern "C"
-# endif
- int F77_DUMMY_MAIN() { return 1; }
-#endif
int
main ()
{
@@ -2755,11 +3049,21 @@ if (sizeof (pid_t))
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
+ (eval $ac_compile) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -2768,10 +3072,11 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
ac_cv_type_pid_t=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_cv_type_pid_t=no
fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5
echo "${ECHO_T}$ac_cv_type_pid_t" >&6
@@ -2791,15 +3096,12 @@ if test "${ac_cv_type_size_t+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
$ac_includes_default
-#ifdef F77_DUMMY_MAIN
-# ifdef __cplusplus
- extern "C"
-# endif
- int F77_DUMMY_MAIN() { return 1; }
-#endif
int
main ()
{
@@ -2813,11 +3115,21 @@ if (sizeof (size_t))
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
+ (eval $ac_compile) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -2826,10 +3138,11 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
ac_cv_type_size_t=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_cv_type_size_t=no
fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
echo "${ECHO_T}$ac_cv_type_size_t" >&6
@@ -2849,18 +3162,15 @@ if test "${ac_cv_header_time+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <sys/types.h>
#include <sys/time.h>
#include <time.h>
-#ifdef F77_DUMMY_MAIN
-# ifdef __cplusplus
- extern "C"
-# endif
- int F77_DUMMY_MAIN() { return 1; }
-#endif
int
main ()
{
@@ -2872,11 +3182,21 @@ return 0;
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
+ (eval $ac_compile) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -2885,10 +3205,11 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
ac_cv_header_time=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_cv_header_time=no
fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
echo "${ECHO_T}$ac_cv_header_time" >&6
@@ -2907,49 +3228,68 @@ if test "${ac_cv_header_stdc+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <float.h>
+int
+main ()
+{
+
+ ;
+ return 0;
+}
_ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
- (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
ac_status=$?
- egrep -v '^ *\+' conftest.er1 >conftest.err
+ grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } >/dev/null; then
- if test -s conftest.err; then
- ac_cpp_err=$ac_c_preproc_warn_flag
- else
- ac_cpp_err=
- fi
-else
- ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_header_stdc=yes
else
echo "$as_me: failed program was:" >&5
- cat conftest.$ac_ext >&5
- ac_cv_header_stdc=no
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_stdc=no
fi
-rm -f conftest.err conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <string.h>
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "memchr" >/dev/null 2>&1; then
+ $EGREP "memchr" >/dev/null 2>&1; then
:
else
ac_cv_header_stdc=no
@@ -2961,13 +3301,16 @@ fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <stdlib.h>
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "free" >/dev/null 2>&1; then
+ $EGREP "free" >/dev/null 2>&1; then
:
else
ac_cv_header_stdc=no
@@ -2982,16 +3325,20 @@ if test $ac_cv_header_stdc = yes; then
:
else
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <ctype.h>
#if ((' ' & 0x0FF) == 0x020)
# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
#else
-# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \
- || ('j' <= (c) && (c) <= 'r') \
- || ('s' <= (c) && (c) <= 'z'))
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
#endif
@@ -3002,7 +3349,7 @@ main ()
int i;
for (i = 0; i < 256; i++)
if (XOR (islower (i), ISLOWER (i))
- || toupper (i) != TOUPPER (i))
+ || toupper (i) != TOUPPER (i))
exit(2);
exit (0);
}
@@ -3022,11 +3369,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
else
echo "$as_me: program exited with status $ac_status" >&5
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
( exit $ac_status )
ac_cv_header_stdc=no
fi
-rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
fi
fi
@@ -3063,18 +3411,31 @@ else
echo "$as_me:$LINENO: checking $ac_header usability" >&5
echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
$ac_includes_default
#include <$ac_header>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
+ (eval $ac_compile) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3083,10 +3444,11 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
ac_header_compiler=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_header_compiler=no
fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6
@@ -3094,20 +3456,24 @@ echo "${ECHO_T}$ac_header_compiler" >&6
echo "$as_me:$LINENO: checking $ac_header presence" >&5
echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <$ac_header>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
- egrep -v '^ *\+' conftest.er1 >conftest.err
+ grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
@@ -3118,7 +3484,8 @@ if test -z "$ac_cpp_err"; then
ac_header_preproc=yes
else
echo "$as_me: failed program was:" >&5
- cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
@@ -3126,26 +3493,43 @@ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6
# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc in
- yes:no )
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
{ echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};;
- no:yes )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
{ echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
{ echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};;
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists. ##
+## ------------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
esac
echo "$as_me:$LINENO: checking for $ac_header" >&5
echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
if eval "test \"\${$as_ac_Header+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
- eval "$as_ac_Header=$ac_header_preproc"
+ eval "$as_ac_Header=\$ac_header_preproc"
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
@@ -3169,13 +3553,16 @@ if test "${ac_cv_prog_gcc_traditional+set}" = set; then
else
ac_pattern="Autoconf.*'x'"
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <sgtty.h>
Autoconf TIOCGETP
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "$ac_pattern" >/dev/null 2>&1; then
+ $EGREP "$ac_pattern" >/dev/null 2>&1; then
ac_cv_prog_gcc_traditional=yes
else
ac_cv_prog_gcc_traditional=no
@@ -3185,13 +3572,16 @@ rm -f conftest*
if test $ac_cv_prog_gcc_traditional = no; then
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <termio.h>
Autoconf TCGETA
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- egrep "$ac_pattern" >/dev/null 2>&1; then
+ $EGREP "$ac_pattern" >/dev/null 2>&1; then
ac_cv_prog_gcc_traditional=yes
fi
rm -f conftest*
@@ -3211,8 +3601,11 @@ if test "${ac_cv_type_signal+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <sys/types.h>
#include <signal.h>
#ifdef signal
@@ -3224,12 +3617,6 @@ extern "C" void (*signal (int, void (*)(int)))(int);
void (*signal ()) ();
#endif
-#ifdef F77_DUMMY_MAIN
-# ifdef __cplusplus
- extern "C"
-# endif
- int F77_DUMMY_MAIN() { return 1; }
-#endif
int
main ()
{
@@ -3240,11 +3627,21 @@ int i;
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
+ (eval $ac_compile) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3253,10 +3650,11 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
ac_cv_type_signal=void
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_cv_type_signal=int
fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5
echo "${ECHO_T}$ac_cv_type_signal" >&6
@@ -3276,49 +3674,73 @@ if eval "test \"\${$as_ac_var+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below. */
-#include <assert.h>
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
+{
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char $ac_func ();
-char (*f) ();
-
-#ifdef F77_DUMMY_MAIN
-# ifdef __cplusplus
- extern "C"
-# endif
- int F77_DUMMY_MAIN() { return 1; }
-#endif
-int
-main ()
-{
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
choke me
#else
-f = $ac_func;
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
#endif
+int
+main ()
+{
+return f != $ac_func;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest$ac_exeext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3327,10 +3749,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
eval "$as_ac_var=yes"
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
eval "$as_ac_var=no"
fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
@@ -3345,49 +3769,73 @@ if test "${ac_cv_func__doprnt+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define _doprnt to an innocuous variant, in case <limits.h> declares _doprnt.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define _doprnt innocuous__doprnt
+
/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char _doprnt (); below. */
-#include <assert.h>
+ which can conflict with char _doprnt (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef _doprnt
+
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
+{
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char _doprnt ();
-char (*f) ();
-
-#ifdef F77_DUMMY_MAIN
-# ifdef __cplusplus
- extern "C"
-# endif
- int F77_DUMMY_MAIN() { return 1; }
-#endif
-int
-main ()
-{
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub__doprnt) || defined (__stub____doprnt)
choke me
#else
-f = _doprnt;
+char (*f) () = _doprnt;
+#endif
+#ifdef __cplusplus
+}
#endif
+int
+main ()
+{
+return f != _doprnt;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest$ac_exeext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3396,10 +3844,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_cv_func__doprnt=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_cv_func__doprnt=no
fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_func__doprnt" >&5
echo "${ECHO_T}$ac_cv_func__doprnt" >&6
@@ -3428,49 +3878,73 @@ if eval "test \"\${$as_ac_var+set}\" = set"; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func (); below. */
-#include <assert.h>
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
+{
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char $ac_func ();
-char (*f) ();
-
-#ifdef F77_DUMMY_MAIN
-# ifdef __cplusplus
- extern "C"
-# endif
- int F77_DUMMY_MAIN() { return 1; }
-#endif
-int
-main ()
-{
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
choke me
#else
-f = $ac_func;
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
#endif
+int
+main ()
+{
+return f != $ac_func;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest$ac_exeext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3479,10 +3953,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
eval "$as_ac_var=yes"
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
eval "$as_ac_var=no"
fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
@@ -3504,8 +3980,11 @@ else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ldl $LIBS"
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
@@ -3514,12 +3993,6 @@ extern "C"
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char dlopen ();
-#ifdef F77_DUMMY_MAIN
-# ifdef __cplusplus
- extern "C"
-# endif
- int F77_DUMMY_MAIN() { return 1; }
-#endif
int
main ()
{
@@ -3530,11 +4003,21 @@ dlopen ();
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest$ac_exeext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3543,10 +4026,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_cv_lib_dl_dlopen=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_cv_lib_dl_dlopen=no
fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
@@ -3566,8 +4051,11 @@ else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lffm $LIBS"
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
@@ -3576,12 +4064,6 @@ extern "C"
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char sin ();
-#ifdef F77_DUMMY_MAIN
-# ifdef __cplusplus
- extern "C"
-# endif
- int F77_DUMMY_MAIN() { return 1; }
-#endif
int
main ()
{
@@ -3592,11 +4074,21 @@ sin ();
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest$ac_exeext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3605,10 +4097,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_cv_lib_ffm_sin=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_cv_lib_ffm_sin=no
fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_ffm_sin" >&5
@@ -3626,8 +4120,11 @@ else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lm $LIBS"
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
@@ -3636,12 +4133,6 @@ extern "C"
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char sin ();
-#ifdef F77_DUMMY_MAIN
-# ifdef __cplusplus
- extern "C"
-# endif
- int F77_DUMMY_MAIN() { return 1; }
-#endif
int
main ()
{
@@ -3652,11 +4143,21 @@ sin ();
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest$ac_exeext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3665,10 +4166,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_cv_lib_m_sin=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_cv_lib_m_sin=no
fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_m_sin" >&5
@@ -3688,8 +4191,11 @@ else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lpthread $LIBS"
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
@@ -3698,12 +4204,6 @@ extern "C"
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char pthread_create ();
-#ifdef F77_DUMMY_MAIN
-# ifdef __cplusplus
- extern "C"
-# endif
- int F77_DUMMY_MAIN() { return 1; }
-#endif
int
main ()
{
@@ -3714,11 +4214,21 @@ pthread_create ();
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest$ac_exeext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3727,10 +4237,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_cv_lib_pthread_pthread_create=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_cv_lib_pthread_pthread_create=no
fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_create" >&5
@@ -3780,8 +4292,8 @@ _ACEOF
# Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.
for ac_extension in a so sl; do
if test ! -f $ac_im_usrlibdir/libX11.$ac_extension &&
- test -f $ac_im_libdir/libX11.$ac_extension; then
- ac_im_usrlibdir=$ac_im_libdir; break
+ test -f $ac_im_libdir/libX11.$ac_extension; then
+ ac_im_usrlibdir=$ac_im_libdir; break
fi
done
# Screen out bogus values from the imake configuration. They are
@@ -3841,20 +4353,24 @@ if test "$ac_x_includes" = no; then
# Guess where to find include files, by looking for Intrinsic.h.
# First, try using that file with no special directory specified.
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <X11/Intrinsic.h>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
- egrep -v '^ *\+' conftest.er1 >conftest.err
+ grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
@@ -3866,7 +4382,8 @@ if test -z "$ac_cpp_err"; then
ac_x_includes=
else
echo "$as_me: failed program was:" >&5
- cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
for ac_dir in $ac_x_header_dirs; do
if test -r "$ac_dir/X11/Intrinsic.h"; then
ac_x_includes=$ac_dir
@@ -3884,15 +4401,12 @@ if test "$ac_x_libraries" = no; then
ac_save_LIBS=$LIBS
LIBS="-lXt $LIBS"
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <X11/Intrinsic.h>
-#ifdef F77_DUMMY_MAIN
-# ifdef __cplusplus
- extern "C"
-# endif
- int F77_DUMMY_MAIN() { return 1; }
-#endif
int
main ()
{
@@ -3903,11 +4417,21 @@ XtMalloc (0)
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest$ac_exeext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -3918,7 +4442,8 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_x_libraries=
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
LIBS=$ac_save_LIBS
for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g`
do
@@ -3931,7 +4456,8 @@ do
done
done
fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
fi # $ac_x_libraries = no
if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then
@@ -3940,7 +4466,7 @@ if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then
else
# Record where we found X for the cache.
ac_cv_have_x="have_x=yes \
- ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
+ ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
fi
fi
@@ -3971,8 +4497,11 @@ else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lX11 -L$x_libraries $LIBS"
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
@@ -3981,12 +4510,6 @@ extern "C"
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char XCreateWindow ();
-#ifdef F77_DUMMY_MAIN
-# ifdef __cplusplus
- extern "C"
-# endif
- int F77_DUMMY_MAIN() { return 1; }
-#endif
int
main ()
{
@@ -3997,11 +4520,21 @@ XCreateWindow ();
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest$ac_exeext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4010,10 +4543,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_cv_lib_X11_XCreateWindow=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_cv_lib_X11_XCreateWindow=no
fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_X11_XCreateWindow" >&5
@@ -4042,18 +4577,31 @@ else
echo "$as_me:$LINENO: checking tcl.h usability" >&5
echo $ECHO_N "checking tcl.h usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
$ac_includes_default
#include <tcl.h>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
+ (eval $ac_compile) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4062,10 +4610,11 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
ac_header_compiler=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_header_compiler=no
fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6
@@ -4073,20 +4622,24 @@ echo "${ECHO_T}$ac_header_compiler" >&6
echo "$as_me:$LINENO: checking tcl.h presence" >&5
echo $ECHO_N "checking tcl.h presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <tcl.h>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
- egrep -v '^ *\+' conftest.er1 >conftest.err
+ grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
@@ -4097,7 +4650,8 @@ if test -z "$ac_cpp_err"; then
ac_header_preproc=yes
else
echo "$as_me: failed program was:" >&5
- cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
@@ -4105,19 +4659,36 @@ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6
# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc in
- yes:no )
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
{ echo "$as_me:$LINENO: WARNING: tcl.h: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: tcl.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: tcl.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: tcl.h: proceeding with the preprocessor's result" >&2;};;
- no:yes )
+ { echo "$as_me:$LINENO: WARNING: tcl.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: tcl.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
{ echo "$as_me:$LINENO: WARNING: tcl.h: present but cannot be compiled" >&5
echo "$as_me: WARNING: tcl.h: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: tcl.h: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: tcl.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tcl.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: tcl.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tcl.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: tcl.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tcl.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: tcl.h: section \"Present But Cannot Be Compiled\"" >&2;}
{ echo "$as_me:$LINENO: WARNING: tcl.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: tcl.h: proceeding with the preprocessor's result" >&2;};;
+echo "$as_me: WARNING: tcl.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tcl.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: tcl.h: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists. ##
+## ------------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
esac
echo "$as_me:$LINENO: checking for tcl.h" >&5
echo $ECHO_N "checking for tcl.h... $ECHO_C" >&6
@@ -4151,18 +4722,31 @@ else
echo "$as_me:$LINENO: checking tcl8.7/tcl.h usability" >&5
echo $ECHO_N "checking tcl8.7/tcl.h usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
$ac_includes_default
#include <tcl8.7/tcl.h>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
+ (eval $ac_compile) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4171,10 +4755,11 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
ac_header_compiler=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_header_compiler=no
fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6
@@ -4182,20 +4767,24 @@ echo "${ECHO_T}$ac_header_compiler" >&6
echo "$as_me:$LINENO: checking tcl8.7/tcl.h presence" >&5
echo $ECHO_N "checking tcl8.7/tcl.h presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <tcl8.7/tcl.h>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
- egrep -v '^ *\+' conftest.er1 >conftest.err
+ grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
@@ -4206,7 +4795,8 @@ if test -z "$ac_cpp_err"; then
ac_header_preproc=yes
else
echo "$as_me: failed program was:" >&5
- cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
@@ -4214,19 +4804,36 @@ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6
# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc in
- yes:no )
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
{ echo "$as_me:$LINENO: WARNING: tcl8.7/tcl.h: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: tcl8.7/tcl.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: tcl8.7/tcl.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: tcl8.7/tcl.h: proceeding with the preprocessor's result" >&2;};;
- no:yes )
+ { echo "$as_me:$LINENO: WARNING: tcl8.7/tcl.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: tcl8.7/tcl.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
{ echo "$as_me:$LINENO: WARNING: tcl8.7/tcl.h: present but cannot be compiled" >&5
echo "$as_me: WARNING: tcl8.7/tcl.h: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: tcl8.7/tcl.h: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: tcl8.7/tcl.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tcl8.7/tcl.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: tcl8.7/tcl.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tcl8.7/tcl.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: tcl8.7/tcl.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tcl8.7/tcl.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: tcl8.7/tcl.h: section \"Present But Cannot Be Compiled\"" >&2;}
{ echo "$as_me:$LINENO: WARNING: tcl8.7/tcl.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: tcl8.7/tcl.h: proceeding with the preprocessor's result" >&2;};;
+echo "$as_me: WARNING: tcl8.7/tcl.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tcl8.7/tcl.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: tcl8.7/tcl.h: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists. ##
+## ------------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
esac
echo "$as_me:$LINENO: checking for tcl8.7/tcl.h" >&5
echo $ECHO_N "checking for tcl8.7/tcl.h... $ECHO_C" >&6
@@ -4260,18 +4867,31 @@ else
echo "$as_me:$LINENO: checking tcl8.6/tcl.h usability" >&5
echo $ECHO_N "checking tcl8.6/tcl.h usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
$ac_includes_default
#include <tcl8.6/tcl.h>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
+ (eval $ac_compile) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4280,10 +4900,11 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
ac_header_compiler=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_header_compiler=no
fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6
@@ -4291,20 +4912,24 @@ echo "${ECHO_T}$ac_header_compiler" >&6
echo "$as_me:$LINENO: checking tcl8.6/tcl.h presence" >&5
echo $ECHO_N "checking tcl8.6/tcl.h presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <tcl8.6/tcl.h>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
- egrep -v '^ *\+' conftest.er1 >conftest.err
+ grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
@@ -4315,7 +4940,8 @@ if test -z "$ac_cpp_err"; then
ac_header_preproc=yes
else
echo "$as_me: failed program was:" >&5
- cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
@@ -4323,19 +4949,36 @@ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6
# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc in
- yes:no )
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
{ echo "$as_me:$LINENO: WARNING: tcl8.6/tcl.h: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: tcl8.6/tcl.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: tcl8.6/tcl.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: tcl8.6/tcl.h: proceeding with the preprocessor's result" >&2;};;
- no:yes )
+ { echo "$as_me:$LINENO: WARNING: tcl8.6/tcl.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: tcl8.6/tcl.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
{ echo "$as_me:$LINENO: WARNING: tcl8.6/tcl.h: present but cannot be compiled" >&5
echo "$as_me: WARNING: tcl8.6/tcl.h: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: tcl8.6/tcl.h: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: tcl8.6/tcl.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tcl8.6/tcl.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: tcl8.6/tcl.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tcl8.6/tcl.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: tcl8.6/tcl.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tcl8.6/tcl.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: tcl8.6/tcl.h: section \"Present But Cannot Be Compiled\"" >&2;}
{ echo "$as_me:$LINENO: WARNING: tcl8.6/tcl.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: tcl8.6/tcl.h: proceeding with the preprocessor's result" >&2;};;
+echo "$as_me: WARNING: tcl8.6/tcl.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tcl8.6/tcl.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: tcl8.6/tcl.h: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists. ##
+## ------------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
esac
echo "$as_me:$LINENO: checking for tcl8.6/tcl.h" >&5
echo $ECHO_N "checking for tcl8.6/tcl.h... $ECHO_C" >&6
@@ -4369,18 +5012,31 @@ else
echo "$as_me:$LINENO: checking tcl8.5/tcl.h usability" >&5
echo $ECHO_N "checking tcl8.5/tcl.h usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
$ac_includes_default
#include <tcl8.5/tcl.h>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
+ (eval $ac_compile) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4389,10 +5045,11 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
ac_header_compiler=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_header_compiler=no
fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6
@@ -4400,20 +5057,24 @@ echo "${ECHO_T}$ac_header_compiler" >&6
echo "$as_me:$LINENO: checking tcl8.5/tcl.h presence" >&5
echo $ECHO_N "checking tcl8.5/tcl.h presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <tcl8.5/tcl.h>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
- egrep -v '^ *\+' conftest.er1 >conftest.err
+ grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
@@ -4424,7 +5085,8 @@ if test -z "$ac_cpp_err"; then
ac_header_preproc=yes
else
echo "$as_me: failed program was:" >&5
- cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
@@ -4432,19 +5094,36 @@ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6
# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc in
- yes:no )
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
{ echo "$as_me:$LINENO: WARNING: tcl8.5/tcl.h: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: tcl8.5/tcl.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: tcl8.5/tcl.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: tcl8.5/tcl.h: proceeding with the preprocessor's result" >&2;};;
- no:yes )
+ { echo "$as_me:$LINENO: WARNING: tcl8.5/tcl.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: tcl8.5/tcl.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
{ echo "$as_me:$LINENO: WARNING: tcl8.5/tcl.h: present but cannot be compiled" >&5
echo "$as_me: WARNING: tcl8.5/tcl.h: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: tcl8.5/tcl.h: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: tcl8.5/tcl.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tcl8.5/tcl.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: tcl8.5/tcl.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tcl8.5/tcl.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: tcl8.5/tcl.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tcl8.5/tcl.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: tcl8.5/tcl.h: section \"Present But Cannot Be Compiled\"" >&2;}
{ echo "$as_me:$LINENO: WARNING: tcl8.5/tcl.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: tcl8.5/tcl.h: proceeding with the preprocessor's result" >&2;};;
+echo "$as_me: WARNING: tcl8.5/tcl.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tcl8.5/tcl.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: tcl8.5/tcl.h: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists. ##
+## ------------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
esac
echo "$as_me:$LINENO: checking for tcl8.5/tcl.h" >&5
echo $ECHO_N "checking for tcl8.5/tcl.h... $ECHO_C" >&6
@@ -4478,18 +5157,31 @@ else
echo "$as_me:$LINENO: checking tcl8.4/tcl.h usability" >&5
echo $ECHO_N "checking tcl8.4/tcl.h usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
$ac_includes_default
#include <tcl8.4/tcl.h>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
+ (eval $ac_compile) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4498,10 +5190,11 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
ac_header_compiler=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_header_compiler=no
fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6
@@ -4509,20 +5202,24 @@ echo "${ECHO_T}$ac_header_compiler" >&6
echo "$as_me:$LINENO: checking tcl8.4/tcl.h presence" >&5
echo $ECHO_N "checking tcl8.4/tcl.h presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <tcl8.4/tcl.h>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
- egrep -v '^ *\+' conftest.er1 >conftest.err
+ grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
@@ -4533,7 +5230,8 @@ if test -z "$ac_cpp_err"; then
ac_header_preproc=yes
else
echo "$as_me: failed program was:" >&5
- cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
@@ -4541,19 +5239,36 @@ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6
# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc in
- yes:no )
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
{ echo "$as_me:$LINENO: WARNING: tcl8.4/tcl.h: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: tcl8.4/tcl.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: tcl8.4/tcl.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: tcl8.4/tcl.h: proceeding with the preprocessor's result" >&2;};;
- no:yes )
+ { echo "$as_me:$LINENO: WARNING: tcl8.4/tcl.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: tcl8.4/tcl.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
{ echo "$as_me:$LINENO: WARNING: tcl8.4/tcl.h: present but cannot be compiled" >&5
echo "$as_me: WARNING: tcl8.4/tcl.h: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: tcl8.4/tcl.h: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: tcl8.4/tcl.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tcl8.4/tcl.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: tcl8.4/tcl.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tcl8.4/tcl.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: tcl8.4/tcl.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tcl8.4/tcl.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: tcl8.4/tcl.h: section \"Present But Cannot Be Compiled\"" >&2;}
{ echo "$as_me:$LINENO: WARNING: tcl8.4/tcl.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: tcl8.4/tcl.h: proceeding with the preprocessor's result" >&2;};;
+echo "$as_me: WARNING: tcl8.4/tcl.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tcl8.4/tcl.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: tcl8.4/tcl.h: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists. ##
+## ------------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
esac
echo "$as_me:$LINENO: checking for tcl8.4/tcl.h" >&5
echo $ECHO_N "checking for tcl8.4/tcl.h... $ECHO_C" >&6
@@ -4587,18 +5302,31 @@ else
echo "$as_me:$LINENO: checking tcl8.3/tcl.h usability" >&5
echo $ECHO_N "checking tcl8.3/tcl.h usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
$ac_includes_default
#include <tcl8.3/tcl.h>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
+ (eval $ac_compile) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4607,10 +5335,11 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
ac_header_compiler=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_header_compiler=no
fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6
@@ -4618,20 +5347,24 @@ echo "${ECHO_T}$ac_header_compiler" >&6
echo "$as_me:$LINENO: checking tcl8.3/tcl.h presence" >&5
echo $ECHO_N "checking tcl8.3/tcl.h presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <tcl8.3/tcl.h>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
- egrep -v '^ *\+' conftest.er1 >conftest.err
+ grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
@@ -4642,7 +5375,8 @@ if test -z "$ac_cpp_err"; then
ac_header_preproc=yes
else
echo "$as_me: failed program was:" >&5
- cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
@@ -4650,19 +5384,36 @@ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6
# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc in
- yes:no )
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
{ echo "$as_me:$LINENO: WARNING: tcl8.3/tcl.h: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: tcl8.3/tcl.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: tcl8.3/tcl.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: tcl8.3/tcl.h: proceeding with the preprocessor's result" >&2;};;
- no:yes )
+ { echo "$as_me:$LINENO: WARNING: tcl8.3/tcl.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: tcl8.3/tcl.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
{ echo "$as_me:$LINENO: WARNING: tcl8.3/tcl.h: present but cannot be compiled" >&5
echo "$as_me: WARNING: tcl8.3/tcl.h: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: tcl8.3/tcl.h: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: tcl8.3/tcl.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tcl8.3/tcl.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: tcl8.3/tcl.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tcl8.3/tcl.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: tcl8.3/tcl.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tcl8.3/tcl.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: tcl8.3/tcl.h: section \"Present But Cannot Be Compiled\"" >&2;}
{ echo "$as_me:$LINENO: WARNING: tcl8.3/tcl.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: tcl8.3/tcl.h: proceeding with the preprocessor's result" >&2;};;
+echo "$as_me: WARNING: tcl8.3/tcl.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tcl8.3/tcl.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: tcl8.3/tcl.h: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists. ##
+## ------------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
esac
echo "$as_me:$LINENO: checking for tcl8.3/tcl.h" >&5
echo $ECHO_N "checking for tcl8.3/tcl.h... $ECHO_C" >&6
@@ -4696,18 +5447,31 @@ else
echo "$as_me:$LINENO: checking tcl8.2/tcl.h usability" >&5
echo $ECHO_N "checking tcl8.2/tcl.h usability... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
$ac_includes_default
#include <tcl8.2/tcl.h>
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
- (eval $ac_compile) 2>&5
+ (eval $ac_compile) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest.$ac_objext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4716,10 +5480,11 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
ac_header_compiler=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_header_compiler=no
fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
echo "${ECHO_T}$ac_header_compiler" >&6
@@ -4727,20 +5492,24 @@ echo "${ECHO_T}$ac_header_compiler" >&6
echo "$as_me:$LINENO: checking tcl8.2/tcl.h presence" >&5
echo $ECHO_N "checking tcl8.2/tcl.h presence... $ECHO_C" >&6
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
#include <tcl8.2/tcl.h>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
- egrep -v '^ *\+' conftest.er1 >conftest.err
+ grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
+ ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
else
ac_cpp_err=
fi
@@ -4751,7 +5520,8 @@ if test -z "$ac_cpp_err"; then
ac_header_preproc=yes
else
echo "$as_me: failed program was:" >&5
- cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_header_preproc=no
fi
rm -f conftest.err conftest.$ac_ext
@@ -4759,19 +5529,36 @@ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
echo "${ECHO_T}$ac_header_preproc" >&6
# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc in
- yes:no )
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
{ echo "$as_me:$LINENO: WARNING: tcl8.2/tcl.h: accepted by the compiler, rejected by the preprocessor!" >&5
echo "$as_me: WARNING: tcl8.2/tcl.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: tcl8.2/tcl.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: tcl8.2/tcl.h: proceeding with the preprocessor's result" >&2;};;
- no:yes )
+ { echo "$as_me:$LINENO: WARNING: tcl8.2/tcl.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: tcl8.2/tcl.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
{ echo "$as_me:$LINENO: WARNING: tcl8.2/tcl.h: present but cannot be compiled" >&5
echo "$as_me: WARNING: tcl8.2/tcl.h: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: tcl8.2/tcl.h: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: tcl8.2/tcl.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tcl8.2/tcl.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: tcl8.2/tcl.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tcl8.2/tcl.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: tcl8.2/tcl.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tcl8.2/tcl.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: tcl8.2/tcl.h: section \"Present But Cannot Be Compiled\"" >&2;}
{ echo "$as_me:$LINENO: WARNING: tcl8.2/tcl.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: tcl8.2/tcl.h: proceeding with the preprocessor's result" >&2;};;
+echo "$as_me: WARNING: tcl8.2/tcl.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: tcl8.2/tcl.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: tcl8.2/tcl.h: in the future, the compiler will take precedence" >&2;}
+ (
+ cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists. ##
+## ------------------------------------------ ##
+_ASBOX
+ ) |
+ sed "s/^/$as_me: WARNING: /" >&2
+ ;;
esac
echo "$as_me:$LINENO: checking for tcl8.2/tcl.h" >&5
echo $ECHO_N "checking for tcl8.2/tcl.h... $ECHO_C" >&6
@@ -4805,16 +5592,13 @@ else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ltcl8.7 $LIBS"
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
-#ifdef F77_DUMMY_MAIN
-# ifdef __cplusplus
- extern "C"
-# endif
- int F77_DUMMY_MAIN() { return 1; }
-#endif
int
main ()
{
@@ -4825,11 +5609,21 @@ main ();
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest$ac_exeext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4838,10 +5632,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_cv_lib_tcl8_7_main=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_cv_lib_tcl8_7_main=no
fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_tcl8_7_main" >&5
@@ -4863,16 +5659,13 @@ else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ltcl8.6 $LIBS"
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
-#ifdef F77_DUMMY_MAIN
-# ifdef __cplusplus
- extern "C"
-# endif
- int F77_DUMMY_MAIN() { return 1; }
-#endif
int
main ()
{
@@ -4883,11 +5676,21 @@ main ();
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest$ac_exeext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4896,10 +5699,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_cv_lib_tcl8_6_main=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_cv_lib_tcl8_6_main=no
fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_tcl8_6_main" >&5
@@ -4921,16 +5726,13 @@ else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ltcl8.5 $LIBS"
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
-#ifdef F77_DUMMY_MAIN
-# ifdef __cplusplus
- extern "C"
-# endif
- int F77_DUMMY_MAIN() { return 1; }
-#endif
int
main ()
{
@@ -4941,11 +5743,21 @@ main ();
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest$ac_exeext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -4954,10 +5766,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_cv_lib_tcl8_5_main=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_cv_lib_tcl8_5_main=no
fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_tcl8_5_main" >&5
@@ -4979,16 +5793,13 @@ else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ltcl8.4 $LIBS"
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
-#ifdef F77_DUMMY_MAIN
-# ifdef __cplusplus
- extern "C"
-# endif
- int F77_DUMMY_MAIN() { return 1; }
-#endif
int
main ()
{
@@ -4999,11 +5810,21 @@ main ();
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest$ac_exeext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5012,10 +5833,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_cv_lib_tcl8_4_main=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_cv_lib_tcl8_4_main=no
fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_tcl8_4_main" >&5
@@ -5037,16 +5860,13 @@ else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ltcl8.3 $LIBS"
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
-#ifdef F77_DUMMY_MAIN
-# ifdef __cplusplus
- extern "C"
-# endif
- int F77_DUMMY_MAIN() { return 1; }
-#endif
int
main ()
{
@@ -5057,11 +5877,21 @@ main ();
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest$ac_exeext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5070,10 +5900,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_cv_lib_tcl8_3_main=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_cv_lib_tcl8_3_main=no
fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_tcl8_3_main" >&5
@@ -5095,16 +5927,13 @@ else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ltcl8.2 $LIBS"
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
-#ifdef F77_DUMMY_MAIN
-# ifdef __cplusplus
- extern "C"
-# endif
- int F77_DUMMY_MAIN() { return 1; }
-#endif
int
main ()
{
@@ -5115,11 +5944,21 @@ main ();
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest$ac_exeext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5128,10 +5967,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_cv_lib_tcl8_2_main=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_cv_lib_tcl8_2_main=no
fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_tcl8_2_main" >&5
@@ -5153,16 +5994,13 @@ else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ltcl8.0 $LIBS"
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
-#ifdef F77_DUMMY_MAIN
-# ifdef __cplusplus
- extern "C"
-# endif
- int F77_DUMMY_MAIN() { return 1; }
-#endif
int
main ()
{
@@ -5173,11 +6011,21 @@ main ();
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest$ac_exeext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5186,10 +6034,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_cv_lib_tcl8_0_main=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_cv_lib_tcl8_0_main=no
fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_tcl8_0_main" >&5
@@ -5227,16 +6077,13 @@ else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ltk8.7 $LIBS"
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
-#ifdef F77_DUMMY_MAIN
-# ifdef __cplusplus
- extern "C"
-# endif
- int F77_DUMMY_MAIN() { return 1; }
-#endif
int
main ()
{
@@ -5247,11 +6094,21 @@ main ();
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest$ac_exeext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5260,10 +6117,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_cv_lib_tk8_7_main=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_cv_lib_tk8_7_main=no
fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_tk8_7_main" >&5
@@ -5285,16 +6144,13 @@ else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ltk8.6 $LIBS"
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
-#ifdef F77_DUMMY_MAIN
-# ifdef __cplusplus
- extern "C"
-# endif
- int F77_DUMMY_MAIN() { return 1; }
-#endif
int
main ()
{
@@ -5305,11 +6161,21 @@ main ();
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest$ac_exeext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5318,10 +6184,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_cv_lib_tk8_6_main=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_cv_lib_tk8_6_main=no
fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_tk8_6_main" >&5
@@ -5343,16 +6211,13 @@ else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ltk8.5 $LIBS"
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
-#ifdef F77_DUMMY_MAIN
-# ifdef __cplusplus
- extern "C"
-# endif
- int F77_DUMMY_MAIN() { return 1; }
-#endif
int
main ()
{
@@ -5363,11 +6228,21 @@ main ();
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest$ac_exeext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5376,10 +6251,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_cv_lib_tk8_5_main=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_cv_lib_tk8_5_main=no
fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_tk8_5_main" >&5
@@ -5401,16 +6278,13 @@ else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ltk8.4 $LIBS"
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
-#ifdef F77_DUMMY_MAIN
-# ifdef __cplusplus
- extern "C"
-# endif
- int F77_DUMMY_MAIN() { return 1; }
-#endif
int
main ()
{
@@ -5421,11 +6295,21 @@ main ();
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest$ac_exeext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5434,10 +6318,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_cv_lib_tk8_4_main=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_cv_lib_tk8_4_main=no
fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_tk8_4_main" >&5
@@ -5459,16 +6345,13 @@ else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ltk8.3 $LIBS"
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
-#ifdef F77_DUMMY_MAIN
-# ifdef __cplusplus
- extern "C"
-# endif
- int F77_DUMMY_MAIN() { return 1; }
-#endif
int
main ()
{
@@ -5479,11 +6362,21 @@ main ();
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest$ac_exeext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5492,10 +6385,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_cv_lib_tk8_3_main=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_cv_lib_tk8_3_main=no
fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_tk8_3_main" >&5
@@ -5517,16 +6412,13 @@ else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ltk8.2 $LIBS"
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
-#ifdef F77_DUMMY_MAIN
-# ifdef __cplusplus
- extern "C"
-# endif
- int F77_DUMMY_MAIN() { return 1; }
-#endif
int
main ()
{
@@ -5537,11 +6429,21 @@ main ();
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest$ac_exeext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5550,10 +6452,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_cv_lib_tk8_2_main=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_cv_lib_tk8_2_main=no
fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_tk8_2_main" >&5
@@ -5575,16 +6479,13 @@ else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ltk8.0 $LIBS"
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
-#ifdef F77_DUMMY_MAIN
-# ifdef __cplusplus
- extern "C"
-# endif
- int F77_DUMMY_MAIN() { return 1; }
-#endif
int
main ()
{
@@ -5595,11 +6496,21 @@ main ();
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest$ac_exeext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5608,10 +6519,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_cv_lib_tk8_0_main=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_cv_lib_tk8_0_main=no
fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_tk8_0_main" >&5
@@ -5654,8 +6567,11 @@ else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lasound $LIBS"
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
@@ -5664,12 +6580,6 @@ extern "C"
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char snd_pcm_info ();
-#ifdef F77_DUMMY_MAIN
-# ifdef __cplusplus
- extern "C"
-# endif
- int F77_DUMMY_MAIN() { return 1; }
-#endif
int
main ()
{
@@ -5680,11 +6590,21 @@ snd_pcm_info ();
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest$ac_exeext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5693,10 +6613,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_cv_lib_asound_snd_pcm_info=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_cv_lib_asound_snd_pcm_info=no
fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_asound_snd_pcm_info" >&5
@@ -5718,8 +6640,11 @@ else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lrt $LIBS"
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
@@ -5728,12 +6653,6 @@ extern "C"
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char shm_open ();
-#ifdef F77_DUMMY_MAIN
-# ifdef __cplusplus
- extern "C"
-# endif
- int F77_DUMMY_MAIN() { return 1; }
-#endif
int
main ()
{
@@ -5744,11 +6663,21 @@ shm_open ();
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest$ac_exeext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5757,10 +6686,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_cv_lib_rt_shm_open=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_cv_lib_rt_shm_open=no
fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_rt_shm_open" >&5
@@ -5777,8 +6708,11 @@ else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ljack $LIBS"
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
@@ -5787,12 +6721,6 @@ extern "C"
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char jack_set_xrun_callback ();
-#ifdef F77_DUMMY_MAIN
-# ifdef __cplusplus
- extern "C"
-# endif
- int F77_DUMMY_MAIN() { return 1; }
-#endif
int
main ()
{
@@ -5803,11 +6731,21 @@ jack_set_xrun_callback ();
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest$ac_exeext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5816,10 +6754,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_cv_lib_jack_jack_set_xrun_callback=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_cv_lib_jack_jack_set_xrun_callback=no
fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_jack_jack_set_xrun_callback" >&5
@@ -5838,8 +6778,11 @@ else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ljack $LIBS"
cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
@@ -5848,12 +6791,6 @@ extern "C"
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char jack_set_error_function ();
-#ifdef F77_DUMMY_MAIN
-# ifdef __cplusplus
- extern "C"
-# endif
- int F77_DUMMY_MAIN() { return 1; }
-#endif
int
main ()
{
@@ -5864,11 +6801,21 @@ jack_set_error_function ();
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
+ (eval $ac_link) 2>conftest.er1
ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
- { ac_try='test -s conftest$ac_exeext'
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
@@ -5877,10 +6824,12 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
ac_cv_lib_jack_jack_set_error_function=yes
else
echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
ac_cv_lib_jack_jack_set_error_function=no
fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_jack_jack_set_error_function" >&5
@@ -5897,22 +6846,24 @@ fi
LDFLAGS="$LDFLAGS -static"
fi
EXT=pd_linux
- MORECFLAGS="-DDL_OPEN -DPA_USE_OSS -DPA_LITTLE_ENDIAN \
+ MORECFLAGS="-DDL_OPEN -DPA_USE_OSS -DPA_LITTLE_ENDIAN -DUNIX -DUNISTD\
-DUSEAPI_OSS \
- -I../portaudio/pa_common \
- -I../portaudio/pablio -I../portaudio/portmidi-macosx \
+ -I../portaudio/pa_common -I../portaudio/pablio \
+ -I../portaudio/portmidi-macosx \
-fno-strict-aliasing"
SYSSRC="s_midi_oss.c s_audio_oss.c"
if test x$alsa == "xyes";
then
- SYSSRC=$SYSSRC" s_audio_alsa.c"
+ SYSSRC=$SYSSRC" s_audio_alsa.c s_audio_alsamm.c"
MORECFLAGS=$MORECFLAGS" -DPA_USE_ALSA -DUSEAPI_ALSA"
LDFLAGS=$LDFLAGS" -lasound"
fi
if test x$portaudio == "xyes";
then
- MORECFLAGS="-DUSEAPI_PORTAUDIO "$MORECFLAGS
+ MORECFLAGS="-DUSEAPI_PORTAUDIO -DPA19 "$MORECFLAGS
SYSSRC="s_audio_pa.c \
+ s_audio_pablio.c \
+ s_audio_paring.c \
../portaudio/pa_common/pa_allocation.c \
../portaudio/pa_common/pa_converters.c \
../portaudio/pa_common/pa_cpuload.c \
@@ -5922,19 +6873,19 @@ fi
../portaudio/pa_common/pa_skeleton.c \
../portaudio/pa_common/pa_stream.c \
../portaudio/pa_common/pa_trace.c \
- ../portaudio/pablio/pablio_pd.c \
- ../portaudio/pablio/ringbuffer_pd.c \
../portaudio/pa_unix/pa_unix_hostapis.c \
../portaudio/pa_unix/pa_unix_util.c \
../portaudio/pa_unix_oss/pa_unix_oss.c "$SYSSRC
if test x$alsa == "xyes";
then
- SYSSRC=$SYSSRC" \
- ../portaudio/pa_linux_alsa/callback_thread.c \
- ../portaudio/pa_linux_alsa/pa_linux_alsa.c \
- ../portaudio/pa_linux_alsa/blocking_calls.c "
+ SYSSRC=$SYSSRC" ../portaudio/pa_linux_alsa/pa_linux_alsa.c"
+ MORECFLAGS=$MORECFLAGS" -Wno-error"
fi
fi
+ if test x$setuid == "xyes";
+ then
+ binarymode="-m4755"
+ fi
STRIPFLAG=-s
GUINAME="pd-gui"
if test x$USE_OPT_CFLAGS == "xyes";
@@ -5949,22 +6900,21 @@ fi
if test `uname -s` = Darwin;
then
- LDFLAGS="-Wl -framework Tcl -framework Tk -framework CoreAudio \
+ LDFLAGS="-Wl -framework CoreAudio \
-framework AudioUnit -framework AudioToolbox \
-framework Carbon -framework CoreMIDI"
EXT=pd_darwin
- MORECFLAGS="-DMACOSX -I/usr/X11R6/include \
- -I../portaudio_v18/pa_common \
- -I../portaudio_v18/pablio \
+ MORECFLAGS="-DMACOSX -DUNISTD -I/usr/X11R6/include \
+ -I../portaudio_v18/pa_common -I../portaudio_v18/pablio \
-I../portmidi_osx \
-Wno-error \
-DUSEAPI_PORTAUDIO -DPA_BIG_ENDIAN"
SYSSRC="s_midi_pm.c s_audio_pa.c \
+ s_audio_pablio.c \
+ s_audio_paring.c \
../portaudio_v18/pa_common/pa_lib.c \
../portaudio_v18/pa_common/pa_trace.c \
../portaudio_v18/pa_common/pa_convert.c \
- ../portaudio_v18/pablio/pablio_pd.c \
- ../portaudio_v18/pablio/ringbuffer_pd.c \
../portaudio_v18/pa_mac_core/pa_mac_core.c \
../portmidi_osx/pmdarwin.c \
../portmidi_osx/pmmacosx.c \
@@ -5973,10 +6923,10 @@ then
../portmidi_osx/ptdarwin.c "
STRIPFLAG=""
GUINAME="pdtcl"
- GUIFLAGS="-framework Tcl -framework Tk \
- -I/Library/Frameworks/Tk.framework/Versions/Current/Headers \
- -I/Library/Frameworks/Tcl.framework/Versions/Current/Headers \
- -I/Library/Frameworks/Tcl.framework/Versions/8.4/PrivateHeaders"
+ GUIFLAGS="-F../../Frameworks -framework Tcl -framework Tk \
+ -I../../Frameworks/Tk.framework/Versions/Current/Headers \
+ -I../../Frameworks/Tcl.framework/Versions/Current/Headers \
+ -I../../Frameworks/Tcl.framework/Versions/8.4/PrivateHeaders"
if test x$USE_OPT_CFLAGS == "xyes";
then
OPT_CFLAGS="-O2"
@@ -5994,6 +6944,7 @@ then
fi
# support for jack, on either linux or darwin:
+
if test x$jack == "xyes";
then
MORECFLAGS=$MORECFLAGS" -DUSEAPI_JACK"
@@ -6019,7 +6970,7 @@ then
MORECFLAGS=$MORECFLAGS" -g3 -D__COMPAQC__ -arch host"
fi
-ac_config_files="$ac_config_files makefile"
+ ac_config_files="$ac_config_files makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
@@ -6030,7 +6981,7 @@ cat >confcache <<\_ACEOF
# config.status only pays attention to the cache file if you give it
# the --recheck option to rerun configure.
#
-# `ac_cv_env_foo' variables (set or unset) will be overriden when
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
# loading this file, other *unset* `ac_cv_foo' will be assigned the
# following values.
@@ -6048,13 +6999,13 @@ _ACEOF
# `set' does not quote correctly, so add quotes (double-quote
# substitution turns \\\\ into \\, and sed turns \\ into \).
sed -n \
- "s/'/'\\\\''/g;
- s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
;;
*)
# `set' quotes correctly as required by POSIX, so do not add quotes.
sed -n \
- "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
;;
esac;
} |
@@ -6065,7 +7016,7 @@ _ACEOF
t end
/^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
: end' >>confcache
-if cmp -s $cache_file confcache; then :; else
+if diff $cache_file confcache >/dev/null 2>&1; then :; else
if test -w $cache_file; then
test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
cat confcache >$cache_file
@@ -6084,13 +7035,13 @@ test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
# trailing colons and then remove the whole line if VPATH becomes empty
# (actually we leave an empty line to preserve line numbers).
if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=/{
+ ac_vpsub='/^[ ]*VPATH[ ]*=/{
s/:*\$(srcdir):*/:/;
s/:*\${srcdir}:*/:/;
s/:*@srcdir@:*/:/;
-s/^\([^=]*=[ ]*\):*/\1/;
+s/^\([^=]*=[ ]*\):*/\1/;
s/:*$//;
-s/^[^=]*=[ ]*$//;
+s/^[^=]*=[ ]*$//;
}'
fi
@@ -6104,13 +7055,13 @@ fi
cat >confdef2opt.sed <<\_ACEOF
t clear
: clear
-s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g
+s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\),-D\1=\2,g
t quote
-s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g
+s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\),-D\1=\2,g
t quote
d
: quote
-s,[ `~#$^&*(){}\\|;'"<>?],\\&,g
+s,[ `~#$^&*(){}\\|;'"<>?],\\&,g
s,\[,\\&,g
s,\],\\&,g
s,\$,$$,g
@@ -6127,6 +7078,21 @@ DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'`
rm -f confdef2opt.sed
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_i=`echo "$ac_i" |
+ sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
+ # 2. Add them.
+ ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
+ ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
: ${CONFIG_STATUS=./config.status}
ac_clean_files_save=$ac_clean_files
@@ -6141,11 +7107,12 @@ cat >$CONFIG_STATUS <<_ACEOF
# configure, is in config.log if it exists.
debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
SHELL=\${CONFIG_SHELL-$SHELL}
_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
-
## --------------------- ##
## M4sh Initialization. ##
## --------------------- ##
@@ -6154,46 +7121,57 @@ cat >>$CONFIG_STATUS <<\_ACEOF
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
set -o posix
fi
+DUALCASE=1; export DUALCASE # for MKS sh
-# NLS nuisances.
# Support unset when possible.
-if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
as_unset=unset
else
as_unset=false
fi
-(set +x; test -n "`(LANG=C; export LANG) 2>&1`") &&
- { $as_unset LANG || test "${LANG+set}" != set; } ||
- { LANG=C; export LANG; }
-(set +x; test -n "`(LC_ALL=C; export LC_ALL) 2>&1`") &&
- { $as_unset LC_ALL || test "${LC_ALL+set}" != set; } ||
- { LC_ALL=C; export LC_ALL; }
-(set +x; test -n "`(LC_TIME=C; export LC_TIME) 2>&1`") &&
- { $as_unset LC_TIME || test "${LC_TIME+set}" != set; } ||
- { LC_TIME=C; export LC_TIME; }
-(set +x; test -n "`(LC_CTYPE=C; export LC_CTYPE) 2>&1`") &&
- { $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set; } ||
- { LC_CTYPE=C; export LC_CTYPE; }
-(set +x; test -n "`(LANGUAGE=C; export LANGUAGE) 2>&1`") &&
- { $as_unset LANGUAGE || test "${LANGUAGE+set}" != set; } ||
- { LANGUAGE=C; export LANGUAGE; }
-(set +x; test -n "`(LC_COLLATE=C; export LC_COLLATE) 2>&1`") &&
- { $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set; } ||
- { LC_COLLATE=C; export LC_COLLATE; }
-(set +x; test -n "`(LC_NUMERIC=C; export LC_NUMERIC) 2>&1`") &&
- { $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set; } ||
- { LC_NUMERIC=C; export LC_NUMERIC; }
-(set +x; test -n "`(LC_MESSAGES=C; export LC_MESSAGES) 2>&1`") &&
- { $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set; } ||
- { LC_MESSAGES=C; export LC_MESSAGES; }
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ $as_unset $as_var
+ fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
# Name of the executable.
-as_me=`(basename "$0") 2>/dev/null ||
+as_me=`$as_basename "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
X"$0" : 'X\(/\)$' \| \
@@ -6204,6 +7182,7 @@ echo X/"$0" |
/^X\/\(\/\).*/{ s//\1/; q; }
s/.*/./; q'`
+
# PATH needs CR, and LINENO needs CR and PATH.
# Avoid depending upon Character Ranges.
as_cr_letters='abcdefghijklmnopqrstuvwxyz'
@@ -6214,15 +7193,15 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits
# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conftest.sh
- echo "exit 0" >>conftest.sh
- chmod +x conftest.sh
- if (PATH=".;."; conftest.sh) >/dev/null 2>&1; then
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
PATH_SEPARATOR=';'
else
PATH_SEPARATOR=:
fi
- rm -f conftest.sh
+ rm -f conf$$.sh
fi
@@ -6271,6 +7250,8 @@ do
as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
test "x$as_lineno_1" != "x$as_lineno_2" &&
test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
+ $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+ $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
CONFIG_SHELL=$as_dir/$as_base
export CONFIG_SHELL
exec "$CONFIG_SHELL" "$0" ${1+"$@"}
@@ -6344,13 +7325,20 @@ else
fi
rm -f conf$$ conf$$.exe conf$$.file
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
as_executable_p="test -f"
# Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
# Sed expression to map a string onto a valid variable name.
-as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
# IFS
@@ -6360,7 +7348,7 @@ as_nl='
IFS=" $as_nl"
# CDPATH.
-$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export CDPATH; }
+$as_unset CDPATH
exec 6>&1
@@ -6377,7 +7365,7 @@ _ASBOX
cat >&5 <<_CSEOF
This file was extended by $as_me, which was
-generated by GNU Autoconf 2.53. Invocation command line was
+generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
@@ -6417,10 +7405,11 @@ Usage: $0 [OPTIONS] [FILE]...
-h, --help print this help, then exit
-V, --version print version number, then exit
+ -q, --quiet do not print progress messages
-d, --debug don't remove temporary files
--recheck update $as_me by reconfiguring in the same conditions
--file=FILE[:TEMPLATE]
- instantiate the configuration file FILE
+ instantiate the configuration file FILE
Configuration files:
$config_files
@@ -6431,11 +7420,10 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
config.status
-configured by $0, generated by GNU Autoconf 2.53,
+configured by $0, generated by GNU Autoconf 2.59,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
-Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
-Free Software Foundation, Inc.
+Copyright (C) 2003 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
srcdir=$srcdir
@@ -6452,25 +7440,25 @@ do
--*=*)
ac_option=`expr "x$1" : 'x\([^=]*\)='`
ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
- shift
- set dummy "$ac_option" "$ac_optarg" ${1+"$@"}
- shift
+ ac_shift=:
+ ;;
+ -*)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
;;
- -*);;
*) # This is not an option, so the user has probably given explicit
# arguments.
+ ac_option=$1
ac_need_defaults=false;;
esac
- case $1 in
+ case $ac_option in
# Handling of the options.
_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- echo "running $SHELL $0 " $ac_configure_args " --no-create --no-recursion"
- exec $SHELL $0 $ac_configure_args --no-create --no-recursion ;;
-_ACEOF
cat >>$CONFIG_STATUS <<\_ACEOF
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
--version | --vers* | -V )
echo "$ac_cs_version"; exit 0 ;;
--he | --h)
@@ -6485,13 +7473,16 @@ Try \`$0 --help' for more information." >&2;}
--debug | --d* | -d )
debug=: ;;
--file | --fil | --fi | --f )
- shift
- CONFIG_FILES="$CONFIG_FILES $1"
+ $ac_shift
+ CONFIG_FILES="$CONFIG_FILES $ac_optarg"
ac_need_defaults=false;;
--header | --heade | --head | --hea )
- shift
- CONFIG_HEADERS="$CONFIG_HEADERS $1"
+ $ac_shift
+ CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
ac_need_defaults=false;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
# This is an error.
-*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
@@ -6506,6 +7497,20 @@ Try \`$0 --help' for more information." >&2;}
shift
done
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+ echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+ exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
+
_ACEOF
@@ -6532,6 +7537,9 @@ if $ac_need_defaults; then
test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
fi
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason to put it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
# Create a temporary directory, and hook for its removal unless debugging.
$debug ||
{
@@ -6540,17 +7548,17 @@ $debug ||
}
# Create a (secure) tmp directory for tmp files.
-: ${TMPDIR=/tmp}
+
{
- tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` &&
+ tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
test -n "$tmp" && test -d "$tmp"
} ||
{
- tmp=$TMPDIR/cs$$-$RANDOM
+ tmp=./confstat$$-$RANDOM
(umask 077 && mkdir $tmp)
} ||
{
- echo "$me: cannot create a temporary directory in $TMPDIR" >&2
+ echo "$me: cannot create a temporary directory in ." >&2
{ (exit 1); exit 1; }
}
@@ -6601,6 +7609,7 @@ s,@LIBS@,$LIBS,;t t
s,@alsa@,$alsa,;t t
s,@jack@,$jack,;t t
s,@portaudio@,$portaudio,;t t
+s,@binarymode@,$binarymode,;t t
s,@PDLIB@,$PDLIB,;t t
s,@MORECFLAGS@,$MORECFLAGS,;t t
s,@EXT@,$EXT,;t t
@@ -6624,6 +7633,9 @@ s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
s,@INSTALL_DATA@,$INSTALL_DATA,;t t
s,@SET_MAKE@,$SET_MAKE,;t t
s,@CPP@,$CPP,;t t
+s,@EGREP@,$EGREP,;t t
+s,@LIBOBJS@,$LIBOBJS,;t t
+s,@LTLIBOBJS@,$LTLIBOBJS,;t t
CEOF
_ACEOF
@@ -6653,9 +7665,9 @@ _ACEOF
(echo ':t
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
if test -z "$ac_sed_cmds"; then
- ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
+ ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
else
- ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
+ ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
fi
ac_sed_frag=`expr $ac_sed_frag + 1`
ac_beg=$ac_end
@@ -6673,46 +7685,51 @@ for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
# Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
case $ac_file in
- | *:- | *:-:* ) # input from stdin
- cat >$tmp/stdin
- ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ cat >$tmp/stdin
+ ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
*:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
- ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+ ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
* ) ac_file_in=$ac_file.in ;;
esac
# Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
ac_dir=`(dirname "$ac_file") 2>/dev/null ||
$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$ac_file" : 'X\(//\)[^/]' \| \
- X"$ac_file" : 'X\(//\)$' \| \
- X"$ac_file" : 'X\(/\)' \| \
- . : '\(.\)' 2>/dev/null ||
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
echo X"$ac_file" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
/^X\(\/\/\)[^/].*/{ s//\1/; q; }
/^X\(\/\/\)$/{ s//\1/; q; }
/^X\(\/\).*/{ s//\1/; q; }
s/.*/./; q'`
- { case "$ac_dir" in
- [\\/]* | ?:[\\/]* ) as_incr_dir=;;
- *) as_incr_dir=.;;
-esac
-as_dummy="$ac_dir"
-for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do
- case $as_mkdir_dir in
- # Skip DOS drivespec
- ?:) as_incr_dir=$as_mkdir_dir ;;
- *)
- as_incr_dir=$as_incr_dir/$as_mkdir_dir
- test -d "$as_incr_dir" ||
- mkdir "$as_incr_dir" ||
- { { echo "$as_me:$LINENO: error: cannot create \"$ac_dir\"" >&5
-echo "$as_me: error: cannot create \"$ac_dir\"" >&2;}
- { (exit 1); exit 1; }; }
- ;;
- esac
-done; }
+ { if $as_mkdir_p; then
+ mkdir -p "$ac_dir"
+ else
+ as_dir="$ac_dir"
+ as_dirs=
+ while test ! -d "$as_dir"; do
+ as_dirs="$as_dir $as_dirs"
+ as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+ /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+ /^X\(\/\/\)$/{ s//\1/; q; }
+ /^X\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+ done
+ test ! -n "$as_dirs" || mkdir $as_dirs
+ fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+ { (exit 1); exit 1; }; }; }
ac_builddir=.
@@ -6739,12 +7756,45 @@ case $srcdir in
ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
ac_top_srcdir=$ac_top_builddir$srcdir ;;
esac
-# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
-# absolute.
-ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
-ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd`
-ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
-ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+ case "$ac_dir" in
+ .) ac_abs_builddir=`pwd`;;
+ [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+ *) ac_abs_builddir=`pwd`/"$ac_dir";;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+ case ${ac_top_builddir}. in
+ .) ac_abs_top_builddir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+ *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+ case $ac_srcdir in
+ .) ac_abs_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+ *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+ esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+ case $ac_top_srcdir in
+ .) ac_abs_top_srcdir=$ac_abs_builddir;;
+ [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+ *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+ esac;;
+esac
case $INSTALL in
@@ -6766,7 +7816,7 @@ echo "$as_me: creating $ac_file" >&6;}
configure_input="$ac_file. "
fi
configure_input=$configure_input"Generated from `echo $ac_file_in |
- sed 's,.*/,,'` by configure."
+ sed 's,.*/,,'` by configure."
# First look for the input files in the build tree, otherwise in the
# src tree.
@@ -6775,24 +7825,24 @@ echo "$as_me: creating $ac_file" >&6;}
case $f in
-) echo $tmp/stdin ;;
[\\/$]*)
- # Absolute (can't be DOS-style, as IFS=:)
- test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+ # Absolute (can't be DOS-style, as IFS=:)
+ test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
echo "$as_me: error: cannot find input file: $f" >&2;}
{ (exit 1); exit 1; }; }
- echo $f;;
+ echo "$f";;
*) # Relative
- if test -f "$f"; then
- # Build tree
- echo $f
- elif test -f "$srcdir/$f"; then
- # Source tree
- echo $srcdir/$f
- else
- # /dev/null tree
- { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+ if test -f "$f"; then
+ # Build tree
+ echo "$f"
+ elif test -f "$srcdir/$f"; then
+ # Source tree
+ echo "$srcdir/$f"
+ else
+ # /dev/null tree
+ { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
echo "$as_me: error: cannot find input file: $f" >&2;}
{ (exit 1); exit 1; }; }
- fi;;
+ fi;;
esac
done` || { (exit 1); exit 1; }
_ACEOF
@@ -6843,8 +7893,11 @@ ac_clean_files=$ac_clean_files_save
# need to make the FD available again.
if test "$no_create" != yes; then
ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
exec 5>/dev/null
- $SHELL $CONFIG_STATUS || ac_cs_success=false
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
exec 5>>config.log
# Use ||, not &&, to avoid exiting from the if with $? = 1, which
# would make configure fail if this is the last instruction.
diff --git a/pd/src/configure.in b/pd/src/configure.in
index 66ba7178..ff6deded 100644
--- a/pd/src/configure.in
+++ b/pd/src/configure.in
@@ -21,7 +21,7 @@ dnl other defaults
dnl check for features
-AC_ARG_ENABLE(alsa, [ --disable-alsa disable ALSA],
+AC_ARG_ENABLE(alsa, [ --disable-alsa force disabling ALSA],
alsa="no")
AC_ARG_ENABLE(jack, [ --enable-jack jack audio server],
jack="yes")
diff --git a/pd/src/d_array.c b/pd/src/d_array.c
index 55e866bd..38beff5d 100644
--- a/pd/src/d_array.c
+++ b/pd/src/d_array.c
@@ -895,7 +895,7 @@ static void tabread_setup(void)
A_SYMBOL, 0);
}
-/* ---------- tabread4: control, non-interpolating ------------------------ */
+/* ---------- tabread4: control, 4-point interpolation --------------- */
static t_class *tabread4_class;
diff --git a/pd/src/g_canvas.c b/pd/src/g_canvas.c
index 2d124ac3..a1beb8a8 100644
--- a/pd/src/g_canvas.c
+++ b/pd/src/g_canvas.c
@@ -84,7 +84,7 @@ static void glist_doupdatewindowlist(t_glist *gl, char *sbuf)
{
char tbuf[1024];
sprintf(tbuf, "{%s .x%lx} ", gl->gl_name->s_name,
- (t_int)canvas);
+ (t_int)canvas);
strcat(sbuf, tbuf);
}
}
@@ -723,8 +723,11 @@ void canvas_vis(t_canvas *x, t_floatarg f)
int flag = (f != 0);
if (flag)
{
+ /* post("havewindow %d, isgraph %d, isvisible %d editor %d",
+ x->gl_havewindow, x->gl_isgraph, glist_isvisible(x),
+ (x->gl_editor != 0)); */
/* test if we're already visible and toplevel */
- if (glist_isvisible(x) && !x->gl_isgraph)
+ if (x->gl_editor)
{ /* just put us in front */
#ifdef MSW
canvas_vis(x, 0);
@@ -1114,6 +1117,14 @@ static void canvas_rename_method(t_canvas *x, t_symbol *s, int ac, t_atom *av)
{
if (ac && av->a_type == A_SYMBOL)
canvas_rename(x, av->a_w.w_symbol, 0);
+ else if (ac && av->a_type == A_DOLLSYM)
+ {
+ t_canvasenvironment *e = canvas_getenv(x);
+ canvas_setcurrent(x);
+ canvas_rename(x, binbuf_realizedollsym(av->a_w.w_symbol,
+ e->ce_argc, e->ce_argv, 1), 0);
+ canvas_unsetcurrent(x);
+ }
else canvas_rename(x, gensym("Pd"), 0);
}
diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c
index b01939fa..77d8cba5 100644
--- a/pd/src/g_editor.c
+++ b/pd/src/g_editor.c
@@ -1342,8 +1342,9 @@ void canvas_mouseup(t_canvas *x,
gobj_activate(x->gl_editor->e_selection->sel_what,
x, 1);
}
- else if (x->gl_editor->e_onmotion == MA_PASSOUT)
- x->gl_editor->e_onmotion = 0;
+ if (x->gl_editor->e_onmotion != MA_NONE)
+ sys_vgui("pdtk_canvas_getscroll .x%lx.c\n", x);
+
x->gl_editor->e_onmotion = MA_NONE;
}
@@ -1813,7 +1814,6 @@ static void canvas_copy(t_canvas *x)
canvas_textcopybuf = (char *)getbytes(bufsize);
memcpy(canvas_textcopybuf, buf, bufsize);
canvas_textcopybufsize = bufsize;
- post("buf size %d", bufsize);
#else /* UNIX */
/* otherwise just copy the text to the clipboard here */
sys_vgui("clipboard clear\n", bufsize, buf);
@@ -1846,7 +1846,6 @@ static void canvas_doclear(t_canvas *x)
t_gobj *y, *y2;
int dspstate;
- post("doclear");
dspstate = canvas_suspend_dsp();
if (x->gl_editor->e_selectedline)
{
@@ -2033,19 +2032,19 @@ void canvas_connect(t_canvas *x, t_floatarg fwhoout, t_floatarg foutno,
for (sink = x->gl_list; whoin; sink = sink->g_next, whoin--)
if (!sink->g_next) goto bad;
- /* check they're both patchable objects */
+ /* check they're both patchable objects */
if (!(objsrc = pd_checkobject(&src->g_pd)) ||
!(objsink = pd_checkobject(&sink->g_pd)))
goto bad;
- /* if object creation failed, make dummy inlets or outlets
- as needed */
+ /* if object creation failed, make dummy inlets or outlets
+ as needed */
if (pd_class(&src->g_pd) == text_class && objsrc->te_type == T_OBJECT)
- while (outno >= obj_noutlets(objsrc))
- outlet_new(objsrc, &s_);
+ while (outno >= obj_noutlets(objsrc))
+ outlet_new(objsrc, &s_);
if (pd_class(&sink->g_pd) == text_class && objsink->te_type == T_OBJECT)
- while (inno >= obj_ninlets(objsink))
- inlet_new(objsink, &objsink->ob_pd, &s_, &s_);
+ while (inno >= obj_ninlets(objsink))
+ inlet_new(objsink, &objsink->ob_pd, &s_, &s_);
if (!(oc = obj_connect(objsrc, outno, objsink, inno))) goto bad;
if (glist_isvisible(x))
diff --git a/pd/src/g_graph.c b/pd/src/g_graph.c
index b7ae4d81..8bb76ac0 100644
--- a/pd/src/g_graph.c
+++ b/pd/src/g_graph.c
@@ -113,10 +113,22 @@ void glist_delete(t_glist *x, t_gobj *y)
void glist_clear(t_glist *x)
{
t_gobj *y, *y2;
- int dspstate = canvas_suspend_dsp();
+ int dspstate = 0, suspended = 0;
+ t_symbol *dspsym = gensym("dsp");
while (y = x->gl_list)
+ {
+ /* to avoid unnecessary DSP resorting, we suspend DSP
+ only if we hit a patchable object. */
+ if (!suspended && pd_checkobject(&y->g_pd) && zgetfn(&y->g_pd, dspsym))
+ {
+ dspstate = canvas_suspend_dsp();
+ suspended = 1;
+ }
+ /* here's the real deletion. */
glist_delete(x, y);
- canvas_resume_dsp(dspstate);
+ }
+ if (suspended)
+ canvas_resume_dsp(dspstate);
}
void glist_retext(t_glist *glist, t_text *y)
@@ -618,7 +630,7 @@ void glist_redraw(t_glist *x)
glist_getcanvas(x), oc,
t.tr_lx1, t.tr_ly1, t.tr_lx2, t.tr_ly2);
}
- if (x->gl_owner)
+ if (x->gl_owner && glist_isvisible(x->gl_owner))
{
graph_vis(&x->gl_gobj, x->gl_owner, 0);
graph_vis(&x->gl_gobj, x->gl_owner, 1);
diff --git a/pd/src/g_hdial.c b/pd/src/g_hdial.c
index cedb4770..3da1ef71 100644
--- a/pd/src/g_hdial.c
+++ b/pd/src/g_hdial.c
@@ -239,8 +239,7 @@ static void hradio_save(t_gobj *z, t_binbuf *b)
iemgui_save(&x->x_gui, srl, bflcol);
binbuf_addv(b, "ssiisiiiisssiiiiiiii", gensym("#X"),gensym("obj"),
- (int)text_xpix(&x->x_gui.x_obj, x->x_gui.x_glist),
- (int)text_ypix(&x->x_gui.x_obj, x->x_gui.x_glist),
+ (int)x->x_gui.x_obj.te_xpix, (int)x->x_gui.x_obj.te_ypix,
(pd_class(&x->x_gui.x_obj.ob_pd) == hradio_old_class ?
gensym("hdl") : gensym("hradio")),
x->x_gui.x_w,
diff --git a/pd/src/g_io.c b/pd/src/g_io.c
index d252fc47..4b4fb9b1 100644
--- a/pd/src/g_io.c
+++ b/pd/src/g_io.c
@@ -250,7 +250,6 @@ void vinlet_dspprolog(t_vinlet *x, t_signal **parentsigs,
}
}
-//static void *vinlet_newsig(void)
static void *vinlet_newsig(t_symbol *s)
{
t_vinlet *x = (t_vinlet *)pd_new(vinlet_class);
@@ -421,7 +420,6 @@ static t_int *voutlet_doepilog(t_int *w)
static t_int *voutlet_doepilog_resampling(t_int *w)
{
t_voutlet *x = (t_voutlet *)(w[1]);
- // t_float *dummy = (t_float *)(w[2]);
int n = (int)(w[2]);
t_float *in = x->x_empty;
t_float *out = x->x_updown.s_vec; /* IOhannes */
@@ -505,12 +503,10 @@ void voutlet_dspepilog(t_voutlet *x, t_signal **parentsigs,
parentvecsize = 1;
re_parentvecsize = 1;
}
- // bigperiod = (downsample * myvecsize)/(upsample * parentvecsize); /* IOhannes */
bigperiod = myvecsize/re_parentvecsize; /* IOhannes */
if (!bigperiod) bigperiod = 1;
epilogphase = phase & (bigperiod - 1);
blockphase = (phase + period - 1) & (bigperiod - 1) & (- period);
- // bufsize = parentvecsize * upsample; /* IOhannes */
bufsize = re_parentvecsize; /* IOhannes */
if (bufsize < myvecsize) bufsize = myvecsize;
if (bufsize != (oldbufsize = x->x_bufsize))
diff --git a/pd/src/g_text.c b/pd/src/g_text.c
index 86bd66a1..cabe22d7 100644
--- a/pd/src/g_text.c
+++ b/pd/src/g_text.c
@@ -109,7 +109,6 @@ static void canvas_objtext(t_glist *gl, int xpix, int ypix, int selected,
else x = 0;
if (!x)
{
-
/* LATER make the color reflect this */
x = (t_text *)pd_new(text_class);
}
@@ -1159,21 +1158,21 @@ void text_drawborder(t_text *x, t_glist *glist,
height = y2 - y1;
if (x->te_type == T_OBJECT)
{
- char *pattern = ((pd_class(&x->te_pd) == text_class) ? "-" : "\"\"");
+ char *pattern = ((pd_class(&x->te_pd) == text_class) ? "-" : "\"\"");
if (firsttime)
sys_vgui(".x%lx.c create line\
%d %d %d %d %d %d %d %d %d %d -dash %s -tags %sR\n",
glist_getcanvas(glist),
x1, y1, x2, y1, x2, y2, x1, y2, x1, y1, pattern, tag);
else
- {
+ {
sys_vgui(".x%lx.c coords %sR\
%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);
- sys_vgui(".x%lx.c itemconfigure -dash %s\n",
- glist_getcanvas(glist), pattern);
- }
+ sys_vgui(".x%lx.c itemconfigure %sR -dash %s\n",
+ glist_getcanvas(glist), tag, pattern);
+ }
}
else if (x->te_type == T_MESSAGE)
{
diff --git a/pd/src/m_binbuf.c b/pd/src/m_binbuf.c
index fa8864b4..be9d882e 100644
--- a/pd/src/m_binbuf.c
+++ b/pd/src/m_binbuf.c
@@ -420,6 +420,8 @@ t_atom *binbuf_getvec(t_binbuf *x)
int canvas_getdollarzero( void);
+/* LATER remove the dependence on the current canvas for $0; should be another
+argument. */
t_symbol *binbuf_realizedollsym(t_symbol *s, int ac, t_atom *av, int tonew)
{
int argno = atol(s->s_name), lastnum;
diff --git a/pd/src/m_pd.h b/pd/src/m_pd.h
index f3af6897..fc9d6abd 100644
--- a/pd/src/m_pd.h
+++ b/pd/src/m_pd.h
@@ -18,7 +18,7 @@ extern "C" {
#endif
#ifdef MSW
-// #pragma warning( disable : 4091 )
+/* #pragma warning( disable : 4091 ) */
#pragma warning( disable : 4305 ) /* uncast const double to float */
#pragma warning( disable : 4244 ) /* uncast float/int conversion etc. */
#pragma warning( disable : 4101 ) /* unused automatic variables */
@@ -451,6 +451,7 @@ EXTERN int open_via_path(const char *name, const char *ext, const char *dir,
char *dirresult, char **nameresult, unsigned int size, int bin);
EXTERN int sched_geteventno(void);
EXTERN double sys_getrealtime(void);
+EXTERN int (*sys_idlehook)(void); /* hook to add idle time computation */
/* ------------ threading ------------------- */
diff --git a/pd/src/m_sched.c b/pd/src/m_sched.c
index b0854984..10c03473 100644
--- a/pd/src/m_sched.c
+++ b/pd/src/m_sched.c
@@ -382,6 +382,11 @@ the audio I/O system is still busy with previous transfers.
void sys_pollmidiqueue( void);
void sys_initmidiqueue( void);
+ /* sys_idlehook is a hook the user can fill in to grab idle time. Return
+nonzero if you actually used the time; otherwise we're really really idle and
+will now sleep. */
+int (*sys_idlehook)(void);
+
int m_scheduler( void)
{
int idlecount = 0;
@@ -468,8 +473,13 @@ int m_scheduler( void)
/* T.Grill - enter idle phase -> unlock thread lock */
sys_unlock();
#endif
- if (timeforward != SENDDACS_SLEPT)
- sys_microsleep(sys_sleepgrain);
+ /* call externally installed idle function if any. */
+ if (!sys_idlehook || !sys_idlehook())
+ {
+ /* if even that had nothing to do, sleep. */
+ if (timeforward != SENDDACS_SLEPT)
+ sys_microsleep(sys_sleepgrain);
+ }
#ifdef THREAD_LOCKING
/* T.Grill - leave idle phase -> lock thread lock */
sys_lock();
diff --git a/pd/src/makefile b/pd/src/makefile
index 62e5f34b..4ab45713 100644
--- a/pd/src/makefile
+++ b/pd/src/makefile
@@ -1,3 +1,186 @@
-all:
- ./configure
- make
+VPATH = ../obj:./
+OBJ_DIR = ../obj
+BIN_DIR = ../bin
+PDEXEC = $(BIN_DIR)/pd
+EXT= pd_linux
+GUINAME= pd-gui
+
+INSTALL_PREFIX = /usr/local
+GFLAGS = -DINSTALL_PREFIX=\"$(INSTALL_PREFIX)\"
+
+MANDIR = ${prefix}/man
+
+MORECFLAGS = -DDL_OPEN -DPA_USE_OSS -DPA_LITTLE_ENDIAN -DUNIX -DUNISTD -DUSEAPI_OSS -I../portaudio/pa_common -I../portaudio/pablio -I../portaudio/portmidi-macosx -fno-strict-aliasing -DPA_USE_ALSA -DUSEAPI_ALSA
+
+INCLUDE = -I.
+GINCLUDE = $(INCLUDE)
+GLIB = -ltk8.4 -ltcl8.4 -lX11 -L/usr/X11R6/lib -lrt
+
+LDFLAGS = -Wl,-export-dynamic -lasound
+LIB = -ldl -lpthread -lasound
+
+OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer
+WARN_CFLAGS = -Wall -W -Wstrict-prototypes \
+ -Wno-unused -Wno-parentheses -Wno-switch
+ARCH_CFLAGS = -DPD
+
+CFLAGS = -Werror $(ARCH_CFLAGS) $(WARN_CFLAGS) $(OPT_CFLAGS) $(MORECFLAGS)
+
+# the sources
+
+SYSSRC += s_midi_oss.c s_audio_oss.c s_audio_alsa.c s_audio_alsamm.c
+
+SRC = g_canvas.c g_graph.c g_text.c g_rtext.c g_array.c g_template.c g_io.c \
+ g_scalar.c g_traversal.c g_guiconnect.c g_readwrite.c g_editor.c \
+ g_all_guis.c g_bang.c g_hdial.c g_hslider.c g_mycanvas.c g_numbox.c \
+ g_toggle.c g_vdial.c g_vslider.c g_vumeter.c \
+ m_pd.c m_class.c m_obj.c m_atom.c m_memory.c m_binbuf.c \
+ m_conf.c m_glob.c m_sched.c \
+ s_main.c s_inter.c s_file.c s_print.c \
+ s_loader.c s_path.c s_entry.c s_audio.c s_midi.c \
+ d_ugen.c d_ctl.c d_arithmetic.c d_osc.c d_filter.c d_dac.c d_misc.c \
+ d_math.c d_fft.c d_mayer_fft.c d_fftroutine.c d_array.c d_global.c \
+ d_delay.c d_resample.c \
+ x_arithmetic.c x_connective.c x_interface.c x_midi.c x_misc.c \
+ x_time.c x_acoustics.c x_net.c x_qlist.c x_gui.c d_soundfile.c \
+ $(SYSSRC)
+
+
+OBJ = $(SRC:.c=.o)
+
+GSRC = t_main.c t_tkcmd.c
+
+GOBJ = $(GSRC:.c=.o)
+
+#
+# ------------------ targets ------------------------------------
+#
+
+.PHONY: pd gui externs all
+
+all: $(PDEXEC) $(BIN_DIR)/pd-watchdog $(BIN_DIR)/$(GUINAME) $(BIN_DIR)/pdsend \
+ $(BIN_DIR)/pdreceive $(BIN_DIR)/pd.tk externs
+
+bin: $(PDEXEC) $(BIN_DIR)/pd-watchdog $(BIN_DIR)/$(GUINAME) $(BIN_DIR)/pdsend \
+ $(BIN_DIR)/pdreceive $(BIN_DIR)/pd.tk
+
+$(OBJ) : %.o : %.c
+ $(CC) $(CFLAGS) $(GFLAGS) $(INCLUDE) -c -o $(OBJ_DIR)/$*.o $*.c
+
+$(GOBJ) : %.o : %.c
+ $(CC) $(CFLAGS) $(GFLAGS) $(GINCLUDE) -c -o $(OBJ_DIR)/$*.o $*.c
+
+pd: $(PDEXEC)
+
+gui: $(BIN_DIR)/$(GUINAME)
+
+pd-watchdog: $(BIN_DIR)/pd-watchdog
+
+$(BIN_DIR)/pd-watchdog: s_watchdog.c
+ $(CC) -O2 $(STRIPFLAG) -o $(BIN_DIR)/pd-watchdog s_watchdog.c
+
+$(BIN_DIR)/pdsend: u_pdsend.c
+ $(CC) $(CFLAGS) $(STRIPFLAG) -o $(BIN_DIR)/pdsend u_pdsend.c
+
+$(BIN_DIR)/pdreceive: u_pdreceive.c
+ $(CC) $(CFLAGS) $(STRIPFLAG) -o $(BIN_DIR)/pdreceive u_pdreceive.c
+
+$(PDEXEC): $(OBJ)
+ cd ../obj; $(CC) $(LDFLAGS) $(DBG_CFLAGS) -o $(PDEXEC) $(OBJ) \
+ $(LIB)
+
+$(BIN_DIR)/pd-gui: $(GOBJ) $(GSRC)
+ cd ../obj; $(CC) $(INCLUDE) -o $(BIN_DIR)/$(GUINAME) $(GOBJ) \
+ $(GLIB)
+
+$(BIN_DIR)/pd.tk: u_main.tk
+ echo set pd_nt 0 > $(BIN_DIR)/pd.tk
+ grep -v "set pd_nt" < u_main.tk >> $(BIN_DIR)/pd.tk
+
+#this is for Max OSX only...
+$(BIN_DIR)/pdtcl: $(GOBJ) $(GSRC)
+ cd ../obj; libtool -dynamic -o $(BIN_DIR)/pdtcl $(GOBJ) \
+ ../../Frameworks/Tk.framework/Versions/Current/Tk \
+ ../../Frameworks/Tcl.framework/Versions/Current/Tcl \
+ /usr/lib/libSystem.B.dylib
+
+externs:
+ cd ../extra/bonk~;make
+ cd ../extra/choice;make
+ cd ../extra/expr~;make
+ cd ../extra/fiddle~;make
+ cd ../extra/loop~;make
+ cd ../extra/lrshift~;make
+ cd ../extra/pique;make
+
+INSTDIR = $(DESTDIR)/$(INSTALL_PREFIX)
+MANINSTDIR = $(DESTDIR)/$(INSTALL_PREFIX)/$(MANDIR)
+BINARYMODE=-m755
+
+install: all
+ install -d $(INSTDIR)/lib/pd/bin
+ install $(BIN_DIR)/$(GUINAME) $(INSTDIR)/lib/pd/bin/$(GUINAME)
+ install $(BIN_DIR)/pd-watchdog $(INSTDIR)/lib/pd/bin/pd-watchdog
+ install -m644 $(BIN_DIR)/pd.tk $(INSTDIR)/lib/pd/bin/pd.tk
+ install -d $(INSTDIR)/bin
+ install $(BINARYMODE) $(PDEXEC) $(INSTDIR)/bin/pd
+ install -m755 $(BIN_DIR)/pdsend $(INSTDIR)/bin/pdsend
+ install -m755 $(BIN_DIR)/pdreceive $(INSTDIR)/bin/pdreceive
+ cp -pr ../doc ../extra $(INSTDIR)/lib/pd/
+ rm -f $(INSTDIR)/extra/*/*.o
+ install -d $(INSTDIR)/include
+ install -m644 m_pd.h $(INSTDIR)/include/m_pd.h
+ install -d $(MANINSTDIR)/man1
+ gzip < ../man/pd.1 > $(MANINSTDIR)/man1/pd.1.gz
+ chmod 644 $(MANINSTDIR)/man1/pd.1.gz
+ gzip < ../man/pdsend.1 > $(MANINSTDIR)/man1/pdsend.1.gz
+ chmod 644 $(MANINSTDIR)/man1/pdsend.1.gz
+ gzip < ../man/pdreceive.1 > $(MANINSTDIR)/man1/pdreceive.1.gz
+ chmod 644 $(MANINSTDIR)/man1/pdreceive.1.gz
+
+local-clean:
+ -rm -f ../obj/* $(BIN_DIR)/pd $(BIN_DIR)/$(GUINAME) $(BIN_DIR)/pdsend \
+ $(BIN_DIR)/pdreceive $(BIN_DIR)/pd-watchdog m_stamp.c
+ -rm -f `find ../portaudio ../portaudio_v18 -name "*.o"`
+ -rm -f *~
+ -(cd ../doc/6.externs; rm -f *.pd_linux)
+ -rm -f makefile.dependencies
+ touch makefile.dependencies
+ chmod 666 makefile.dependencies
+
+extra-clean:
+ -rm -f `find ../extra/ -name "*.pd_*"`
+ -rm -f tags
+
+clean: extra-clean local-clean
+
+distclean: clean
+ rm -rf config.cache config.log config.status makefile tags \
+ autom4te-*.cache
+ echo all: > makefile
+ echo -e "\t./configure" >> makefile
+ echo -e "\tmake" >> makefile
+
+tags: $(SRC) $(GSRC); ctags *.[ch]
+
+depend:
+ $(CC) $(INCLUDE) $(CFLAGS) -M $(SRC) > makefile.dependencies
+
+uninstall:
+ rm -f -r $(INSTDIR)/lib/pd
+ rm -f $(INSTDIR)/bin/pd
+ rm -f $(INSTDIR)/bin/pdsend
+ rm -f $(INSTDIR)/bin/pdreceive
+ rm -f $(INSTDIR)/include/m_pd.h
+ rm -f $(MANINSTDIR)/man1/pd.1.gz
+ rm -f $(MANINSTDIR)/man1/pdsend.1.gz
+ rm -f $(MANINSTDIR)/man1/pdreceive.1.gz
+
+include makefile.dependencies
+
+
+
+
+
+
+
diff --git a/pd/src/makefile.in b/pd/src/makefile.in
index dbc5ec57..ae8ccffc 100644
--- a/pd/src/makefile.in
+++ b/pd/src/makefile.in
@@ -94,8 +94,7 @@ $(BIN_DIR)/pd-gui: $(GOBJ) $(GSRC)
$(GLIB)
$(BIN_DIR)/pd.tk: u_main.tk
- echo set pd_nt @OSNUMBER@ > $(BIN_DIR)/pd.tk
- grep -v "set pd_nt" < u_main.tk >> $(BIN_DIR)/pd.tk
+ cp u_main.tk $(BIN_DIR)/pd.tk
#this is for Max OSX only...
$(BIN_DIR)/pdtcl: $(GOBJ) $(GSRC)
diff --git a/pd/src/notes.txt b/pd/src/notes.txt
index 59ae31e7..48eb33f5 100644
--- a/pd/src/notes.txt
+++ b/pd/src/notes.txt
@@ -28,6 +28,9 @@ put in Wini's RME ALSA code; there are still bugs...
portaudio fixed for inchans != outchans, e.g., emi emagic (2/6)
sprout inlets/outlets on objects whose creation failed.
uploaded to CVS
+bug fix: click on minaturized subpatch fails to "vis" it
+bug fix: CK on Oct. 4 (crash changing font size)
+sched_idle hook
doc:
document env~ second argument (and why is it no less than 1/10 of first???)
@@ -35,7 +38,7 @@ update 0.intro.pd
vibrato example
problems:
-click on minaturized subpatch fails to "vis" it
+--enable-alsa actually disables it???
startup flags need to handle spaces, duh.
test MIDI I/O on all platforms, inc. sysex...
'[' in numbox label breaks it (Yury Sept. 3)
diff --git a/pd/src/s_audio.c b/pd/src/s_audio.c
index 90500790..8ae63198 100644
--- a/pd/src/s_audio.c
+++ b/pd/src/s_audio.c
@@ -687,7 +687,7 @@ void glob_audio_properties(t_pd *dummy, t_floatarg flongform)
audiooutchan1, audiooutchan2, audiooutchan3, audiooutchan4,
rate, advance, canmulti, (flongform != 0));
gfxstub_deleteforkey(0);
- gfxstub_new(&glob_pdobject, glob_audio_properties, buf);
+ gfxstub_new(&glob_pdobject, (void *)glob_audio_properties, buf);
}
/* new values from dialog window */
diff --git a/pd/src/s_audio_alsa.c b/pd/src/s_audio_alsa.c
index 10577ad5..27188a72 100644
--- a/pd/src/s_audio_alsa.c
+++ b/pd/src/s_audio_alsa.c
@@ -30,6 +30,11 @@
#define DEBUG(x) x
#define DEBUG2(x) {x;}
+/* needed for alsa 0.9 compatibility: */
+#if (SND_LIB_MAJOR < 1)
+#define ALSAAPI9
+#endif
+
static void alsa_checkiosync( void);
static void alsa_numbertoname(int iodev, char *devname, int nchar);
@@ -83,7 +88,7 @@ static int alsaio_setup(t_alsa_dev *dev, int out, int *channels, int *rate,
if (sys_verbose)
{
- if (out)
+ if (out)
post("configuring sound output...");
else post("configuring sound input...");
}
@@ -134,7 +139,8 @@ static int alsaio_setup(t_alsa_dev *dev, int out, int *channels, int *rate,
dev->a_channels = *channels;
/* set the sampling rate */
- err = snd_pcm_hw_params_set_rate_min(dev->a_handle, hw_params, rate, 0);
+ err = snd_pcm_hw_params_set_rate_min(dev->a_handle, hw_params,
+ (unsigned int *)rate, 0);
check_error(err, "snd_pcm_hw_params_set_rate_min (input)");
#if 0
err = snd_pcm_hw_params_get_rate(hw_params, &subunitdir);
@@ -144,21 +150,37 @@ static int alsaio_setup(t_alsa_dev *dev, int out, int *channels, int *rate,
/* set the period - ie frag size */
/* LATER try this to get a recommended period size...
right now, it trips an assertion failure in ALSA lib */
+
+#ifdef ALSAAPI9
+ err = snd_pcm_hw_params_set_period_size_near(dev->a_handle,
+ hw_params, (snd_pcm_uframes_t)frag_size, 0);
+#else
tmp_snd_pcm_uframes = frag_size;
err = snd_pcm_hw_params_set_period_size_near(dev->a_handle,
hw_params, &tmp_snd_pcm_uframes, 0);
+#endif
check_error(err, "snd_pcm_hw_params_set_period_size_near (input)");
/* set the number of periods - ie numfrags */
+#ifdef ALSAAPI9
+ err = snd_pcm_hw_params_set_periods_near(dev->a_handle,
+ hw_params, nfrags, 0);
+#else
tmp_uint = nfrags;
err = snd_pcm_hw_params_set_periods_near(dev->a_handle,
hw_params, &tmp_uint, 0);
+#endif
check_error(err, "snd_pcm_hw_params_set_periods_near (input)");
/* set the buffer size */
+#ifdef ALSAAPI9
+ err = snd_pcm_hw_params_set_buffer_size_near(dev->a_handle,
+ hw_params, nfrags * frag_size);
+#else
tmp_snd_pcm_uframes = nfrags * frag_size;
err = snd_pcm_hw_params_set_buffer_size_near(dev->a_handle,
hw_params, &tmp_snd_pcm_uframes);
+#endif
check_error(err, "snd_pcm_hw_params_set_buffer_size_near (input)");
err = snd_pcm_hw_params(dev->a_handle, hw_params);
@@ -348,8 +370,6 @@ void alsa_close_audio(void)
alsa_nindev = alsa_noutdev = 0;
}
-// #define DEBUG_ALSA_XFER
-
int alsa_send_dacs(void)
{
#ifdef DEBUG_ALSA_XFER
diff --git a/pd/src/s_audio_alsamm.c b/pd/src/s_audio_alsamm.c
index 6d140044..0378c4b4 100644
--- a/pd/src/s_audio_alsamm.c
+++ b/pd/src/s_audio_alsamm.c
@@ -31,6 +31,10 @@
#include <sched.h>
#include "s_audio_alsa.h"
+/* needed for alsa 0.9 compatibility: */
+#if (SND_LIB_MAJOR < 1)
+#define ALSAAPI9
+#endif
/* sample type magic ...
Hammerfall/HDSP/DSPMADI cards always 32Bit where lower 8Bit not used (played) in AD/DA,
but can have some bits set (subchannel coding)
@@ -421,6 +425,7 @@ void alsamm_close_audio(void)
/* ------- PCM INITS --------------------------------- */
static int set_hwparams(snd_pcm_t *handle, snd_pcm_hw_params_t *params,int *chs)
{
+#ifndef ALSAAPI9
unsigned int rrate;
int err, dir;
int channels_allocated = 0;
@@ -488,11 +493,13 @@ static int set_hwparams(snd_pcm_t *handle, snd_pcm_hw_params_t *params,int *chs)
{
int maxchs,minchs,channels = *chs;
- if((err = snd_pcm_hw_params_get_channels_max(params,&maxchs)) < 0){
+ if((err = snd_pcm_hw_params_get_channels_max(params,
+ (unsigned int *)&maxchs)) < 0){
check_error(err,"Getting channels_max not available");
return err;
}
- if((err = snd_pcm_hw_params_get_channels_min(params,&minchs)) < 0){
+ if((err = snd_pcm_hw_params_get_channels_min(params,
+ (unsigned int *)&minchs)) < 0){
check_error(err,"Getting channels_min not available");
return err;
}
@@ -523,7 +530,7 @@ static int set_hwparams(snd_pcm_t *handle, snd_pcm_hw_params_t *params,int *chs)
}
/* testing for channels */
- if((err = snd_pcm_hw_params_get_channels(params,chs)) < 0)
+ if((err = snd_pcm_hw_params_get_channels(params,(unsigned int *)chs)) < 0)
check_error(err,"Get channels not available");
#ifdef ALSAMM_DEBUG
else
@@ -542,7 +549,8 @@ static int set_hwparams(snd_pcm_t *handle, snd_pcm_hw_params_t *params,int *chs)
alsamm_buffer_size = alsamm_buffersize;
- err = snd_pcm_hw_params_set_buffer_size_near(handle, params, &alsamm_buffer_size);
+ err = snd_pcm_hw_params_set_buffer_size_near(handle, params,
+ (unsigned long *)&alsamm_buffer_size);
if (err < 0) {
check_error(err,"Unable to set max buffer size");
return err;
@@ -559,14 +567,16 @@ static int set_hwparams(snd_pcm_t *handle, snd_pcm_hw_params_t *params,int *chs)
(unsigned int) (alsamm_buffertime*0.001) );
#endif
- err = snd_pcm_hw_params_set_buffer_time_near(handle, params, &alsamm_buffertime, &dir);
+ err = snd_pcm_hw_params_set_buffer_time_near(handle, params,
+ &alsamm_buffertime, &dir);
if (err < 0) {
check_error(err,"Unable to set max buffer time");
return err;
}
}
- err = snd_pcm_hw_params_get_buffer_time(params, &alsamm_buffertime, &dir);
+ err = snd_pcm_hw_params_get_buffer_time(params,
+ (unsigned int *)&alsamm_buffertime, &dir);
if (err < 0) {
check_error(err,"Unable to get buffer time");
return err;
@@ -578,7 +588,8 @@ static int set_hwparams(snd_pcm_t *handle, snd_pcm_hw_params_t *params,int *chs)
(float) (alsamm_buffertime*0.001));
#endif
- err = snd_pcm_hw_params_get_buffer_size(params, &alsamm_buffer_size);
+ err = snd_pcm_hw_params_get_buffer_size(params,
+ (unsigned long *)&alsamm_buffer_size);
if (err < 0) {
check_error(err,"Unable to get buffer size");
return err;
@@ -589,7 +600,8 @@ static int set_hwparams(snd_pcm_t *handle, snd_pcm_hw_params_t *params,int *chs)
post("hw_params: got buffersize to %d samples",(int) alsamm_buffer_size);
#endif
- err = snd_pcm_hw_params_get_period_size(params, &alsamm_period_size, &dir);
+ err = snd_pcm_hw_params_get_period_size(params,
+ (unsigned long *)&alsamm_period_size, &dir);
if (err > 0) {
check_error(err,"Unable to get period size");
return err;
@@ -644,11 +656,13 @@ static int set_hwparams(snd_pcm_t *handle, snd_pcm_hw_params_t *params,int *chs)
check_error(err,"Unable to set hw params");
return err;
}
+#endif /* ALSAAPI9 */
return 0;
}
static int set_swparams(snd_pcm_t *handle, snd_pcm_sw_params_t *swparams, int playback)
{
+#ifndef ALSAAPI9
int err;
snd_pcm_uframes_t ps,ops;
snd_pcm_uframes_t bs,obs;
@@ -759,7 +773,10 @@ static int set_swparams(snd_pcm_t *handle, snd_pcm_sw_params_t *swparams, int pl
#ifdef ALSAMM_DEBUG
if(sys_verbose)
post("set sw finished");
+#else
+ post("alsa: need version 1.0 or above for mmap operation");
#endif
+#endif /* ALSAAPI9 */
return 0;
}
@@ -1173,7 +1190,8 @@ int alsamm_send_dacs(void)
oframes = size;
- err = alsamm_get_channels(out, &oframes, &ooffset,ochannels,dev->a_addr);
+ err = alsamm_get_channels(out, (unsigned long *)&oframes,
+ (unsigned long *)&ooffset,ochannels,dev->a_addr);
#ifdef ALSAMM_DEBUG
if(dac_send < WATCH_PERIODS){
@@ -1283,7 +1301,8 @@ int alsamm_send_dacs(void)
int chn;
snd_pcm_sframes_t iframes = size;
- err = alsamm_get_channels(in, &iframes, &ioffset,ichannels,dev->a_addr);
+ err = alsamm_get_channels(in,
+ (unsigned long *)&iframes, (unsigned long *)&ioffset,ichannels,dev->a_addr);
if (err < 0){
if ((err = xrun_recovery(in, err)) < 0) {
check_error(err,"MMAP begins avail error");
diff --git a/pd/src/s_audio_pa.c b/pd/src/s_audio_pa.c
index 92f0e8bf..15699556 100644
--- a/pd/src/s_audio_pa.c
+++ b/pd/src/s_audio_pa.c
@@ -106,9 +106,9 @@ int pa_open_audio(int inchans, int outchans, int rate, t_sample *soundin,
post("framesperbuf %d, nbufs %d", framesperbuf, nbuffers);
}
if (inchans || outchans)
- err = OpenAudioStream( &pa_stream, rate, paFloat32,
+ err = OpenAudioStream( &pa_stream, rate, paFloat32,
inchans, outchans, framesperbuf, nbuffers,
- pa_indev, pa_outdev);
+ pa_indev, pa_outdev);
else err = 0;
if ( err != paNoError )
{
diff --git a/pd/src/s_audio_pablio.c b/pd/src/s_audio_pablio.c
index d0438b0f..ad4c9b01 100644
--- a/pd/src/s_audio_pablio.c
+++ b/pd/src/s_audio_pablio.c
@@ -1,5 +1,5 @@
/*
- * $Id: s_audio_pablio.c,v 1.1 2004-09-06 20:20:35 millerpuckette Exp $
+ * $Id: s_audio_pablio.c,v 1.2 2004-11-06 16:07:34 millerpuckette Exp $
* pablio.c
* Portable Audio Blocking Input/Output utility.
*
@@ -98,14 +98,14 @@ static int blockingIOCallback( void *inputBuffer, void *outputBuffer,
if( inputBuffer != NULL )
{
RingBuffer_Write( &data->inFIFO, inputBuffer,
- data->inbytesPerFrame * framesPerBuffer );
+ data->inbytesPerFrame * framesPerBuffer );
}
if( outputBuffer != NULL )
{
int i;
- int numBytes = data->outbytesPerFrame * framesPerBuffer;
+ int numBytes = data->outbytesPerFrame * framesPerBuffer;
int numRead = RingBuffer_Read( &data->outFIFO, outputBuffer,
- numBytes);
+ numBytes);
/* Zero out remainder of buffer if we run out of data. */
for( i=numRead; i<numBytes; i++ )
{
@@ -214,7 +214,7 @@ static unsigned long RoundUpToNextPowerOf2( unsigned long n )
*/
PaError OpenAudioStream( PABLIO_Stream **rwblPtr, double sampleRate,
PaSampleFormat format, int inchannels,
- int outchannels, int framesperbuf, int nbuffers,
+ int outchannels, int framesperbuf, int nbuffers,
int indeviceno, int outdeviceno) /* MSP */
{
long bytesPerSample;
@@ -310,14 +310,14 @@ PaError OpenAudioStream( PABLIO_Stream **rwblPtr, double sampleRate,
if(doRead)
{
err = PABLIO_InitFIFO( &aStream->inFIFO, numFrames,
- aStream->inbytesPerFrame );
+ aStream->inbytesPerFrame );
if( err != paNoError ) goto error;
}
if(doWrite)
{
long numBytes;
err = PABLIO_InitFIFO( &aStream->outFIFO, numFrames,
- aStream->outbytesPerFrame );
+ aStream->outbytesPerFrame );
if( err != paNoError ) goto error;
/* Make Write FIFO appear full initially. */
numBytes = RingBuffer_GetWriteAvailable( &aStream->outFIFO );
diff --git a/pd/src/s_file.c b/pd/src/s_file.c
index ca0512fc..34992e01 100644
--- a/pd/src/s_file.c
+++ b/pd/src/s_file.c
@@ -84,9 +84,9 @@ static void sys_initloadpreferences( void)
static int sys_getpreference(const char *key, char *value, int size)
{
+ char searchfor[80], *where, *whereend;
if (!sys_prefbuf)
return (0);
- char searchfor[80], *where, *whereend;
sprintf(searchfor, "\n%s:", key);
where = strstr(sys_prefbuf, searchfor);
if (!where)
@@ -157,7 +157,7 @@ static void sys_initloadpreferences( void)
static int sys_getpreference(const char *key, char *value, int size)
{
- HKEY *hkey;
+ HKEY **hkey;
DWORD bigsize = size;
char *val2 = value;
LONG err = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
@@ -192,7 +192,7 @@ static void sys_initsavepreferences( void)
static void sys_putpreference(const char *key, const char *value)
{
- HKEY *hkey;
+ HKEY **hkey;
LONG err = RegCreateKeyEx(HKEY_LOCAL_MACHINE,
"Software\\Pd", 0, NULL, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE,
NULL, &hkey, NULL);
@@ -223,7 +223,7 @@ static int sys_getpreference(const char *key, char *value, int size)
{
char cmdbuf[256];
int nread = 0, nleft = size;
- snprintf(cmdbuf, 256, "defaults read com.ucsd.pd %s 2> /dev/null\n", key);
+ snprintf(cmdbuf, 256, "defaults read org.puredata.pd %s 2> /dev/null\n", key);
FILE *fp = popen(cmdbuf, "r");
while (nread < size)
{
@@ -233,11 +233,13 @@ static int sys_getpreference(const char *key, char *value, int size)
nread += newread;
}
pclose(fp);
- if (!nread)
+ if (nread < 1)
return (0);
if (nread >= size)
nread = size-1;
value[nread] = 0;
+ if (value[nread-1] == '\n') /* remove newline character at end */
+ value[nread-1] = 0;
return(1);
}
@@ -253,7 +255,7 @@ static void sys_putpreference(const char *key, const char *value)
{
char cmdbuf[MAXPDSTRING];
snprintf(cmdbuf, MAXPDSTRING,
- "defaults write com.ucsd.pd %s \"%s\" 2> /dev/null\n", key, value);
+ "defaults write org.puredata.pd %s \"%s\" 2> /dev/null\n", key, value);
system(cmdbuf);
}
diff --git a/pd/src/s_inter.c b/pd/src/s_inter.c
index 05232d59..dc7d3a34 100644
--- a/pd/src/s_inter.c
+++ b/pd/src/s_inter.c
@@ -28,6 +28,7 @@ that didn't really belong anywhere. */
#include <process.h>
#include <winsock.h>
typedef int pid_t;
+typedef int socklen_t;
#define EADDRINUSE WSAEADDRINUSE
#endif
#include <stdarg.h>
@@ -611,7 +612,7 @@ void sys_vgui(char *fmt, ...)
sys_guibufsize = GUI_ALLOCCHUNK;
sys_guibufhead = sys_guibuftail = 0;
}
- if (sys_guibufhead > sys_guibufsize - 50)
+ if (sys_guibufhead > sys_guibufsize - (GUI_ALLOCCHUNK/2))
sys_trytogetmoreguibuf(sys_guibufsize + GUI_ALLOCCHUNK);
va_start(ap, fmt);
msglen = vsnprintf(sys_guibuf + sys_guibufhead,
@@ -619,16 +620,18 @@ void sys_vgui(char *fmt, ...)
va_end(ap);
if (msglen >= sys_guibufsize - sys_guibufhead)
{
- int newsize = sys_guibufsize + 1 +
+ int msglen2, newsize = sys_guibufsize + 1 +
(msglen > GUI_ALLOCCHUNK ? msglen : GUI_ALLOCCHUNK);
sys_trytogetmoreguibuf(newsize);
va_start(ap, fmt);
- msglen = vsnprintf(sys_guibuf + sys_guibufhead,
- sys_guibufsize + 1 - sys_guibufhead, fmt, ap);
+ msglen2 = vsnprintf(sys_guibuf + sys_guibufhead,
+ sys_guibufsize - sys_guibufhead, fmt, ap);
va_end(ap);
+ if (msglen2 != msglen)
+ bug("sys_vgui");
if (msglen >= sys_guibufsize - sys_guibufhead)
- msglen = sys_guibufsize - sys_guibufhead - 1;
+ msglen = sys_guibufsize - sys_guibufhead;
}
if (sys_debuglevel & DEBUG_MESSUP)
fprintf(stderr, "%s", sys_guibuf + sys_guibufhead);
@@ -1145,7 +1148,7 @@ int sys_startgui(const char *guidir)
struct sched_param param;
int policy = SCHED_RR;
int err;
- param.sched_priority = 80; // adjust 0 : 100
+ param.sched_priority = 80; /* adjust 0 : 100 */
err = pthread_setschedparam(pthread_self(), policy, &param);
if (err)
@@ -1159,7 +1162,8 @@ int sys_startgui(const char *guidir)
fprintf(stderr, "Waiting for connection request... \n");
if (listen(xsock, 5) < 0) sys_sockerror("listen");
- sys_guisock = accept(xsock, (struct sockaddr *) &server, &len);
+ sys_guisock = accept(xsock, (struct sockaddr *) &server,
+ (socklen_t *)&len);
#ifdef OOPS
close(xsock);
#endif
diff --git a/pd/src/s_main.c b/pd/src/s_main.c
index 94fc720c..056f5bbf 100644
--- a/pd/src/s_main.c
+++ b/pd/src/s_main.c
@@ -7,7 +7,7 @@
* 1311:forum::für::umläute:2001
*/
-char pd_version[] = "Pd version 0.38 TEST 6\n";
+char pd_version[] = "Pd version 0.38 TEST9\n";
char pd_compiletime[] = __TIME__;
char pd_compiledate[] = __DATE__;
diff --git a/pd/src/s_midi.c b/pd/src/s_midi.c
index 0cde64d7..9e169cd0 100644
--- a/pd/src/s_midi.c
+++ b/pd/src/s_midi.c
@@ -603,7 +603,7 @@ void glob_midi_properties(t_pd *dummy, t_floatarg flongform)
midioutdev1, midioutdev2, midioutdev3, midioutdev4,
(flongform != 0));
gfxstub_deleteforkey(0);
- gfxstub_new(&glob_pdobject, glob_midi_properties, buf);
+ gfxstub_new(&glob_pdobject, (void *)glob_midi_properties, buf);
}
/* new values from dialog window */
diff --git a/pd/src/s_path.c b/pd/src/s_path.c
index 90d1fa51..4b9399a6 100644
--- a/pd/src/s_path.c
+++ b/pd/src/s_path.c
@@ -484,7 +484,7 @@ void glob_start_path_dialog(t_pd *dummy)
sys_vgui("pd_set pd_path%d \"\"\n", i);
sprintf(buf, "pdtk_path_dialog %%s %d %d\n", sys_usestdpath, sys_verbose);
- gfxstub_new(&glob_pdobject, glob_start_path_dialog, buf);
+ gfxstub_new(&glob_pdobject, (void *)glob_start_path_dialog, buf);
}
/* new values from dialog window */
@@ -517,7 +517,7 @@ void glob_start_startup_dialog(t_pd *dummy)
sprintf(buf, "pdtk_startup_dialog %%s %d \"%s\"\n", sys_defeatrt,
sys_flags->s_name);
- gfxstub_new(&glob_pdobject, glob_start_startup_dialog, buf);
+ gfxstub_new(&glob_pdobject, (void *)glob_start_startup_dialog, buf);
}
/* new values from dialog window */
diff --git a/pd/src/t_tkcmd.c b/pd/src/t_tkcmd.c
index 23e53572..546ffb67 100644
--- a/pd/src/t_tkcmd.c
+++ b/pd/src/t_tkcmd.c
@@ -437,7 +437,7 @@ static void pd_startfromgui( void)
fprintf(stderr, "Waiting for connection request... \n");
#endif
if (listen(xsock, 5) < 0) pd_sockerror("listen");
- sockfd = accept(xsock, (struct sockaddr *) &server, &len);
+ sockfd = accept(xsock, (struct sockaddr *) &server, (unsigned int *)&len);
if (sockfd < 0) pd_sockerror("accept");
#ifdef DEBUGCONNECT
fprintf(stderr, "... connected\n");
diff --git a/pd/src/u_main.tk b/pd/src/u_main.tk
index b07c7d16..03dbc544 100644
--- a/pd/src/u_main.tk
+++ b/pd/src/u_main.tk
@@ -1,8 +1,16 @@
#!/usr/bin/wish
-set pd_nt 0
-# (The above is 0 for unix, 1 for microsoft, and 2 for Mac OSX. The first
-# line is automatically munged by the relevant makefiles.)
+# set pd_nt (bad name) 0 for unix, 1 for microsoft, and 2 for Mac OSX.
+if { $tcl_platform(platform) == "windows" } {
+ set pd_nt 1
+ puts stderr {Configuring for Windows}
+} elseif { $tcl_platform(os) == "Darwin" } {
+ set pd_nt 2
+ puts stderr {Configuring for MacOS X}
+} else {
+ set pd_nt 0
+ puts stderr {Configuring for UNIX}
+}
# Copyright (c) 1997-1999 Miller Puckette.
# For information on usage and redistribution, and for a DISCLAIMER OF ALL
@@ -25,11 +33,13 @@ if {$pd_nt == 1} {
set pd_gui2 [string range $argv0 0 [expr [string last \\ $argv0 ] - 1]]
regsub -all \\\\ $pd_gui2 / pd_gui3
set pd_guidir $pd_gui3/..
- load $pd_guidir/bin/pdtcl
+ load $pd_guidir/bin/pdtcl.dll
set pd_tearoff 1
}
if {$pd_nt == 2} {
+# turn on James Tittle II's fast drawing (wait until I can test this...):
+# set tk::mac::useCGDrawing 1
global pd_guidir
global pd_tearoff
set pd_gui2 [string range $argv0 0 [expr [string last / $argv0 ] - 1]]
@@ -315,10 +325,17 @@ proc menu_documentation {} {
global help_directory
global pd_nt
- set filename [tk_getOpenFile -defaultextension .pd \
- -filetypes { {{documentation} {.pd .txt .htm}} } \
- -initialdir $help_directory]
-
+ if {$pd_nt == 2} {
+ exec rm -rf /tmp/pd-documentation
+ exec cp -pr $help_directory /tmp/pd-documentation
+ set filename [tk_getOpenFile -defaultextension .pd \
+ -filetypes { {{documentation} {.pd .txt .htm}} } \
+ -initialdir /tmp/pd-documentation]
+ } else {
+ set filename [tk_getOpenFile -defaultextension .pd \
+ -filetypes { {{documentation} {.pd .txt .htm}} } \
+ -initialdir $help_directory]
+ }
if {$filename != ""} {
if {[string first .txt $filename] >= 0} {
menu_opentext $filename
@@ -1652,9 +1669,9 @@ proc pdtk_graph_dialog {id x1 y1 x2 y2 xpix ypix} {
pdtk_standardkeybindings $id.xrangef.x1
pdtk_standardkeybindings $id.xrangef.x2
pdtk_standardkeybindings $id.xrangef.xpix
- pdtk_standardkeybindings $id.xrangef.y1
- pdtk_standardkeybindings $id.xrangef.y2
- pdtk_standardkeybindings $id.xrangef.ypix
+ pdtk_standardkeybindings $id.yrangef.y1
+ pdtk_standardkeybindings $id.yrangef.y2
+ pdtk_standardkeybindings $id.yrangef.ypix
$id.xrangef.x2 select from 0
$id.xrangef.x2 select adjust end
focus $id.xrangef.x2
diff --git a/pd/src/x_connective.c b/pd/src/x_connective.c
index 4dfacb90..7e6dcdd8 100644
--- a/pd/src/x_connective.c
+++ b/pd/src/x_connective.c
@@ -1064,12 +1064,12 @@ typedef struct _spigot
float x_state;
} t_spigot;
-static void *spigot_new(void)
+static void *spigot_new(t_floatarg f)
{
t_spigot *x = (t_spigot *)pd_new(spigot_class);
floatinlet_new(&x->x_obj, &x->x_state);
outlet_new(&x->x_obj, 0);
- x->x_state = 0;
+ x->x_state = f;
return (x);
}
@@ -1106,7 +1106,7 @@ static void spigot_anything(t_spigot *x, t_symbol *s, int argc, t_atom *argv)
static void spigot_setup(void)
{
spigot_class = class_new(gensym("spigot"), (t_newmethod)spigot_new, 0,
- sizeof(t_spigot), 0, A_DEFSYM, 0);
+ sizeof(t_spigot), 0, A_DEFFLOAT, 0);
class_addbang(spigot_class, spigot_bang);
class_addpointer(spigot_class, spigot_pointer);
class_addfloat(spigot_class, spigot_float);