View unanswered posts | View active topics It is currently Wed May 24, 2017 8:46 pm



Reply to topic  [ 11 posts ]  Go to page 1, 2  Next
Use Emacs to navigate through FreeEMS source code 
Author Message
LQFP112 - Up with the play
User avatar

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
1.png [ 138.41 KiB | Viewed 3520 times ]


2.Use Emacs compile mode to configure, compile and install package
Attachment:
2.png
2.png [ 147.03 KiB | Viewed 3520 times ]


3.Locate gtags elisp extension file and open it
Attachment:
3.png
3.png [ 117.45 KiB | Viewed 3520 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
Profile
LQFP112 - Up with the play
User avatar

Joined: Wed Apr 13, 2011 2:35 am
Posts: 110
4.Follow the comments to configure your emacs
Attachment:
4.png
4.png [ 95.76 KiB | Viewed 3519 times ]


5.Navigate to FreeEMS source directory and run shell command 'gtags' from Emacs
Attachment:
5.png
5.png [ 139.74 KiB | Viewed 3519 times ]


6.Three file should be generated
Attachment:
6.png
6.png [ 137.35 KiB | Viewed 3519 times ]


Wed Jan 18, 2012 5:18 am
Profile
LQFP112 - Up with the play
User avatar

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
7.png [ 99.43 KiB | Viewed 3519 times ]

Press 'enter' key to locate the function body
Attachment:
8.png
8.png [ 67.61 KiB | Viewed 3519 times ]

here it is
Attachment:
9.png
9.png [ 120.79 KiB | Viewed 3519 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
Profile
LQFP112 - Up with the play
User avatar

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
10.png [ 111.6 KiB | Viewed 3519 times ]

Press 'enter' key to locate whatever definition you prefer to see
Attachment:
11.png
11.png [ 87.74 KiB | Viewed 3519 times ]

See how it was defined for Hyundai
Attachment:
12.png
12.png [ 145.01 KiB | Viewed 3519 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
Profile
LQFP112 - Up with the play
User avatar

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
13.png [ 114.05 KiB | Viewed 3519 times ]

here it is
Attachment:
14.png
14.png [ 132.42 KiB | Viewed 3519 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
Profile
LQFP112 - Up with the play
User avatar

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
15.png [ 117.62 KiB | Viewed 3519 times ]

There maybe a few candidates, press 'enter' key to choose which one you love it
Attachment:
16.png
16.png [ 55.99 KiB | Viewed 3519 times ]

Here it is
Attachment:
17.png
17.png [ 113.84 KiB | Viewed 3519 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
Profile
LQFP112 - Up with the play
User avatar

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
18.png [ 111.38 KiB | Viewed 3519 times ]

you must choose
Attachment:
20.png
20.png [ 56.36 KiB | Viewed 3519 times ]

Here it is
Attachment:
21.png
21.png [ 133.15 KiB | Viewed 3519 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
Profile
LQFP112 - Up with the play
User avatar

Joined: Wed Apr 13, 2011 2:35 am
Posts: 110
End of this topic, thanks for watching :lol:


Wed Jan 18, 2012 5:43 am
Profile
LQFP112 - Up with the play

Joined: Sat Apr 24, 2010 1:42 am
Posts: 119
Location: New Zealand
Image


Wed Jan 18, 2012 9:25 am
Profile
Moderator
User avatar

Joined: Tue Jan 15, 2008 2:31 pm
Posts: 14597
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
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 11 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software for PTF. ColorizeIt.