[m-dev.] for review: pragma foreign_code for MC++ (part 1/2)

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Nov 15 12:54:20 AEDT 2000


On 15-Nov-2000, Tyson Dowd <trd at cs.mu.OZ.AU> wrote:
> > > +make_pragma_import(PredInfo, ProcInfo, C_Function, Context,
> > > +		ModuleInfo, PragmaImpl, VarSet, PragmaVars, ArgTypes, 
> > > +		Arity, PredOrFunc) :-
> > ...
> > > +	%
> > > +	% Construct parts of the C_Code string for calling C_Function.
> > > +	% This C code fragment invokes the specified C function
> > > +	% with the appropriate arguments from the list constructed
> > > +	% above, passed in the appropriate manner (by value, or by
> > > +	% passing the address to simulate pass-by-reference), and
> > > +	% assigns the return value (if any) to the appropriate place.
> > > +	% As this phase occurs before polymorphism, we don't know about
> > > +	% the type-infos yet.  polymorphism.m is responsible for adding
> > > +	% the type-info arguments to the list of variables.
> > > +	%
> > > +	handle_return_value(CodeModel, PredOrFunc, PragmaVarsAndTypes,
> > > +			ModuleInfo, ArgPragmaVarsAndTypes, Return),
> > > +	assoc_list__keys(ArgPragmaVarsAndTypes, ArgPragmaVars),
> > > +	create_pragma_import_c_code(ArgPragmaVars, ModuleInfo,
> > > +			"", Variables),
> > > +
> > > +	%
> > > +	% Add the C_Code for this `pragma import' to the clauses_info
> > > +	%
> > > +	PragmaImpl = import(C_Function, Return, Variables, yes(Context)).
> > 
> > The comment here appears to have suffered documentation rot.
> > It needs at least "s/C_Code/C code/g", and perhaps more serious revision.
> 
> The "add the C code" is just wrong because I moved the code around a
> bit.  This now happens in make_hlds. 
> 
> The rest of the documentation seems to be OK.   I've fixed the
> captitalization a bit.  What did you think needed revising?

I was wondering whether this stuff was specific to C code or
whether it was supposed to handle arbitrary foreign languages.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list