Author |
Message |
HotCat
LQFP112 - Up with the play
Joined: Wed Apr 13, 2011 2:35 am Posts: 110
|
Emacs is my favorite editor, I started to use it since 2003 after graduating from high school, I can't image working on Unix-like environment without it, just like driving a car without steering wheel. Emacs is so Powerful, so flexible and so complex, I can't thoroughly explain how to use it. Instead I only focus on how to navigate through FreeEMS source code 1.First download GNU gtags package Attachment:
1.png [ 138.41 KiB | Viewed 12126 times ]
2.Use Emacs compile mode to configure, compile and install package Attachment:
2.png [ 147.03 KiB | Viewed 12126 times ]
3.Locate gtags elisp extension file and open it Attachment:
3.png [ 117.45 KiB | Viewed 12126 times ]
Last edited by HotCat on Wed Jan 18, 2012 6:39 am, edited 1 time in total.
|
Wed Jan 18, 2012 5:16 am |
|
 |
HotCat
LQFP112 - Up with the play
Joined: Wed Apr 13, 2011 2:35 am Posts: 110
|
4.Follow the comments to configure your emacs Attachment:
4.png [ 95.76 KiB | Viewed 12125 times ]
5.Navigate to FreeEMS source directory and run shell command 'gtags' from Emacs Attachment:
5.png [ 139.74 KiB | Viewed 12125 times ]
6.Three file should be generated Attachment:
6.png [ 137.35 KiB | Viewed 12125 times ]
|
Wed Jan 18, 2012 5:18 am |
|
 |
HotCat
LQFP112 - Up with the play
Joined: Wed Apr 13, 2011 2:35 am Posts: 110
|
7.Explore what gtags can do with our source code, use 'gtags-parse-file' command to list C functions in a C source file and locate the function body Attachment:
7.png [ 99.43 KiB | Viewed 12125 times ]
Press 'enter' key to locate the function body Attachment:
8.png [ 67.61 KiB | Viewed 12125 times ]
here it is Attachment:
9.png [ 120.79 KiB | Viewed 12125 times ]
Last edited by HotCat on Wed Jan 18, 2012 6:23 am, edited 3 times in total.
|
Wed Jan 18, 2012 5:24 am |
|
 |
HotCat
LQFP112 - Up with the play
Joined: Wed Apr 13, 2011 2:35 am Posts: 110
|
8.Find the macro definition of 'cliConfiguredOffset' using 'gtags-find-tag' command Place cursor around the 'cliConfiguredOffset' variable and issue 'gtags-find-tag' command Attachment:
10.png [ 111.6 KiB | Viewed 12125 times ]
Press 'enter' key to locate whatever definition you prefer to see Attachment:
11.png [ 87.74 KiB | Viewed 12125 times ]
See how it was defined for Hyundai Attachment:
12.png [ 145.01 KiB | Viewed 12125 times ]
Last edited by HotCat on Wed Jan 18, 2012 6:36 am, edited 5 times in total.
|
Wed Jan 18, 2012 5:30 am |
|
 |
HotCat
LQFP112 - Up with the play
Joined: Wed Apr 13, 2011 2:35 am Posts: 110
|
9.Find the definition of 'calculateFuelAndIgnition' using 'gtags-find-tag' command Place cursor around the 'calculateFuelAndIgnition' function and issue 'gtags-find-tag' command Attachment:
13.png [ 114.05 KiB | Viewed 12125 times ]
here it is Attachment:
14.png [ 132.42 KiB | Viewed 12125 times ]
Last edited by HotCat on Wed Jan 18, 2012 6:31 am, edited 1 time in total.
|
Wed Jan 18, 2012 5:35 am |
|
 |
HotCat
LQFP112 - Up with the play
Joined: Wed Apr 13, 2011 2:35 am Posts: 110
|
10.Find how the function was referenced using 'gtags-find-rtag' command Place cursor around the 'generateDerivedVars' function and issue 'gtags-find-rtag' command Attachment:
15.png [ 117.62 KiB | Viewed 12125 times ]
There maybe a few candidates, press 'enter' key to choose which one you love it Attachment:
16.png [ 55.99 KiB | Viewed 12125 times ]
Here it is Attachment:
17.png [ 113.84 KiB | Viewed 12125 times ]
Last edited by HotCat on Wed Jan 18, 2012 6:35 am, edited 4 times in total.
|
Wed Jan 18, 2012 5:39 am |
|
 |
HotCat
LQFP112 - Up with the play
Joined: Wed Apr 13, 2011 2:35 am Posts: 110
|
11.Sometimes you have to use 'gtags-find-symbol' command to locate some macro definition When 'gtags-find-tag' command does not work, try this one Attachment:
18.png [ 111.38 KiB | Viewed 12125 times ]
you must choose Attachment:
20.png [ 56.36 KiB | Viewed 12125 times ]
Here it is Attachment:
21.png [ 133.15 KiB | Viewed 12125 times ]
Last edited by HotCat on Wed Jan 18, 2012 6:58 am, edited 2 times in total.
|
Wed Jan 18, 2012 5:42 am |
|
 |
HotCat
LQFP112 - Up with the play
Joined: Wed Apr 13, 2011 2:35 am Posts: 110
|
End of this topic, thanks for watching 
|
Wed Jan 18, 2012 5:43 am |
|
 |
johntramp
LQFP112 - Up with the play
Joined: Sat Apr 24, 2010 1:42 am Posts: 119 Location: New Zealand
|
|
Wed Jan 18, 2012 9:25 am |
|
 |
Fred
Moderator
Joined: Tue Jan 15, 2008 2:31 pm Posts: 15376 Location: Home sweet home!
|
HotCat, cool article, this is the most inspired I've EVER been to use emacs! (More than when my best friend tried to convince me) Still not enough to actually do it, though :-)
If you want to edit it freely in future I can leave it here, or I can promote it to article status in the article section. If I do that, though, you have to ask me to get it edited.
LOL @ johntramp :-)
Fred.
_________________DIYEFI.org - where Open Source means Open Source, and Free means Freedom FreeEMS.org - the open source engine management system FreeEMS dev diary and its comments thread and my turbo truck!n00bs, do NOT PM or email tech questions! Use the forum! The ever growing list of FreeEMS success stories!
|
Wed Jan 18, 2012 11:31 am |
|
|