[GRASS-dev] [GRASS-SVN] r64658 - grass/trunk/tools

Martin Landa landa.martin at gmail.com
Mon Feb 16 12:54:43 PST 2015


Hi, are you planing to backport it to relbr70? BTW, I was always
thinking about moving scripts which are duplicated in various branches
to one common place. Martin

2015-02-16 21:05 GMT+01:00  <svn_grass at osgeo.org>:
> Author: wenzeslaus
> Date: 2015-02-16 12:05:05 -0800 (Mon, 16 Feb 2015)
> New Revision: 64658
>
> Modified:
>    grass/trunk/tools/grass_indent.sh
> Log:
> do not use tabs which are 8 spaces wide when indent level is 4 spaces
>
> Indent script was creating source code with 4 spaces for indent level 1,
> 1 tab for indent level 2, 1 tab and 4 spaces for indent level 3, 2 tabs
> for indent level 4 etc. This is style which is hard to do manually
> and cannot be easily guessed and supported by a text editor because it
> mixes spaces and tabs
> (http://lists.osgeo.org/pipermail/grass-dev/2014-September/070653.html).
>
> The indent rules are still the same, each level must be in multiplies
> of 4 spaces (columns) as specified in
> http://lists.osgeo.org/pipermail/grass-dev/2014-August/070497.html.
>
> No backwards compatibility is needed because just small portion of the
> current code has no diff after applying the (original version of) indent
> script. Now tested with v.external, i.segment and r.slope.aspect.
>
> The -ut (--use-tabs) was in the list at
> https://trac.osgeo.org/grass/wiki/Submitting/C.
> But it was not in the list at
> http://grasswiki.osgeo.org/w/index.php?title=Development&oldid=21058#Explanation_of_C_indentation_rules.
> And tabs are explicitly forbidden in instructions for Emacs users at
> http://grasswiki.osgeo.org/w/index.php?title=GRASS_Programming_Howto&oldid=20573#Emacs.
>
> See also #1663 (Tabs in C source code) and grass-dev Tabs and spaces in C code
> (http://lists.osgeo.org/pipermail/grass-dev/2014-August/070484.html).
>
>
> Modified: grass/trunk/tools/grass_indent.sh
> ===================================================================
> --- grass/trunk/tools/grass_indent.sh   2015-02-16 19:48:39 UTC (rev 64657)
> +++ grass/trunk/tools/grass_indent.sh   2015-02-16 20:05:05 UTC (rev 64658)
> @@ -1,14 +1,28 @@
>  #!/bin/sh
>
> -# Indent source code according to GRASS SUBMITTING rules
> +# Indent source code according to GRASS GIS submitting rules
>
> +# Should be in sync with:
> +#     https://trac.osgeo.org/grass/wiki/Submitting/C
> +#     http://grasswiki.osgeo.org/wiki/Development#Explanation_of_C_indentation_rules
> +
> +# Dependencies:
> +#     indent
> +
> +# Changes and their reasons:
> +#    -ts8 -ut -> --no-tabs
> +#        Do not use 8 space wide tabs when indent level is 4
> +
> +# TODO: replace short flags by long ones to improve readability
> +
> +
>  if [ $# -lt 1 ] ; then
>   echo "No files specified (give file name(s) as parameter)"
>   exit 1
>  else
>   indent -npro -bad -bap -bbb -br -bli0 -bls -cli0 -ncs -fc1 -hnl -i4 \
>        -nbbo -nbc -nbfda -nbfde -ncdb -ncdw -nce -nfca -npcs -nprs \
> -      -npsl -nsc -nsob -saf -sai -saw -sbi0 -ss -ts8 -ut "$@"
> +      -npsl -nsc -nsob -saf -sai -saw -sbi0 -ss --no-tabs "$@"
>
>   # fix broken gettext macros:
>   grep -l '\<_$' "$@" | \
>
> _______________________________________________
> grass-commit mailing list
> grass-commit at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-commit



-- 
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.eu/mentors/landa


More information about the grass-dev mailing list