Positron Compiler Documentation

Code Explorer

Source: Positron8 Compiler User Manual, PDF page 489

The code explorer enables you to easily navigate your program code. The code explorer tree displays your currently selected processor, include files, declares, constants, variables, alias and modifiers, labels, macros and data labels.

Device Node

The device node is the first node in the explorer tree. It displays your currently selected processor type. For example, if you program has the declaration:

Device = 16F1829

then the name of the device node will be 16F1829. You don't need to explicitly give the device name in your program for it to be displayed in the explorer. For example, you may have an include file with the device type already declared. The code explorer looks at all include files to determine the device type. The last device declaration encountered is the one used in the explorer window. If you expand the device node, then all Special Function Registers (SFRs) belonging to the selected device are displayed in the explorer tree.

Include File Node

When you click on an include file, the IDE will automatically open that file for viewing and editing. Alternatively, you can just explorer the contents of the include file without having to open it. To do this, just click on the icon and expand the node. For example: -

In the above example, clicking on the icon for MyInclude.bas has expanded the node to reveal its contents. You can now see that MyInclude.bas has two constant declarations called TransferMax and TransferMin and also two variables called Index and Transfer. The include file also contains another include file called proton_4.inc. Again, by clicking the icon, the contents of proton_4.inc can be seen, without opening the file. Clicking on a declaration name will open the include file and automatically jump to the line number. For example, if you were to click on TransferMax, the include file MyInclude.bas would be opened and the declaration TransferMax would be marked in the IDE editor window. When using the code explorer with include files, you can use the explorer history buttons to go backwards or forwards. The explorer history buttons are normally located to the left of the main editors file select tabs,

History back button History forward button

Additional Nodes Declares, constants, variables, alias and modifiers, labels, macros and data label explorer nodes work in much the same way. Clicking on any of these nodes will take you to its declaration. If you want to find the next occurrence of a declaration, you should enable automatically select variable on code explorer click from View...Editor Options.

Selecting this option will load the search name into the 'find dialog' search buffer. You then just need to press F3 to search for the next occurrence of the declaration in your program. To sort the explorer nodes, right click on the code explorer and check the Sort Nodes option.

Explorer Warnings and Errors

The code explorer can identify duplicate declarations. If a declaration duplicate is found, the explorer node icon changes from its default state to a . For example,

 Dim MyVar as Byte
 Dim MyVar as Byte

The above example is rather simplistic. It is more likely you see the duplicate declaration error in you program without an obvious duplicate partner. That is, only one single duplicate error symbol is being displayed in the code explorer. In this case, the declaration will have a duplicate contained in an include file. For example,

The declaration TransferMax has been made in the main program and marked as a duplicate. By exploring your include files, the problem can be identified. In this example, TransferMax has already been declared in the include file MyInclude.bas Some features of the compiler of not available for some MCU types. For example, you cannot have a string declaration when using a 14 core part (for example, the 16F1829). If you try to do this, the explorer node icon changes from its default state and displays a . You will also see this icon displayed if the SFR View feature for a device is not available.

Notes

The code explorer uses an optimised parse and pattern match strategy in order to update the tree in real time. The explorer process is threaded so as not to interfere or slow down other IDE tasks, such as typing in new code. However, if you run computationally expensive background tasks on your machine (for example, circuit simulation) you will notice a drop in update performance, due to the threaded nature of the code explorer.

Figure from Positron8 manual, PDF page 490
Source manual figure - PDF page 490.
Figure from Positron8 manual, PDF page 491
Source manual figure - PDF page 491.