Re: how to express "struct"

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

I am in the (slow) process of rewriting most of that code (and throwing
away things that do not make sense any longer, such as bigints),
although the core macros from the PDF above still work pretty much the
same. If there is some interest in the project (and, possibly, people
interested in collaborating), I can publish an updated version.

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.