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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 224 - (download) (annotate)
Sat Apr 17 16:27:01 1999 UTC (22 years, 1 month ago) by monnier
File size: 945 byte(s)
This commit was generated by cvs2svn to compensate for changes in r223,
which included commits to RCS files with non-trunk default branches.
The functor binaryC in the files
		binary-C-file.sig.sml
		binary-C-file.sml
can be used to convert binary C data (e.g. structs) into their
SML/NJ C interface equivalents.  This is useful for importing 
C binary data from files, for example.

To use the convertor, instantiate a C interface for the source
C data.  Note that it is possible to import C data created by a 
C compiler with different characteristcs (e.g. sizes) than the
target (SML/NJ) platform.  Then, instantiate the binaryC functor
with this C interface.  The function toBits converts an SML/NJ
ctype instance to bits in a Word8Vector.  Conversely, the function
fromBits converts the bits in a Word8Vector, given a ctype, to 
the corresponding C data.  

The toBits/fromBits operations are valid only on flat types; no
pointers or functions.  binaryC raises an exception when asked
to convert non-flat types.

The file load.sml serves to illustrate the process described above.

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0