[mercury-users] Re: integer enumerations

Tyson Dowd trd at cs.mu.OZ.AU
Wed Jul 26 13:21:47 AEST 2000


On 26-Jul-2000, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> On 26-Jul-2000, Michael Day <mcda at students.cs.mu.OZ.AU> wrote:
> > 
> > Has any work been done in Mercury to allow integer types limited to a
> > fixed set of values,

...

> > Alternatively, how about a pragma hack for discriminated union types for
> > easy interfacing with C libraries...
> > 
> > :- type some_c_enum
> > 	--->	foo	= some hack to set value to 1
> > 	;	bar	= some hack to set value to 2
> > 	;	baz	= some hack to set value to 17
> > 	.

I have a tool that can parse C enums, and it would be pretty simple to
get it to spit out the appropriate Mercury code for interfacing to the
enum in the manner Fergus suggests (using some constant integer functions).

I'm happy to give you (or anyone else) the code if you are interested.

-- 
       Tyson Dowd           # 
                            #  Surreal humour isn't everyone's cup of fur.
     trd at cs.mu.oz.au        # 
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list