Subsections

6. The IDE

The IDE (Integrated Development Environment) provides a comfortable user interface to the compiler. It contains an editor with syntax highlighting, a debugger, symbol browser etc. The IDE is a text-mode application which has the same look and feel on all supported operating systems. It is modelled after the IDE of Turbo Pascal, so many people should feel comfortable using it.

Currently, the IDE is available for DOS, WINDOWS and LINUX.

6.1 First steps with the IDE

6.1.1 Starting the IDE

The IDE is started by entering the command:
fp
at the command line. It can also be started from a graphical user interface such as WINDOWS.

Remark: Under WINDOWS, it is possible to switch between windowed mode and full screen mode by pressing Alt-Enter).

6.1.2 IDE Command line options

When starting the IDE, command line options can be passed:
fp [-option] [-option] ... <file name> ...
Option is one of the following switches (the option letters are case insensitive):
-N
(DOS only) Do not use long file names. WINDOWS 95 and later versions of WINDOWS provide an interface to DOS applications to access long file names. The IDE uses this interface by default to access files. Under certain circumstances, this can lead to problems. This switch tells the IDE not to use the long filenames.
-Cfilename
This option, followed by a filename, tells the IDE to read its options from filename. There should be no whitespace between the file name and the -C.
-F
use alternative graphic characters. This can be used to run the IDE on LINUX in an X-term or through a telnet session.
-R
After starting the IDE, it changes automatically to the directory which was active when the IDE exited the last time.
-S
Disable the mouse. When this option is used, then the mouse is disabled, even if a mouse is present.
The files given at the command line are loaded into edit windows automatically.

Remark: Under DOS/Win32, the first character of a command-line option can be a / character instead of a - character. So /S is equivalent to -S.

6.1.3 The IDE screen

After start up, the screen of the IDE can look like this:

idestart.png

At top of the screen the menu bar is visible, at the bottom the status bar. The empty space between them is called the desktop.

The status bar shows the keyboard shortcuts for frequently used commands, and allows quick access to these commands by clicking them with the mouse. At the right edge of the status bar, the current amount of unused memory is displayed. This is only an indication, since the IDE tries to allocate more memory from the operating system if it runs out of memory.

The menu provides access to all of the IDE's functionality, and at the right edge of the menu, a clock is displayed.

The IDE can be left by selecting File|Exit in the menu 6.1or by pressing Alt-X.

Remark: If a file fp.ans is found in the current directory, then it is loaded and used to paint the background. This file should contain ANSI drawing commands to draw on a screen.

6.2 Navigating in the IDE

The IDE can be navigated both with the keyboard and with a mouse, if the system is equipped with a mouse.

6.2.1 Using the keyboard

All functionality of the IDE is available through use of the keyboard.

Remark:


6.2.2 Using the mouse

If the system is equipped with a mouse, it can be used to work with the IDE. The left button is used to select menu items, press buttons, select text blocks etc.

The right mouse button is used to access the local menu, if available. Holding down the Ctrl or Alt key and clicking the right button will execute user defined functions, see section prefmouse.

Remark:

  1. Occasionally, the manual uses the term "drag the mouse". This means that the mouse is moved while the left mouse button is being pressed.
  2. The action of mouse buttons may be reversed, i.e. the actions of the left mouse button can be assigned to the right mouse button and vice versa 6.2. Throughout the manual, it is assumed that the actions of the mouse buttons are not reversed.
  3. The mouse is not always available, even if a mouse is installed:


6.2.3 Navigating in dialogs

Dialogs usually have a lot of elements in them such as buttons, edit fields, memo fields, list boxes and so on. To activate one of these fields, it is sufficient to:
  1. Click on the element with the mouse.
  2. Press the Tab key till the focus reaches the mouse
  3. Press the highlighted letter in the element's label. If the focus is currently on an element that allows to edit, then Alt should be pressed simultaneously with the highlighted letter. For a button, the action associated with the button will then be executed.
Inside edit fields, list boxes, memos, navigation is carried out with the usual arrow key commands.


6.3 Windows

Nowadays, working with windowed applications should be no problem for most WINDOWS and LINUX users. Nevertheless, the following section describes how the windows work in the Free Pascal IDE, to allow efficient work with it.


6.3.1 Window basics

A common IDE window is displayed below:

idewin.png

The window is surrounded by a so-called frame, the white double line around the window.

At the top of the window 4 things are displayed:

The right edge and bottom edges of a window contain scrollbars. They can be used to scroll the window contents with the mouse. The arrows at the ends of the scrollbars can be clicked to scroll the contents line by line. Clicking on the dotted area between the arrows and the cyan-coloured rectangle will scroll the window's content page by page. By dragging the rectangle the content can be scrolled continuously.

The star and the numbers in the lower left corner of the window display information about the contents of the window. They are explained in the section about the editor, see section editingtext.


6.3.2 Sizing and moving windows

A window can be moved and sized using the mouse and the keyboard: To move a window: To resize a window: Not all windows can be resized. This applies, for example, to dialog windows (section dialogwindow).

A window can also be hidden. To hide a window, the Ctrl-F6 key combination can be used, or the Window|Hide menu may be selected. To restore a Hidden window, it is necessary to select it from the window list. More information about the window list can be found in the next section.


6.3.3 Working with multiple windows

When working with larger projects, it is likely that multiple windows will appear on the desktop. However, only one of these windows will be the active window, all other windows will be inactive.

An inactive window is identified by a grey frame. An inactive window can be made active in one of several ways:

The windows can be ordered and placed on the IDE desktop by zooming and resizing them with the mouse or keyboard. This is a time-consuming task, and particularly difficult with the keyboard. Instead, the menu items Window|Tile and Window|Cascade can be used:

Tile
will divide whole desktop space evenly between all resizable windows.
Cascade
puts all windows in a cascaded position.

In very rare cases the screen of the IDE may be mixed up. In this case the whole IDE screen can be refreshed by selecting the menu item Window|Refresh display.


6.3.4 Dialog windows

In many cases the IDE displays a dialog window to get user input. The main difference to normal windows is that other windows cannot be activated while a dialog is active. Also the menu is not accessible while in a dialog. This behaviour is called modal. To activate another window, the modal window or dialog must be closed first.

A typical dialog window looks like:

idedlg.png


6.4 The Menu

The main menu (the gray bar at the top of the IDE) provides access to all the functionality of the IDE. It also displays a clock, displaying the current time. The menu is always available, except when a dialog is opened. If a dialog is opened, it must be closed first in order to access the menu.

In certain windows, a local menu is also available. The local menu will appear where the cursor is, and provides additional commands that are context-sensitive.

6.4.1 Accessing the menu

The menu can be accessed in a number of ways:
  1. By using the mouse to select items. The mouse cursor should be located over the desired menu item, and a left mouse click will then select it.
  2. By pressing F10. This will switch the IDE focus to the menu. Use the arrow keys can then be used to navigate in the menu, the Enter key should be used to select items.
  3. To access menu items directly, Alt-<highlighted menu letter> can be used to select a menu item. Afterwards submenu entries can be selected by pressing the highlighted letter, but without Alt. E.g. Alt-S G is a fast way to display the goto line dialog.
Every menu item is explained by a short text in the status bar.

When a local menu is available, it can be accessed by pressing the right mouse button or Alt-F10.

In the subsequent, all menu entries and their actions are described.


6.4.2 The File menu

The File menu contains all menu items that allow to load and save file, as well as to exit the IDE.
New
Opens a new, empty editor window.
New from template
Prompts for a template to be used, asks to fill in any parameters, and then starts a new editor window with the template.
Open
(F3) Presents a file selection dialog, and opens the selected file in a new editor window.
Save
(F2) Saves the contents of the current edit window with the current filename. If the current edit window does not yet have a filename, a dialog is presented to enter a filename.
Save as
Presents a dialog in which a filename can be entered. The current window's contents are then saved to this new filename, and the filename is stored for further save actions.
Change dir
Presents a dialog in which a directory can be selected. The current working directory is then changed to the selected directory.
Command shell
Executes a command shell. After the shell exited, the IDE resumes. Which command shell is executed depends on the system.
Exit
(ALT-X) Exits the IDE. If any unsaved files are in the editor, the IDE will ask if these files should be saved.
Under the Exit menu appear some filenames of recently used files. These entries can be used to quickly reload these files in the editor.


6.4.3 The Edit menu

