Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:/csound/csound into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
kunstmusik committed May 19, 2018
2 parents 091fc28 + b857216 commit 4b27e25
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 33 deletions.
6 changes: 3 additions & 3 deletions Engine/insert.c
Original file line number Diff line number Diff line change
Expand Up @@ -1654,15 +1654,15 @@ int nstrnumset(CSOUND *csound, NSTRNUM *p)
{
/* IV - Oct 31 2002 */
*(p->i_insno) = (MYFLT) strarg2insno(csound, p->iname, 0);
return (*(p->i_insno) > FL(0.0) ? OK : NOTOK);
return (*(p->i_insno) != NOT_AN_INSTRUMENT ? OK : NOTOK);
}

int nstrnumset_S(CSOUND *csound, NSTRNUM *p)
{
/* IV - Oct 31 2002 */
*(p->i_insno) = (MYFLT) strarg2insno(csound,
((STRINGDAT *)p->iname)->data, 1);
return (*(p->i_insno) > FL(0.0) ? OK : NOTOK);
return (*(p->i_insno) != NOT_AN_INSTRUMENT ? OK : NOTOK);
}


Expand Down Expand Up @@ -2559,7 +2559,7 @@ int delete_instr(CSOUND *csound, DELETEIN *p)
else
n = (int) (*p->insno + FL(0.5));

