Skip to content

Commit

Permalink
types in Opcodes
Browse files Browse the repository at this point in the history
  • Loading branch information
jpffitch committed Feb 6, 2018
2 parents 754389a + 3869982 commit 1f37bd4
Show file tree
Hide file tree
Showing 65 changed files with 383 additions and 362 deletions.
1 change: 1 addition & 0 deletions Frontends/beats/beats.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ extern int yyparse(void);
extern void print_instr_structure(void);
extern INSTR *find_instr(int);


6 changes: 6 additions & 0 deletions Frontends/beats/beats.l
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
#include <string.h>
#include <stdlib.h>
#include "beats.tab.h"

#if defined(_WIN32) || defined(WIN32)
#include <io.h>
#define isatty(x) _isatty(x)
#endif

void comment(void);
void comment1(void);
int yyline = 0;
Expand Down
2 changes: 2 additions & 0 deletions Frontends/beats/beats.y
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
extern int debug;
extern int yylex(void);
extern void yyerror (char *);


%}
%token S_NL
%token S_EQ
Expand Down
5 changes: 2 additions & 3 deletions Frontends/csound/csound_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,11 @@ int main(int argc, char **argv)
csoundInitialize(CSOUNDINIT_NO_SIGNAL_HANDLER);

/* set stdout to non buffering if not outputing to console window */
if (!isatty(fileno(stdout))) {
#if !defined(WIN32)
if (!isatty(fileno(stdout))) {
setvbuf(stdout, (char*) NULL, _IONBF, 0);
#endif
}

#endif
#ifdef GNU_GETTEXT
/* We need to set the locale for the translations to work */
lang = csoundGetEnv(NULL, "CS_LANG");
Expand Down
2 changes: 1 addition & 1 deletion InOut/ipmidi.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ static int OpenMidiInDevice_(CSOUND *csound, void **userData, const char *dev)

mreq.imr_multiaddr.s_addr = inet_addr("225.0.0.37");
mreq.imr_interface.s_addr = htonl(INADDR_ANY);
status = setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq));
status = setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, (const char *)&mreq, sizeof(mreq));

if ( status < 0 ) {
#ifdef WIN32
Expand Down
6 changes: 3 additions & 3 deletions InOut/rtwinmm.c
Original file line number Diff line number Diff line change
Expand Up @@ -500,8 +500,8 @@ static void rtclose_(CSOUND *csound)
}
}

