octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Octave line length


From: John W. Eaton
Subject: Re: Octave line length
Date: Wed, 15 Jan 2020 10:32:57 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0

On 1/14/20 11:25 AM, Rik wrote:
On 01/13/2020 09:20 PM, John W. Eaton wrote:

Is it easy to ask the reformatting tool to not break any expressions into
multiple lines and then get a distribution of line lengths for all
lines?  I think it would be interesting to see just how many lines are
longer than 80, 90, 100, ... characters.

I don't know how to do it with a reformatting tool, but with Perl it was
easy enough.  The following results are only for liboctave/ and libinterp/
including all *.cc, *.c, *.h files.  The line length begins at 1 because
the newline is counted as a character.

I did the following:

echo "LENGTH COUNT"; for f in $(hg locate '*.c' '*.f' '*.cc' '*.h' '*.ll' '*.yy'); do awk '{ n = length ($0); if (n > 80) print n; }' $f ; done | sort | uniq -c | awk '{printf (" %4d %4d\n", $2, $1); }' | sort -n

and my results are a little different from yours.

Using

for f in $(hg locate '*.c' '*.f' '*.cc' '*.h' '*.ll' '*.yy') ; do awk '{if (length ($0) > 100) print FILENAME; }' $f ; done | sort | uniq -c | sort -nr

