PowerAda How do I …

From OC Systems Wiki!
Jump to: navigation, search

How do I contact OC Systems excellent technical support?

How do I get my existing source quickly compiled with PowerAda?

Try this, from the command line:

  • Copy all the source into a directory tree, let's call it /pa_test.
  • Suppose you have a main program that's in /pa_test/main/main.ada.
  • Set up the PowerAda environment: e.g., . /usr/lpp/powerada/setup
  • Run this "build_from_scratch" example script with the root directory and main program file:
$POWERADA/examples/scripts/build_from_scratch \			
   /pa_test main/main.ada

If you're porting from another compiler you'll have some errors to fix up, but this will create a project and some configuration files to get started with.

How do I create a new project?

Choose Create New Project from the Project menu in powerada, or use aprojinit from the command line.

Do I have to create a project?

If you want to work in the powerada GUI, yes. If you want to work at the command-line, no, not really. The Example in CHAPTER 2, "Getting Started", shows how you can just compile a file into a single sublibrary. The section on Alternate Libraries in CHAPTER 3, "Basic PowerAda Concepts" describes how things worked in PowerAda version 2, which didn't have projects, and all the non-project command-line tools like abuild, ada, alibinit, and areport are still available.

How do I get source into the project?

You can convert an existing source tree into a project by designating an existing directory as the project root when creating it.

To copy it, use Import Files in the powerada Directory Menu.

To move a source tree, create the project then use the mv command from the command line.

How do I compile the source?

Use the operations in the powerada Build Menu, as described in the Getting Started Demo. You can use the command-line as described in the Multiple Directories Demo or using the shell script $POWERADA/examples/scripts/build_from_scratch. Or you can just compile with the ada command as shown in the "Example" in Chapter 2.

How do I link a program?

After compiling from powerada, use the Bind Main operation in the Build Menu. From the command line, use ada with the -b option.

How do I run the program?

In powerada, choose Run Program from the Directory or File menu, or from the command line, just type the path of the executable file.

How do I debug the program?

In powerada, choose Debug Program from the Directory or File menu, or from the command line, type adbg followed by the path of the executable file.

How do I change the fonts and colors?

See "GUI Customization" in Chapter 4.

How do I create a new directory in my working project?

Use Create Directory from the powerada Directory menu (See "Create Directory/File" in Chapter 4), or the mkdir command.

How do I create a new file?

Use Create File from the powerada Directory menu (See "Create Directory/File" in Chapter 4), or the touch command. This creates an empty file, which you can then modify using Edit File.

How do I reference stuff I've already compiled in another directory?

Assuming you compiled within a project within powerada, that "stuff" went into a sublibrary named adalib in the same directory as the source. So to compile files that reference units in that other sublibrary, you need to include the project-relative name of another_directory/adalib in a sublibrary imports file called adalib.imports in your current directory.

This is explained in with more context in CHAPTER 3, "Project Libraries and Sublibraries" and in "Setting Up the PowerAda Project" in Chapter 5.

How do I reference stuff that's already compiled outside the project?

Name the compilation unit that is compiled into external sublibrary an in a with clause in the Ada source file in your current directory, and add the fully qualified name of this external sublibrary to your local sublibrary imports file, adalib.imports.

See "Referencing External Libraries" in Chapter 5.

How do I compile a C file?

There is no GUI support for compiling with C. Choose New Shell Window from the Project menu, and use the C compiler of your choice to compile the file. You may need to buy a compiler from IBM, or use gcc.

How do I link in an external object file?

You can specify it as one of the "Non-Ada Archive, Object Files" under the Bind Options tab of the Build Options Dialog, or in one of the several ways described in CHAPTER 7, "Linking With Foreign Object Code".

How do I get the CM menu operations to work?

PowerAda supports one of several third-party CM systems. If you don't see a CM menu at all, then the "none" option was chosen at installation time. If you have a CM menu but the specified operations don't work, then the system that was selected is not installed properly.

To determine the system that is currently selected, choose Environment Variables from the Environment cascaded menu in the Project Menu and select PACM_CM_SYSTEM. Its value will be that of the chosen system, e.g., CMVC.

For more information, see CHAPTER 5, "Choosing a CM System", or see your system adminstator.

How do I find the compile options of a file?

In a powerada, you can choose Visit Compiled Unit for the file, which will put you in a Source Browser View. Then select Unit Info from the Source menu to see the compile options and other information; or you can choose Show Compile Options from the Show Columns cascaded menu in one of powerada's Unit Views.

From the command line, use

areport -Wlf filename

to see lots of information about the specified file, including the options (shown in quotes).

How do I recompile with different options?

  • Choose Load from the Build menu
  • Click the Options button
  • Choose the Build Options tab
  • Set the Always load/compile toggle
  • Clear the Inherit options toggle button
  • Choose the Compile Options tab
  • Check the toggles you want, or enter other ada command line options in the type-in labeled Other options.
  • Click Ok in the Build Options Dialog.
  • Click the Preview button to confirm that your file(s) will be compiled as desired.
  • Click the Load button to load the file(s).

Or, from the command line, use the ada command with the desired options and filenames.

How do I compile Ada files outside powerada?

The tool to use outside of powerada but within a project is aprojbuild. This is the tool invoked by the Powerada Build Windows, and uses the project library and sublibrary imports file as described in "Project Libraries and Sublibraries" in Chapter 3.

Outside of a project, you can use abuild. For a single directory full of source, you can just type

ls *.ada | abuild -vI

and then bind your main program with

abuild -vb main_unit_name

For multiple sublibraries, you build each sublibrary by naming it at the top of an library list file (alib.list), followed by the names of all the sublibraries directly or indirectly needed by the program, as described in CHAPTER 3, "Alternate Libraries".

How do I make changes to a baseline?

In general, you don't: instead, you:

  • create a working project that has the baseline project to be changed as its parent baseline.
  • compile your changes into the working project.
  • use Baseline Project to convert the working project to a baseline.
  • change the baselines file named by the POWERADA_BASELINES environment variable, in which the alias for the original baseline appeared, to reference the new baseline containing the changes. Or, simply inform users to do a Change Baseline to the new baseline you created.

If you feel you must change an already baselined project. Make sure nobody else is referencing it, perhaps by temporarily moving it and seeing if anybody noticies.

Then, from the command line, execute

aprojbaseline -vu baseline_name

to "unbaseline" the baseline. Now, from either powerada or the command line, you can copy the changed source files over the existing ones in the baseline, and compile them into the corresponding sublibrary. When the changes have been compiled in, you can baseline the project again with Baseline Project menu item or with aprojbaseline.

How do I view a language-defined package like text_io?

  • Look in the index of LRM83 or RM95.; or
  • Choose Visit Library in a directory that has some compiled units (locally or in a baseline) and double-click on the desired unit in the resulting list; or
  • Click the Search button on the button bar, and in the dialog specify

Find Unit in Library whose name Contains text_ioor, if you have a baseline project:
Find Unit in Full Project whose name Contains text_io.
Then double-click on the desired unit in the resulting list.

How do I get a window with all my local files in it?

Click the Search button, and change the contents of the dialog to read: Find Files in Working Project whose name Contains: *

How do I see what will be recompiled because of a change I made?

Click Preview instead of the Update (or Load, Compile, or Bind) button in the Powerada Build Windows, or add -n to the aprojbuild command line.

How do I see what units will have to be recompiled if I change this unit?

In one of the Unit Views (reached by Visit Sublibrary, for example), select the unit to be changed. Then choose Unit Reports from the Sublibrary (or Library, or Unit) menu. This brings up the Unit Reports Dialog. Select the Reference Library you want to search, set the Report Type to dependents, and click Start. Click Ok in the "Done" dialog to view the resulting list.

How do I get to the source browser view from the text view?

Type Ctrl-V, or choose Visit Compiled Unit from the Popup Menu or the Visit/Visit In New cascaded menu in the Go Menu. If there is a corresponding compiled unit available, you will be positioned at the same place in that Source Browser View.

How do I get to the source browser from the file list?

Choose Visit Compiled Unit from the Popup Menu or the Visit/Visit In New cascaded menu in the Go Menu.

Or, choose Choose Visit Sublibrary or Visit Library from the Popup Menu or the Visit/Visit In New cascaded menu in the Go Menu, then double click on a unit in that list.

How do I jump to the declaration of a variable?

In a Source Browser View, find a reference to the variable, and put the cursor over it. Single-click with the middle mouse button to highlight the variable, then do one of:

How do I see all uses of a variable?

The reference to the variable must be in a compiled unit. View that unit in a Source Browser View with by choosing Visit Compiled Unit from the Go Menu or the Popup Menu. Find a reference to the variable, and put the cursor over it. Single-click with the middle mouse button to highlight the variable. To find all uses within the current unit, choose Local Uses from the Source menu. To pop up a dialog from which to search the entire project for uses of the variable, choose Global Uses from the Source menu.