Skip to content

Commit

Permalink
better patch for ETX
Browse files Browse the repository at this point in the history
  • Loading branch information
jpffitch committed Aug 28, 2016
1 parent 30e1ce0 commit 08ec473
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
1 change: 1 addition & 0 deletions Engine/sread.c
Expand Up @@ -236,6 +236,7 @@ static int undefine_score_macro(CSOUND *csound, const char *name)
static inline int isNameChar(int c, int pos)
{
//c = (int) ((unsigned char) c);
if (c<0) return 0;
return (isalpha(c) || (pos && (c == '_' || isdigit(c))));
}

Expand Down
2 changes: 1 addition & 1 deletion InOut/midifile.c
Expand Up @@ -558,7 +558,7 @@ int csoundMIDIFileOpen(CSOUND *csound, const char *name)
/* open file */
if (name == NULL || name[0] == '\0')
return -1;
if (*name==3) name++; /* Because of ETX added bt readOptions */
//if (*name==3) name++; /* Because of ETX added bt readOptions */
if (strcmp(name, "stdin") == 0)
f = stdin;
else {
Expand Down
22 changes: 16 additions & 6 deletions Top/argdecode.c
Expand Up @@ -524,6 +524,7 @@ static int decode_long(CSOUND *csound, char *s, int argc, char **argv)
}
else if (!(strncmp (s, "midifile=", 9))) {
s += 9;
if (*s==3) s++; /* skip ETX */
if (UNLIKELY(*s == '\0')) dieu(csound, Str("no midifile name"));
O->FMidiname = s; /* Midifile name */
if (!strcmp(O->FMidiname, "stdin")) {
Expand All @@ -540,6 +541,7 @@ static int decode_long(CSOUND *csound, char *s, int argc, char **argv)
}
else if (!(strncmp (s, "midioutfile=", 12))) {
s += 12;
if (*s==3) s++; /* skip ETX */
if (UNLIKELY(*s == '\0')) dieu(csound, Str("no midi output file name"));
O->FMidioutname = s;
return 1;
Expand Down Expand Up @@ -568,13 +570,15 @@ static int decode_long(CSOUND *csound, char *s, int argc, char **argv)
#ifdef EMBEDDED_PYTHON
else if (strncmp(s, "pyvar=", 6) == 0) {
s += 6;
if (*s==3) s++; /* skip ETX */
if (UNLIKELY(python_add_cmdline_definition(s)))
dieu(csound, Str("invalid python variable definition syntax"));
return 1;
}
#endif
else if (!(strncmp (s, "input=", 6))) {
s += 6;
if (*s==3) s++; /* skip ETX */
if (UNLIKELY(*s == '\0')) dieu(csound, Str("no infilename"));
O->infilename = s; /* soundin name */
if (UNLIKELY(strcmp(O->infilename, "stdout") == 0))
Expand Down Expand Up @@ -637,6 +641,7 @@ static int decode_long(CSOUND *csound, char *s, int argc, char **argv)
*/
else if (!(strncmp (s, "score-in=", 9))) {
s += 9;
if (*s==3) s++; /* skip ETX */
if (UNLIKELY(*s=='\0')) dieu(csound, Str("no Linein score device_name"));
O->Linename = s;
if (!strcmp(O->Linename, "stdin")) {
Expand Down Expand Up @@ -737,6 +742,7 @@ static int decode_long(CSOUND *csound, char *s, int argc, char **argv)
*/
else if (!(strncmp (s, "midi-device=", 12))) {
s += 12;
if (*s==3) s++; /* skip ETX */
if (UNLIKELY(*s=='\0')) dieu(csound, Str("no midi device_name"));
O->Midiname = s;
if (!strcmp(O->Midiname, "stdin")) {
Expand All @@ -762,6 +768,7 @@ static int decode_long(CSOUND *csound, char *s, int argc, char **argv)
}
else if (!(strncmp (s, "output=", 7))) {
s += 7;
if (*s==3) s++; /* skip ETX */
if (UNLIKELY(*s == '\0')) dieu(csound, Str("no outfilename"));
O->outfilename = s; /* soundout name */
if (UNLIKELY(strcmp(O->outfilename, "stdin")) == 0)
Expand All @@ -786,6 +793,7 @@ static int decode_long(CSOUND *csound, char *s, int argc, char **argv)
/* -r N */
else if (!(strncmp (s, "sample-rate=", 12))) {
s += 12;
if (*s==3) s++; /* skip ETX */
O->sr_override = (float)atof(s);
return 1;
}
Expand Down Expand Up @@ -838,15 +846,16 @@ static int decode_long(CSOUND *csound, char *s, int argc, char **argv)
else if (!(strncmp (s, "utility=", 8))) {
int retval;
s += 8;
if (*s==3) s++; /* skip ETX */
if (*s=='\0') dieu(csound, Str("no utility name"));

retval = csoundRunUtility(csound, s, argc, argv);
if (retval) {
csound->info_message_request = 1;
csound->orchname = NULL;
return 0;
}
else csound->LongJmp(csound, retval);
if (retval) {
csound->info_message_request = 1;
csound->orchname = NULL;
return 0;
}
else csound->LongJmp(csound, retval);
return 1;
}
/* -v */
Expand Down Expand Up @@ -922,6 +931,7 @@ static int decode_long(CSOUND *csound, char *s, int argc, char **argv)
else if (!(strncmp (s, "opcode-lib=", 11))) {
int nbytes;
s += 11;
if (*s==3) s++; /* skip ETX */
nbytes = (int) strlen(s) + 1;
if (csound->dl_opcodes_oplibs == NULL) {
/* start new library list */
Expand Down

0 comments on commit 08ec473

Please sign in to comment.