to get counts by file for lines longer than 100 characters, I see

    199 liboctave/external/Faddeeva/Faddeeva.cc
    141 libinterp/operators/op-int.h
     72 liboctave/numeric/lo-specfun.h
     70 libinterp/corefcn/besselj.cc
     54 libgui/src/gui-preferences-sc.h
     24 libgui/qterminal/libqterminal/unix/Filter.h
     23 libinterp/corefcn/data.cc
     22 libinterp/corefcn/graphics.in.h
     19 libgui/src/settings-dialog.cc
     18 libinterp/dldfcn/qr.cc
     18 libinterp/corefcn/rand.cc
     14 libinterp/corefcn/mappers.cc
     12 libinterp/octave-value/ov-java.cc
     11 libinterp/corefcn/graphics.cc
     10 liboctave/numeric/oct-rand.cc
     10 libinterp/corefcn/matrix_type.cc
     10 libgui/src/welcome-wizard.cc
      9 libinterp/corefcn/regexp.cc
      9 libinterp/corefcn/oct-stream.cc
      9 libgui/src/m-editor/file-editor-tab.cc
      8 liboctave/numeric/eigs-base.cc
      8 libinterp/parse-tree/oct-parse.yy
      8 libinterp/dldfcn/__glpk__.cc
      8 libinterp/corefcn/file-io.cc
      7 libinterp/octave-value/ov.cc
      7 libinterp/corefcn/time.cc
      7 libinterp/corefcn/lu.cc
      7 libinterp/corefcn/gsvd.cc
      7 libinterp/corefcn/cellfun.cc
      6 liboctave/array/Sparse.cc
      6 liboctave/array/CMatrix.cc
      6 libinterp/octave-value/ov-struct.cc
      6 libinterp/dldfcn/chol.cc
      6 libinterp/corefcn/utils.cc
      6 libinterp/corefcn/dasrt.cc
      6 libgui/qterminal/libqterminal/unix/TerminalView.h
      5 libgui/src/main-window.cc
      5 libgui/src/files-dock-widget.cc
      5 libgui/qterminal/libqterminal/unix/CharacterColor.h
      4 liboctave/operators/mx-op-defs.h
      4 liboctave/array/fCMatrix.cc
      4 libinterp/parse-tree/lex.ll
      4 libinterp/octave-value/ov-class.cc
      4 libinterp/corefcn/quadcc.cc
      4 libinterp/corefcn/quad.cc
      4 libinterp/corefcn/oct-tex-parser.yy
      4 libinterp/corefcn/event-manager.cc
      4 libgui/src/news-reader.cc
      4 libgui/qterminal/libqterminal/unix/ScreenWindow.h
      3 src/mkoctfile.in.cc
      3 libinterp/octave.cc
      3 libinterp/dldfcn/__init_fltk__.cc
      3 libinterp/dldfcn/audioread.cc
      3 libinterp/corefcn/sysdep.cc
      3 libinterp/corefcn/syscalls.cc
      3 libinterp/corefcn/strfns.cc
      3 libinterp/corefcn/stream-euler.cc
      3 libinterp/corefcn/stack-frame.cc
      3 libinterp/corefcn/pr-output.cc
      3 libinterp/corefcn/lsode.cc
      3 libinterp/corefcn/gl-render.cc
      3 libgui/src/m-editor/file-editor.cc
      3 libgui/qterminal/libqterminal/unix/Screen.h
      3 libgui/qterminal/libqterminal/unix/KeyboardTranslator.h
      3 libgui/qterminal/libqterminal/unix/History.h
      2 liboctave/wrappers/unistd-wrappers.c
      2 liboctave/util/lo-regexp.cc
      2 liboctave/numeric/sparse-qr.cc
      2 liboctave/array/CSparse.cc
      2 liboctave/array/CRowVector.cc
      2 libinterp/parse-tree/jit-typeinfo.h
      2 libinterp/operators/ops.h
      2 libinterp/octave-value/ov-fcn-handle.cc
      2 libinterp/dldfcn/__eigs__.cc
      2 libinterp/dldfcn/audiodevinfo.cc
      2 libinterp/corefcn/urlwrite.cc
      2 libinterp/corefcn/symtab.cc
      2 libinterp/corefcn/qz.cc
      2 libinterp/corefcn/ls-mat5.cc
      2 libinterp/corefcn/help.cc
      2 libinterp/corefcn/gl2ps-print.cc
      2 libinterp/corefcn/fcn-info.cc
      2 libinterp/corefcn/dot.cc
      2 libgui/src/qt-interpreter-events.cc
      2 libgui/src/gui-preferences-mw.h
      2 libgui/src/find-files-dialog.cc
      2 libgui/qterminal/libqterminal/unix/TerminalCharacterDecoder.h
      1 liboctave/util/quit.h
      1 liboctave/util/oct-sparse.h
      1 liboctave/util/oct-shlib.cc
      1 liboctave/util/lo-utils.cc
      1 liboctave/util/lo-ieee.cc
      1 liboctave/numeric/schur.cc
      1 liboctave/numeric/oct-fftw.cc
      1 liboctave/numeric/LSODE.cc
      1 liboctave/numeric/hess.cc
      1 libinterp/parse-tree/pt-mat.cc
      1 libinterp/octave-value/ov-typeinfo.cc
      1 libinterp/octave-value/ov-scalar.h
      1 libinterp/octave-value/ov-intx.h
      1 libinterp/octave-value/ov-float.h
      1 libinterp/octave-value/ov-cell.cc
      1 libinterp/octave-value/ov-bool-mat.cc
      1 libinterp/octave-value/ov-bool.h
      1 libinterp/octave-value/cdef-package.cc
      1 libinterp/octave-value/cdef-class.cc
      1 libinterp/dldfcn/__ode15__.cc
      1 libinterp/dldfcn/__fltk_uigetfile__.cc
      1 libinterp/dldfcn/__delaunayn__.cc
      1 libinterp/dldfcn/convhulln.cc
      1 libinterp/dldfcn/amd.cc
      1 libinterp/corefcn/toplev.cc
      1 libinterp/corefcn/sylvester.cc
      1 libinterp/corefcn/strfind.cc
      1 libinterp/corefcn/sparse.cc
      1 libinterp/corefcn/__qp__.cc
      1 libinterp/corefcn/psi.cc
      1 libinterp/corefcn/ordschur.cc
      1 libinterp/corefcn/load-save.cc
      1 libinterp/corefcn/load-path.cc
      1 libinterp/corefcn/__lin_interpn__.cc
      1 libinterp/corefcn/input.h
      1 libinterp/corefcn/input.cc
      1 libinterp/corefcn/__ilu__.cc
      1 libinterp/corefcn/hex2num.cc
      1 libinterp/corefcn/errwarn.cc
      1 libinterp/corefcn/ellipj.cc
      1 libinterp/corefcn/dassl.cc
      1 libinterp/corefcn/daspk.cc
      1 libgui/src/workspace-view.cc
      1 libgui/src/variable-editor.cc
      1 libgui/src/shortcut-manager.cc
      1 libgui/src/octave-qobject.cc
      1 libgui/src/m-editor/octave-qscintilla.cc
      1 libgui/src/gui-preferences-ed.h
      1 libgui/graphics/Panel.cc
      1 libgui/graphics/ButtonGroup.cc
      1 libgui/graphics/ButtonControl.cc

I bet a bunch of those are long error messages.

The thing I'm really curious about is how many lines longer than N (say 100 or 132) characters do we have if we reformat the sources so that no expressions are split across lines? Do things get any worse than what we currently have, or would most of of the expressions that are split to fit in 80 character lines fit in 100 or 132 character lines?

jwe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]