Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /sml/trunk/src/smlnj-c/libs/binC2ML/README
ViewVC logotype

Annotation of /sml/trunk/src/smlnj-c/libs/binC2ML/README

Parent Directory Parent Directory | Revision Log Revision Log

Revision 651 - (view) (download)

1 : monnier 249 The functor binaryC in the files
2 :     binary-C-file.sig.sml
3 :     binary-C-file.sml
4 :     can be used to convert binary C data (e.g. structs) into their
5 :     SML/NJ C interface equivalents. This is useful for importing
6 :     C binary data from files, for example.
7 :    
8 :     To use the convertor, instantiate a C interface for the source
9 :     C data. Note that it is possible to import C data created by a
10 :     C compiler with different characteristcs (e.g. sizes) than the
11 :     target (SML/NJ) platform. Then, instantiate the binaryC functor
12 :     with this C interface. The function toBits converts an SML/NJ
13 :     ctype instance to bits in a Word8Vector. Conversely, the function
14 :     fromBits converts the bits in a Word8Vector, given a ctype, to
15 :     the corresponding C data.
16 :    
17 :     The toBits/fromBits operations are valid only on flat types; no
18 :     pointers or functions. binaryC raises an exception when asked
19 :     to convert non-flat types.
20 :    
21 :     The file load.sml serves to illustrate the process described above.

ViewVC Help
Powered by ViewVC 1.0.0