gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gm2] C IMPLEMENTATION MODULE?


From: Gaius Mulley
Subject: Re: [Gm2] C IMPLEMENTATION MODULE?
Date: Sun, 20 Dec 2009 17:50:55 +0000
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

Martin Kalbfuß <address@hidden> writes:

> Hi,
>
> I'm using C definition modules. A second layer of modules makes the api
> more Modula like. Is it possible to have implementation modules for C
> and  add the C function declarations there inside the wrapping
> functions.
>
> Something like this:
>
> IMPLEMENTATION MODULE FOR "C" AModule.
>
> PROCEDURE DoSomethingTheModulaWay( aParameter : aDatatype);
>
>       (* C-Function declaration *)
>       PROCEDURE DoSomethingTheCWay( aParameter : anotherType);
>
> BEGIN
>       (* convert aParameter *)
>         DoSomethingTheCWay(convertedParameter);
> END DoSomethingTheModulaWay;
>
> END AModule.

Hi Martin,

I think it makes the extensions too complex and probably introduces
ambiguity.  I'd favour keeping things as they are and if the above
is required then I'd write the code thus:

AModule.def
===========

DEFINITION MODULE AModule ;

PROCEDURE DoSomethingTheModulaWay (aParameter : aDatatype);

END AModule.

AModule.c
=========

void AModule_DoSomethingTheModulaWay (map_aDatatype_from_m2_into_c aParameter)
{
   bParameter = /* do any conversion */

   DoSomethingTheCWay (bParameter);
}

_M2_AModule_init () {}
_M2_AModule_finish () {}


regards,
Gaius




reply via email to

[Prev in Thread] Current Thread [Next in Thread]