Changeset 3ac5fd8 for doc


Ignore:
Timestamp:
Aug 17, 2024, 3:15:21 PM (3 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
df2e00f
Parents:
afb15cf
Message:

first attempt changing end-of-file to an exception

Location:
doc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/jiada_liang_MMath/CFAenum.tex

    rafb15cf r3ac5fd8  
    471471        E e;
    472472
    473         for () {
    474                 try {
    475                         @sin | e@;
    476                 } catch( missing_data * ) {
    477                         sout | "missing data";
    478                         continue; // try again
     473        try {
     474                for () {
     475                        try {
     476                                @sin | e@;
     477                        } catch( missing_data * ) {
     478                                sout | "missing data";
     479                                continue; // try again
     480                        }
     481                        sout | e | "= " | value( e );
    479482                }
    480           if ( eof( sin ) ) break;
    481                 sout | e | "= " | value( e );
    482         }
     483        } catch( end_of_file ) {}
    483484}
    484485\end{cfa}
  • doc/user/user.tex

    rafb15cf r3ac5fd8  
    1111%% Created On       : Wed Apr  6 14:53:29 2016
    1212%% Last Modified By : Peter A. Buhr
    13 %% Last Modified On : Fri Jul 26 06:56:11 2024
    14 %% Update Count     : 6955
     13%% Last Modified On : Thu Aug 15 22:23:30 2024
     14%% Update Count     : 6957
    1515%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    1616
     
    46564656\VRef[Figure]{f:CFACommand-LineProcessing} demonstrates the file operations by showing the idiomatic \CFA command-line processing and copying an input file to an output file.
    46574657Note, a stream variable may be copied because it is a reference to an underlying stream data-structures.
    4658 \Textbf{All I/O errors are handled as exceptions}, but end-of-file is not an exception as C programmers are use to explicitly checking for it.
     4658\Textbf{All unusual I/O cases are handled as exceptions, including end-of-file.}
    46594659
    46604660\begin{figure}
     
    46864686        in | nlOn;                                                              §\C{// turn on reading newline}§
    46874687        char ch;
    4688         for () {                                                                §\C{// read/write characters}§
    4689                 in | ch;
    4690           if ( eof( in ) ) break;                               §\C{// eof ?}§
    4691                 out | ch;
    4692         } // for
     4688        try {
     4689                for () {                                                        §\C{// read/write characters}§
     4690                        in | ch;
     4691                        out | ch;
     4692                } // for
     4693        } catch( end_of_file * ) {                              §\C{// end-of-file raised}§
     4694        } // try
    46934695} // main
    46944696\end{cfa}
Note: See TracChangeset for help on using the changeset viewer.