[m-dev.] for review: pragma foreign_code for MC++ (part 1/2)
Tyson Dowd
trd at cs.mu.OZ.AU
Wed Nov 15 09:07:20 AEDT 2000
Hi Fergus,
Thanks for the review so far. I've been using this code to implement
the library in managed C++, and it seems to work reasonably well.
>
> > +:- func make_pred_name_rest(foreign_language, sym_name) = string.
> > +make_pred_name_rest(c, _SymName) = "some_c_name".
>
> Hmm, that looks a bit odd... perhaps it is missing an XXX comment
> and explanation?
Yep, this is right. This is where I stopped working on C++/C
interfacing.
> > +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've fixed all the other errors you pointed out.
--
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-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