static void CALLBACK midi_in_handler(HMIDIIN hmin, UINT wMsg, DWORD dwInstance,
DWORD dwParam1, DWORD dwParam2)
static void CALLBACK midi_in_handler(HMIDIIN hmin, UINT wMsg, DWORD_PTR dwInstance,
DWORD_PTR dwParam1, DWORD_PTR dwParam2)
{
RTMIDI_MME_GLOBALS *p = (RTMIDI_MME_GLOBALS*) dwInstance;
int new_pos;
Expand Down Expand Up @@ -562,7 +562,7 @@ static int midi_in_open(CSOUND *csound, void **userData, const char *devName)
csound->Message(csound, Str("Opening MIDI input device %d (%s)\n"),
devnum, &(caps.szPname[0]));
if (midiInOpen(&(p->inDev), (unsigned int) devnum,
(DWORD) midi_in_handler, (DWORD) p, CALLBACK_FUNCTION)
(DWORD_PTR) midi_in_handler, (DWORD_PTR) p, CALLBACK_FUNCTION)
!= MMSYSERR_NOERROR) {
p->inDev = (HMIDIIN) 0;
csound->ErrorMsg(csound, Str("rtmidi: could not open input device"));
Expand Down
6 changes: 6 additions & 0 deletions Opcodes/OSC.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,14 @@ static int32_t osc_send(CSOUND *csound, OSCSEND *p)
IP_MULTICAST_TTL, &ttl, sizeof(ttl))==-1)) {
csound->Message(csound, Str("Failed to set multicast"));
}
#elif defined(MSVC)
setsockopt((SOCKET)p->addr, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof(ttl));
#else
<<<<<<< HEAD
setsockopt((int32_t)p->addr, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof(ttl));
=======
setsockopt((int64_t)p->addr, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof(ttl));
>>>>>>> 3869982d8381b83e98017c40a8534b6733e68be7
#endif
}
csound->Free(csound, p->lhost);
Expand Down
6 changes: 3 additions & 3 deletions Opcodes/afilters.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,14 +386,14 @@ static int32_t tonexa(CSOUND *csound, TONEX *p) /* From Gabriel Maldonado, modif
return OK;
}

static int32_t32_t atonexa(CSOUND *csound, TONEX *p) /* Gabriel Maldonado, modified */
static int32_t atonexa(CSOUND *csound, TONEX *p) /* Gabriel Maldonado, modified */
{
MYFLT *ar = p->ar;
double c2 = p->c2, *yt1 = p->yt1;
uint32_t offset = p->h.insdshead->ksmps_offset;
uint32_t early = p->h.insdshead->ksmps_no_end;
uint32_t n, nsmps = CS_KSMPS;
int32_t j, lp = p->loop;
int32_t j, lp = p->loop;
MYFLT prvhp = p->prvhp;

memmove(ar,p->asig,sizeof(MYFLT)*nsmps);
Expand Down Expand Up @@ -453,7 +453,7 @@ static int32_t bbutset(CSOUND *csound, BBFIL *p) /* Band set-up
}


static int32_t32_t hibuta(CSOUND *csound, BFIL *p) /* Hipass filter */
static int32_t hibuta(CSOUND *csound, BFIL *p) /* Hipass filter */
{
MYFLT *out, *in;
uint32_t offset = p->h.insdshead->ksmps_offset;
Expand Down
76 changes: 38 additions & 38 deletions Opcodes/arrays.c
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ static int32_t tabsub(CSOUND *csound, TABARITH *p)
ARRAYDAT *l = p->left;
ARRAYDAT *r = p->right;
int32_t size = ans->sizes[0];
int32_t32_t i;
int32_t i;

if (UNLIKELY(ans->data == NULL || l->data==NULL || r->data==NULL))
return csound->PerfError(csound, p->h.insdshead,
Expand All @@ -414,12 +414,12 @@ static int32_t tabsub(CSOUND *csound, TABARITH *p)
return OK;
}

/* static int32_t32_t tabneg(CSOUND *csound, TABARITH *p) */
/* static int32_t tabneg(CSOUND *csound, TABARITH *p) */
/* { */
/* ARRAYDAT *ans = p->ans; */
/* ARRAYDAT *l = p->left; */
/* int32_t32_t size = ans->sizes[0]; */
/* int32_t32_t i; */
/* int32_t size = ans->sizes[0]; */
/* int32_t i; */

/* if (UNLIKELY(ans->data == NULL || l->data==NULL)) */
/* return csound->PerfError(csound, p->h.insdshead, */
Expand All @@ -431,13 +431,13 @@ static int32_t tabsub(CSOUND *csound, TABARITH *p)
/* return OK; */
/* } */

static int32_t32_t tabmult(CSOUND *csound, TABARITH *p)
static int32_t tabmult(CSOUND *csound, TABARITH *p)
{
ARRAYDAT *ans = p->ans;
ARRAYDAT *l = p->left;
ARRAYDAT *r = p->right;
int32_t32_t size = ans->sizes[0];
int32_t32_t i;
int32_t size = ans->sizes[0];
int32_t i;

if (UNLIKELY(ans->data == NULL || l->data== NULL || r->data==NULL))
return csound->PerfError(csound, p->h.insdshead,
Expand All @@ -451,13 +451,13 @@ static int32_t32_t tabmult(CSOUND *csound, TABARITH *p)
return OK;
}

static int32_t32_t tabdiv(CSOUND *csound, TABARITH *p)
static int32_t tabdiv(CSOUND *csound, TABARITH *p)
{
ARRAYDAT *ans = p->ans;
ARRAYDAT *l = p->left;
ARRAYDAT *r = p->right;
int32_t32_t size = ans->sizes[0];
int32_t32_t i;
int32_t size = ans->sizes[0];
int32_t i;

if (UNLIKELY(ans->data == NULL || l->data== NULL || r->data==NULL))
return csound->PerfError(csound, p->h.insdshead,
Expand All @@ -475,13 +475,13 @@ static int32_t32_t tabdiv(CSOUND *csound, TABARITH *p)
return OK;
}

static int32_t32_t tabrem(CSOUND *csound, TABARITH *p)
static int32_t tabrem(CSOUND *csound, TABARITH *p)
{
ARRAYDAT *ans = p->ans;
ARRAYDAT *l = p->left;
ARRAYDAT *r = p->right;
int32_t32_t size = ans->sizes[0];
int32_t32_t i;
int32_t size = ans->sizes[0];
int32_t i;

if (UNLIKELY(ans->data == NULL || l->data== NULL || r->data==NULL))
return csound->PerfError(csound, p->h.insdshead,
Expand All @@ -494,13 +494,13 @@ static int32_t32_t tabrem(CSOUND *csound, TABARITH *p)
return OK;
}

static int32_t32_t tabpow(CSOUND *csound, TABARITH *p)
static int32_t tabpow(CSOUND *csound, TABARITH *p)
{
ARRAYDAT *ans = p->ans;
ARRAYDAT *l = p->left;
ARRAYDAT *r = p->right;
int32_t32_t size = ans->sizes[0];
int32_t32_t i;
int32_t size = ans->sizes[0];
int32_t i;
MYFLT tmp;

if (UNLIKELY(ans->data == NULL || l->data== NULL || r->data==NULL))
Expand All @@ -521,7 +521,7 @@ static int32_t32_t tabpow(CSOUND *csound, TABARITH *p)


#define IIARRAY(opcode,fn) \
static int32_t32_t opcode(CSOUND *csound, TABARITH *p) \
static int32_t opcode(CSOUND *csound, TABARITH *p) \
{ \
if (!tabarithset(csound, p)) return fn(csound, p); \
else return NOTOK; \
Expand All @@ -535,10 +535,10 @@ IIARRAY(tabremi,tabrem)
IIARRAY(tabpowi,tabpow)

// Add array and scalar
static int32_t32_t tabiadd(CSOUND *csound, ARRAYDAT *ans, ARRAYDAT *l, MYFLT r, void *p)
static int32_t tabiadd(CSOUND *csound, ARRAYDAT *ans, ARRAYDAT *l, MYFLT r, void *p)
{
int32_t32_t size = ans->sizes[0];
int32_t32_t i;
int32_t size = ans->sizes[0];
int32_t i;

if (UNLIKELY(ans->data == NULL || l->data== NULL))
return csound->PerfError(csound, ((TABARITH *) p)->h.insdshead,
Expand All @@ -552,7 +552,7 @@ static int32_t32_t tabiadd(CSOUND *csound, ARRAYDAT *ans, ARRAYDAT *l, MYFLT r,
}

// K[]+K
static int32_t32_t tabaiadd(CSOUND *csound, TABARITH1 *p)
static int32_t tabaiadd(CSOUND *csound, TABARITH1 *p)
{
ARRAYDAT *ans = p->ans;
ARRAYDAT *l = p->left;
Expand All @@ -561,7 +561,7 @@ static int32_t32_t tabaiadd(CSOUND *csound, TABARITH1 *p)
}

// K+K[]
static int32_t32_t tabiaadd(CSOUND *csound, TABARITH2 *p)
static int32_t tabiaadd(CSOUND *csound, TABARITH2 *p)
{
ARRAYDAT *ans = p->ans;
ARRAYDAT *l = p->right;
Expand All @@ -570,7 +570,7 @@ static int32_t32_t tabiaadd(CSOUND *csound, TABARITH2 *p)
}

// Subtract K[]-K
static int32_t32_t tabaisub(CSOUND *csound, TABARITH1 *p)
static int32_t tabaisub(CSOUND *csound, TABARITH1 *p)
{
ARRAYDAT *ans = p->ans;
ARRAYDAT *l = p->left;
Expand Down Expand Up @@ -1646,9 +1646,9 @@ typedef struct {
static int32_t tabslice(CSOUND *csound, TABSLICE *p){

MYFLT *tabin = p->tabin->data;
int32_t32_t start = (int) *p->start;
int32_t32_t end = (int) *p->end;
int32_t32_t inc = (int) *p->inc;
int32_t start = (int) *p->start;
int32_t end = (int) *p->end;
int32_t inc = (int) *p->inc;
int32_t size = (end - start)/inc + 1;
int32_t i, destIndex;
int32_t memMyfltSize = p->tabin->arrayMemberSize / sizeof(MYFLT);
Expand Down Expand Up @@ -1677,8 +1677,8 @@ static int32_t tabslice(CSOUND *csound, TABSLICE *p){
//static int32_t tabsliceS(CSOUND *csound, TABSLICE *p){
//
// MYFLT *tabin = p->tabin->data;
// int32_t32_t start = (int) *p->start;
// int32_t32_t end = (int) *p->end;
// int32_t start = (int) *p->start;
// int32_t end = (int) *p->end;
// int32_t size = end - start + 1, i;
// STRCPY_OP xx;
// if (UNLIKELY(size < 0))
Expand Down Expand Up @@ -1773,7 +1773,7 @@ static int32_t tabmap_perf(CSOUND *csound, TABMAP *p)
int32_t tablength(CSOUND *csound, TABQUERY1 *p)
{
IGN(csound);
int32_t32_t opt = (int)*p->opt;
int32_t opt = (int)*p->opt;
if (UNLIKELY(p->tab==NULL || opt>p->tab->dimensions))
*p->ans = -FL(1.0);
else if (UNLIKELY(opt<=0)) *p->ans = p->tab->dimensions;
Expand Down Expand Up @@ -1831,7 +1831,7 @@ static int32_t ina_set(CSOUND *csound, OUTA *p)
aa->dimensions = 1;
if (aa->sizes) csound->Free(csound, aa->sizes);
if (aa->data) csound->Free(csound, aa->data);
aa->sizes = (int32_t32_t*)csound->Malloc(csound, sizeof(int));
aa->sizes = (int32_t*)csound->Malloc(csound, sizeof(int));
aa->sizes[0] = p->len = csound->inchnls;
aa->data = (MYFLT*)
csound->Malloc(csound, CS_KSMPS*sizeof(MYFLT)*p->len);
Expand Down Expand Up @@ -1906,7 +1906,7 @@ static int32_t monitora_init(CSOUND *csound, OUTA *p)
aa->dimensions = 1;
if (aa->sizes) csound->Free(csound, aa->sizes);
if (aa->data) csound->Free(csound, aa->data);
aa->sizes = (int32_t32_t*)csound->Malloc(csound, sizeof(int));
aa->sizes = (int32_t*)csound->Malloc(csound, sizeof(int));
aa->sizes[0] = p->len = csound->nchnls;
aa->data = (MYFLT*)
csound->Malloc(csound, CS_KSMPS*sizeof(MYFLT)*p->len);
Expand Down Expand Up @@ -2246,7 +2246,7 @@ int32_t ctor_i(CSOUND *csound, FFT *p){

int32_t init_window(CSOUND *csound, FFT *p){
int32_t N = p->in->sizes[0];
int32_t32_t i,type = (int) *p->f;
int32_t i,type = (int) *p->f;
MYFLT *w;
tabensure(csound, p->out, N);
if (p->mem.auxp == 0 || p->mem.size < N*sizeof(MYFLT))
Expand Down Expand Up @@ -2434,7 +2434,7 @@ int32_t cols_perf(CSOUND *csound, FFT *p){
else return csound->PerfError(csound, p->h.insdshead,
Str("requested col is out of range\n"));
}
static inline void tabensure2D(CSOUND *csound, ARRAYDAT *p, int32_t32_t rows, int columns)
static inline void tabensure2D(CSOUND *csound, ARRAYDAT *p, int32_t rows, int32_t columns)
{
if (p->data==NULL || p->dimensions == 0 ||
(p->dimensions==2 && (p->sizes[0] < rows || p->sizes[1] < columns))) {
Expand All @@ -2447,7 +2447,7 @@ static inline void tabensure2D(CSOUND *csound, ARRAYDAT *p, int32_t32_t rows, in
if (p->data==NULL) {
p->data = (MYFLT*)csound->Calloc(csound, ss);
p->dimensions = 2;
p->sizes = (int32_t32_t*)csound->Malloc(csound, sizeof(int)*2);
p->sizes = (int32_t*)csound->Malloc(csound, sizeof(int)*2);
}
else p->data = (MYFLT*) csound->ReAlloc(csound, p->data, ss);
p->sizes[0] = rows; p->sizes[1] = columns;
Expand Down Expand Up @@ -2566,7 +2566,7 @@ int32_t unwrap(CSOUND *csound, FFT *p){
}

void *csoundDCTSetup(CSOUND *csound,
int32_t32_t FFTsize, int d);
int32_t FFTsize, int32_t d);
void csoundDCT(CSOUND *csound,
void *p, MYFLT *sig);

Expand Down Expand Up @@ -2649,7 +2649,7 @@ static inline MYFLT f2mel(MYFLT f){
return 1125.*log(1.+f/700.);
}

static inline int32_t32_t mel2bin(MYFLT m, int N, MYFLT sr){
static inline int32_t mel2bin(MYFLT m, int32_t N, MYFLT sr){
MYFLT f = 700.*(exp(m/1125.) - 1.);
return (int32_t)(f/(sr/(2*N)));

Expand All @@ -2670,7 +2670,7 @@ int32_t mfb_init(CSOUND *csound, MFB *p){

int32_t mfb(CSOUND *csound, MFB *p) {
int32_t i,j;
int32_t32_t *bin = (int *) p->bins.auxp;
int32_t *bin = (int32_t *) p->bins.auxp;
MYFLT start,max,end;
MYFLT g = FL(0.0), incr, decr;
int32_t L = p->out->sizes[0];
Expand Down Expand Up @@ -2747,7 +2747,7 @@ typedef struct _inout{

int32_t nxtpow2(CSOUND *csound, INOUT *p){
IGN(csound);
int32_t inval = (int)*p->in;
int32_t inval = (int32_t)*p->in;
int32_t powtwo = 2;
while (powtwo < inval) powtwo *= 2;
*p->out = powtwo;
Expand Down
2 changes: 1 addition & 1 deletion Opcodes/bbcut.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static inline int32_t roundoffint(MYFLT x)
return((int32_t)(x - 0.5));
}

static int32_t32_t32_t32_t random_number(CSOUND *csound, int a, int b)
static int32_t random_number(CSOUND *csound, int32_t a, int32_t b)
{
MYFLT x;
x = (MYFLT) (csound->Rand31(&(csound->randSeed1)) - 1) / FL(2147483645.0);
Expand Down
4 changes: 2 additions & 2 deletions Opcodes/biquad.c
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ static int32_t vco(CSOUND *csound, VCO *p)
MYFLT *buf = (MYFLT *)p->aux.auxp;
MYFLT fv1, out1;
int32 v1, v2;
int32_t32_t32_t wave = (int)MYFLT2LONG(*p->wave); /* Save recalculation and also round */
int32_t wave = (int32_t)MYFLT2LONG(*p->wave); /* Save recalculation and also round */

leaky = p->leaky;

Expand Down Expand Up @@ -1379,7 +1379,7 @@ static int32_t bqrez(CSOUND *csound, REZZY *p)
double sin2 = 0.0, cos2 = 0.0, beta=0.0, alpha, gamma=0.0, mu, sigma, chi;
double theta;
double xnm1 = p->xnm1, xnm2 = p->xnm2, ynm1 = p->ynm1, ynm2 = p->ynm2;
int32_t32_t32_t mode = (int)MYFLT2LONG(*p->mode);
int32_t mode = (int32_t)MYFLT2LONG(*p->mode);

in = p->in;
out = p->out;
Expand Down
Loading

0 comments on commit 1f37bd4

Please sign in to comment.