Code explorer and preprocessor defines

Discuss the Integrated Development Environment (IDE)

Moderators: David Barker, Jerry Messina

User avatar
octal
Registered User
Registered User
Posts: 586
Joined: Thu Jan 11, 2007 12:49 pm
Location: Paris IDF
Contact:

Code explorer and preprocessor defines

Post by octal » Fri Apr 20, 2007 7:58 am

Hi David,
1- Actually the code explorer shows the list of procedures and functions in the left panel as a tree.
I noticed that when I use some defines (#ifdef ... #endif), if a bloc is removed by the preprocessor then it will also not show in the tree. I think that this is somewhat a wrong (ennoying) behaviour, because the code explorer is a tool to navigate in sources and had nothing to do with the real program flow.

I'm using some defines to separate debug code from production release, and it"s ennoying because, the way the ide work today, I do not have access to my debug routines in left panel.
I do not see the usefulness of hiding routines because of defines. May be it can be added as an option, but by default we should have ALL procedures shown.

2- I'm an old dos code hacker, and I use Ctrl+Ins and Shift+Ins to copy/paste code instead of Windows shortcuts, and what's ennoying is that every time I use Ctrl+Ins the editor switches to OverWrite mode. It acts like if I had pressed Ins alone :( Can this be corrected please to act like most editors under windows?

Best regards
Octal

User avatar
David Barker
Swordfish Developer
Posts: 1214
Joined: Tue Oct 03, 2006 7:01 pm
Location: Saltburn by the Sea, UK
Contact:

Post by David Barker » Fri Apr 20, 2007 2:06 pm

> I think that this is somewhat a wrong (ennoying) behaviour, because
> the code explorer is a tool to navigate in sources and had nothing to
> do with the real program flow.

The explorer window will display all declarations and calls that would be available if the project was compiled. Try this

Code: Select all

clock = 40
include "usart.bas"
const Baudrate = br19200
Expand the explorer 'constant' node so you can see the value of 'Baudrate'. Now change the 'clock' value. You see the value updating in real time. I find this type of thing extremely useful, as some code can be removed depending on current directive settings. I designed the explorer to work this way...

> ...corrected please to act like most editors under windows?

Swordfish allows

Cut = Ctrl+X
Copy = Ctrl+C
Paste = Ctrl+V

which is a standard used by many windows editors. Delphi, VB, Notepad and MS Word are just some examples.

User avatar
octal
Registered User
Registered User
Posts: 586
Joined: Thu Jan 11, 2007 12:49 pm
Location: Paris IDF
Contact:

Post by octal » Fri Apr 20, 2007 2:26 pm

David Barker wrote:I find this type of thing extremely useful, as some code can be removed depending on current directive settings. I designed the explorer to work this way...
may be if we can have an option to disable this kind of filtering it will be better. I prefer to SEE ALL my procedures instead of only those that will be really included in the final hex. As it's done it make me use a lot "find text" dialog witch is not so usefull. The way it's done make Code Explorer lose a lot of his functionality witch is primarily EXPLORING and NAVIGATING in code, not to reflect visually what will be in final program. This also make exploring libraries fastidious because we must scroll all the code to see procedures that may be hidden by code explorer tree because of some default values.
This my personal point of view, perhaps a POLL on the forum can give us the opinion of other developers.
David Barker wrote:which is a standard used by many windows editors. D

This is not so important. I'll try to use Ctrl+C/Ctrl+V.
What I means by 'correcting' that is to make it working for either OLD DOS shortcuts of new windows standard, this is the way Notepad, Delphi or Word work. All of them support old dos shortcuts for Copy/Paste/Cut.

Regards

TimB
Posts: 262
Joined: Wed Oct 04, 2006 7:25 am
Location: London UK

Post by TimB » Fri Apr 20, 2007 3:46 pm

Johnb has written a very very nice Module explorer, it will let you explore all the subs functions etc in all modules

Currently its a stand alone feature as while it can hook into the SF IDE, the IDE hooks are still in flux.

I hope John will release it as is before Dave get's round to letting him hock it into the IDE

johngb
Registered User
Registered User
Posts: 139
Joined: Tue Oct 03, 2006 10:16 pm

Post by johngb » Fri Apr 20, 2007 7:47 pm

H'mmm that was a bit premature - however, I am working on it, I hope it will be available within a week or so.

Just trying to ensure I can catch all the subdirectories and populate the tree correctly. Also adding in SF style ICONs for each tree node.

Also, as Tim said, until the IDE API is fixed I will, on Dave's advice, hold fire on integrating it with the IDE. Eventually I would like to be able to allow you to chose a library from the explorer and add it to your project and also to allow you to paste a function or sub call into you code from the explorer.
JohnB

User avatar
octal
Registered User
Registered User
Posts: 586
Joined: Thu Jan 11, 2007 12:49 pm
Location: Paris IDF
Contact:

Post by octal » Wed Apr 25, 2007 12:43 pm

Hi David,
Again with procedures/functions navigation. I think that the way it's done can be conserved, and to give users access to all functions we can have a tool like GExperts Procedures Lister under Delphi. For people who do not know it, GExperts navigation works like that:

Image

in any source window, you type Ctrl+G and you have a popup window that shows the list of ALL procedures and functions. and on top of this list you have a text box. to reach any proc or function you have just to type some text that is part of the name of proc or function. During typing, the list box is automatically filtered to show only functions that include the typed text as part of its name.
For example if the list contains

Function myInitialisation()
Function SetTimerRoutine()
Function TimerStart()
Function SetTimerInterval()

the typing "timer" keeps only the three functions that contains timer in the name.
and by pressing UP/DOWN arrow keys we can select anyone of the routines in the list (without lefting the textbox). Pressing Enter jumps to the concerned function in the editor.
So to navigate you have just to type:
Ctrl+G
Type a part of the name of the function/sub
once the list contains one or little number of function use UP/Down arrows to select
Press Enter.

I use this plugin in Delphi and I must admit that it let me avoid using mouse to select any procedure from delphi code explorer treeview... and it also let me avoid using continuously "Find..." dialog box. And since I do not like mouse when coding ... this feature is great ....

We of course do need only the navigation function and not all functionnalities of gexperts...
What do you think ?

GExperts screenshot and link (go to Procedure List in left menu):
http://gexperts.org/tour/procedure_list.html

here is the description as given by the site :
Image
To search for a procedure, start typing in the Search edit box. As you type, the characters will appear at the top next to the word Search. To jump to a selected procedure, double click or highlight it and press enter.

Two search modes are provided. In the first search mode (match only from the start), searches are conducted only on the beginning of the procedure name (after an optional object reference). In the second search mode (match anywhere), the search string can match at any point in the procedure name. For example, if you had two functions, TMyObject.Assign and TMyObject.AssignWidget, searching for "assign" would return both methods in either mode, whereas searching for widget would return neither when searching from the start, while TMyObject.AssignWidget would appear if searching for a match at any point.

Using the Objects combobox on the right, you can filter the procedure list to display all procedures, only those without an associated object, or only those associated with a specific object. The Copy button will copy all of the visible procedure details to the clipboard.

Using the options button, you can configure several items:

· Optionally show the selected procedure's source code in a pane inside the procedure list
· Determine whether the search filter matches within class names as well as procedure names
· Configure the fonts used for display
· Select whether or not the class name of any methods are displayed
GExperts
Best regards
Octal

johngb
Registered User
Registered User
Posts: 139
Joined: Tue Oct 03, 2006 10:16 pm

Post by johngb » Wed Apr 25, 2007 1:29 pm

My Library Browser will look more like the Code Explorer in Swordfish it does not follow the principles of GExpert but you can select an item and copy its syntax to the clipboard.

Just trying to speed it up at the moment but hope to publish it shortly. Would publish a preview but cannot see how its possible to publish images on this forum - Octal must have more clout than me
[/img]
JohnB

User avatar
octal
Registered User
Registered User
Posts: 586
Joined: Thu Jan 11, 2007 12:49 pm
Location: Paris IDF
Contact:

Post by octal » Wed Apr 25, 2007 1:41 pm

I think that David can add this stuff "easily" (if he has time :wink: ) because the actual IDE already do most of the parsing work, so instead of having the procedures listed at left we can just have them in a popup window list and the filtering is not so difficult to do !!!!
the problem is
1- "are people interrested" in such tool or no
2- can this be done quickly ?
3- this MUST be INTEGRATED in the IDE (as plugin or as part of the ide). it must not be an external tool. It's useful for navigation during coding.

Best regard

PS. to Johngb, to publish an image in the forum just upload it anywhere and put the url between [Img ] and [/Img ] tags (I added a space befor each closing square bracket to let the forum show them ;) ) It should look like this ... (and the image must be less than 35Ko on size I think ... so Png is very well format.

[Img ] h**p://ww . myurl . com /myimage.png [/Img ]

johngb
Registered User
Registered User
Posts: 139
Joined: Tue Oct 03, 2006 10:16 pm

Post by johngb » Wed Apr 25, 2007 1:49 pm

I don't disagree with you Octal but David has other things on his plate. When I was beta testing I did try and persuade him to add a Library Explorer but there was too much time pressure on releasing the product.
JohnB

User avatar
David Barker
Swordfish Developer
Posts: 1214
Joined: Tue Oct 03, 2006 7:01 pm
Location: Saltburn by the Sea, UK
Contact:

Post by David Barker » Wed Apr 25, 2007 2:05 pm

John is right, I am rather busy at the moment. I've just taken a look a Johns library explorer - it's looking very interesting.

I have to say the library explorer probably has more potential for what octal wants to do - its parsed in such a way to include every sub and function, even if it is overidden, private or public (and I believe directives are ignored). So the work has been done already.

I know the plugin is written in Delphi, so you could easily tag a line number to the TreeNodes 'Data' pointer (you usually store other objects here) but for a simple integer

Code: Select all

Node.Data := pointer(LineNumber);  set...
LineNumber := integer(Node.Data); get...
If john is up for it, I'll help him out - but if he is also busy, then it will have to go on the back burner...

User avatar
octal
Registered User
Registered User
Posts: 586
Joined: Thu Jan 11, 2007 12:49 pm
Location: Paris IDF
Contact:

Post by octal » Wed Apr 25, 2007 2:15 pm

It looks very interesting ...

Just to add that if the explorer shows a tree it will not be as usefull (during coding) as the GExperts plugin, because it will force us to use mouse (navigating in a tree using keyboard is not as easy). The GExperts Filter+ListBox+EditBox is a better choice.

Best regards.
PS. If you need help in Delphi programming, let me know ;)

User avatar
David Barker
Swordfish Developer
Posts: 1214
Joined: Tue Oct 03, 2006 7:01 pm
Location: Saltburn by the Sea, UK
Contact:

Post by David Barker » Wed Apr 25, 2007 2:21 pm

Why not give it a go yourself - if you program in Delphi I can send you the API header files (with sample program) that allows you to write your own plugin...

TimB
Posts: 262
Joined: Wed Oct 04, 2006 7:25 am
Location: London UK

Post by TimB » Wed Apr 25, 2007 2:24 pm

Personally I prefer a tree and to use a mouse. I've played with it and think its excellent.

Considering John did it all by parsing the files with no integration it shows access to the IDE is not necessary. I look forward to you publishing your own variant octal.

I also have some other plug-ins that will enhance SF, should I publish a list for you? Should not take you long to them couple of weeks max.

User avatar
octal
Registered User
Registered User
Posts: 586
Joined: Thu Jan 11, 2007 12:49 pm
Location: Paris IDF
Contact:

Post by octal » Wed Apr 25, 2007 3:05 pm

David Barker wrote:Why not give it a go yourself - if you program in Delphi I can send you the API header files (with sample program) that allows you to write your own plugin...
Yeehhhhhh ... please send it to my email.
TimB wrote: Personally I prefer a tree and to use a mouse. I've played with it and think its excellent.
I do not say that a tree and mouse are not good. I think that the purpose of the two approach are different :
Tree+Mouse : very good for quick navigation, for navigating from procedure to procedure, for quick reference, and to see in one shot all the structure of code.
GExpert way : Very good because when working in sources,
1- you do not have to leave the keyboard to click the mouse and scroll until reaching the desired procedure
2- The filtering mechanism makes it very powerfull, because when you already know that you have a procedure named getMyItemData you do quickly type data for example to see it selected. Trust me, when I use it in Delphi, most of time I invoque it with Ctrl+G I never have time to read the list, I just type what's enought to make it appear in list and type enter.
TimB wrote: Considering John did it all by parsing the files with no integration it shows access to the IDE is not necessary. I look forward to you publishing your own variant octal.
The John work is needed for browsing, I do not say that it"'s usefulness, the treeview is usefull to browse libs ... I only think that since he has parsed all procedures and has the code that list them, instead of presenting them only in a treeview way, he can add (I can do it for him) a GExperts like form to implement this functionnality for the currently edited file. It's just another functionnality, another way to represent information, a really complementary wok and tool.
You can see this kind of representing information in different ways in Eclipse (in Java Develpment tools plugins),
1- the Project tree view shows all files of the project, and when you click each file you have an outline of all classes and methods in it (very similar to the actual treeview of SFCompiler IDE),
2- the Outline view shows all classes and objects in the currently edited file,
3- When you type quick navigation shortcut you can type just a part of the name and it will show all classes or interfaces concerned much like in GExperts (but better than GExperts).

And what I means by the integration in the IDE is that it has to be part of the IDE, not an external independent tool. I was thinking that John browser was intended to browse libs and sources as a true external browser, so I was thinking that it will not be as important as if it where integrated.
TimB wrote: I also have some other plug-ins that will enhance SF, should I publish a list for you? Should not take you long to them couple of weeks max.
Can you give us a list? It will be nice to know what kind of functionnalities can be added. I did not understand what you meant by "Should not take you long to them couple of weeks max." . I'm a long time developper and I know that nothing is easy and little toys can take long time, this why I said that David can add it IF HE HAS TIME ;)

Best regards

PS. David, I'm waiting Impatiently for your mail with the API :twisted:

johngb
Registered User
Registered User
Posts: 139
Joined: Tue Oct 03, 2006 10:16 pm

Post by johngb » Fri Apr 27, 2007 9:29 am

I have posted a Library Explorer to Dave for publication: Its main points are:

Displays all public Constants, Variables, Types, Structures, Subroutines and Functions.

Does not process Complier directives so some items may appear repeated

System Library and User Library are displayed under separate tabs

The Syntax for any command can be copied to the clipboard by right click on a specific entry. This can then be pasted into the Swordfish IDE as required.

The images used in the explorer are the same as those used by the Swordfish Code Explorer.
JohnB

Post Reply