Code tidying (indentation)
Moderators: jsmcortina, muythaibxr
-
- Super MS/Extra'er
- Posts: 1021
- Joined: Sun Jun 27, 2004 12:04 pm
- Location: Long Beach, CA - USA
Code tidying (indentation)
Hey Ken or James,
I'm not really sure if this is of interest to you, but I was just going through ms2_extra_ego.c and I noticed that a lot of the indentation was inconsistent.
If you'd like, I can clean up the formatting (indentation, mostly) for files as I go through them. Like, today I was cleaning up the ego file so I could understand what was going on.
Not really a big deal for me and thought it might be a little help for you guys. Just curious if you're interested.
Thanks,
Mike
I'm not really sure if this is of interest to you, but I was just going through ms2_extra_ego.c and I noticed that a lot of the indentation was inconsistent.
If you'd like, I can clean up the formatting (indentation, mostly) for files as I go through them. Like, today I was cleaning up the ego file so I could understand what was going on.
Not really a big deal for me and thought it might be a little help for you guys. Just curious if you're interested.
Thanks,
Mike
-
- Site Admin
- Posts: 8228
- Joined: Thu Oct 14, 2004 12:48 pm
-
- MS/Extra Guru
- Posts: 1210
- Joined: Fri May 07, 2004 6:55 pm
- Location: Rochester, NY, U.S.A.
- Contact:
For those who don't know, with vi/vim/gvim, if you hit "escape" (to get to command or "beep mode"), and then hit % on an opening or closing bracket and it'll indent to the closing bracket. Hence best to do that right at the beginning or end of a function.. there's prolly some hidden macro that'll auto-indentthe whole file, but I haven't figured that one out yet.muythaibxr wrote:I go through with gvim and clean up indents at the end of the release cycle, right before official release...
I just haven't done it yet for 2.0.
Thanks for the offer though.
Ken
using
Code: Select all
": set ts=4"
David J. Andruczyk
MegaTunix author. The only non-java cross platform tuning software for MS-I/II hardware.
Where to get and how to install:
http://msextra.com/viewtopic.php?t=23080
http://sourceforge.net/projects/megatunix
MegaTunix author. The only non-java cross platform tuning software for MS-I/II hardware.
Where to get and how to install:
http://msextra.com/viewtopic.php?t=23080
http://sourceforge.net/projects/megatunix
-
- Experienced MS/Extra'er
- Posts: 307
- Joined: Mon Oct 22, 2007 7:15 am
- Location: Auckland, New Zealand
its been 6 months since i wrote any code, and longer since i wrote any in vi, but i used to use this at the top of each file :djandruczyk wrote:there's prolly some hidden macro that'll auto-indentthe whole file, but I haven't figured that one out yet.
usingif you like your tabstops at 4 chars vs 6 or 8.Code: Select all
": set ts=4"
/* vim:set et:set sw=4:set ts=8:set sts=4 VIM indentation information. */
which sets it for that file. right now i cant remember what it all means, but the basicly between involved devs, you agree on how it is to be stored in the file
say 4 spaces for a single tab
then each of you sets your editor to display that at the distance that you desire. that way the code stays consistent and each dev has it looking how he/she likes it on their screen.
i realise i'm preaching to the choir but since we are spreading the word about vim indentation :-)
-
- Site Admin
- Posts: 8228
- Joined: Thu Oct 14, 2004 12:48 pm
yeah, I have a bunch of settings configured to indent with gvim when I code, but I'm not the only one coding!
EDIT: (That wasn't directed at any one person by the way, the file in question is still mostly in the same condition it was when we imported it from the standard firmware though. Al follows a consistent format, but somewhat non-standard for people who are used to coding elsewhere)
Ken
EDIT: (That wasn't directed at any one person by the way, the file in question is still mostly in the same condition it was when we imported it from the standard firmware though. Al follows a consistent format, but somewhat non-standard for people who are used to coding elsewhere)
Ken
-
- Site Admin
- Posts: 39587
- Joined: Mon May 03, 2004 1:34 am
- Location: Birmingham, UK
- Contact:
Yep. It took me months to get to grips with it.Xtatic wrote:hmm, i found indentation the least troublesome part when i dove into the code. (i.e the code is pretty noob-unfriendly ;) i found i needed quite a bit of dedication to get somewhat comfortable understanding it. It can be pretty frustrating at first. )
James
I can repair or upgrade Megasquirts in UK. http://www.jamesmurrayengineering.co.uk
My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".
My Success story: http://www.msextra.com/forums/viewtopic ... 04&t=34277
MSEXTRA documentation at: http://www.msextra.com/doc/index.html
New users, please read the "Forum Help Page".