[metapost] multiple and nested input

Taco Hoekwater taco at elvenkind.com
Tue Sep 1 21:39:36 CEST 2020



> On 1 Sep 2020, at 20:38, Josef Eschgfaeller <esg at unife.it> wrote:
> 
> I work with High Sierra and TexLive 2018
> on an iMac. Since it seems that also the
> -mem (or &) commands don't work, I
> modified the file ".../base/mpost.pm" as follows
> ("Alfa" should become the root file for a little library),
> adding only the second input line:
> --------------------------------------------------
> % $Id: mpost.mp,v 1.1 2005/05/06 09:11:09 taco Exp $
> % Public domain.
> 
> input plain;
> input /Users/je/Programmiersprachen/Metapost/Bibliothek/Alfa;
> dump

OK, that is fine. But you are missing the meaning of the ‘dump’
command. It should be used only once in a run, and it signals the
end of the ‘preloaded’ section. It should be the last command
in the file you pass with the —mem parameter (or in the default 
mpost.mp, like you have done).

> --------------------------------------------------
> I create now the following files (in the same directory):
> --------------------------------------------------
> % Alfa.
> input /Users/je/Programmiersprachen/Metapost/Bibliothek/aux;
> input /Users/je/Programmiersprachen/Metapost/Bibliothek/conf;
> dump

Do not use “dump" in runtime loaded files. Just end the file,
or use ”endinput”. And end the run with “end”. 

So, delete the “dump” line above

> --------------------------------------------------
> % aux.
> def out (text name)=outputtemplate:=name & ".mps"; enddef;
> dump

and this one

> --------------------------------------------------
> % conf.
> bboxmargin:=0;
> dump

and this one

> --------------------------------------------------
> Now I write (elsewhere) a file "ex":
> --------------------------------------------------
> % ex.
> out("ex");
> beginfig(1);
> endfig;
> dump

and replace this one with “end”

Also, I would advise to use .mp as file extension for all your files.

Best wishes,
Taco








More information about the metapost mailing list.