The Edit menu contains entries for accessing the clipboard, and undoing or redoing editing actions. Most of these functions have shortcut keys associated with them.
Undo
(ALT-BKSP) Undo the last editing action. The editing actions are stored in a buffer, selecting this mechanism will move backwards through this buffer, i.e. multiple undo levels are possible. The selection is not preserved, though.
Redo
Redo the last action that was previously undone. Redo can redo multiple undone actions.
Cut
(Shift-DEL) Copy the current selection to the clipboard and delete the selection from the text. Any previous clipboard contents is lost after this action. After this action, the clipboard contents can be pasted elsewhere in the text.
Copy
(Ctrl-INS) Copy the current selection to the clipboard. Any previous clipboard contents is lost after this action. After this action, the clipboard contents can be pasted elsewhere in the text.
Paste
(Shift-INS) Insert the current clipboard contents in the text at the cursor position. The clipboard contents remains as it was.
Clear
(Ctrl-DEL) Clears (i.e. deletes) the current selection.
Show clipboard
Opens a window in which the current clipboard contents is shown.
When running an IDE under WINDOWS, the Edit menu has two additional entries. The IDE maintains a separate clipboard which does not share its contents with the windows clipboard. To access the Windows clipboard, the following two entries are also present:
Copy to Windows
this will copy the selection to the Windows clipboard.
Paster from windows
this will insert the content of the windows clipboard (if it contains text) in the edit window at the current cursor position.


6.4.4 The Search menu

The Search menu provides access to the search and replace dialogs, as well as access to the symbol browser of the IDE.
Find
(Ctrl-Q F) Presents the search dialog. A search text can be entered, and when the dialog is closed, the entered text is searched in the active window. If the text is found, it will be selected.
Replace
(Ctrl-Q A) Presents the search and replace dialog. After the dialog is closed, the search text will be replaced by the replace text in the active window.
Search again
(CTRL-L) Repeats the last search or search and replace action, using the same parameters.
Go to line number
(Alt-G) Prompts for a line number, and then jumps to this line number.
When the program and units are compiled with browse information, then the following menu entries are also enabled:
Find procedure
Not yet implemented.
Objects
Asks for the name of an object and opens a browse window for this object.
Modules
Asks for the name of a module and opens a browse window for this object.
Globals
Asks for the name of a global symbol and opens a browse window for this object.
Symbol
Opens a window with all known symbols, so a symbol can be selected. After the symbol is selected, a browse window for that symbol is opened.


6.4.5 The Run menu

The Run menu contains all entries related to running a program,
Run
(Ctrl-F9) If the sources were modified, compiles the program. If the compile is successful, the program is executed. If the primary file was set, then that is used to determine which program to execute. See section menucompile for more information on how to set the primary file.
Step over
(F8) Run the program till the next source line is reached. If any calls to procedures are made, these will be executed completely as well.
Trace into
(F7) Execute the current line. If the current line contains a call to another procedure, the process will stop at the entry point of the called procedure.
Goto cursor
(F4) Runs the program till the execution point matches the line where the cursor is.
Until return
Runs the current procedure till it exits.
Parameters
This menu item allows to enter parameters that will be passed on to the program when it is being executed.
Program reset
(Ctrl-F2) if the program is being run or debugged, the debug session is aborted, and the running program is killed.


6.4.6 The Compile menu

The Compile menu contains all entries related to compiling a program or unit.
Compile
(Alt-F9) Compiles the contents of the active window, irrespective of the primary file setting.
Make
(F9) Compiles the contents of the active window, and any files that the unit or program depends on and that were modified since the last compile. If the primary file was set, the primary file is compiled instead.
Build
Compiles the contents of the active window, and any files that the unit or program depends on, whether they were modified or not. If the primary file was set, the primary file is compiled instead.
Target
Sets the target operating system for which should be compiled.
Primary file
Sets the primary file. If set, any run or compile command will act on the primary file instead of on the active window. The primary file need not be loaded in the IDE for this to have effect.
Clear primary file
Clears the primary file. After this command, any run or compile action will act on the active window.
Information
Displays some information about the current program.
Compiler messages
(F12) Displays the compiler messages window. This window will display the messages generated by the compiler during the last compile.


6.4.7 The Debug menu

The Debug menu contains menu entries to aid in debugging a program, such as setting breakpoints and watches.
Output
User screen
(Alt-F5) Switches to the screen as it was last left by the running program.
Breakpoint
(Ctrl-F8) Sets a breakpoint at the current line. When debugging, program execution will stop at this breakpoint.
Call stack
(Ctrl-F3) Shows the call stack. The call stack is the list of addresses (and filenames and line numbers, if this information was compiled in) of procedures that are currently being called by the running program.
Registers
Shows the current content of the CPU registers.
Add watch
(Ctrl-F7) Add a watch. A watch is an expression that can be evaluated by the IDE and will be shown in a special window. Usually this is the content of some variable.
Watches
Shows the current list of watches in a separate window.
Breakpoint list
Shows the current list of breakpoints in a separate window.
GDB window
Shows the GDB debugger console. This can be used to interact with the debugger directly; here arbitrary GDB commands can be typed and the result will be shown in the window.


6.4.8 The Tools menu

The Tools menu defines some standard tools. If new tools are defined by the user, they are appended to this menu as well.
Messages
(F11) Show the messages window. This window contains the output from one of the tools. For more information, see section toolsmessages.
Goto next
(Alt-F8) Goto next message.
Goto previous
(Alt-F7) Goto previous message
Grep
(SHIFT-F2) Prompts for a regular expression and options to be given to grep, and then executes grep with the given expression and options. For this to work, the grep program must be installed on the system, and be in a directory that is in the PATH. For more information, see section grep.
Calculator
Displays the calculator. For more information, see section calculator
Ascii table
Displays the ASCII table. For more information, see section asciitable


6.4.9 The Options menu

The Options menu is the entry point for all dialogs that are used to set options for compiler and IDE, as well as the user preferences.
Mode
Presents a dialog to set the current mode of the compiler. The current mode is shown at the right of the menu entry. For more information, see section compilermode.
Compiler
Presents a dialog that can be used to set common compiler options. These options will be used when compiling a program or unit.
Memory sizes
Presents a dialog where the stack size and the heap size for the program can be set. These options will be used when compiling a program.
Linker
Presents a dialog where some linker options can be set. These options will be used when a program or library is compiled.
Debugger
Presents a dialog where the debugging options can be stored. These options are used when compiling units or programs. Note that the debugger will not work unless debugging information is generated in the program.
Directories
Presents a dialog where the various directories needed by the compiler can be set. These directories will be used when a program or unit is compiled.
Browser
Presents a dialog where the browser options can be set. The browser options affect the behaviour of the symbol browser of the IDE.
Tools
Presents a dialog to configure the tools menu. For more information, see section addingtools.
Environment
Presents a dialog to configure the behaviour of the IDE. A sub menu is presented with the various aspects of the IDE:
Preferences
General preferences, such as whether to save files or not, and which files should be saved. The video mode can also be set here.
Editor
Controls various aspects of the edit windows.
CodeComplete
Used to set the words which can be automatically completed when typing in the editor windows.
Codetemplates
Used to define code templates, which can be inserted in an edit window.
Desktop
Used to control the behaviour of the desktop, i.e. several features can be switched on or off.
Mouse
Can be used to control the actions of the mouse, and to assign commands to various mouse actions.
Startup
Not yet implemented.
Colors
Here the various colors used in the IDE and the editor windows can be set.
Open
Presents a dialog in which a file with editor preferences can be selected. after the dialog is closed, the preferences file will be read and the preferences will be applied.
Save
Save the current options in the default file.
Save as
Saves the current options in an alternate file. A file selection dialog box will be presented in which the alternate settings file can be entered.
Please note that options are not saved automatically, they should be saved explicitly with the Options|Save command.


6.4.10 The Window menu

The Window menu provides access to some window functions. More information on all these functions can be found in section windows
Tile
Tiles all opened windows on the desktop.
Cascade
Cascades all opened windows on the desktop.
Close all
Close all opened windows.
Size/move
(Ctrl-F5) Put the IDE in Size/move modus; after this command the active window can be moved and resized using the arrow keys.
Zoom
(F5) Zooms or unzooms the current window.
Next
(F6) Activates the next window in the window list.
Previous
(SHIFT-F6) Activates the previous window in the window list.
Hide
(Ctrl-F6) Hides the active window.
Close
(ALT-F3) Closes the active window.
List
(Alt-0) Shows the list of opened windows. From there a window can be activated, closed, shown and hidden.
Refresh display
Redraws the screen.


6.4.11 The Help menu

The Help menu provides entry points to all the help functionality of the IDE, as well as the entry to customize the help system.
Contents
Shows the help table of contents
Index
(SHIFT-F1) Jumps to the help Index.
Topic search
(CTRL-F1) Jumps to the topic associated with the currently highlighted text.
Previous topic
(ALT-F1) Jumps to the previously visited topic.
Using help
Displays help on using the help system.
Files
Allows to configure the help menu. With this menu item, help files can be added to the help system.
About
Displays information about the IDE. See section about for more information.


6.5 Editing text

In this section, the basics of editing (source) text are explained. The IDE works like many other text editors in this respect, so mainly the distinguishing points of the IDE will be explained.

6.5.1 Insert modes

Standard, the IDE is in insert mode. This means that any text that is typed will be inserted before text that is present after the cursor.

In overwrite mode, any text that is typed will replace existing text.

When in insert mode, the cursor is a flat blinking line. If the IDE is in overwrite, the cursor is a cube with the height of one line. Switching between insert mode or overwrite mode happens with the Insert key or with the Ctrl-V key.


6.5.2 Blocks

The IDE handles selected text just as the IDE handles it. This is slightly different from the way e.g. Windows applications handle selected text.

Text can be selected in 3 ways:

  1. Using the mouse, dragging the mouse over existing text selects it.
  2. Using the keyboard, press Ctrl-K B to mark the beginning of the selected text, and Ctrl-K K to mark the end of the selected text.
  3. Using the keyboard, hold the Shift key depressed while navigating with the cursor keys.

There are also some special select commands:

  1. The current line can be selected using Ctrl-K L.
  2. The current word can be selected using Ctrl-K T.

In the Free Pascal IDE, selected text is persistent. After selecting a range of text, the cursor can be moved, and the selection will not be destroyed; hence the term 'block' is more appropriate for the selection, and will be used henceforth...

Several commands can be executed on a block:

When searching and replacing, the search can be restricted to the block contents.


6.5.3 Setting bookmarks

The IDE provides a feature which allows to set a bookmark at the current cursor position. Later, the cursor can be returned to this position by pressing a keyboard shortcut.

Up to 9 bookmarks per source file can be set up, they are set by Ctrl-K <Number> (where number is the number of the mark). To go to a previously set bookmark, press Ctrl-Q <Number>.

Remark: Currently, the bookmarks are not stored if the IDE is left. This may change in future implementations of the IDE.

6.5.4 Jumping to a source line

It is possible to go directly to a specific source line. To do this, open the goto line dialog via the Search|Goto line menu.

In the dialog that appears, the line-number the IDE should jump to can be entered. The goto line dialog.

gotoline.png


6.5.5 Syntax highlighting

The IDE is capable of syntax highlighting, i.e. the color of certain Pascal elements can be set. As text is entered in an editor window, the IDE will try to recognise the elements, and set the color of the text accordingly.

The syntax highlighting can be customized in the colors preferences dialog, using the menu option Options|Environment|Colors. In the colors dialog, the group "Syntax" must be selected. The item list will then display the various syntactical elements that can be colored:

Whitespace
The empty text between words. Remark that for whitespace, only the background color will be used.
Comments
All styles of comments in Free Pascal.
Reserved words
All reserved words of Free Pascal. (see also Reference guide).
Strings
Constant string expressions.
Numbers
Numbers in decimal notation.
Hex numbers
Numbers in hexadecimal notation.
Assembler
Any assembler blocks.
Symbols
Recognised symbols (variables, types)
Directives
Compiler directives.
Tabs
Tab characters in the source can be given a different color than other whitespace.
The editor uses some default settings, but experimentation is the best way to find a fitting color scheme. A good color scheme helps detecting errors in sources, since errors will result in wrong syntax highlighting.


6.5.6 Code Completion

Code completion means the editor will try to guess the text as it is being typed. It does this by checking what text is typed, and as soon as the typed text can be used to identify a keyword in a list of keywords, the keyword will be presented in a small colored box under the typed text. Pressing the Enter key will complete the word in the text.

There is no code completion yet for filling in function arguments, choosing object methods as in e.g. .

Code completion can be customized in the Code completion dialog, reachable through the menu option Options|Preferences|Codecompletion. The list of keywords that can be completed can be maintained here.

The code completion dialog.

codecomp.png

The dialog shows the currently defined keywords that will be completed in alphabetical order. The following buttons are available:

Ok
Saves all changes and closes the dialog.
Edit
Pops up a dialog that allows to edit the currently highlighted keyword.
New
Pops up a dialog that allows to enter a new keyword which will be added to the list.
Delete
Deletes the currently highlighted keyword from the list
Cancel
Discards all changes and closes the dialog.
All keywords are saved and are available the next time the IDE is started. Duplicate names are not allowed. If an attempt is made to add a duplicate name to the list, an error will follow.

6.5.7 Code Templates

Code templates are a way to insert large pieces of code at once. Each code templates is identified by a unique name. This name can be used to insert the associated piece of code in the text.

For example, the name ifthen could be associated to the following piece of code:

If | Then
  begin
  end
A code template can be inserted by typing its name, and pressing Ctrl-J when the cursor is positioned right after the template name.

If there is no template name before the cursor, a dialog will pop up to allow selection of a template.

If a vertical bar (|) is present in the code template, the cursor is positioned on it, and the vertical bar is deleted. In the above example, the cursor would be positioned between the if and then, ready to type an expression.

Code templates can be added and edited in the code templates dialog, reachable via the menu option Options|Preferences|Codetemplates.

The code templates dialog.

codetemp.png

The top listbox in the code templates dialog shows the names of all known templates. The bottom half of the dialog shows the text associated with the currently highlighted code template. The following buttons are available:

Ok
Saves all changes and closes the dialog.
Edit
Pops up a dialog that allows to edit the currently highlighted code template. Both the name and text can be edited.
New
Pops up a dialog that allows to enter a new code template which will be added to the list. A name must be entered for the new template.
Delete
Deletes the currently highlighted code template from the list
Cancel
Discards all changes and closes the dialog.
All templates are saved and are available the next time the IDE is started.

Remark: Duplicates are not allowed. If an attempt is made to add a duplicate name to the list, an error will occur.


6.6 Searching and replacing

The IDE allows to search for text in the active editor window. To search for text, one of the following can be done:
  1. Select Search|Find in the menu.
  2. Press Ctrl-Q F.
After that, the following dialog will pop up:

search.png

In this dialog, the following options can be entered:
Text to find
The text to be searched for. If a block was active when the dialog was started, the first line of this block is proposed.
Case sensitive
When checked, the search is case sensitive.
Whole words only
When checked, the search text must appear in the text as a complete word.
Direction
The direction in which the search must be conducted, starting from the specified origin.
Scope
Specifies if the search should be on the whole file, or just the selected text.
Origin
Specifies if the search should start from the cursor position or the start of the scope.
After the dialog has closed, the search is performed using the given options.

A search can be repeated (using the same options) in one of 2 ways:

  1. Select Search|Find again from the menu.
  2. Press Ctrl-L.

It is also possible to replace occurrences of a text with another text. This can be done in a similar manner to searching for a text:

  1. Select Search|Replace from the menu.
  2. Press Ctrl-Q A.
A dialog, similar to the search dialog will pop up: A dialog, similar to the search dialog will pop up:

replace.png

In this dialog, the following options can be entered: In this dialog, in addition to the things that can be filled in in the search dialog, the following things can be entered:
New text
Text by which found text will be replaced.
Prompt on replace
Before a replacement is made, the IDE will ask for confirmation.
If the dialog is closed with the 'OK' button, only the next occurrence of the the search text will be replaced. If the dialog is closed with the 'Change All' button, all occurrences of the search text will be replaced.


6.7 The symbol browser

The symbol browser allows to find all occurrences of a symbol. A symbol can be a variable, type, procedure or constant that occurs in the program or unit sources.

To enable the symbol browser, the program or unit must be compiled with browser information. This can be done by setting the browser information options in the compiler options dialog.

The IDE allows to browse several types of symbols:

procedures
Allows to quickly jump to a procedure definition or implementation.
Objects
Allows to quickly browse an object.
Modules
Allows to browse a module.
Globals
Allows to browse any global symbol.
Arbitrary symbol
Allows to browse an arbitrary symbol.
In all cases, first a symbol to be browsed must be selected. After that, a browse window appears. In the browse window, all locations where the symbol was encountered are shown. Selecting a location and pressing the space bar will cause the editor to jump to that location; the line containing the symbol will be highlighted.

If the location is in a source file that is not yet displayed, a new window will be opened with the source file loaded.

After the desired location was reached, the browser window can be closed with the usual commands.

The behaviour of the browser can be customized with the browser options dialog, using the Options|Browser menu. The browser options dialog looks as follows:

obrowser.png

The following options can be set in the browser options dialog:

Symbols
Here the types of symbols displayed in the browser can be selected:
Labels
labels are shown.
Constants
Constants are shown.
Types
Types are shown.
Variables
Variables are shown.
Procedures
Procedures are shown.
Inherited
Sub-browsing
Specifies what the browser should do when displaying the members of a complex symbol such as a record or class:
New browser
The members are shown in a new browser window.
Replace current
The contents of the current window are replaced with the members of the selected complex symbol.
Preferred pane
Specifies what pane is shown in the browser when it is initially opened:
scope
Reference
Display
Determines how the browser should display the symbols:
Qualified symbols
Sort always
sorts the symbols in the browser window.


