[metapost] how to express "struct"

Nicola nvitacolonna at gmail.com
Sun Mar 12 10:32:25 CET 2017


On 12/03/2017 10:05, Nicola wrote:
> On 12/03/2017 01:35, Laurent Méhats wrote:
>> Le 11/03/2017 à 19:23, Qiong Cai a écrit :
>>> Hi,
>>>
>>> I am trying to define a C-like struct in metapost:
>>>
>>>        struct Pixel {
>>>              numeric x;
>>>              numeric y;
>>>              numeric val;
>>>        };
>>>
>>> What's the best way to define such a struct in MetaPost?
>
> You may copy and paste the two macros described here:
>
> http://www.gust.org.pl/projects/pearls/2011p/nicola-vitacolonna/bachotex2011-nicola-vitacolonna-pearl1.pdf
>
>
> That gives you “structs” and “templates” (well, sort of…).
>
> I have experimented with the idea a bit more:
>
> http://users.dimi.uniud.it/~nicola.vitacolonna/software/metappeal/

Maybe, something like "records" from the above library fits your use 
case best.

Nicola




More information about the metapost mailing list