Example: quiz answers

TAL Programmer's Guide - NonStopTools

Languages LibraryTALP rogrammer sGuideAbstractThis manual provides usage information for TAL (Transaction Application Language) and the TALcompiler for system and application Number096254 EditionSecondPublishedSeptember 1993 Product VersionTAL C30, TAL D10, TAL D20 Release ReleasesThis manual supports C30 and all subsequent releases until otherwise indicated in a HistoryEditionPart NumberProduct VersionEarliest Supported ReleasePublishedFirst065721 TAL D10N/AJanuary 1993 Second096254 TAL C30 TAL D10 TAL D20C30 1993 New editions incorporate any updates issued since the previous plus sign (+) after a release ID indicates that this manual describes function added to the base release,either by an interim product modification (IPM) or by a new product version on a .99 site update tape (SUT).CopyrightCopyright 1993 by Tandem Computers Incorporated. Printed in the All rights reserved. No part of thisdocument may be reproduced in any form, including photocopying or translation to another language, withoutthe prior written consent of Tandem Computers StatementExport of the information contained in this manual may require authorization from the U.

Languages Library TAL Programmer’s Guide Abstract This manual provides usage information for TAL (Transaction Application Language) and the TAL compiler for system and application programmers. Part Number 096254 Edition Second Published September 1993 Product Version TAL C30, TAL D10, TAL D20 Release ID D20.00 Supported Releases This manual supports C30/D10.00 and all subsequent …

Tags:

  Guide, Manual, Programmer, Tal programmer s guide

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Transcription of TAL Programmer's Guide - NonStopTools

1 Languages LibraryTALP rogrammer sGuideAbstractThis manual provides usage information for TAL (Transaction Application Language) and the TALcompiler for system and application Number096254 EditionSecondPublishedSeptember 1993 Product VersionTAL C30, TAL D10, TAL D20 Release ReleasesThis manual supports C30 and all subsequent releases until otherwise indicated in a HistoryEditionPart NumberProduct VersionEarliest Supported ReleasePublishedFirst065721 TAL D10N/AJanuary 1993 Second096254 TAL C30 TAL D10 TAL D20C30 1993 New editions incorporate any updates issued since the previous plus sign (+) after a release ID indicates that this manual describes function added to the base release,either by an interim product modification (IPM) or by a new product version on a .99 site update tape (SUT).CopyrightCopyright 1993 by Tandem Computers Incorporated. Printed in the All rights reserved. No part of thisdocument may be reproduced in any form, including photocopying or translation to another language, withoutthe prior written consent of Tandem Computers StatementExport of the information contained in this manual may require authorization from the U.

2 S. Department and sample programs are for illustration only and may not be suited for your particular does not warrant, guarantee, or make any representations regarding the use or the results of the useof any examples or sample programs in any documentation. You should verify the applicability of any exampleor sample program before placing the software into productive InformationFor manual ordering information: Domestic customers, call 1-800-243-6886; international customers,contact your local sales and Changed Information096254 Tandem Computers IncorporatediiiThe TAL programmer s Guide gives guidelines for using TAL. This edition incorporatesnew features introduced in the D20 release and corrects text in response to readercomment edition includes the following new features:For INT, REAL, and UNSIGNED data types and parameter types, a widthargument can consist of any constant expression, including LITERALs (*) is now a data type and a parameter variable can have the same identifier as the encompassing BLOCK addition to the implicit block named #GLOBAL, TAL creates an implicit blockfor each template structure declared outside a BLOCK compiler ignores extra commas in, or adjacent to, procedure attribute CALL statements, the CALL keyword is RETURN statement lets you specify a condition-code value and a returnexpression.

