Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some bugs in preprocess #151

Merged
merged 1 commit into from
Dec 11, 2015
Merged

Conversation

DimonSE
Copy link
Contributor

@DimonSE DimonSE commented May 18, 2014

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 }
  10. return;
  11. }*/
  12. // We only perform most nav computations if we have new gps data to work with
  13. // --------------------------------------------------------------------------
  14. if(GPS_new_data){
  15. ///// some code
    21.
  16. }
  17. }

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

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
Robot-Will added a commit that referenced this pull request Dec 11, 2015
Fix some bugs in preprocess
@Robot-Will Robot-Will merged commit 56ff515 into Robot-Will:master Dec 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants