Shop OBEX P1 Docs P2 Docs Learn Events
Finding Functions and Summary View — Parallax Forums

Finding Functions and Summary View

Duane DegnDuane Degn Posts: 10,588
edited 2014-09-09 15:15 in Learn with BlocklyProp
Now that I have all the parts to convert a BOE-Bot into an ActivityBot, I've been working through the Propeller C Tutorials. As I've come to expect from Parallax, the tutorials are great and a very pleasant way of learning a new topic.

I have run into a couple of frustrations. One is the difficulty in finding a function called by an example program and the other frustration is the lack of a way of easily "summarize" a program.

Here's an example of my first frustration, finding a function called by a program.

Below is the example program "Forward Stop Face Right.side".
/*  Forward Stop Face Right.c


  http://learn.parallax.com/activitybot
*/


#include "simpletools.h"
#include "abdrive.h"


int main()                    
{
  drive_goto(256, 256);
  pause(200);
  drive_goto(26, -25);
}

I'd like to know how the method function "drive_goto" works. I assume the function is part of "abdrive.h" but is there a way to know which included file holds the function?

Once I know which file holds the function I wish to view, is there an easy way to find this function?

So far I've found I need to find the project which includes "abdrive.h" which I believe is part of "libabdrive.side". I found "libabdrive.side" in the SimpleIDE\Learn\Simple Libraries\Robotics\ActicityBot\libabdrive\ folder. Once I open "libabdrive.side", I can then "Open Tab to Project" and and find "abdrive.c" and "abdrive.h".

In "abdrive.h" I find the function prototype "drive_goto" on line 337 but I don't find "drive_goto" in "abdrive.c"?

I was able to find "drive_goto" in "goto.c". Was there some way I should have known to look in "goto.c" for the function "drive_goto"?

Is there an easier way of finding functions called from example programs?

On to my second frustration. With the Propeller Tool, if I select the "Summary" option the code will be compressed to a list of methods. Is there a similar way of listing the functions within a C program? I haven't been able to find a way to compressing the displayed program.

I have these same frustrations when using the Arduino IDE so using C on the Propeller isn't any more frustrating than using C on an Arduino but I sure have gotten used to being able to find methods quickly in Spin with the Propeller Tool and to easily get an overview of my program using the Summary feature and I don't like having to get by without these convinces.

Comments

  • SRLMSRLM Posts: 5,045
    edited 2014-09-09 12:21
    These two problems sound like editor problems. IDEs typically let you CTRL+click a function name and it will open the definition. The second problem is solved with collapsible blocks: little + or - icons in the left hand gutter that allows you to toggle sections between the curly braces.

    There's tutorials for setting up Netbeans or Code::Blocks with PropGCC here..

    Probably not the answer that you want, but I suspect that the answer for SimpleIDE is "not possible."
  • Duane DegnDuane Degn Posts: 10,588
    edited 2014-09-09 12:54
    SRLM wrote: »
    There's tutorials for setting up Netbeans or Code::Blocks with PropGCC here..

    I hadn't seen that page before. Thank you.
  • jazzedjazzed Posts: 11,803
    edited 2014-09-09 13:18
    Library function "summaries" are in the Simple Libraries help .html file. There is also "mouseover + F1" context help available in the latest package. Release 1.0 coming soon.

    SimpleIDE allows Control+Click browsing for functions within a project, but libraries are not browsable from your own project (typically true of system libraries on any IDE). All Simple Libraries offer a file (such as libsimpletext.c in the simpletext library project) where functions can be added, tested, and browsed, etc....

    Having SimpleIDE browse functions in the Simple Libraries has never been a high enough priority to add in the program. One could say the same for context help, but it's there anyway because I had time to add it.
  • dgatelydgately Posts: 1,630
    edited 2014-09-09 13:33
    Duane Degn wrote: »
    I have run into a couple of frustrations. One is the difficulty in finding a function called by an example program and the other frustration is the lack of a way of easily "summarize" a program.

    Do you really want to see the function's code or just a description of what it does and what inputs it needs? If the later, you can always use SimpleIDE's Help menu item, "Simple Library Reference". I keep it up in a browser in the background and just switch to it and search through the header file links (of course, you need to have an idea which header to look for :-)... It's not "auto-magical" but works.


    Both of these features sound like enhancement requests. You can create issues as feature requests at: https://code.google.com/p/propside/issues/list, then just reference the issue's link in a forum post. It's a great way for the requests to be published and tracked! And, it keeps the issue in a public place, sorted by date and available to SimpleIDE's developers (Now, who was that musically-named forum poster, that would take an interest in the issue list?, Hmm...)... Jazzed beat me to the punch!


    dgately
  • dgatelydgately Posts: 1,630
    edited 2014-09-09 13:40
    jazzed wrote: »
    ...but libraries are not browsable from your own project ... typically true of system libraries on any IDE

    Well, there's XCode and it allows jumping to a library's definition of a selected function, object or VAR...



    dgately
  • Duane DegnDuane Degn Posts: 10,588
    edited 2014-09-09 15:15
    jazzed wrote: »
    Library function "summaries" are in the Simple Libraries help .html file.
    dgately wrote: »
    Do you really want to see the function's code or just a description of what it does and what inputs it needs?

    Thanks guys. I had found the list of functions in the help section. I wanted to see the code and how it was written.

    As I mentioned, I have these same frustrations with other IDEs, I was just wondering if I was missing something obvious.

    I'll try the options Cody mentioned.
Sign In or Register to comment.