6.8 Running programs

A compiled program can be run straight from the IDE. This can be done in one of several ways:
  1. select the Run|Run menu, or
  2. press Ctrl-F9.
If command-line parameters should be passed to the program, then these can be set through the Run|Parameters menu. The Parameters dialog.

params.png

Once the program started, it will continue to run, until
  1. the program quits normally,
  2. an error happens,
  3. a breakpoint is encountered or
  4. the program is reset by the user.
The last alternative is only possible if the program is compiled with debug information.

Alternatively, it is possible to position the cursor somewhere in a source file, and run the program till the execution reaches the source-line where the cursor is located. This can be done by

  1. selecting Run|Goto Cursor in the menu,
  2. pressing F4.
Again, this is only possible if the program was compiled with debug information.

The program can also executed line by line. Pressing F8 will execute the next line of the program. If the program wasn't started yet, it is started. Repeatedly pressing F8 will execute line by line of the program, and the IDE will show the line to be executed in an editor window. If somewhere in the code a call occurs to a subroutine, then pressing F8 will cause the whole routine to be executed before control returns to the IDE. If the code of the subroutine should be stepped through as well, then F7 should be used instead. Using F7 will cause the IDE to execute line by line of any subroutine that is encountered.

If a subroutine is being stepped through, then the Run|Until return menu will execute the program till the current subroutine ends.

If the program should be stopped before it quits by itself, then this can be done by

  1. selecting Run|Program reset from the menu, or
  2. pressing Ctrl-F2.
The running program will then be aborted.


6.9 Debugging programs

To debug a program, it must be compiled with debug information. Compiling a program with debug information allows to:
  1. Execute the program line by line.
  2. Run the program till a certain point (a breakpoint)
  3. Inspect the contents of variables or memory locations while the program is running.

6.9.1 Using breakpoints

Breakpoints will cause a running program to stop when the execution reaches the line where the breakpoint was set. At that moment, control is returned to the IDE, and it is possible to continue execution.

To set a breakpoint on the current source line, use the Debug|Breakpoint menu entry, or press Ctrl-F8.

A list of current breakpoints can be obtained through the Debug|Breakpoint list menu. The breakpoint list window looks as follows:

brklist.png

In the breakpoint list window, the following things can be done:

New
Shows the breakpoint property dialog where the properties for a new breakpoint can be entered.
Edit
Shows the breakpoint property dialog where the properties of the highlighted breakpoint can be changed.
Delete
Deletes the highlighted breakpoint.
The dialog can be closed with the 'Close' button.

The breakpoint properties dialog looks as follows:

brkprop.png

The following properties can be set:

type
function
function breakpoint. The program will stop when the function with the given name is reached.
file-line
Source line breakpoint. The program will stop when the source file with given name and line is reached;
watch
Expression breakpoint. An expression may be entered, and the program will stop as soon as the expression changes.
awatch
(access watch) Expression breakpoint. An expression that references a memory location may be entered, and the program will stop as soon as the memory indicated by the expression is accessed.
rwatch
(read watch) Expression breakpoint. An expression that references a memory location may be entered, and the program will stop as soon as the memory indicated by the expression is read.
name
Name of the function or file where to stop.
line
Line number in the file where to stop. Only for breakpoints of type file-line.
Conditions
Here an expression can be entered which must evaluate True for the program to stop at the breakpoint. The expressions that can be entered must be valid GDB expressions.
Ignore count
The number of times the breakpoint will be ignored before the program stops;

Remark:

  1. Because the IDE uses GDB to do its debugging, it is necessary to enter all expressions in uppercase on FREEBSD.
  2. Expressions that reference memory locations should be no longer than 16 bytes on LINUX or go32v2 on an Intel processor, since the Intel processor's debug registers are used to monitor these locations.
  3. Memory location watches will not function on Win32 unless a special patch is applied.

6.9.2 Using watches

When debugging information is compiled in the program, watches can be used. Watches are expressions which can be evaluated by the IDE and shown in a separate window. When program execution stops (e.g. at a breakpoint) all watches will be evaluated and their current values will be shown.

Setting a new watch can be done with the Debug|Add watch menu command or by pressing Ctrl-F7. When this is done, the watch property dialog appears, and a new expression can be entered. The watch property dialog looks as follows:

watch.png

In the dialog, the expression can be entered, any possible previous value and current value are shown.

Remark: Because the IDE uses GDB to do it's debugging, it is necessary to enter all expressions in uppercase in FREEBSD.

A list of watches and their present value is available in the watches window, which can be opened with the Debug|Watches menu. The watch list window looks as follows:

watchlst.png

Pressing Enter or the space bar will show the watch property dialog for the currently highlighted watch in the watches window.

The list of watches is updated whenever the IDE resumes control when debugging a program.


6.9.3 The call stack

The call stack helps in showing the program flow. It shows the list of procedures that are being called at this moment, in reverse order. The call stack window can be shown using the Debug|Call Stack It will show the address or procedure name of all currently active procedures with their filename and addresses. If parameters were passed they will be shown as well. The call stack window looks as follows:

callstck.png

By pressing the space bar in the call stack window, the line corresponding to the call will be highlighted in the edit window.


6.9.4 The GDB window

The GDB window provides direct interaction with the GDB debugger. In it, GDB commands can be typed as they would be typed in GDB. The response of GDB will be shown in the window.

Some more information on using GDB can be found in section usinggdb, but the final reference is of course the GDB manual itself 6.3.

The GDB window looks as follows:

gdbwin.png


6.10 Using Tools

The tools menu provides easy access to external tools. It also has three pre-defined tools for programmers: an ASCII table, a grep tool and a calculator. The output of the external tools can be accessed through this menu as well.


6.10.1 The messages window

The output of the external utilities is redirected by the IDE and it will be displayed in the messages window. The messages window is displayed automatically, if an external tool was run. The messages window can be also displayed manually by the selecting the menu item Tools|Messages or by pressing the key F11.

The messages window looks as follows:

messages.png

If the output of the tool contains filenames and line numbers, the messages window can be used to navigate the source as in a browse window:

  1. Pressing Enter or double clicking the output line will jump to the specified source line and close the messages window.
  2. Pressing the space bar will jump to the specified source line, but will leave the messages window open, with the focus on it. This allows to quickly select another message line with the arrow keys and jump to another location in the sources.
The algorithm which extracts the file names and line numbers from the tool output is quite sophisticated, but in some cases it may fail6.4.


6.10.2 Grep

One external tool in the Tools menu is already predefined: a menu item to call the grep utility (Tools|Grep or Shift-F2). Grep searches for a given string in files and returns the lines which contain the string. The search string can be even a regular expression. For this menu item to work, the grep program must be installed, since it does not come with Free Pascal.

The messages window displayed in messages in the previous section shows the output of a typical grep session. The messages window can be used in combination with grep to find special occurrences in the text.

Grep supports regular expressions. A regular expression is a string with special characters which describe a whole class of expressions. The command line in DOS or LINUX have limited support for regular expressions: entering ls *.pas (or dir *.pas) to get a list of all Pascal files in a directory. *.pas is something similar to regular expression. It uses a wildcard to describe a whole class of strings: these which end with ".pas". Regular expressions offer much more: for example [A-Z][0-9]+ describes all strings which begin with a upper case letter followed by one or more digits.

It is outside the scope of this manual to describe regular expressions in great detail. Users of a LINUX system can get more information on grep using man grep on the command-line.


6.10.3 The ASCII table

The tools menu provides also an ASCII table (Tools|Ascii table), The ASCII table can be used to look up ASCII codes as well as inserting characters into the window which was active when invoking the table. To get the ASCII code of a char move the cursor on this char or click with the mouse on it. To insert a char into an editor window either:
  1. using the mouse, double click it,
  2. using the keyboard, press Enter while the cursor is on it.
This is especially useful for pasting graphical characters in a constant string.

The ASCII table remains active till another window is explicitly activated, thus multiple characters can be inserted at once. The ASCII table looks as follows:

ascii.png


6.10.4 The calculator

The calculator allows to do some quick calculations. It is a simple calculator, since it does not take care of operator precedence, and bracketing of operations is not (yet) supported.

The result of the calculations can be pasted into the text using the Ctrl-Enter keystroke.

The calculator dialog looks as follows:

calc.png

The calculator supports all basic mathematical operations such as addition, subtraction, division and multiplication. They are summarised in table (calculatorbasic) .

Table: Advanced calculator commands
Operation Button Key  
Add two numbers + +  
Subtract two numbers    
Multiply two numbers * *  
Divide two numbers / /  
Delete the last typed digit <- Backspace  
Delete the display C C  
Change the sign +    
Do per cent calculation % %  
Get result of operation = Enter  

