Gaius Mulley <gaius@gnu.org>
Mike Gancarz
DEFINITION MODULE FOR "C" libc ; EXPORT UNQUALIFIED printf ; PROCEDURE printf (a: ARRAY OF CHAR; ...) ; END libc.
PROCEDURE Example (i, j: CARDINAL) : CARDINAL ; VAR k: CARDINAL ; BEGIN ASM VOLATILE ("movl %1,%eax; \ addl %2,%eax; movl %eax,%0" : "=g" (k) (* outputs *) : "g" (i), "g" (j) (* inputs *) : "eax") ; (* we trash *) RETURN( k ) END Example ;
DEFINITION MODULE MathLib0 ; CONST pi =3.1415926535897932384626433832795028841972; exp1=2.7182818284590452353602874713526624977572; PROCEDURE __BUILTIN__ sqrt (x: REAL) : REAL ; PROCEDURE __BUILTIN__ sqrtl (x: LONGREAL) : LONGREAL ; PROCEDURE __BUILTIN__ sqrts (x: SHORTREAL) : SHORTREAL ; PROCEDURE exp (x: REAL) : REAL ; PROCEDURE exps (x: SHORTREAL) : SHORTREAL ;
IMPLEMENTATION MODULE MathLib0 ; IMPORT cbuiltin, libm ; PROCEDURE __ATTRIBUTE__ __BUILTIN__ ((__builtin_sqrt)) sqrt (x: REAL): REAL; BEGIN RETURN cbuiltin.sqrt (x) END sqrt ; PROCEDURE exp (x: REAL) : REAL ; BEGIN RETURN libm.exp (x) END exp ;
# # GNU Modula-2 repo # deb http://floppsie.comp.glam.ac.uk/debian/ squeeze main deb-src http://floppsie.comp.glam.ac.uk/debian/ squeeze main
$ sudo apt-get update $ sudo apt-get install gm2-doc gm2
This document was produced using groff-1.22.