═══ 1. Overview ═══ (C) Copyright International Business Machines Corporation 1993. All rights Reserved. Augustus MMDCCXLIII AUC IBM United Kingdom Laboratories Ltd. This program may be of interest to those people who examine 370, 386 assembler, PASCAL(Ada), PL/AS(PL/I, REXX), C and FORTRAN etc. under OS/2. It was developed along with the CMS programme ANALYSE as part of the CICS restructure project to help understand convoluted 370 assemble programmes. This programme will provide basic browse functions for all files with a record size =<256 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, PL/AS, C, and FORTRAN 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. ═══ 2. 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' of OS2 V1.3. On OS/2 V2.x 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 a Transfer_pgm such as ALMCOPY from the OS2TOOLS disk. You can send commands to the host if you also install a Command_pgm such as OS2CMD. If you wish to access the OS/2 help file, ALPHA.HLP, it must be installed in the HELP path. ═══ 3. Starting up Alpha ═══ The syntax for starting up the Alpha programme is :- [C:\] ALPHA

> 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, see Profile. 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 On OS/2 V1.3 if 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 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 ═══ 4. Description ═══ This programme may be used to browse any file with a record size =<256 and may also be used with language files such as :- 370, 386 assembler, PASCAL(Ada), PLS 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 using ' ', ',', '+' 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 see Expand. Search commands may be issued from the command window see Command window, which may be invoked by the F6 key or the system menu icon When the main window is displayed keywords which are associated with the file extension will be highlighted using the colours specified in the profile. 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 the file may be browsed as soon as the window is opened, performance then improves once the file is read in. 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 (=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 'n - scroll right n characters 5. :n - go to record n 6. / - Search for string, not case dependent, from the current position in the file 7. " - Search for string, as typed, from the current position in the file 8. ' - Search for string, as typed, from the current position in the file but only in column 1 9. (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. 10. (s-e)- - will remove the records from the window. 11.  &  will cycle through the last 6 commands. 12. 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 Help button will start the Help summary widow or access the OS/2 help file ALPHA.HLP. 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 label searched for is preceded by "FUNCTION" or "SUBROUTINE" if the language is FORTRAN. The operators for langauages other than the C-language may be specified by the Language_operator keyword in the profile. 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 options 1. Transient Options - reset when a new file is allocated. a. Comment Suppression - replace a block of comment lines by one highlighted line of . b. Statement # - will display the current line number in the TITLE bar. c. Scale - place a scale line in the middle of the window. d. Status - indicate in the top left of the window the current status of file reading etc. 2. Permanent Options - remain set when a new file is allocated. a. Quiet - suppress the beep which indicates that the file is read in to storage. b. 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. c. Record_structure - for language files this will cause the calling structure to be recorded when the file has been read in. d. Tab - recognize tab characters, X'09', and skip to n*8. e. 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. f. Keyword - allow or suppress the keyword highlighting. The Allocate menu will create the Allocate window, see Allocate window. The Structure menu may be used to display the call structure for 370, 386 assembler, PASCAL, PL/AS, C and FORTRAN 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, for PL/AS PROC, CALL, keywords, for FORTRAN FUNCTION, SUBROUTINE, 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 Print button may be used to print the contents of the List box on LPT1. The Font menu may be used to dynamically change the font and character size; the change is not saved in the profile, see FONTs. The Colour menu may be used to dynamically change the text colours. The language keyword colours must be specified in the profile. ═══ 4.5. 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,16 & 20 is supplied with the ALPHA PACKAGE, which may also be used. See Installation for the installation of the Alpha Fonts. 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) {(16) for 8515/8516 screens} 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{8x12}, 9{9x10}, 10{8x14}, 11{11x12}, 16{12x16}, 20{12x20}). 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). ═══ 4.6. Profile ═══ A profile may be specified defining the following keyword values :- {Colours may take the values :- BLUE, DARKCYAN, BLACK, DARKBLUE, DARKPINK, DARKGRAY, DARKRED, DARKGREEN, BROWN, CYAN, RED, GREEN ,PINK, YELLOW, PALEGRAY, DEFAULT, WHITE} Text_colour specifies the colour of the window text. Highlight_colour is used for the isolate function of mouse button 1. Locate_colour is used for the argument for the locate function Comment_colour The first comment_colour is used for comment line beginning :- /*, {, *, ;, C and for the 'scale' background. The second comment_colour is used for the compressed comment line and for the Clipboard highlight. Branch_colour is used for 370, 386 branch instructions. Expand_colour is used for the text in the label expansion window Back_ground is use to specify the main window background colour. File_type specifies the File types to be recognized. The string must be =<64 characters and terminated by a comma. The first 6 types are used for :- 1 370 assembler 2 386 assembler 3 PASCAL, (Ada) 4 PL/S, PL/AS, PL/I etc., (REXX) 5 C 6 FORTRAN For REXX files use :- "A37,ASM,PAS,CMD,C,FOR," and replace the PLS entries For Ada files use :- "A37,ASM,ADA,PLS,C,FOR," and replace the PAS entries Comment_start specifies the first two characters of the start of a comment. The string must be =<12 characters. The 6 pairs are used for :- 1 370 assembler 2 386 assembler 3 PASCAL, for Ada specify Comment_start="* ; --/*/*C " 4 PL/S, PL/AS etc. 5 C 6 FORTRAN Comment_end specifies the last two characters of the end of a comment. The string must be =<12 characters. The 6 pairs are as in Comment_start. Precedent_C specifies the C language procedure keywords. The string must be <=64 characters and terminated by a comma. Precedent_C="char,extern,far,int,long,pascal,pointer,short,static,void," Language_colour defines the highlight colours for key words. Up to 128 entries may be defined as follows :- file_type,key_word,colour,scan_length and are terminated by .END, invalid entries are ignored. The key words must be =<12 characters. Language_operator defines the operator keywords for each language. The second value indicates how to process the keyword, viz. '<' or '>' indicate the scan direction from the keyword to locate the label 'P' or 'C' indicates that the keyword specifies an entry point or call, ':' indicates that the label will be followed by a colon, '2' indicates that the second label following a , is to be used. Up to 32 entries may be defined as follows :- file_type,<|>C|P[:][2],keyword and are terminated by '.END', invalid entries are ignored. The keywords must be <=12 characters. {The C-language procedure values are supplied on the Precedent_C keyword.} Font may take the values :- Courier|System|Helvetica|Roman|Alpha<,Bold|Italic><,(Point_size)> or a face name may be specified e.g. Font="Alpha",(10) Character_size specifies the (width,height) of the characters The character width is used to select the size of the font if the point size is not specified on the "Font" keyword. Read_file takes the value Yes|No and specifies whether the file is to be read in after allocation. Flow takes the value On|Off and specifies whether to draw flow lines from branch statements to labels. Expand takes the value On|Off and specifies that Expand mode will be effective once the file is read in. Marker takes the value On|Off and specifies whether mouse button 1 will define marker values. Language takes the values :- *<,Language> - determine the language from the file suffix. If a Language is all so given then this will be the default if the file type can not be found in "File_type", e.g. Language=*,PAS. For PL/I use Language=PLS etc. A37 - 370 assemble ASM - 386 macro assemble PAS - Pascal PLS - PL/S or PL/AS etc. C - C language FOR - FORTRAN Default_chr specifies the default character width and height used for scaling the Allocate and Command dialogue boxes. The default value is (10,16) {(14,20) for 8515/8516 screens}. Window specifies the initial window position. If no profile is specified then Window=(0,4h,63.5w,26h) {(0,120,1020,650) - for 8515/8516 screens} is assumed where w and h are the Default_chr width & height. Quiet will suppress the beep on completion of file read. Record_structure will record the CALL structure for 370 & 386 assembler, PASCAL, PL/AS, C and FORTRAN programmes, as the file is read in to memory. Tab will use X'09' as the tab character to move to column n*8 when file is read. Proportional will use the Font character spacing rather than the Character width to place the characters. Keyword will highlight the specified keywords. Statement_number sets the display of the statement number On|Off Command_pgm specifies the programme name invoked by <. Transfer_pgm specifies the programme name invoked by >. Alpha has within it (hard coded) routines which understand certain language features e.g. 370 Assembler labels start in start in column 1, procedures are invoked by BAL, BAS etc. and PASCAL procedures are preceded by FUNCTION or PROCEDURE etc.. There are 6 languages understood by Alpha, viz. :- 1 370 Assembler 2 386 Assembler 3 PASCAL (Ada) 4 PL/AS (PL/I, REXX) 5 C 6 FORTRAN Because Ada is similar to PASCAL and PL/I & REXX are similar to PL/AS, in respect to procedure calls etc., you can also analyse these languages by pretending they are type 3 & 4 respectively. However, you can interpret any language/file type (use the highlighting facility) by suppling extra definitions in a profile which is specified as a parameter to Alpha e.g. START ALPHA /p profile_name A sample profile (ALPHA.PRF) is provided in the package, which includes comments explaining the use of the keywords. This may be edited to change/add a file extension, highlighting and programme structure by modifying the following keywords :- File_type - list of file extensions up to 64 characters Comment_start - list of comment start character pairs (blank is ignored) up to 12 characters Comment_end - list of comment end character pairs (blank is ignored) up to 12 characters Language_colour - list of keyword definitions file_type,keyword,colour,maximum scan length Language_operator - list of operator definitions file_type,attributes,keyword e.g. to add language XYZ with a routine call 'ICALL routine_name' with a structure similar to PLS. File_type="A37,ASM,PAS,XYZ,C,FOR," Language_colour XYZ,ICALL,GREEN,72 XYZ,Next_key ,RED,72 Language_operator XYZ,>C,ICALL Only the first 6 language types will allow the Expand, Flow and Structure operations to be effective. This implies that you could not use all the features of Alpha for a new language which did not have the call/label syntax of one of the existing languages. The Alpha programme scans the keyword table in the order specified in the profile to the comment start in the record for a maximum of 16 found entries. A keyword_found array is created and the text is written by running down the array from the last to the first so if the entries in the profile were in the order :- PLS, END LOOP,GREEN,72 PLS, END,DARKCYAN,72 Then the 'END LOOP' would overwrite the 'END'; spaces are significant. The following is the sample profile which may be edited to change the startup values :- ALPHA.PRF ═══ ═══ Specify Language=PLS in the profile for PL/S, PL/AS etc. or use a file type of ".PLS". Because PL/I is similar to PL/AS you can use this file type for PL/I files. For REXX files, extension ".CMD", replace PLS by CMD in the File_type and replace the PLS entries in the Language_colour by the CMD entries. {Only "CALL" or "call" subroutine calls will be recognized.} For Ada files, extension ".ADA", replace PAS by ADA in the File_type and replace the PAS entries by the ADA entries in the profile. Also specify Comment_start="* ; --/*/*C " for the Ada comment start characters. ═══ ═══ 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 6 types are assumed to refer to :- 370 assembler, 386 assembler, PASCAL, PL/AS, C and FORTRAN in that order. ═══ ═══ Only the first 256 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. ═══ ═══ This function may be selected from the Command window which may be brought up from the system menu icon ═══ ═══ The statement number is displayed in the TITLE bar. R indicates that the file is being read in to memory, S indicates that the programme structure is being recorded. ═══ ═══ 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. When the file is read in there is a beep of 1760HZ and then one of 880HZ to indicate that recording of the programme structure is complete, provided that "Quiet=No" is specified in the profile. ═══ ═══ This window may also be created from the system menu icon A child window is created in to which may be typed the command. ═══ ═══ The line on which mouse button 1 was last pressed. ═══ ═══ 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. ═══ ═══ The file ALPHA.HLP must be installed in the help path. ═══ ═══ The C language keywords may be specified by the Precedent_C keyword in the profile, and the operators for the other languages by the Language_operator keyword.