HP pTAL Reference Manual Abstract This publication describes the syntax of pTAL, the Portable Transaction Application Language for HP NonStop™ systems [TNS/R pTAL compiler (T9248) and TNS/E EpTAL compiler (T0561)] for system and application programmers. Product Version pTAL D44 EpTAL H01 Supported Release Version Updates (RVUs) This publication supports D44.00, G06.20, H06.03 and all subsequent D-series, G-series, and H-series RVUs unless otherwise indicated by its replacement publication.
Document History Part Number Product Version Published 115327 pTAL D40 December 1995 523746-001 pTAL D40 May 2003 523746-002 pTAL D44 September 2003 523746-005 pTAL D44, EpTAL H01 July 2005
HP pTAL Reference Manual Glossary Index What’s New in This Manual xxxi Manual Information xxxi New and Changed Information Examples Figures xxxi About This Manual xxxvii Audience xxxvii Additional Information xxxvii Notation Conventions xli 1.
2. Language Elements Contents 2. Language Elements Character Set 2-2 Keywords 2-2 Delimiters 2-4 Operators 2-5 Base Address Symbols 2-7 Indirection Symbols 2-7 Declarations 2-8 Identifiers 2-8 Variables 2-10 Scope 2-10 Constants 2-12 Statements 2-12 3.
. Expressions Contents 5.
8. Arrays Contents 8. Arrays Declaring Arrays 8-2 Declaring Read-Only Arrays 8-6 Using Constant Lists in Array Declarations Read-Only Arrays 8-8 Nonstring Arrays 8-9 8-8 9.
9. Structures (continued) Contents 9.
10. Pointers (continued) Contents 10. Pointers (continued) Initializing Structure Pointers 10-17 Declaring System Global Pointers 10-20 11.
12. Statements (continued) Contents 12.
13. Hardware Indicators (continued) Contents 13. Hardware Indicators (continued) Hardware Indicators After Assignments 13-3 $OVERFLOW 13-3 $CARRY 13-4 Condition Codes 13-4 Hardware Indicators in Conditional Expressions 13-8 Nesting Condition Code Tests 13-12 Using Hardware Indicators Across Procedures 13-14 Testing a Hardware Indicator Set in the Calling Procedure 13-14 Returning a Condition Code to the Calling Procedure 13-15 Returning the Value of $OVERFLOW or $CARRY to the Calling Procedure 13-16 14.
15. Built-In Routines Contents 15.
15. Built-In Routines (continued) Contents 15.
15. Built-In Routines (continued) Contents 15.
16. Compiling and Linking pTAL Programs (continued) Contents 16. Compiling and Linking pTAL Programs (continued) Linking Object Files 16-7 Creating a Dynamic Linked Library (DLL) 16-12 Compiling With Global Data Blocks 16-12 Declaring Global Data 16-12 Allocating Global Data Blocks 16-15 Address Assignments 16-15 Sharing Global Data Blocks 16-16 Compiling With Saved Global Data 16-17 17.
17. Compiler Directives (continued) Contents 17.
18. pTAL Cross Compiler Contents 18. pTAL Cross Compiler NonStop pTAL (ETK) 18-2 pTAL or EpTAL (PC Command Line) 18-3 Compilation and Linking 18-5 Debugging 18-6 Tools and Utilities 18-6 NonStop ar Utility 18-6 TACL DEFINE Tool (ETK) 18-7 PC-to-NonStop-Host Transfer Tools 18-7 Documentation 18-8 A.
A. Syntax Summary (continued) Contents A.
A. Syntax Summary (continued) Contents A.
B. Disk File Names and HP TACL Commands Contents B. Disk File Names and HP TACL Commands Disk File Names B-1 Parts of a Disk File Name Partial File Names B-3 Logical File Names B-4 Internal File Names B-4 HP TACL Commands B-4 DEFINE B-5 PARAM SWAPVOL B-7 ASSIGN B-7 B-2 C. Differences Between the pTAL and EpTAL Compilers General C-1 Data Types and Alignment Routines C-2 Compiler Directives C-3 C-1 D. RETURN, RETURNSCC, and C/C++ on TNS/E Glossary Index Examples Example 2-1. Example 2-2. Example 2-3.
Examples (continued) Contents Examples (continued) Example 5-7. Example 5-8. Example 5-9. Example 5-10. Example 5-11. Example 5-12. Example 6-1. Example 6-2. Example 6-3. Example 6-4. Example 6-5. Example 6-6. Example 6-7. Example 6-8. Example 6-9. Example 6-10. Example 6-11. Example 6-12. Example 6-13. Example 7-1. Example 7-2. Example 7-3. Example 7-4. Example 7-5. Example 7-6. Example 8-1. Example 8-2. Example 8-3. Example 8-4. Example 8-5. Example 8-6. Example 8-7. Example 8-8. Example 8-9.
Examples (continued) Contents Examples (continued) Example 9-4. Example 9-5. Example 9-6. Example 9-7. Example 9-8. Example 9-9. Example 9-10. Example 9-11. Example 9-12. Example 9-13. Example 9-14. Example 9-15. Example 9-16. Example 9-17. Example 9-18. Example 9-19. Example 9-20. Example 9-21. Example 9-22. Example 9-23. Example 9-24. Example 9-25. Example 9-26. Example 9-27. Example 9-28. Example 9-29. Example 9-30. Example 9-31. Example 9-32. Example 9-33. Example 9-34. Example 9-35. Example 9-36.
Examples (continued) Contents Examples (continued) Example 9-42. Example 9-43. Example 9-44. Example 9-45. Example 9-46. Example 9-47. Example 9-48. Example 9-49. Example 10-1. Example 10-2. Example 10-3. Example 10-4. Example 10-5. Example 10-6. Example 10-7. Example 10-8. Example 10-9. Example 10-10. Example 10-11. Example 10-12. Example 10-13. Example 10-14. Example 10-15. Example 10-16. Example 10-17. Example 10-18. Example 10-19. Example 10-20. Example 11-1. Example 11-2. Example 11-3. Example 11-4.
Examples (continued) Contents Examples (continued) Example 11-11. Memory Usage for Structured Equivalenced Variables (Incorrect) 11-21 Example 11-12. Memory Usage for Structured Equivalenced Variables (Correct) 11-21 Example 11-13. FIELDALIGN Clause in Structured Equivalenced Variables 11-22 Example 11-14. Equivalenced Simple Variable Declaration 11-24 Example 11-15. Equivalenced Definition Structure Declaration 11-25 Example 11-16. Equivalenced Referral Structure Declaration 11-26 Example 11-17.
Examples (continued) Contents Examples (continued) Example 12-27. MOVE Statement Copying Bracketed and Unbracketed Constants 12-31 Example 12-28. MOVE Statement Copying From One Structure to Another 12-31 Example 12-29. MOVE Statement Copying a Substructure 12-32 Example 12-30. MOVE Statement With Destination Shorter Than Source 12-32 Example 12-31. FILL16 Statement 12-33 Example 12-32. RETURN Statements Nested in an IF Statement 12-35 Example 12-33.
Examples (continued) Contents Examples (continued) Example 13-7. Example 14-1. Example 14-2. Example 14-3. Example 14-4. Example 14-5. Example 14-6. Example 14-7. Example 14-8. Example 14-9. Example 14-10. Example 14-11. Example 14-12. Example 14-13. Example 14-14. Example 14-15. Example 14-16. Example 14-17. Example 14-18. Example 14-19. Example 14-20. Example 14-21. Example 15-1. Example 15-2. Example 15-3. Example 15-4. Example 15-5. Example 15-6. Example 15-7. Example 15-8. Example 15-9.
Examples (continued) Contents Examples (continued) Example 15-15. Example 15-16. Example 15-17. Example 15-18. Example 15-19. Example 15-20. Example 15-21. Example 15-22. Example 15-23. Example 15-24. Example 15-25. Example 15-26. Example 15-27. Example 15-28. Example 15-29. Example 15-30. Example 15-31. Example 15-32. Example 15-33. Example 15-34. Example 15-35. Example 15-36. Example 15-37. Example 15-38. Example 15-39. Example 15-40. Example 15-41. Example 15-42. Example 15-43. Example 15-44.
Examples (continued) Contents Examples (continued) Example 15-53. Example 15-54. Example 15-55. Example 15-56. Example 15-57. Example 15-58. Example 15-59. Example 15-60. Example 15-61. Example 15-62. Example 15-63. Example 15-64. Example 15-65. Example 15-66. Example 15-67. Example 15-68. Example 15-69. Example 15-70. Example 15-71. Example 15-72. Example 15-73. Example 15-74. Example 15-75. Example 15-76. Example 15-77. Example 15-78. Example 15-79. Example 15-80. Example 15-81. Example 15-82.
Examples (continued) Contents Examples (continued) Example 15-91. Example 15-92. Example 15-93. Example 15-94. Example 15-95. Example 15-96. Example 16-1. Example 16-2. Example 16-3. Example 16-4. Example 16-5. Example 16-6. Example 17-1. Example 17-2. Example 17-3. Example 17-4. Example 17-5. Example 17-6. Example 17-7. Example 17-8. Example 17-9. Example 17-10. Example 17-11. Example 17-12. Example 17-13. Example 17-14. Example 17-15. Example 17-16. Example 17-17. Example 17-18. Example 17-19.
Examples (continued) Contents Examples (continued) Example 17-25. Example 17-26. Example 17-27. Example 17-28. Example 17-29. Example 17-30. Example 17-31. Example 17-32. Example 17-33. Example 17-34. Example 17-35. Example 17-36. Example 17-37. Example 17-38. Example 17-39. Example B-1. Example B-2. Example D-1. Example D-2. Example D-3.
Figures (continued) Contents Figures (continued) Figure 11-3. Figure 11-4. Figure 11-5. Figure 16-1. Figure 16-2. Figure 16-3. Figure 16-4. Figure 16-5.
Tables (continued) Contents Tables (continued) Table 5-8. Table 5-9. Table 5-10. Table 5-11. Table 5-12. Table 5-13. Table 5-14. Table 5-15. Table 5-16. Table 5-17. Table 5-18. Table 9-1. Table 9-2. Table 9-3. Table 9-4. Table 9-5. Table 9-6. Table 9-7. Table 9-8. Table 10-1. Table 10-2. Table 11-1. Table 11-2. Table 11-3. Table 11-4. Table 12-1. Table 13-1. Table 14-1. Table 15-1. Table 15-2. Table 15-3. Table 15-4. Table 15-5. Table 15-6. Table 15-7. Table 15-8. Table 15-9. Table 15-10.
Tables (continued) Contents Tables (continued) Table 15-11. Table 15-12. Table 15-13. Table 15-14. Table 15-15. Table 16-1. Table 17-1. Table 17-2. Table 17-3. Table 18-1.
What’s New in This Manual Manual Information HP pTAL Reference Manual Abstract This publication describes the syntax of pTAL, the Portable Transaction Application Language for HP NonStop™ systems [TNS/R pTAL compiler (T9248) and TNS/E EpTAL compiler (T0561)] for system and application programmers. Product Version pTAL D44 EpTAL H01 Supported Release Version Updates (RVUs) This publication supports D44.00, G06.20, H06.
New What’s New in This Manual Topics: • • • New on page xxxii Moved on page xxxii Changed on page xxxiii New • • • • • • • • • • • EpTAL, pTAL, and TAL Compilers on page 1-2 Scope on page 2-10 STRUCTALIGN (MAXALIGN) Attribute on page 9-32 Example 14-11, Subprocedure Entry-Point Identifiers, on page 14-25 $TRIGGER on page 15-88 Table 17-2, Compiler Directives by Name, on page 17-16 Migrating from TNS/R to TNS/E on page 17-11 In Appendix A, Syntax Summary, links to the full syntax descriptions Appendix
Changed What’s New in This Manual • In Appendix A, Syntax Summary: ° The following declarations were moved from Privileged Procedures (which was deleted) to Declarations on page A-7: ° ° ° ° ° ° ° System Global on page A-22 'SG'-Equivalenced Simple Variable on page A-26 'SG'-Equivalenced Definition Structure on page A-26 'SG'-Equivalenced Referral Structure on page A-27 'SG'-Equivalenced Simple Pointer on page A-27 'SG'-Equivalenced Structure Pointer on page A-28 What were previously called “standar
Changed What’s New in This Manual • • • • • • • • GOTO on page 12-23 Testing Address Types on page 12-27 RETURN on page 12-34 Section 13, Hardware Indicators (reorganized and corrected) Procedure Attributes on page 14-5 $READTIME on page 15-81 Linking Object Files on page 16-7 (reorganized and updated) Section 17, Compiler Directives: ° Toggles on page 17-5 was created from information that was (and is no longer) repeated in each of: ° ° ° ° SETTOG on page 17-56 RESETTOG on page 17-52 Saving and Usi
Changed What’s New in This Manual • • • ° Table 17-1, Compiler Directives by Category, on page 17-14, no longer lists each directive’s alternatives (some directives have eight) or highlights its default alternative (which can differ for the pTAL and EpTAL compilers) ° Table 17-3, Data Block Names, on page 17-20 Section 18, pTAL Cross Compiler was updated with TNS/E information Glossary entries (see change bars) Miscellaneous minor changes (identified by change bars) HP pTAL Reference Manual—523746-0
Changed What’s New in This Manual HP pTAL Reference Manual—523746-005 xxxvi
About This Manual The Portable Transaction Application Language for HP NonStop systems (pTAL) is a high-level, block-structured language used to write systems software and transactionoriented applications.
Additional Information About This Manual Table i. Related Manuals Manual Description pTAL Conversion Guide Provides information needed to convert TAL programs to pTAL programs. pTAL Guidelines for TAL Programmers Gives guidelines for writing TAL code that you can migrate later to pTAL code with as few changes as possible. TAL Programmer’s Guide Helps you get started in creating, structuring, compiling, running and debugging programs.
Additional Information About This Manual Table iii.
Additional Information About This Manual Table iv.
Notation Conventions About This Manual Table iv.
Syntax Diagram Conventions About This Manual To use a railroad diagram, follow the direction of the arrows and specify syntactic items as indicated by the diagram pieces: Diagram Piece Meaning Type KEYWORD as shown. You can type letters in uppercase or lowercase. KEYWORD VST412.vsd Replace item with a value that fits its description, which follows the syntax diagram. item VST413.vsd Type content (punctuation mark, symbol, or letter) as shown. You can type a letter in uppercase or lowercase.
Syntax Diagram Conventions About This Manual Spacing rules are: • If the arrow between two diagram pieces is labelled “ns,” put no spaces between the syntactic items that they represent. For example: ns volume $ VST420.vsd means that you type: $NEWVOL not $ NEWVOL • An “ns” on the top line of a choice structure applies to the lower lines in the choice structure as well. For example: ns " ns RETURN^SORT^ERRORS " RETURN_SORT_ERRORS_ VST185.
Syntax Diagram Conventions About This Manual • If two diagram pieces are separated by a separator character, separating the syntactic items that they represent by spaces is optional. For example: MULTIPLY integer1 , integer2 VST411.vsd means that you type: MULTIPLY 3,4 or MULTIPLY 3, 4 • If a diagram piece is immediately followed by a period, putting spaces between the syntactic item and the period is optional. For example: END PROGRAM program-name . VST374.
Notation for Messages About This Manual Notation for Messages The following list summarizes the notation conventions for the presentation of displayed messages in this manual. Bold Text. Bold text in an example indicates user input entered at the terminal. For example: ENTER RUN CODE ?123 CODE RECEIVED: 123.00 The user must press the Return key after typing the input. Nonitalic text. Nonitalic letters, numbers, and punctuation indicate text that is displayed or returned exactly as shown.
Change Bar Notation About This Manual % Percent Sign. A percent sign precedes a number that is not in decimal notation. The % notation precedes an octal number. The %B notation precedes a binary number. The %H notation precedes a hexadecimal number. For example: %005400 %B101111 %H2F Change Bar Notation Change bars are used to indicate substantive differences between this edition of the manual and the preceding edition.
1 Introduction to pTAL pTAL is based on the HP Transaction Application Language (TAL). You can compile pTAL source code with either the pTAL or EpTAL compiler.
EpTAL, pTAL, and TAL Compilers Introduction to pTAL EpTAL, pTAL, and TAL Compilers Note. This topic includes only enough information about the TAL compiler to compare it to the EpTAL and pTAL compilers. For complete information about the TAL compiler, see: • • • TAL Reference Manual TAL Programmer’s Guide TAL Programmer’s Guide Data Alignment Addendum You can compile pTAL source programs using either the pTAL compiler or the EpTAL compiler. Table 1-1.
pTAL Applications Introduction to pTAL For more information: Topic Source Itanium® chips used in TNS/E systems Intel Itanium Architecture Software Developer’s Manual RISC chips used in TNS/R systems MIPS RISC Architecture by Gerry Kane and Joe Heinrich TNS/R or TNS/E architecture System description manual for your system Compiling pTAL source programs Section 16, Compiling and Linking pTAL Programs pTAL Applications The pTAL language is appropriate for writing applications where optimal performa
pTAL Features Introduction to pTAL pTAL Features • • • • • • • • • • • • • Procedures on page 1-4 Subprocedures on page 1-4 Private Data Area on page 1-4 Recursion on page 1-5 Parameters on page 1-5 Data Types on page 1-5 Data Grouping on page 1-5 Pointers on page 1-6 Data Operations on page 1-6 Bit Operations on page 1-6 Built-in Routines on page 1-6 Compiler Directives on page 1-6 Modular Programming on page 1-6 Procedures Each pTAL program contains one or more procedures.
Recursion Introduction to pTAL Recursion Because each activation of a procedure or subprocedure has its own data area, a procedure or subprocedure can call itself or can call another procedure that in turn calls the original procedure. Parameters A procedure or subprocedure can have optional or required parameters. The same procedure or subprocedure can process different sets of variables sent by different calls to it.
Pointers Introduction to pTAL Pointers A pTAL program can declare pointers (variables that can contain addresses) and use them to access locations throughout memory. You can store addresses in pointers when you declare them or later in your program. Data Operations A pTAL program can copy a contiguous group of words or bytes and compare one group with another. It can scan a series of bytes for the first byte that matches (or fails to match) a given character.
System Procedures Introduction to pTAL System Procedures The file system treats all devices as files, including disk files, disk packs, terminals, printers, and programs running on the system. File-system procedures provide a file-access method that lets you ignore the peculiarities of devices. Your program can refer to a file by the file’s symbolic name without knowing the physical address or configuration status of the file.
pTAL and the CRE Introduction to pTAL HP pTAL Reference Manual—523746-005 1 -8
2 Language Elements The elements that make up the pTAL language include: • • • • • • • • • Character Set on page 2-2 Keywords on page 2-2 Delimiters on page 2-4 Operators on page 2-5 Base Address Symbols on page 2-7 Indirection Symbols on page 2-7 Declarations on page 2-8 Constants on page 2-12 Statements on page 2-12 HP pTAL Reference Manual—523746-005 2 -1
Character Set Language Elements Character Set pTAL supports the complete ASCII character set, which includes: • • • Uppercase and lowercase alphabetic characters (A through Z.) Numeric characters (0 through 9) Special characters Table 2-1.
Keywords Language Elements . Table 2-2. Reserved Keywords AND DOWNTO INT PROC SGXWADDR ASSERT ELSE INTERRUPT PROCADDR UNTIL BADDR END LABEL PROCPTR USE BEGIN ENTRY LAND REAL VARIABLE BY EXTERNAL LITERAL REFALIGNED VOLATILE CALL EXTADDR LOR RESIDENT WADDR CALLABLE FIELDALIGN MAIN RETURN WHILE CASE FIXED NOT RSCAN XOR CBADDR FOR OF SCAN SGXWADDR CWADDR FORWARD OR SGBADDR DEFINE GOTO OTHERWISE SGWADDR DO IF PRIV SGXBADDR Table 2-3.
Delimiters Language Elements Table 2-3. Nonreserved Keywords (page 2 of 2) Keyword Restrictions SHARED8 None UNSPECIFIED None WORDS Not to be used as an identifier of a LITERAL or DEFINE Delimiters Delimiters are symbols that begin, end, or separate fields of information. Delimiters tell the compiler how to handle the fields of information. Table 2-4.
Operators Language Elements Table 2-4.
Operators Language Elements Table 2-5. Operators (page 2 of 2) Context Operator Description Template structure (*) Template structure declaration FIXED(*) parameter type (*) Value parameter to be treated as FIXED Bit-field access .
Base Address Symbols Language Elements Base Address Symbols Base address symbols let you declare pointers to specific data segments. Table 2-6. Base Address Symbols Symbol Description 'P' P-register addressing (read-only array declaration) 'SG' Define base address equivalencies, system global space (privileged procedures only) 'SGX' References data in the system data segment. Indirection Symbols Indirection symbols determine the address types of variables.
Declarations Language Elements Declarations Declarations allocate storage and associate identifiers with declarable objects in a program; that is: • • • • • Variables LITERALs and DEFINEs (see Section 6, LITERALs and DEFINEs) Procedures (see Section 14, Procedures, Subprocedures, and Procedure Pointers) Labels (see Labels in Procedures on page 14-37) Entry points (see Entry-Point Declarations on page 14-22) Topics: • • • Identifiers on page 2-8 Variables on page 2-10 Scope on page 2-10 Identifiers I
Identifiers Language Elements Example 2-1. Correct Identifiers a2 HP _2345678012_31_characters name_with_exactly_31_characters Example 2-2. Incorrect Identifiers Identifier Problem 2abc Begins with a number ab%99 Contains % symbol VARIABLE Reserved word Each identifier belongs to an identifier class. The compiler determines the identifier class based on how you declare the identifier. . Table 2-8.
Variables Language Elements Variables A variable is a symbolic representation of data. It can be a single-element variable or a multiple-element variable. You use variables to store data that can change during program execution. Before you can access data stored in a variable you must either: • • Initialize the variable with a value when you declare the variable Assign a value to the variable after you declare the variable . Table 2-9.
Scope Language Elements Example 2-3. Scope of Declared Items int i; ! i has global scope and is visible everywhere ! from this point forward. proc p; ! p has global scope. If p had formal ! parameters, they would have local scope. begin int j := i; subproc s; ! j has local scope and is visible everywhere in ! procedure p from this point forward. ! s has local scope. If s had formal parameters, ! they would have sublocal scope.
Constants Language Elements Constants A constant is a value you can store in a variable, declare as a LITERAL, or use as part of an expression. Constants can be numbers or character strings. The following are examples of constants: Constant Type Example Character string "abc" Numeric 654 You can specify numeric constants in binary, octal, decimal, or hexadecimal base, depending on the data type of the item. The default number base in pTAL is decimal.
3 Data Representation A program operates on data—variables and constants—which it stores in the storage units that Table 3-1 on page 3-1 describes. Table 3-1. Storage Units Storage Unit Number of Bits Description Byte 8 Smallest addressable unit of memory.
Data Types Data Representation Table 3-2. Data Types (page 2 of 2) Data Type Storage Unit1 INT INT(16)2 Word Values the Data Type Can Represent • • • String of one or two ASCII characters Unsigned 6-bit integer in the range 0 through 65,535 Signed 6-bit integer in the range -32,768 through 32,767 INT(32) Doubleword 32-bit integer in the range -2,147,483,648 through +2,147,483,647 REAL REAL(32)4 Doubleword 32-bit floating-point number in the range ±8.6361685550944444E-78 through ±1.
Specifying Data Types Data Representation Specifying Data Types The syntax for specifying the data type in a variable declaration is: STRING INT REAL ( width ) UNSIGNED ( width ) ( fpoint ) FIXED * VST214.vsd width is a constant expression that specifies the width, in bits, of the variable.
Data Type Aliases Data Representation *(asterisk) prevents scaling of the initialization values (for an explanation of scaling, see Scaling of FIXED Operands on page 5-7). Example 3-1.
Address Types Data Representation The data type of a variable also determines which built-in routines you can use with the variable (see Section 15, Built-In Routines). Address Types Every identifier that you declare has both a data type and an address type. The data type describes the data item itself. The address type describes the address of the data item. If you declare a pointer to the data item, the value that you assign to the pointer must be of that address type.
Address Types Data Representation Table 3-4.
Storing Addresses in Variables Data Representation Storing Addresses in Variables You can store an address into a variable when either of the following is true: • • The address is the same data type as the variable into which you are storing the address. The address is convertible to the data type of the variable into which you are storing the address.
Converting Between Address Types Data Representation The compiler generates code for implicit conversions for the following operations: • Block moves and compares The compiler automatically converts an address type if required for the source or destination pointer in a block move or block compare instruction.
Using Indexes to Access Array Elements Data Representation Table 3-5.
Data Representation Incrementing and Decrementing Addresses (Stepping Pointers) Incrementing and Decrementing Addresses (Stepping Pointers) You can increment or decrement the value of a pointer (step a pointer) by: • • • • • • Using Arithmetic Operations to Adjust Addresses on page 3-10 Computing the Number of Bytes Between Addresses on page 3-11 Comparing Addresses to Addresses on page 3-11 Comparing Addresses to Constants on page 3-11 Comparing PROCADDRs and PROCPTRs on page 3-11 Testing a Pointer for
Data Representation Incrementing and Decrementing Addresses (Stepping Pointers) If you increment or decrement a pointer, the number that you add to, or subtract from, a byte address (such as BADDR) is the number of bytes to move the pointer. Similarly, the number that you add to a word address (such as WADDR) is the number of 16-bit words to move the pointer, not the number of 32-bit words.
Constants Data Representation Testing a Pointer for a Nonzero Value You can test a pointer for a nonzero value without specifying the constant zero. For example, if i is declared: int .i; Then these two statements are equivalent: if (@i) then ... if (@i <> 0) ... You can test an EXTADDR pointer for a nonzero value without specifying the constant zero. For example, if j is declared: int.ext j; Then these two statements are equivalent: if (@j) then ... if (@j <> 0D) ...
Character String Data Representation string is a sequence of one or more ASCII characters enclosed in quotation mark delimiters. If a quotation mark is a character within the sequence of ASCII characters, use two quotation marks (in addition to the quotation mark delimiters). The compiler does not upshift lowercase characters. Each character in a character string requires one byte of contiguous storage.
STRING Numeric Data Representation STRING Numeric Representation Unsigned 8-bit integer Range 0 through 255 integer base VST002.vsd base indicates a number base as follows: Octal % Binary %b Hexadecimal %h If you omit the base, the default base is decimal.
INT Numeric Data Representation INT Numeric Representation Signed or unsigned 16-bit integer Range (unsigned) 0 through 65,535 Range (signed) -32,768 through 32,767 integer base + - VST027.vsd base indicates a number base as follows: Octal % Binary %b Hexadecimal %h The default base is decimal.
INT(32) Numeric Data Representation INT(32) Numeric Representation Signed or unsigned 32-bit integer Range -2,147,483,648 through 4,294,967,295 ns D integer base + ns %D VST028.vsd base indicates a number base as follows: Octal % Binary %b Hexadecimal %h The default base is decimal.
FIXED Numeric Data Representation Examples of INT(32) numeric constants: Decimal 0D +14769D -327895066d Octal %1707254361d -%24700000221D Binary %B000100101100010001010001001d Hexadecimal %h096228d%d -%H99FF29%D For readability, always specify the % in the %D hexadecimal suffix to prevent the suffix from being confused with the integer part of the constant.
FIXED Numeric Data Representation integer is one or more of the following digits: Decimal 0 through 9 Octal 0 through 7 Binary 0 or 1 Hexadecimal 0 through 9, A through F fraction is one or more decimal digits. fraction is legal only for decimal base. F %F are suffixes that specify FIXED constants: Decimal F Octal F Binary F Hexadecimal %F Examples of FIXED numeric constants: Decimal 1200.09F 0.1234567F 239840984939873494F -10.
REAL and REAL(64) Numeric Data Representation REAL and REAL(64) Numeric integer . fraction + - E L exponent + VST006.vsd Representation Signed 32-bit REAL or 64-bit REAL(64) floating-point number Range ±8.6361685550944446 * 10-78 through ±1.15792089237316189 * 10+77 Precision REAL—to approximately 6.5 significant decimal digits REAL(64)—to approximately 16.5 significant decimal digits integer is one or more decimal digits that compose the integer part.
REAL and REAL(64) Numeric Data Representation Examples of REAL and REAL(64) numeric constants, showing the integer part, the fractional part, the E or L suffix, and the exponent part: Decimal Value REAL REAL(64) 0 0.0E0 0.0L0 2 2.0e0 0.2E1 20.0E-1 2.0L0 0.2L1 20.0L-1 -17.2 -17.2E0 -1720.0E-2 -17.2L0 -1720.0L-2 The system stores the number in binary scientific notation in the form: x * 2y x is a value of at least 1 but less than 2.
Constant Lists Data Representation Constant Lists A constant list is a list of one or more constants. You can use constant lists in: • • • initializations of array declarations that are not contained in structures group comparison expressions move statements You cannot use constant lists in assignment statements repetition-constant-list ] repetition-constant-list [ FIELDALIGN-clause constant-list-seq VST621.vsd repetition-constant-list [ repetition-factor constant-list-seq ] * VST008.
Constant List Alignment Specification Data Representation FIELDALIGN-clause FIELDALIGN ( SHARED2 ) SHARED8 VST065.vsd specifies how you want the compiler to align the base of the structure and fields in the structure. The offsets of fields in a structure are aligned relative to the base of the structure. For more information about constant list alignment, see Constant List Alignment Specification on page 3-22.
Constant List Alignment Specification Data Representation Examples of constant lists: 1. In each of the following pairs, the list on the left is equivalent to the list on the right: [ "A", "BCD" , "...", "Z" ] [ "ABCD...Z" ] 10 * [0]; [0,0,0,0,0,0,0,0,0,0] [3 * [2 * [1], 2 * [0]]] [1,1,0,0,1,1,0,0,1,1,0,0] 10 * [" "] [" "] 2. The following is an example of the FIELDALIGN clause: STRING i [0:3] := FIELDALIGN(SHARED2) [0,1,2,3]; 3.
Data Representation Constant List Alignment Specification HP pTAL Reference Manual—523746-005 3- 24
4 Data Alignment In native mode, a data item is aligned if its address is a multiple of its size. For example, a 4-byte data item is aligned if its address is a multiple of four. An address that is not aligned is called misaligned. In native mode, a compiler requires data to be aligned unless otherwise indicated. Unexpected misalignment causes the program to run slowly, but usually with the expected results.
Misalignment Tracing Facility Data Alignment When a misaligned address causes an exception that RVUs prior to G06.17 would have rounded down, the tracing facility traces the exception. Note. The tracing facility does not count and trace every misaligned address, only those that cause round-down exceptions. Other accesses that use misaligned addresses without rounding them down do not cause exceptions and are not counted or traced.
Misalignment Handling Data Alignment Misalignment Handling Misalignment handling is determined by the following SCF attributes, which are set system-wide (that is, for all processors in the node) by the persons who configure the system: • • • MISALIGNLOG TNSMISALIGN (applies only to programs running in TNS mode or TNS accelerated mode, and therefore, does not apply to pTAL programs) NATIVEATOMICMISALIGN MISALIGNLOG enables or disables the tracing facility (see Misalignment Tracing Facility on page 4-1)
Misalignment Handling Data Alignment HP pTAL Reference Manual—523746-005 4 -4
5 Expressions An expression is a sequence of operands and operators that, when evaluated, produces a single value. Operands in an expression include variables, constants, and routine identifiers. Operators in an expression perform arithmetic or conditional operations on the operands. pTAL supports the following types of expressions: Expression Description Examples Arithmetic expression An expression, consisting of operands and arithmetic operators, that produces a single numeric value.
Data Types of Expressions Expressions Topics: • • • • • • • • • • Data Types of Expressions on page 5-2 Operator Precedence on page 5-3 Arithmetic Expressions on page 5-5 Signed Arithmetic Operators on page 5-6 Unsigned Arithmetic Operators on page 5-8 Comparing Addresses on page 5-11 Constant Expressions on page 5-14 Conditional Expressions on page 5-15 Special Expressions on page 5-20 Bit Operations on page 5-31 Data Types of Expressions The result of an expression can be any data type or address typ
Operator Precedence Expressions Operator Precedence Operators in expressions can be arithmetic (signed, unsigned, or logical) or conditional (relational, signed or unsigned). Within an expression, the compiler evaluates the operators in the order of precedence. Within each level of precedence, the compiler evaluates the operators from left to right. Table 5-1.
Operator Precedence Expressions Table 5-1.
Arithmetic Expressions Expressions Arithmetic Expressions An arithmetic expression is a sequence of operands and arithmetic operators that computes a single numeric value of a specific data type. operand arithmetic-operator + operand VST010.vsd + are unary plus and minus operators. The default is unary plus. operand is one of the elements in Table 5-2 on page 5-5.
Signed Arithmetic Operators Expressions Table 5-3.
Scaling of FIXED Operands Expressions Table 5-5. Signed Arithmetic Operand and Result Types (page 2 of 2) Operand Type Operand Type Result Type Example INT UNSIGNED(1-16) INT word + unsign12 INT(32) UNSIGNED(17-31) INT(32) double + unsign20 UNSIGNED(1-16) UNSIGNED(1-16) INT unsign6 + unsign9 UNSIGNED(17-31) UNSIGNED(17-31) INT(32) unsign26 + unsign31 The compiler treats a STRING or UNSIGNED(1-16) operand as an INT operand.
Using FIXED(*) Variables Expressions Using FIXED(*) Variables pTAL does not scale data items that it stores into FIXED(*) items. The following procedure has one local variable whose data type is FIXED(*): PROC p; BEGIN FIXED(*) f; f := 1234F; END; The data type of a FIXED(*) variable is the same as a FIXED variable when it is used in an expression: FIXED(*) f1 := 123F; FIXED(2) f2; f2 := f1; ! f2 is assigned 123.00 pTAL does not scale data when it is stored into a FIXED(*) variable: FIXED(2) f1 := 1.
Unsigned Arithmetic Operators Expressions Table 5-6. Unsigned Arithmetic Operators (page 2 of 2) Operator Operation Operand Type Example '/' Unsigned division INT(32) or UNSIGNED (17-31) dividend and STRING, INT, or UNSIGNED(1-16) divisor alpha '/' beta '\' Unsigned remainder* INT(32) or UNSIGNED (17-31) dividend and STRING, INT, or UNSIGNED(1-16) divisor alpha '\' beta * If the quotient exceeds 16 bits, an overflow condition occurs and the results will have unpredictable values.
Bitwise Logical Operators Expressions Bitwise Logical Operators Use bitwise logical operators (LOR, LAND, and XOR) to perform bit-by-bit operations on STRING, INT, UNSIGNED(1-16) operands. Use INT(32) operands to return INT(32) results. 16-bit operands produce a 16-bit result. 32-bit operands produce a 32-bit result. Bitwise logical operators are not defined for 64-bit operands. Table 5-8.
Comparing Addresses Expressions • Unsigned addition and subtraction operators ('+' and '-') The INT(32) operands are treated as nonnegative values in the range 0 to 232-1. Unsigned and signed addition and subtraction are the same except that $OVERFLOW on page 15-76 returns false after an unsigned operation. • Unsigned multiplication operator ('*') The INT(32) operands are treated as nonnegative values in the range 0 to 232-1. The unsigned product of two INT(32) values is an FIXED value.
Extended Addresses Expressions Extended Addresses The following rules apply when you compare extended addresses (EXTADDRs): • • Use signed relational operators to compare extended addresses. Unsigned operators are not valid. If you compare an extended address to a constant, the constant must be a 32-bit integer. Example 5-1. Extended Addresses EXTADDR e; INT .EXT i; IF e < @i THEN ... IF @i >= 0D THEN ... IF e = 0D THEN ... IF e <> 0D THEN ... IF e THEN ... IF NOT e THEN ... IF e > i THEN ...
Nonextended Addresses Expressions • If one operand of a relational operator is a nonextended address and the other is a constant, the constant must be 16 bits in length: INT .p; IF @p = 100 THEN ... IF @p = 100D THEN ... ! OK ! ERR Table 5-10. Valid Address Expressions (page 1 of 2) Template Result Type Examples atype [k]; atype * INT .EXT p; @p := @p[2]; atype '+' INT16 atype * INT .p; @p := @p '+' 2; @p := @p '-' 4; int16 '+' atype atype * INT .
Constant Expressions Expressions Table 5-10. Valid Address Expressions (page 2 of 2) Template Result Type Examples EXTADDR relational EXTADDR INT EXTADDR b1, b2; INT i; IF b1 < b2 THEN ...; i := b1 < b2; relational must be a signed relational operation (<, =, >, <=, <>, >=). INT atype relational CONSTANT BADDR b1; INT i; IF b1 '>' 100 THEN ...; i := b1 '<>' nil; relational must be an unsigned relational operation ('<', '=', '>', '<=', '<>', '>=') or signed equal or not equal (=, <>).
Conditional Expressions Expressions Conditional Expressions A conditional expression is a sequence of conditions and relational operators that establishes the relationship between values. You can use conditional expressions to direct program flow. condition NOT AND OR VST996.vsd NOT is an operator that produces a true state if condition has the value false: Value of a Value of NOT a True False False True condition is an expression whose value is either true or false.
Conditional Expressions Expressions Table 5-11. Conditional Expressions Syntax Example condition a NOT condition NOT a condition OR condition a OR b condition AND condition a AND b condition AND NOT condition a AND NOT b OR c Table 5-12. Conditions in Conditional Expressions Element Description Example Relational expression Two conditions connected by a relational operator. The result type is INT; a -1 if true or a 0 if false. The example is true if A equals B. If a = b THEN ...
NOT, OR, and AND Operators Expressions Topics: • • NOT, OR, and AND Operators on page 5-17 Relational Operators on page 5-18 NOT, OR, and AND Operators You use the operators NOT, OR, and AND to set the state of a single value or the relationship between two values. Table 5-13.
Relational Operators Expressions NOT, OR, and AND Operators and Condition Codes If the root operator in the conditional expression of an IF statement is a relational operator (<, =, >, <=, <>, >=, '<', '=', '>', '<=', '<>', '>='), pTAL sets the condition code according to the result of the comparison. Relational operators that test the condition code (for example, IF < THEN...) do not set the condition code.
Relational Operators Expressions Unsigned Relational Operators Unsigned relational operators perform unsigned comparison of two operands and return a true or false state. Table 5-15.
Special Expressions Expressions Special Expressions Special expressions allow you to perform specialized arithmetic or conditional operations. Table 5-16.
CASE Expressions 3. This example mixes the assignment form with a relational form. It assigns the value of b to a, then checks for equality with 0: IF (a := b) = 0 THEN ... ; CASE The CASE expression selects one of several expressions. CASE selector OF BEGIN expression-1 ; END OTHERWISE expression-2 ; VST013.vsd selector is an arithmetic expression [INT or INT(32)] that selects the expression to evaluate. expression-1 is an expression of any data type.
CASE Expressions • All fixed-point data types are compatible with each other; however, if expression-1 and expression-2 are differently scaled fixed-point expressions, the data type of the IF expression is the data type of the fixed-point expression whose scale factor is largest. The smaller operand is implicitly scaled to match the type of the IF expression.
IF Expressions IF The IF expression selects one of two expressions, usually for assignment to a variable. IF condition THEN expression-1 ELSE expression-2 VST014.vsd condition is either: • • A conditional expression An INT arithmetic expression. If the result of the arithmetic expression is not 0, the condition is true. If the result is 0, condition is false.
Group Comparison Expressions You can nest IF expressions within an IF expression or within other expressions. The IF expression resembles the IF on page 12-26 except that the IF expression: • • Requires the ELSE clause Contains expressions, not statements Examples of IF expressions: 1. This example assigns an arithmetic expression to var based on the condition length > 0: var := IF length > 0 THEN 10 ELSE 20; 2.
Group Comparison Expressions relational-operator is one of the following operators: Signed relational operator <, =, >, <=, >=, <> Unsigned relational operator '<', '=', '>', '<=', '>=', '<>' All comparisons are unsigned whether you use a signed or unsigned operator. var-2 is the identifier of a variable, with or without an index, to which var-1 is compared. var-2 can be a simple variable, array, read-only array, simple pointer, structure, structure item, or structure pointer.
Group Comparison Expressions count-unit is BYTES, WORDS, or ELEMENTS. count-unit changes the meaning of count to the following: BYTES Compares count bytes; however, if var-1 and var-2 both have word addresses, BYTES implicitly generates a word comparison for (count +1)/2 words. WORDS Compares count words. ELEMENTS Compares count elements.
Group Comparison Expressions constant-list is a list of one or more constants, which are concatenated and compared to var-1. Specify constant-list in the form shown in Section 3, Data Representation. next-addr is a variable to contain the address of the first byte or word in var-1 that does not match the corresponding byte or word in var-2. The compiler returns a 16-bit or 32-bit address as described in the following subsection. pTAL programs access all data using byte addresses.
Group Comparison Expressions Figure 5-2. Ending Address After Comparing INT Strings (page 2 of 2) P User Data Segment A B C D A X X Y VST131.vsd Figure 5-3 on page 28 is the same as Figure 5-2 on page 5-27 except that in Figure 5-3 on page 5-28, y is a 2-byte STRING array. The IF statement, therefore, compares x to y on a byte-by-byte basis. Because the first (upper) bytes of x and y are equal, the comparison continues to the second byte.
Group Comparison Expressions Testing Group Comparisons If you use a group comparison in an IF statement, you can test the condition code after the group comparison is evaluated by setting by using the following relational operators (with no operands) in a conditional expression: Operator Meaning < CCL if var-1 '<' var-2 = CCE if var-1 = var-2 > CCG if var-1 '>' var-2 See Example 5-5 on page 5-30.
Group Comparison Expressions Example 5-5. Array Comparison INT d_array[0:9]; INT s_array[0:9]; ! Code to assign values to arrays IF d_array = s_array FOR 10 ELEMENTS -> @pointer THEN BEGIN ! They matched ! Do something END ELSE IF < THEN ... ; ! Pointer points to element of d_array ! Do something else that is less than the corresponding ! element of s_array When you compare array elements (as in Example 5-5 on page 5-30), the ELEMENTS keyword is optional but provides clearer source code.
Bit Operations Expressions Bit Operations You can access individual bits or groups of bits in a STRING or INT variable. Table 5-17.
Bit Extractions Expressions You can perform bit extractions and deposits on 16-bit and 32-bit items. pTAL reports an error, however, if you attempt to reference bits outside of the bits declared in the variable’s declaration. Example 5-8. Bit Extraction INT UNSIGNED(4) STRING INT(32) i; j; k; l; i := j.<7:11>; ! ERROR: You can reference only bits 12 ! through 15 of j i := k.<0:7>; ! ERROR: You can reference only bits 8 ! through 15 of k i := l.
Bit Shifts Expressions Bit Shifts A bit shift operation shifts a bit field a specified number of positions to the left or to the right within a variable without altering the variable. RISC and Itanium architectures do not include a signed left-shift operation, so pTAL compiles a signed left shift (for example, i << 8) as an unsigned left shift (i '<<' 8). int-expression shift-operator positions dbl-expression VST017.vsd int-expression is an INT arithmetic expression.
Bit Shifts Expressions The compiler implements arithmetic left shifts as unsigned left shifts (and warns you when it does this). Most programs do not need to perform signed left shifts. If your program does require an arithmetic left shift, use the functions in Example 5-12 on page 5-34 to perform signed left-shift operations. Example 5-12. Arithmetic Left Shift INT PROC ashift16(a, count); INT a, count; BEGIN STRUCT s = a; BEGIN UNSIGNED(1) sign_bit; UNSIGNED(15) rest; END; s.rest := s.
Bit Shifts Expressions Bit-shift operations include: Operation User Action Multiplication by powers of 2 For each power of 2, shift the field one bit to the left. (Some data might be lost.) Unsigned division by powers of 2 For each power of 2, shift the field one bit to the right (Some data might be lost.) Word-to-byte address conversion Shift the word address one bit to the left by using an unsigned shift operator. Bit shift examples: 1.
Bit Shifts Expressions HP pTAL Reference Manual—523746-005 5- 36
6 LITERALs and DEFINEs A LITERAL declaration associates identifiers with constant values. A DEFINE declaration associates identifiers (and parameters if any) with text. You can declare LITERALs and DEFINEs once in a program, and then refer to them by identifier many times throughout the program. They allow you to efficiently make significant changes in the source code. You only need to change the declaration, not every reference to it in the program.
Declaring Literals LITERALs and DEFINEs constant is one of the following: • • A character string of 1 to 4 characters. Any of the following numeric constant expressions whose value is not the address of a global variable (global variables are relocatable during linking): ° ° ° ° ° ° FIXED(n) INT INT(32) REAL REAL(64) UNSIGNED(n) If you omit any constants, the compiler supplies the omitted numeric constants.
Declaring DEFINEs LITERALs and DEFINEs Example 6-1.
Declaring DEFINEs LITERALs and DEFINEs param-list ( param-name ) , VST994.vsd param-name is the identifier of a formal parameter. You can specify up to 31 formal parameters. An actual parameter can be up to 500 bytes. A formal parameter cannot be a pTAL reserved word. define-body specifies all characters between the = and # delimiters. define-body can span multiple source lines. Enclose character strings in quotation marks (").
Calling DEFINEs LITERALs and DEFINEs Example 6-2. DEFINE Declarations Parentheses direct the DEFINE body evaluation: DEFINE value = ( (45 + 22) * 8 / 2 ) #; Incrementing and decrementing utilities included: DEFINE increment (x) = x := x + 1 #; DEFINE decrement (y) = y := y - 1 #; Loads numbers into specified bit positions: DEFINE word_val (a, b) = ((a) '<<' 12) LOR (b) #; When a STRUCT item and a DEFINE have the same name, the compiler issues a warning when the STRUCT item is referenced.
How the Compiler Processes DEFINEs LITERALs and DEFINEs Example 6-4.
Passing Actual Parameters to DEFINEs LITERALs and DEFINEs Passing Actual Parameters to DEFINEs If the DEFINE declaration has formal parameters, supply the actual parameters when you use the DEFINE identifier in a statement. The number of actual parameters can be less than the number of formal parameters. If actual parameters are missing, the corresponding formal parameters expand to empty text. For each missing actual parameter, you can use a placeholder comma, as in Example 6-5 on page 6-7. Example 6-5.
Passing Actual Parameters to DEFINEs LITERALs and DEFINEs Example 6-9. Parentheses in an Actual Parameter DEFINE varproc (proc1, param) = CALL proc1 (param) #; varproc (myproc, (i + j) * k); ! Expands to: ! CALL myproc ((i+j)*k); Example 6-10 on page 6-8 shows a DEFINE declaration that has one formal parameter and an assignment statement that uses the DEFINE identifier, passing a parameter of 3. Example 6-10.
Passing Actual Parameters to DEFINEs LITERALs and DEFINEs Example 6-13. Checking a Condition Code INT INT INT INT INT error; file; .
LITERALs and DEFINEs Passing Actual Parameters to DEFINEs HP pTAL Reference Manual—523746-005 6- 10
7 Simple Variables A simple variable is a single-element data item of a specified data type that is not an array, a structure, or a pointer. After you declare a simple variable, you can use its identifier in statements to access or change the data contained in the variable. You must declare variables before you use them. This section defines the syntax for declaring simple variables.
Declaring Simple Variables Simple Variables VOLATILE specifies that the value of this variable must be maintained in memory, not in a register. Each reference to a VOLATILE data item causes the data item to be read or written to memory even when code is optimized. Based on the order of reads and writes in the source code, VOLATILE also causes that precise order of memory references to be preserved, again, when code is optimized.
Specifying Simple Variable Address Types Simple Variables width For INT, REAL, and UNSIGNED data types, the value in parentheses is a constant expression specifying the width, in bits of the variable. The constant expression can include LITERALs and DEFINEs.
Simple Variables Initializing Simple Variables With Numbers Initializing Simple Variables With Numbers When you initialize with a number, it must match the data type specified for the simple variable. The data type determines what kind of values the simple variable can store: • • • STRING, INT, and INT(32) simple variables can contain integer constants in binary, decimal, hexadecimal, or octal base. REAL and REAL(64) simple variables can contain signed floating-point numbers.
Examples Simple Variables Example 7-1. Declaring Simple Variables Without Initializing Them STRING b; INT(32) dblwd1; REAL(64) long; UNSIGNED(5) flavor; BADDR ba; WADDR wa; EXTADDR ea; Example 7-2. Declaring and Initializing Simple Variables STRING y := "A"; STRING z := 255; INT a := "AB"; INT b := 5 * 2; INT c := %B110; INT(32) dblwd2 := %B1011101D; INT(32) dblwd3 := $DBL(%177775); REAL flt1 := 365335.6E-3; REAL(64) flt2 := 2718.
Examples Simple Variables Example 7-4. Initializing Simple Variables With Constants and Variables* INT global := 34; ! Only constants allowed ! in global initialization PROC mymain MAIN; BEGIN INT local := global + 10; INT local2 := global * local; FIXED local3 := $FIX(local2); !Lots of code END; !Any expression allowed ! in local or sublocal ! initialization ! End of mymain procedure * Constants can be at any level, but variables must be local or sublocal. Example 7-5.
8 Arrays An array is a one-dimensional set of elements of the same data type. Each array is stored as a collective group of elements. You use arrays to store constants, especially character strings. After you declare an array, you can use its identifier to access the array elements individually or as a group. You can declare: • • • Arrays Read-only arrays Address arrays The declaration includes initializing the array as well as allocating storage for the array.
Declaring Arrays Arrays Declaring Arrays An array declaration associates an identifier with a set of elements of the same data type. The data type of an array can be one of the pTAL address types. type identifier ; range := . initialization .EXT .SG .SGX , VST021.
Declaring Arrays Arrays The data type determines: • • The kind of values that are appropriate for the array The storage unit the compiler allocates for each array element as follows: width is a constant expression specifying the width, in bits, of the variable. fpoint is the implied fixed point of the FIXED variable. identifier is the array name. . .EXT .SG .SGX are indirection symbols (see Table 2-7 on page 2-7). range [ lower-bound : upper-bound ] VST993.
Declaring Arrays Arrays initialization is a constant or a constant list of values to assign to the array elements, beginning with the lower-bound element. (Constant lists are described in Section 3, Data Representation.) If you specify fewer initialization values than the number of elements, the values of uninitialized elements are undefined. You cannot initialize extended indirect local arrays or UNSIGNED arrays. Specify initialization values that are appropriate for the data type of the array.
Declaring Arrays Arrays Example 8-3. Declaring Arrays and Initializing Them With Constant Lists INT c_array[0:5] := [1,2,3,4,5,6]; ! Constant list STRING buffer[0:102] := [ "A constant list can consist ", "of several character string constants, ", "one to a line, separated by commas.
Declaring Read-Only Arrays Arrays Declaring Read-Only Arrays A read-only array declaration allocates storage for a nonmodifiable array in a user code segment. Read-only arrays are sometimes referred to as p-relative arrays, because they are addressed using the program counter (the p register). type identifier = range 'p' := initialization ; , VST022.vsd type is any data type described in Declaring Arrays on page 8-2 except UNSIGNED. The data type of a read-only array cannot be an address type.
Declaring Read-Only Arrays Arrays initialization is a constant list to assign to the array elements. You must initialize read-only arrays when you declare them. (Constant lists are described in Section 3, Data Representation.) Specify initialization values that are appropriate for the data type of the array. For example, if the decimal setting of an initialization value differs from the fpoint of a FIXED array, the system scales the initialization value to match the fpoint.
Using Constant Lists in Array Declarations Arrays Using Constant Lists in Array Declarations pTAL requirements for array declarations are: • • If an array declaration includes an initialization string, the size of a constant list must be less than or equal to the size of the array. If the constant list is larger than the array, an error occurs.
Nonstring Arrays Arrays Nonstring Arrays You can specify an initialization string when you declare an array: INT .a[0:3] := [0,1,2,3]; The length of the initialization string must be less than or equal to the length of the array. Example 8-10. Declaring Nonstring Arrays With Constant Lists INT INT INT INT .a[0:3] .a[0:3] .a[0:3] .
Nonstring Arrays Arrays HP pTAL Reference Manual—523746-005 8- 10
9 Structures A structure is a collectively stored set of data items that you can access individually or as a group. Structures contain structure items (fields) such as simple variables, arrays, simple pointers, structure pointers, and nested structures (called substructures). The structure items can be of different data types. Structures usually contain related data items such as the fields of a file record.
Structures • • • • • • • • • • • • • • • • • VOLATILE Attribute on page 9-33 Declaring Definition Structures on page 9-33 Declaring Template Structures on page 9-35 Declaring Referral Structures on page 9-38 Declaring Simple Variables in Structures on page 9-40 Declaring Arrays in Structures on page 9-40 Declaring Substructures on page 9-42 Declaring Filler on page 9-46 Declaring Simple Pointers in Structures on page 9-48 Declaring Structure Pointers in Structures on page 9-51 Declaring Redefinitions on p
Structure Layout Structures Structure Layout The structure layout (or body) is a BEGIN-END block that contains declarations of structure items. Table 9-2.
Overview of Structure Alignment Structures Topics: • • Overview of Structure Alignment on page 9-4 Structures Aligned at Odd-Byte Boundaries on page 9-5 Overview of Structure Alignment The memory alignment of the fields of a structure is important to pTAL. A field that is aligned for fastest access is said to be well-aligned. A field that is not aligned for fastest access is said to be misaligned.
Structures Aligned at Odd-Byte Boundaries Structures • • Accessing data is somewhat slower if the data is not well-aligned and you reference the data using a pointer that specifies REFALIGNED(2). Accessing data is significantly slower if the data is not well-aligned, but pTAL generates code that functions as if the data is well-aligned. In this case, your program traps to the millicode exception handler, which completes the data access and returns to your program.
SHARED2 Structures If more than one program uses the same source file, you might want to include a FIELDALIGN clause on every structure declaration in the source file. This ensures that the field alignment of every structure is consistent across all programs that compile the source file. If you do not specify a FIELDALIGN clause, each structure will use the current setting of the FIELDALIGN compiler directive, which might be different for different compilations.
PLATFORM Structures For more information, see FIELDALIGN Clause on page 9-20 and SHARED8 Parameter on page 9-22. PLATFORM FIELDALIGN(PLATFORM) directs the compiler to allocate the structure’s fields according to a layout that is consistent across different programming languages running on a given architecture. (PLATFORM field alignment is not consistent across different architectures.
Differences Between PLATFORM and AUTO Structures Specify FIELDALIGN(AUTO) for structures that are not used to exchange data between processes. Do not assume that fields of an AUTO structure are contiguous in memory. The compilers insert filler where required for optimal alignment. Pointer fields and nonpointer fields in structures declared with AUTO field alignment can be any address type or data type, respectively. TAL, pTAL, and C lay out AUTO structures differently.
Base Alignment Structures Base Alignment The base alignment of a structure is the alignment of the widest field in the structure. The base alignment determines where the structure can be located in memory and be well-aligned. A structure is well-aligned when the memory address at which it is located is an integral multiple of its base alignment. Table 9-3.
Structure Alignment Examples Structures Figure 9-1.
Structure Alignment Examples Structures Figure 9-2.
Structure Alignment Examples Structures Figure 9-3 on page 9-12 shows a structure that is declared FIELDALIGN(SHARED8). The widest fields in s2, i32a and i32b, are each four bytes; therefore, although the field alignment of s2 is SHARED8, the base alignment of s2 is four, not eight. s2 is well-aligned in memory if the base of the structure begins at any address that is a multiple of four. Figure 9-3.
Array Alignment in Structures Structures Figure 9-4 on page 9-13 shows which fields are misaligned if s2 is allocated at an address other than a 4-byte address. Figure 9-4.
Array Alignment in Structures Structures Example 9-1. Arrays Within Structures (page 2 of 2) STRUCT s2 FIELDALIGN(SHARED8); BEGIN INT i; INT a; INT b; INT c; STRUCT s1a; BEGIN INT(32)w; INT y; INT x; END; STRUCT s1b; BEGIN INT(32)w; INT y; INT x; END; END; An array of structures or substructures is the same as an array of a pTAL data type.
Structure Alignment Structures Example 9-4. 8-Byte Alignment and 4-Byte Alignment STRUCT s3[0:9] FIELDALIGN(SHARED8); BEGIN STRUCT s4[0:4]; BEGIN INT i; FILLER 2; INT(32) j; END; REAL(64) END; ! ! ! ! s3 is SHARED8 Alignment is 8 s4 is SHARED8 Alignment is 4 k; Structure Alignment A structure’s alignment is the alignment of the widest field declared in the structure and is always less than or equal to the alignment specified in a FIELDALIGN clause or FIELDALIGN compiler directive.
Substructure Alignment Structures Substructure Alignment The rules for field alignment of substructures are the same as the rules for structures. You can specify the field alignment of a substructure explicitly using a FIELDALIGN clause or implicitly by allowing the field alignment of the substructure to default to the field alignment of the containing structure or substructure. In either case, the alignment of fields must conform to the rules described previously, under “Using Field Alignment.
Substructure Alignment Structures Example 9-7. SHARED8 Structures With SHARED2 Substructures STRUCT t_s2(*) FIELDALIGN(SHARED2); BEGIN INT(32) j; END; ! Base alignment of t_s2 ! is 2 STRUCT t_s8(*) FIELDALIGN(SHARED8); BEGIN INT(32) j; END; ! Base alignment of t_s8 ! is 4 Example 9-8. SHARED2 Structures With SHARED8 Substructure STRUCT s1 FIELDALIGN(SHARED2); BEGIN INT i; STRUCT s2(t_s8); ! s2 has SHARED8 alignment END; ! Base alignment of s2 is 2 INT .p2(t_s8) REFALIGNED(2); INT .
Substructure Alignment Structures When you design routines that return addresses to their callers, return addresses that are well-aligned whenever possible. Example 9-9. SHARED8 Structure With SHARED2 Substructure STRUCT s3 FIELDALIGN(SHARED8); BEGIN ! Base alignment of s3 is 4 INT i; STRUCT s4(t_s2); ! s2 has SHARED8 alignment END; ! Base alignment of s2 is 4 INT .p4(t_s2); ! Uses default alignment: 2 The compiler always generates conservative code. In Example 9-9 on page 9-18, references to s3.s4.
Alignment Considerations for Substructures Structures Alignment Considerations for Substructures When you declare a substructure, you must be aware of how the base alignment of the substructure and its containing structure affect references to the fields of the structure and substructure. Table 9-4.
FIELDALIGN Clause Structures FIELDALIGN Clause You use a FIELDALIGN clause in a structure declaration to specify how you want pTAL to align the fields in the structure.
SHARED2 Parameter Structures • The address type of pointers in a SHARED2 structure must be EXTADDR, SGBADDR, or SGWADDR; for example: STRUCT s FIELDALIGN(SHARED2); BEGIN INT .EXT i; ! OK: EXTADDR pointer INT .SG j; ! OK: SGWADDR pointer STRING .
SHARED8 Parameter Structures Example 9-13.
SHARED8 Parameter Structures Table 9-5. Variable Alignment (page 2 of 2) Data Type Alignment Notes UNSIGNED(1-16) 2 Multiple UNSIGNED fields can be packed in a word or doubleword. .SG pointers 2 .SG pointers are 16 bits in both pTAL and TAL.* .SGX pointers 4 Allowed in structures only with AUTO field alignment.** Other 16-bit pointers 4 Allowed in structures only with AUTO field alignment.
Alignment of Fields Structures • If the data type of a field in a SHARED8 structure is an address type, the type must be EXTADDR, SGBADDR, or SGWADDR, as shown in the following example: STRUCT s FIELDALIGN(SHARED8); BEGIN EXTADDR x; ! OK: EXTADDR field INT.EXT i; ! OK: EXTADDR pointer INT.SG j; ! OK: SGWADDR pointer STRING.
Optimizing Structure Layouts Structures Example 9-15.
Structure Length Structures By rearranging the order of the fields, s3 requires 24 bytes, rather than the 32 bytes required by s2, even though the information in s3 and s2 is the same. s3 uses only six more bytes than s1. Structure Length The total number of bytes in a SHARED8 structure must be an integral multiple of the widest field in the structure. If needed, you must explicitly declare filler at the end of a SHARED8 structure to ensure this condition. Example 9-18.
Alignment of UNSIGNED(17-31) Fields Structures Alignment of UNSIGNED(17-31) Fields In a SHARED8 structure, UNSIGNED(17-31) fields cannot cross a 4-byte address. Because an UNSIGNED(17-31) field is longer than 16 bits, its base alignment is 4 bytes. In Example 9-21 on page 9-27, i starts at the beginning of the structure. u, therefore, begins at an even-byte offset from the beginning of s.
REFALIGNED Clause Structures The alignment of a structure pointer is the alignment specified in a REFALIGNED clause if present, or if not present, by the field alignment of the structure it references. The REFALIGNED compiler directive does not affect the reference alignment of structure pointers. It is used only for pointers to nonstructure data. You can specify the REFALIGNED clause on any pointer field.
Default Reference Alignment Structures Default Reference Alignment If you do not specify a REFALIGNED clause in a structure pointer declaration, the reference alignment for the pointer is the alignment of the structure that the pointer references in its declaration. In Example 9-25 on page 9-29, none of the pointers p1, p2, or p3 specifies an alignment. Their alignment, therefore, is the field alignment of the structures s1, s2, and s3 that they reference. Example 9-25.
REFALIGNED(2) Structures To ensure good performance, use REFALIGNED(2) to access the field, even if it happens to be well-aligned. Always use REFALIGNED(2) unless you are certain that nearly all fields referenced by the pointer are well-aligned. Example 9-26. REFALIGNED(2) WADDR a_str; STRUCT s_templ(*) FIELDALIGN(SHARED8); BEGIN INT i; FILLER 2; INT(32) j; END; STRUCT s(s_templ); PROC p(struct_addr, p1); WADDR struct_addr; INT .p1(s_templ); ! Use template for structure definition BEGIN INT .
REFALIGNED(8) Structures The field alignment of s and s_templ is SHARED8. Because the declaration of p1 does not specify a REFALIGNED clause, the statement a := p1.i might cause performance degradation. See REFALIGNED(8) on page 9-31. The pointers p3, p4, and p5 specify REFALIGNED(2). Compared to p1, references to p3, p4, and p5 will have somewhat degraded performance when the fields they reference are wellaligned.
Code Generation for Structure References Structures For the assignment i32 := p1.i, pTAL generates fast code to access the field described by t1 because the declaration of pointer p1 specifies REFALIGNED(8). If the field is not well-aligned, your program will run significantly slower because each reference to elements of p1 will trap to the millicode exception handler to resolve each memory access. For the assignment i32 := p2.
VOLATILE Attribute Structures VOLATILE Attribute The VOLATILE attribute specifies that the value of this variable must be maintained in memory, not in a register. Each reference to a VOLATILE data item causes the data item to be read or written to memory even when code is optimized. Based on the order of reads and writes in the source code, VOLATILE also causes that precise order of memory references to be preserved, again, when code is optimized.
Declaring Definition Structures Structures range [ lower-bound : upper-bound ] VST993.vsd lower-bound is an INT constant expression (in the range -32,768 through 32,767) that specifies the index (relative to the zeroth structure occurrence) of the first structure occurrence you want to allocate. Each occurrence is one copy of the structure.
Declaring Template Structures Structures SHARED2 specifies that the base of the structure and each field in the structure must begin at an even-byte address except STRING fields. SHARED8 specifies that the offset of each field in the structure from the base of the structure must be begin at an address that is an integral multiple of the width of the field.
Declaring Template Structures Structures (*) is the symbol for a template structure. STRUCTALIGN (MAXALIGN) causes each definition structure that uses this template to be aligned on a 16-byte boundary (for more information, see STRUCTALIGN (MAXALIGN) Attribute on page 9-32). field-alignment FIELDALIGN ( SHARED2 ) SHARED8 AUTO PLATFORM VST992.vsd FIELDALIGN specifies how you want the compiler to align the base of the structure and fields in the structure.
Declaring Template Structures Structures AUTO specifies that the structure and the fields of the structure be aligned according to the optimal alignment for the architecture on which the program will run (this is not the same behavior as the AUTO attribute has in the native mode HP C compiler). PLATFORM specifies that the structure and the fields of the structure must begin at addresses that are consistent across all languages on the same architecture.
Declaring Referral Structures Structures Example 9-30. Template Structure With STRUCTALIGN(MAXALIGN) (page 2 of 2) STRUCT B (*) FIELDALIGN (SHARED8); BEGIN INT K; FILLER 14; STRUCT A2 (A); ! Base of A2 is guaranteed to be aligned on ! 16-byte boundary. Compiler issues warning ! here because A is declared with STRUCTALIGN ! (MAXALIGN) and B is a SHARED8 structure.
Declaring Referral Structures Structures range [ lower-bound : upper-bound ] VST993.vsd lower-bound is an INT constant expression (in the range -32,768 through 32,767) that specifies the index (relative to the zeroth structure occurrence) of the first structure occurrence you want to allocate. Each occurrence is one copy of the structure.
Declaring Simple Variables in Structures Structures Declaring Simple Variables in Structures The simple variable declaration associates a name with a single-element data item. When you declare a simple variable inside a structure, the form is: identifier type ; , VOLATILE VST705.vsd VOLATILE specifies that the value of this variable must be maintained in memory, not in a register. Each reference to a VOLATILE data item causes the data item to be read or written to memory even when code is optimized.
Declaring Arrays in Structures Structures type is any data type described in Section 3, Data Representation. identifier is the identifier of the array. range [ lower-bound : upper-bound ] VST993.vsd lower-bound is an INT constant expression (in the range -32,768 through 32,767) that specifies the index (relative to the zeroth array element) of the first array element you want allocated. Both lower and upper bounds are required.
Declaring Substructures Structures Example 9-34. Using a Zero-Length Array to Initialize a Structure STRUCT s; BEGIN STRING a[0:-1]; INT b; ! @a[0] is the same as @b STRUCT t; BEGIN ... END; ... END; s.a[0] := 0; s.a[1] := s.a[0] for $LEN(s); ... ! Very efficient Declaring Substructures A substructure is a structure embedded within another structure or substructure. You can declare substructures that have the following characteristics: • • • • Substructures must be directly addressed.
Definition Substructures Structures field-alignment FIELDALIGN ( SHARED2 ) SHARED8 AUTO PLATFORM VST992.vsd FIELDALIGN specifies how you want the compiler to align the base of the structure and fields in the structure. The offsets of fields in a structure are aligned relative to the base of the structure. If a definition substructure does not specify a FIELDALIGN clause, the contained substructure’s field alignment is the field alignment of its encompassing structure or substructure.
Definition Substructures Structures range [ lower-bound : upper-bound ] VST993.vsd lower-bound is an INT constant expression (in the range -32,768 through 32,767) that specifies the index (relative to the zeroth substructure occurrence) of the first substructure occurrence you want allocated. Each occurrence is one copy of the substructure.
Referral Substructures Structures Referral Substructures A referral substructure allocates storage for a substructure whose layout is the same as the layout of a previously declared structure or structure pointer. identifier STRUCT referral ( ) ; range VST203.vsd identifier is the identifier of the referral substructure. referral is the identifier of a structure that provides the structure layout.
Declaring Filler Structures Example 9-36. Declaring a Referral Substructure STRUCT temp(*); BEGIN STRING a[0:2]; INT b; STRING c; END; ! Template structure -! no space allocated STRUCT .ind_struct; BEGIN INT header[0:1]; STRING abyte; STRUCT abc (temp) [0:1]; END; ! Definition structure -! space allocated ! Declare referral substructure ! Size of ind_struct.abc[0] is ! 8 bytes Declaring Filler A filler declaration allocates a byte or bit place holder in a structure.
Declaring Filler Structures The compiler allocates space for each byte or bit you specify in a filler declaration. If the alignment of the next data item requires additional pad bytes or bits, the compiler allocates those also. Example 9-37. Filler Byte Declarations LITERAL last = 11; STRUCT .
Declaring Simple Pointers in Structures Structures Declaring Simple Pointers in Structures A simple pointer is a variable that contains the memory address of a simple variable or an array. When you declare a simple pointer inside a structure, the form is: type VOLATILE identifier . .EXT .SG .SGX ; REFALIGNED ( 2 ) 8 , VST627.vsd VOLATILE specifies that the value of this variable must be maintained in memory, not in a register.
Using Simple Pointers Structures REFALIGNED specifies the base alignment of the structures that the structure pointer will reference. 2 references a structure that might not be well-aligned. 8 indicates that the base of the structure and the fields in the structure are well aligned in memory Example 9-39. Simple Pointers Within a Structure STRUCT my_struct; BEGIN FIXED .std_pointer; STRING .
Assigning Addresses to Pointers in Structures Structures Table 9-7.
Declaring Structure Pointers in Structures Structures Example 9-41. Assigning Addresses to Pointers in Structures STRUCT .s1; BEGIN INT var1; INT var2; END; STRUCT .s2; BEGIN INT .std_ptr (s1); INT .EXT ext_ptr (s1); END; PROC g MAIN; BEGIN @s2.std_ptr := @s1[0]; @s2.ext_ptr := $XADR(s1); END; Declaring Structure Pointers in Structures A structure pointer is a variable that contains the address of a structure.
Declaring Structure Pointers in Structures Structures VOLATILE specifies that the value of this variable must be maintained in memory, not in a register. Each reference to a VOLATILE data item causes the data item to be read or written to memory even when code is optimized. Based on the order of reads and writes in the source code, VOLATILE also causes that precise order of memory references to be preserved, again, when code is optimized. STRING is the STRING attribute. INT is the INT attribute . .EXT .
Declaring Redefinitions Structures Table 9-8.
Simple Variable Structures Additional rules are given in subsections that describe each kind of redefinition in the following topics: • • • • • • Simple Variable on page 9-54 Array on page 9-55 Definition Substructure on page 9-56 Referral Substructure on page 9-59 Simple Pointer on page 9-61 Structure Pointer on page 9-63 For information about redefinitions outside structures, see Section 11, Equivalenced Variables.
Array Structures In a redefinition, the new item and the previous (nonpointer) item both must have a byte address or both must have a word address. If the previous item is a pointer, the data it points to must be word addressed or byte addressed to match the new item. Example 9-43 on page 9-55 redefines the left byte of int_var as string_var. Example 9-43. Simple Variable Redefinition STRUCT .
Definition Substructure Structures upper-bound is an INT constant expression (in the range -32,768 through 32,767) that specifies the index (relative to the zeroth element) of the last array element you want allocated. previous-identifier is the identifier of a simple variable, array, substructure, or pointer previously declared in the same structure. You cannot specify an index with this identifier.
Definition Substructure Structures lower-bound is an INT constant expression (in the range -32,768 through 32,767) that specifies the index (relative to the zeroth substructure occurrence) of the first substructure occurrence you want allocated. Each occurrence is one copy of the substructure. upper-bound is an INT constant expression (in the range −32,768 through 32,767) that specifies the index (relative to the zeroth substructure occurrence) of the last substructure occurrence you want allocated.
Definition Substructure Structures SHARED8 specifies that the offset of each field in the structure from the base of the structure must be begin at an address that is an integral multiple of the width of the field. AUTO specifies that the structure and the fields of the structure be aligned according to the optimal alignment for the architecture on which the program will run (this is not the same behavior as the AUTO attribute has in the native mode HP C compiler).
Referral Substructure Structures Example 9-46. Definition Substructure Redefinition STRUCT mystruct; BEGIN STRUCT mysub1; BEGIN INT int_var; END; STRUCT mysub2 = mysub1; BEGIN STRING string_var; END; END; ! Redefine mysub1 as mysub2 Referral Substructure A referral substructure redefinition associates a new referral substructure with a previous item at the same BEGIN-END level of a structure. identifier STRUCT = referral ( previous-identifier ) ; range VST208.
Referral Substructure Structures lower-bound is an INT constant expression (in the range -32,768 through 32,767) that specifies the index (relative to the zeroth substructure occurrence) of the first substructure occurrence you want allocated. Each occurrence is one copy of the substructure. upper-bound is an INT constant expression (in the range -32,768 through 32,767) that specifies the index (relative to the zeroth substructure occurrence) of the last substructure occurrence you want allocated.
Simple Pointer Structures Simple Pointer A simple pointer redefinition associates a new simple pointer with a previous item at the same BEGIN-END level of a structure. type identifier VOLATILE . .EXT .SG .SGX REFALIGNED ( 2 ) 8 = previous-identifier ; VST708.vsd VOLATILE specifies that the value of this variable must be maintained in memory, not in a register. Each reference to a VOLATILE data item causes the data item to be read or written to memory even when code is optimized.
Simple Pointer Structures REFALIGNED specifies the base alignment of the structures that the structure pointer will reference. 2 references a structure that might not be well-aligned. 8 indicates that the base of the structure and the fields in the structure are well aligned in memory previous-identifier is the identifier of a simple variable, array, substructure, or pointer previously declared in the same structure. No index is allowed with this identifier. Example 9-48.
Structure Pointer Structures Structure Pointer A structure pointer redefinition associates a new structure pointer with a previous item at the same BEGIN-END level of a structure. STRING VOLATILE identifier . INT .EXT .SG .SGX ( referral ) ( REFALIGNED 2 ) 8 = previous-identifier ; VST709.vsd VOLATILE specifies that the value of this variable must be maintained in memory, not in a register.
Structure Pointer Structures identifier is the identifier of the new structure pointer. referral is the identifier of a structure that provides the structure layout. You can specify any previously declared structure (including the encompassing structure) or structure pointer. REFALIGNED specifies the base alignment of the structures that the structure pointer will reference. 2 references a structure that might not be well-aligned.
10 Pointers This section describes the syntax for declaring and initializing pointers you manage yourself. You can declare the following kinds of pointers: • • Simple pointer—a variable into which you store a memory address, usually of a simple variable or array, which you can access with this simple pointer. Structure pointer—a variable into which you store the memory address of a structure which you can access with this structure pointer. The compiler allocates 32 bits for all pointers except .SG.
Overview of Pointer Declaration Pointers Overview of Pointer Declaration This subsection gives you the general pointer syntax and explains the syntax elements. type VOLATILE identifier . .EXT .SG .SGX REFALIGNED 2 ( ) 8 ; := initialization , VST676.vsd VOLATILE specifies that the value of this variable must be maintained in memory, not in a register. Each reference to a VOLATILE data item causes the data item to be read or written to memory even when code is optimized.
Overview of Pointer Declaration Pointers • • • • • • • • • • • • • INT (32) INT (64) PROCADDR REAL REAL (32) REAL (64) SGBADDR SGWADDR SGXBADDR SGXWADDR STRING UNSIGNED (width) WADDR fpoint is the implied fixed point of the FIXED variable. fpoint can also be an asterisk (*) as in: FIXED(*) .f; width is a constant expression specifying the width, in bits, of the variable. . .EXT .SG .SGX are indirection symbols (see Table 2-7 on page 2-7). identifier is the identifier of the pointer.
Declaring VOLATILE Pointers Pointers initialization is an expression representing a memory address. For more information about operations on addresses, see Section 5, Expressions. Declaring VOLATILE Pointers Declare pointers VOLATILE if they can be accessed asynchronously by other processes such as another process in your application or an I/O driver.
Structure Pointers Structure When you declare a VOLATILE structure pointer, the compiler generates code that maintains the value of the pointer in memory, not in a register. Each reference to a VOLATILE data item causes the data item to be read or written to memory even when code is optimized. Based on the order of reads and writes in the source code, VOLATILE also causes that precise order of memory references to be preserved, again, when code is optimized.
Address Types Pointers A pointer is associated with two data types: Data Type Description Object data type Data type of the objects that the pointer can reference Address data type Data type of the addresses that you can store in the pointer Table 10-1. Address Types Pointer Size Example 16-bit address to 1-bytealigned data 32 STRING .s; Word 16-bit address to 2-bytealigned data 32 INT .
Address Types Pointers Example 10-3. Determining Address Types INT .j; INT i; ! Pointer: address type is WADDR ! Simple variable: address type is WADDR Table 10-2. Object Data Types and Their Addresses (page 1 of 2) Declaration Address Type Object Data Type STRING .s; BADDR STRING INT .i; WADDR INT INT(32) .j; WADDR INT(32) REAL .r; WADDR REAL REAL(64) .s; WADDR REAL(64) FIXED .f; WADDR FIXED UNSIGNED(n) .u; WADDR UNSIGNED STRUCT .t; WADDR none SUBSTRUCT .
Address Types Pointers Table 10-2. Object Data Types and Their Addresses (page 2 of 2) Declaration Address Type Object Data Type STRING .SGX s; SGXBADDR STRING INT1 .SGX i; SGXWADDR INT INT(32) .SGX j; SGXWADDR INT(32 REAL .SGX r; SGXWADDR REAL REAL(64) .SGX s; SGXWADDR REAL(64) FIXED .SGX f; SGXWADDR FIXED UNSIGNED(n) .SGX u; SGXWADDR UNSIGNED addr-type 1 .
BADDR and WADDR Pointers BADDR and WADDR The address type of pointers is WADDR, except for STRING pointers, for which the address type is BADDR. Example 10-4. BADDR and WADDR INT a; INT .b; STRING .c; INT(32) d[0:9]; INT .
PROCADDR (Procedures, Procedure Pointers, and Procedure Entry Points) Pointers PROCADDR (Procedures, Procedure Pointers, and Procedure Entry Points) The address type of procedures, procedure pointers (PROCPTRs), and procedure entry points is PROCADDR. Example 10-6. PROCADDR PROCADDR pa; PROCPTR q( j ); INT j; END PROCPTR; PROC p( j ); INT j; BEGIN ENTRY p1; ...
EXTADDR Pointers Example 10-7.
Declaring Simple Pointers Pointers Declaring Simple Pointers A simple pointer declaration associates an identifier with a memory location that contains the user-initialized address of a simple variable or array. type VOLATILE identifier . .EXT .SG .SGX REFALIGNED 2 ( ) 8 ; := initialization , VST676.vsd VOLATILE specifies that the value of this variable must be maintained in memory, not in a register.
Declaring Simple Pointers Pointers • • • • • • • • • • • • • INT (64) PROCADDR REAL REAL (32) REAL REAL (32) REAL (64) SGBADDR SGWADDR SGXBADDR SGXWADDR STRING WADDR fpoint The implied fixed point of the FIXED variable. fpoint can also be an asterisk (*) as in: FIXED(*) .f; . .EXT .SG .SGX are indirection symbols (see Table 2-7 on page 2-7). identifier is the identifier of the pointer. REFALIGNED For simple pointers, the default for REFALIGNED is the value you specify in the REFALIGNED on page 17-51.
Initializing Simple Pointers Pointers initialization An expression representing a memory address. For more information about operations on addresses, see Section 5, Expressions. The data type determines the size of data a simple pointer can access at a time. The addressing mode and data type of the simple pointer determines the kind of address the pointer can contain. For information about data types and addresses, see Table 10-1 on page 10-6 and Table 10-2 on page 10-7.
Initializing Simple Pointers Pointers You can apply the @ operator to these global variables: Variable @identifier? Direct array Yes Standard indirect array Yes Extended indirect array No Direct structure Yes Standard indirect structure Yes Extended indirect structure No Simple pointer No Structure pointer No Simple pointers receive their initial values when you compile the source code.
Declaring Structure Pointers Pointers Example 10-13. Declaring and Initializing a Simple Pointer, Using $XADR INT a[0:1]; ! 16-bit word-addressed array STRING .EXT s := $XADR (a[0]); ! Extended simple pointer ! initialized with ! 32-bit byte address of a[0] Example 10-14. Declaring and Initializing an Extended Simple Pointer INT .EXT x[-100:100]; ! Array INT .
Initializing Structure Pointers Pointers STRING is the STRING attribute. INT is the INT attribute, as INT, INT(32), or FIXED. . .EXT .SG .SGX are indirection symbols (see Table 2-7 on page 2-7). identifier is the identifier of the pointer. referral is the identifier of a previously-declared structure, structure template, or structure pointer. Specify referral only for pointers to structures. initialization is an expression representing a memory address.
Initializing Structure Pointers Pointers Example 10-15. Declaring and Initializing a Structure Pointer, Using $OFFSET STRUCT t (*); BEGIN INT k; END; ! Template structure STRUCT .st; ! Definition structure BEGIN INT j; STRUCT ss (t); END; INT .ip := @st '+' $OFFSET (st.j) '>>' 1; ! Simple pointer INT .stp (t) := @st '+' $OFFSET (st.ss) '>>' 1; ! INT structure pointer STRING .sstp (t) := @st '<<' 1 '+' $OFFSET (st.
Initializing Structure Pointers Pointers Example 10-17. Declaring and Initializing a Local Structure Pointer PROC my_proc MAIN; BEGIN STRUCT my_struct[0:2]; BEGIN INT array[0:7]; END; INT .struct_ptr (my_struct) := @my_struct[1]; ! Structure pointer contains address of my_struct[1] END; Example 10-18. Declaring and Initializing a Local STRING Structure Pointer STRUCT name_def(*); BEGIN STRING first[0:3]; STRING last[0:3]; END; STRUCT .
Declaring System Global Pointers Pointers Declaring System Global Pointers Note. Only procedures that operate in privileged mode can access system global data. The system global pointer declaration associates an identifier with a memory location at which you store the address of a variable located in the system global data area. type .SG ; identifier := preset-address , VST020.vsd type is any data type except UNSIGNED; specifies the data type of the value to which the pointer points. .
11 Equivalenced Variables Equivalencing lets you declare more than one identifier and description for a location in a storage area. Equivalenced variables that represent the same location can have different data types and byte-addressing and word-addressing attributes. For example, you can refer to an INT(32) variable as two separate words or four separate bytes. You can equivalence any variable in the first column of Table 11-1 on page 11-1 to any variable in the second column. Table 11-1.
Declaring Equivalenced Variables Equivalenced Variables Table 11-2. Equivalenced Variable Terminology (page 2 of 2) Term Definition Extended equivalent declaration The equivalenced variable is an extended indirect array or extended indirect structure. Extended indirect items can be equivalenced only to other extended indirect items. Standard pointer equivalent declaration The equivalenced variable is a pointer to data.
Declaring Equivalenced Variables Equivalenced Variables Table 11-3. Valid Equivalenced Variable Declarations (page 2 of 2) Equivalenced Variable Category Equivalenced Variable Variable Example Standard Pointer Standard pointer INT .p; Standard structure pointer INT .s(t); Extended pointer INT .EXT e; Extended structure pointer INT .
Memory Allocation Equivalenced Variables Memory Allocation pTAL does not allocate memory for equivalenced variables. In the following example, pTAL allocates memory only for base_previous: INT base_previous; INT equivalenced1 = base_previous; INT equivalenced2 = equivalenced1; An equivalenced variable is an alias for memory allocated for a previously declared variable. The equivalenced declaration can specify different attributes; for example, a different data type than those of the previous variable.
Declaring Nonstructure Equivalenced Variables Equivalenced Variables Declaring Nonstructure Equivalenced Variables Nonstructure equivalenced declarations include simple variables, pointers, and arrays. VOLATILE type identifier = ( ) referral previous-identifier ; [ index + offset ] , VST629.vsd VOLATILE specifies that the value of this variable must be maintained in memory, not in a register.
Declaring Nonstructure Equivalenced Variables Equivalenced Variables previous-identifier the identifier of a previously-declared variable, direct array element, pointer, structure, structure pointer, or equivalenced variable. index is an INT constant that specifies an element offset from previous-identifier to which the equivalenced pointer or variable refers. Specify index only with direct variables. index must end on a word boundary.
Memory Usage for Nonstructured Equivalenced Variables Equivalenced Variables Memory Usage for Nonstructured Equivalenced Variables The memory referenced by an equivalenced variable including all fields of an equivalenced structure and all elements of an equivalenced array must be contained entirely within the memory allocated for the previous variable.
Indirect Arrays Equivalenced Variables Indirect Arrays Figure 11-1 on page 11-8 shows how pTAL implements indirect arrays. The compiler allocates storage for the four elements of the array a, but not for a pointer to a. References to a access the data directly not indirectly through a pointer. Figure 11-1. Indirect Array pTAL Indirect Array INT .A[0:3] := [10,20,30,40]; ! Object date type: INT ! Address type: WADDR A: 1000 1001 1002 1003 10 20 30 40 VST121.
Equivalenced Simple Variables Equivalenced Variables VOLATILE specifies that the value of this variable must be maintained in memory, not in a register. Each reference to a VOLATILE data item causes the data item to be read or written to memory even when code is optimized. Based on the order of reads and writes in the source code, VOLATILE also causes that precise order of memory references to be preserved, again, when code is optimized.
Equivalenced Simple Pointers Equivalenced Variables Figure 11-2. Equivalenced Simple Variables INT w[0:1]; STRING b = w[0]; INT(32) d = b; w[0] B[0] B[1] w[1] B[2] B[3] D VST302.vsd Equivalenced Simple Pointers An equivalenced simple pointer declaration associates a new simple pointer with a previously declared variable. type VOLATILE identifier referral ( ) . .EXT = previous-identifier .SG .SGX ; [ index + offset ] , VST630.
Equivalenced Simple Pointers Equivalenced Variables type is any data type except UNSIGNED. The data type determines how much data the simple pointer can access at a time (byte, word, doubleword, or quadrupleword). . .EXT .SG .SGX are indirection symbols (see Table 2-7 on page 2-7). identifier is the identifier of a simple pointer to be made equivalent to previousidentifier.
Equivalenced Simple Pointers Equivalenced Variables Using Equivalenced Simple Pointers If the previous variable is a pointer, an indirect array, or an indirect structure, the previous pointer and the new pointer must both contain either: • • • A standard byte address A standard word address An extended address Otherwise, the pointers will point to different locations, even if they both contain the same value.
Equivalenced Simple Pointers Equivalenced Variables Figure 11-3. The Object and Address Types of a Pointer INT .EXT a; 12345 Object Data Type: INT Address Type: EXTADDR STRING .b; "ABCDEFGHIJ" Object Data Type: STRING Address Type: BADDR VST124.vsd Table 11-4. Data Types for Equivalenced Variables Example Object Data Type Address Type INT a; INT WADDR INT .b; INT WADDR INT .EXT c; INT EXTADDR BADDR d; BADDR WADDR BADDR .e; BADDR WADDR BADDR .
Equivalenced Simple Pointers Equivalenced Variables The code in Figure 11-4 on page 11-14 declares an INT(32) simple pointer equivalent to an INT simple pointer. Both contain a word address. Figure 11-4. Equivalenced Simple Pointer Declaration INT .ptr1 := 200; INT(32) .ptr2 := ptr1; ptr1 = 200 ptr2 = 200 . . . G[200] VST307.vsd pTAL does not verify that the lengths of the objects to which an equivalenced pointer refers are equal.
Equivalencing PROCADDR Variables and PROCPTR Variables Equivalenced Variables REFALIGNED Clause for Equivalenced Simple Pointers The REFALIGNED clause assigns a REFALIGNED attribute (2 or 8) to a simple equivalenced pointer when you declare the pointer. Equivalenced pointers do not inherit the reference alignment of the previous variable. Example 11-6. REFALIGNED Clause for Equivalenced Simple Pointers ?REFALIGNED(8) INT .p REFALIGNED(2); INT .q REFALIGNED(8) = p; INT .r REFALIGNED(2) = p; INT .
Declaring Equivalenced Definition Structures Equivalenced Variables Declaring Equivalenced Definition Structures An equivalenced definition structure declaration associates a new structure with a previously declared variable. identifier STRUCT referral ( ) . .EXT .SG .SGX previous-identifier = field-alignment ; [ index + offset ] structure-layout VST632.vsd - . .EXT .SG .SGX are indirection symbols (see Table 2-7 on page 2-7). structure is the identifier that the declaration creates.
Declaring Equivalenced Definition Structures Equivalenced Variables FIELDALIGN specifies the memory alignment for the base of the structure and for fields within the structure. For details about the FIELDALIGN clause, see Section 9, Structures. SHARED2 specifies that the base of the structure and each field in the structure must begin at an even byte address except STRING fields.
Declaring Equivalenced Definition Structures Equivalenced Variables offset is an INT constant that specifies a word offset. Specify offset only with indirect variables. The offset is from the location of the pointer, not from the location of the data pointed to. structure-layout is a BEGIN-END block that contains declarations. For more information about the structure layout, See Section 9, Structures.
Declaring Equivalenced Definition Structures Equivalenced Variables The code in Figure 11-5 on page 11-19 declares an extended indirect definition structure equivalent to a previously declared extended indirect structure. Figure 11-5. Equivalenced Definition Structure for CISC Architecture STRUCT .EXT xstrl; BEGIN STRING old_name[0:20]; STRING old_addr[0:50]; END; STRUCT .
Structure Variants Equivalenced Variables Topics: • • • Structure Variants on page 11-20 Memory Usage for Structured Equivalenced Variables on page 11-21 FIELDALIGN Clause on page 11-22 Structure Variants You use substructures to declare variant records in structures. pTAL does not detect addresses that are redefined by equivalenced variant structures. Example 11-9. Structure Variants STRUCT s FIELDALIGN(AUTO); BEGIN STRUCT v1; BEGIN INT .p; ! .p is 4 bytes INT q; END; STRUCT v2 = v1; BEGIN INT .
Memory Usage for Structured Equivalenced Variables Equivalenced Variables In Example 11-10 on page 11-20, v1 is 4 bytes, but v2 is 8 bytes. The compiler reports a warning. Data that your program stores into s.v2.q overwrites the data in the memory locations that follow s. v2 is 8 bytes to maintain the alignment of variables in memory. For more information about lengths of pTAL structures, see Section 9, Structures.
FIELDALIGN Clause Equivalenced Variables FIELDALIGN Clause The FIELDALIGN clause specifies the alignment of the fields of a structure and the alignment of the structure itself in memory. You can use an equivalenced declaration to create two layouts for the same area, one optimized for TAL programs on TNS architecture and the other optimized for pTAL programs on TNS/R or TNS/E architecture. Declare the pTAL structure first. Example 11-13.
Equivalenced Simple Variable Equivalenced Variables Equivalenced Simple Variable An equivalenced simple variable declaration associates a simple variable with a location that is relative to the 'SG' base address. type identifier = 'SG' ; [ index + offset ] , VST068.vsd type is any data type except UNSIGNED; specifies the data type of identifier. identifier is the identifier of a simple variable to be made equivalent to 'SG'. 'SG' a symbol that denotes a 16-bit system global address.
Equivalenced Definition Structure Equivalenced Variables Example 11-14. Equivalenced Simple Variable Declaration INT item = 'SG' + 15; Equivalenced Definition Structure An equivalenced definition structure declaration associates a definition structure with a location relative to a system global ('SG') or extended system global ('SGX') base address. identifier STRUCT = 'SG' .EXT .SG .SGX ; [ index + offset structure-layout ; ] VST710.vsd .EXT .SG .
Equivalenced Referral Structure Equivalenced Variables + is the word or byte offset, relative to the base of previous-ident, where the equivalenced variable is placed. For example, if a and b are declared: INT a[0:9]; INT b = a+5 then b is placed at a[5]. offset an equivalent INT values in the range 0 through 63. structure-layout a BEGIN-END block that contains declarations for structure items. Example 11-15.
Equivalenced Referral Structure Equivalenced Variables .EXT .SG .SGX are indirection symbols (see Table 2-7 on page 2-7). identifier is the identifier of a referral structure to be made equivalent to 'SG'. referral is the identifier of a previously declared structure or structure pointer that is to provide the layout for this structure. 'SG' denotes a 16-bit system global address.
Equivalenced Simple Pointer Equivalenced Variables Equivalenced Simple Pointer The equivalenced simple pointer declaration associates a simple pointer with a location relative to the base address of the system global ('SG') or the extended system global ('SGX') data area. type identifier = 'SG' .SG .SGX .EXT ; [ index + offset ] , VST704.vsd type is any data type except UNSIGNED and specifies the data type of the value to which the pointer points. .EXT .SG .
Equivalenced Structure Pointer Equivalenced Variables + is the word or byte offset, relative to the base of previous-ident, where the equivalenced variable is placed. For example, if a and b are declared: INT a[0:9]; INT b = a+5 then b is placed at a[5]. offset an equivalent INT values in the range 0 through 63. Example 11-17. Equivalenced Simple Pointer Declaration INT .
Equivalenced Structure Pointer Equivalenced Variables . .EXT .SG .SGX are indirection symbols (see Table 2-7 on page 2-7). identifier is the identifier of a structure pointer to be made equivalent to 'SG'. referral is the identifier of a previously declared structure or structure pointer that is to provide the layout for identifier. 'SG' denotes a 16-bit system global address.
Equivalenced Structure Pointer Equivalenced Variables HP pTAL Reference Manual—523746-005 11 -30
12 Statements Statements—also known as executable statements—perform operations in a program. They can modify the program’s data or control the program’s flow. Table 12-1.
Using Semicolons in Statements Statements Using Semicolons in Statements You use semicolons with statements as follows: • • • • A semicolon is required between successive statements. A semicolon is optional before an END keyword that terminates a compound statement. A semicolon must not immediately precede an ELSE or UNTIL keyword. A semicolon alone in place of a statement creates a null statement. The compiler generates no code for null statements.
ASSERT Statements Example 12-1. Null Compound Statement BEGIN END; Example 12-2. Compound Statement BEGIN a := b + c; d := %B101; f := d - e; END; ASSERT The ASSERT statement conditionally calls the procedure specified in the active directive ASSERTION on page 17-18. ASSERT assert-level : condition VST035.vsd assert-level is an integer in the range 0 through 32,767.
Assignment Statements Example 12-3 on page 12-4 calls PROCESS_DEBUG_ whenever a carry or overflow condition occurs. Example 12-3. ASSERTION Directive and ASSERT Statement ?SOURCE $SYSTEM.SYSTEM.
Assignment Statements expression is either: • • An arithmetic expression of the same data type as variable A conditional expression, which always has an INT result expression can be a bit extraction value or an identifier prefixed with @ (the address of a variable). expression cannot be a constant list. In general, the data types of variable and expression must match.
Pointer Assignment Statements When an INT variable is assigned to a STRING variable, the upper 8 bits of the INT variable are not retained in any way in the STRING variable. Thus, the comparison of i1 to i2 in the final statement of the following code fails because i2 still holds the full 16 bits that were assigned to it at the beginning of the code, but i1 holds only the lower 8 bits. The upper 8 bits of I1 are not transferred to s in the assignment statement s := i1.
Assigning Numbers to FIXED Variables Statements You can use type-conversion built-in routines to convert some address types to other address types. For more information: Topic See ... Type-conversion built-in routines Section 15, Built-In Routines Converting addresses Section 5, Expressions Pointers Section 10, Pointers Assigning Numbers to FIXED Variables When you assign a number to a FIXED variable, the system scales the value up or down to match the fpoint value.
Examples Statements Examples Example 12-4. Assignment Statements INT array[0:2]; INT .ptr; REAL real_var; ! Array ! Simple pointer ! REAL variable FIXED fixed_var; ! FIXED variable array[2] := 255; ! Assign a value to array[2] @ptr := @array[1]; ! Assign address of array[1] ! to ptr ptr := array[2]; ! Assign value of array[2] ! to array[1], to which ptr ! points real_var := 36.
Bit-Deposit Assignment Statements Bit-Deposit Assignment The bit deposit form of the assignment statement lets you assign a value to an individual bit or to a group of sequential bits. variable . < > left-bit : := right-bit expression VST037.vsd variable is the identifier of a STRING or INT variable, but not an UNSIGNED(1-16) variable. variable can be the identifier of a simple variable, array element, or simple pointer (inside or outside a structure).
CALL Statements Examples: 1. The bit deposit assignment sets bits 3 through 7 of the word designated by x: INT x; x.<3:7> := %B11111; 2. The bit deposit assignment replaces bits <10> and <11> with zeros: INT old := -1; old.<10:11> := 0; ! old = %b1111111111111111 ! old = %b1111111111001111 3. The bit deposit assignment sets bit <8>, the leftmost bit of strng, to 0: STRING strng := -1; strng.<8> := 0; ! strng = %b11111111 ! strng = %b01111111 4. The value %577 is too large to fit in bits <7:12> of var.
CALL Statements param-name is a variable identifier or an expression that defines an actual parameter to pass to a formal parameter declared in identifier. param-pair is an actual parameter pair to pass to a formal parameter pair declared in identifier. param-pair has the form: string : length VST039.vsd string is an expression of the type STRING . or STRING .EXT. length is an INT expression that specifies the length, in bytes, of string.
CASE Statements Example 12-7. CALL Statement PROC p (a, INT(32) REAL REAL(64) BEGIN END; b, c); a; b; c; PROC q; BEGIN CALL p(1.0E0, ! ERROR: Cannot pass REAL to INT(32) 1D, ! ERROR: Cannot pass INT(32) to REAL 1F); ! ERROR: Cannot pass FIXED to REAL(64) END; CASE The CASE statement executes a choice of statements based on a selector value. Normally, you use labeled CASE statements. Labeled CASE statements are described first, followed by unlabeled CASE statements.
Labeled CASE Statements Labeled CASE The labeled CASE statement executes a choice of statements when the value of the selector matches a case label associated with those statements. CASE selector OF BEGIN case-alternative ; END -> OTHERWISE ; statement-2 VST041.vsd selector is an INT or INT (32) value arithmetic expression that uniquely selects the casealternative for the program to execute.
Labeled CASE Statements upper-case-label is the largest value in an inclusive range of signed INT constants or LITERALs. statement-1 is any statement described in this section. OTHERWISE specifies an optional sequence of statements to execute if selector does not select any case-alternative. If no OTHERWISE clause is present and selector does not match a case-alternative, a run-time error occurs. Always include an OTHERWISE clause, even if it contains no statements.
Unlabeled CASE Statements Example 12-10.
Unlabeled CASE Statements statement-1 is any statement described in this section. Include a statement-1 for each value in the implicit selector range, from 0 through n. If a selector has no action, specify a null statement (semicolon with no statement). If you include more than one statement-1 for a value, you must use a compound statement. OTHERWISE indicates the statement to execute for any case outside the range of selector values.
DO-UNTIL Statements Example 12-12. Unlabeled CASE Statement INT selector; INT var0; INT var1; CASE selector OF BEGIN var0 := 0; var1 := 1; OTHERWISE CALL error_handler; END; ! Executes if selector=0 ! Executes if selector=1 ! Executes if selector is not 0 or 1 Example 12-13 on page 12-17 selectively moves one of several messages into an array. Example 12-13. Unlabeled CASE Statement Assigning Text to Array PROC msg_handler (selector); INT selector; BEGIN LITERAL len = 80; ! Length of array STRING .
DO-UNTIL Statements condition is either: • • A conditional expression An INT, INT(32), or FIXED arithmetic expression. If the result of the arithmetic expression is not 0, condition is true. If the result is 0, condition is false. If condition is false, the DO-UNTIL statement continues to execute. If condition is true, the statement following the DO-UNTIL statement executes. A DO-UNTIL statement always executes at least once (unlike the WHILE on page 12-45).
DROP Statements Example 12-16. DO-UNTIL Statement With Hardware Indicator INT exit_loop; ... exit_loop := FALSE; DO BEGIN ... READ(...); IF <> THEN exit_loop := TRUE; END UNTIL exit_loop; Example 12-17. DO-UNTIL Statement With GOTO Statement DO BEGIN ... READ(...); IF <> THEN GOTO out; END UNTIL false; out: ... DROP The DROP statement removes either a label (from the symbol table) or a temporary variable that was created by the statement USE on page 12-45. DROP identifier , VST047.
Dropping Temporary Variables Statements Dropping Temporary Variables When you no longer need a temporary variable, drop (remove) it by using a DROP statement. After you drop a temporary variable, do not use its identifier without using a new USE statement to assign a value to the temporary variable. If you do not drop all temporary variables, the compiler automatically drops them when the procedure or subprocedure completes execution.
Nested Statements limit is an arithmetic expression that terminates the loop. If index is INT, initialvalue is INT. If index is INT(32), initial-value is INT(32). step is an arithmetic expression by which to increment or decrement index each time the loop executes. If index is INT, then step is INT; otherwise, index is INT(32). The default is 1. statement is any statement described in this section. The FOR statement tests index at the beginning of each iteration of the loop.
Optimized Statements • limit and step are recomputed at the start of each iteration of the statement. The standard FOR statement in Example 12-19 on page 12-22 uses the DOWNTO clause to reverse a string from "BAT" to "TAB". Example 12-19. Standard FOR Statement LITERAL len = 3; LITERAL limit = len - 1; STRING .normal_str[0:limit] := "BAT"; STRING .
GOTO Statements Example 12-20. Standard and Optimized FOR Statements (page 2 of 2) INT PROC p2; BEGIN USE i; y := 0; FOR i := 1 to q() DO ... ; RETURN x; END; ! p2 has optimized FOR statement ! q is called 1 time ! i=10 here ! p2 returns 1 GOTO The GOTO statement unconditionally transfers control to a labeled target statement. GOTO label-name VST049.vsd label-name is the label that precedes the target statement (see Labels in Procedures on page 14-37).
Nonlocal Statements Nonlocal Note. Nonlocal GOTO statements are are inefficient and not recommended. If the GOTO statement is in a subprocedure and the target statement is in the enclosing procedure, the GOTO statement is nonlocal. Example 12-22.
GOTO and Target Statements With Different Trapping States Statements If a GOTO statement and the target statement are in different BEGIN-END blocks: • You must declare the target label in a LABEL declaration in the containing procedure. Note. LABEL is an invalid data type for a formal parameter. You cannot pass a label as an actual parameter. • • Overflow trapping must be enabled in both blocks or disabled in both blocks.
IF Statements IF The IF statement conditionally selects one of two statements to execute. IF condition THEN statement-1 ELSE statement-2 VST050.vsd condition is either: • • A conditional expression whose value has 16 bits An INT, INT(32), or FIXED arithmetic expression. If the result of the arithmetic expression is not 0, condition is true. If the result is 0, condition is false. statement-1 specifies the statement to execute if condition is true.
Testing Address Types Statements You can nest IF statements to any level.
Move Statements Move A move statement copies a block of data from one location in memory to another. You specify the number of bytes, words, or elements to copy in the move statement. With PVU T9248AAD, you can move any variable up to the current maximum allowed size for any object on a TNS/R platform of 127.5 megabytes. A value parameter cannot be the target of a move statement. := destination =: & source FOR count count-unit constant [ constant ] constant-list -> next-addr VST051.
Move Statements count is an unsigned INT arithmetic expression that defines the number of units in source to copy.
Move Statements If count-unit is not BYTES, WORDS, or ELEMENTS, the compiler issues an error. If you specify BYTES, WORDS, or ELEMENTS for count-unit, that term cannot also appear as a LITERAL or DEFINE identifier in the global declarations or in any procedure or subprocedure in which the move statement appears. constant is a numeric constant, a character string constant, or a LITERAL to copy.
Move Statements Example 12-26. MOVE Statement Copying to an Array LITERAL len = 10; LITERAL num = 5; STRING .array[0:len - 1]; STRING .next_addr; ! ! ! ! Length of array Number of elements Destination array Next address simple pointer array[0] ':=' num * [" "] -> @next_addr; ! Do first copy and capture next-addr next_addr ':=' num * ["-"]; ! Use next-addr as start of second copy Example 12-27 on page 12-31 contrasts copying a bracketed constant with copying an unbracketed constant.
Destination Shorter Than Source Statements Example 12-29. MOVE Statement Copying a Substructure LITERAL copies = 3; STRUCT .s; BEGIN STRUCT s_sub[0:copies - 1]; BEGIN INT a, b; END; END; STRUCT .d (s); ! Number of occurrences ! Source substructure ! Destination substructure ! is within structure d PROC p; BEGIN d.s_sub ':=' s.
$FILL8, $FILL16, and $FILL32 Statements Statements Example 12-30.
RETURN Statements RETURN A RETURN statement causes a procedure or function to return control to its caller. When you return from a function, the RETURN statement also specifies a value to return to the function’s caller. Note. • • In the discussion of the RETURN statement, the word “procedure” implies both procedures and subprocedures but not functions.
Functions Statements Topics: • • • Functions on page 12-35 Procedures and Subprocedures on page 12-36 Condition Codes on page 12-37 Functions Every function must include at least one RETURN statement. The compiler does not verify that every path through a function’s code includes a RETURN statement; therefore, a function can reach the end of its code without executing a RETURN statement. If this happens, the function returns zero.
Procedures and Subprocedures Statements Example 12-34. Testing a Condition Code (page 2 of 2) INT PROC p2 (i); INT i; BEGIN INT j := i + 1; RETURN i, j; END; CALL p1 (i); IF < THEN ... ; ! Test return value CALL p2 (i); IF < THEN ... ; ! Test condition code Procedures and Subprocedures In procedures and subprocedures that are not functions, a RETURN statement is optional.
Condition Codes Statements Example 12-36. RETURN Statement in a Procedure That Returns a Condition Code PROC p (s, x, y) RETURNSCC; INT .s, x, y; BEGIN INT cc_result; INT i; i := x + y; IF $OVERFLOW THEN cc_result := 1 ELSE cc_result := 0; s := i; RETURN cc_result; ! If overflow, condition code is >; END; ! otherwise, it is = Condition Codes A procedure (but not a function) returns a condition code only if the procedure declaration includes the RETURNSCC attribute.
Condition Codes Statements Example 12-38. Procedure With RETURNSCC (page 2 of 2) PROC q; BEGIN CALL p; IF < THEN ... END; ! OK: p returns a condition code Functions that do not specify RETURNSCC return a condition code that is based on the numeric value returned by the function, regardless of the nature of the expression in the RETURN statement. Example 12-39.
Condition Codes Statements A function or procedure that specifies RETURNSCC must include cc-expression on every RETURN statement. Conversely, specify cc-expression in RETURN statements only in functions and procedures that specify RETURNSCC. You can test the condition code returned by a function, even if you call the function in a CALL statement. Example 12-41.
SCAN and RSCAN Statements Example 12-43. Condition Code That Is Independent of the Function’s Value INT PROC p(i) RETURNSCC; INT i; BEGIN ... RETURN i, f(i); END; ! Return the value of i and set the ! condition code according to the ! value returned by function f Note. The EpTAL compiler issues a warning whenever a pTAL procedure returns both a traditional function value and a condition code value. For details, see Appendix D, RETURN, RETURNSCC, and C/C++ on TNS/E. Example 12-44.
SCAN and RSCAN Statements RSCAN indicates a right-to-left search. variable is the identifier, with or without an index, of a variable at which to start the scan. The following restrictions apply: • • • The variable can be a simple variable, array, read-only array, simple pointer, structure pointer, structure, or structure data item. The variable can be of any data type but UNSIGNED. The variable cannot have extended indirection.
Determining What Stopped a Scan Statements Example 12-45. SCAN UNTIL Statement INT .words[-1:3] := [0,"Doe, J",0]; STRING .
Crossing Variable Boundaries Statements Crossing Variable Boundaries SCAN and RSCAN statements can access data contained within single named variables or arrays as long as the scan encounters either the target character specified in the SCAN or RSCAN statement or a 0 byte before it reaches the end of the named variable or array. SCAN and RSCAN statements that depend on accessing data that precedes or follows the variable named in the SCAN or RSCAN statement do not work.
P-Relative Arrays Statements Example 12-49. Scanning Data in a P-Relative Array STRING s = 'P' := [ 1, "msg1.", 2, "msg2.", 3, "msg3.", 0 ]; ! STRING P-relative array s STRING ! Start address of msg ! End address of msg INT .t_start, .t_end; c := 3, z := ".
USE Statements USE The USE statement creates a temporary variable. USE identifier , VST056.vsd identifier is the name of the temporary variable being created.
WHILE Statements Hardware indicators cannot appear in the conditional expression of a WHILE statement. Example 12-51. WHILE Statement LITERAL len = 100; INT .array[0:len - 1]; INT item := 0; WHILE item < len DO BEGIN array[item] := 0; item := item + 1; END; ! item equals len at this point The WHILE statement in Example 12-52 on page 12-46 increments index until a nonalphabetic character occurs. Example 12-52. WHILE Statement LITERAL len = 255; STRING .
13 Hardware Indicators Table 13-1. Hardware Indicators Hardware Indicator Representation Overflow bit $OVERFLOW Carry bit $CARRY Condition code < or ‘<’ Less than > or ‘>’ Greater than = or ‘=’ Equal <= or ‘<=’ Less than or equal >= or ‘>=’ Greater than or equal <> or ‘<>’ Not equal Meaning In TNS architecture, a “hardware indicator” is one of three fields of the environment (ENV) register.
[NO]OVERFLOW_TRAPS Procedure Attribute Hardware Indicators The directives and attributes active when a pTAL statement is compiled determine the overflow trapping state of the code that the compiler generates for that statement. A procedure does not inherit the trapping state of its caller.
Hardware Indicators After Assignments Hardware Indicators Example 13-2. ENABLE_OVERFLOW_TRAPS and DISABLE_OVERFLOW_TRAPS Block Attributes PROC p; BEGIN: ENABLE_OVERFLOW_TRAPS ... END; ! Enable traps for block PROC q; BEGIN SUBPROC q1; BEGIN: DISABLE_OVERFLOW_TRAPS ... END; ...
$CARRY Hardware Indicators ° ° ° ° ° ° ° ° ° ° $FIX of a REAL or REAL(64) value $FIXD $FIXI $FIXL $FIXR of a REAL or REAL(64) value $INT of a FIXED, REAL, or REAL(64) value $INTR of a FIXED, REAL, or REAL(64) value $FIXEDTOASCII $SCALE for which 1 <= exponent <= 4 The next statement is an IF statement that tests $OVERFLOW.
Condition Codes Hardware Indicators When Condition Codes Are Accessible The condition code is accessible after an assignment statement only if: • The right side of the assignment statement is not: ° A 1-byte item: STRING s; INT i; i := s; ! Condition code is not accessible ° A call to a built-in routine (for a list of these, see Table 15-1 on page 15-4): i := $ABS(i); ° An expression whose value is an address type (for example, WADDR or EXTADDR): INT i; INT .
Condition Codes Hardware Indicators • If the right side of an assignment statement is an INT function, the condition code is determined by the INT value returned by the function. The value returned is always an INT, even if the expression in the function’s RETURN statement is a byte value. The byte value is not sign-extended.
Condition Codes Hardware Indicators ° A global variable: INT g; PROC p; BEGIN INT i := 0; g := i; END; ° A pointer: INT .p; INT i := 0; p := i; ° ! Condition code is not accessible ! Condition code is not accessible A variable containing indexing, field selection, or bit selection: STRUCT s; BEGIN INT f; END; INT a[0:9]; INT i; s.f := i; ! Field selection: condition code is ! not accessible a[9] := i; ! Index: condition code is not accessible i.
Hardware Indicators in Conditional Expressions Hardware Indicators Example 13-3. Assignments After Which You Can Test Condition Codes (page 2 of 2) STRUCT s; BEGIN INT s1[0:4]; INT s2; END; i := k; i := i + 1; ! OK: Left and right sides are simple ! OK: Left and right sides are simple x := x + 1; ! OK: Left side is value parameter, ! right side is INT @k := f(0); ! OK: Left side is pointer cell, ! right side is RETURNSCC function y := i + 1; a[i] := a[i+1]; s.s1[0] := i; s.s2 := i; i.
Hardware Indicators in Conditional Expressions Hardware Indicators Both the statement preceding the WHILE statement and the last statement in the WHILE statement must set the condition code indicator. See Example 13-5 on page 13-9. Example 13-4. Hardware Indicators in DO-UNTIL Statements proc p returnscc; begin ... end; proc q; begin ... end; do call p () until = ; ! Sets condition code indicator ! OK do begin ... call p (); end until = ; ! OK do begin ... call q (); end until > ; int i := 0; ...
Hardware Indicators in Conditional Expressions Hardware Indicators Example 13-5. Hardware Indicators in WHILE Statements (page 2 of 2) call p (); while >= do call p (); call p (); ! ! ! ! Sets condition code indicator OK Sets condition code indicator Sets condition code indicator while > do begin ... call p (); ! OK ! Sets condition code indicator end; call q (); ! Doesn't set the condition code indicator while > do begin ...
Hardware Indicators in Conditional Expressions Hardware Indicators An IF statement that tests a hardware indicator must either: • Immediately follow the statement that establishes the value of the hardware indicator INT a; a := a - 1; IF < THEN ... ! OK: hardware indicator tested immediately a := a + 1; IF $CARRY THEN ... ! OK: hardware indicator tested ! immediately CALL WRITEREAD(...); IF <> THEN... a := a - 1; BEGIN IF < THEN ... ...
Nesting Condition Code Tests Hardware Indicators The first statement in an IF statement’s THEN clause or ELSE clause (or both) can, in turn, be an IF statement that tests the condition code established by the conditional expression of the containing IF statement. In this case, the root operator in the containing IF statement’s conditional expression must be either: • A relational operator i := i + 1; IF i >= 0 THEN IF > THEN ...
Nesting Condition Code Tests Hardware Indicators You cannot test $OVERFLOW or $CARRY to determine if an overflow or carry occurred while evaluating an IF statement’s conditional expression. IF i + 1 < 100 THEN BEGIN IF $CARRY THEN ... END ! ERROR: invalid to test $CARRY here You can test $OVERFLOW or $CARRY by evaluating, in a separate assignment statement, the expression in which overflow or carry could occur, then test $OVERFLOW or $CARRY.
Using Hardware Indicators Across Procedures Hardware Indicators • If an outer IF statement’s conditional expression uses a signed operator (= or <>) to compare two 16-bit addresses, an inner IF statement’s THEN or ELSE clause cannot test the condition code established by the outer IF statement’s conditional expression. WADDR w1, w2; EXTADDR e1, e2; IF e1 <> e2 THEN BEGIN IF < THEN ... END; ! OK: e1 and e2 are EXTADDR values IF w1 '<>' w2 THEN BEGIN IF < THEN ...
Returning a Condition Code to the Calling Procedure Hardware Indicators Example 13-6. Testing a Hardware Indicator Set in a Calling Procedure PROC b(status); INT status; BEGIN IF status <> 0 THEN ... END; PROC a; BEGIN INT i, j, k; ...
Returning the Value of $OVERFLOW or $CARRY to the Calling Procedure Hardware Indicators Returning the Value of $OVERFLOW or $CARRY to the Calling Procedure A called procedure cannot return the value of $OVERFLOW or $CARRY to its caller. To achieve this effect, set variables with the values of these indicators and return the variables’ values using either parameters, global variables, or return values. Example 13-7.
14 Procedures, Subprocedures, and Procedure Pointers Procedures are program units that contain the executable portions of a pTAL program and that are callable from anywhere in the program. Procedures allow you to segment a program into discrete parts that each perform a particular task such as I/O or error handling. An executable program contains at least one procedure. One procedure in the program has the attribute MAIN, which identifies it as the first procedure to execute when you run the program.
Procedures, Subprocedures, and Procedure Pointers Procedure Declarations Procedure Declarations A procedure is a program unit that is callable from anywhere in the program. You declare a procedure as follows: PROC identifier type public-name-spec ; proc-attribute parameter-list , proc-body ; param-spec ; EXTERNAL FORWARD VST058.vsd type specifies that the procedure is a function that returns a result and indicates the data type of the returned result.
Procedures, Subprocedures, and Procedure Pointers Procedure Declarations If a procedure declaration includes LANGUAGE on page 14-8, it must also include public-name-spec. parameter-list ( ) param-name param-pair , VST210.vsd param-name is the identifier of a formal parameter. A procedure can have up to 32 formal parameters. param-pair is a pair of formal parameter identifiers that comprise a language-independent string descriptor in the form: string : length VST039.
Procedures, Subprocedures, and Procedure Pointers Procedure Declarations proc-body is a BEGIN-END block that contains local declarations and statements, as described in Procedure Body on page 14-17. FORWARD specifies that the procedure body is declared later in the compilation. EXTERNAL specifies that the procedure body is either declared in another compilation unit or later in this compilation unit. Example 14-1.
Procedures, Subprocedures, and Procedure Pointers Procedure Attributes Procedure Attributes Procedures can have the following attributes: MAIN INTERRUPT RESIDENT CALLABLE PRIV VARIABLE EXTENSIBLE ( count ) RETURNSCC OVERFLOW_TRAPS NOOVERFLOW_TRAPS LANGUAGE C COBOL FORTRAN PASCAL UNSPECIFIED VST635.vsd MAIN causes the procedure to execute first when you run the program.
Procedures, Subprocedures, and Procedure Pointers Procedure Attributes INTERRUPT causes the pTAL compiler to generate an interrupt exit instruction instead of an EXIT instruction at the end of execution. Only operating system interrupt handlers use the INTERRUPT attribute. An example is: PROC int_handler INTERRUPT; BEGIN ! Do some work END; Note. The EpTAL compiler ignores INTERRUPT. RESIDENT causes procedure code to remain in main memory for the duration of program execution.
Procedures, Subprocedures, and Procedure Pointers Procedure Attributes VARIABLE means the compiler treats all parameters of the subprocedure as if they are optional, even if some are required by your code. If you add parameters to the VARIABLE subprocedure declaration, all procedures that call it must be recompiled.
Procedures, Subprocedures, and Procedure Pointers Parameters and VARIABLE and EXTENSIBLE Procedures RETURNSCC causes a procedure to return a condition code. The compiler reports an error if a procedure attempts to test the condition code after calling a procedure that does not specify RETURNSCC. Procedures declared with RETURNSCC cannot return 64-bit values. Note.
Procedures, Subprocedures, and Procedure Pointers VARIABLE, EXTENSIBLE and RETURNSCC Procedures as Actual Parameters VARIABLE, EXTENSIBLE and RETURNSCC Procedures as Actual Parameters You can pass a procedure or procedure pointer that includes an EXTENSIBLE, VARIABLE, or RETURNSCC attribute as a parameter to a procedure whose formal parameter is a PROC, but you cannot reference the PROC formal parameter identifier in a CALL statement.
Procedures, Subprocedures, and Procedure Pointers Formal Parameter Specification Formal Parameter Specification A formal parameter specification defines the parameter type of a formal parameter and whether the parameter is a value parameter or a reference parameter. param-type param-name . .EXT .SG .SGX ( referral ) ; REFALIGNED ( 2 ) 8 , VST636.
Procedures, Subprocedures, and Procedure Pointers Formal Parameter Specification param-type is the parameter type of the formal parameter and can be one of the following: STRING INT REAL UNSIGNED ( width ) ( width ) FIXED ( fpoint ) * STRUCT BADDR WADDR EXTADDR PROCADDR CBADDR CWADDR SGBADDR SGWADDR SGXBADDR SGXWADDR PROC type VST637.vsd Descriptions for STRUCT, PROC, PROC(32), and type, are included below. You can find descriptions of the remaining data types in Section 3, Data Representation.
Procedures, Subprocedures, and Procedure Pointers Formal Parameter Specification PROC is the address of the entry point of a procedure. You must assign PROC to a PROCPTR before you can call it. type specifies that the parameter is a function procedure, the return value of which is one of the following data types: STRING INT REAL ( width ) UNSIGNED ( width ) ( fpoint ) FIXED * VST214.vsd width is a constant expression that specifies the number of bits in the variable.
Procedures, Subprocedures, and Procedure Pointers Formal Parameter Specification . .EXT .SG .SGX are indirection symbols (see Indirection Symbols on page 2-7). If present, the parameter is passed by reference; if absent, the parameter is passed by value. Specify reference parameters for actual parameters that will be: • • • Arrays Structures Simple variables (when you want to update the original value in the caller’s scope) param-name is the identifier of a formal parameter.
Procedures, Subprocedures, and Procedure Pointers Formal Parameter Specification Table 14-1.
Procedures, Subprocedures, and Procedure Pointers Formal Parameter Specification Example 14-3. Function With Value and Reference Formal Parameters PROC mult (var1, var2); INT var1, .var2; BEGIN var2 := var2 + var1; END; ! Value parameter ! Reference parameter ! Manipulate parameters Example 14-4. Reference Structure as a Formal Reference Parameter STRUCT template (*); BEGIN INT a; INT b; END; ! Template structure PROC .
Procedures, Subprocedures, and Procedure Pointers Using STRUCT as a Formal Parameter Using STRUCT as a Formal Parameter You cannot declare a definition STRUCT as a formal parameter. You can, however, achieve the same effect by using a referral STRUCT as a formal parameter, and having it reference a previously declared structure. Example 14-5. Using a Referral STRUCT as a Formal Parameter STRUCT s (*); BEGIN INT a; INT b; END; PROC p (i, j); INT i; STRUCT .j (s); BEGIN ...
Procedures, Subprocedures, and Procedure Pointers Procedure Body Guidelines: • • • • • Do not treat a procedure’s formal parameters as an implied array or implied structure. Do not index a parameter to access another parameter or local variable. Do not perform block moves in which the source or destination spans more than one parameter. Do not pass the address of a value parameter to another procedure that expects the address of an array or structure.
Procedures, Subprocedures, and Procedure Pointers Procedure Body subproc-decl is a subprocedure declaration, as described in Subprocedure Declarations on page 14-19. statement is any statement described in Section 12, Statements. Example 14-6. Procedures INT c; ! Global declaration PROC first; BEGIN INT a, b; ... END; ! Procedure body ! Local declarations PROC second; BEGIN ... CALL first; ... END; ! Procedure body ! Call first procedure Example 14-7.
Procedures, Subprocedures, and Procedure Pointers Subprocedure Declarations Subprocedure Declarations You can declare subprocedures within procedures, but not within subprocedures. SUBPROC identifier type parameter-list ; VARIABLE RETURNSCC OVERFLOW_TRAPS NOOVERFLOW_TRAPS subproc-body parameter-spec ; ; FORWARD VST702.vsd type specifies that the subprocedure is a function that returns a result and indicates the data type of the returned result.
Procedures, Subprocedures, and Procedure Pointers Subprocedure Declarations param-pair is a pair of formal parameter identifiers that comprise a language-independent string descriptor in the form: string : length VST039.vsd string is the identifier of a standard or extended STRING simple pointer. The actual parameter is the identifier of a STRING array or simple pointer declare inside or outside a structure. length is the identifier of a directly addressed INT simple variable.
Procedures, Subprocedures, and Procedure Pointers Subprocedure Body FORWARD means the subprocedure body is declared later in this procedure. Subprocedure Body A subprocedure body can contain sublocal declarations and statements. BEGIN END sublocal-decl ; ; statement ; VST062.
Procedures, Subprocedures, and Procedure Pointers Entry-Point Declarations Example 14-8. Function Subprocedure PROC p; BEGIN SUBPROC p1; BEGIN INT .a[0:9]; INT .ext b[0:9]; a[0] := 1; b[9] := 2; END; CALL p1; END; PROC q; BEGIN SUBPROC q1; BEGIN STRUCT .s; BEGIN INT i; INT j; END; END; END; Entry-Point Declarations The entry-point declaration associates an identifier with a secondary location in a procedure or subprocedure where execution can start. ENTRY identifier ; , VST195.
Procedures, Subprocedures, and Procedure Pointers Procedure Entry-Point Identifiers Procedure Entry-Point Identifiers Here are guidelines for using procedure entry point identifiers: • • • • • • • Declare all entry-point identifiers for a procedure within the procedure. Place each entry-point identifier and a colon (:) at a point in the procedure at which execution is to start. You can call a procedure entry-point identifier from anywhere in the program.
Procedures, Subprocedures, and Procedure Pointers Subprocedure Entry-Point Identifiers Example 14-10. FORWARD Declarations for Entry Points INT to_this := 314; PROC add_1 (g2); INT .g2; FORWARD; ! FORWARD entry-point identifier ! declaration PROC add_2 (g2); INT .g2; FORWARD; ! FORWARD entry-point identifier ! declaration PROC add_3 (g2); INT .g2; FORWARD; ! FORWARD procedure declaration PROC mymain MAIN; BEGIN CALL add_1 (to_this); END; ! Main procedure declaration PROC add_3 (g2); INT .
Procedures, Subprocedures, and Procedure Pointers • • Subprocedure Entry-Point Identifiers To obtain the code address of a subprocedure entry-point identifier, preface the identifier with @. You can specify FORWARD subprocedure entry-point declarations, which look like FORWARD subprocedure declarations. Example 14-11. Subprocedure Entry-Point Identifiers literal write_op, read_op, writeread_op, readwrite_op; int proc io (op, buf); int op; int .ext buf; begin int subproc do_read_op (buf); int .
Procedures, Subprocedures, and Procedure Pointers Procedure Pointers Procedure Pointers Procedure pointers allow a program to call a variable dynamically or to call an EXTENSIBLE procedure. The syntax of procedure pointers is similar to the syntax of forward procedures; however, instead of the keyword PROC, you declare a procedure pointer using the keyword PROCPTR.
Procedures, Subprocedures, and Procedure Pointers • • Procedure Pointers UNSIGNED (width ) WADDR scale is a constant integer expression from -19 to 19. width is a constant integer expression from 1 to 31. procptr-name is the name of the procedure pointer. formal-param-names is the identifier of a formal parameter. A procedure can have up to 32 formal parameters, with no limit on the number of words of parameters and has the form: ( ) param-name param-pair , VST210.
Procedures, Subprocedures, and Procedure Pointers Procedure Pointers length is the identifier of a directly addressed INT simple variable. The actual parameter is an INT expression that specifies the length of string in bytes. attributes is an attribute described in Procedure Attributes on page 14-5. formal-param-spec is a formal parameter and has the following form: procptr param-type identifier . .EXT .SG .SGX ( referral ) , VST712.vsd procptr is a pointer identifier.
Procedures, Subprocedures, and Procedure Pointers Declaring PROCPTR Variables referral is the name of a previously declared structure or structure pointer. You must include referral if the formal parameter identifier is the name of a structure.
Procedures, Subprocedures, and Procedure Pointers Declaring PROCPTR in Structures The object data type of a reference to a function PROCPTR is the data type returned by the PROCPTR. You can equivalence a PROCPTR to any previously declared variable provided that the width of the previous variable is greater than or equal to the width of the PROCPTR. Example 14-12. PROCPTRs as Variables and Formal Parameters INT i; INT .EXT j; REAL k; PROCADDR pa; PROC p (i, j) EXTENSIBLE, CALLABLE; INT i, .
Procedures, Subprocedures, and Procedure Pointers Declaring PROCPTR in Structures previous-identifier The identifier of a field at the same level as procptr in the same structure. Example 14-13 on page 14-31 declares a REAL PROCPTR as a field in a structure array of 10 elements. Use an index to reference elements of array s1: CALL s1[3].f(3.0e1); Example 14-13.
Procedures, Subprocedures, and Procedure Pointers Declaring PROCPTRs as Formal Parameters Declaring PROCPTRs as Formal Parameters The compiler: • • Ensures that the procedure attributes and parameter data types of procedures passed as actual parameters match those defined in the formal parameters of the called procedure Builds parameter masks for calls to VARIABLE procedures and EXTENSIBLE procedures You can declare a formal parameter to be a PROCPTR as in the following example: PROC p(pp); PROCPTR pp(
Procedures, Subprocedures, and Procedure Pointers Assignments to PROCPTRs Assignments to PROCPTRs You can assign values to a PROCPTR variable in much the same way as you assign values to any variable; however, only values of data type PROCADDR can be assigned to a PROCPTR.
Procedures, Subprocedures, and Procedure Pointers Assignments to PROCPTRs Example 14-18. Assignments to PROCPTRs REAL r; INT i; STRUCT s1 [0:9]; BEGIN REAL PROCPTR f(x); REAL x; END PROCPTR; END; PROC p (i, j) EXTENSIBLE, CALLABLE; INT i, .EXT j; FORWARD; ! Declare PROC p in a ! FORWARD declaration PROCPTR a (i, j) EXTENSIBLE,CALLABLE; INT i, .
Procedures, Subprocedures, and Procedure Pointers Dynamically Selected Procedure Calls Dynamically Selected Procedure Calls You can use a PROCPTR to dynamically select a procedure to call. Example 14-19.
Procedures, Subprocedures, and Procedure Pointers Dynamically Selected Procedure Calls Example 14-20.
Procedures, Subprocedures, and Procedure Pointers Labels in Procedures Labels in Procedures A label is the target location of a GOTO statement. LABEL identifier ; , VST196.vsd identifier is as described in Identifiers on page 2-8. It cannot be an entry-point identifier. The following guidelines apply: • • • LABEL is not a valid data type for a formal procedure parameter. You cannot pass a label to a procedure. A label is not a valid actual procedure parameter.
Procedures, Subprocedures, and Procedure Pointers HP pTAL Reference Manual—523746-005 14 -38 Labels in Procedures
15 Built-In Routines Topics: • • • • • Privileged Mode on page 15-1 Parameters on page 15-2 Hardware Indicators on page 15-4 Atomic Operations on page 15-4 Nonatomic Operations on page 15-11 Built-in routine calls whose results do not depend on the values of variables (such as $LEN(n ) or $INT(10D)) can be used wherever constant values are allowed. The syntax descriptions in this section use these terms: Term Definition sINT Signed 16-bit integer. Range is -32,768 through 32,767.
Built-In Routines Parameters Routines that operate in privileged mode must be specially licensed, because they might (if improperly written) adversely affect the status of the processor in which they are running.
Built-In Routines Expressions as Parameters Example 15-2. Built-In Routine With Address Output Parameter STRING .s[0:99]; $BUILT_IN_2(@s); ! ERROR: s has no address container ! in which to store a new address Expressions as Parameters Many built-in routines accept expressions as parameters (see their individual syntax descriptions). If a parameter of a built-in routine is an expression: • • • The value of the expression can be any data type except STRING or UNSIGNED.
Built-In Routines Hardware Indicators Hardware Indicators The description of each built-in routine specifies which hardware indicators (condition code, $CARRY, and $OVERFLOW) the built-in routine sets. If the description does not specify the conditions for which the built-in routine sets the value of a hardware indicator, see the system description manual for your system.
Built-In Routines $ATOMIC_ADD $ATOMIC_ADD $ATOMIC_ADD atomically adds two INT values. $ATOMIC_ADD ( var , value ) ; VST607.vsd Sets condition code Yes (according the final value of var ) Sets $CARRY Yes, if traps are disabled Sets $OVERFLOW Yes, if traps are disabled; otherwise, traps on overflow var input,output sINT:variable is the variable that $ATOMIC_ADD increments. value input sINT:value is the value $ATOMIC_ADD adds to var.
Built-In Routines $ATOMIC_AND $ATOMIC_AND $ATOMIC_AND performs an atomic LAND on two INT values. $ATOMIC_AND ( var , mask ) ; VST608.vsd Sets condition code Yes (according the final value of var ) Sets $CARRY No Sets $OVERFLOW No var input,output sINT:variable is the variable to which $ATOMIC_AND applies mask. mask input INT:value is a 16-bit mask that $ATOMIC_AND applies to var.
Built-In Routines $ATOMIC_DEP $ATOMIC_DEP $ATOMIC_DEP atomically deposits bits into an INT variable. $ATOMIC_DEP value ) ( var , mask , ; VST609.vsd Sets condition code Yes (according the final value of var ) Sets $CARRY No Sets $OVERFLOW No var input,output INT:variable is the variable into which $ATOMIC_DEP deposits bits from value. mask input INT:value is a 16-bit mask word that determines which bits of value to deposit into var. $ATOMIC_DEP stores into each bit position of var.
Built-In Routines $ATOMIC_GET The following table shows examples of $ATOMIC_DEP: var value mask result %H0000 %H1234 %HAAAA %H0220 %H0000 %H1234 %H5555 %H1010 %H0000 %H6789 %HAAAA %H2288 %H0000 %H6789 %H5555 %H1010 $ATOMIC_GET $ATOMIC_GET atomically gets (returns) the value of a variable. $ATOMIC_GET ( var ) ; VST610.vsd Sets condition code Yes Sets $CARRY No Sets $OVERFLOW No var input type:variable is the variable whose value $ATOMIC_GET returns.
Built-In Routines $ATOMIC_OR $ATOMIC_OR $ATOMIC_OR performs an atomic LOR on two INT values. $ATOMIC_OR ( var , mask ) ; VST611.vsd Sets condition code Yes (according the final value of var ) Sets $CARRY No Sets $OVERFLOW No var input,output INT:variable is the variable to which $ATOMIC_OR applies mask. mask input INT:value is a 16-bit mask that $ATOMIC_OR applies to var.
Built-In Routines $ATOMIC_PUT $ATOMIC_PUT $ATOMIC_PUT atomically puts a value into a variable. $ATOMIC_PUT ( , var value ) ; VST612.vsd Sets condition code No Sets $CARRY No Sets $OVERFLOW No var output type:variable the variable into which $ATOMIC_PUT stores value. var must be one of: • • A 1-byte, 2-byte, or 4-byte variable whose address is an integral multiple of its width. A bit field fully contained in a 1-byte, 2-byte, or 4-byte variable that is aligned on an even-byte boundary.
Built-In Routines Nonatomic Operations Nonatomic Operations • • • • • • • • • • • pTAL Privileged Routines on page 15-11 Type-Conversion Routines on page 15-12 Address-Conversion Routines on page 15-14 Character-Test Routines on page 15-14 Minimum and Maximum Routines on page 15-15 Arithmetic Routines on page 15-15 Carry and Overflow Routines on page 15-15 FIXED-Expression Routines on page 15-15 Variable-Characteristic Routines on page 15-16 Procedure-Parameter Routines on page 15-16 Miscellaneous Routin
Built-In Routines Type-Conversion Routines Table 15-2. pTAL Privileged Routines (page 2 of 2) Procedure Description $TRIGGER Replaces $FREEZE and $HALT, which are available only for code generated for the TNS/R architecture $UNLOCKPAGE Unlocks one page of memory $WRITEPTE Writes a segment-page-table entry Type-Conversion Routines A type-conversion routine converts its argument or arguments from one data type to another data type. Table 15-3.
Built-In Routines Type-Conversion Routines Table 15-3. Built-In Type-Conversion Routines (page 2 of 2) Routine Converts ... To ...
Built-In Routines Address-Conversion Routines Address-Conversion Routines An address-conversion routine converts one address type to another address type. Table 15-4. Built-In Address-Conversion Routines Routine Converts ... To ...
Built-In Routines Minimum and Maximum Routines Minimum and Maximum Routines Minimum routines return the minimum of two arguments. Maximum routines return the maximum of two arguments. Table 15-6. Built-In Minimum and Maximum Routines Arguments are of the type ... Minimum Maximum Unsigned INT $LMIN $LMAX Signed INT, INT(32), FIXED(fpoint ), REAL, or REAL(64) $MIN $MAX Arithmetic Routines Table 15-7.
Built-In Routines Variable-Characteristic Routines Variable-Characteristic Routines Variable-characteristic routines return INT values that represent various characteristics of variables. Table 15-10. Built-In Variable-Characteristic Routines Routine Returns an INT value that is the ...
Built-In Routines Miscellaneous Routines Table 15-12.
Built-In Routines Miscellaneous Routines Table 15-13.
Built-In Routines Miscellaneous Routines Table 15-13. Built-In Routines for Nonatomic Operations (page 3 of 6) Routine Description Can Set ...
Built-In Routines Miscellaneous Routines Table 15-13. Built-In Routines for Nonatomic Operations (page 4 of 6) Routine Description Can Set ...
Built-In Routines Miscellaneous Routines Table 15-13.
Built-In Routines $ABS Table 15-13. Built-In Routines for Nonatomic Operations (page 6 of 6) Routine Description Can Set ...
Built-In Routines $ALPHA expression is an expression (as described in Section 5, Expressions). If the absolute value of a negative INT, INT(32), or FIXED expression cannot be represented in two’s complement form (for example, if expression has the INT value -32,768), $ABS traps if overflow traps are enabled (see Section 13, Hardware Indicators); otherwise, $ABS ignores the problem. Example 15-9.
Built-In Routines $ASCIITOFIXED Example 15-10. $ALPHA Routine STRING some_char; IF $ALPHA (some_char) THEN ... ; ! Test for alphabetic character $ASCIITOFIXED $ASCIITOFIXED converts an ASCII value to a FIXED value. $ASCIITOFIXED remainingdigits ( qvaluein , bufferaddr , qvalueout , maxdigits ) ; VST606.
Built-In Routines $ASCIITOFIXED qvaluein input FIXED(*):value is a value that $ASCIITOFIXED adds to the result of converting the bytes at bufferaddr. $ASCIITOFIXED multiplies qvaluein by 10 for each digit it converts from ASCII to FIXED. After it converts the last digit at bufferaddr, $ASCIITOFIXED adds qvaluein to the result of the conversion to establish the value that it returns qvalueout.
Built-In Routines $AXADR $AXADR Note. The EpTAL compiler does not support this routine. (The EpTAL compiler does allow $AXADR as a DEFINE name.) $AXADR converts a standard address or a relative extended address to an absolute extended address. $AXADR ( variable ) VST116.
Built-In Routines $BADDR_TO_WADDR pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code Yes Sets $CARRY No Sets $OVERFLOW No expression is an expression whose value is a BADDR address. Example 15-13. $BADDR_TO_EXTADDR Routine STRING .EXT s; STRING t; @s := $BADDR_TO_EXTADDR(@t); ! @t is a BADDR address $BADDR_TO_WADDR $BADDR_TO_WADDR converts a BADDR address to a WADDR address. $BADDR_TO_WADDR ( expression ) VST684.
Built-In Routines $BITLENGTH $BITLENGTH $BITLENGTH returns an INT value that is the length, in bits, of a variable. $BITLENGTH ( variable ) VST074.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No variable is the identifier of a simple variable, array element, pointer, structure, or structure data item.
Built-In Routines $BITOFFSET $BITOFFSET $BITOFFSET returns an INT value that is the offset, in bits, of a structure data item from the address of the zeroth structure occurrence. $BITOFFSET ( variable ) VST075.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No variable is the fully qualified identifier of a structure item. The zeroth structure occurrence has an offset of 0.
Built-In Routines $CARRY $CARRY $CARRY returns a value that indicates whether an arithmetic carry occurred during certain arithmetic operations or during execution of a SCAN or RSCAN statement. $CARRY VST076.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No The value returned by $CARRY is based on instructions emitted by the compiler that determine whether a carry occurred.
Built-In Routines $CHECKSUM $CHECKSUM $CHECKSUM returns the checksum of data. $CHECKSUM wordcount ( ) checksum , bufferaddr , ; VST613.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No checksum input,output uINT:variable the initial value (“seed” value) of the checksum. When $CHECKSUM completes, checksum holds the final checksum. checksum must be an INT variable.
Built-In Routines $COMP Example 15-18. $CHECKSUM Routine LITERAL buffer_len = 100; INT c_sum_val; INT .EXT buffer1 [ 0:buffer_len - 1 ]; INT .
Built-In Routines $COUNTDUPS $COUNTDUPS $COUNTDUPS returns the number of consecutive words, starting at the beginning of a buffer, that are equal to the first word in the buffer. $COUNTDUPS ( ) duplicationcount scraddr , maxwords , ; VST614.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No srcaddr input,output EXTADDR:variable an address.
Built-In Routines $DBL duplicationcount input,output uINT:variable holds an initial value. At the end of the operation, duplicationcount contains its original value plus the number of duplicate words found by $COUNTDUPS. duplicationcount must be an INT variable; it cannot be a STRING, UNSIGNED, or USE variable or a bit field. $COUNTDUPS scans a buffer from left to right until it encounters two adjacent unequal words or until it reads maxwords words. Example 15-20. $COUNTDUPS Routine LITERAL INT .
Built-In Routines $DBLL Example 15-21. $DBL Routine INT .EXT i; EXTADDR e; INT(32) j; j j j j j := := := := := $DBL(e); $DBL(@i); $DBL(i); $DBL(@j); $DBL(@e); ! ! ! ! ! OK: e is type EXTADDR OK: @i is type EXTADDR OK: i is type INT ERROR: @j is type WADDR ERROR: @e is type WADDR $DBLL $DBLL converts to INT values an INT(32) value. DBLL ( int-expression , int-expression ) VST079.
Built-In Routines $DBLR $DBLR $DBLR converts its argument to an INT(32) value and rounds the result. $DBLR ( expression ) VST080.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No expression is an INT, INT(32), FIXED, REAL, or REAL(64) expression.
Built-In Routines $EFLT dbl-expression is an INT(32) expression. fpoint is a value in the range -19 through +19 that specifies the position of the implied decimal point in the result. A positive fpoint specifies the number of decimal places to the right of the decimal. A negative fpoint specifies the number of integer places to the left of the decimal point.
Built-In Routines $EFLTR $EFLTR $EFLTR converts its argument to a REAL(64) value and rounds the result. $EFLTR ( ) expression VST083.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No expression is an INT, INT(32), FIXED(fpoint ), REAL, or REAL(64) expression. If a FIXED expression has a nonzero fpoint, the compiler multiplies or divides the result by the appropriate power of ten. Example 15-26.
Built-In Routines $EXCHANGE If a FIXED expression has a nonzero fpoint, the compiler multiplies or divides the result by the appropriate power of ten. Example 15-27. $EFLTR Routine REAL(64) rndnum; FIXED(3) fixnum := 12345.678F; rndnum := $EFLTR (fixnum); ! Return rounded REAL(64) value $EXCHANGE $EXCHANGE exchanges the values of two variables of the same data type. $EXCHANGE ( var1 , var2 ) ; VST615.
Built-In Routines $EXECUTEIO $EXECUTEIO Note. The EpTAL compiler does not support this procedure. $EXECUTEIO executes an I/O operation. $EXECUTEIO ( , lacsubcommand channel-status ) , channel lprmcommand , , rdstdevstatus ; VST616.vsd pTAL privileged procedure Yes Can be executed only by privileged procedures Yes Sets condition code Yes Sets $CARRY No Sets $OVERFLOW No channel input uINT:value is the channel number to which the I/O is initialized.
Built-In Routines $EXTADDR_TO_BADDR channel-status output sINT:variable See the system description manual for your system for details. Example 15-28. $EXECUTEIO Routine INT INT INT INT INT channel; lprm_command; lac_subcommand; rdst_dev_status; channel_status; $EXECUTEIO (channel, lprm_command, lac_subcommand, rdst_dev_status, channel_status); $EXTADDR_TO_BADDR $EXTADDR_TO_BADDR converts an EXTADDR address to a BADDR address. $EXTADDR_TO_BADDR ( ) expression VST686.
Built-In Routines $EXTADDR_TO_WADDR $EXTADDR_TO_WADDR $EXTADDR_TO_WADDR converts an EXTADDR address to an WADDR address. $EXTADDR_TO_WADDR ( ) expression VST687.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No expression is an expression whose value is an EXTADDR address. Example 15-30. $EXTADDR_TO_WADDR Routine PROC p(x); INT .EXT x; BEGIN INT .
Built-In Routines $FILL8, $FILL16, and $FILL32 pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No area-to-fill is a variable of any data type. The address of area-to-fill specifies the beginning of the area to fill. repetitions is an INT expression whose value specifies the number of times to write.
Built-In Routines $FIX $FIX $FIX converts its argument to a FIXED value. $FIX expression ( ) VST084.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No expression is an INT, INT(32), FIXED, REAL, or REAL(64) expression.
Built-In Routines $FIXEDTOASCII fixed-expression is a FIXED expression, which $FIXD treats as a FIXED expression, ignoring any implied decimal point. If the result cannot be represented in a signed doubleword, $FIXD traps if overflow traps are enabled (see Section 13, Hardware Indicators); otherwise, $FIXD ignores the problem. Example 15-33.
Built-In Routines $FIXEDTOASCIIRESIDUE If $FIXEDTOASCII converts maxdigits bytes but leading digits in qvalue are not converted, and $OVERFLOW can be checked, $FIXEDTOASCII sets $OVERFLOW; otherwise, it resets $OVERFLOW. Example 15-34. $FIXEDTOASCII Routine LITERAL FIXED STRING buffer_len = 100; val; .
Built-In Routines $FIXI qresidue output FIXED(*):variable holds any of the original value that was not converted because maxdigits bytes were converted without converting all of qvalue. $FIXEDTOASCIIRESIDUE returns in qresidue any portion of qvalue that it does not convert because maxdigits digits were written but qvalue was not fully converted.
Built-In Routines $FIXL Example 15-36. $FIXI Routine INT intnum; FIXED fixnum := %177777F; intnum := $FIXI (fixnum); ! Return -1 $FIXL $FIXL converts a FIXED value to an unsigned INT value. $FIXL fixed-expression ( ) VST087.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW Yes fixed-expression is a FIXED expression, which $FIXL treats as a FIXED expression, ignoring any implied decimal point.
Built-In Routines $FLT pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW Yes expression is an INT, INT(32), FIXED, REAL, or REAL(64) expression. If expression is too large in magnitude to be represented by a 64-bit two’s complement integer, $FIXR traps if overflow traps are enabled (see Section 13, Hardware Indicators); otherwise, $FIXR ignores the problem. Example 15-38.
Built-In Routines $FLTR Example 15-39. $FLT Routine REAL realnum; INT(32) dblnum := 147D; realnum := $FLT (dblnum); ! Return 147E0 $FLTR $FLTR converts its argument to a REAL value and rounds the result. $FLTR expression ( ) VST090.
Built-In Routines $FREEZE $FREEZE Note. • • The EpTAL compiler does not support this procedure. Use $TRIGGER on page 15-88 instead. (The EpTAL compiler does allow $FREEZE as a DEFINE name.) Execution does not return from this call. $FREEZE halts the processor in which its process is running and any other processors on the same node that have FREEZE enabled. $FREEZE VST619.
Built-In Routines $HIGH $HIGH $HIGH converts the high-order (leftmost) 16 bits of an INT(32) or EXTADDR value to an INT value. dbl-expression ( $HIGH ) VST091.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No dbl-expression is an expression whose value is INT(32) or EXTADDR. $HIGH returns the high-order 16 bits of dbl-expression and preserves the sign bit. $HIGH does not cause overflow. Example 15-41.
Built-In Routines $INT pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No int-expression is a signed INT expression. fpoint is a value in the range -19 through +19 that specifies the position of the implied decimal point in the result. A positive fpoint specifies the number of decimal places to the right of the decimal. A negative fpoint specifies the number of integer places to the left of the decimal point.
Built-In Routines $INT_OV expression is an expression whose value is an INT, INT(32), UNSIGNED(1-16), UNSIGNED(17-31), FIXED, REAL, REAL(64), SGBADDR, SGWADDR, SGXBADDR, SGXWADDR, or EXTADDR value. If expression is not a FIXED, REAL, or REAL(64) value, $INT returns the low-order (rightmost) 16 bits of expression. $INT never causes overflow. $INT does not explicitly maintain the sign of expression. In Example 15-43 on page 15-54, $INT returns -1 although the argument to $INT is a positive number.
Built-In Routines $INTERROGATEHIO pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW Yes expression is an expression whose value is an INT, INT(32), UNSIGNED(1-31), FIXED, REAL, REAL(64), SGBADDR, SGWADDR, SGXBADDR, SGXWADDR, or EXTADDR value.
Built-In Routines $INTERROGATEHIO pTAL privileged procedure No Can be executed only by privileged procedures Yes Sets condition code Yes Sets $CARRY No Sets $OVERFLOW No select output uINT:variable is an integer variable that is always set to 0. rank-channel output uINT:variable is an integer variable that is always set to 0. ric-int-cause output uINT:variable is the read interrupt cause received from the controller holding the completed I/O.
Built-In Routines $INTERROGATEIO $INTERROGATEIO Note. The EpTAL compiler does not support this procedure. $INTERROGATEIO stores cause and status information from an I/O interrupt, which the operating system uses to reset the interrupt. $INTERROGATEIO , ric-int-cause ) ( , select rank-channel , rist-int-cause , channel-status ; VST644.
Built-In Routines $INTR channel-status output sINT:variable is an integer variable that holds the status returned by the controller. Example 15-47.
Built-In Routines $LEN Example 15-48. $INTR Routine INT rndnum; REAL realnum := 12345E-2; rndnum := $INTR (realnum); ! Return 123 $LEN $LEN returns an INT value that is the length, in bytes, of a variable. $LEN variable ( ) VST096.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No variable is the identifier of a simple variable, array element, pointer, structure, or structure data item.
Built-In Routines $LFIX Example 15-50. $LEN Routine INT s_len; STRUCT .s[0:99]; BEGIN INT(32) array[0:2]; END; s_len := $LEN (s); ! Return 12 Example 15-51. $LEN Routine INT array_length; INT(32) array[0:2]; array_length := $LEN (array) * $OCCURS (array); ! Return 12, the length of the entire array in bytes $LFIX $LFIX converts an unsigned INT value to a FIXED(fpoint ) value. $LFIX ( int-expression fpoint , ) VST097.
Built-In Routines $LMAX Example 15-52. $LFIX Routine FIXED(2) fixnum; INT intnum := 125; fixnum := $LFIX (intnum, 2); ! Return 1.25 $LMAX $LMAX returns the maximum of two unsigned INT values. ( $LMAX int-expression int-expression , ) VST098.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No int-expression is an unsigned INT expression. Example 15-53.
Built-In Routines $LOCATESPTHDR int-expression is an unsigned INT expression. Example 15-54. $LMIN Routine INT intval := 3; min := $LMIN (intval, 5); ! Return 3 $LOCATESPTHDR Note. The EpTAL compiler does not support this procedure. $LOCATESPTHDR returns the address of the Segment Page Table (SPT). $LOCATESPTHDR sptbase ) ( headersize , virtaddr , ; VST645.
Built-In Routines $LOCKPAGE $LOCATESPTHDR returns in sptbase the address of the segment-page table for the address in virtaddr. Example 15-55. $LOCATESPTHDR Routine INT headersize; EXTADDR addr; EXTADDR seg_page_table_base; $LOCATESPTHDR(headersize, addr, seg_page_table_base); $LOCKPAGE Note. The EpTAL compiler does not support this procedure. $LOCKPAGE locks one page of memory. ( $LOCKPAGE virtaddr ) , only-if-locked lock-count , ; VST646.
Built-In Routines $MAX virtaddr input EXTADDR:value is the beginning virtual address to lock. $LOCKPAGE calculates the page associated with virtaddr. Example 15-56. $LOCKPAGE Routine INT only_if_locked; INT lock_count; EXTADDR virtaddr; $LOCKPAGE(only_if_locked, lock_count, virtaddr); $MAX $MAX returns the maximum of two signed values. $MAX expression ( , expression ) VST100.
Built-In Routines $MOVEANDCXSUMBYTES pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No expression is an INT, INT(32), FIXED(fpoint ), REAL, or REAL(64) expression. Both expressions must be of the same data type. Example 15-58.
Built-In Routines $MOVEANDCXSUMBYTES destaddr input,output EXTADDR:variable is the address to which $MOVEANDCXSUMBYTES moves data. When $MOVEANDCXSUMBYTES completes, destaddr points to the memory location following the last byte written. srcaddr input,output EXTADDR:variable is the address from which bytes are read. When $MOVEANDCXSUMBYTES completes, srcaddr points to the memory location following the last byte read. count input uINT:value is the number of bytes to move.
Built-In Routines $MOVENONDUP $MOVENONDUP $MOVENONDUP moves words from one location to another until it encounters two adjacent identical words. $MOVENONDUP maxwords , ( lastword destaddr , ) ; srcaddr , VST648.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code Yes Sets $CARRY No Sets $OVERFLOW No destaddr input,output EXTADDR:variable is the address to which words are moved.
Built-In Routines $NUMERIC Example 15-60. $MOVENONDUP Routine INT .EXT source; INT .EXT destination; INT maxword; INT latestword; $MOVENONDUP(@destination, @source, maxword, latestword); $NUMERIC $NUMERIC tests the right byte of an INT value for the presence of a numeric character. $NUMERIC ( int-expression ) ; VST102.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No int-expression is an INT expression.
Built-In Routines $OCCURS $OCCURS $OCCURS returns an INT value that is the number of elements in an array. $OCCURS ( variable ) VST103.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No variable is the name of a variable, array, structure, or structure field. variable cannot be the name of a structure template.
Built-In Routines $OCCURS Table 15-15.
Built-In Routines $OFFSET Example 15-63. $OCCURS Routine With Structure Arrays INT i; STRUCT s[0:9]; BEGINSTRUCT t[0:7]; BEGIN INT i[0:4]; INT f; END; END; i i i i i i i := := := := := := := $OCCURS(s); $OCCURS(s[7].t); $OCCURS(s[7].t[3].i); $OCCURS(s[7].t[3].f); $OCCURS(s[7]); $OCCURS(s[7].t[3]); $OCCURS(s[7].t[3].
Built-In Routines $OFFSET variable is the fully qualified identifier of a structure field. The compiler reports an error for the following uses of $OFFSET: • • • • $OFFSET applied to an UNSIGNED field. Use $BITOFFSET instead of $OFFSET. $OFFSET applied to an item that is not a field in a structure. $OFFSET applied to a structure array whose lower bound is nonzero; however, $OFFSET applied to a substructure array whose lower bound is nonzero returns the appropriate offset.
Built-In Routines $OPTIONAL Example 15-67. $OFFSET Routine Applied to a Template Structure INT x; STRUCT st[-1:1]; BEGIN INT item; FIXED(2) price; END; x := $OFFSET (st[-1].item); !x gets -10 $OPTIONAL $OPTIONAL controls whether a given parameter or parameter pair is passed to a VARIABLE procedure or EXTENSIBLE procedure. $OPTIONAL ( cond-expression , param ) param-pair VST213.
Built-In Routines $OPTIONAL param-pair is an actual parameter pair to pass to a formal parameter pair declared in the called procedure if cond-expression is true. param-pair has the form: string : length VST039.vsd string is the identifier of a STRING array or simple pointer declared inside or outside a structure. length is an INT expression that specifies the length, in bytes, of string. A call to a VARIABLE or EXTENSIBLE procedure can omit some or all parameters.
Built-In Routines $OPTIONAL Example 15-69. Parameters Omitted Conditionally and Unconditionally PROC p1 (i) EXTENSIBLE; INT i; BEGIN ! Lots of code END; PROC p2; BEGIN INT n := 1; CALL p1 ($OPTIONAL (n < 0, n) ); CALL p1 ( ); END; ! These two calls are ! indistinguishable Example 15-70. Parameters Passed Conditionally PROC p1 (str:len, b) EXTENSIBLE; STRING .str; INT len; INT b; BEGIN ! Lots of code END; PROC p2; BEGIN STRING .
Built-In Routines $OVERFLOW Example 15-71. $OPTIONAL Routine for a Front-End Interface (page 2 of 2) PROC p2 (p, q) EXTENSIBLE; INT .p; INT .q; BEGIN ! Lots of code CALL p1 ($OPTIONAL ($PARAM (p), p ), $OPTIONAL ($PARAM (q), q )); ! Lots of code END; $OVERFLOW $OVERFLOW returns a value indicating whether an overflow occurred during certain arithmetic operations. $OVERFLOW VST105.
Built-In Routines $PARAM Example 15-72. $OVERFLOW Routine i := i + 1; IF $OVERFLOW THEN ... For more information about overflow, see Section 13, Hardware Indicators. $PARAM $PARAM checks for the presence or absence of an actual parameter in the call that called the current procedure or subprocedure. $PARAM ( formal-param ) VST106.
Built-In Routines $POINT $POINT $POINT returns the fpoint value (as an integer) of a FIXED expression. $POINT ( fixed-expression ) VST107.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No fixed-expression is a FIXED expression. The compiler emits no instructions when evaluating fixed-expression ; therefore, fixed-expression cannot call a routine and cannot be an assignment expression. Example 15-74.
Built-In Routines $READBASELIMIT identifier is either a procedure address (that is, @procedure-name ) or an INT(32) expression. $READBASELIMIT Note. The EpTAL compiler does not support this procedure. $READBASELIMIT returns the base and limit of the current extended segment. $READBASELIMIT ( xbase , xlimit ) VST649.
Built-In Routines $READCLOCK $READCLOCK $READCLOCK returns the current setting of the system clock as a FIXED value. $READCLOCK VST108.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No Example 15-76. $READCLOCK Routine FIXED the_time; the_time := $READCLOCK; ! Return current clock time $READSPT Note. The EpTAL compiler does not support this procedure.
Built-In Routines $READTIME sptentryaddr output EXTADDR:variable is the address at which $READSPT stores the SPT entry. Example 15-77. $READSPT Routine EXTADDR virtual_addr; INT .EXT spt_entry(spt_template) := spt_entry_addr; $READSPT(virtual_addr, @spt_entry); $READTIME $READTIME returns the number of microseconds since the last cold load. Note. $READTIME is not affected by the TACL command SETTIME; therefore, $READTIME does not always return the value [JULIANTIMESTAMP(0) - JULIANTIMESTAMP(1)].
Built-In Routines $SCALE $SCALE $SCALE moves the position of the implied fixed-point (decimal point) by changing a FIXED(fpoint ) value. $SCALE ( fixed-expression , scale ) VST110.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW Yes fixed-expression is the FIXED expression whose implied decimal point is to be changed.
Built-In Routines $SGBADDR_TO_EXTADDR Example 15-80. Using the $SCALE Routine to Maintain Precision FIXED(3) num, a, b; ! fpoint of 3 num := $SCALE (a,3) / b; ! Scale a to FIXED(6); result is a ! FIXED(3) value $SGBADDR_TO_EXTADDR $SGBADDR_TO_EXTADDR converts an SGBADDR or SGXBADDR address to an EXTADDR address. $SGBADDR_TO_EXTADDR ( expression ) VST603.
Built-In Routines $SGWADDR_TO_EXTADDR pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No expression is an expression whose value is an SGBADDR or SGXBADDR address. $SGBADDR_TO_SGWADDR returns expression converted to an SGWADDR address. The result is undefined if the least significant bit of expression is 1. Example 15-82. $SGBADDR_TO_SGWADDR Routine STRING .SG s; INT .
Built-In Routines $SGWADDR_TO_SGBADDR Example 15-83. $SGWADDR_TO_EXTADDR Routine STRING .EXT s; INT .SG i; @s := $SGWADDR_TO_EXTADDR(@i); $SGWADDR_TO_SGBADDR $SGWADDR_TO_SGBADDR converts an SGWADDR or SGXWADDR address to an SGBADDR address. $SGWADDR_TO_SGBADDR ( expression ) VST690.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No expression is an expression whose value is an SGWADDR or SGXWADDR address.
Built-In Routines $STACK_ALLOCATE pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No int-expression is an INT expression. $SPECIAL inspects bits <8:15> of the int-expression and ignores bits <0:7>.
Built-In Routines $STACK_ALLOCATE size is an INT expression that specifies the number of bytes to allocate. size is an unsigned value from 0 through 65534. Difference between pTAL and EpTAL compilers: pTAL Compiler EpTAL Compiler If size is not an integral multiple of 8, $STACK_ALLOCATE rounds size up to the next integral multiple of 8. If size is not an integral multiple of 32, $STACK_ALLOCATE rounds size up to the next integral multiple of 32. The returned value is aligned to an 8-byte boundary.
Built-In Routines $TRIGGER $TRIGGER Note. • • The pTAL compiler does not support this routine. Execution does not return from this call. $TRIGGER replaces $FREEZE on page 15-51 and $HALT on page 15-51, which are available only for code generated for the TNS/R architecture. $TRIGGER ( op ) VST060.vsd pTAL privileged procedure Yes Can be executed only by privileged procedures Yes Sets condition code No Sets $CARRY No Sets $OVERFLOW No op is an INT(32) value. Example 15-87.
Built-In Routines $UDBL variable is the identifier of a simple variable, array, simple pointer, structure, structure data item, or structure pointer. $TYPE returns an INT value that has a meaning as follows: Value Meaning Value Meaning 0 Undefined 5 REAL 1 STRING 6 REAL(64) 2 INT 7 Substructure 3 INT(32) 8 Structure 4 FIXED 9 UNSIGNED For a structure pointer, $TYPE returns the value 8, regardless of whether the structure pointer points to a structure or to a substructure.
Built-In Routines $UDIVREM16 Example 15-89. $UDBL Routine INT a16 := -1;s INT(32) a32; a32 := $UDBL (a16); ! Return 65535D $UDIVREM16 $UDIVREM16 divides an INT(32) dividend by an INT divisor to produce an INT quotient and INT remainder. $UDIVREM16 quotient ( dividend remainder , divisor , ) , ; VST653.
Built-In Routines • $UDIVREM32 If both dividend and divisor have constant values whose unsigned quotient is greater than 16 bits, the compiler reports overflow: INT quot, rem; $UDIVREM16(65536 * 1024, 256, quot, rem); • ! Report error If both dividend and divisor are constants, and you test $OVERFLOW following the call to $UDIVREM16, the compiler reports a warning that overflow cannot occur: $UDIVREM16(32767, 256, quot, rem); IF $OVERFLOW THEN ...
Built-In Routines $UDIVREM32 divisor input sINT:value quotient output INT(32):variable remainder output sINT:variable The compiler checks the following conditions during compilation: • If the value of divisor is a constant value of zero, the compiler reports an error that division by zero is not valid: $UDIVREM32(dividend, 2 / 2 - 1, quot, rem); • ! Report error If both dividend and divisor are constants, and you test $OVERFLOW following the call to $UDIVREM32, the compiler reports a warning th
Built-In Routines $UNLOCKPAGE $UNLOCKPAGE Note. The EpTAL compiler does not support this procedure. $UNLOCKPAGE unlocks one page of memory.. ( $UNLOCKPAGE unlockcount , virtaddr ) ; VST655.vsd pTAL privileged procedure Yes Can be executed only by privileged procedures Yes Sets condition code Yes Sets $CARRY No Sets $OVERFLOW No unlockcount input sINT:value is the total number of bytes to unlock in the page. virtaddr input EXTADDR:value is the beginning virtual address to unlock.
Built-In Routines $WADDR_TO_EXTADDR pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No expression is an expression whose value is a WADDR address. Example 15-93. $WADDR_TO_BADDR Routine STRING .s; INT t; @s := $WADDR_TO_BADDR(@t); ! @t is a WADDR address $WADDR_TO_EXTADDR $WADDR_TO_EXTADDR converts a WADDR address to an EXTADDR address. $WADDR_TO_EXTADDR ( expression ) VST692.
Built-In Routines $WRITEPTE $WRITEPTE Note. The EpTAL compiler does not support this procedure. $WRITEPTE writes a segment-page-table entry. $WRITEPTE abs ) ( ptetag , , pageframe : VST656.vsd pTAL privileged procedure Yes Can be executed only by privileged procedures Yes Sets condition code No Sets $CARRY Yes Sets $OVERFLOW No ptetag input uINT:value are the page attribute bits associated with pageframe.
Built-In Routines $XADR $XADR $XADR converts a standard address to an EXTADDR address. $XADR ( variable ) VST115.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No variable is a variable that has a standard address. $XADR returns an EXTADDR address. If the argument to $XADR is not a variable, the compiler reports an error.
16 Compiling and Linking pTAL Programs Input to the compiler is a source file containing pTAL source text (such as data declarations, statements, compiler directives, and comments). Output from the compiler is a linkfile consisting of relocatable code and data blocks. To produce an executable pTAL program, link one or more linkfiles into a single loadfile (see Figure 16-1 on page 16-1). Figure 16-1.
Compiling and Linking pTAL Programs Compiling Source Files Topics: • • • • • Compiling Source Files on page 16-2 Linking Object Files on page 16-7 Creating a Dynamic Linked Library (DLL) on page 16-12 Compiling With Global Data Blocks on page 16-12 Compiling With Saved Global Data on page 16-17 Note. The remainder of this section applies only to Guardian platforms. To compile and link pTAL programs on Windows platforms, see Section 18, pTAL Cross Compiler.
Compiling and Linking pTAL Programs Input Files Topics: • • • • Input Files on page 16-3 Output Files on page 16-3 Running the Compiler on page 16-4 Completion Codes Returned by the Compiler on page 16-6 Input Files The compiler reads input only from an edit-format disk file up to a maximum of 132 characters for each record, ignoring characters after the 132nd (and issuing a warning for each such line). The compiler does not read input from a terminal or from any other source or file format.
Compiling and Linking pTAL Programs Running the Compiler Running the Compiler To run the compiler on Guardian platforms, issue a compilation command at the HP TACL prompt. Options that you can specify in the compilation command are: • • • • IN File Option on page 16-4 OUT File Option on page 16-4 HP TACL Run Options on page 16-5 Target File Option on page 16-6 You can include one or more compiler directives in the compilation command (see Compilation Command on page 17-1).
Compiling and Linking pTAL Programs Running the Compiler HP TACL Run Options You can include one or more HP TACL run options in the compilation command, such as: • • • • • A process name A CPU number A priority level The NOWAIT option A swap volume For example, you can specify CPU 3 and NOWAIT when you run the compiler: pTAL /IN mysource, CPU 3, NOWAIT/ myobject EpTAL /IN mysource, CPU 3, NOWAIT/ myobject For information about HP TACL run options, see the RUN command in the TACL Reference Manual.
Compiling and Linking pTAL Programs Completion Codes Returned by the Compiler Target File Option The target file is the disk file that is to receive the object code. You can specify a file name or a DEFINE name as described in Appendix B, Disk File Names and HP TACL Commands. These examples write the object code to a disk file named myobject: pTAL /IN mysource/ myobject EpTAL /IN mysource/ myobject If you omit the target file, the compiler creates a file named object on your current default subvolume.
Compiling and Linking pTAL Programs Linking Object Files Linking Object Files The linker links one or more linkfiles to produce either a loadfile or another linkfile.
Compiling and Linking pTAL Programs Linking Object Files Figure 16-2. Creating a Loadfile on TNS/E for TNS/E pTAL Source Code EpTAL Compiler TNS/E Nonexecutable Object Code (PIC) eld TNS/E Executable Object Code (PIC) VST045.vsd The source code can be in one or more files. From each source code file, the compiler generates a single nonexecutable object code file. Input these object code files to the linker to produce a single loadfile. (See Figure 16-1 on page 16-1.
Compiling and Linking pTAL Programs Linking Object Files Figure 16-3. Creating Loadfiles on TNS/R for TNS/R pTAL Source Code pTAL Compiler NOCALL_SHARED directive (default) CALL_SHARED directive TNS/R Nonexecutable Object Code (non-PIC) TNS/R Nonexecutable Object Code (PIC) nld ld TNS/R Executable Object Code (non-PIC) TNS/R Executable Object Code (PIC) VST054.vsd The source code can be in one or more files.
Compiling and Linking pTAL Programs Linking Object Files Figure 16-4. Creating a Loadfile on TNS for TNS/R TNS TAL Source Code TAL Compiler TNS Nonexecutable Object Code (non-PIC) Binder TNS Executable Object Code (non-PIC) TNS/R AXCEL TNS & TNS/R Executable Object Code (non-PIC) VST824.vsd The source code can be in one or more files. From each source code file, the compiler generates a single nonexecutable object code file. Input these object code files to Binder to produce a single loadfile.
Compiling and Linking pTAL Programs Linking Object Files As Figure 16-4 on page 16-10 shows, the Accelerator (AXCEL) is available on both TNS/R and TNS processors; therefore, you can do either of the following: • • Accelerate your TNS executable object code while it is on a TNS processor and then move the resulting executable object code to a TNS/R processor. Move your TNS executable object code to a TNS/R processor and then accelerate it.
Compiling and Linking pTAL Programs Creating a Dynamic Linked Library (DLL) Creating a Dynamic Linked Library (DLL) To create a dynamic-link library (DLL) from pTAL source files, compile the pTAL source files by using the CALL_SHARED directive (in the Guardian environment) or the -call_shared flag (in the Windows environment), and then use ld or eld to link the pTAL source files through the -shared option. The compiler does not automatically export program names.
Compiling and Linking pTAL Programs Declaring Global Data Topics: • • • • Naming Compilation Units on page 16-13 Declaring Named Data Blocks on page 16-13 Declaring Private Data Blocks on page 16-14 Declaring Unblocked Data on page 16-14 Naming Compilation Units To assign an identifier to a compilation unit, specify the NAME declaration as the first declaration in the compilation unit. (If no BLOCK declaration appears in the compilation unit, you need not include the NAME declaration.
Compiling and Linking pTAL Programs Declaring Global Data Declaring Private Data Blocks A private data block is a global data block that is shareable only among the procedures within a compilation unit. You can include only one private data block in a compilation unit. The private data block inherits the identifier you specify in the NAME declaration; therefore, the NAME declarations in all compilations that you use to assemble an executable program must have unique names.
Compiling and Linking pTAL Programs Allocating Global Data Blocks Named data blocks are split the same way. For example: BLOCK blk; INT x; INT .y; INT .ext z [0:99]; END BLOCK; Two data blocks are created. Variables x and y are placed in the block named BLK and z is placed in the block named $BLK. You can link object files compiled with and without template blocks with no loss of information. A referral structure and the structure layout to which it refers can appear in different data blocks.
Compiling and Linking pTAL Programs Sharing Global Data Blocks Sharing Global Data Blocks Because the length of any shared data block must match in all compilation units, it is recommended that you declare all shareable global data in one source file. You can then share that global data block with other source files as follows: 1. In the source file that declares the data block, specify the SECTION directive at the beginning of the data block to assign a section name to the data block.
Compiling and Linking pTAL Programs Compiling With Saved Global Data Compiling With Saved Global Data Note. This topic applies only to the pTAL compiler. If you are using the EpTAL compiler, see Migrating from TNS/R to TNS/E on page 17-11. During program development or maintenance, you often need to change procedural code or data without changing the global declarations. You can save the global data in a file during a compilation session and then use the saved global data during a subsequent compilation.
Compiling and Linking pTAL Programs Compiling With Saved Global Data HP pTAL Reference Manual—523746-005 16 -18
17 Compiler Directives Topics: • • • • • • • Specifying Compiler Directives on page 17-1 File Names as Compiler Directive Arguments on page 17-3 (Guardian platforms only) Directive Stacks on page 17-4 Toggles on page 17-5 Saving and Using Global Data Declarations on page 17-8 Summary of Compiler Directives on page 17-13 Topics for individual compiler directives, beginning with ASSERTION on page 17-18 Specifying Compiler Directives You can specify compiler directives either in the compilation command or
Compiler Directives Directive Line directive is a directive listed in Table 17-1 on page 17-14 or Table 17-2 on page 17-16, except the following, which can appear only in the source file (see Directive Line on page 17-2): • • • • • • • ASSERTION on page 17-18 BEGINCOMPILATION on page 17-19 (not recommended) ENDIF on page 17-27 IF and IFNOT on page 17-36 PAGE on page 17-49 SECTION on page 17-55 SOURCE on page 17-58 Example 17-1. Compilation Commands With Compiler Directives EPTAL /IN mysrc, OUT $s.
Compiler Directives File Names as Compiler Directive Arguments Rules for directive lines: • • • • Begin each directive line by specifying ? in column 1. (? is not part of the directive name.) Place the name of the directive and its arguments on the same line unless the directive description says you can use continuation lines. Do not put extra characters (such as semicolons) at the end of a directive line.
Compiler Directives Directive Stacks Directive Stacks Each of these directives has a compile-time directive stack onto which you can push, and from which you can pop, directive settings: • • • • • • • • • CHECKSHIFTCOUNT on page 17-22 DEFEXPAND on page 17-24 DO_TNS_SYNTAX on page 17-26 GP_OK on page 17-35 INNERLIST on page 17-39 LIST on page 17-41 MAP on page 17-43 OVERFLOW_TRAPS on page 17-47 REFALIGNED on page 17-51 Each directive stack is 31 levels deep.
Compiler Directives Example Example In Example 17-2 on page 17-5: 1. LIST is the default setting for the source file. 2. PUSHLIST pushes the LIST directive setting onto the LIST directive stack. 3. NOLIST suppresses listing of procedures included by the SOURCE directive. 4. POPLIST pops the top value from the LIST directive stack and restores LIST as the current setting for the remainder of the source file. Example 17-2.
Compiler Directives Named Toggles Named Toggles Before you use a named toggle in an IF or IFNOT directive, you must specify that name in a DEFINETOG, SETTOG, or RESETTOG directive. Which of these directives you use depends on whether you want the setting of the toggle to be unchanged, turned on, or turned off.
Compiler Directives Examples Example 17-3. DEFINETOG, IF, and ENDIF Directives ?DEFINETOG scanner ... ! Define toggle ?IF scanner PROC skipped; BEGIN ... END; ?ENDIF scanner ! Test toggle for on state ! Find it off, skip procedure ! End of skipped procedure Example 17-4. DEFINETOG, IFNOT, and ENDIF Directives Directive ?DEFINETOG emitter ... ! Define toggle ?IFNOT emitter ! Test toggle for off state PROC kept; BEGIN ...
Compiler Directives Saving and Using Global Data Declarations Example 17-7. SETTOG, RESETTOG, IF, and ENDIF Directives ?SETTOG (versn1, versn2, 7, 4, 11) ?SETTOG versn3 ?RESETTOG (versn2, 7) ! Turn on toggles ! Turn on toggle ! Turn off toggles ... ?IF versn2 PROC version_2; BEGIN ...
Compiler Directives Saving Global Data Declarations Saving Global Data Declarations When you compile with SAVEGLOBALS, the compiler saves the global data declarations—global data identifiers and their attributes (such as data type and kind of variable initialization)—in a file whose file code is 701. If you make no changes in the global data declarations, you can use the saved declarations in subsequent USEGLOBALS compilations, reducing their compilation time.
Compiler Directives Examples Caution. Be sure the global data declarations in both the SAVEGLOBALS and USEGLOBALS compilations are identical. If you include new or changed global data declarations anywhere in the USEGLOBALS source file, results are unpredictable.
Compiler Directives Migrating from TNS/R to TNS/E A USEGLOBALS compilation (Example 17-10 on page 17-11) then produces object file newobj and retrieves global data declarations and initialization from ptalsym and global initializations from myobj. When USEGLOBALS is active, the compiler ignores text lines and SOURCE directives until BEGINCOMPILATION appears in the source file. Example 17-10.
Compiler Directives Migrating from TNS/R to TNS/E If some files do not compile successfully because of missing global data declarations, the source code files were not set up correctly and you must modify one or more of them. For example: 1. Suppose that the original SAVEGLOBALS compilation source file is COMP1 in Example 17-13 on page 17-12. Example 17-13. Original SAVEGLOBALS Compilation Source File ! COMP1 ?FIELDALIGN (SHARED2) name x; ?source FILE1 ?source FILE2 ...
Compiler Directives Summary of Compiler Directives Example 17-14. New GLOBALS Source File (page 2 of 2) struct s(*); begin ... end; ! All other common declarations and directives in the ! compilation ! End of GLOBALS 3. Use a SOURCE directive to include GLOBALS in COMP1 (as in Example 17-15 on page 17-13). Example 17-15.
Compiler Directives Summary of Compiler Directives Table 17-1.
Compiler Directives Summary of Compiler Directives Table 17-1.
Compiler Directives Summary of Compiler Directives Table 17-1.
Compiler Directives Summary of Compiler Directives Table 17-2.
Compiler Directives ASSERTION Table 17-2. Compiler Directives by Name (page 3 of 3) Directive Operation SYNTAX Checks the syntax, suppressing the object code TARGET3 Specifies the architecture on which the program will run USEGLOBALS2 Reads global data declarations and initial values from a file WARN Suppresses compiler warnings 1. The EpTAL compiler ignores this directive. 2. The EpTAL compiler does not accept this directive. 3. The pTAL and EpTAL compilers treat this directive differently.
Compiler Directives Default: BEGINCOMPILATION None Placement: • • Scope: Applies until another ASSERTION overrides it Dependencies: Has no effect without the ASSERT statement References: ASSERT on page 12-3 Anywhere in the source file (not in the compilation command) Must be the last directive on the directive line ASSERT on page 12-3 explains how to use the ASSERTION directive and the ASSERT statement together. BEGINCOMPILATION Note. The EpTAL compiler ignores this directive.
Compiler Directives BLOCKGLOBALS BLOCKGLOBALS BLOCKGLOBALS determines how the compiler allocates global data that is not declared within the scope of a named data block or the private data block. BLOCKGLOBALS VST658.
Compiler Directives CALL_SHARED If the name of a variable is the same as the name of the data block in which the variable is located, and the block only contains one variable, the compiler allocates the data block in the small data area if the length of the block is eight or fewer bytes; otherwise, the compiler allocates the data block in the large data area. (This is the allocation strategy used by the native HP C compiler.
Compiler Directives CHECKSHIFTCOUNT CHECKSHIFTCOUNT CHECKSHIFTCOUNT NOCHECKSHIFTCOUNT PUSHCHECKSHIFTCOUNT POPCHECKSHIFTCOUNT VST659.vsd CHECKSHIFTCOUNT generates code that causes an overflow trap if the number of positions in a bit-shift operation is too large, as in: INT j := 20; INT i; i := i << j; (For more information about bit shifts, see Bit Shifts on page 5-33.
Compiler Directives COLUMNS COLUMNS COLUMNS causes the compiler to treat any text beyond the specified column as comments. COLUMNS columns-value VST127.vsd columns-value is an unsigned decimal constant in the range 12 through 132, the column beyond which the compiler is to treat text as comments. If columns-value is smaller than 12 or larger than 132, the compiler issues an error message.
Compiler Directives • • • • DEFEXPAND At each SECTION directive, columns-value is set by the last COLUMNS directive before the first SECTION directive in the included file. If there is no such COLUMNS directive, each SECTION initially has the columns-value active at the beginning of the included file. Within a section, a COLUMNS directive sets the columns-value only until the next COLUMNS or SECTION directive or the end of the file.
Compiler Directives DEFINETOG For an explanation of directive stacks, see Directive Stacks on page 17-4.
Compiler Directives DO_TNS_SYNTAX toggle-name is an identifier. The EpTAL compiler allows toggle-name to be RISC1, _TNS_E_TARGET, or TARGETSPECIFIED, as long as toggle-name does not change the value of target in the IF, IFNOT, or ENDIF statement (see IF and IFNOT on page 17-36 and ENDIF on page 17-27). toggle-number is an unsigned decimal constant in the range 1 through 15. Leading zeros are ignored.
Compiler Directives ENDIF NODO_TNS_SYNTAX suppresses warnings for each occurrence of a construct that is valid in pTAL but not in TAL. PUSHTNS_SYNTAX pushes the current setting (DOTNS_SYNTAX or NODOTNS_SYNTAX) onto the DOTNS_SYNTAX directive stack. Does not change the current setting. POPTNS_SYNTAX pops the top value from the DOTNS_SYNTAX directive stack and changes the current setting to that value.
Compiler Directives ERRORFILE pTAL identifies the end of code that is to be compiled by the pTAL or EpTAL compiler but not by the TAL compiler: Compiler IF pTAL IFNOT pTAL pTAL or EpTAL True False TAL False True Default: None Placement: • • Anywhere in the source file (not in the compilation command) Must be the only directive on the directive line Scope: Everything between ENDIF and the most recently compiled IF or IFNOT directive that specifies the same toggle, target, or keyword Depende
Compiler Directives ERRORFILE file-name is the name of either: • • An existing error file created by ERRORFILE. Such a file has file code 106 (an entry-sequenced disk file used only with the HP TACL FIXERRS macro). The compiler purges any data in it before logging errors and warnings. A new error file to be created by ERRORFILE if errors occur. If a file with the same name exists but the file code is not 106, the compiler terminates compilation to prevent overwriting the file.
Compiler Directives ERRORFILE After the compiler logs messages to the error file, you can call the HP TACL FIXERRS macro and correct the source file. FIXERRS uses the PS Text Edit ANYHOW option to open the source file in a two-window session. One window displays a diagnostic message. The other window displays the source code to which the message applies. If you have write access to the file, you can correct the source code.
Compiler Directives ERRORS ERRORS ERRORS sets the maximum number of error messages to allow before the compiler terminates the compilation. num-messages ERRORS = VST138.vsd num-messages is an unsigned decimal constant in the range 0 through 32,767 that represents the maximum number of error messages to allow before the compilation terminates.
Compiler Directives EXPORT_GLOBALS EXPORT_GLOBALS causes the compiler to define (rather than only declare) global data blocks, allocating space for them and (optionally) giving them initial values, and causes the linker to include in the program file all global data blocks declared up to the next occurrence of NOEXPORT_GLOBALS or through the last declared global data block, whichever is first. NOEXPORT_GLOBALS causes the compiler to declare (rather than define) global data blocks.
Compiler Directives FIELDALIGN FIELDALIGN FIELDALIGN specifies the default alignment for structures. ( FIELDALIGN SHARED2 ) SHARED8 PLATFORM AUTO NODEFAULT VST660.vsd SHARED2 specifies that the base of the structure and each field in the structure must begin at an even-byte address except STRING fields. For more information, see SHARED2 on page 9-6.
Compiler Directives FMAP FMAP FMAP NOFMAP VST141.vsd FMAP lists the file map in the compiler listing. NOFMAP suppresses the file map in the compiler listing. Default: NOFMAP Placement: Anywhere, any number of times. The last FMAP or NOFMAP in the compilation unit determines whether the compiler lists the file map.
Compiler Directives GP_OK NOGMAP suppresses the global map in the compiler listing. Default: GMAP Placement: Anywhere, any number of times. The last GMAP or NOGMAP in the compilation unit determines whether the compiler lists the global map.
Compiler Directives IF and IFNOT POPGP_OK pops the top value from the GP_OK directive stack and changes the current setting to that value. For an explanation of directive stacks, see Directive Stacks on page 17-4.
Compiler Directives IF and IFNOT toggle-name was specified by one of the following: • • • DEFINETOG on page 17-25 SETTOG on page 17-56 RESETTOG on page 17-52 IF compiles the conditional code only if toggle-name is on. IFNOT compiles the conditional code only if toggle-name is off. The EpTAL compiler allows toggle-name to be RISC1, _TNS_E_TARGET, or TARGETSPECIFIED, as long as toggle-name does not change the value of target in the IF, IFNOT, or ENDIF statement.
Compiler Directives IF and IFNOT RISC1 tests for a TARGET RISC1 directive in the current compilation. TNS_ARCH tests for a TARGET TNS_ARCH directive in the current compilation. TNS_R_ARCH tests for a TARGET TNS_R_ARCH directive in the current compilation. _TNS_E_TARGET tests for a TARGET _TNS_E_TARGET directive in the current compilation. TARGETSPECIFIED tests for a TARGET directive in the current compilation.
Compiler Directives INNERLIST Example 17-21. IF Directive Without Matching ENDIF Directive ?RESETTOG flag ! Create & turn off flag ?IF flag ! Statements for true condition ! (skipped because flag is off) ?IFNOT flag ! Statements for false condition ! (also skipped, because no ENDIF appears for IF flag) ?ENDIF flag If you insert an ENDIF for the IF in the code in Example 17-21 on page 17-39, as in Example 17-22 on page 17-39, the compiler skips only the first part. Example 17-22.
Compiler Directives INVALID_FOR_PTAL PUSHINNERLIST pushes the current setting (INNERLIST or NOINNERLIST) onto the INNERLIST directive stack. Does not change the current setting. POPINNERLIST pops the top value from the INNERLIST directive stack and changes the current setting to that value. For an explanation of directive stacks, see Directive Stacks on page 17-4.
Compiler Directives LINES Default: None Placement: After IF or IFNOT and before ENDIF Scope: Applies to code between itself and ENDIF Dependencies: None References: • • IF and IFNOT on page 17-36 ENDIF on page 17-27 LINES LINES sets the maximum number of output lines per page if the list file is a line printer or a process. LINES num-lines = VST154.vsd num-lines is an unsigned decimal constant in the range 10 through 32,767.
Compiler Directives LIST PUSHLIST pushes the current setting (LIST or NOLIST) onto the LIST directive stack. Does not change the current setting. POPLIST pops the top value from the LIST directive stack and changes the current setting to that value. For an explanation of directive stacks, see Directive Stacks on page 17-4.
Compiler Directives MAP MAP MAP NOMAP PUSHMAP POPMAP VST157.vsd MAP lists identifier maps in the compiler listing. NOMAP suppresses identifier maps in the compiler listing. PUSHMAP pushes the current setting (MAP or NOMAP) onto the MAP directive stack. Does not change the current setting. POPMAP pops the top value from the MAP directive stack and changes the current setting to that value. For an explanation of directive stacks, see Directive Stacks on page 17-4.
Compiler Directives OPTIMIZE Each identifier map includes: Item Possible Values Identifier class Type Addressing mode • • • • • • • • • • • • VAR SUBPROC ENTRY LABEL DEFINE LITERAL Data type Structure Substructure Structure pointer Direct Indirect Subprocedure, entry, or label offset Text of LITERALs and DEFINEs OPTIMIZE OPTIMIZE level = VST665.vsd level Level Effect 0 Code is not optimized. Provided in case other optimization levels cause errors or interfere with debugging.
Compiler Directives OPTIMIZEFILE Default: OPTIMIZE 1 Placement: Outside the boundary of a separately compiled program Scope: The optimization level active at the beginning of a separately compiled program determines the level of optimization for that program and any programs it contains Dependencies: None, but OPTIMIZEFILE can override OPTIMIZE in individual procedures References: OPTIMIZEFILE on page 17-45 OPTIMIZEFILE OPTIMIZEFILE sets the optimization level for individual procedures and subpr
Compiler Directives OPTIMIZEFILE optimize-level is an integer. If it is not 0, 1, or 2, the compiler ignores the line. optimizelevel must be preceded by white space and it can be followed by white space. comment is any text. Default: The optimization level that OPTIMIZE specified Placement: Only in the compilation command (not in the source file) Scope: Applies to the compilation unit Dependencies: None References: OPTIMIZE on page 17-44 Example 17-25.
Compiler Directives OVERFLOW_TRAPS Difference between pTAL and EpTAL compilers: pTAL Compiler EpTAL Compiler Does not issue warnings for errors in filename Issues a warning when filename : • • • • • Does not exist Cannot be opened Is not an EDIT file (Guardian operating systems only) Has the same routine-name on more than one line Has a line that: ° ° ° ° Exceeds 511 characters (Windows operating systems only) Has a routine-name that does not match any routine declaration in the source file Has an
Compiler Directives OVERFLOW_TRAPS PUSHOVERFLOW_TRAPS pushes the current setting (OVERFLOW_TRAPS or NOOVERFLOW_TRAPS) onto the OVERFLOW_TRAPS directive stack. Does not change the current setting. POPOVERFLOW_TRAPS pops the top value from the OVERFLOW_TRAPS directive stack and changes the current setting to that value. For an explanation of directive stacks, see Directive Stacks on page 17-4.
Compiler Directives PAGE PAGE The first PAGE sets the string to be printed as part of the heading for each page. Each subsequent PAGE prints the heading and causes a page eject. PAGE " heading-string " VST160.vsd heading-string is a character string of at most 122 characters. The default is an empty string.
Compiler Directives PRINTSYM PRINTSYM PRINTSYM NOPRINTSYM VST162.vsd PRINTSYM lists symbols in the compiler listing. NOPRINTSYM suppresses symbols in the compiler listing.
Compiler Directives REFALIGNED REFALIGNED REFALIGNED ( 2 ) 8 PUSHREFALIGNED POPREFALIGNED VST669.vsd REFALIGNED specifies the default alignment for pointers to nonstructure data items and procedure reference parameters. PUSHREFALIGNED pushes the current setting [REFALIGNED (2) or REFALIGNED (8)] onto the REFALIGNED directive stack. Does not change the current setting. POPREFALIGNED pops the top value from the REFALIGNED directive stack and changes the current setting to that value.
Compiler Directives RESETTOG RESETTOG RESETTOG turns off either specified toggles or all numeric toggles. RESETTOG toggle-name toggle-number , ( toggle-name ) toggle-number , VST164.vsd toggle-name is an identifier. toggle-number is an unsigned decimal constant in the range 1 through 15. Leading zeros are ignored.
Compiler Directives ROUND Default: None • • Placement: With a parenthesized list, it can appear anywhere Without a parenthesized list, it must be the last directive on the directive line or compilation command line Scope: Applies to the compilation unit Dependencies: Interacts with: • • • • • DEFINETOG SETTOG IF IFNOT ENDIF See Toggles on page 17-5.
Compiler Directives SAVEGLOBALS NOROUND turns off rounding. That is, rounding does not occur when a FIXED value is assigned to a FIXED variable that has a smaller fpoint. If the fpoint of the assignment value is greater than that of the variable, the assignment value is truncated and some precision is lost.
Compiler Directives SECTION If the existing file is secured so that the compiler cannot purge it, the compilation terminates. The compiler uses the current default volume and subvolume names as needed and lists the complete file name in the trailer message at the end of compilation. For this directive, the compiler does not use HP TACL ASSIGN SSV information (available only on Guardian platforms) to complete the file name.
Compiler Directives Default: SETTOG None Placement: • • Only in the source file (not in the compilation command) Must be the only directive on the directive line Scope: Applies to subsequent code until another SECTION directive or the end of the file, whichever is first Dependencies: Interacts with SOURCE (see Section Names on page 17-59) References: SOURCE on page 17-58 Example 17-30.
Compiler Directives SETTOG toggle-name is an identifier. The EpTAL compiler allows toggle-name to be RISC1, _TNS_E_TARGET, or TARGETSPECIFIED, as long as toggle-name does not change the value of target in the IF, IFNOT, or ENDIF statement (see IF and IFNOT on page 17-36 and ENDIF on page 17-27). toggle-number is an unsigned decimal constant in the range 1 through 15. Leading zeros are ignored. SETTOG with no arguments turns on all numeric toggles but does not affect named toggles.
Compiler Directives SOURCE SOURCE SOURCE reads source code from another source file. SOURCE file-name define-name assign-name ( section-name ) , VST173.vsd file-name is the name of a disk file from which the compiler is to read source code. On Guardian platforms, the compiler uses HP TACL ASSIGN SSV information, if specified, to complete the file name; otherwise, the compiler uses the current default volume and subvolume names as needed.
Compiler Directives Default: Section Names None Placement: • • Scope: Applies to the source file Dependencies: References: • • • • • • • • • Only in the source file (not in the compilation command) Must be the last directive on the directive line Interacts with COLUMNS Interacts with SECTION (see Section Names on page 17-59) Interacts with the directives referenced in the next row (see Effect of Other Directives on page 17-60) BEGINCOMPILATION on page 17-19 COLUMNS on page 17-23 LIST on page 17-4
Compiler Directives Nesting Levels Nesting Levels You can nest SOURCE directives to a maximum of seven levels, not counting the original outermost source file. For example, the deepest nesting allowed is as follows: 1. 2. 3. 4. 5. 6. 7. The MAIN file F sources in file F1. File F1 sources in file F2. File F2 sources in file F3. File F3 sources in file F4. File F4 sources in file F5. File F5 sources in file F6. File F6 sources in file F7.
Compiler Directives Including System Procedure Declarations NOLIST You can precede SOURCE with NOLIST to suppress the listings of procedures to be read in. Place NOLIST and SOURCE on the same line, because the line containing NOLIST is not suppressed: ?PUSHLIST, NOLIST, SOURCE $src.current.
Compiler Directives Examples Example 17-32. Procedure That Calls Procedures Specified by SOURCE Directive PROC a MAIN; BEGIN INT x, y, z, error; ! Code for manipulating x, y, and z IF x = 5 THEN CALL PROCESS_STOP_; CALL PROCESS_DEBUG_; END; ! Call procedures listed ! in SOURCE directive Examples The SOURCE directive in Example 17-33 on page 17-62 instructs the compiler to process the file until an end of file occurs. (Any SECTION directives in the file ROUTINES are treated as comments.) Example 17-33.
Compiler Directives SRL SRL Note. The EpTAL compiler ignores this directive. SRL causes the pTAL compiler to generate code that can be linked into a user library. You must specify SRL to be able to link the object file created by the compilation into a user library. SRL VST671.vsd Default: None Placement: Anywhere Scope: Applies to the compilation unit Dependencies: When declaring a data block that belongs to an SRL, you must specify NOEXPORT_GLOBALS and NOGP_OK.
Compiler Directives SYMBOLS Default: NOSUPPRESS Placement: Anywhere Scope: Applies to the compilation unit Dependencies: Overrides all the listing directives (referenced in the next row) References: • • • • • • • • DEFEXPAND on page 17-24 FMAP on page 17-34 GMAP on page 17-34 INNERLIST on page 17-39 LIST on page 17-41 MAP on page 17-43 PAGE on page 17-49 PRINTSYM on page 17-50 The compilation command in Example 17-36 on page 17-64 starts the compilation and suppresses all source code listings a
Compiler Directives SYNTAX Default: NOSYMBOLS Placement: Before the first declaration in the compilation Scope: The last legally placed SYMBOLS or NOSYMBOLS applies to the compilation unit Dependencies: Interacts with SAVEGLOBALS and USEGLOBALS (see Saving Global Data Declarations on page 17-9) • • References: SAVEGLOBALS on page 17-54 USEGLOBALS on page 17-67 Note. These linker options discard information that SYMBOLS saves: • • -x discards line number information.
Compiler Directives TARGET Default: The compiler produces an object file Placement: Anywhere Scope: Applies to the compilation unit Dependencies: Interacts with SAVEGLOBALS and USEGLOBALS (see Saving Global Data Declarations on page 17-9) References: • • SAVEGLOBALS on page 17-54 USEGLOBALS on page 17-67 The compilation command in Example 17-38 on page 17-66 checks the syntax of global data declarations in source file myprog and saves the declarations in file ptalsym for use in subsequent compi
Compiler Directives USEGLOBALS RISC1 specifies the TNS/R architecture. This is the only option that the pTAL compiler accepts. It is also the default for the pTAL compiler. _TNS_E_TARGET specifies the TNS/E architecture. This is the only option that the EpTAL compiler accepts. It is also the default for the EpTAL compiler. TNS_ARCH specifies the TNS architecture. The compiler does not accept this option. T16 specifies the T16 architecture. The compiler does not accept this option.
Compiler Directives USEGLOBALS file-name is the name of the global declarations disk file created by SAVEGLOBALS in a previous compilation. On Guardian platforms, the compiler uses HP TACL ASSIGN SSV information, if specified, to complete the file name; otherwise, the compiler uses the current default volume and subvolume names as needed. define-name is the name of a MAP DEFINE that refers to the global declarations file. Note. MAP DEFINEs are available only on Guardian platforms.
Compiler Directives WARN WARN WARN NOWARN warning-number VST675.vsd WARN prints specific (or all) warning messages in the compiler listing. NOWARN suppresses specific (or all) warning messages in the compiler listing. warning-number is the number of a warning message. The default is all warning messages. If warning-number is outside the range of all pTAL warnings and all TAL warnings, the compiler issues a warning.
Compiler Directives WARN Unsuppressed compiler warnings are compiler warnings that are not suppressed by NOWARN directives. The summary does not report the location of the last compiler warning. If no compiler errors and no unsuppressed compiler warnings occur, the completion code is zero.
18 pTAL Cross Compiler The optional pTAL cross compiler runs on the PC platforms in Table 18-1 on page 18-1. Table 18-1. pTAL Cross Compiler Platforms Windows Operating System Platform PC Guardian Cross Compiler Name NT 4.0 2000 XP ETK1 TNS/R NonStop pTAL Yes Yes Yes TNS/E2 NonStop pTAL No Yes Yes TNS/R3 ptal Yes Yes Yes TNS/E2 eptal No Yes Yes PC command line 1. HP Enterprise Toolkit—NonStop Edition 2. H06.01 and later RVUs 3. G06.
pTAL Cross Compiler NonStop pTAL (ETK) Topics: • • • • • • NonStop pTAL (ETK) on page 18-2 pTAL or EpTAL (PC Command Line) on page 18-3 Compilation and Linking on page 18-5 Debugging on page 18-6 Tools and Utilities on page 18-6 Documentation on page 18-8 NonStop pTAL (ETK) The optional pTAL cross compiler for use with the ETK, NonStop pTAL, is available for TNS/R and TNS/E. The ETK is a GUI-based extension package to Visual Studio .
pTAL Cross Compiler pTAL or EpTAL (PC Command Line) pTAL or EpTAL (PC Command Line) Beginning with RVU G06.14, you can call the pTAL cross compiler from the TNS/R command line (DOS prompt) on your PC by using the command ptal. Beginning with RVU H06.01, you can call the pTAL cross compiler from the TNS/E command line (DOS prompt) on your PC by using the command eptal. Note.
pTAL Cross Compiler pTAL or EpTAL (PC Command Line) flag is one of the following: flag Directs the compiler to: -Whelp Display information about how to run the compiler. No compilation system components are run. -Wusage Display information about how to run the compiler. No compilation system components are run. -Wverbose Displays the command line used when the driver calls each component of the compiler.
pTAL Cross Compiler Compilation and Linking Directives Sources (page 2 of 2) -[no]symbols SYMBOLS on page 17-64 -[no]syntax SYNTAX on page 17-65 -warn=n WARN on page 17-69 The command-line interface allows you to create batch scripts for use on multiple platforms. Compilation and Linking The pTAL cross compiler can compile only one pTAL source file at a time.
pTAL Cross Compiler Debugging Debugging On the ETK platform, debug pTAL source code using Visual Inspect. After Visual Inspect is installed on your workstation, you can configure Visual Inspect as an external tool. On the command-line platform, debug loadfiles that were compiled through the pTAL cross compiler either by using Visual Inspect on Windows or by running Native Inspect on the NonStop RISC-based or Itanium-based server.
pTAL Cross Compiler TACL DEFINE Tool (ETK) If an archive contains one or more native object files of the same format, the linker can use the archive as an object file library, replacing most functions provided by the Binder SELECT SEARCH command. If an archive contains one or more ... This cross linker can use the archive as an object file library ... For more information, see ...
pTAL Cross Compiler Documentation Documentation The ETK has online help that provides conceptual, reference, task-oriented, and error message information, as well as quick-start tutorials. To access the online help, do either of the following: • • From the Help menu, select Contents, Index, or Search. Click the Help button in any ETK dialog box.
A • • • • • • • • Syntax Summary Data Types on page A-1 Constants on page A-1 Expressions on page A-4 Declarations on page A-7 Statements on page A-39 Overflow Traps on page A-46 Built-in Routines on page A-46 Compiler Directives on page A-87 Data Types STRING INT REAL ( width ) UNSIGNED ( width ) ( fpoint ) FIXED * VST214.
Syntax Summary Character String Character String " " string VST001.vsd More information: Character String on page 3-12 STRING Numeric integer base VST002.vsd More information: STRING Numeric on page 3-14 INT Numeric integer + base VST027.vsd More information: INT Numeric on page 3-15 INT(32) Numeric ns D integer + base ns %D VST028.
Syntax Summary FIXED Numeric FIXED Numeric integer + base - F . fraction %F VST005.vsd More information: FIXED Numeric on page 3-17 REAL and REAL(64) Numeric integer . fraction + - E exponent L + VST006.vsd More information: REAL and REAL(64) Numeric on page 3-19 Constant List repetition-constant-list FIELDALIGN ( SHARED2 ) SHARED8 [ repetition-constant-list ] constant-list-seq VST621.
Syntax Summary Expressions repetition-constant-list [ repetition-factor constant-list-seq ] * VST008.vsd constant-list-seq constant repetition-constant-list , VST029.vsd More information: Constant Lists on page 3-21 Expressions • • • • • • • • Arithmetic on page A-4 Conditional on page A-5 Assignment on page A-5 CASE on page A-5 IF on page A-5 Group Comparison on page A-6 Bit Extraction on page A-6 Bit Shift on page A-6 Arithmetic + - operand arithmetic-operand operand VST010.
Syntax Summary Conditional Conditional condition NOT AND OR VST996.vsd More information: Conditional Expressions on page 5-15 Assignment variable := expression VST012.vsd More information: Assignment on page 5-20 CASE CASE selector OF BEGIN expression ; END expression OTHERWISE ; VST013.vsd More information: CASE on page 5-21 IF IF condition THEN expression ELSE expression VST014.
Syntax Summary Group Comparison Group Comparison var-1 relational-operator FOR var-2 count count-unit constant [ constant ] constant-list -> next-addr VST015.vsd More information: Group Comparison on page 5-24 Bit Extraction int-expression . ns < ns ns > left-bit ns ns : ns right-bit VST016.vsd More information: Bit Extractions on page 5-31 Bit Shift int-expression shift-operator positions dbl-expression VST017.
Syntax Summary Declarations Declarations • • • • • • • • • • LITERAL on page A-7 DEFINE on page A-7 Simple Variable on page A-8 Array on page A-8 Read-Only Array on page A-9 Structures on page A-9 Redefinition on page A-16 Pointer on page A-21 Equivalenced Variable on page A-22 Procedure and Subprocedure on page A-28 LITERAL LITERAL identifier = constant , VST018.vsd More information: Declaring Literals on page 6-1 DEFINE DEFINE item-list ; , VST019.
Syntax Summary Simple Variable param-list ( ) param-name , VST994.vsd More information: Declaring DEFINEs on page 6-3 Simple Variable type VOLATILE identifier ; := initialization , VST622.vsd More information: Declaring Simple Variables on page 7-1 Array type identifier ; range := . initialization .EXT .SG .SGX , VST021.
Syntax Summary Read-Only Array range [ lower-bound : upper-bound ] VST993.vsd More information: Declaring Arrays on page 8-2 Read-Only Array type identifier = range 'p' := initialization ; , VST022.vsd range [ lower-bound : upper-bound ] VST993.
Syntax Summary Structures Definition Structure identifier STRUCT . .EXT .SG .SGX structure-layout range ; field-alignment VST624.vsd range [ lower-bound : upper-bound ] VST993.vsd field-alignment FIELDALIGN ( SHARED2 ) SHARED8 AUTO PLATFORM VST992.
Syntax Summary Structures Template Structure STRUCT STRUCTALIGN identifier ( ( MAXALIGN structure-layout * ) ) ; field-alignment VST625.vsd field-alignment FIELDALIGN ( SHARED2 ) SHARED8 AUTO PLATFORM VST992.
Syntax Summary Structures Referral Structure identifier STRUCT referral ( ) . .EXT .SG .SGX ; range VST025.vsd range [ lower-bound : upper-bound ] VST993.vsd More information: Declaring Referral Structures on page 9-38 Simple Variables Declared in Structure type VOLATILE identifier ; , VST705.
Syntax Summary Structures Arrays Declared in Structure type identifier range ; , VST201.vsd range [ lower-bound : upper-bound ] VST993.vsd More information: Declaring Arrays in Structures on page 9-40 Definition Substructure identifier STRUCT structure-layout ; range field-alignment VST626.vsd field-alignment FIELDALIGN ( SHARED2 ) SHARED8 AUTO PLATFORM VST992.vsd range [ lower-bound : upper-bound ] VST993.
Syntax Summary Structures Referral Substructure identifier STRUCT ( referral ) ; range VST203.vsd range [ lower-bound : upper-bound ] VST993.vsd More information: Referral Substructures on page 9-45 Filler in Structure FILLER constant-expression ; BIT_FILLER VST026.
Syntax Summary Structures Simple Pointers Declared in Structure type VOLATILE identifier . .EXT .SG .SGX ; REFALIGNED ( 2 ) 8 , VST627.
Syntax Summary Redefinition Structure Pointers Declared in Structure STRING VOLATILE INT identifier ( referral ) . .EXT .SG .SGX ; REFALIGNED ( 2 ) 8 , VST628.
Syntax Summary Redefinition Simple Variable type identifier = previous-identifier VOLATILE ; VST706.vsd More information: Simple Variable on page 9-54 Array type identifier = previous-identifier ; range VST030.vsd range [ lower-bound : upper-bound ] VST993.
Syntax Summary Redefinition Definition Substructure identifier STRUCT range = previous-identifier ; field-alignment structure-layout ; VST707.vsd range [ lower-bound : upper-bound ] VST993.vsd field-alignment FIELDALIGN ( SHARED2 ) SHARED8 AUTO PLATFORM VST992.
Syntax Summary Redefinition Referral Substructure identifier STRUCT = referral ( previous-identifier ) ; range VST208.vsd range [ lower-bound : upper-bound ] VST993.vsd More information: Referral Substructure on page 9-59 Simple Pointer type identifier VOLATILE . .EXT .SG .SGX REFALIGNED ( 2 ) 8 = previous-identifier ; VST708.
Syntax Summary Redefinition Structure Pointer STRING VOLATILE identifier . INT .EXT .SG .SGX ( referral REFALIGNED ) ( 2 ) 8 = previous-identifier ; VST709.
Syntax Summary Pointer Pointer • • • Simple on page A-21 Structure on page A-22 System Global on page A-22 Simple type VOLATILE identifier . .EXT .SG .SGX REFALIGNED 2 ( ) 8 ; := initialization , VST676.
Syntax Summary Equivalenced Variable Structure STRING VOLATILE INT identifier ( referral ) . .EXT .SG .SGX ; := initialization , VST677.vsd More information: Declaring Structure Pointers on page 10-16 System Global type .SG ; identifier := preset-address , VST020.
Syntax Summary • • • • Equivalenced Variable 'SG'-Equivalenced Definition Structure on page A-26 'SG'-Equivalenced Referral Structure on page A-27 'SG'-Equivalenced Simple Pointer on page A-27 'SG'-Equivalenced Structure Pointer on page A-28 Nonstructure VOLATILE type identifier = ( referral ) previous-identifier ; [ index + offset ] , VST629.
Syntax Summary Equivalenced Variable Simple Variable type VOLATILE identifier = ( referral ) previous-identifier ; [ index + offset ] , VST004.vsd More information: Equivalenced Simple Variables on page 11-8 Simple Pointer type VOLATILE identifier ( referral ) . .EXT = previous-identifier .SG .SGX ; [ index + offset ] , VST630.
Syntax Summary Equivalenced Variable Definition Structure identifier STRUCT referral ( ) . .EXT .SG .SGX = previous-identifier field-alignment ; [ index + offset ] structure-layout VST632.vsd - field-alignment FIELDALIGN ( SHARED2 ) SHARED8 AUTO PLATFORM VST992.
Syntax Summary Equivalenced Variable 'SG'-Equivalenced Simple Variable type identifier = 'SG' ; [ index + offset ] , VST068.vsd More information: Equivalenced Simple Variable on page 11-23 'SG'-Equivalenced Definition Structure identifier STRUCT = 'SG' .EXT .SG .SGX ; [ index + offset structure-layout ; ] VST710.
Syntax Summary Equivalenced Variable 'SG'-Equivalenced Referral Structure identifier STRUCT ( referral ) .SG .SGX .EXT = ; 'SG' [ index + offset ] VST703.vsd More information: Equivalenced Referral Structure on page 11-25 'SG'-Equivalenced Simple Pointer type identifier = 'SG' .SG .SGX .EXT ; [ index + offset ] , VST704.
Syntax Summary Procedure and Subprocedure 'SG'-Equivalenced Structure Pointer STRING identifier . .SG INT .SGX .EXT ( referral ) = 'SG' ; [ index + offset ] , VST711.
Syntax Summary Procedure and Subprocedure Procedure PROC identifier type public-name-spec ; proc-attribute parameter-list , proc-body ; param-spec ; EXTERNAL FORWARD VST058.vsd type See Data Types on page A-1. public-name-spec = " public-name " VST209.vsd parameter-list ( ) param-name param-pair , VST210.vsd param-pair string : length VST039.
Syntax Summary Procedure and Subprocedure proc-attribute MAIN INTERRUPT RESIDENT CALLABLE PRIV VARIABLE EXTENSIBLE ( count ) RETURNSCC OVERFLOW_TRAPS NOOVERFLOW_TRAPS LANGUAGE C COBOL FORTRAN PASCAL UNSPECIFIED VST635.vsd Note. • • The EpTAL compiler ignores INTERRUPT. Because no FORTRAN or Pascal compilers exist especially for TNS/R or TNS/E architecture, LANGUAGE FORTRAN and LANGUAGE PASCAL have no meaning on TNS/R or TNS/E architecture.
Syntax Summary Procedure and Subprocedure proc-body BEGIN local-decl subproc-decl ; ; END statement VST061.vsd More information: Procedure Declarations on page 14-2 Subprocedure SUBPROC identifier type parameter-list ; VARIABLE RETURNSCC OVERFLOW_TRAPS NOOVERFLOW_TRAPS subproc-body parameter-spec ; ; FORWARD VST702.vsd type See Data Types on page A-1. parameter-list ( param-name ) param-pair , VST210.
Syntax Summary Procedure and Subprocedure param-pair string : length VST039.vsd param-spec See Formal Parameters on page A-33. subproc-body BEGIN END sublocal-decl statement ; ; ; VST062.
Syntax Summary Procedure and Subprocedure Formal Parameters param-type param-name . .EXT .SG .SGX ( referral ) ; REFALIGNED ( 2 ) 8 , VST636.
Syntax Summary Procedure and Subprocedure param-type STRING INT REAL UNSIGNED ( width ) ( width ) FIXED ( fpoint ) * STRUCT BADDR WADDR EXTADDR PROCADDR CBADDR CWADDR SGBADDR SGWADDR SGXBADDR SGXWADDR PROC type VST637.vsd Note. The EpTAL compiler does not allow you to assign label or subprocedure addresses to CBADDR and CWADDR address types.
Syntax Summary Procedure and Subprocedure type STRING INT REAL ( width ) UNSIGNED ( width ) ( fpoint ) FIXED * VST214.vsd More information: Formal Parameter Specification on page 14-10 Entry Point ENTRY identifier ; , VST195.vsd More information: Entry-Point Declarations on page 14-22 Label LABEL identifier ; , VST196.
Syntax Summary Procedure and Subprocedure Procedure Pointer procptr-name PROCPTR return-type attributes formal-param-names formal-param-spec ; END PROCPTR VST600.vsd formal-param-names ( ) param-name param-pair , VST210.vsd param-pair string : length VST039.
Syntax Summary Procedure and Subprocedure attributes MAIN INTERRUPT RESIDENT CALLABLE PRIV VARIABLE EXTENSIBLE ( count ) RETURNSCC OVERFLOW_TRAPS NOOVERFLOW_TRAPS LANGUAGE C COBOL FORTRAN PASCAL UNSPECIFIED VST635.vsd Note. • • The EpTAL compiler ignores INTERRUPT. Because no FORTRAN or Pascal compilers exist especially for TNS/R or TNS/E architecture, LANGUAGE FORTRAN and LANGUAGE PASCAL have no meaning on TNS/R or TNS/E architecture.
Syntax Summary Procedure and Subprocedure formal-param-spec procptr param-type identifier . .EXT .SG .SGX ( referral ) , VST712.
Syntax Summary Statements Statements • • • • • • • • • • • • • • • • • Compound on page A-39 ASSERT on page A-40 Assignment on page A-40 Bit Deposit Assignment on page A-40 CALL on page A-41 Labeled CASE on page A-41 Unlabeled CASE on page A-42 DO-UNTIL on page A-42 DROP on page A-42 FOR on page A-43 GOTO on page A-43 IF on page A-43 Move on page A-44 RETURN on page A-44 SCAN and RSCAN on page A-45 USE on page A-45 WHILE on page A-45 Compound BEGIN END statement ; ; VST034.
Syntax Summary ASSERT ASSERT ASSERT assert-level : condition VST035.vsd More information: ASSERT on page 12-3 Assignment The assignment statement assigns a value to a previously declared variable. variable := expression VST012.vsd More information: Assignment on page 12-4 Bit Deposit Assignment variable ns ns . < ns > left-bit ns : := ns ns right-bit expression VST037.
Syntax Summary CALL CALL identifier ( CALL ) param-name param-pair , VST038.vsd param-pair string : length VST039.vsd More information: CALL on page 12-10 Labeled CASE CASE selector OF BEGIN case-alternative ; END -> OTHERWISE ; statement-2 VST041.vsd case-alternative case-label lower-case-label -> .. upper-case-label , statement-1 ; VST042.
Syntax Summary Unlabeled CASE Unlabeled CASE CASE selector OF BEGIN ; statement END OTHERWISE ; statement VST040.vsd More information: Unlabeled CASE on page 12-15 DO-UNTIL DO UNTIL condition statement VST046.vsd More information: DO-UNTIL on page 12-17 DROP DROP identifier , VST047.
Syntax Summary FOR FOR FOR index := TO initial-value limit DOWNTO DO BY statement step VST048.vsd More information: FOR on page 12-20 GOTO GOTO label-name VST049.vsd Note. Nonlocal GOTO statements are are inefficient and not recommended. More information: GOTO on page 12-23 IF IF condition THEN statement ELSE statement VST050.
Syntax Summary Move Move := destination =: & source FOR count count-unit constant [ constant ] constant-list -> next-addr VST051.vsd More information: Move on page 12-28 RETURN Note. The EpTAL compiler issues a warning whenever a pTAL procedure returns both a result-expression and a cc-expression and has the procedure attribute RETURNSCC on page 14-8. The reason for this warning is in Appendix D, RETURN, RETURNSCC, and C/C++ on TNS/E.
Syntax Summary SCAN and RSCAN SCAN and RSCAN SCAN WHILE variable UNTIL RSCAN -> test-char next-addr VST053.vsd More information: SCAN and RSCAN on page 12-40 USE USE identifier , VST056.vsd More information: USE on page 12-45 WHILE WHILE condition DO statement VST057.
Syntax Summary Overflow Traps Overflow Traps OVERFLOW_TRAPS Directive See OVERFLOW_TRAPS on page A-106. [EN|DIS]ABLE_OVERFLOW_TRAPS Block Attribute BEGIN : ENABLE_OVERFLOW_TRAPS DISABLE_OVERFLOW_TRAPS VST682.
Syntax Summary Atomic $ATOMIC_ADD $ATOMIC_ADD ( var , value ) ; VST607.vsd Sets condition code Yes (according the final value of var ) Sets $CARRY Yes, if traps are disabled Sets $OVERFLOW Yes, if traps are disabled; otherwise, traps on overflow More information: $ATOMIC_ADD on page 15-5 $ATOMIC_AND $ATOMIC_AND ( var , mask ) ; VST608.
Syntax Summary Atomic $ATOMIC_GET $ATOMIC_GET ( var ) ; VST610.vsd Sets condition code No Sets $CARRY No Sets $OVERFLOW No More information: $ATOMIC_GET on page 15-8 $ATOMIC_OR $ATOMIC_OR ( var , mask ) ; VST611.vsd Sets condition code Yes (according the final value of var ) Sets $CARRY No Sets $OVERFLOW No More information: $ATOMIC_OR on page 15-9 $ATOMIC_PUT $ATOMIC_PUT ( var , value ) ; VST612.
Syntax Summary Nonatomic Nonatomic • • • • • • • • • • • • • • • • • • • • • • • • • • • • • $ABS on page A-52 $ALPHA on page A-52 $ASCIITOFIXED on page A-53 $AXADR on page A-53 $BADDR_TO_EXTADDR on page A-54 $BADDR_TO_WADDR on page A-54 $BITLENGTH on page A-54 $BITOFFSET on page A-55 $CARRY on page A-55 $CHECKSUM on page A-56 $COMP on page A-56 $COUNTDUPS on page A-57 $DBL on page A-57 $DBLL on page A-58 $DBLR on page A-58 $DFIX on page A-58 $EFLT on page A-59 $EFLTR on page A-59 $EXCHANGE on page A-59
Syntax Summary • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Nonatomic $FIXR on page A-64 $FLT on page A-65 $FLTR on page A-65 $FREEZE on page A-66 $HALT on page A-66 $HIGH on page A-67 $IFIX on page A-67 $INT on page A-67 $INT_OV on page A-68 $INTERROGATEHIO on page A-68 $INTERROGATEIO on page A-69 $INTR on page A-69 $LEN on page A-70 $LFIX on page A-70 $LMAX on page A-70 $LMIN on page A-71 $LOCATESPTHDR on page A-71 $LOCKPAGE on page A-72 $MAX on page A-72 $MIN on page A-73 $MOVEANDCXSUMB
Syntax Summary • • • • • • • • • • • • • • • • • • • • • Nonatomic $READBASELIMIT on page A-78 $READCLOCK on page A-78 $READSPT on page A-79 $READTIME on page A-79 $SCALE on page A-80 $SGBADDR_TO_EXTADDR on page A-80 $SGBADDR_TO_SGWADDR on page A-80 $SGWADDR_TO_EXTADDR on page A-81 $SGWADDR_TO_SGBADDR on page A-81 $SPECIAL on page A-81 $STACK_ALLOCATE on page A-82 $TRIGGER on page A-82 $TYPE on page A-83 $UDBL on page A-83 $UDIVREM16 on page A-84 $UDIVREM32 on page A-84 $UNLOCKPAGE on page A-85 $WADDR_TO
Syntax Summary Nonatomic $ABS $ABS ( expression ) VST072.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No More information: $ABS on page 15-22 $ALPHA $ALPHA ( int-expression ) VST073.
Syntax Summary Nonatomic $ASCIITOFIXED $ASCIITOFIXED ( remainingdigits , bufferaddr , qvaluein qvalueout , maxdigits ) ; VST606.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code Yes Sets $CARRY No Sets $OVERFLOW Yes More information: $ASCIITOFIXED on page 15-24 $AXADR Note. The EpTAL compiler does not support this routine. (The EpTAL compiler does allow $AXADR as a DEFINE name.) $AXADR ( variable ) VST116.
Syntax Summary Nonatomic $BADDR_TO_EXTADDR $BADDR_TO_EXTADDR ( expression ) VST683.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No More information: $BADDR_TO_EXTADDR on page 15-26 $BADDR_TO_WADDR $BADDR_TO_WADDR ( expression ) VST684.
Syntax Summary Nonatomic $BITOFFSET $BITOFFSET ( variable ) VST075.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No More information: $BITOFFSET on page 15-29 $CARRY $CARRY VST076.
Syntax Summary Nonatomic $CHECKSUM $CHECKSUM wordcount ( ) checksum , bufferaddr , ; VST613.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No More information: $CHECKSUM on page 15-31 $COMP $COMP ( int-expression ) VST077.
Syntax Summary Nonatomic $COUNTDUPS $COUNTDUPS ( ) duplicationcount , scraddr maxwords , ; VST614.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No More information: $COUNTDUPS on page 15-33 $DBL $DBL ( expression ) VST078.
Syntax Summary Nonatomic $DBLL $DBLL ( expression ) VST079.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No More information: $DBLL on page 15-35 $DBLR $DBLR ( expression ) VST080.
Syntax Summary Nonatomic $EFLT $EFLT ( expression ) VST082.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No More information: $EFLT on page 15-37 $EFLTR $EFLTR ( expression ) VST083.
Syntax Summary Nonatomic $EXECUTEIO Note. The EpTAL compiler does not support this routine. $EXECUTEIO ( lacsubcommand channel-status channel , ) , rdstdevstatus lprmcommand , , ; VST616.vsd pTAL privileged procedure Yes Can be executed only by privileged procedures Yes Sets condition code Yes Sets $CARRY No Sets $OVERFLOW No More information: $EXECUTEIO on page 15-40 $EXTADDR_TO_BADDR $EXTADDR_TO_BADDR ( expression ) VST686.
Syntax Summary Nonatomic $EXTADDR_TO_WADDR $EXTADDR_TO_WADDR ( expression ) VST687.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No More information: $EXTADDR_TO_WADDR on page 15-42 $FILL8, $FILL16, and $FILL32 $FILL8 CALL $FILL16 $FILL32 ( area-to-fill , repetitions , value ) VST688.
Syntax Summary Nonatomic $FIX $FIX ( expression ) VST084.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No More information: $FIX on page 15-44 $FIXD $FIXD ( expression ) VST085.
Syntax Summary Nonatomic $FIXEDTOASCII $FIXEDTOASCII maxdigits ( ) , qvalue , bufferaddr ; VST617.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW Yes More information: $FIXEDTOASCII on page 15-45 $FIXEDTOASCIIRESIDUE $FIXEDTOASCIIRESIDUE , maxdigits , ( , qvalue qresidue ) bufferaddr ; VST618.
Syntax Summary Nonatomic $FIXI $FIXI ( fixed-expression ) VST086.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No More information: $FIXI on page 15-47 $FIXL $FIXL ( fixed-expression ) VST087.
Syntax Summary Nonatomic $FLT $FLT ( expression ) VST089.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No More information: $FLT on page 15-49 $FLTR $FLTR ( expression ) VST090.
Syntax Summary Nonatomic $FREEZE Note. • • The EpTAL compiler does not support this procedure. Use $TRIGGER on page 15-88 instead. (The EpTAL compiler does allow $FREEZE as a DEFINE name.) Execution does not return from this call. $FREEZE VST619.vsd pTAL privileged procedure Yes Can be executed only by privileged procedures Yes Sets condition code No Sets $CARRY No Sets $OVERFLOW No More information: $FREEZE on page 15-51 $HALT Note. • • The EpTAL compiler does not support this procedure.
Syntax Summary Nonatomic $HIGH ( $HIGH dbl-expression ) VST091.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No More information: $HIGH on page 15-52 $IFIX ( $IFIX int-expression , fpoint ) VST092.
Syntax Summary Nonatomic $INT_OV Note. $INT_OV is supported in the D40 and later RVUs. $INT_OV ( expression ) VST689.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW Yes More information: $INT_OV on page 15-54 $INTERROGATEHIO Note. The EpTAL compiler does not support this routine. $INTERROGATEHIO , ) ric-int-cause ( , select , ric-int-cause rank-channel , channel-status ; VST643.
Syntax Summary Nonatomic $INTERROGATEIO Note. The EpTAL compiler does not support this routine. $INTERROGATEIO , ric-int-cause ) ( , , select ric-int-cause rank-channel , channel-status ; VST644.vsd pTAL privileged procedure Yes Can be executed only by privileged procedures Yes Sets condition code Yes Sets $CARRY No Sets $OVERFLOW No More information: $INTERROGATEIO on page 15-57 $INTR $INTR ( expression ) VST094.
Syntax Summary Nonatomic $LEN $LEN ( variable ) VST096.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No More information: $LEN on page 15-59 $LFIX $LFIX ( int-expression , fpoint ) VST097.
Syntax Summary Nonatomic $LMIN ( $LMIN int-expression , int-expression ) VST099.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No More information: $LMIN on page 15-61 $LOCATESPTHDR Note. The EpTAL compiler does not support this routine. $LOCATESPTHDR sptbase ) ( headersize , virtaddr , ; VST645.
Syntax Summary Nonatomic $LOCKPAGE Note. The EpTAL compiler does not support this routine. ( $LOCKPAGE virtaddr ) only-if-locked , lock-count , ; VST646.vsd pTAL privileged procedure Yes Can be executed only by privileged procedures Yes Sets condition code Yes Sets $CARRY Yes Sets $OVERFLOW No More information: $LOCKPAGE on page 15-63 $MAX $MAX ( expression , expression ) VST100.
Syntax Summary Nonatomic $MIN $MIN ( expression , expression ) VST101.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No More information: $MIN on page 15-64 $MOVEANDCXSUMBYTES $MOVEANDCXSUMBYTES destaddr , srcaddr ( checksum , count , ) ; VST647.
Syntax Summary Nonatomic $MOVENONDUP $MOVENONDUP maxwords ( , lastword destaddr , ) ; srcaddr , VST648.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code Yes Sets $CARRY No Sets $OVERFLOW No More information: $MOVENONDUP on page 15-67 $NUMERIC ( $NUMERIC int-expression ) ; VST102.
Syntax Summary Nonatomic $OCCURS $OCCURS ( variable ) VST103.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No More information: $OCCURS on page 15-69 $OFFSET $OFFSET ( variable ) VST104.
Syntax Summary Nonatomic $OPTIONAL $OPTIONAL ( cond-expression , param ) param-pair VST213.vsd param-pair string : length VST039.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No More information: $OPTIONAL on page 15-73 $OVERFLOW $OVERFLOW VST105.
Syntax Summary Nonatomic $PARAM $PARAM ( formal-param ) VST106.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No More information: $PARAM on page 15-77 $POINT $POINT ( fixed-expression ) VST107.
Syntax Summary Nonatomic $READBASELIMIT Note. The EpTAL compiler does not support this procedure. $READBASELIMIT ( xbase , xlimit ) VST649.vsd pTAL privileged procedure Yes Can be executed only by privileged procedures Yes Sets condition code No Sets $CARRY No Sets $OVERFLOW No More information: $READBASELIMIT on page 15-79 $READCLOCK $READCLOCK VST108.
Syntax Summary Nonatomic $READSPT Note. The EpTAL compiler does not support this routine. $READSPT ( virtaddr , sptentryaddr ) VST650.vsd pTAL privileged procedure No Can be executed only by privileged procedures Yes Sets condition code No Sets $CARRY Yes Sets $OVERFLOW No More information: $READSPT on page 15-80 $READTIME $READTIME VST651.
Syntax Summary Nonatomic $SCALE $SCALE ( fixed-expression , scale ) VST110.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No More information: $SCALE on page 15-82 $SGBADDR_TO_EXTADDR $SGBADDR_TO_EXTADDR ( expression ) VST603.
Syntax Summary Nonatomic $SGWADDR_TO_EXTADDR $SGWADDR_TO_EXTADDR ( expression ) VST605.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No More information: $SGWADDR_TO_EXTADDR on page 15-84 $SGWADDR_TO_SGBADDR $SGWADDR_TO_SGBADDR ( expression ) VST690.
Syntax Summary Nonatomic $STACK_ALLOCATE Note. The pTAL and EpTAL compilers behave differently. $STACK_ALLOCATE ( size ) VST032.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No More information: $STACK_ALLOCATE on page 15-86 $TRIGGER Note. • • The pTAL compiler does not support this routine. Execution does not return from this call. $TRIGGER ( op ) VST060.
Syntax Summary Nonatomic $TYPE ( $TYPE variable ) VST112.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No More information: $TYPE on page 15-88 $UDBL $UDBL ( int-expression ) VST113.
Syntax Summary Nonatomic $UDIVREM16 $UDIVREM16 quotient ( dividend remainder , divisor , ) , ; VST653.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW Yes, if the divisor is 0 or the quotient is too large More information: $UDIVREM16 on page 15-90 $UDIVREM32 $UDIVREM32 quotient ( dividend remainder , , ) divisor , ; VST654.
Syntax Summary Nonatomic $UNLOCKPAGE Note. The EpTAL compiler does not support this routine. ( $UNLOCKPAGE unlockcount , virtaddr ) ; VST655.vsd pTAL privileged procedure Yes Can be executed only by privileged procedures Yes Sets condition code Yes Sets $CARRY No Sets $OVERFLOW No More information: $UNLOCKPAGE on page 15-93 $WADDR_TO_BADDR $WADDR_TO_BADDR ( expression ) VST691.
Syntax Summary Nonatomic $WADDR_TO_EXTADDR $WADDR_TO_EXTADDR ( expression ) VST692.vsd pTAL privileged procedure No Can be executed only by privileged procedures No Sets condition code No Sets $CARRY No Sets $OVERFLOW No More information: $WADDR_TO_EXTADDR on page 15-94 $WRITEPTE Note. The EpTAL compiler does not support this routine. $WRITEPTE abs ) ( ptetag , pageframe , : VST656.
Syntax Summary Compiler Directives $XADR $XADR ( variable ) VST115.
Syntax Summary • • • • • • • • • • • • • • • • • • • • • • • • Directive Line INNERLIST on page A-102 INVALID_FOR_PTAL on page A-102 LINES on page A-103 LIST on page A-103 MAP on page A-104 OPTIMIZE on page A-104 OPTIMIZEFILE on page A-105 OVERFLOW_TRAPS on page A-106 PAGE on page A-107 PRINTSYM on page A-107 REFALIGNED on page A-108 RESETTOG on page A-109 ROUND on page A-110 SAVEGLOBALS on page A-110 SECTION on page A-111 SETTOG on page A-112 SOURCE on page A-113 SRL on page A-114 SUPPRESS on page A-114
Syntax Summary ASSERTION ASSERTION ASSERTION assertion-level , = procedure-name VST123.
Syntax Summary BEGINCOMPILATION BEGINCOMPILATION Note. This directive can appear only in the source file, not in the compilation command. The EpTAL compiler ignores this directive. • • BEGINCOMPILATION VST991.
Syntax Summary CALL_SHARED CALL_SHARED Note. • • This directive is useful only for the pTAL compiler. The EpTAL compiler ignores it (and issues a warning). You cannot link PIC and non-PIC object files into a single object file. CALL_SHARED NOCALL_SHARED VST036.
Syntax Summary CHECKSHIFTCOUNT CHECKSHIFTCOUNT CHECKSHIFTCOUNT NOCHECKSHIFTCOUNT PUSHCHECKSHIFTCOUNT POPCHECKSHIFTCOUNT VST659.vsd Default: NOCHECKSHIFTCOUNT Placement: Anywhere Scope: • • Dependencies: CHECKSHIFTCOUNT applies to the shift operators that follow it until it is overridden by NOCHECKSHIFTCOUNT NOCHECKSHIFTCOUNT applies to the shift operators that follow it until it is overridden by CHECKSHIFTCOUNT None Caution.
Syntax Summary COLUMNS COLUMNS COLUMNS columns-value VST127.
Syntax Summary DEFEXPAND DEFEXPAND DEFEXPAND NODEFEXPAND PUSHDEFEXPAND POPDEFEXPAND VST023.
Syntax Summary DEFINETOG DEFINETOG DEFINETOG toggle-name toggle-number , ( toggle-name ) toggle-number , VST212.vsd Default: Placement: None • • With a parenthesized list, it can appear anywhere Without a parenthesized list, it must be the last directive on the directive line or compilation command line Scope: Applies to the compilation unit Dependencies: Interacts with: • • • • • SETTOG RESETTOG IF IFNOT ENDIF See Toggles on page 17-5.
Syntax Summary DO_TNS_SYNTAX DO_TNS_SYNTAX DO_TNS_SYNTAX NODO_TNS_SYNTAX PUSHDO_TNS_SYNTAX POPDO_TNS_SYNTAX VST663.vsd Default: NODO_TNS_SYNTAX Placement: • • Scope: Applies to the compilation unit Dependencies: None References: TARGET on page A-116 Can appear only once in a compilation Must precede any TARGET directive and any nondirective lines More information: DO_TNS_SYNTAX on page 17-26 ENDIF See IF, IFNOT, and ENDIF on page A-100.
Syntax Summary ERRORS ERRORS num-messages ERRORS = VST138.vsd Default: Unlimited number of errors Placement: Anywhere Scope: Applies to the compilation unit Dependencies: None More information: ERRORS on page 17-31 EXPORT_GLOBALS EXPORT_GLOBALS NOEXPORT_GLOBALS PUSHEXPORT_GLOBALS POPEXPORT_GLOBALS VST662.
Syntax Summary FIELDALIGN FIELDALIGN ( FIELDALIGN SHARED2 ) SHARED8 PLATFORM AUTO NODEFAULT VST660.vsd Default: FIELDALIGN AUTO Placement: • • Scope: Applies to the compilation unit Dependencies: None Can appear only once in a compilation unit Must precede all declarations of data, blocks, and procedures More information: FIELDALIGN on page 17-33 FMAP FMAP NOFMAP VST141.vsd Default: NOFMAP Placement: Anywhere, any number of times.
Syntax Summary GMAP GMAP GMAP NOGMAP VST142.vsd Default: GMAP Placement: Anywhere, any number of times. The last GMAP or NOGMAP in the compilation unit determines whether the compiler lists the global map.
Syntax Summary IF, IFNOT, and ENDIF IF, IFNOT, and ENDIF IF toggle-number IFNOT toggle-name target pTAL VST694.vsd ENDIF toggle-name toggle-number target pTAL VST693.vsd target ANY RISC1 TNS_ARCH TNSR_ARCH _TNS_E_TARGET TARGETSPECIFIED VST695.
Syntax Summary Default: Placement: IF, IFNOT, and ENDIF None • • • Anywhere in the source file (not in the compilation command) IF or IFNOT must be the last directive on its directive line ENDIF must be the only directive on its directive line Scope: Everything between IF or IFNOT and the next ENDIF that specifies the same toggle, target, or keyword Dependencies: Interact with: • • • • DEFINETOG SETTOG RESETTOG TARGET See Toggles on page 17-5.
Syntax Summary INNERLIST INNERLIST INNERLIST NOINNERLIST PUSHINNERLIST POPINNERLIST VST149.
Syntax Summary LINES LINES LINES num-lines = VST154.vsd Default: LINES 60 Placement: Anywhere Scope: Applies until overridden by another LINES directive Dependencies: Has no effect if the list file is a terminal More information: LINES on page 17-41 LIST LIST NOLIST PUSHLIST POPLIST VST155.
Syntax Summary MAP MAP MAP NOMAP PUSHMAP POPMAP VST157.vsd Default: MAP Placement: Anywhere Scope: • • Dependencies: MAP has no effect if NOLIST or SUPPRESS is active References: • • MAP applies to subsequent code it until it is overridden by NOMAP NOMAP applies to subsequent code until it is overridden by MAP LIST on page A-103 SUPPRESS on page A-114 More information: MAP on page 17-43 OPTIMIZE OPTIMIZE level = VST665.
Syntax Summary OPTIMIZEFILE OPTIMIZEFILE filename OPTIMIZEFILE VST666.vsd filename routine-name optimize-level comment # blank line VST064.vsd Default: The optimization level that OPTIMIZE specified Placement: Only in the compilation command (not in the source file) Scope: Applies to the compilation unit Dependencies: None References: OPTIMIZE on page A-104 Note. The pTAL and EpTAL compilers behave differently.
Syntax Summary OVERFLOW_TRAPS OVERFLOW_TRAPS OVERFLOW_TRAPS NOOVERFLOW_TRAPS PUSHOVERFLOW_TRAPS POPOVERFLOW_TRAPS VST697.
Syntax Summary PAGE PAGE PAGE " heading-string " VST160.
Syntax Summary REFALIGNED REFALIGNED REFALIGNED ( 2 ) 8 PUSHREFALIGNED POPREFALIGNED VST669.
Syntax Summary RESETTOG RESETTOG RESETTOG toggle-name toggle-number , ( toggle-name ) toggle-number , VST164.vsd Default: Placement: None • • With a parenthesized list, it can appear anywhere Without a parenthesized list, it must be the last directive on the directive line or compilation command line Scope: Applies to the compilation unit Dependencies: Interacts with: • • • • • DEFINETOG SETTOG IF IFNOT ENDIF See Toggles on page 17-5.
Syntax Summary ROUND ROUND ROUND NOROUND VST165.vsd Default: NOROUND Placement: Anywhere Scope: • • Dependencies: None ROUND applies to subsequent code until overridden by NOROUND NOROUND applies to subsequent code until overridden by ROUND More information: ROUND on page 17-53 SAVEGLOBALS Note. The EpTAL compiler does not accept this directive. SAVEGLOBALS file-name define-name VST670.
Syntax Summary SECTION SECTION SECTION section-name VST171.
Syntax Summary SETTOG SETTOG SETTOG toggle-name toggle-number , ( toggle-name ) toggle-number , VST172.vsd Default: Placement: None • • With a parenthesized list, it can appear anywhere Without a parenthesized list, it must be the last directive on the directive line or compilation command line Scope: Applies to the compilation unit Dependencies: Interacts with: • • • • • DEFINETOG RESETTOG IF IFNOT ENDIF See Toggles on page 17-5.
Syntax Summary SOURCE SOURCE SOURCE file-name ( define-name section-name ) , assign-name VST173.
Syntax Summary SRL SRL Note. The EpTAL compiler ignores this directive. SRL VST671.vsd Default: None Placement: Anywhere Scope: Applies to the compilation unit Dependencies: When declaring a data block that belongs to an SRL, you must specify NOEXPORT_GLOBALS and NOGP_OK. • • References: EXPORT_GLOBALS on page A-97 GP_OK on page A-99 More information: SRL on page 17-63 SUPPRESS SUPPRESS NOSUPPRESS VST176.
Syntax Summary SYMBOLS SYMBOLS SYMBOLS NOSYMBOLS VST672.vsd Default: NOSYMBOLS Placement: Before the first declaration in the compilation Scope: The last legally placed SYMBOLS or NOSYMBOLS applies to the compilation unit Dependencies: Interacts with SAVEGLOBALS and USEGLOBALS • • References: SAVEGLOBALS on page A-110 USEGLOBALS on page A-117 Note. These linker options discard information that SYMBOLS saves: • • -x discards line number information.
Syntax Summary TARGET TARGET TARGET T16 LIBERTY RISC1 ANY TNS_ARCH TNS_R_ARCH _TNS_E_TARGET VST673.
Syntax Summary USEGLOBALS USEGLOBALS Note. The EpTAL compiler does not accept this directive. USEGLOBALS file-name define-name VST674.vsd Default: None Placement: Either in the compilation command or in the source code before any global data declarations Scope: Applies to the compilation unit Dependencies: • • • References: • • • • • • • The compilation unit must have exactly one BEGINCOMPILATION directive.
Syntax Summary WARN WARN WARN NOWARN warning-number VST675.vsd Default: WARN Placement: Anywhere Scope: Dependencies: • • WARN applies to subsequent code until overridden by NOWARN NOWARN applies to subsequent code until overridden by WARN; however: To print selected warnings, you must specify WARN before any NOWARN directives. If you specify NOWARN first, subsequent WARN warning-number directives have no effect.
B Disk File Names and HP TACL Commands Note. This appendix applies only to Guardian platforms, not Windows platforms. • • Disk File Names on page B-1 HP TACL Commands on page B-4 For information about process or device file names, see the Guardian Programmer’s Guide. Disk File Names A disk file name identifies a file that contains data or a program. A disk file name reflects the specified file’s location on a NonStop system.
Disk File Names and HP TACL Commands Parts of a Disk File Name Topics: • • • • Parts of a Disk File Name on page B-2 Partial File Names on page B-3 Logical File Names on page B-4 Internal File Names on page B-4 Parts of a Disk File Name A disk file has a unique file name that consists of four parts, with each part separated by a period: • • • • A D-series node name or a C-series system name A volume name A subvolume name A file ID Example B-1. Disk File Name \mynode.$myvol.mysubvol.
Disk File Names and HP TACL Commands Partial File Names Volume Name The volume name, such as $MYVOL, is the name of the disk volume where the file resides. If specified, the volume name must begin with a dollar sign ($), followed by one to six or one to seven alphanumeric characters as follows. The character following the dollar sign must be an alphabetic character. On a D-series system, the volume name can contain one to seven alphanumeric characters.
Disk File Names and HP TACL Commands Logical File Names Following are all the partial file names you can specify for a disk file named \BRANCH.$DIV.DEPT.EMP: Omitted File-Name Parts Partial File Name D-Series System C-Series System Node (system) $div.dept.emp Yes Yes Node (system), volume dept.emp Yes Yes Node (system), volume, subvolume emp Yes Yes Volume \branch.dept.emp Yes No Volume, subvolume \branch.emp Yes No Subvolume \branch.$div.
Disk File Names and HP TACL Commands DEFINE For complete information about these commands, see the following manuals: • • • • TACL Reference Manual (syntactic information) TACL Programmer’s Guide (programmatic information) Guardian User’s Guide (interactive information) Guardian Programmer’s Guide (programmatic information) DEFINE • • Substituting File Names for DEFINE Macros on page B-5 DEFINE Names on page B-5 To create a DEFINE message or set its attributes, you must set a CLASS attribute for the
Disk File Names and HP TACL Commands DEFINE DEFINE names that begin with an equals sign followed by an underscore (=_) are reserved by HP (for example, =_DEFAULTS). Example B-2. DEFINE Names =A =The_chosen_file =Long-but-not-too-long =The-File-of-The-Week MAP DEFINE (Guardian Platforms Only) When you log on, the default CLASS attribute is MAP, which requires a file name. A MAP DEFINE substitutes a file name for a DEFINE name used in the source file.
Disk File Names and HP TACL Commands PARAM SWAPVOL DEFAULTS DEFINE In the DEFAULTS class, a permanently built-in DEFINE named =_DEFAULTS has the following attributes, which are active regardless of any DEFMODE setting: Attribute Required Purpose VOLUME Yes Contains the default node, volume, and subvolume names for the current process as set by the HP TACL VOLUME, SYSTEM, and LOGON commands SWAP No Contains the node and volume name in which the operating system is to store swap files CATALOG No
Disk File Names and HP TACL Commands ASSIGN Ordinary ASSIGN Command The ordinary ASSIGN command equates a file name with a logical file name used in ERRORFILE, SAVEGLOBALS, SEARCH, SOURCE, and USEGLOBALS directives. The compiler accepts only the first 75 ordinary ASSIGN messages. Note. The EpTAL compiler ignores the SAVEGLOBALS and USEGLOBALS directives. In each ASSIGN command, specify a logical identifier followed by a comma and the file name or an HP TACL DEFINE name: ASSIGN dog, \a.$b.c.
Disk File Names and HP TACL Commands ASSIGN ASSIGN SSV The ASSIGN SSV (search subvolume) command lets you specify which node, volume, and subvolume to take files from. The compiler uses ASSIGN SSV information to resolve partial file names in the SEARCH, SOURCE, and USEGLOBALS directives. Note. The EpTAL compiler ignores the USEGLOBALS directive. For each ASSIGN SSV command, append to the SSV keyword a value in the range 0 through 49. Values in the range 0 through 9 can appear with or without a leading 0.
Disk File Names and HP TACL Commands ASSIGN For example, if you issue the following ASSIGN commands before running the compiler: ASSIGN ASSIGN ASSIGN ASSIGN ASSIGN SSV7, SSV10, SSV8, SSV20, trig, $aa.b3 $aa.grplip mylib $cc.divlib $sp.math.xtrig and the compiler encounters the following SOURCE directive: ?SOURCE unpack the compiler first looks for an ASSIGN message having the logical name unpack. If there is none, the compiler looks for the file in subvolumes in the following order: $aa.b3.
C Differences Between the pTAL and EpTAL Compilers • • • • General on page C-1 Data Types and Alignment on page C-1 Routines on page C-2 Compiler Directives on page C-3 General Topic pTAL Compiler EpTAL Compiler RVU D40 and later G06.20 and later H06.
Differences Between the pTAL and EpTAL Compilers Routines Routines Routine or Attribute pTAL Compiler EpTAL Compiler INTERRUPT attribute Not recognized RETURN statement Issues a warning if a RETURN statement includes both a result-expression and a cc-expression (see Appendix D, RETURN, RETURNSCC, and C/C++ on TNS/E) $AXADR routine Not supported except as a DEFINE name $EXECUTEIO routine Not supported $FREEZE routine Not supported except as a DEFINE name. Use $TRIGGER instead.
Differences Between the pTAL and EpTAL Compilers Compiler Directives Compiler Directives Directive pTAL Compiler EpTAL Compiler BEGINCOMPILATION Ignored SAVEGLOBALS Not accepted USEGLOBALS Not accepted CALL_SHARED Default NOCALL_SHARED Default Not accepted GP_OK Not accepted NOGP_OK Ignored PUSHGP_OK Ignored POPGP_OK Ignored OPTIMIZEFILE Does not issue warnings for errors in filename OVERFLOW_TRAPS Default Issues a warning when filename meets one of the Conditions: on page C-3 N
Differences Between the pTAL and EpTAL Compilers HP pTAL Reference Manual—523746-005 C- 4 Compiler Directives
D RETURN, RETURNSCC, and C/C++ on TNS/E Read this appendix if you write or call pTAL procedures that: • • Return both: ° ° A traditional function value by means of the RETURN statement An unrelated condition code value by means of the RETURNSCC attribute And are called by C or C++ procedures On the TNS architecture, a TAL procedure can return both a traditional function value and an unrelated condition code value. Both return values are accessible after the procedure call.
RETURN, RETURNSCC, and C/C++ on TNS/E Example D-1. C Procedure Extracting Two pTAL Return Values from a 64-Bit Value (Works Only on TNS/R Systems—Not Recommended) pTAL procedure with two return values: int proc p (i, j, k) returnscc; int(16) i; int(32) .ext j; int(64) k; begin ... return i, j < k; ! Traditional function value is the value of i. ! Expression j < k sets condition code.
RETURN, RETURNSCC, and C/C++ on TNS/E Example D-2. C Procedure Extracting Only the Traditional Function Value from a 64-Bit Value (Works Only on TNS/R Systems) pTAL procedure with two return values: int proc p (i, j, k) returnscc; int(16) i; int(32) .ext j; int(64) k; begin ... return i, j < k; ! Traditional function value is the value of i. ! Expression j < k sets condition code.
RETURN, RETURNSCC, and C/C++ on TNS/E HP pTAL Reference Manual—523746-005 D- 4
Glossary accelerate. To speed up emulated execution of a TNS object file by applying the Accelerator for TNS/R system execution or the TNS Object Code Accelerator (OCA) for TNS/E system execution before running the object file. accelerated mode. See TNS accelerated mode. accelerated object code.
Glossary ASSIGN SSV command ASSIGN SSV command. An HP TACL command (available only on Guardian platforms) that lets you specify the node, system, volume, and subvolume from which the compiler is to resolve incomplete file names specified in SEARCH, SOURCE, and USEGLOBALS directives. Binder. A programming utility that combines one or more compilation units’ TNS object code files to create an executable TNS object code file for a TNS program or library. Used only with TNS object files. bit deposit.
Glossary breakpoint breakpoint. A location in a program at which execution is suspended so that you can examine and modify the program state. Breakpoints are set by debugger commands. byte. An 8-bit storage unit; the smallest addressable unit of memory. central processing unit (CPU). Historically, the main data processing unit of a computer. HP NonStop™ servers have multiple cooperating processors rather than a single CPU. See also processor. character string constant.
Glossary CPU CPU. See central processing unit (CPU). CRE. Common Run-Time Environment. Services that facilitate mixed-language programs. data segment. A virtual memory segment holding data. Every process begins with its own data segments for program global variables and runtime stacks (and for some libraries, instance data). Additional data segments can be dynamically created. DEFINE.
Glossary EXTDECS EXTDECS. A file, provided by the operating system, that contains external declarations for system procedures. System procedures, for example, manage files, activate and terminate programs, and monitor the operations of processes. extended addressing. Data access through an extended (32-bit) pointer. Compare to direct addressing. extended data segment. See selectable segment. extended pointer. A 32-bit simple pointer or structure pointer.
Glossary file system file system. In the Open System Services (OSS) environment, a collection of files and file attributes. A file system provides the namespace for the file serial numbers that uniquely identify its files. Open System Services provides a file system (see also ISO/IEC IS 9945-1:1990 [ANSI/IEEE Std. 1003.1-1990], Clause 2.2.2.38); the Guardian application program interface (API) provides a file system; and OSS Network File System (NFS) provides a file system.
Glossary HP Transaction Application Language (TAL) HP Transaction Application Language (TAL). A systems programming language with many features specific to stack-oriented TNS systems. identifier. A name you declare for an object such as a variable, LITERAL, or procedure. IF expression. An expression that selects the THEN expression for a true state or the ELSE expression for a false state. index.
Glossary misaligned misaligned. In TNS mode and TNS accelerated mode, an erroneous address that is oddbyte aligned. In native mode, an inefficient address that is not aligned. mixed-language program. A program that contains source files written in different HP programming languages. move statement. A statement that copies a group of elements from one location to another. multidimensional array. A structure that contains nested substructures. NAME declaration.
Glossary parameter mask parameter mask. A means by which the compiler keeps track of which actual parameters are passed by a procedure to an EXTENSIBLE procedure or VARIABLE procedure. parameter pair. Two parameters connected by a colon that together describe a single data type to some languages. pathname. In the Open System Services (OSS) file system and Network File System (NFS), the string of characters that uniquely identifies a file within its file system.
Glossary processor processor. 1. A functional unit of a computer that reads program instructions, moves data between processor memory and the input/output controllers, and performs arithmetic operations. Because a processor is composed of several hardware components that reside in different enclosures, it is sometimes called a logical processor. A processor is sometimes called a central processing unit (CPU), but HP NonStop™ servers have multiple cooperating processors rather than a single CPU. 2.
Glossary register register. A facility that stores information about a running process. Registers include the program register, the instruction register, the local register, the stack register, the register stack, and the environment register. relational operator. A signed (<, =, >, <=, >= <>) or unsigned ('<', '=', '>', '<=', '>=', '<>') operator that performs signed or unsigned comparison, respectively, of two operands and then returns a true or false state. release version update (RVU).
Glossary source file source file. A file that contains source text such as data declarations, statements, compiler directives, and comments. The source file, together with any source code read in from other source files by SOURCE directives, compose a compilation unit that you can compile into an object file. SSV. See ASSIGN SSV command. standard pointer. A 16-bit simple pointer or structure pointer. A standard pointer can contain a 16-bit address. structure.
Glossary TNS accelerated mode TNS accelerated mode. A TNS emulation environment on a TNS/R or TNS/E system in which accelerated TNS object files are run. TNS instructions have been previously translated into optimized sequences of MIPS or Intel® Itanium® instructions. TNS accelerated mode runs much faster than TNS interpreted mode. Accelerated or interpreted TNS object code cannot be mixed with or called by native mode object code. See also TNS Object Code Accelerator (OCA). Compare to native mode.
Glossary value parameter value parameter. An argument for which a procedure or subprocedure passes a value, rather than the address of the argument, to a called procedure or subprocedure. The called procedure or subprocedure can modify the passed value but not the original argument in the caller’s scope. Compare to reference parameter. variable. A symbolic representation of an item or a group of items or elements.
Index A ABS routine 15-22/15-23 Absolute value 15-22 Actual parameters description of 12-11 checking for presence of 15-77 in CALL statement 12-10 of DEFINEs 6-7/6-9 Addition operator signed (+) in arithmetic expression 5-5 operand types for 5-6 precedence of 5-3 unsigned (’+’) in arithmetic expression 5-5 operand types for 5-8 precedence of 5-3 result types for 5-9 with INT(32) operands 5-11 Address misalignment causes of 4-1 handling 4-3 tracing facility for 4-1/4-2 Address symbols, base 2-7 Address types
Index A Arithmetic operators (continued) unsigned description of 5-8/5-11 in arithmetic expressions 5-5 Arithmetic overflow testing 15-76 Arrays description of 8-1 alignment of, in structures 9-13/9-15 as parameters 14-13, 14-14 data type of 15-88 declaring in structures 9-40/9-41 read-only 8-6/8-7 read-write 8-2/8-5 elements of accessing 3-9 number of 15-69 length of in bits 15-28 in bytes 15-59 nonstring 8-9 number of elements of 15-69 of addresses 8-2 redefining 9-55/9-56 ASCII characters set of 2-2 te
Index B AUTO parameter description of 9-7 compared to PLATFORM parameter 9-8 FIELDALIGN clause and 9-5/9-6 AXADR routine 15-26 B Backslash (\) See Remainder operator (’\’) BADDR address type description of 10-6 converting 3-9 parameters of 14-11 STRING pointers of 10-9 BADDR_TO_EXTADDR routine 15-26/15-27 BADDR_TO_WADDR routine 15-27 Base address symbols 2-7 Bases of constants 2-12 BEGIN keyword in compound statement 12-2 in procedure 14-17 in structure 9-3 in subprocedure 14-21 BEGINCOMPILATION directiv
Index C CASE statement description of 12-12 empty 12-12 labeled 12-13/12-15 unlabeled 12-15/12-17 CBADDR address type description of 10-6 converting 3-9 parameters of 14-11 pointers of 10-10 Character set for pTAL 2-2 Character string constants 3-12/3-13 Character-test routines 15-14 CHECKSHIFTCOUNT directive 17-22 CHECKSUM routine 15-31/15-32 COBOL procedure attribute 14-5 Codes completion 16-6 condition See Condition codes Colon (:) 2-4 COLUMNS directive description of 17-23/17-24 SOURCE directive and 1
Index D Condition codes (continued) returning (continued) with RETURNSCC attribute in procedure 14-5/14-8 in subprocedure 14-19/14-20 testing after function calls 12-35/12-36 Conditional compilation directives 17-16 Conditional expressions description of 5-15/5-17 hardware indicators in 13-8/13-12 Constant expressions description of 5-14 as parameters 14-14 in data type specifications 3-3 Constant lists description of 3-21/3-22 aligning 3-22/3-23 in array declarations 8-8/8-9 in move statement 12-28 Const
Index D Data (continued) types of See Data types Data addresses arithmetic operations on 3-10/3-11 comparing description of 5-11 extended addresses 5-12 nonextended addresses 5-12/5-14 to constants 3-11 to procedure pointers 3-11 computing distance between 3-11 converting to numbers 3-7 decrementing 3-10 incrementing 3-10 storing in variables 3-7 Data allocation statements 12-1 Data types See also Address types aliases for 3-4 changing, with group comparisons 5-27/5-28 obtaining 15-88 of expressions 5-2 p
Index E DEFINEs calling 6-5/6-6 CLASS attributes of B-5 declaring 6-3/6-5 expansion of 6-6 how compiler processes 6-6 LITERAL declarations and 6-1 names of B-5 parameters of actual 6-7/6-9 formal 6-3 substituting file names for B-5 DEFINETOG directive 17-25/17-26 Definition structures, declaring equivalenced 11-24/11-25 not equivalenced 9-33/9-35 Definition substructures declaring 9-42/9-44 redefining 9-56/9-59 Delimiters 2-4/2-5 Deploy command 18-7 DFIX routine 15-36/15-37 Diagnostics directives 17-15 Di
Index E END keyword in compound statement 12-2 in procedure 14-17 in structure 9-3 in subprocedure 14-21 ENDIF directive 17-27/17-28 Enterprise Toolkit (ETK) cross compilers and 18-2 debugging and 18-6 DEFINE files and 18-1 online help for 18-8 Entry points declaring 14-22/14-25 procedure 10-10 subprocedure 10-10 Equal sign as delimiter 2-5 as equal operator signed (=) in conditional expression 5-18 operand types for 5-18 precedence of 5-4 without operands 5-19 unsigned (’=’) in conditional expression 5-1
Index F EXTENSIBLE procedure attribute 14-5, 14-7 External declarations 17-61 EXTERNAL keyword in procedure declaration 14-2, 14-4 in procedure entry-point declaration 14-23 Extracting bits 5-31/5-32 F FAIL misalignment handling method 4-3 FIELDALIGN clause description of 9-20 role in field alignment 9-5/9-6 FIELDALIGN directive description of 9-20, 17-33 role in field alignment 9-5/9-6 File IDs B-3 File names See Disk file names Files DEFINE 18-1 EXTDECS 17-61 input 16-3 map of 17-34 OBJECT 16-6 object
Index G FOR statement description of 12-20/12-21 nested 12-21 optimized 12-22 standard 12-21 Formal parameters indirection symbols and 2-7 of DEFINEs 6-3 of procedures 14-3, 14-10 of subprocedures 14-10, 14-19 passing by reference 2-7 procedure pointers as 14-26, 14-32 specifying 14-10/14-15 FORTRAN procedure attribute 14-5 FORWARD keyword in procedure declaration 14-2, 14-4 in procedure entry-point declaration 14-23 in subprocedure declaration 14-19, 14-21 in subprocedure entry-point declaration 14-24 fp
Index H Greater than or equal operator (continued) unsigned (’>=’) (continued) with INT(32) operands 5-10 without operands 5-19 Group comparison expressions description of 5-24/5-27 for changing data types 5-27/5-28 testing 5-29/5-30 H HALT routine 15-51 Hardware indicators See also Condition codes across procedures 13-14/13-16 after assignments 13-3/13-8 built-in routines and 15-4 in conditional expressions 13-8/13-12 list of 13-1 Hash mark (#) 2-5 HIGH routine 15-52 HP TACL commands description of B-4
Index K INT data type constants of 3-15 converting 3-9 functions that return values of 14-12 high-order word of 15-52 parameters of 14-11, 14-12 rounding and 15-13 signed value of 15-47 unsigned value of 15-48 $INTR routine and 15-58 INT routine 15-53/15-54 Internal file names B-4 INTERROGATEHIO routine 15-55/15-56 INTERROGATEIO routine 15-57/15-58 INTERRUPT procedure attribute 14-5, 14-6 INTR routine 15-58/15-59 INT(16) data type See INT data type INT(32) address type bitwise logical operators and 5-10/5
Index M Less than operator (continued) unsigned (’<’) in conditional expression 5-18 operand types for 5-19 precedence of 5-4 with INT(32) operands 5-10 without operands 5-19 Less than or equal operator signed (<=) in conditional expression 5-18 operand types for 5-18 precedence of 5-4 without operands 5-19 unsigned (’<=’) in conditional expression 5-18 operand types for 5-19 precedence of 5-4 with INT(32) operands 5-10 without operands 5-19 LFIX routine 15-60/15-61 Libraries dynamic-link (DLLs) 16-12 use
Index N MISALIGNLOG attribute (SCF) misalignment handling and 4-3 misalignment tracing facility and 4-1 Misalignment See Address misalignment Mnemonics, listing 17-39 Modular programming 1-6 Most significant byte 3-1 Move statement 12-28/12-33 MOVEANDCXSUMBYTES routine 15-65/15-66 MOVENONDUP routine 15-67/15-68 Multiplication operator signed (*) description of 2-6 in arithmetic expression 5-5 operand types for 5-6 precedence of 5-3 unsigned (’*’) description of 2-6 operand types for 5-8 precedence of 5-3
Index O Numbers, converting to data addresses 3-7 NUMERIC routine 15-68 Numeric toggles 17-6 O OBJECT file 16-6 Object files content directives for 17-15 creating 16-7/16-11 generating 16-4 hybrid 16-11 linking 16-7/16-11 OCCURS routine 15-69/15-71 Odd-byte references 10-14, 10-17 OF keyword in labeled CASE statement 12-13 in unlabeled CASE statement 12-15 OFFSET routine description of 15-71/15-73 structure pointers and 10-18 Online help for cross compilers 18-8 Operands in arithmetic expressions 5-5 sca
Index P Output files 16-3 Overflow managing generally 13-1/13-3 GOTO statement and 12-24/12-25 testing 15-76 OVERFLOW routine description of 15-76/15-77 after assignments 13-3/13-4 atomic operation that can set 15-4 in nested IF statements 13-12/13-13 nonatomic operations that can set 15-17/15-22 returning its value to calling procedure 13-16 OVERFLOW_TRAPS directive 17-47/17-48 OVERFLOW_TRAPS procedure attribute description of 13-2 in procedure 14-5, 14-8 in subprocedure 14-19, 14-20 P PAGE directive 17
Index P Pointers (continued) declaring overview 10-2/10-4 procedure See Procedure pointers, declaring simple See Simple pointers, declaring structure See Structure pointers, declaring system global See System global data, declaring, pointers VOLATILE 10-4 procedure See Procedure pointers simple See Simple pointers stepping 3-10 structure See Structure pointers testing for nonzero values 3-12 POPname directive See name directive Position-independent code (PIC) 17-21 Pound sign (#) 2-5 Precedence of operato
Index Q Procedures (continued) main 14-5 resident 14-6 scope of 2-10/2-11 system 1-7 that return condition codes 12-37, 14-8 typed See Functions using hardware indicators across 13-14/13-16 variable 14-7 with RETURN statements 12-34 with two return values D-1/D-3 Procedure-parameter routines 15-16 PROCPTRs See Procedure pointers PROC(32) address type 14-11 Program control statements 12-1 pTAL language applications 1-3 character set for 2-2 compatibility with TAL 1-1 elements of 2-1 features of 1-4/1-6 ser
Index S REFALIGNED clause with simple equivalenced pointers 11-15 with structure pointers 9-27/9-32 REFALIGNED directive 17-51 Referral structures, declaring equivalenced 11-25/11-26 not equivalenced 9-38/9-39 Referral substructures declaring 9-45 redefining 9-59/9-60 Relational operators in conditional expressions 5-18 signed in address comparisons 5-11 operand types for 5-18 precedence of 5-4 unsigned in address comparisons 5-11 operand types for 5-19 precedence of 5-4 with INT(32) operands 5-10 with ex
Index S Search subvolume (SSV) command B-9/B-10 SECTION directive description of 17-55/17-56 global data blocks and 16-16 SOURCE directive and 17-59 Section names 17-55 Segment Page Table (SPT) address of 15-62 copying an entry from 15-80 Selector in labeled CASE statement 12-13 in unlabeled CASE statement 12-15 Semicolon (;) as delimiter 2-4 in statements 12-2 Services CRE 1-7 pTAL 1-7 system 1-6 setjmp() instruction 9-1 SETTOG directive 17-56/17-57 SGBADDR address type description of 10-6 converting 3-9
Index S Simple variables as parameters 14-13, 14-14 data type of 15-88 declaring equivalenced 11-8/11-10 not equivalenced 7-1/7-3 equivalenced 11-23/11-24 length of in bits 15-28 in bytes 15-59 redefining 9-54/9-55 within structures 9-40 Single quotation mark (’) 2-5 sINT 15-1 Slash (⁄ ) See Division operator Smear operation 12-33, 15-42 Source code listing 17-41 SOURCE directive description of 17-58/17-62 global data blocks and 16-16 NOLIST directive and 17-61 system procedure declarations and 17-61 Sour
Index S STRUCTALIGN (MAXALIGN) attribute 9-32, 9-36 Structure items arrays 9-40 filler bits or bytes 9-46/9-47 offsets of in bits 15-29 in bytes 15-71 pointers simple 9-48/9-49 structure 9-51/9-53 procedure pointers as 14-26 simple variables 9-40 substructures definition 9-42/9-44 referral 9-45/9-46 Structure pointers description of 10-1 addresses in 10-17 as parameters 14-14 declaring 10-16/10-17 initializing 10-17/10-19 redefining 9-63/9-64 reference alignment with 9-27/9-32 VOLATILE 10-5 within structu
Index T Substructures (continued) declaring definition 9-42/9-44 referral 9-45/9-46 length of in bits 15-28 in bytes 15-59 number of elements of 15-69 redefining definition 9-56/9-59 referral 9-59/9-60 Subsystem Control Facility See SCF user interface Subtraction operator signed (-) in arithmetic expression 5-5 operand types for 5-6 precedence of 5-3 unsigned (’-’) in arithmetic expression 5-5 operand types for 5-8 precedence of 5-3 result types for 5-9 with INT(32) operands 5-11 Subvolume names B-3 SUPPR
Index U Traps, managing generally 13-1/13-3 GOTO statement and 12-24/12-25 TRIGGER routine 15-88 TYPE routine 15-88/15-89 Typed procedures See Functions Type-conversion routines 15-12/15-13 U UDBL routine 15-89/15-90 UDIVREM16 routine 15-90/15-91 UDIVREM32 routine 15-91/15-92 uINT 15-1 Unlabeled CASE statement 12-15/12-17 UNLOCKPAGE routine 15-93 UNSIGNED data type functions that return values of 14-12 parameters of 14-11 Unsigned operators arithmetic 5-8/5-11 bit shift 5-3 relational 5-19 UNSPECIFIED pr
Index X WHILE statement description of 12-45/12-46 hardware indicators in 13-8 Words 3-1 WRITEPTE routine 15-95 X XADR routine 15-96 XOR operator in arithmetic expression 5-5 operand types for 5-10 precedence of 5-3 with INT(32) operands 5-10 Z ZZBInnnn target file 16-6 Special Characters ! (exclamation mark) 2-4 " (quotation mark) 2-5 # (hash mark or pound sign) 2-5 $ (dollar sign) 2-5 $ABS routine 15-22/15-23 $ALPHA routine 15-23/15-24 $ASCIITOFIXED routine 15-24/15-25 $ATOMIC_ routines 4-1, 4-3 $ATO
Index Special Characters $INTERROGATEIO routine 15-57/15-58 $INTR routine 15-58/15-59 $INT_OV routine 15-54/15-55 $LEN routine 15-59/15-60 $LFIX routine 15-60/15-61 $LMAX routine 15-61 $LMIN routine 15-61/15-62 $LOCATESPTHDR routine 15-62/15-63 $LOCKPAGE routine 15-63/15-64 $MAX routine 15-64 $MIN routine 15-64/15-65 $MOVEANDCXSUMBYTES routine 15-65/15-66 $MOVENONDUP routine 15-67/15-68 $NUMERIC routine 15-68 $OCCURS routine 15-69/15-71 $OFFSET routine description of 15-71/15-73 structure pointers and 10-
Index Special Characters .SG in formal parameters 14-13 in procedure pointers 14-28 in system global pointers 10-20 .SGX in formal parameters 14-13 in procedure pointers 14-28 .tal file extension 18-1 ... (ellipsis) 12-13 : (colon) 14-23 := assignment operator 5-4 See also Assignments left-to-right move 12-28 ; (semicolon) as delimiter 2-4 in statements 12-2 < See Less than operator, signed (<) < > (angle brackets) 2-4 <...> (bit extraction) 5-3 <...
Index ’⁄ Special Characters ’ See Division operator, unsigned (’⁄ ’) ⁄ See Division operator, signed (⁄ ) HP pTAL Reference Manual—523746-005 Index -28