m3core_sa C


Motivation

You can't deny that a lot of useful code exists in C. In order to combine Modula-3 code and C code in the same program, you need to equate C's types with some Modula-3 types.

Overview

The Ctypes are used heavily in SPIN, because we communicate a lot of information between our own code written in Modula-3 and the SAL layer written in C.

Contents of the C language interface

Cerrno
The variable set by many C library functions to indicate error conditions. SPIN uses a procedural interface with GetErrno and SetErrno rather than exposing the actual variable.
Cstddef
The type size_t.
Cstdlib
Only malloc() and free() functions are retained by SPIN.
Ctypes
BasicCtypes
Define the mapping between C types and Modula-3 types.
M3toC
Procedures for changing TEXTs to C strings and vice versa.


garrett@cs.washington.edu