diff6-10.chapter9.txt

このページは最後に更新されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

last mod. 2008-08-28 (木) 10:01:05

diff6-10

12a13
>                                                                   
16,23c17,18
<           definition ::=   let [rec] let-binding { and let-binding }           
<                        |  external value-name : typexpr = external-declaration 
<                        |  type-definition                                      
<                        |  exception-definition                                 
<                        |  module module-name [ : module-type ] = module-expr   
<                        |  module type modtype-name = module-type               
<                        |  open module-path                                     
<   directive-argument ::=   nothing                                             
---
>                                                                   
>               directive-argument ::=  epsilon                     
27a23
>   
40,41c36
<                 The toplevel system is started by the command ocaml, as
<                follows: 
---
>     The toplevel system is started by the command ocaml, as follows: 
43,44c38
<                          ocaml options objects                # interactive
<                mode
---
>              ocaml options objects                # interactive mode
47,86c41,80
<                 options are described below. objects are filenames ending in
<                .cmo or .cma; they are loaded into the interpreter immediately
<                after options are set. scriptfile is any file name not ending in
<                .cmo or .cma.
<                If no scriptfile is given on the command line, the toplevel
<                system enters interactive mode: phrases are read on standard
<                input, results are printed on standard output, errors on
<                standard error. End-of-file on standard input terminates ocaml
<                (see also the #quit directive in section 9.2).
<                On start-up (before the first phrase is read), if the file
<                .ocamlinit exists in the current directory, its contents are
<                read as a sequence of Objective Caml phrases and executed as per
<                the #use directive described in section 9.2. The evaluation
<                outcode for each phrase are not displayed.
<                The toplevel system does not perform line editing, but it can
<                easily be used in conjunction with an external line editor such
<                as fep; just run fep -emacs ocaml or fep -vi ocaml. Another
<                option is to use ocaml under Gnu Emacs, which gives the full
<                editing power of Emacs (see the subdirectory emacs of the
<                Objective Caml distribution).
<                At any point, the parsing, compilation or evaluation of the
<                current phrase can be interrupted by pressing ctrl-C (or, more
<                precisely, by sending the sigintr signal to the ocaml process).
<                The toplevel then immediately returns to the # prompt.
<                If scriptfile is given on the command-line to ocaml, the
<                toplevel system enters script mode: the contents of the file are
<                read as a sequence of Objective Caml phrases and executed, as
<                per the #use directive (section 9.2). The outcome of the
<                evaluation is not printed. On reaching the end of file, the
<                ocaml command exits immediately. No commands are read from
<                standard input. Sys.argv is transformed, ignoring all Objective
<                Caml parameters, and starting with the script file name in
<                Sys.argv.(0).
<                In script mode, the first line of the script is ignored if it
<                starts with #!. Thus, it is theoretically possible to make the
<                script itself executable and put as first line
<                #!/usr/local/bin/ocaml, thus calling the toplevel system
<                automatically when the script is run. However, ocaml itself is a
<                #! script on most installations of Objective Caml, and Unix
<                kernels usually do not handle nested #! scripts.
---
>     options are described below. objects are filenames ending in .cmo or .cma;
>    they are loaded into the interpreter immediately after options are set.
>    scriptfile is any file name not ending in .cmo or .cma.
>    If no scriptfile is given on the command line, the toplevel system enters
>    interactive mode: phrases are read on standard input, results are printed on
>    standard output, errors on standard error. End-of-file on standard input
>    terminates ocaml (see also the #quit directive in section 9.2).
>    On start-up (before the first phrase is read), if the file .ocamlinit exists
>    in the current directory, its contents are read as a sequence of Objective
>    Caml phrases and executed as per the #use directive described in section
>    9.2. The evaluation outcode for each phrase are not displayed. If the
>    current directory does not contain an .ocamlinit file, but the user's home
>    directory (environment variable HOME) does, the latter is read and executed
>    as described below.
>    The toplevel system does not perform line editing, but it can easily be used
>    in conjunction with an external line editor such as ledit, ocaml2 or rlwrap 
>     (see the Caml Hump (1)).  Another option is to use ocaml under Gnu Emacs,
>    which gives the full editing power of Emacs (command run-caml from library
>    inf-caml).
>    At any point, the parsing, compilation or evaluation of the current phrase
>    can be interrupted by pressing ctrl-C (or, more precisely, by sending the
>    INTR signal to the ocaml process). The toplevel then immediately returns to
>    the # prompt.
>    If scriptfile is given on the command-line to ocaml, the toplevel system
>    enters script mode: the contents of the file are read as a sequence of
>    Objective Caml phrases and executed, as per the #use directive (section
>    9.2). The outcome of the evaluation is not printed. On reaching the end of
>    file, the ocaml command exits immediately. No commands are read from
>    standard input. Sys.argv is transformed, ignoring all Objective Caml
>    parameters, and starting with the script file name in Sys.argv.(0).
>    In script mode, the first line of the script is ignored if it starts with
>    #!. Thus, it should be possible to make the script itself executable and put
>    as first line #!/usr/local/bin/ocaml, thus calling the toplevel system
>    automatically when the script is run. However, ocaml itself is a #! script
>    on most installations of Objective Caml, and Unix kernels usually do not
>    handle nested #! scripts. A better solution is to put the following as the
>    first line of the script: 
>    <<        #!/usr/local/bin/ocamlrun /usr/local/bin/ocaml
>    >>
>    
89,110c83,88
<                 In addition to the text-only command ocaml.exe, which works
<                exactly as under Unix (see above), a graphical user interface
<                for the toplevel is available under the name ocamlwin.exe. It
<                should be launched from the Windows file manager or program
<                manager.
<                The ``Terminal'' windows is split in two panes. Phrases are
<                entered and edited in the bottom pane. The top pane displays a
<                copy of the input phrases as they are processed by the Objective
<                Caml toplevel, interspersed with the toplevel responses. The
<                ``Return'' key sends the contents of the bottom pane to the
<                Objective Caml toplevel. The ``Enter'' key inserts a newline
<                without sending the contents of the Input window. (This can be
<                configured with the ``Preferences'' menu item.)
<                The contents of the input window can be edited at all times,
<                with the standard Windows interface. An history of previously
<                entered phrases is maintained and displayed in a separate
<                window.
<                To quit the Camlwin application, either select ``Quit'' from the
<                ``File'' menu, or use the quit function described below.
<                At any point, the parsing, compilation or evaluation of the
<                current phrase can be interrupted by selecting the ``Interrupt
<                Objective Caml'' menu item. This goes back to the # prompt. 
---
>     In addition to the text-only command ocaml.exe, which works exactly as
>    under Unix (see above), a graphical user interface for the toplevel is
>    available under the name ocamlwin.exe. It should be launched from the
>    Windows file manager or program manager. This interface provides a text
>    window in which commands can be entered and edited, and the toplevel
>    responses are printed. 
120a99
>  
148a128,129
>  -version  Print version and exit.
>  
155,164c136,145
<                 LC_CTYPE  If set to iso_8859_1, accented characters (from the
<                   ISO Latin-1 character set) in string and character literals
<                   are printed as is; otherwise, they are printed as decimal
<                   escape sequences (\ddd).
<                 
<                 TERM  When printing error messages, the toplevel system
<                   attempts to underline visually the location of the error. It
<                   consults the TERM variable to determines the type of output
<                   terminal and look up its capabilities in the terminal
<                   database. 
---
>     LC_CTYPE  If set to iso_8859_1, accented characters (from the ISO Latin-1
>       character set) in string and character literals are printed as is;
>       otherwise, they are printed as decimal escape sequences (\ddd).
>     
>     TERM  When printing error messages, the toplevel system attempts to
>       underline visually the location of the error. It consults the TERM
>       variable to determines the type of output terminal and look up its
>       capabilities in the terminal database.
>     
>     HOME  Directory where the .ocamlinit file is searched. 
178c159,160
< but typing quit;; will result in an ``unbound value quit'' error.
---
> but typing quit;; will result in an "unbound value quit" error.
>   
217,221c199,203
<    function named function-name will be ``traced''. That is, the argument and
<    the result are displayed for each call, as well as the exceptions escaping
<    out of the function, raised either by the function itself or by another
<    function it calls. If the function is curried, each argument is printed as
<    it is passed to the function.
---
>    function named function-name will be "traced". That is, the argument and the
>    result are displayed for each call, as well as the exceptions escaping out
>    of the function, raised either by the function itself or by another function
>    it calls. If the function is curried, each argument is printed as it is
>    passed to the function.
248,253c230,235
< provided results in the error ``Reference to undefined global `...' ''.
<   Note that entering open mod merely accesses the compiled interface (.cmi
< file) for mod, but does not load the implementation of mod, and does not cause
< any error if no implementation of mod has been loaded. The error  ``reference
< to undefined global mod'' will occur only when executing a value or module
< definition that refers to mod.
---
> provided results in the error "Reference to undefined global `...' ".
>   Note that entering open Mod merely accesses the compiled interface (.cmi
> file) for Mod, but does not load the implementation of Mod, and does not cause
> any error if no implementation of Mod has been loaded. The error  "reference to
> undefined global Mod" will occur only when executing a value or module
> definition that refers to Mod.
263a246
>  
292,293c275
< <<
<           ocamlmktop -o mytoplevel foo.cmo bar.cmo gee.cmo
---
> <<        ocamlmktop -o mytoplevel foo.cmo bar.cmo gee.cmo
298,299c280
< <<
<           ./mytoplevel
---
> <<        ./mytoplevel
303,304c284
< <<
<           #load "foo.cmo";;
---
> <<        #load "foo.cmo";;
310,311c290
< <<
<           open Foo;;
---
> <<        open Foo;;
322a302
>  
324c304
<    ``custom runtime'' mode. See the corresponding option for ocamlc, in chapter
---
>    "custom runtime" mode. See the corresponding option for ocamlc, in chapter
328c308
<    linking in ``custom runtime'' mode. See the corresponding option for ocamlc,
---
>    linking in "custom runtime" mode. See the corresponding option for ocamlc,
331c311
<  -custom  Link in ``custom runtime'' mode. See the corresponding option for
---
>  -custom  Link in "custom runtime" mode. See the corresponding option for
339a320,321
> ---------------------------------------
>   
340a323
>  (1) http://caml.inria.fr/humps/index_framed_caml.html

新規 編集 添付