Skip to content

Commit

Permalink
patch to expansion of envvar for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jpffitch committed Aug 28, 2015
1 parent d115300 commit bbdcfc8
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 22 deletions.
7 changes: 5 additions & 2 deletions Engine/envvar.c
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ char **csoundGetSearchPathFromEnv(CSOUND *csound, const char *envList)
for (i = j = 0; i <= len; i++) {
if (envList[i] == ';' || envList[i] == ':' || envList[i] == '\0') {
if (i > j) {
tmp = (nameChain_t*) csound->Malloc(csound, sizeof(nameChain_t) + (i - j));
tmp = (nameChain_t*)csound->Malloc(csound, sizeof(nameChain_t) + (i-j));
for (k = 0; j < i; j++, k++)
tmp->s[k] = envList[j];
tmp->s[k] = '\0';
Expand Down Expand Up @@ -448,8 +448,10 @@ char **csoundGetSearchPathFromEnv(CSOUND *csound, const char *envList)
len = (int) strlen(s);
else
len = -1;
// **** THIS CODE DOES NOT CHECK FOR WINDOWS STYLE C:\foo ****
for (i = j = 0; i <= len; i++) {
if (s[i] == ';' || s[i] == ':' || s[i] == '\0') {
if (i==0 && isalpha(s[i]) && s[i+1]==':') i++;
else if (s[i] == ';' || s[i] == ':' || s[i] == '\0') {
if (i > j) {
tmp = (nameChain_t*) csound->Malloc(csound, sizeof(nameChain_t)
+ (i - j) + 1);
Expand Down Expand Up @@ -477,6 +479,7 @@ char **csoundGetSearchPathFromEnv(CSOUND *csound, const char *envList)
}
}
j = i + 1;
if (s[i+2]==':' && isalpha(s[i+1])) i+=2;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Engine/extract.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ void readxfil(CSOUND *csound, EXTRACT_STATICS* extractStatics,
switch (flag) {
case 'i':
sscanf(s, "%d", &i);
//printf("%s %d\n", s, i);
//printf("%s %d\n", s, i);
if (i>=0 && i < INSMAX) STA(inslst)[i] = 1;
else csound->Die(csound, Str("instrument number out of range"));
all = 0;
Expand Down
16 changes: 8 additions & 8 deletions OOps/schedule.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ int schedule_N(CSOUND *csound, SCHED *p)
sprintf(s, "i %f %f %f", *p->which, *p->when, *p->dur);
for (i=4; i < argno ; i++) {
MYFLT *arg = p->argums[i-4];
if(csoundGetTypeForArg(arg) == &CS_VAR_TYPE_S)
sprintf(s, "%s \"%s\" ", s, ((STRINGDAT *)arg)->data);
else sprintf(s, "%s %f", s, *arg);
if(csoundGetTypeForArg(arg) == &CS_VAR_TYPE_S)
sprintf(s, "%s \"%s\" ", s, ((STRINGDAT *)arg)->data);
else sprintf(s, "%s %f", s, *arg);
}
csoundInputMessage(csound, s);
csoundInputMessage(csound, s);
return OK;
}

Expand All @@ -74,11 +74,11 @@ int schedule_SN(CSOUND *csound, SCHED *p)
sprintf(s, "i \"%s\" %f %f", ((STRINGDAT *)p->which)->data, *p->when, *p->dur);
for (i=4; i < argno ; i++) {
MYFLT *arg = p->argums[i-4];
if(csoundGetTypeForArg(arg) == &CS_VAR_TYPE_S)
sprintf(s, "%s \"%s\" ", s, ((STRINGDAT *)arg)->data);
else sprintf(s, "%s %f", s, *arg);
if(csoundGetTypeForArg(arg) == &CS_VAR_TYPE_S)
sprintf(s, "%s \"%s\" ", s, ((STRINGDAT *)arg)->data);
else sprintf(s, "%s %f", s, *arg);
}
csoundInputMessage(csound, s);
csoundInputMessage(csound, s);
return OK;
}

Expand Down
1 change: 0 additions & 1 deletion OOps/str_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,6 @@ int strsub_opcode(CSOUND *csound, STRSUB_OP *p)
int size = p->Ssrc->size;
p->Sdst->data = csound->Calloc(csound, size);
p->Sdst->size = size;

}

src = (char*) p->Ssrc->data;
Expand Down
20 changes: 10 additions & 10 deletions Opcodes/psynth.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ static int psynth_init(CSOUND *csound, _PSYN *p)
p->facsqr = p->factor * p->factor;
if(*p->thresh == -1) p->min = 0.00002*csound->Get0dBFS(csound);
else p->min = *p->thresh*csound->Get0dBFS(csound);

if (p->amps.auxp == NULL ||
(unsigned) p->amps.size < sizeof(double) * numbins)
csound->AuxAlloc(csound, sizeof(double) * numbins, &p->amps);
Expand Down Expand Up @@ -179,7 +179,7 @@ static int psynth_process(CSOUND *csound, _PSYN *p)
/* for each track */
i = j = k = 0;
while (i < maxtracks * 4) {

ampnext = (double) fin[i] * scale;
freqnext = (double) fin[i + 1] * pitch;
if ((id = (int) fin[i + 3]) != -1) {
Expand Down Expand Up @@ -276,7 +276,7 @@ static int psynth2_init(CSOUND *csound, _PSYN2 *p)
p->facsqr = p->factor * p->factor;
if(*p->thresh == -1) p->min = 0.00002*csound->Get0dBFS(csound);
else p->min = *p->thresh*csound->Get0dBFS(csound);

if (p->amps.auxp == NULL ||
(unsigned) p->amps.size < sizeof(double) * numbins)
csound->AuxAlloc(csound, sizeof(double) * numbins, &p->amps);
Expand Down Expand Up @@ -355,7 +355,7 @@ static int psynth2_process(CSOUND *csound, _PSYN2 *p)
freqnext = (double) fin[i + 1] * TWOPI_F;
phasenext = (double) fin[i + 2];
if ((id = (int) fin[i + 3]) != -1) {

j = k + notcontin;

if (k < tracks - notcontin) {
Expand Down Expand Up @@ -420,7 +420,7 @@ static int psynth2_process(CSOUND *csound, _PSYN2 *p)
}
/* keep amp, freq, and phase values for next time */
cont:
if (contin) {
if (contin) {
amps[k] = ampnext;
freqs[k] = freqnext;
phases[k] = phasenext;
Expand All @@ -431,17 +431,17 @@ static int psynth2_process(CSOUND *csound, _PSYN2 *p)
else
notcontin++;
}
else
else
break;
}

}
pos = 0;
p->tracks = k;
}

}
p->pos = pos;

return OK;
}

Expand Down

0 comments on commit bbdcfc8

Please sign in to comment.