GreenBox Posted November 23, 2012 Group: Members Topic Count: 9 Topics Per Day: 0.00 Content Count: 303 Reputation: 101 Joined: 11/13/11 Last Seen: October 11, 2023 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 Group: Members Topic Count: 19 Topics Per Day: 0.00 Content Count: 713 Reputation: 71 Joined: 11/08/11 Last Seen: December 25, 2024 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 Group: Members Topic Count: 69 Topics Per Day: 0.01 Content Count: 592 Reputation: 31 Joined: 11/14/11 Last Seen: July 29, 2015 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 Group: Members Topic Count: 16 Topics Per Day: 0.00 Content Count: 737 Reputation: 216 Joined: 11/29/11 Last Seen: December 20, 2020 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 Group: Members Topic Count: 8 Topics Per Day: 0.00 Content Count: 148 Reputation: 46 Joined: 11/02/11 Last Seen: November 25, 2024 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 Group: Members Topic Count: 75 Topics Per Day: 0.02 Content Count: 2223 Reputation: 593 Joined: 10/26/11 Last Seen: June 2, 2018 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 Group: Members Topic Count: 8 Topics Per Day: 0.00 Content Count: 148 Reputation: 46 Joined: 11/02/11 Last Seen: November 25, 2024 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 Group: Members Topic Count: 20 Topics Per Day: 0.00 Content Count: 213 Reputation: 109 Joined: 05/21/12 Last Seen: December 27, 2014 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 Group: Members Topic Count: 9 Topics Per Day: 0.00 Content Count: 303 Reputation: 101 Joined: 11/13/11 Last Seen: October 11, 2023 Author Share Posted November 25, 2012 Implemented in r16968. Link to comment Share on other sites More sharing options...
Brian Posted November 28, 2012 Group: Members Topic Count: 75 Topics Per Day: 0.02 Content Count: 2223 Reputation: 593 Joined: 10/26/11 Last Seen: June 2, 2018 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...
Recommended Posts