[m-rev.] for review: add lang spec to pragma import

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Nov 22 22:55:15 AEDT 2001


On 22-Nov-2001, Peter Ross <peter.ross at miscrit.be> wrote:
> I would propose the documentation has to change something along these
> lines.
> 
> @example
> :- pragma import(@var{Pred}(@var{Mode1}, @var{Mode2}, @dots{}),
>                  @var{Attributes}, @var{ImportedFunction}).
> @end example
> 
> @var{ImportedFunction} is a term which describes how to call the
> specified function on a particular backend.
> For instance on the C backend: the term will be @code{c("c_function_name")},
> where c_function_name is then name of a C function.
> 
> On the IL backend: the term will be something like
> @code{il("assembly", "function", yes(return_type), [arg_one_type])},
> where return_type and arg_one_type are the mercury type names which are
> declared using the foreign_type declaration.

For the IL and Java backends, the argument types should be determined
from the Mercury type declaration.  You shouldn't need to give the types
again in the `pragma import' declaration.

> > For consistency with what we do for `pragma foreign_proc',
> > `pragma foreign_decl', etc., the language specifier should
> > come at the start:
> > 
> > 	:- pragma import(c, p(in, out)).
>
> Unfortunately the information that we need to include is different for
> each backend

I'm not convinced on that.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list