3 $OPTIONAL, a new standard function, lets you conditionally pass parameters toVARIABLE and EXTENSIBLE , a new directive, lets you create named and numeric toggles. Itleaves new toggles turned off but does not change the settings of existing IF, IFNOT, and ENDIF directives now support named operating system for Tandem NonStop systems, formerly called the Guardianoperating system, is now called the Tandem NonStop Kernel. This change reflectsTandem's current and future operating system enhancements that further enable opensystems and application and Changed Informationiv096254 Tandem Computers IncorporatedContents096254 Tandem Computers IncorporatedvAbout This manual xxvNotation Conventions xxxiiiSection 1 Introducing TALU sing TAL 1-1 Major Features 1-1 System Services 1-3 System Procedures 1-3 TAL Run-Time Library 1-3 CRE Services 1-3 Section 2 Getting StartedSample Source File 2-1 Creating Source Files 2-2 Compiler Directives 2-2 System Procedures 2-3 Procedures 2-3 Data Declarations 2-3 Statements 2-4 Comments 2-4 Compiling Source Files 2-4 Running Programs 2-5 Section 3 Structuring ProgramsSource Files 3-1 Compilation Units 3-1 Structuring Compilation Units 3-1 Order of Components 3-3 Naming Compilation Units 3-4 Declaring Data 3-4 Declaring Global Data

4 3-5 Declaring Unblocked Global Data 3-5 Declaring Blocked Global Data 3-5 Contentsvi096254 Tandem Computers IncorporatedDeclaring Procedures 3-6 Procedure Heading 3-6 Procedure Body 3-6 FORWARD Procedures 3-6 EXTERNAL Procedures 3-7 Procedure Entry Points 3-7 Local Data 3-8 Local Labels 3-8 Local Statements 3-8 Declaring Subprocedures 3-10 Subprocedure Heading 3-10 Subprocedure Body 3-10 FORWARD Subprocedures 3-10 Subprocedure Entry Points 3-11 Sublocal Data 3-12 Sublocal Labels 3-12 Sublocal Statements 3-12 Formatting Programs 3-13 Formatting With Comments 3-14 Formatting With BEGIN-END Constructs 3-16 Using Semicolons 3-17 Using Compiler Directives 3-18 Section 4 Introducing the EnvironmentProcess Environment 4-1 Code Space 4-1 Data Space 4-2 System Code Space 4-5 System Library Space 4-5 Registers 4-5 Addressing Modes 4-5 Direct Addressing 4-6 Indirect Addressing 4-6 Indexing 4-7 Storage Allocation 4-8 Allocation in the User Data Segment 4-8 Allocation in the Automatic Extended Segment 4-10 Contents096254 Tandem Computers IncorporatedviiSection 5 Using ExpressionsAbout Expressions 5-1 Complexity 5-1 Functionality 5-1 Operands 5-2 Identifiers 5-2 Data Types 5-4 Data Type Aliases 5-6 Storage Units 5-6 Data Types of Expressions 5-6 Variables 5-7 Constants 5-7 LITERALs 5-11 Standard Functions 5-12 Precedence of Operators 5-13 Arithmetic Expressions 5-15 Operands in Arithmetic Expressions 5-15 Signed Arithmetic Operators 5-16 Unsigned Arithmetic Operators 5-18 Bitwise Logical Operators 5-20 Conditional Expressions 5-21 Conditions 5-21 Boolean Operators 5-22 Relational Operators 5-23 Assigning Conditional Expressions 5-24 Testing Hardware Indicators

5 5-25 Condition Code Indicator 5-25 Carry Indicator 5-26 Overflow Indicator 5-26 Accessing Operands 5-27 Getting the Address of Variables 5-27 Dereferencing Simple Variables 5-27 Extracting Bit Fields 5-28 Shifting Bit Fields 5-29 Contentsviii096254 Tandem Computers IncorporatedSection 6 Using Simple VariablesDeclaring Simple Variables 6-1 Specifying Data Types 6-1 Initializing Simple Variables 6-2 Allocating Simple Variables 6-3 Assigning Data to Simple Variables 6-4 Assigning Variables 6-4 Matching Data Types 6-4 Converting Data Types 6-4 Assigning Character Strings 6-4 Multiple Variables 6-5 Simple Variables by Data Type 6-5 STRING Simple Variables 6-5 INT Simple Variables 6-6 INT(32) Simple Variables 6-8 REAL Simple Variables 6-9 REAL(64) Simple Variables 6-10 FIXED Simple Variables 6-11 UNSIGNED Simple Variables 6-13 Section 7 Using ArraysDeclaring Arrays 7-1 Using Indirection 7-2 Specifying Data Types 7-2 Initializing Arrays 7-2 Arrays by Data Type 7-4 Allocating Arrays 7-8 Addressability of Arrays 7-11 Accessing Arrays 7-12 Indexing Arrays 7-12 Assigning Data to Array Elements 7-13 Assigning the Address of Arrays 7-13 Copying Data Into Arrays 7-14 Copying a Constant List Into an Array 7-14 Copying Data Between Arrays 7-15 Copying Data Within an Array 7-17 Using the Next Address 7-17 Concatenating Copy Operations 7-18 Contents096254 Tandem Computers IncorporatedixScanning Arrays 7-19 Delimiting the Scan Area 7-19 Determining What Stopped the Scan 7-20 Scanning Bytes in Word-Aligned Arrays 7-20 Multipart Scan Example 7-20 Comparing Arrays 7-23 Using Standard Functions With

6 Arrays 7-23 Using Read-Only Arrays 7-24 Declaring Read-Only Arrays 7-24 Accessing Read-Only Arrays 7-24 Section 8 Using StructuresKinds of Structures 8-1 Structure Layout 8-2 Declaring Definition Structures 8-3 Specifying Structure Occurrences 8-3 Using Indirection 8-3 Allocating Definition Structures 8-4 Addressability of Structures 8-6 Declaring Template Structures 8-7 Declaring Referral Structures 8-8 Specifying Structure Occurrences 8-8 Using Indirection 8-8 Allocating Referral Structures 8-9 Addressability of Structures 8-9 Declaring Simple Variables and Arrays in Structures 8-9 Declaring Arrays That Use No Memory 8-10 Allocating Simple Variables and Arrays in Structures 8-10 Alignment of Simple Variables and Arrays 8-10 Declaring Substructures 8-12 Declaring Definition Substructures 8-12 Declaring Referral Substructures 8-15 Declaring Fillers 8-16 Declaring Filler Bytes 8-16 Declaring Filler Bits 8-16 Contentsx096254 Tandem Computers IncorporatedDeclaring Simple Pointers in Structures 8-17 Addresses Simple Pointers Can Contain 8-18 Allocating Simple Pointers in Structures 8-18 Declaring Structure Pointers in Structures 8-19 Addresses Structure Pointers Can Contain 8-20 Allocating Structure Pointers in Structures 8-20 Declaring Redefinitions 8-21 Simple Variables or Arrays as Redefinitions 8-21 Definition Substructures as Redefinitions 8-23 Referral Substructures as Redefinitions 8-25 Simple Pointers as Redefinitions 8-26 Structure Pointers as Redefinitions 8-26 Accessing Structure Items 8-27 Qualifying Identifiers 8-27 Indexing Structures 8-28 Assigning Values to Structure Items 8-34 Assigning Addresses to Pointers in Structures 8-35 Accessing Data Through Pointers in Structures 8-36 Copying Data in

7 Structures 8-39 Using Standard Functions With Structures 8-43 Section 9 Using PointersUsing Simple Pointers 9-2 Declaring Simple Pointers 9-2 Specifying a Data Type 9-2 Initializing Simple Pointers 9-3 Initializing Global Simple Pointers 9-3 Initializing Local or Sublocal Simple Pointers 9-5 Allocating Simple Pointers 9-6 Assigning Addresses to Simple Pointers 9-7 Accessing Data With Simple Pointers 9-9 Indexing Simple Pointers 9-10 Contents096254 Tandem Computers IncorporatedxiUsing Structure Pointers 9-12 Declaring Structure Pointers 9-12 Initializing Structure Pointers 9-13 Initializing Global Structure Pointers 9-13 Initializing Local or Sublocal Structure Pointers 9-15 Allocating Structure Pointers 9-16 Assigning Addresses to Structure Pointers 9-16 Accessing Data With Structure Pointers 9-18 Indexing Structure Pointers 9-20 Section 10 Using Equivalenced VariablesExample Diagrams 10-1 Variables You Can Equivalence 10-1 Equivalencing Simple Variables 10-2 Declaring Equivalenced Simple Variables 10-2 Accessing Equivalenced Simple Variables 10-5 Equivalencing Simple Pointers 10-6 Declaring Equivalenced Simple Pointers 10-6 Accessing Equivalenced Simple Pointers 10-8 Equivalencing Structures 10-9 Equivalencing Definition Structures 10-10 Equivalencing Referral Structures 10-14 Equivalencing Structure Pointers 10-15 Declaring Equivalenced Structure Pointers 10-16 Accessing Data Through Equivalenced Structure Pointers 10-18 Using Indexes or Offsets 10-19 Emulating Pascal Variant Parts 10-21 Section 11 Using ProceduresProcedures and Code Segments 11-1 Declaring Procedures 11-2 Calling Procedures 11-2 Declaring Parameters in Procedures 11-3 Specifying a Formal Parameter List 11-3 Declaring Formal Parameters 11-3

8 Passing Actual Parameters 11-4 Contentsxii096254 Tandem Computers IncorporatedDeclaring Data in Procedures 11-4 Allocating Local Variables 11-5 Allocating Parameters and Variables 11-5 Returning From a Procedure 11-7 Using Procedure Options 11-7 Declaring the MAIN Procedure 11-7 Declaring Functions 11-8 Declaring FORWARD Procedures 11-8 Declaring EXTERNAL Procedures 11-9 Declaring VARIABLE Procedures 11-9 Declaring EXTENSIBLE Procedures 11-10 Passing Parameters to VARIABLE or EXTENSIBLE Procedures 11-11 Converting VARIABLE Procedures to EXTENSIBLE 11-13 Comparing Procedures and Subprocedures 11-14 Declaring and Calling Subprocedures 11-15 Including Formal Parameters 11-15 Sublocal Variables 11-16 Visibility of Identifiers 11-16 Sublocal Storage Limitations 11-17 Sublocal Parameter Storage Limitations 11-18 Using Parameters 11-20 Declaring Formal Parameters 11-20 Using Value Parameters 11-21 Using Reference Parameters 11-29 Parameter Pairs 11-35 Procedure Parameter Area 11-36 Subprocedure Parameter Area 11-36 Scope of Formal Parameters 11-36 Parameter Masks 11-38 VARIABLE Parameter Masks 11-38 EXTENSIBLE Parameter Masks 11-42 Using Labels 11-48 Using Local Labels 11-48 Using Undeclared Labels 11-51 Getting Addresses of Procedures and Subprocedures 11-52 Contents096254 Tandem Computers IncorporatedxiiiSection 12 Controlling Program FlowIF Statement 12-2IF Statement Execution 12-3IF-ELSE Pairing 12-4 CASE Statement.

9 Labeled 12-5 Statement Forms Generated by the Compiler 12-6 Directives and CASE Statements 12-7 Labeled CASE Statement Execution 12-7 WHILE Statement 12-8DO Statement 12-10 FOR Statement 12-12 Nesting FOR Loops 12-13 Standard FOR Loops 12-13 Optimized FOR Loops 12-15 ASSERT Statement 12-17 Using ASSERT with ASSERTION 12-17 Nullifying ASSERT Statements 12-18 CALL Statement 12-19 Calling Procedures and Subprocedures 12-19 Calling Functions 12-20 Calling Procedures Declared as Formal Parameters 12-20 Passing Parameter Pairs 12-20 RETURN Statement 12-21 Returning From Functions 12-21 Returning From Nonfunction Procedures 12-23 GOTO Statement 12-24 Local Scope 12-24 Sublocal Scope 12-24 Usage Guidelines 12-25 Contentsxiv096254 Tandem Computers IncorporatedSection 13 Using Special ExpressionsAssignment Expression 13-2 CASE Expression 13-3IF Expression 13-4 Group Comparison Expression 13-5 Comparing a Variable to a Constant List 13-5 Comparing a Variable to a Single Byte 13-5 Comparing a Variable to a Variable 13-6 Using the Next Address 13-7 Testing the Condition Code Setting 13-9 Section 14 Compiling ProgramsTh


Related search queries