Browse Prior Art Database

Coroutine Implementation to Process Composed Page Data Stream

IP.com Disclosure Number: IPCOM000100565D
Original Publication Date: 1990-May-01
Included in the Prior Art Database: 2005-Mar-15
Document File: 6 page(s) / 220K

Publishing Venue

IBM

Related People

Smith, WC: AUTHOR

Abstract

Disclosed is a programming technique to process Composed Page Data Stream input for printing.

This text was extracted from an ASCII text file.
This is the abbreviated version, containing approximately 34% of the total text.

Coroutine Implementation to Process Composed Page Data Stream

       Disclosed is a programming technique to process Composed
Page Data Stream input for printing.

      The programs that process Composed Page Data Stream input (1)
must perform nonuniform processing due to data expansion and
dissimilar buffering of program inputs and outputs.  A coroutine
implementation reduces the internal complexity of the software to
perform the nonuniform processing.

      A method to implement a coroutine [2] with standard Linkage
Conventions for System/370 programs [3] is described here.  The basic
logical principle of the method will be described first, followed by
a description of each case for the potential variations in program
architecture.

      The basic logical principle is illustrated by two procedures.
Let A and B be two procedures which must operate as coroutines.  When
A calls B, then, according to standard Linkage Conventions, B is
subordinate to A and will execute from the beginning (Fig. 1).
However, B can operate as a coroutine in this situation if it
determines whether the entry to it from the call is an initial entry,
or a resumption after a prior entry, and restores its state from the
prior execution to effect the resumption (Fig. 2).  B must meet these
two requirements:
1.  it must have saved its state from the prior execution; and
2.  it must be able to perform a test to distinguish an initial entry
from a resumption (resume test).

      The standard Linkage Conventions do not preclude these actions
by B; in fact, they provide assistance in various ways.

      Three cases will be described, depending upon whether or not B
must be read-only (R-O) and if B is merely the top program in a
subtree of subroutines which must collectively operate as a
coroutine.
Case 1: Subroutine B is not R-O

      Before B returns to its caller, it must save its state in
storage owned by itself.  The state consists of the machine registers
being used, the address at which to resume execution (resume
address), a binary value (resume flag) for the resume test, plus any
internal storage which can be affected by other initial executions
along alternate paths (i.e., being called by P, Q, etc.).  The resume
flag may be the storage of any value of one or more bits which can
be conveniently set to and tested for zero/nonzero. Satisfactory
candidates for the resume flag include the following:
$   a separate word
$   resume address
$   storage of general register 14.

      The stored resume flag must initially be zero so that a nonzero
value will identify the existence of a saved state (Fig. 3(a)).  The
resume flag must be made nonzero when B exits but wishes to continue
execution as a coroutine (Fig. 3(b)).  When B is entered with a
nonzero resume flag, it must restore the prior state and continue
execution from the resume address.  B must reset the resume flag to
zero when it concludes its execution as a co...