• Aucun résultat trouvé

Current Matching Class

Dans le document 4110 SERIES HOST PROGRAMMERS (Page 70-73)

Definition. The current matching class is defined by a pair of 64-bit terminal registers, the inclusion class register and the exclusion class register. These registers are defined by two arrays sent as parameters to the SET-CURRENT-MATCH-lNG-CLASS command. When you use -3 as the segment-number parameter in a segment manipulation command, the terminal compares every segment's segment class field with the inclusion and exclusion class registers. Each segment that passes the matching operation is acted upon by the segment command. By defining the matching class registers properly, you can cause a segment manipulation command to affect any group of segments.

The Inclusion Array. This parameter of the SET-CUR-RENT-MATCH lNG-CLASS command is an array of integers between 1 and 64 or the single integer -1. Bits in the inclu-sion class register are set to 1 if that integer is included in the array and to 0 if that integer is not included in the array.

If the array consists of the single integer -1, all bits in the inclusion class register are set to 1. To set bits 13 and 14 (Subassembly 12 from our earlier example) in the inclusion class register to 1, your inclusion array should be:

14,13

The Exclusion Array. This parameter of the SET-CUR-RENT-MATCH lNG-CLASS command is an array of integers between 1 and 64 or the single integer -1. Bits in the exclu-sion class register are set to 1 if that integer is included in the array and to 0 if that integer is not included in the array.

If the array consists of the single integer -1, all bits in the exclusion class register are set to 1. If you want to set Bits 1, 2, 4, and 5 (Part Number 27 in our previous example) to 1, your exclusion array should be:

5,4,2,1

The Matching Operation. When you have a segment num-ber of -3 for a segment command, the terminal performs a bitwise comparison between the segment class field of each segment and the inclusion and exclusion class registers in the terminal. If the result of this comparison is true, the op-eration is performed for that segment.

4110 SERIES HOST

(

(

(

The comparison is true when each bit of the segment class field ANDed with the inclusion class register yields the inclu-sion class register and each bit of the segment class field ANDed with the exclusion class register yields a field of ze-ros. If SCF is a bit in the segment class field, ICR is a bit in the inclusion class register, and ECR is a bit in the exclusion class register, the comparison is true when, for each SCF, ICR, and ECR, the following expression is true:

(SCF AND ICR = ICR) AND (SCF AND ECR = 0) AN EXAMPLE USING SEGMENT CLASSES

The following example uses an encoding method chosen to illustrate the use of both inclusion and exclusion arrays.

The Scenario

You have a program that draws widgets. Each widget may be one of 45 colors. Widgets may be made of glass, plastic, copper, or tin. Widgets are made by companies A, B, and C in Great Britain; by company Land M in Sri Lanka; and companies V, W, X, and Y in the United States.

Defining the Segment Class Subfields

First, partition the segment class field into subfields to rep-resent the country of origin, the manufacturer, the color, the material, and the product.

SEGMENTS

You could assign bit positions to the subfields like this:

• Country - Bits 1 and 2

• Manufacturer - Bits 3 through 6

• Color - Bits 7 through 12

• Material - Bits 13 and 14

• Widget - Bit 15

Figure 7-2 shows how, in this example, the first 15 bits of the segment class field are grouped into subfields.

Setting the Segment Class Field

You must set the segment class field for each widget. As-suming that Segment 43 is a blue tin widget made in Sri Lanka by company L we might have the following conditions:

• Sri Lanka is Country Number 3

• Company L is Company Number 4

• Blue is Color Number 12

• Tin is Material Number 1

• Segment 43 is a widget

In this case, the first 15 bits of the segment class field for Segment 43 should look like Figure 7-3.

To set the segment class field to this pattern, use the SET-SEGMENT-CLASS command and send the addition array:

15,14,10,9,4,1,2

Figure 7-2. The First 15 Bits of the Segment Class Field.

Figure 7-3 . The Segment Class Field for Segment 43.

4110 SERIES HOST 7-9

SEGMENTS

Using the Current Matching Class

After you have set the segment class fields for several seg-ments, you can manipulate groups of segments using the current matching class and a segment number of -3. If you want to see only the widgets from Sri Lanka, first make all segments invisible:

SET-SEGMENT-VISIBILITY -1,0

Then make just the widgets from Sri Lanka visible.

SET-CURRENT-MATCHING-CLASS (1,2,15)0 SET-SEGMENT-VISIBILITY -3,1

7-10

In this case you need only specify the bits you want to find as set in the segment class field by putting the bit number in the inclusion array. To check that a bit is 0, put its number in the exclusion array. For example, if you want to show all segments from Sri Lanka that are not widgets, make all the segments invisible, then set the current matching class to exclude Bit 15, the widget subfield:

SET-CURRENT-MATCHING-CLASS (1,2)(15) SET-SEGMENT-VISIBILITY -3,1

Remember, the comparison is a bitwise comparison. You could inadvertently include or exclude undesired segments if you are not cautious in allocating your subfields. For exam-ple, if Great Britain were country 1 (Bit 2 set) excluding Great Britain would also exclude Sri Lanka, which has both Bits 1 and 2 set.

4110 SERIES HOST

()

(

Section 8

Dans le document 4110 SERIES HOST PROGRAMMERS (Page 70-73)

Documents relatifs