But also more sophisticated mathematical operations such as exponentiation and logarithms are supported. The available mathematical calculations are shown in table (calculatoradvanced) .

Table: Advanced calculator commands
Operation Button Key  
Calculate power xy    
Calculate the inverse value 1/x    
Calculate the square root sqr    
Calculate the natural logarithm log    
Square the display contents x2    
.      

Like many calculators, the calculator in the IDE also supports storing a single value in memory, and several operations can be done on this memory value. The available operations are listed in table (calculatormemory)

Table: Advanced calculator commands
Operation Button Key  
Add the displayed number to the memory M+    
Subtract the displayed number from the memory M-    
Move the memory contents to the display M->    
Move the display contents to the memory M<-    
Exchange display and memory contents M<->    


6.10.5 Adding new tools

The tools menu can be extended with any external program which is command-line oriented. The output of such a program will be caught and displayed in the messages window.

Adding a tool to the tools menu can be done using the Options|Tools menu. This will display the tools dialog. The tools dialog looks as follows:

otools.png

In the tools dialog, the following actions are available:

New
Shows the tool properties dialog where the properties of a new tool can be entered.
Edit
Shows the tool properties dialog where the properties of the highlighted tool can be edited.
Delete
Removes the currently highlighted tool.
Cancel
Discards all changes and closes the dialog.
OK
Saves all changes and closes the dialog.
The definitions of the tools are written in the desktop configuration file, so unless auto-saving of the desktop file is enabled, the desktop file should be saved explicitly after the dialog is closed.

6.10.6 Meta parameters

When specifying the command line for the called tool, meta parameters can be used. Meta parameters are variables and and they are replaced by their contents before passing the command line to the tool.

$CAP
Captures the output of the tool.
$CAP_MSG
Captures the output of the tool and puts it in the messages window.
$CAP_EDIT
Captures the output of the tool and puts it in a separate editor window.
$COL
Replaced by the column of the cursor in the active editor window. If there is no active window or the active window is a dialog, then it is replaced by 0.
$CONFIG
Replaced by the complete filename of the current configuration file.
$DIR()
Replaced by the full directory of the filename argument, including trailing directory separator. e.g.
  $DIR('d:\data\myfile.pas')
would return d:\data\.
$DRIVE()
Replaced by the drive letter of the filename argument. e.g.
  $DRIVE('d:\data\myfile.pas')
would return d:.
$EDNAME
Replaced by the complete file name of the file in the active edit window. If there is no active edit window, this is an empty string.
$EXENAME
Replaced by the executable name that would be created if the make command was used. (i.e. from the 'Primary File' setting or the active edit window).
$EXT()
Replaced by the extension of the filename argument. The extension includes the dot. e.g.
  $DIR('d:\data\myfile.pas')
would return .pas.
$LINE
Replaced by the line number of the cursor in the active edit window. If no edit window is present or active, this is 0.
$NAME()
Replaced by the name part (excluding extension and dot) of the filename argument. e.g.
  $NAME('d:\data\myfile.pas')
would return myfile.
$NAMEEXT()
Replaced by the name and extension part of the filename argument. e.g.
  $DIR('d:\data\myfile.pas')
would return myfile.pas.
$NOSWAP
Does nothing in the IDE, it is provided for compatibility with only.
$PROMPT()
Prompt displays a dialog bow that allows editing of all arguments that come after it. Arguments that appear before the $PROMPT keyword are not presented for editing.

If a (optional) filename argument is present, $PROMPT() will load a dialog description from the filename argument, e.g.

$PROMPT(cvsco.tdf)
would parse the file cvsco.tdf, construct a dialog with it and display it. After the dialog closed, the information entered by the user is used to construct the tool command line.

See section commanddialogs for more information on how to create a dialog description.

$SAVE
Before executing the command, the active editor window is saved, even if it is not modified.
$SAVE_ALL
Before executing the command, all unsaved editor files are saved without prompting.
$SAVE_CUR
Before executing the command the contents of the active editor window are saved without prompting if they are modified.
$SAVE_PROMPT
Before executing the command, a dialog is displayed asking whether any unsaved files should be saved before executing the command.
$WRITEMSG()
Writes the parsed tool output information to a file with name as in the argument.


6.10.7 Building a command line dialog box

When defining a tool, it is possible to show a dialog to the user, asking for additional arguments, using the $PROMPT(filename) command-macro. Free Pascal comes with some dialogs, such as a 'grep' dialog, a 'cvs checkout' dialog and a 'cvs check in' dialog. The files for these dialogs are in the binary directory and have an extension .tdf.

In this section, the file format for the dialog description file is explained. The format of this file resembles a windows .INI file, where each section in the file describes an element (or control) in the dialog. A OK and Cancel button will be added to the bottom of the dialog, so these should not be specified in the dialog definition.

A special section is the Main section. It describes how the result of the dialog will be passed on the command-line, and the total size of the dialog.

Remark: Keywords that contain a string value, should have the string value enclosed in double quotes as in

Title="Dialog title"

The Main section should contain the following keywords:

Title
The title of the dialog. This will appear in the frame title of the dialog. The string should be enclosed in quotes.
Size
The size of the dialog, this is formatted as (Cols,Rows), so
Size=(59,9)
means the dialog is 59 characters wide, and 9 lines high. This size does not include the border of the dialog.
CommandLine
specifies how the command-line will be passed to the program, based on the entries made in the dialog. The text typed here will be passed on after replacing some control placeholders with their values.

A control placeholder is the name of some control in the dialog, enclosed in percent (%) characters. The name of the control will be replaced with the text, associated with the control. Consider the following example:

CommandLine="-n %l% %v% %i% %w% %searchstr% %filemask%"
Here the values associated with the controls named l, i, v, w and searchstr and filemask will be inserted in the command-line string.
Default
The name of the control that is the default control, i.e. the control that has the focus when the dialog is opened.
The following is an example of a valid main section:
[Main]
Title="GNU Grep"
Size=(56,9)
CommandLine="-n %l% %v% %i% %w% %searchstr% %filemask%"
Default="searchstr"

After the Main section, a section must be specified for each control that should appear on the dialog. Each section has the name of the control it describes, as in the following example:

[CaseSensitive]
Type=CheckBox
Name="~C~ase sensitive"
Origin=(2,6)
Size=(25,1)
Default=On
On="-i"
Each control section must have at least the following keywords associated with it:
Type
The type of control. Possible values are:
Label
A plain text label which will be shown on the dialog. A control can be linked to this label, so it will be focused when the user presses the highlighted letter in the label caption (if any).
InputLine
An edit field where a text can be entered.
CheckBox
A Checkbox which can be in a on or off state.
Origin
Specifies where the control should be located in the dialog. The origin is specified as (left,Top) and the top-left corned of the dialog has coordinate (1,1) (not counting the frame).
Size
Specifies the size of the control, which should be specified as (Cols,Rows).

Each control has some specific keywords associated with it; they will be described below.

A label (Type=Label) has the following extra keywords associated with it:

Text
the text displayed in the label. If one of the letters should be highlighted so it can be used as a shortcut, then it should be enclosed in tilde characters (~), e.g. in
Text="~T~ext to find"
The T will be highlighted.
Link
here the name of a control in the dialog may be specified. If specified, pressing this letter in combination with the Alt key will put the focus on the control specified here.
A label does not contribute to the text of the command-line, it is for informational and navigational purposes only. The following is an example of a label description section:
[label2]
Type=Label
Origin=(2,3)
Size=(22,1)
Text="File ~m~ask"
Link="filemask"

An edit control (Type=InputLine) allows to enter arbitrary text. The text of the edit control will be pasted in the command-line if it is referenced there. The following keyword can be specified in a inputline control section:

Value
here a standard value (text) for the edit control can be specified. This value will be filled in when the dialog appears.
The following is an example of a input line section:
[filemask]
Type=InputLine
Origin=(2,4)
Size=(22,1)
Value="*.pas *.pp *.inc"

A combo-box control (Type=CheckBox) presents a checkbox which can be in one of two states, on or off. With each of these states, a value can be associated which will be passed on to the command-line. The following keywords can appear in a checkbox type section:

Name
the text that appears after the checkbox. If there is a highlighted letter in it, this letter can be used to set or unset the checkbox using the Alt-letter combination.
Default
specifies whether the checkbox is checked or not when the dialog appears (values on or off)
On
the text associated with this checkbox if it is in the checked state.
Off
the text associated with this checkbox if it is in the unchecked state.
The following is a example of a valid checkbox description:
[i]
Type=CheckBox
Name="~C~ase sensitive"
Origin=(2,6)
Size=(25,1)
Default=On
On="-i"
If the checkbox is checked, then the value -i will be added on the command-line of the tool. If it is unchecked, no value will be added.


6.11 Project management and compiler options

