[Yhc] Adding Custom Primitive functions

Alexis Morris akmorris at gmail.com
Tue Aug 21 22:57:14 EDT 2007


Hi all,

I have a number of driver related function calls that I would like to add as
Primitive functions to yhc and yhi. For yhi (yhc\src\runtime\BCKernel) I
have added definitions to Runtime.c and WrapPrimitive.c, in order to define
and wrap stuff like  "void display_string(void)" where the function is
declared in a display.h/display.c file  (this code controls the LCD display
of the NXT).

So far I think I have this yhi part covered. My question is about where
these primitives are made known to the compiler so I can make display_string
visible to yhc programs. After adding this line to Primitive.hs yhc hangs...

----------------------------------------------------------------------------------------------------
-- NXT Display
----------------------------------------------------------------------------------------------------
foreign import fastccall display_string :: CString -> IO ()


I just noticed the following files seem to have something todo with things:

C:\YHC_OLD_SOURCES\yhc_again\yhc\src\packages\yhc-base-1.0\YHCPrimitive.hs

C:\YHC_OLD_SOURCES\yhc_again\yhc\src\compiler\Prim.hs
C:\YHC_OLD_SOURCES\yhc_again\yhc\src\compiler\PrimCode.hs

C:\YHC_OLD_SOURCES\yhc_again\yhc\src\compiler98\Prim.hs
C:\YHC_OLD_SOURCES\yhc_again\yhc\src\compiler98\PrimCode.hs


Which changes I need to make before recompiling YHC? Thanks in advance.  :)

Cheers,
-- 
</Alexis>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/yhc/attachments/20070822/8cb5f6e5/attachment.htm


More information about the Yhc mailing list