Re: how to express "struct"

Nicola <[email protected]>
Newsgroups gmane.comp.tex.metapost
Message-ID <[email protected]>
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


--
http://tug.org/metapost/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.