[m-dev.] for review: document pragma import & nondet pragma c_code

Tyson Dowd trd at cs.mu.OZ.AU
Thu Nov 5 15:48:59 AEDT 1998


On 05-Nov-1998, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> Hi,
> 
> Tom and Zoltan, could you both please review this?
> 
> --------------------
> 
> Estimated hours taken: 3
> 
> doc/reference_manual.texi:
> 	Document `pragma import' and nondet `pragma c_code'.
> 	Also make various other minor improvements to the documentation
> 	of the C interface, and fix a few layout errors
> 	(e.g. the use of "..." instead of "@dots{}").
> 


> +If you use @samp{pragma import} for a polymorphically typed Mercury procedure,
> +the compiler will prepend one @samp{type_info} argument to the parameters passed
> +to the C function for each polymorphic type variable in the
> +Mercury procedure's type signature.  The values passed in these arguments
> +will be the same as the values that would be obtained using the Mercury
> + at samp{type_of} function in the Mercury standard library module @samp{std_util}.

Are typeclass_infos handled at all?  If not is it noted as a
bug/limitation somewhere?

> + at var{FirstCode} will be executed whenever the Mercury procedure is called.
> + at var{RetryCode} will be executed whenever a given call to the procedure
> +is re-entered on backtracking to find subsequent solutions.
> +The shared_code(@var{SharedCode}) argument is optional; if present,
> + at var{SharedCode} willl be executed after each execution of
> + at var{FirstCode} or @var{RetryCode}.

In the first example, the retry_code(RetryCode) arguement is missing.
Is this optional too?

> +:- pred foo(int).
> +:- mode foo(out) is multi.
> +:- pragma c_code(foo(X::out), [will_not_call_mercury, thread_safe],
> +        local_vars("
> +                int state;
> +        "),
> +        first_code("
> +                LOCALS->state = 0;
> +        "),
> +        common_code("

s/common/shared

> +        retry_code("
> +                LOCALS->count++;
> +        "),
> +        common_code("

s/common/shared/

> + at c XXX document the default values
> +

Yes please.

Otherwise it's fine.

-- 

Because I dislike being quoted I lie almost constantly when talking 
about my work.
		-- Terry Gilliam

Tyson Dowd   <tyson at tyse.net>   http://tyse.net/tyson 




More information about the developers mailing list