Hello:
I would like to implement a new "calling convention" for Maple
language, so that programers in Haskell may call for Maple routines.
Both languages are intereseting for cooperation, due to its symbolic
expresiveness.
Maple 9.3 has released "Open Maple", somewhat like JNI for
Java, if I'm no
> I would like to implement a new "calling convention" for Maple
> language, so that programers in Haskell may call for Maple routines.
> Both languages are intereseting for cooperation, due to its symbolic
> expresiveness.
Making it possible to call Maple would be very cool. Can you give more d
>
> Making it possible to call Maple would be very cool. Can you give more detail
> about Open Maple?
>
Description
OpenMaple is a suite of functions that allows you to access Maple
algorithms and data structures in your compiled C program. This is the
reverse of ExternalCalling, which allows
> Examples ( taken from Open Maple )
>
> ALGEB M_DECL MyStats( MKernelVector kv, ALGEB *args )
> {
> ALGEB mean, sd, f;
>
> if( 1 != MapleNumArgs(kv,(ALGEB)args) ) {
> MapleRaiseError(kv,"one argument expected");
> return( NULL );
> }
> ...
>
On Mon, 20 Sep 2004, Alastair Reid wrote:
> > }
> > ...
> > /* return the pair */
> > return( ToMapleExpressionSequence(kv,2,mean,sd) );
> > }
> >
> > Is it what do you mean ?
>
> Yes, now use Haskell's ffi to import all those OpenMaple calls you made in the
> above.
>
> B) When passing char *string on C, should I use
> the CString or the Ptr CChar marhalling type from FFI ?
>
Ok. I see. Definition for CSTring is
type CString = Ptr CChar
C) CInt, CDouble are available...but, concerning Storable class.
Given:
typedef struct _foostruct {
int a;
doub
> -
> A) The H98 Foreign Function Interface remakrs the next example to import
> from C.
>
> foreign import ccall "string.h strlen" cstrlen:: Ptr CChar -> IO CSize
>
> but trying
>
> foreign import ccall "maplec.h MapleKernelOptions" mapleKernelOptions ::
> MKernelVector -> CString ->
Rafael Martinez Torres wrote:
Done. Upgrading ghc-6.0.1 solves it.
Why not 6.2.2? 6.0.1 is relatively old...
Still waiting for answer C) on how marshalling C structures...
Perhaps a look at
http://www.reid-consulting-uk.ltd.uk/docs/ffi.html
and probably
http://haskell.org/ghc/docs/latest/html
>
>
> C) CInt, CDouble are available...but, concerning Storable class.
>
> Given:
> typedef struct _foostruct {
> int a;
> double b;
> } fooStruct, *fooStructPtr;
>
> How to do to marshall it to Haskell ?
>
> type CFooStruct = ???
>
> instance Storable CFooStruct where
>sizeOf _ = ??
Rafael Martinez Torres wrote:
Well, after reading some doc, I realised it may not be feasible
without a FFI preprocessor.
It's feasible without a FFI preprocessor, but probably not very portable.
For the time beeing, as I don't want to access the internals of Kernel
descriptor, but to deal with it
>
> Yes, now use Haskell's ffi to import all those OpenMaple calls you made in the
> above. That is, MapleNumArgs, ToMapleExpressionSequence, etc.
>
> Having done that, translate the code into Haskell in the obvious way and check
> it works.
>
Done !!!
> After you've done a bunch of examples, s
11 matches
Mail list logo