[Insight-developers] KWStyle

Hans Johnson hans-johnson at uiowa.edu
Mon Jul 19 09:13:57 EDT 2010


I fully agree with Emanuel.  I am currently putting together a formal
proposal that will soon be posted to the ITK4 wiki page for review.

Hans
-- 
Hans J. Johnson, Ph.D.
Hans-johnson at uiowa.edu

278 GH
The University of Iowa
Iowa City, IA 52241
(319) 353 8587


> From: Emmanuel Christophe <emmanuel.christophe at gmail.com>
> Date: Mon, 19 Jul 2010 12:55:53 +0800
> To: Bradley Lowekamp <blowekamp at mail.nih.gov>
> Cc: Bill Lorensen <bill.lorensen at gmail.com>, Hans Johnson
> <hans-johnson at uiowa.edu>, ITK <insight-developers at itk.org>
> Subject: Re: [Insight-developers] KWStyle
> 
> Hi all,
> 
> Could ITK v4 be the opportunity to alter slightly ITK style to make it
> easier to configure for standard editors (emacs, vim, eclipse, ...)
> and popular code beautifiers (uncrustify, astyle)?
> 
> If an ITK style configuration file was provided for most editors, the
> style should not be an issue any more. But rules such as indent method
> braces in .h but not in .txx are often too subtle and I'm not
> convinced that they serve any purpose.
> 
> Emmanuel
> 
> 
> 
> On Mon, Jul 19, 2010 at 11:47, Bradley Lowekamp <blowekamp at mail.nih.gov>
> wrote:
>> Bill and Hans,
>> 
>> Emacs has the "inline-open" syntactic symbol (
>> http://www.phys.ufl.edu/docs/emacs/emacs_252.html#SEC258 ). This should be 2
>> ( but its 0 in the faq ). Unfortunately "EXPORT" macro contained in the class
>> declaration it is not applied correctly. I have tried this on simple example
>> such as:
>> 
>> class ITKCommon_EXPORT foo
>> {
>>  inline void bar(void)
>>  {
>>  }
>> }
>> 
>> Emacs is so close to being correct KWStyle!
>> 
>> BTW, I have the flowing in my .emacs file:
>> 
>> ;;;;;;;;;;;;;;
>> (c-add-style "itk"
>>            '("stroustrup"
>>              (c-basic-offset . 2)
>>              (c-offsets-alist
>>               (c . c-lineup-dont-change)
>>               (inher-intro . 2)
>>               (innamespace . 0)
>>               (inline-open . 2)
>>               (substatement-open . +)
>>               (statement-block-intro . 0) ) ) )
>> (add-hook 'c++-mode-hook (function (lambda ()
>> (c-set-style "itk")(turn-on-auto-fill)(setq show-trailing-whitespace t))))
>> (add-to-list 'auto-mode-alist '("\\.txx\\'" . c++-mode))
>> (add-to-list 'auto-mode-alist '("\\.h\\'" . c++-mode))
>> 
>> On Jul 18, 2010, at 10:48 AM, Bill Lorensen wrote:
>> 
>>> Hans,
>>> 
>>> I think in the .h files we use the convention of a two space indent,
>>> while in the txx and cxx files we keep it in the first column.
>>> 
>>> I'm not sure why, but that is what we have been doing and that is what
>>> KWStyle enforces I think. I know that my emacs settings do not work
>>> properly in the .h files and I always have to override them when I
>>> edit a .h file.
>>> 
>>> Bill
>>> 
>>> On Sun, Jul 18, 2010 at 10:39 AM, Hans Johnson <hans-johnson at uiowa.edu>
>>> wrote:
>>>> In reviewing the ITK style guide on page 11, in section 3.7.3, It states
>>>> that the brace should be in the first column of the function.  In the
>>>> example code on page 13, the brace is indented two spaces.
>>>> 
>>>> I can make the code beautifier (or my editor) do either of these, but not
>>>> both.
>>>> 
>>>> I think that functions should be formatted consistently with respect to the
>>>> brace body.
>>>> 
>>>> Regards,
>>>> Hans
>>>> --
>>>> Hans J. Johnson, Ph.D.
>>>> Hans-johnson at uiowa.edu
>>>> 
>>>> 278 GH
>>>> The University of Iowa
>>>> Iowa City, IA 52241
>>>> (319) 353 8587
>>>> 
>>>> 
>>>>> From: Hans Johnson <hans-johnson at uiowa.edu>
>>>>> Date: Sun, 18 Jul 2010 09:14:49 -0500
>>>>> To: ITK <insight-developers at itk.org>
>>>>> Subject: [Insight-developers] KWStyle
>>>>> 
>>>>> 
>>>>> I can't figure out what the KWStyle rules are.
>>>>> 
>>>>> In itkImageToImageFilterDetail.h in one part function braces required to
>>>>> be
>>>>> indented 2, in another location it is required that they are not indented.
>>>>> 
>>>>> How do I figure out which functions are supposed to have indented braces?
>>>>> 
>>>>> Hans
>>>>> 
>>>>> 
>>>>> 
>>>>> --
>>>>> Hans J. Johnson, Ph.D.
>>>>> Hans-johnson at uiowa.edu
>>>>> 
>>>>> 278 GH
>>>>> The University of Iowa
>>>>> Iowa City, IA 52241
>>>>> (319) 353 8587
>>>>> 
>>>>> _______________________________________________
>>>>> Powered by www.kitware.com
>>>>> 
>>>>> Visit other Kitware open-source projects at
>>>>> http://www.kitware.com/opensource/opensource.html
>>>>> 
>>>>> Kitware offers ITK Training Courses, for more information visit:
>>>>> http://kitware.com/products/protraining.html
>>>>> 
>>>>> Please keep messages on-topic and check the ITK FAQ at:
>>>>> http://www.itk.org/Wiki/ITK_FAQ
>>>>> 
>>>>> Follow this link to subscribe/unsubscribe:
>>>>> http://www.itk.org/mailman/listinfo/insight-developers
>>>> 
>>>> _______________________________________________
>>>> Powered by www.kitware.com
>>>> 
>>>> Visit other Kitware open-source projects at
>>>> http://www.kitware.com/opensource/opensource.html
>>>> 
>>>> Kitware offers ITK Training Courses, for more information visit:
>>>> http://kitware.com/products/protraining.html
>>>> 
>>>> Please keep messages on-topic and check the ITK FAQ at:
>>>> http://www.itk.org/Wiki/ITK_FAQ
>>>> 
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://www.itk.org/mailman/listinfo/insight-developers
>>>> 
>>> _______________________________________________
>>> Powered by www.kitware.com
>>> 
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>> 
>>> Kitware offers ITK Training Courses, for more information visit:
>>> http://kitware.com/products/protraining.html
>>> 
>>> Please keep messages on-topic and check the ITK FAQ at:
>>> http://www.itk.org/Wiki/ITK_FAQ
>>> 
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.itk.org/mailman/listinfo/insight-developers
>> 
>> _______________________________________________
>> Powered by www.kitware.com
>> 
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>> 
>> Kitware offers ITK Training Courses, for more information visit:
>> http://kitware.com/products/protraining.html
>> 
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>> 
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-developers
>> 



More information about the Insight-developers mailing list