EasyManua.ls Logo

HP TACL User Manual

HP TACL
235 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #23 background imageLoading...
Page #23 background image
Defining Program Structure
Developing TACL Programs
107365 Tandem Computers Incorporated 2–3
You can define a macro that increments a loop variable (passed as the argument); for
example:
[#DEF next MACRO |BODY|
#SET %1% [#COMPUTE %1% + 1]
]
Use the macro in Figure 2-2, bubble, with its nested #LOOP statements, to perform a
bubble sort. A bubble sort compares numbers and switches their places until the
numbers are stored in ascending order.
To run bubble, load its file and supply the number of sort elements as an argument:
bubble
num
Figure 2-2. Performing a Bubble Sort With Nested #LOOP Statements (Page 1 of 2)
?SECTION bubble MACRO
#FRAME
#PUSH i j max ocount element prompt temp
#SETMANY i j max ocount element, 0 0 0 0 0
#SET prompt Enter Next Number to be Sorted...
== Request the number of elements specified in argument 1 and
== store them in levels of STACK
[#LOOP |WHILE| (element < %1%) |DO|
#PUSH stack
#INPUTV stack prompt
#SET element [#COMPUTE element + 1]
] {end of INPUT loop}
== Loop once for each element
#SET ocount 1
[#LOOP |WHILE| (ocount < %1%) |DO|
#SET i 1
#SET max [#COMPUTE %1% - ocount + 1]
== Compare each element to its adjacent number; switch places
== if we encounter a smaller number.
[#LOOP |WHILE| (i < max) |DO|
#SET j [#COMPUTE i + 1]
[#IF ([stack.i] > [stack.j]) |THEN|
#SET temp [stack.i]
#SET stack.i stack.j
#SET stack.j temp
]
#SET i [#COMPUTE i + 1]
] {end of inner loop}
#SET ocount [#COMPUTE ocount + 1]
] == end of outer loop

Table of Contents

Question and Answer IconNeed help?

Do you have a question about the HP TACL and is the answer not in the manual?

HP TACL Specifications

General IconGeneral
NameHP TACL
PurposeTask automation, system management, and application control
CategorySoftware
PlatformHP NonStop
TypeScripting language
DeveloperHewlett-Packard

Summary

Section 1 An Overview of TACL

Running the Examples in This Manual

Instructions for executing manual examples, including setting required variables.

About This Manual

Section 2 Developing TACL Programs

Processing Character Data

Covers tasks like constructing text strings, analyzing output, and manipulating characters.

Debugging TACL Programs

Introduces the TACL debugger for step-by-step execution and variable examination.

Section 3 Developing TACL Routines

Processing Arguments

Details how routines handle arguments using #ARGUMENT, including options and alternatives.

Writing an Exception Handler

Explains handling events like BREAK keys or TACL errors using exception handlers.

4 Accessing Files

#REQUESTER Operation

Describes the #REQUESTER function for opening files and initiating I/O operations.

Requesting Waited Reads

Explains opening files for waited read operations using #REQUESTER.

5 Initiating and Communicating With Processes

Initiating a Process: RUN and #NEWPROCESS

Covers starting processes using RUN and #NEWPROCESS, including startup options.

6 Running TACL as a Server

Running a TACL Process as a Server

Explains making a TACL process a server by establishing its IN file as $RECEIVE.

Running TACL Code as a Server

Details providing TACL code for a TACL-server process using #INPUTV and #REPLYV.

Using TACL as a Pathway Server

Describes creating a Pathway environment with TCP and TACL servers to process requests.

7 Using Programmatic Interfaces

8 Example of a System Management Program

Related product manuals