                        

    ********************************************************    
    *                                                      *
    *           (C) Copyright IBM Corp. 1992               *
    *                                                      *
    ********************************************************






                           ALPHA V1.5

             Lionel de Lambert - Iunius MMDCCXLIII AUC

                IBM United Kingdom Laboratories Ltd.









This document describes the installation, function and commands of the ALPHA
code analysis and browse programme which runs under the OS/2 operating 
system. The languages supported are :-
370 and 386 assembler, PASCAL(Ada), PL/AS(PL/I, REXX) and C.














Introduction.

This program may be of interest to those people who examine 370, 386 
assembler, PASCAL(Ada), PL/AS(PL/I, REXX) and C etc. under OS/2.

This programme will provide basic browse functions for all files with a
record size <=132 as well as highlighting specified keywords and allowing 
user defined Marker references and flow lines, and for language files 
such as 370 & 386 Assemble, PASCAL, C, PL/AS etc. ALPHA will also draw
branch flow lines from 'Jump/GOTO' instructions to labels in the  same 
window, will display the programme call structure, and expand the 
procedure call in a secondary window.

The programme is written in PASCAL and MASM for OS/2 using Presentation 
Manager calls.


Installation

The minimum requirement is to transfer the binary file 'ALPHA EXEBIN' to 
a directory on your PS/2 as 'ALPHA.EXE'.
  
If you want different colours, fonts etc. you can copy the text file 
'ALPHA PRF' to the PS/2 as 'ALPHA.PRF' and edit the file. You can also
install the 'Alpha' fonts by transferring the binary file 'ALPHA FONBIN' 
to the PS/2 as 'ALPHA.FON' and using the 'Add font' command of the 
Installation menu on the 'Control Panel'. On OS/2 V2.0 select 'System Setup'
from 'OS/2 System' and use 'Add' in the 'Edit font' of the 'Font Palette'. 
If you wish to access files from the host then you should also install
ALMCOPY. You can send commands to the host if you also install OS2CMD.


Starting up Alpha

The syntax for starting up the Alpha programme is :-

[C:\].<START> ALPHA <file name> </p <profile name>> </m>
  
Where the option /m may be specified to cause the programme to be started 
minimised. This is intended for use in the 'STARTUP.CMD' file as an 
alternative to having the programme in the "Group - main" window, e.g.

START ALPHA /p /m

The option /p may be specified to cause the file of initial values of 
colours, font etc. to be read. The default file name for this profile is 
'ALPHA.PRF'. This file may be used to set alternative start up values such 
as the keyword colours. If a file name is not supplied on the OS/2 command
line then the first display will ask for the file name to be browsed. 
The Enter key or Enter button should be used to terminate the string, e.g.

        C:\WORK\TEST.A37<Enter_key>

If Alpha is minimised or active with or without a file allocated and the 
file manager window is active then a selected file may be moved from the
file manager window by dragging mouse button 2 and releasing it over the
a icon or main window. This will cause the new file to be allocated.




note
If the window fails to appear the error, WinGetLastError, is written to the
OUTPUT device. This should be directed to a printer or file e.g. 
ALPHA >PRN | >file_name


Description

This programme may be used to browse any file with a record size 132 and 
may also be used with language files such as :-
370, 386 assembler, PASCAL(Ada), C, or PL/AS(PL/I, REXX) programmes etc. 
on a PS/2 under OS/2 to help in analysing their structure.

The basic browse functions are :-

1) Home - Move to top of file
2) End - Move to end of file
3) Page_up - scroll up 1 screen
4) Page_down - scroll down 1 screen
5) F7 - scroll up 1/2 screen
6) F8 - scroll down 1/2 screen
7) F19 (Shift+F7) - scroll left 1/2 screen
8) F20 (Shift+F8) - scroll right 1/2 screen
9) The Horizontal and Vertical scroll bars.

The mouse button 1 when pressed will isolate the addressed string 
' ', ',', '+' etc. as separators, and highlight it and all references in 
the window or as the file is browsed.
In Locate mode if mouse button 1 is pressed twice (double clicked) then the
isolated string will become a search argument. If mouse button 2 is pressed
once (clicked) then the next occurrence of the search argument will be 
located. If mouse button 2 is double clicked then the search will start
at the top of the file. 

