tsp-devel
[Top][All Lists]
Advanced

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

Re: RE : [Tsp-devel] Source indentation


From: Eric Noulard
Subject: Re: RE : [Tsp-devel] Source indentation
Date: Thu, 26 Apr 2007 23:02:54 +0200

2007/4/26, Frederik Deweerdt <address@hidden>:
I've done various tests on .o generated files before and after indent.
After:
- compiling in Release mode
- replacing STRACE_ERROR, STRACE_WARN macros with empty defines
I've copied all generated .o files in /tmp/indent and /tmp/vanilla
respectively.
The result is:
$ diff -pruN /tmp/{indent,vanilla}/
Binary files /tmp/indent/gtkdatabox.o and /tmp/vanilla/gtkdatabox.o differ
Binary files /tmp/indent/plotwindow.o and /tmp/vanilla/plotwindow.o differ
After examining the generated code, this is due to the
g_return_val_if_fail macro which takes the line number, the generated
code thus differs.
So, IMO, find . -name '*.[ch]' -exec indent -i8 -kr -l200 {} \;
is safe. I'll do it at the end of the week unless some one spots a
problem I missed.

Knowing that I'm OK.
What makes you choose 200?
200 character is a really lengthly line?

After re-indent is done which should ensure everybody knows a mean
to enforce the rules with its favorite editor and or systematically
call "make indent" before any commit.

Thus, after you did it (or before that if I am fast :))
I will set up a CMake target "indent" which will do the :

find . -name '*.[ch]' -exec indent -i8 -kr -l200 {} \;

in the source tree.

Everyone around here is welcomed to tell how to:

-i8     : Set indentation level to 8 spaces.
-kr     : Use Kernighan & Ritchie coding style.
-l200 : Set maximum line length for non-comment lines to 200.

with its favorite editor:
  emacs
xemacs
  nedit
  vi/vim
  ed :))
  MS-Word[pad] :-((
  ...

Yves & Fred already sent helpfull URL for emacs/xemacs:
http://escher.sourceforge.net/current/etc/linux-coding-style

linux is : indent -i8 -kr
we only need the -l200

I think this just what the following tsp-c-mode does:
[needs testing even if works for me]

(defun tsp-c-mode ()
 "C mode with adjusted defaults for use with TSP."
 (interactive)
 (c-mode)
 (c-set-style "K&R")
 (setq c-basic-offset 8)
(setq c-auto-newline t)
(set fill-column 200)
(setq auto-fill-mode 1))

for automatic mode switch:

(setq auto-mode-alist (cons '(".*tsp.*/.*\\.[ch]$" . tsp-c-mode)
                      auto-mode-alist))


--
Erk




reply via email to

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