Commit 0df18d07 authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2004-06-28 18:41:23 by afrisch] Optional 'external' keyword

Original author: afrisch
Date: 2004-06-28 18:41:24+00:00
parent 89628c20
let sdl_version = string_of (external "Sdl.version" [])
let sdl_version = string_of (Sdl.version [])
let [] =
print [ 'Sdl version' !sdl_version '\n' ];
external "Sdl.init" `None [ `EVERYTHING ];
let n = string_of (external "Sdlcdrom.get_num_drives" []) in
Sdl.init `None [ `EVERYTHING ];
let n = string_of (Sdlcdrom.get_num_drives []) in
print [ 'Drives:' !n '\n' ];
let cd = external "Sdlcdrom.cd_open" 0 in
external "Sdlcdrom.cd_eject" cd
let cd = Sdlcdrom.cd_open 0 in
Sdlcdrom.cd_eject cd
......@@ -146,9 +146,9 @@ more details).
</p>
<p>
In the CDuce module, you can write <code>external "M.f"</code>
In a CDuce module, you can write <code>external "M.f"</code>
to denote the result of translating the OCaml value <code>M.f</code>
to CDuce.
to CDuce. Actually, you can simply write <code>M.f</code>.
</p>
<p>
......@@ -302,7 +302,7 @@ Here is the protocol to compile a single CDuce module:
<section title="Getting the value of an environment variable">
<sample>
let home = external "Sys.getenv" "home";;
let home = Sys.getenv "home";;
</sample>
</section>
......@@ -314,9 +314,9 @@ This example demonstrates how to use OCamlSDL library.
</p>
<sample>
external "Sdl.init" `None [ `EVERYTHING ];;
let cd = external "Sdlcdrom.cd_open" 0;;
external "Sdlcdrom.cd_eject" cd;;
Sdl.init `None [ `EVERYTHING ];;
let cd = Sdlcdrom.cd_open 0;;
Sdlcdrom.cd_eject cd;;
</sample>
<p>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment