[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: Indent?



Gavin Henry writes:
> Do any of you use indent or similar for cleaning up OpenLDAP code and
> have a ~/.my_rules to share?

I don't know how to make indent output OpenLDAP's spacing around parens.
And I'm not sure what the rules are anyway.  Space inside but not
outside parens in function calls, (usually) no space between multiple
parens, space after if/while/for, don't know what else.

Since I also don't know how to make indent leave those spaces alone, I'm
not sure if this will be of any use to you, but I think this should come
close for the rest:

-ts4  (--tab-size4)
    And if I find whoever thought a nonstandard tab-size was a good way
    to reduce source file size or whatever the idea was, I'll chain him
    to a terminal with tab-size 11 till he learns the error of his ways.
-i4   (--indent-level4)
-ci4  (--continuation-indentation4)
-cli0 (--case-indentation0)
-nlp  (--dont-line-up-parentheses)
-lps  (--leave-preprocessor-space) or sometimes -ppi1
-bad  (--blank-lines-after-declarations)
-bap  (--blank-lines-after-procedures)
-bbb  (--blank-lines-before-block-comments)
-sc   (--start-left-side-of-comments)
-br   (--braces-on-if-line)
-ce   (--cuddle-else)
-cdw  (--cuddle-do-while)
-cbi0 (--case-brace-indentation0)
-npcs (--no-space-after-function-call-names)
-nbc  (--no-blank-lines-after-commas)
-psl  (--procnames-start-lines)
-brs  (--braces-on-struct-decl-line)

# this is done sometimes, sometimes not:
-bfda (--break-function-decl-args)
-nss  (--dont-space-special-semicolon)
-cs   (--space-after-cast) or -ncs (--no-space-after-cast)?
-nbbo (--break-after-boolean-operator)

# leave some things alone when indenting a reasonably formatted file...
-hnl  (--honour-newlines)
-nsob (--leave-optional-blank-lines)

# indent needs to know type names
-T FILE -T fpos_t -T ptrdiff_t -T size_t -T time_t -T va_list
-T ber_int_t -T ber_sint_t -T ber_uint_t -T ber_len_t -T ber_slen_t
-T ber_socket_t -T ber_tag_t
-T BerElement -T BerValue -T BerVarray
-T LDAP -T LDAPAVA -T LDAPControl -T LDAPDN -T LDAPMessage
-T LDAPMod -T LDAPRDN -T LDAPURLDesc
...

-- 
Regards,
Hallvard