Project management in Pascal is much easier than with C. The compiler knows from the source which units, sources etc. it needs. So the Free Pascal IDE does not need a full featured project manager like some C development environments offer, nevertheless there are some settings in the IDE which apply to projects.


6.11.1 The primary file

Without a primary file the IDE compiles/runs the source of the active window when a program is started. If a primary file is specified, the IDE compiles/runs always this source, even if another source window is active. With the menu item Compile|Primary file... a file dialog can be opened where the primary file can be selected. Only the menu item Compile|Compile compiles still the active window, this is useful if a large project is being edited, and only the syntax of the current source should be checked.

The menu item Compiler|Clear primary file restores the default behaviour of the IDE, i.e. the 'compile' and 'run' commands apply to the active window.

6.11.2 The directory dialog

In the directory dialog, the directories can be specified where the compiler should look for units, libraries, object files. It also says where the output files should be stored. Multiple directories (except for the output directory) can be entered, separated by semicolons.

The directories dialog looks as follows:

odirs.png

The following directories can be specified:

EXE & PPU directories
Specifies where the compiled units and executables will go. (See FE on the command line.)
Object directories
Specifies where the compiler looks for external object files. (See Fo on the command line.)
Library directories
Specifies where the compiler (more exactly, the linker) looks for external libraries. (See Fl on the command line.)
Include directories
Specifies where the compiler will look for include files, included with the {$i } directive. (See Fi or See I on the command line.)
Unit directories
Specifies where the compiler will look for compiled units. The compiler always looks first in the current directory, and also in some standard directories. (See Fu on the command line.)

6.11.3 The target operating system

The menu item Compile|Target allows to specify the target operating system for which the sources will be compiled. Changing the target doesn't affect any compiler switches or directories. It does affect some defines defined by the compiler. The settings here correspond to the option See T on the command-line. The target dialog looks as follows:

target.png

The following targets can be set:
Dos (go32v1)
This switch will dissapear in time as this target is no longer being maintained.
Dos (go32v2)
Compile for DOS, using version 2 of the Go32 extender.
FreeBSD
Compile for FREEBSD.
Linux
Compile for LINUX.
OS/2
Compile for OS/2 (using the EMX extender)
Win32
Compile for windows 32 bit.
The currently selected target operating system is shown in the menu item in the Compile menu. Standard this should be the operating system for which the IDE was compiled.

6.11.4 Compiler options

The menu Options|Compiler allows to set other options that affect the compilers behaviour. When this menu item is chosen, a dialog pops up that displays several tabs.

There are 5 tabs:

Syntax
Here options can be set that affect the various syntax aspects of the code. They correspond mostly to the -S option on the command line (section sourceoptions).
Code generation
These options control the generated code; they are mostly concerned with the -C and -X command-line options.
Verbose
These set the verbosity of the compiler when compiling. The messages of the compiler are shown in the compiler messages window (can be called with F12).
Browser
options concerning the generated browser information. Browser information needs to be generated for the symbol browser to work.
Assembler
Options concerning the reading of assembler blocks (-R on the command line) and the generated assembler (-A on the command line)

Under the tab pages, the Conditional defines entry box is visible; here symbols to define can be entered. The symbols should be separated with semicolons.

The syntax tab of the compiler options looks as follows:

ocompa.png

In this dialog, the following options can be set:

Delphi 2 extensions on
Enables the use of classes and exceptions (See Sd on the command-line).
C-like operators
Allows the use of some extended operators such as +=, -= etc. (See Sc on the command-line).
Stop after first error
when checked, the compiler stops after the first error. Normally the compiler continues compiling till a fatal error is reached. (See Se on the command-line)
Allow label and goto
Allow the use of label declarations and goto statements (See Sg on the command line).
C++ styled inline
allows the use of inlined functions (See Sc on the command-line).
TP/BP 7.0 compatibility
Try to be more compatible (See So on the command-line).
Delphi compatibility
try to be more compatible (See Sd on the command-line).
Allow STATIC in objects
Allow the Static modifier for object methods (See St on the command-line)
Strict var-strings
Not used.
Extended syntax
Not used.
Allow MMX operations
Allow MMX operations.

The code generation tab of the compiler options looks as follows:

ocompb.png

In this dialog, the following options can be set:

Run-time checks
Controls what run-time checking code is generated. If such a check fails, a run-time error is generated. the following checking code can be generated:
Range checking
Code that checks the results of enumeration and subset type operations is generated (See Cr command-line option)
Stack checking
Code that checks whether the stack limit is not reached is generated (See Cs command-line option)
I/O checking
Code that checks the result of IO operations is generated. (See Ci command-line option).
Integer overflow checking
The result of integer operations is checked (See Co command-line option)
Target processor
Set the target process for optimizations. The compiler can use different optimizations for different processors. This corresponds to the Op option.
i386/i486
Code is optimized for less than Pentium processors.
Pentium/pentiumMMX
Code is optimized for Pentium processors.
PPro/PII/c6x86/K6
Code is optimized for Pentium pro and higher processors.
Optimizations
What optimizations should be used when compiling:
Generate faster code
Corresponds to the -OG command-line option.
Generate smaller code
Corresponds to the -Og command-line option.
Use register variables
Corresponds to the -Or command-line option.
Uncertain optimizations
Corresponds to the -Ou command-line option.
Level 1 optimizations
Corresponds to the O1 command-line option.
Level 2 optimizations
Corresponds to the O1 command-line option.
More information on these switches can be found in section codegen.

The verbose tab of the compiler options looks as follows:

ocompc.png

In this dialog, the following verbosity options (See v on the command-line) can be set:

Warnings
Generate warnings, corresponds to -vw on the command-line.
Notes
Generate notes, corresponds to -vn on the command-line.
Hints
Generate hints, corresponds to -vh on the command-line.
General info
Generate general information, corresponds to -vi on the command-line.
User,tried info
Generate information on used and tried files. Corresponds to -vut on the command-line.
All
Switch on full verbosity. Corresponds to -va on the command-line.
Show all procedure if error
If an error using overloaded procedure occurs, show all procedures. Corresponds to -vb on the command-line.

The browser tab of the compiler options looks as follows:

ocompd.png

In this dialog, the browser options can be set:

No browser
(default) no browser information is generated by the compiler.
Only global browser
Browser information is generated for global symbols only, i.e. symbols defined not in a procedure or function (-b on the command-line)
Local and global browser
Browser information is generated for all symbols, i.e. also for symbols that are defined in procedures or functions (-bl on the command-line)

Remark: If no browser information is generated, the symbol browser of the IDE will not work.

The assembler tab of the compiler options looks as follows:

ocompe.png

In this dialog, the assembler reader and writer options can be set:

Assembler reader
This allows to set the style of the assembler blocks in the sources:
Direct assembler
The assembler blocks are copied as-is to the output (-Rdirect on the command-line).
AT&T assembler
The assembler is written in AT&T style assembler (-Ratt on the command-line).
Intel style assembler
The assembler is written in Intel style assembler blocks (-Rintel on the command-line).
remark that this option is global, but locally the assembler style can be changed with compiler directives.
Assembler info
When writing assembler files, this option decides which extra information is written to the assembler file in comments:
List source
The source lines are written to the assembler files together with the generated assembler (-al on the command line).
List register allocation
The compilers internal register allocation/deallocation information is written to the assembler file (-ar on the command-line).
List temp allocation
The temporary register allocation/deallocation is written to the assembler file. (-at on the command-line).
The latter two of these options are mainly useful for debugging the compiler itself, it should be rarely necessary to use these.
Assembler output
This option tells the compiler what assembler output should be generated.
Use default output
This depends on the target.
Use GNU as
assemble using GNU as (-Aas on the command-line).
Use NASM coff
produce NASM coff assembler (go32v2, -Anasmcoff on the command-line)
Use NASM elf
produce NASM elf assembler (LINUX, -Anasmelf on the command-line).
Use NASM obj
produce NASM obj assembler (-Anasmobj on the command-line).
Use MASM
produce MASM (Microsoft assembler) assembler (-Amasm on the command-line).
Use TASM
produce TASM (Turbo Assembler) assembler (-Atasm on the command-line).
Use coff
Write binary coff files directly using the internal assembler (go32v2, -Acoff on the command-line).
Use pecoff
Write binary pecoff files files directly using the internal writer. (Win32)

6.11.5 Linker options

The linker options can be set in the menu Options|Linker. It allows to determine how libraries and units are linked, and how the linker should be called. The linker options dialog looks as follows:

olinker.png

The following options can be set:
Call linker after
If this option is set then a script is written which calls the linker. This corresponds to the See s on the command-line.
Preferred library type
With this option, the type of library to be linked in can be set:
Target default
This depends on the platform.
Dynamic libraries
Tries to link in units in dynamical libraries. (option -XD on the command-line)
Static libraries
Tries to link in units in statical libraries. (option -XS on the command-line)
Smart libraries
Tries to link in units in smartlinked libraries. (option -XX on the command-line)

