Hello everybody,
I finally spent some hours today to go through all configuration options of GNU indent and experiment on our Gnutella Packet.h and Packet.cpp. The closest I could ever get was with this:
$ indent Packet.h -o Packet.o.h -bad -bap -br -ce -cdw -cli0 -cbi4 -ss -pcs -cs -bs -saf -sai -saw -nprs -bls -fc1 -i4 -lp -ts4 -di24 -l80 -sbi0 -sob -ut -c0 -cd0 -cp0 -nfca
The result is not really satisfying. indent even breaks the code at some places. For example the definitions of const member functions get a second const and that’s wrong. I also have trouble indenting variable declarations because function definitions are affected as well and some other statements where that’s not desired. There is a lack of options for C++ syntax. For example, no option to say where you want the opening bracket of a namespace and whether you want indentation of its block, no control for indentation of public:, protected: and private:, etc. It is actually said in the documentation that there might be problems with C++ code.
It’s not all bad though. Braking long argument lists and conditionals is great! Whitespaces around keywords, function names, parentheses are done fine. Maybe I should try out whether it is possible to use only the features that “work” on the source of Calitko and have the rest done by some other tool or by hand. That will be better than having nothing at all!
I’m open to any suggestions!
Regards,
Peter
