[metapost] Source code mplib

Skleroza skleroza at poczta.onet.pl
Sat Sep 23 16:30:18 CEST 2017


I found this C program.
https://www.tug.org/docs/metapost/mplibapi.pdf
Where is source code. and examples to compiling this simple program
    ?
==========
2.1  Simple MPlib use
There are two different approaches possible when running MPlib. The
first method is most suitable
for programs that function as a command-line frontend. It uses ‘normal’
MetaPost interface with
I/O to and from files, and needs very little setup to run. On the other
hand, it also gives almost
no chance to control the MPlib behaviour.
Here is a C language example of how to do this:
#include "mplib.h"
int main (int argc, char **argv) {
MP mp;
MP_options *opt = mp_options();
opt->command_line = argv[1];
mp = mp_initialize(opt);
if (mp) {
int history = mp_run(mp);
mp_finish(mp);
exit (history);
} else {
exit (EXIT_FAILURE);
}
}
This example will run in ‘inimpost’ mode. See below for how to preload a
macro package.


More information about the metapost mailing list