Improved error messages.
parent
24ee1b1fa7
commit
c509e46926
|
@ -1237,7 +1237,7 @@ check_recursive(int status, int chan, int data, int recursive)
|
||||||
// only mod translations can be used in recursive calls
|
// only mod translations can be used in recursive calls
|
||||||
if (recursive) {
|
if (recursive) {
|
||||||
char name[100];
|
char name[100];
|
||||||
fprintf(stderr, "Warning: $%s: undefined\n",
|
fprintf(stderr, "Warning: $%s: undefined macro\n",
|
||||||
debug_key(0, name, status, chan, data, 0));
|
debug_key(0, name, status, chan, data, 0));
|
||||||
}
|
}
|
||||||
return recursive;
|
return recursive;
|
||||||
|
|
21
readconfig.c
21
readconfig.c
|
@ -67,7 +67,7 @@ allocate(size_t len)
|
||||||
{
|
{
|
||||||
char *ret = (char *)calloc(1, len);
|
char *ret = (char *)calloc(1, len);
|
||||||
if (ret == NULL) {
|
if (ret == NULL) {
|
||||||
fprintf(stderr, "Out of memory!\n");
|
fprintf(stderr, "out of memory!\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -1244,7 +1244,7 @@ start_translation(translation *tr, char *which_key)
|
||||||
//printf("start_translation(%s)\n", which_key);
|
//printf("start_translation(%s)\n", which_key);
|
||||||
|
|
||||||
if (tr == NULL) {
|
if (tr == NULL) {
|
||||||
fprintf(stderr, "need to start translation section before defining key: %s\n", which_key);
|
fprintf(stderr, "missing translation section: %s\n", which_key);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
current_translation = tr->name;
|
current_translation = tr->name;
|
||||||
|
@ -1467,11 +1467,11 @@ start_translation(translation *tr, char *which_key)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// this can't happen
|
// this can't happen
|
||||||
fprintf(stderr, "bad message name: [%s]%s\n", current_translation, which_key);
|
fprintf(stderr, "unexpected error: [%s]%s\n", current_translation, which_key);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "bad message name: [%s]%s\n", current_translation, which_key);
|
fprintf(stderr, "syntax error: [%s]%s\n", current_translation, which_key);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if ((!first_stroke || *first_stroke) ||
|
if ((!first_stroke || *first_stroke) ||
|
||||||
|
@ -1481,7 +1481,7 @@ start_translation(translation *tr, char *which_key)
|
||||||
((!alt_press_stroke || *alt_press_stroke) ||
|
((!alt_press_stroke || *alt_press_stroke) ||
|
||||||
(is_bidirectional &&
|
(is_bidirectional &&
|
||||||
(!alt_release_stroke || *alt_release_stroke))))) {
|
(!alt_release_stroke || *alt_release_stroke))))) {
|
||||||
fprintf(stderr, "can't redefine message: [%s]%s\n", current_translation, which_key);
|
fprintf(stderr, "already defined: [%s]%s\n", current_translation, which_key);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
press_first_stroke = first_stroke;
|
press_first_stroke = first_stroke;
|
||||||
|
@ -1639,19 +1639,16 @@ add_midi(char *tok)
|
||||||
// the default MIDI channel
|
// the default MIDI channel
|
||||||
midi_channel = data;
|
midi_channel = data;
|
||||||
if (recursive)
|
if (recursive)
|
||||||
fprintf(stderr, "recursion not permitted: %s\n", tok);
|
fprintf(stderr, "invalid macro call: %s\n", tok);
|
||||||
} else {
|
} else {
|
||||||
if ((status & 0xf0) != 0xe0 || step != 0)
|
append_midi(status, data, step, n_steps, steps,
|
||||||
append_midi(status, data, step, n_steps, steps,
|
swap, incr!=0, recursive);
|
||||||
swap, incr!=0, recursive);
|
|
||||||
else
|
|
||||||
fprintf(stderr, "zero step size not permitted: %s\n", tok);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// inspect the token that was actually recognized (if any) to give some
|
// inspect the token that was actually recognized (if any) to give some
|
||||||
// useful error message here
|
// useful error message here
|
||||||
if (strcmp(buf, "ch"))
|
if (strcmp(buf, "ch"))
|
||||||
fprintf(stderr, "unrecognized keysym: %s\n", tok);
|
fprintf(stderr, "syntax error: %s\n", tok);
|
||||||
else
|
else
|
||||||
fprintf(stderr, "invalid MIDI channel: %s\n", tok);
|
fprintf(stderr, "invalid MIDI channel: %s\n", tok);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue