previous up next index Irvine Compiler Logo
Previous: 3 Ada95 Features Up: User's Guide for the Next: 5 Caveats

4 Examples

In each of the examples, the words in slanted font are entered by the user, and the text in typewriter font displays the normal output from iccfmt.

Assume the file simple.ada (following) exists:

     -- A simple program for testing the ICC pretty printer.

     with text_io;
     use text_io;

     procedure simple is

     package int_io is new integer_io(integer);
     use int_io;

     begin
     int_io.default_width := 0;

     for i in 1..10 loop
     put(i);
     put(' ');
     end loop;
     new_line;
     end;

  1. This example shows the default formating of iccfmt.

         -- A simple program for testing the ICC pretty printer.
    
         with text_io;
         use  text_io;
    
         procedure simple is
            package int_io is new integer_io(integer);
            use int_io;
         begin
            int_io.default_width := 0;
    
            for i in 1..10 loop
               put(i);
               put(' ');
            end loop;
    
            new_line;
         end simple;
    

  2. This example shows the same file formatted with different qualifiers.

    % iccfmt -unit=upper -dotdot -for=5 simple

    The resulting file simple.fmt:

         -- A simple program for testing the ICC pretty printer.
    
         with TEXT_IO;
         use  TEXT_IO;
    
         procedure SIMPLE is
            package int_io is new integer_io(integer);
            use int_io;
         begin
            int_io.default_width := 0;
    
            for i in 1 .. 10 loop
                 put(i);
                 put(' ');
            end loop;
    
            new_line;
         end simple;
    

  3. This example shows the output when the source file contains an error(s). Using the original simple.ada, assume that you have inadvertently omitted the semicolon (;) after use text_io.

    % iccfmt simple.ada
         ICC Ada Source Code Formatter [vx.x.x MMM DD, YYYY]
         "simple.ada", 2: Error: Syntax error before token "with".
         "simple.fmt": Info: Deleting file because of errors.
    



© 1999 Irvine Compiler Corporation
2000-05-04