if (UNLIKELY(n < 1 ||
if (UNLIKELY(n == NOT_AN_INSTRUMENT ||
n > csound->engineState.maxinsno ||
csound->engineState.instrtxtp[n] == NULL))
return OK; /* Instrument does not exist so noop */
Expand Down
12 changes: 6 additions & 6 deletions Engine/linevent.c
Original file line number Diff line number Diff line change
Expand Up @@ -468,14 +468,14 @@ int eventOpcode_(CSOUND *csound, LINEVENT *p, int insname, char p1)
return csound->PerfError(csound, p->h.insdshead, "%s", Str(errmsg_2));
evt.p[1] = csound->strarg2insno(csound,
((STRINGDAT*) p->args[1])->data, 1);
if (UNLIKELY(evt.p[1]<0)) return NOTOK;
if (UNLIKELY(evt.p[1] == NOT_AN_INSTRUMENT)) return NOTOK;
evt.strarg = NULL; evt.scnt = 0;
}
else {
if (csound->ISSTRCOD(*p->args[1])) {
evt.p[1] = csound->strarg2insno(csound,
get_arg_string(csound, *p->args[1]), 1);
if (UNLIKELY(evt.p[1]<0)) return NOTOK;
if (UNLIKELY(evt.p[1] != NOT_AN_INSTRUMENT)) return NOTOK;
} else evt.p[1] = *p->args[1];
evt.strarg = NULL; evt.scnt = 0;
}
Expand Down Expand Up @@ -534,7 +534,7 @@ int eventOpcodeI_(CSOUND *csound, LINEVENT *p, int insname, char p1)
if (UNLIKELY(evt.opcod != 'i' && evt.opcod != 'q' && opcod != 'd'))
return csound->InitError(csound, "%s", Str(errmsg_2));
evt.p[1] = csound->strarg2insno(csound,((STRINGDAT *)p->args[1])->data, 1);
if (UNLIKELY(evt.p[1]<0)) return NOTOK;
if (UNLIKELY(evt.p[1] == NOT_AN_INSTRUMENT)) return NOTOK;
evt.strarg = NULL; evt.scnt = 0;
for (i = 2; i <= evt.pcnt; i++)
evt.p[i] = *p->args[i];
Expand All @@ -544,7 +544,7 @@ int eventOpcodeI_(CSOUND *csound, LINEVENT *p, int insname, char p1)
if (csound->ISSTRCOD(*p->args[1])) {
evt.p[1] = csound->strarg2insno(csound,
get_arg_string(csound, *p->args[1]), 1);
if (UNLIKELY(evt.p[1]<0)) return NOTOK;
if (UNLIKELY(evt.p[1] == NOT_AN_INSTRUMENT)) return NOTOK;
} else evt.p[1] = *p->args[1];
for (i = 2; i <= evt.pcnt; i++)
evt.p[i] = *p->args[i];
Expand Down Expand Up @@ -594,14 +594,14 @@ int instanceOpcode_(CSOUND *csound, LINEVENT2 *p, int insname)
if (insname) {
evt.p[1] = csound->strarg2insno(csound,
((STRINGDAT*) p->args[0])->data, 1);
if (UNLIKELY(evt.p[1]<0)) return NOTOK;
if (UNLIKELY(evt.p[1] == NOT_AN_INSTRUMENT)) return NOTOK;
evt.strarg = NULL; evt.scnt = 0;
}
else {
if (csound->ISSTRCOD(*p->args[0])) {
evt.p[1] = csound->strarg2insno(csound,
get_arg_string(csound, *p->args[0]), 1);
if (UNLIKELY(evt.p[1]<0)) return NOTOK;
if (UNLIKELY(evt.p[1] == NOT_AN_INSTRUMENT)) return NOTOK;
} else evt.p[1] = *p->args[0];
evt.strarg = NULL; evt.scnt = 0;
}
Expand Down
4 changes: 2 additions & 2 deletions Engine/musmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ int turnon(CSOUND *csound, TURNON *p)
if (csound->ISSTRCOD(*p->insno)) {
char *ss = get_arg_string(csound,*p->insno);
insno = csound->strarg2insno(csound,ss,1);
if (insno <= 0L)
if (insno == NOT_AN_INSTRUMENT)
return NOTOK;
} else insno = *p->insno;
evt.p[1] = (MYFLT) insno;
Expand All @@ -588,7 +588,7 @@ int turnon_S(CSOUND *csound, TURNON *p)
evt.opcod = 'i';
evt.pcnt = 3;
insno = csound->strarg2insno(csound, ((STRINGDAT *)p->insno)->data, 1);
if (UNLIKELY(insno <= 0L))
if (UNLIKELY(insno == NOT_AN_INSTRUMENT))
return NOTOK;
evt.p[1] = (MYFLT) insno;
evt.p[2] = *p->itime;
Expand Down
2 changes: 0 additions & 2 deletions Engine/namedins.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
#include "csound_orc_semantics.h"
#include <ctype.h>

#define NOT_AN_INSTRUMENT INT32_MAX

/* check if the string s is a valid instrument or opcode name */
/* return value is zero if the string is not a valid name */

Expand Down
4 changes: 2 additions & 2 deletions InOut/libsnd_u.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ void *sndgetset(CSOUND *csound, void *p_)
sfname = &(p->sfname[0]);
/* IV - Feb 26 2005: should initialise sfinfo structure */
memset(&sfinfo, 0, sizeof(SF_INFO));
sfinfo.format = (p->format ? /* store default sample format, */
((int) FORMAT2SF(p->format) | SF_FORMAT_RAW) : 0);
sfinfo.format = (p->format<0 ? /* store default sample format, */
((int) FORMAT2SF(-p->format) | SF_FORMAT_RAW) : 0);
sfinfo.channels = 1; /* number of channels, */
if (p->analonly) /* and sample rate */
sfinfo.samplerate = (int) p->sr;
Expand Down
4 changes: 2 additions & 2 deletions Opcodes/gab/newgabopc.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,11 +331,11 @@ typedef struct



static int32_t dashow< (CSOUND *csound, DSH *p)
static int32_t dashow(CSOUND *csound, DSH *p)
{
MYFLT range = *p->kband_max - *p->kband_min;
if (range != FL(0.0))
*p->rmod = (*p->kfreq_max - *p->kfreq_min) / (*p->kband_max - *p->kband_min);
*p->rmod = (*p->kfreq_max - *p->kfreq_min) / range;
else
*p->rmod = FL(0.0);
*p->rcar = (*p->kfreq_max - (*p->kband_max * *p->rmod));
Expand Down
5 changes: 4 additions & 1 deletion Top/csound.c
Original file line number Diff line number Diff line change
Expand Up @@ -2062,7 +2062,10 @@ int csoundReadScoreInternal(CSOUND *csound, const char *str)
csound->scorestr = corfile_create_w(csound);
corfile_puts(csound, (char *)str, csound->scorestr);
//#ifdef SCORE_PARSER
corfile_puts(csound, "\ne\n#exit\n", csound->scorestr);
if (csound->engineStatus&CS_STATE_COMP)
corfile_puts(csound, "\n#exit\n", csound->scorestr);
else
corfile_puts(csound, "\ne\n#exit\n", csound->scorestr);
//#endif
corfile_flush(csound, csound->scorestr);
/* copy sorted score name */
Expand Down
14 changes: 0 additions & 14 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,6 @@ init:
- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
- if "%APPVEYOR_BUILD_WORKER_IMAGE%" == "Visual Studio 2017" call "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Auxiliary\\Build\\vcvars64.bat"
- if "%APPVEYOR_BUILD_WORKER_IMAGE%" == "Visual Studio 2015" call "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\bin\\amd64\\vcvars64.bat"
# C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Redist\MSVC\14.12.25810\x64\Microsoft.VC141.CRT
# C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Redist\MSVC\14.12.25810\x64\Microsoft.VC141.CXXAMP
# C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Redist\MSVC\14.12.25810\x64\Microsoft.VC141.MFC
# C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Redist\MSVC\14.12.25810\x64\Microsoft.VC141.MFCLOC
# C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Redist\MSVC\14.12.25810\x64\Microsoft.VC141.OpenMP
- set VCREDIST_CRT_DIR=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Redist\MSVC\14.13.26020\x64\Microsoft.VC141.CRT
- set VCREDIST_CXXAMP_DIR=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Redist\MSVC\14.13.26020\x64\Microsoft.VC141.CXXAMP
- set VCREDIST_OPENMP_DIR=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Redist\MSVC\14.13.26020\x64\Microsoft.VC141.OpenMP
- set
- echo "Redistributable runtime libraries:"
- dir /B /S "%VCToolsRedistDir%"
- dir /B /S "%VCREDIST_CRT_DIR%"
- dir /B /S "%VCREDIST_CXXAMP_DIR%"
- dir /B /S "%VCREDIST_OPENMP_DIR%"
- set PATH=%PATH%;%CsoundDepsDir%

install:
Expand Down
3 changes: 2 additions & 1 deletion include/csoundCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ typedef struct {
#define MAXINSNO (200)
#define PMAX (1998)
#define VARGMAX (1999)

#define NOT_AN_INSTRUMENT INT32_MAX

#define ORTXT h.optext->t
#define INCOUNT ORTXT.inlist->count
#define OUTCOUNT ORTXT.outlist->count /* Not used */
Expand Down

0 comments on commit 4b27e25

Please sign in to comment.