6.11.6 Memory sizes

The memory sizes dialog (reachable via options|Memory sizes) allows to enter the memory sizes for the project. The memory sizes dialog looks as follows:

omemsize.png

The following sizes can be entered:
Stack size
Sets the size of the stack in bytes; (option -Cs on the command line). This size may be ignored on some systems.
Heap size
Sets the size of the heap in bytes; (option -Ch on the command-line). Note that the heap grows dynamically as much as the OS allows.


6.11.7 Debug options

In the debug options dialog some options for inclusion of debug information in the binary can be set; it i also possible to add additional compiler options in this dialog. The debug options dialog looks as follows:

odebug.png

The following options can be set:
Debugging information
tells the compiler which debug information should be compiled in. One of following options can be chosen:
Strip all debug symbols from executable
Will strip all debug nd symbol information from the binary. (option -Xs on the command-line).
Generate debug symbol information
include debug information in the binary (option -g on the command-line). Please note that no debug information for units in the Run-Time Library will be included, unless a version of the RTL compiled with debug information is available. Only units specific to the current project will have debug information included.
Generate also backtrace lines information
Will compile with debug information, and will additionally include the lineinfo unit in the binary, so in case of an error the backtrace will contain the filenames and linenumbers of procedures in the call-stack. (Option -gl on the command-line)
Profiling switches
Tells the compiler whether or not profile code should be included in the binary.
No profile information
Has no effect, as it is the default.
Generate Profile code for gprof
If checked, profiling code is included in the binary (option -p on the command-line).
Addition compiler args
Here arbitrary options can be entered as they would be entered on the command-line, they will be passed on to the compiler as typed here.
Debuggee redirection
If checked, an attempt will be made to redirect the output of the program being debugged to another window (terminal).


6.11.8 The switches mode

The IDE allows to save a set of compiler settings under a common name; it provides 3 names under which the switches can be saved:
Normal
For normal (fast) compilation.
Debug
For debugging; intended to set most debug switches on. Also useful for setting conditional defines that e.g. allow to include some debug code.
release
For a compile of the program as it should be released, debug information should be off, the binary should be stripped, and optimizations should be used.
Selecting one of these modes will load the compiler options as they were saved the last time the selected mode was active, i.e. it doesn't specifically set or unset options.

When setting and saving compiler options, be sure to select the correct switch mode first; it makes little sense to set debug options while the release switch is active.

The switches mode dialog looks as follows:

oswitch.png

6.12 Customizing the IDE

The IDE is configurable in a wide range: Colors can be changed, screen resolution. The configuration setting can reached via the sub-menu Environment in the Options menu.

6.12.1 Preferences

The preferences dialog is called by the menu item Options|Environment|Preferences. The preferences dialog looks as follows:

oeprefs.png

Video modes
The drop down list at the top of the dialog allows to select a video mode. The available video modes depend on the system on which the IDE is running.

Remark:

  1. The video mode must be selected by pressing space or clicking on it. If the drop down list is opened while leaving the dialog, the new video mode will not be applied.
  2. For the DOS version of the IDE, the following should be noted: When using VESA modes, the display refresh rate may be very low. On older graphics card (1998 and before), it is possible to use the UniVBE driver of SciTech6.5

Desktop File
Specifies where the desktop file is saved: the current directory, or the directory where the config file was found;
Auto save
Here it is possible to set which files are saved when a program is run or when the IDE is exited:
Editor files
The contents of all open edit windows will be saved.
Environment
The current environment settings will be saved
Desktop
The desktop file with all desktop settings (open windows, history lists, breakpoints etc.) will be saved.
Options
Some special behaviour of the IDE can be specified here:
Auto track source
Close on go to source
When checked, the messages window is closed when the 'go to source line' action is executed.
Change dir on open
When a file is opened, the directory of that file is made the current working directory.


6.12.2 The desktop

The desktop preferences dialog allows to specify what elements of the desktop are saved across sessions, i.e. they are saved when the IDE is left, and they are again restored when the IDE is started the next time. They are saved in a file fp.dsk.

The desktop preferences dialog looks as follows:

oeprefs.png

The following elements can be saved and restored across IDE sessions:

History lists
Most entry boxes have a history list where previous entries are saved and can be selected. When this option is saved, these entries are saved in the desktop file. On by default.
Clipboard content
When checked, the contents of the clipboard is also saved to disk. Off by default.
Watch expressions
When checked, all watch expressions are saved in the desktop file. Off by default.
Breakpoints
When checked, all break points with their properties are saved in the desktop file. Off by default.
Open windows
When checked, the list of files in open editor windows is saved in the desktop file, and the windows will be restored the next time the IDE is run. On by default.
Symbol information
When checked, the information for the symbol browser is saved in the desktop file. Off by default.
CodeComplete wordlist
When checked, the list of code-completion words is saved. On by default.
CodeTemplates
When checked, the defined code-templates are saved. On by default.

6.12.3 The Editor

Several aspects of the editor window behaviour can be set in this dialog.

The editor preferences dialog looks as follows:

oeeditor.png

The following elements can be set in the editor preferences dialog:

Create backup files
Whenever an editor file is saved, a backup is made of the old file. On by default.
Auto indent mode
Smart indenting is on. This means that pressing Enter will position the cursor on the next line in the same column where text starts on the current line. On by default.
Use tab characters
When the tab key is pressed, use a tab character. Normally, when the tab key is pressed, spaces are inserted. When this option is checked, tab characters will be inserted instead. Off by default.
Backspace unindents
Pressing the Bksp key will unindent if the beginning of the text on the current line is reached, instead of deleting just the previous character. On by default.
Persistent blocks
When a selection is made, and the cursor is moved, the selection is not destroyed, i.e. the selected block stays selected. On by default.
Syntax highlight
Use syntax highlighting on the files that have an extension which appears in the list of highlight extensions. On by default.
Block insert cursor
The insert cursor is a block instead of an underscore character. By default the overwrite cursor is a block. This option reverses that behaviour. Off by default.
Vertical blocks
When selecting blocks over several lines, the block doesn't select the whole lines in the block, it selects the lines till the column on which the cursor is located. Off by default.
Highlight column
When checked, the current column (i.e. the column where the cursor is) is highlighted. Off by default.
Highlight row
When checked, the current row (i.e. the row where the cursor is) is highlighted. Off by default.
Auto closing brackets
When an opening bracket character is typed, the closing bracket is also inserted at once. Off by default.
Keep trailing spaces
When saving a file, the spaces at the end of lines are stripped off. This behaviour disables that behaviour, i.e. any trailing spaces are also saved to file. Off by default.
Codecomplete enabled
Enable code completion. On by default.
enable folds
???. Off by default.
Tab size
The number of spaces that are inserted when the Tab key is pressed. The default value is 8.
Indent size
The number of spaces a block is indented when calling the block indent function. The default value is 2.
Highlight extensions
When syntax highlighting is on, the list of file masks entered here will be used to determine which files are highlighted. File masks should be separated with semicolon (;) characters. The default is *.pas;*.pp;*.inc.
File patterns needing tabs
Some files (such as makefiles) need actual tab characters instead of spaces. Here a series of file masks can be entered for which tab characters will always be used. Default is make*;make*.*.

Remark: These options will not be applied to already opened windows, only newly opened windows will have these options.


6.12.4 Mouse

The mouse options dialog is called by the menu item Options|Environment|Mouse. It allows to adjust the behaviour of the mouse as well as the sensitivity of the mouse. The mouse options dialog looks as follows:

oemouse.png

Mouse double click
The slider can be used to adjust the double click speed. Fast means that the time between two clicks is very short, slow means that the time between two mouse clicks can be quite long.
Reverse mouse buttons
the behaviour of the left and right mouse buttons can be changed by by checking the checkbox; this is especially useful for left-handed people.
Ctrl+Right mouse button
Assigns an action to a right mouse button click while holding the Ctrl key pressed.
Ctrl+Left mouse button
Assigns an action to a left mouse button click while holding the Ctrl key pressed.

The following actions can be assigned to Ctrl-right mouse button or Alt-right mouse button:

Topic search
The keyword at the mouse cursor is searched in the help index.
Go to cursor
The program is executed until the line where the mouse cursor is located.
Breakpoint
Set a breakpoint at the mouse cursor position.
Evaluate
Evaluate the value of the variable at the mouse cursor.
Add watch
Add the variable at the mouse cursor to the watch list.
Browse symbol
The symbol at the mouse cursor is displayed in the browser.


6.12.5 Colors

Almost all elements of the IDE such as borders input fields, buttons and so on can have their color set in this dialog. The dialog sets the colors for all elements at once, i.e. it is not so that the color of one particular button can be set.

