[metapost] Recovering from errors in MPlib
Nicola
nvitacolonna at gmail.com
Mon Nov 28 14:30:53 CET 2016
Hi,
when using MPlib, is it possible to recover from errors?
In other words, when the current status of the MP instance is
mp_error_message_issued, is it possible to return to a status
where commands are accepted again? If so, how?
I ask, because whatever command I send after an error,
the status doesn't change. Maybe I'm doing something wrong.
This is the function I'm using:
void eval(MP mp) {
int history = mp_execute(mp, line_read, strlen(line_read));
mp_run_data *result = mp_rundata(mp); // TODO: I guess I must free this
printf("%s\n", result->term_out.data);
printf("DEBUG: mp_status = %d\n", mp_status(mp));
switch (history) {
case mp_spotless:
printf("OK\n");
break;
case mp_warning_issued:
printf("Warning\n");
break;
case mp_error_message_issued:
printf("Error\n");
break;
case mp_fatal_error_stop:
printf("Fatal error\n");
break;
case mp_system_error_stop:
printf("System error\n");
break;
default:
printf("Default\n");
}
}
Nicola
More information about the metapost
mailing list