Annotation of 43BSDTahoe/new/help/src/f77/error, revision 1.1.1.1

1.1       root        1: .TI F77/ERROR "Sep. 15, 1984"
                      2: Using the 'error' Command for Syntax Errors
                      3: 
                      4: This help file describes the use of the UNIX 'error' command with
                      5: syntax error messages;  for execution errors, see "help f77 error_msgs"
                      6: and for debugging, see "help f77 debugging".
                      7: 
                      8: Normally, f77 writes syntax error messages on the screen, you
                      9: copy them down and then edit the source file(s) and correct the
                     10: errors.  If you use the 'error' command, instead of having the error
                     11: messages displayed on the screen, they are inserted by the appropriate
                     12: lines in the source file.
                     13: 
                     14: As an example, suppose prog.f contains:
                     15: 
                     16: .nf
                     17:                print, " hi "
                     18:                sqr2p = sqrt(2.0)
                     19:                sqr2e = 2.0^0.5
                     20:                print *, "square root of 2.0 is", sqr2p, sqr2e
                     21:                end
                     22: .fi
                     23: 
                     24: Compiling prog.f generates these messages:
                     25: 
                     26: .nf
                     27:        % f77 prog.f
                     28:        prog.f:
                     29:           MAIN:
                     30:        Error on line 1 of prog.f: syntax error
                     31:        Error on line 3 of prog.f: syntax error
                     32:        
                     33:        Error.  No assembly.
                     34:        % 
                     35: .fi
                     36: 
                     37: These can be piped to the error utility (piping both standard output
                     38: and standard error):
                     39: 
                     40: .nf
                     41:        % f77 prog.f |& error
                     42:        
                     43:        1 file contains errors "prog.f" (2)
                     44:        
                     45:        File "prog.f" has 2 errors.
                     46:                2 of these errors can be inserted into the file.
                     47:        You touched file(s): "prog.f"
                     48: .fi
                     49: 
                     50: The output to your terminal notes that two error messages have been
                     51: inserted into the file prog.f.  Prog.f now contains:
                     52: 
                     53: .nf
                     54:        C###1 [f77] Error on line 1 of prog.f syntax error%%%
                     55:                print, " hi "
                     56:                sqr2p = sqrt(2.0)
                     57:        C###3 [f77] Error on line 3 of prog.f syntax error%%%
                     58:                sqr2e = 2.0^0.5
                     59:                print *, "square root of 2.0 is", sqr2p, sqr2e
                     60:                end
                     61: .fi
                     62: 
                     63: Each of the syntax errors has been inserted in the file in front of
                     64: the line causing the error.  They are inserted as Fortran comments,
                     65: so they will not cause new syntax errors if you forget to remove them.
                     66: 
                     67: You can use the editor and look for `###' in the error messages,
                     68: and then fix the errors.  If the ``-v'' flag is used:
                     69: 
                     70:        % f77 prog.f |& error -v
                     71: 
                     72: error will finish by invoking the visual editor, vi, with
                     73: the first source file containing errors.
                     74: 
                     75: It is easier to see what error does by using it than to understand
                     76: it by looking at examples.  Error is particularly useful when
                     77: there are few errors in a large source program.
                     78: If there are too many errors, such as if a dimension statement is missing,
                     79: the inserted errors can be overwhelming; however:
                     80: 
                     81:        :g /###/d
                     82: 
                     83: will eliminate them (along with any other lines containing ``###'').

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.