In Expand mode if mouse button 1 is double clicked then the search string 
is assumed to be a label or procedure name and a second window is opened 
with the procedure code provided the label/routine name can be found.

Search commands may be issued from the command window, which may be invoked
by the F6 key or the system menu icon a {Code Page 437; the icon will be  
for Code Page 850 etc.}.
When the main window is displayed keywords which are associated with the 
file extension will be highlighted using the colours specified in the 
profile.

Note
Up to 128 language keywords may be specified with their corresponding 
colour and the length of the record to be scanned. Only the first 16 key 
words on the line will be highlighted and the search order is the order 
specified in the profile. The keyword must be <=12 characters.

The File_type keyword in the profile may be used to introduce extra file 
types but the first 5 types are assumed to refer to :- 370 assembler, 386 
assembler, PASCAL, PL/AS, and C in that order. With Flow on for language 
files branch flow lines will be drawn from 'Branch/GOTO' instructions to 
labels in the same window.

If the profile specifies Read_file=Yes, the default, then the file may be 
browsed as soon as the window is opened, performance then improves once 
the file is read in.


Note
Only the first 132 characters of a record are read. Once the file is read 
in there is an internal switch over. If a locate etc. was in progress at 
the time of the switch over the window may not display the line found; 
it may be necessary to repeat the command e.g.F5.

If the profile specifies Read_file=No then only 120 records from the file 
are read in to storage and scrolling takes place within this buffer unless 
F4+Ctrl is pressed when the whole file is read in to memory asynchronously.
As the file is scrolled up/down extra pages are read in to the buffer.
The affect is that on scrolling upwards, after the window is displayed, 
there may be a pause (hour glass symbol) while extra data is read in.

Small parts (window size) of the file may be remembered and redisplayed by 
using the Clipboard function. Drag the mouse with button 1 down over the 
lines to be saved and press Ctrl+Insert to save the highlighted lines. 
To redisplay the saved lines press Shift+Insert. The lines are displayed 
from the cursor position onwards. The highlighted records may be printed 
on LPT1 by pressing Insert+Alt.


Function keys

The following keys are effective for the programme:-

Mouse button 1 will isolate and highlight the text. If button 1 is pressed 
twice then the highlighted string may then be used as a search argument by 
button 2.

Mouse button 2 will scan from the current position to the end of file for 
the locate string, i.e. the string isolated by button 1 or by use of a 
locate command from the command window (F6).
If the mouse button 2 is pressed twice then the scan will start from the 
top of the file.

F1 is the help key. 
  F1+Alt will display/hide the current status  {The statement number is 
displayed in the MINMAX  menu. R indicates that the file is being read in 
to memory, S indicates that the programme structure is being recorded.} 
of the programme. 
F2 will change the font. The System Monospaced font is the default font,
unless the Alpha font is installed.
F3 will terminate programme.
F4 will allocate a new file
  F4+Ctrl will read the currently assigned file in to memory.

Note
A separate thread is attached to read in the file whilst the file may 
continue to be browsed within the 120 record buffer. The scrolling of the 
file will be much faster but there may be some degradation of performance 
while the file is read in to store. A maximum of 21,844 records can be read
in if there is enough memory available. The start of the process is 
signalled by a 130HZ beep and when the file is read in there is a beep of 
1760HZ and 880HZ, provided that "Quiet=No" is specified in the profile.
             
F5 will repeat the previous command
F6 will issue a command.

Note
This window may also be created from the system menu icon a. A child window
is created in to which may be typed the command. 

F7 scroll up 1/2 screen.
F8 scroll down 1/2 screen.
F9 switch on/off comment suppression.
    A sequence of blank or comment lines will be compressed to a single line
    of  provided that he file is read in. The comment lines must begin with
    characters specified in  Comment_start.
F10 not used.
F11 not used.
F12 will move the mouse button 1 focus line {The line on which mouse button
     1 was last pressed.} to the centre of screen.
  F12+Ctrl will switch on/off the scale line in the centre of the window.
F13 (shift+F1) will display the programme structure.
F14 (shift+F2) will change the text colours.
F17 (shift+F5) will locate the next Marker.
F19 (Shift+F7) will scroll left 1/2 line.
F20 (shift+F8) will scroll right 1/2 line.
F24 (shift+F12) will reset the horizontal scroll, clear line markers etc.
Page_Up will scroll up one page.
Page_Down will scroll down one page.
Home key will move to top of file.
End  key will move to end of file.
Insert+Ctrl will place mouse Button 1 drag area in Clipboard.
Insert+Shift will copy Clipboard text to mouse Button 1 position - cursor.
Insert+Alt will write the highlighted records to LPT1.
Delete will remove the highlighted records, mouse button 1 display area, 
from the window display.
The Up & Down arrow keys will move the cursor.
The scroll arrows, slider etc. and Page up or Page down keys may be used 
for browsing.

Note
If the mouse button 1 is kept depressed then the lines or characters will 
scroll at 1 per second until the button is released. If the file is not 
read in then the file size is estimated by adding 1000 every time the 
internal array is filled. In this case the slider may be move to the end 
of the vertical scroll bar before end_of_file is reached and then move up.

Enter key will terminate an input string or refresh the screen.

Help window
This window may be invoked by the F1 key or the Help button on the command 
window. The window may be scrolled by :-

Page_up - scroll up 1 screen
Page_down - scroll down 1 screen
Home - scroll to the top of the Help data
End - scroll to the end of the Help data
F7 - scroll up 1/2 screen
F8 - scroll down 1/2 screen
The Page_Up key word at the bottom of the window will scroll up 1 screen if
selected by mouse button 1.
The Page_Down key word at the bottom of the window will scroll down 1 
screen if selected by mouse button 1.
  
The Help window may be cancelled by F3, the Cancel button or by Enter.



Allocate window
The File Allocate window will be created by the F4 key or from the Allocate
menu item of the command window. The file may be selected from the List box
or typed in to the Entry box. The drive may be changed by selecting [a] from
the List box or typing the drive letter followed by a ':' e.g. 'a:' in the 
Entry box. The Path may be changed by selecting a directory name from the 
List box or by typing the path name in the Entry box e.g. 'C:\WORK'.
The COMBO box will hold the last three allocate texts which have been 
entered.

A host file may be received and allocated by entering 
'>H:fn ft fm PC_file_name'; this string is passed to Transfer_pgm (ALMCOPY)
{without the '>' and with '/Q' appended} which must be installed on the PS/2.
If Transfer_pgm fails the return code is displayed in red and the Entry text
is left to be edited. If the requested file can not be allocated then the 
allocate window together with an error message will be displayed.

A host command may be executed by entering '<host command'; this string is 
passed to Command_pgm (OS2CMD) {without the '<'} which must be installed 
on the PS/2. 

If the DosExecPgm call fails for either OS2CMD or ALMCOPY then the error 
code is displayed in black.

Note
If the Allocate window can not be contained in the main window then it will
be made sysmodal; i.e. it must be closed before other windows can be used. 
For 8515 type screens a more suitable value for the Window keyword in the 
profile would be Window=(0,60,1000,600) for example. 

Command window
This window may be invoked by the F6 key or the system menu icon a.
{Code Page 437; the icon will be  for Code Page 850 etc.}

The following commands may be issued :-
+n - scroll down n lines
-n - scroll up n lines
<n - scroll left n characters
>n - scroll right n characters 
:n - go to record n
/ - Search for string, not case dependent, from the current position in the
     file.
" - Search for string, as typed, from the current position in the file
' - Search for string, as typed, from the current position in the file but 
    only in column 1
(s-e)>file_name - will copy records from the current file starting at s and
    ending with e to the file
   file_name. file_name may be 'LPT2' etc., an existing file or a new file. 
   If the end record number    is '*'  then the file is copied to end-of-file.
(s-e)- - will remove the records from the window.
 will cycle through the last 6 commands.
The Delete|Backspace key will delete a character from the input text. 

If the first character is invalid then the line will be filled red until it
is deleted.
F3 or ENTER will close the window and enter the command.
The cancel button will remove the window; only this child window will 
receive input until it is terminated.
The Flow button will switch on/off the drawing of flow lines. These lines 
are drawn for language files from 'Branch/GOTO' instructions to labels 
within the window.

The Expand/Locate button will switch on/off the label expansion. The 
isolated label is expanded by locating the routine and opening a second 
window containing the code. The mouse button 1 must be pressed twice 
(double clicked) to cause the label to be located. A depth of 8 expand 
windows is allowed, and each window may be scrolled using the scroll bar, 
Page_Up, Page_Down, etc.
The file must be read in to storage to use this facility. The Expand window 
may be closed by F3 or the CALL menu item when the main window will remain 
at the CALL. If the Routine menu is clicked then the main window will 
scroll to the expand text, i.e. the called code line may be passed back to 
the higher level window. The Locate menu or F6 will perform a case 
sensitive forward search from the current line+1.
F5 will repeat the previous locate. If Button 2 is double clicked after 
moving to the expanded label then the window will be moved back to the 
previous line, i.e. return to point of call.
The label searched for is succeeded by ":" for PLS and preceded by 
"FUNCTION" or   "PROCEDURE" in PASCAL. The label searched for is preceded 
by "char", "extern", "far", "int", "long", "pascal", "pointer", "short",  
"static" or "void" if the language type is C.

The Mark button will switch on/off the drawing of user flow lines defined 
by the mouse button 1, or the setting of a marker. Up to 16 user lines or 
markers may be associated with the file. If mouse button 1 is double clicked
then a marker will be associated with the line. If mouse button 1 is pressed
once then it will delimit the ends of a flow line. The markers or flow 
lines remain associated with the record until F24 (Shift+F12) is pressed. 
The markers enable places within the file to be remembered  and recalled by
(Shift+F5). 

The Options menu may be selected to change the state of the following option
s :-

Transient Options - reset when a new file is allocated.

Comment Suppression - replace a block of comment lines by one highlighted 
line of .
Scale - place a scale line in the middle of the window.
Status - indicate in the top left of the window the current status of file 
reading etc.

Permanent Options - remain set when a new file is allocated.

Quiet - suppress the beep which indicates that the file is read in to 
storage.
Read_file_when_allocated - when the file has been allocated read it in to 
storage by attaching a subtask. The file may be browsed whilst this is in 
progress but the reading of the file in to storage will be slower.
Record_structure - For language files this will cause the recording of the 
calling structure when the
file has been read.
Tab - recognize tab characters, X'09', and skip to n*8.
Proportional - use the font spacing for writing the characters rather than 
the character size; this will allow proportional fonts to be used however 
these are not suitable for displaying code.
Keyword - allow or suppress the keyword highlighting.

The Allocate menu will create the Allocate window

The Structure menu may be used to display the call structure for 370, 386 as
sembler, PASCAL, C and PL/AS programmes provided that the Record_structure 
option is effective when the file is read in. For 370 assembler the 
structure is based on BAL, BAS, DFHSTACK, for 386 assembler CALL, PROC 
instructions, for PASCAL PROCEDURE, FUNCTION, keywords, for C char, extern,
far, int, long, pascal, pointer, short, static or void keywords, and for 
PL/AS PROC, CALL, keywords {Labels 27 characters are ignored}.
If an entry is selected from the Programme Structure List Box then the 
main window is scrolled to that line.

The Font menu may be used to dynamically change the font and character size;
the change is not saved in the profile.
 
The Colour  menu may be used to dynamically change the text colours. The 
language keyword colours must be specified in the profile.

 FONTs
You can specify the initial/default font in the profile by using the Font 
keyword in the profile,
or you can change the font dynamically by invoking the Font window.

You can use the System Monospaced, Helvetica, Roman and Courier fonts but 
the Courier font and the System Monospaced are the only monospaced fonts 
supplied with OS/2. A monospaced font with point sizes 8,9,10 & 11 is 
supplied with the ALPHA PACKAGE, which  may also be used.
The fonts are then requested by specifying Font="Alpha",(10) etc. in the
profile.
The font type or face_name and size may be selected by the Font and 
Character_size keywords in the profile. If a profile is not supplied then 
the "Alpha",(10) font will be used if it is installed and a character_size 
of (8,14) else the "System Monospaced",(10) font will be used and a 
character_size of (8,16). Outline fonts are not selectable.

If the point size is not specified then the font is selected by using the 
Character_size.
Point sizes (1/72") are :-
Courier (8,10,12), Roman (8,10,12,14,18,24),
Helvetica (8,10,12,14,18,24),
System (8,10,12, {8x8, 8x16,9x20),
"Alpha" (8,9,10,11).
If the point size is specified but an image font does not exist for this 
nominal point size then the outline font, if available, will be used and 
scaled by the Character_size.
The font may be requested by face_name, e.g. Font="Alpha",(8).




