Robot-Will/Stino — pull request #151 by DimonSE (2014-05-18 17:59:08+00:00)
Title: Fix some bugs in preprocess

Hello! I work with this project http://code.google.com/p/ardupilot

It's a Arduino based autopilot, and I have trouble with Verify/Compile for this project only in Stino.

I start investigation and find some bugs.

First, some .pde files in ArduPilot without line-ending in end of file. And such files incorrect concatenate with next file. I add '\n' for this in 197 line.

Secondary, is more hard.

General problem to create correct main .cpp file is that sometimes function don't add to function_list by genFunctionList(src_text)

It's happens because function removeCertainTypeText(src_text, 'multi-comment') in 66 line remove to many lines of code for this example:

1. //****************************************************************
2. // Function that will calculate the desired direction to fly and altitude error
3. //****************************************************************
4. void navigate()
5. {
6. // do not navigate with corrupt data
7. // ---------------------------------
8. /*if (GPS_fix == FAILED_GPS){
9. if(control_mode != CIRCLE){
10. nav_roll = 300; // Set up a gentle bank
11. nav_pitch = 0;
12. }
13. return;
14. }*/
15.
16. // We only perform most nav computations if we have new gps data to work with
17. // --------------------------------------------------------------------------
18. if(GPS_new_data){
19.
20. ///// some code
21.
22. }
23. }

So, you can see that we have '//*************' on first line, and '}*/' in line 14

All of them can removed! Including 'void navigate()' and this function don't include to function list. In another places, I have similar problems.

So, if you first remove all single-comment by removeCertainTypeText(src_text, 'single-comment') and after them remove by removeCertainTypeText(src_text, 'multi-comment') all been fine.

I swap line 65 and 66 for correct removing comments and after them all problems disappear.

I think in 95 and 96 lines we can get something trouble but in 106/107 lines all correct already.

P.S: I am new in git_hub and this is my first pull-request :). Sorry for my bad english, it's not my native language