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/ml-nlffigen/spec.sml
ViewVC logotype

View of /sml/trunk/src/ml-nlffigen/spec.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 828 - (download) (annotate)
Fri May 11 18:32:07 2001 UTC (19 years, 1 month ago) by blume
File size: 1339 byte(s)
added new FFI code to repository
(*
 * spec.sml - A data structure describing the export interface of a
 *            C program.
 *
 *  (C) 2001, Lucent Technologies, Bell Labs
 *
 * author: Matthias Blume (blume@research.bell-labs.com)
 *)
structure Spec = struct

    datatype constness = RO | RW
    type tag = string

    datatype ctype =
	SCHAR | UCHAR | SINT | UINT | SSHORT | USHORT | SLONG | ULONG
      | FLOAT | DOUBLE | VOIDPTR
      | STRUCT of tag
      | UNION of tag
      | FPTR of cft
      | PTR of cobj
      | ARR of { t: ctype, d: int, esz: int }

    withtype cft = { args: ctype list, res: ctype option }

    and cobj = constness * ctype

    datatype fieldspec =
	OFIELD of { offset: int, spec: cobj, synthetic: bool }
      | SBF of { offset: int, constness: constness, bits: word, shift: word }
      | UBF of { offset: int, constness: constness, bits: word, shift: word }

    type field = { name: string, spec: fieldspec }

    type s =
	 { tag: tag, anon: bool, size: word, fields: field list }
    type u =
	 { tag: tag, anon: bool, size: word, largest: field, all: field list }

    type gvar = { name: string, spec: cobj }

    type gfun = { name: string, spec: cft }

    type gty = { name: string, spec: ctype }

    type spec = { structs: s list,
		  unions: u list,
		  gtys: gty list,
		  gvars: gvar list,
		  gfuns: gfun list }
end

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