The syntax highlighting colors for the editor windows of the IDE can also be set in this dialog. The colors dialog looks as follows:

oecolors.png

The following elements are visible in the color dialog:

Group
Here the group to be customized is displayed; A group is a specific window or series of windows in the editor. A special group is Syntax which sets the colors for syntax highlighting.
Browser
Sets the colors for the symbol browser window.
Clock
Sets the colors for the clock in the menu.
Desktop
Sets the colors for the desktop.
Dialogs
Sets the colors for the dialog windows.
Editor
Sets the colors for the editor windows.
Help
Sets the colors for the help windows.
Menus
Sets the colors used in the menus.
Syntax
Sets the colors used when performing syntax highlighting in the editor windows.
item
Here the item for the current group can be selected. The foreground and background of this item can be set using the color selectors on the right of the dialog.
Foreground
Sets the foreground color of the selected item.
background
Sets the background color of the selected item.
Sample text
This shows the colors of the selected item in a sample text.
Setting a good color scheme is important especially for syntax highlighting; a good syntax highlighting scheme helps in eliminating errors when typing, without needing to compile the sources.

6.13 The help system

More information on how to handle the IDE, or about the use of various calls in the RTL, explanations regarding the syntax of a Pascal statement, can be found in the help system. The help system is activated by pressing F1.

6.13.1 Navigating in the help system

The help system contains hyperlinks; these are sensitive locations that lead to another topic in the help system. They are marked by a different color. The hyperlinks can be activated in 2 ways:
  1. by clicking them with the mouse,
  2. by using the Tab and Shift-Tab keys to move between the different hyperlinks of a page and the Enter key can be used to activate them.

The contents of the help system is displayed, if Shift-F1 is pressed. To go back to the previous help topic, press Alt-F1. This also works if the help window isn't displayed on the desktop; the help window will then be activated.

6.13.2 Working with help files

The IDE contains a help system which can display the following file formats:
TPH
The help format for the Turbo Pascal help viewer.
INF
The OS/2 help format.
NG
The Norton Guide Help format.
HTML
HTML files.
In future some more formats may be added. However, the above formats should cover already a wide spectrum of help files available.

Remark: Concerning the support for HTML files the following should be noted:

  1. The HTML viewer of the help system is limited, it can only handle the most basic HTML files (graphics excluded), since it is only designed to display the Free Pascal help files. 6.6.
  2. When the HTML help viewer encounters a graphics file, it will try and find a file with the same name but an extension of .ans; If this file is found, this will be interpreted as a file with ANSI escape sequences, and these will be used to display a text image. The displays of the IDE dialogs in the IDE help files are made in this way.

The menu item Help|Files permits to add and delete help files to the list of files in the help table of contents. The Help files dialog looks as follows:

helpfils.png

The dialogs lists the files that will be presented in the table of contents window of the help system. Each entry has a small descriptive title and a filename next to it. The following actions are available when adding help files:

New
Adds a new file. IDE will display a prompt, in which the location of the help file should be entered.

If the added file is an HTML file, a dialog box will be displayed which asks for a title. This title will then be included in the contents of help.

Delete
Deletes the currently highlighted file from the help system. It is not deleted from the hard disk, only the help system entry is removed.
Cancel
Discards all changes and closes the dialog.
OK
Saves the changes and closes the dialog.

The Free Pascal documentation in HTML format can be added to the IDE's help system, this way the documentation can be viewed from within the IDE. If Free Pascal has been installed using the installer, the installer should have added the FPC documentation to the list of help files, if the documentation was installed as well.


6.13.3 The about dialog

The about dialog, reachable through (Help|About...) shows some information about the IDE, such as the version number, the date it was built, what compiler and debugger it uses. When reporting bugs about the IDE, please use the information given by this dialog to identify the version of the IDE that was used.

It also displays some copyright information.


6.14 Keyboard shortcuts

A lot of keyboard shortcuts used by the IDE are compatible with WordStar and should be well known to Turbo Pascal users.

Below are the following tables:

  1. In table (shortcutsgeneral) some shortcuts for handling the IDE windows and Help are listed.
  2. In table (shortcutscompiler) the shortcuts for compiling, running and debugging a program are presented.
  3. In table (shortcutsnavigation) the navigation keys are described.
  4. In table (shortcutsedit) the editing keys are listed.
  5. In table (shortcutsblock) lists all block command shortcuts.
  6. In table (shortcutsselection) all selection-changing shortcuts are presented.
  7. In table (shortcutsmisc) some general shortcuts are presented, which do not fit in the previous categories.


Table: General
Command Key shortcut Alternative
Help F1  
Goto last help topic Alt-F1  
Search word at cursor position in help Ctrl-F1  
Help index Shift-F1  
Close active window Alt-F3  
Zoom/Unzoom window F5  
Move/Zoom active window Ctrl-F5  
Switch to next window F6  
Switch to last window Shift-F6  
Menu F10  
Local menu Alt-F10  
List of windows Alt-0  
Active another window Alt-<digit>  
Call grep utility Shift-F2  
Exit IDE Alt-X  


Table: Compiler
Command Key shortcut Alternative
Reset debugger/program Ctrl-F2  
Display call stack Ctrl-F3  
Run til cursor F4  
Switch to user screen Alt-F5  
Trace into F7  
Add watch Ctrl-F7  
Step over F8  
Set breakpoint at current line Ctrl-F8  
Make F9  
Run Ctrl-F9  
Compile the active source file Alt-F9  
Message F11  
Compiler messages F12  


Table: Text navigation
Command Key shortcut Alternative
Char left Arrow left Ctrl-S
Char right Arrow right Ctrl-D
Line up Arrow up Ctrl-E
Line down Arrow down Ctrl-X
Word left Ctrl-Arrow left Ctrl-A
Word right Ctrl-Arrow right Ctrl-F
Scroll one line up Ctrl-W  
Scroll one line down Ctrl-Z  
Page up PageUp Ctrl-R
Page down PageDown  
Beginning of Line Pos1 Ctrl-Q-S
End of Line End Ctrl-Q-D
First line of window Ctrl-Pos1 Ctrl-Q-E
Last line of window Ctrl-End Ctrl-Q-X
First line of file Ctrl-PageUp Ctrl-Q-R
Last line of file Ctrl-PageDown Ctrl-Q-C
Last cursor position Ctrl-Q-P  


Table: Edit
Command Key shortcut Alternative
Delete char Del Ctrl-G
Delete left char Backspace Ctrl-H
Delete line Ctrl-Y  
Delete til end of line Ctrl-Q-Y  
Delete word Ctrl-T  
Insert line Ctrl-N  
Toggle insert mode Insert Ctrl-V


Table: Block commands
Command Key shortcut Alternative
Goto Beginning of selected text Ctrl-Q-B  
Goto end of selected text Ctrl-Q-K  
Select current line Ctrl-K-L  
Print selected text Ctrl-K-P  
Select current word Ctrl-K-T  
Delete selected text Ctrl-Del Ctrl-K-Y
Copy selected text to cursor position Ctrl-K-C  
Move selected text to cursor position Ctrl-K-V  
Copy selected text to clipboard Ctrl-Ins  
Move selected text to the clipboard Shift-Del  
Indent block one column Ctrl-K-I  
Unindent block one column Ctrl-K-U  
Insert text from clipboard Shift-Insert  
Insert file Ctrl-K-R  
Write selected text to file Ctrl-K-W  
Uppercase current block Ctrl-K-N  


Table: Change selection
Command Key shortcut Alternative
Mark beginning of selected text Ctrl-K-B  
Mark end of selected text Ctrl-K-K  
Remove selection Ctrl-K-Y  
Extend selection one char to the left Shift-Arrow left  
Extend selection one char to the right Shift-Arrow right  
Extend selection to the beginning of the line Shift-Pos1  
Extend selection to the end of the line Shift-End  
Extend selection to the same column in the last row Shift-Arrow up  
Extend selection to the same column in the next row Shift-Arrow down  
Extend selection to the end of the line Shift-End  
Extend selection one word to the left Ctrl-Shift-Arrow left  
Extend selection one word to the right Ctrl-Shift-Arrow right  
Extend selection one page up Shift-PageUp  
Extend selection one page down Shift-PageDown  
Extend selection to the beginning of the file Ctrl-Shift-Pos1 Ctrl-Shift-PageUp
Extend selection to the end of the file Ctrl-Shift-End Ctrl-Shift-PageUp


Table: Misc. commands
Command Key shortcut Alternative
Save file F2 Ctrl-K-S
Open file F3  
Search Ctrl-Q-F  
Search again Ctrl-L  
Search and replace Ctrl-Q-A  
Set mark Ctrl-K-n (where n can be 0..9)  
Goto mark Ctrl-Q-n (where n can be 0..9)  
Undo Alt-Backspace  



root
2000-12-20