GreenBox Posted November 23, 2012 Share Posted November 23, 2012 I want to cry every time I see how our code isn't uniform, each file/function uses a different code style. It already was proposed before, but let's reconsider: We should normalize our source with astyle(http://astyle.sourceforge.net/). We just have a problem, it will break all patches. What you guys think about it? And what style we should use, Allman? K&R? Link to comment Share on other sites More sharing options...
EvilPuncker Posted November 23, 2012 Share Posted November 23, 2012 I want to cry every time I see you guys using spaces everywhere to indent while like 98% of source use tab 1 Link to comment Share on other sites More sharing options...
GM Takumirai Posted November 23, 2012 Share Posted November 23, 2012 hope this will be fix.. +1 Link to comment Share on other sites More sharing options...
Lighta Posted November 23, 2012 Share Posted November 23, 2012 I'm in favor of AStyle too, but when I tryed some function was getting quite long. The better IDE I had to do this was codeblock, "format projet" using IDE, you'll see what I was talking about. Link to comment Share on other sites More sharing options...
lekkereten Posted November 23, 2012 Share Posted November 23, 2012 I use Allman but I think K&R is more beautiful. Link to comment Share on other sites More sharing options...
Brian Posted November 23, 2012 Share Posted November 23, 2012 I vote for these Astyle options for trunk/src/: # Brackets are broken from namespaces, classes, and function definitions. # Brackets are attached to statements within a function. --style=kr # Indent using tabs. Convert 4 spaces to 1 tab. --indent=tab=4 # Indent 'class' and 'struct' blocks --indent-classes # Indent multi-line preprocessor definitions ending with a backslash. --indent-preprocessor # Indent comments beginning in column one. --indent-col1-comments # When a header is built of multiple lines, the lines will be aligned with the paren on the preceding line. --min-conditional-indent=0 # Insert space padding after paren headers only (e.g. 'if', 'for', 'while'...). --pad-header # Remove extra space padding around parenthesis on the inside and outside. --unpad-paren # Don't break complex statements and multiple statements residing on a single line. --keep-one-line-statements ######################################################### # Which --align-pointer and --align-reference options? ######################################################### # Do not retain a backup of the original file. (your working copy has SVN History) --suffix=none # For each directory in the command line, process all subdirectories recursively. --recursive Also, some previous discussion: (rough draft) Scripting & Coding Style Guidelines and User:Gepard/Sandbox. 1 Link to comment Share on other sites More sharing options...
lekkereten Posted November 23, 2012 Share Posted November 23, 2012 My parameter list: --style=kr --align-pointer=name --align-reference=name --mode=c --lineend=linux --convert-tabs --keep-one-line-statements --min-conditional-indent=0 --pad-header --unpad-paren --indent-col1-comments --indent-preprocessor --indent-labels --indent-cases --indent-switches --indent=spaces=4 --suffix=none --max-instatement-indent=80 --recursive @edit It is reducing the file size better thant I thought it would. Also, a diff for atcommand.c so you can see how it would look like: atcommand.c.patch went from 283kb to 275kb @edit2 I uploaded the files already on astyle to a github repo so you can see for yourselves. https://github.com/mkbu95/rathena_src_astyle Link to comment Share on other sites More sharing options...
Cookie Posted November 25, 2012 Share Posted November 25, 2012 Approved the K&R style patch based on votes, and discussion. GreenBox will soon reply with his commit he is making for it. Thank you! -Cookie Link to comment Share on other sites More sharing options...
GreenBox Posted November 25, 2012 Author Share Posted November 25, 2012 Implemented in r16968. Link to comment Share on other sites More sharing options...
Brian Posted November 28, 2012 Share Posted November 28, 2012 @GreenBox: was the conversion of indents from tabs to spaces intentional? I want to cry every time I see you guys using spaces everywhere to indent while like 98% of source use tab I also voted for tab indents # Indent using tabs. Convert 4 spaces to 1 tab. --indent=tab=4 1 Link to comment Share on other sites More sharing options...