PATMAT
         IDENT     PATMAT                                               PATMAT       1
         TITLE PATTERN MATCHING                                         PATMAT       2
*  FOR A LISTING OF THE SNODEF COMDECK, CALLED BELOW, SEE MAINLUP.      PATMAT       3
         LIST  -L                                                       PATMAT       4
*CALL,SNODEF                                                            PATMAT       5
         LIST  L                                                        PATMAT       6
*  ERROR                                                                PATMAT       7
         EXT   ERR20,ERR21,ERR22,ERR23,ERR24,ERR26,ERR27,ERR28          PATMAT       8
*  STORMAN                                                              PATMAT       9
         EXT   PUSHSTK,RESERVE,MORFREE,GETSTAK,GRBCOLL,RESHB            PATMAT      10
*  UTILITY                                                              PATMAT      11
         EXT   ITOS,SSTOS,STOSFX6,PTOPX4,ICX1X6,ZROX7,SSTOSF,ITOSF      PATMAT      12
         EXT   ITOSFTP,SOPERND,X1VALUE,FREESVD,SASSIGN,INDRCT,INDRX     PATMAT      13
         EXT   SEARCH,FREESTR                                           PATMAT      14
*  PATMAT                                                               PATMAT      15
         ENTRY PRDPM,DOLPM,ENDEXPM,ALTPM,EXPPM,ARBPM,LENPM,POSPM        PATMAT      16
         ENTRY RPOSPM,TABPM,RTABPM,REMPM,BALPM,FAILPM,FENCEPM,ABORTPM   PATMAT      17
         ENTRY ARBNOPM,STARPM,LITPM,ANYPM,NTANYPM,SPANPM,BREAKPM        PATMAT      18
         ENTRY ENTER,SETSIPI,NALTPMP                                    PATMAT      19
*  IO                                                                   PATMAT      20
         EXT   INPUT,OUTPUT,CLOSOUT                                     PATMAT      21
*  MAINLUP                                                              PATMAT      22
         EXT   PMFOUND,PMABT                                            PATMAT      23
*                                                                       PATMAT      24
SIXREL   EQU   0                                                        PATMAT      25
PIXREL   EQU   1                                                        PATMAT      26
MARK     EQU   377777B                                                  PATMAT      27
         EJECT                                                          PATMAT      28
ENTERA   DATA 0                                                         PATMAT      29
+        SX0   X5+0                . THE NEXT ELEMENT IS THE ELEMENT    PATMAT      30
         SA2   ENTERA              .  AFTER THE ALTERNATIVE             PATMAT      31
         NG    X0,ENTER1                                                PATMAT      32
         SB4   X0+0                                                     PATMAT      33
         EQ    ENTER1                                                   PATMAT      34
*                                                                       PATMAT      35
ENTER    NO                        . RECURSIVE CALL                     PATMAT      36
+        NO                                                             PATMAT      37
         SA2   ENTER                                                    PATMAT      38
ENTER1   SB6   B6+4                                                     PATMAT      39
          SA1       MAXSTAK                                             PATMAT      40
          SX1       X1+B6                                               PATMAT      41
          PL        X1,PMBUMP      . BRANCH IF NO SPACE                 PATMAT      42
PMBUMPR  BX6   X2                  . STORE X5,X4,THE RETURN JUMP        PATMAT      43
         SA7   B6-1                . AND X7 IN THE STACK                PATMAT      44
         SA6   B6                                                       PATMAT      45
         BX6   X4                                                       PATMAT      46
         BX7   X5                                                       PATMAT      47
         SA6   B6-3                                                     PATMAT      48
         SA7   B6-2                                                     PATMAT      49
         SA5   PIB                                                      PATMAT      50
         SX2   B1+0                                                     PATMAT      51
         LX5   18                                                       PATMAT      52
         BX5   X2+X5                                                    PATMAT      53
         MX0   1                                                        PATMAT      54
         LX5   18                                                       PATMAT      55
         BX5   X5+X0                                                    PATMAT      56
*                                                                       PATMAT      57
NEXT     SX0   1                   . SET NO ALTERNATIVE                 PATMAT      58
         LX0   17                                                       PATMAT      59
         BX5   X0+X5                                                    PATMAT      60
NEXT1     SA1      B4              . NEXT PM OPERATION TO X1            PATMAT      61
         ID    X1,YDOL             . IGNORE DOLPM OR PRDPM              PATMAT      62
         UX1   X1,B2                                                    PATMAT      63
       JP    B2+YSTAR                                                   PATMAT      64
*                                                                       PATMAT      65
PMBUMP   SA1   MINHS               . STORE S AND P STACK POINTERS       PATMAT      66
         BX6   X3                  . IN SPECIAL HS LOCATIONS            PATMAT      67
         BX3   X5                                                       PATMAT      68
         SA6   X1+SIXREL                                                PATMAT      69
         SA5   PMA5                . RESTORE A5 FOR ERRORMESSAGE        PATMAT      70
         SA5   X5+0                                                     PATMAT      71
         BX5   X3                                                       PATMAT      72
         SA3   PIX                                                      PATMAT      73
         BX6   X3                                                       PATMAT      74
         SX3   A0                                                       PATMAT      75
         SA6   X1+PIXREL                                                PATMAT      76
         SB2   B3+1                . DESCRIBE IN A0 WHERE THE LAST      PATMAT      77
         SA0   B6-B2               .  NORMAL STACK ENTRY CAN BE FOUND   PATMAT      78
         RJ    GETSTAK                                                  PATMAT      79
         SA0   X3                                                       PATMAT      80
         SA1   MINHS                                                    PATMAT      81
         SA3   X1+PIXREL           . CLEAR USED LOCATIONS               PATMAT      82
         SX6   X3                                                       PATMAT      83
         SA1   X1+SIXREL                                                PATMAT      84
         SA6   PIX                 . RESTORE STACK POINTERS             PATMAT      85
         SX3   X1                                                       PATMAT      86
         BX6   X6-X6                                                    PATMAT      87
         SA6   A3                                                       PATMAT      88
         SA6   A1                                                       PATMAT      89
         EQ    PMBUMPR                                                  PATMAT      90
*                                                                       PATMAT      91
ALTLFM   SA1   LENFAIL                                                  PATMAT      92
         BX5   -X1*X5                                                   PATMAT      93
         EQ    ALTLF                                                    PATMAT      94
ALT      MX0   1                   . ALTERNATE WITHOUT LENGTH FAILURE   PATMAT      95
         BX5   -X0*X5                                                   PATMAT      96
ALTLF    SX7   NEXT                . SIGN BIT IN X5 IS ONE IFF ALL      PATMAT      97
         SX1   X5+0                . ALTERNATIVES LENGTH FAILED         PATMAT      98
         PL    X1,SETSIPI                                               PATMAT      99
         MX0   1                                                        PATMAT     100
         BX6   -X5*X0                                                   PATMAT     101
         SA6   LENFAIL                                                  PATMAT     102
         EQ    EXIT                                                     PATMAT     103
*  RETURN ADDRESS IS IN X7                                              PATMAT     104
 SETSIPI SA1   PIB                 . OPEN SUBROUTINE TO RESET S AND P   PATMAT     105
         ZR    X1,ALTLF5           . STACK POINTERS TO THEIR ORIGINAL   PATMAT     106
         SA2   PIX                 . VALUE AS INDICATED IN X5           PATMAT     107
         SB2   X1+0                . THESE STACKS CONSTITUTE TWO LIST   PATMAT     108
         LX5   24                  .  STRUCTURES                        PATMAT     109
         SX1   X5+0                                                     PATMAT     110
         LX5   36                                                       PATMAT     111
ALTLF1   SX0   B0-B2               . RESET STACK P                      PATMAT     112
         IX0   X0+X1                                                    PATMAT     113
         ZR    X0,ALTLF2                                                PATMAT     114
         SA2   X2                                                       PATMAT     115
         SX6   B7                  . LINK FREED WORD TO THE FREE CHAIN  PATMAT     116
         SB7   A2                                                       PATMAT     117
         SA6   A2                                                       PATMAT     118
         SB2   B2-1                . B2 IS THE NUMBER OF WORDS IN       PATMAT     119
         EQ    ALTLF1              . STACK P                            PATMAT     120
ALTLF2   SX6   X1+0                                                     PATMAT     121
         SA6   A1+0                . STORE B2 IN PIB                    PATMAT     122
         SX6   X2+0                                                     PATMAT     123
         SA6   PIX                                                      PATMAT     124
 ALTLF5  LX5   42                  . RESET STACK S                      PATMAT     125
         SX1   X5+0                                                     PATMAT     126
         LX5   18                                                       PATMAT     127
 ALTLF3  SB2   B0-B1               . B1=SIB, X3=SIX                     PATMAT     128
         SB2   X1+B2                                                    PATMAT     129
         EQ    B0,B2,ALTLF4        . BRANCH IF X1=B1                    PATMAT     130
         SA3   X3                                                       PATMAT     131
         SX6   B7                  . AS ABOVE                           PATMAT     132
         SB7   A3                                                       PATMAT     133
         SA6   A3                                                       PATMAT     134
         SB1   B1-1                . B1 IS RESERVED FOR THE NUMBER OF   PATMAT     135
         EQ    ALTLF3              .  WORDS IN STACK S                  PATMAT     136
ALTLF4   SX3   X3                                                       PATMAT     137
         SB2   X7                                                       PATMAT     138
         JP    B2                                                       PATMAT     139
*                                                                       PATMAT     140
 YENDEX  NZ    X1,PMFOUND          . FOUND IF OUTERMOST END             PATMAT     141
         SB4   B4+1                                                     PATMAT     142
         SA2   X3                                                       PATMAT     143
         BX6   X2                                                       PATMAT     144
         AX2   36                                                       PATMAT     145
         SB2   X2                                                       PATMAT     146
         ZR    X2,YENDEX1          . UNLESS ARBNO CALLED                PATMAT     147
         SA1   B4                                                       PATMAT     148
         SX2   A0                                                       PATMAT     149
         DF    X1,YENDEX1          . PERFORM ASSIGNMENTS                PATMAT     150
         RJ    ASSIGNS                                                  PATMAT     151
YENDEX1  SX7   B7                  . REMOVE TOP ELEMENT FROM            PATMAT     152
         SB7   X3                  .  STACK S                           PATMAT     153
         SX3   X6                                                       PATMAT     154
         SA7   B7                                                       PATMAT     155
         AX6   18                                                       PATMAT     156
         SB1   B1-1                . DECREASE SIB                       PATMAT     157
         SA1   X6-1                                                     PATMAT     158
         UX1   X1,B2                                                    PATMAT     159
         SB4   X6                                                       PATMAT     160
         NE    B2,B0,YENDEX2       . IF STAR CALLED                     PATMAT     161
         BX2   X6                  . PERFORM ASSIGNMENTS                PATMAT     162
         AX2   18                                                       PATMAT     163
         SB2   X2                  . UNPACK POS FROM STACK ENTRY        PATMAT     164
         SX2   A0                                                       PATMAT     165
         RJ    ASSIGNS                                                  PATMAT     166
YENDEX2  SX7   B4                  . SAVE WORD FROM STACK S IN X4       PATMAT     167
         BX4   X6                  .                                    PATMAT     168
         SX0   A0                                                       PATMAT     169
         LX7   18                                                       PATMAT     170
         BX7   X0+X7                                                    PATMAT     171
         SB4   X6                                                       PATMAT     172
         RJ    ENTER               . RECURSIVE CALL                     PATMAT     173
         BX6   X4                                                       PATMAT     174
         LX6   18                                                       PATMAT     175
         SA1   B7                                                       PATMAT     176
         BX6   X6+X3               . RESTORE X4 INTO STACK S            PATMAT     177
         NZ    X1,YENDEX3                                               PATMAT     178
         RJ    MORFREE                                                  PATMAT     179
YENDEX3  SA6   B7                                                       PATMAT     180
         SB7   X1                                                       PATMAT     181
         SB1   B1+1                                                     PATMAT     182
         SX3   A6                                                       PATMAT     183
         EQ    EXIT                                                     PATMAT     184
*                                                                       PATMAT     185
YALTER   SX1   X1+B4               . PACK ADDRESS OF ALTERNATIVE        PATMAT     186
         MX0   42                  .  INTO X5                           PATMAT     187
         BX5   X5*X0                                                    PATMAT     188
         BX5   X5+X1                                                    PATMAT     189
YDOL     SB4   B4+1                . NEXT OPERATION                     PATMAT     190
          EQ       NEXT1                                                PATMAT     191
*                                                                       PATMAT     192
YEXP     SX6   B4+1                . BEGIN EXPRESSION                   PATMAT     193
         SB4   X1+B4               . INDEX VALUE TO BE STACKED          PATMAT     194
         SB1   B1+1                . BUMP SIB                           PATMAT     195
         SB2   YEXPR                                                    PATMAT     196
POPS     SA1   B7                  . STACK INDEX AND POS IN STACK S     PATMAT     197
         SX7   A0                  .  (OPEN SUBROUTINE IS USED BY       PATMAT     198
         SX2   X5                  .  YSTAR AS WELL)                    PATMAT     199
         LX7   18                                                       PATMAT     200
         NZ    X1,POPS1                                                 PATMAT     201
         RJ    MORFREE                                                  PATMAT     202
POPS1    PL    X2,POPS2                                                 PATMAT     203
         SX2   B4+0                                                     PATMAT     204
POPS2    BX7   X7+X2                                                    PATMAT     205
         SB7   X1                                                       PATMAT     206
         LX7   18                                                       PATMAT     207
         BX7   X7+X3                                                    PATMAT     208
         SA7   A1                                                       PATMAT     209
         JP    B2                                                       PATMAT     210
YEXPR    SX3   A1                                                       PATMAT     211
         SX7   B4                                                       PATMAT     212
         SX0   A0                  . SET UP CALL TO MATCH THE           PATMAT     213
         LX7   18                  .  EXPRESSION                        PATMAT     214
         SB4   X6                                                       PATMAT     215
         BX7   X7+X0                                                    PATMAT     216
         RJ    ENTER                                                    PATMAT     217
         EQ    ALTLFM                                                   PATMAT     218
*                                                                       PATMAT     219
YARB     SB4   B4+1                . ARB PATTERN ELEMENT                PATMAT     220
         SX4   A0                                                       PATMAT     221
YARB1    SA1   B4                                                       PATMAT     222
         DF    X1,YARB2                                                 PATMAT     223
         SX2   X4                                                       PATMAT     224
         SB2   A0                                                       PATMAT     225
         RJ    ASSIGNS                                                  PATMAT     226
YARB2    SX7   B4                                                       PATMAT     227
         SX0   A0                                                       PATMAT     228
         LX7   18                                                       PATMAT     229
            SA0   X4                                                    PATMAT     230
         BX7   X7+X0                                                    PATMAT     231
         RJ    ENTERA              . TRY TO MATCH THE REST OF THE       PATMAT     232
         SA1   LENFAIL             .  PATTERN                           PATMAT     233
         SB2   X4+0                . EXTEND THE STRING MACHED           PATMAT     234
         SX4   X4+1                                                     PATMAT     235
         LT    B3,B2,ALT           . TOO LONG                           PATMAT     236
         ZR    X1,ALT                                                   PATMAT     237
         SX7   YARB1               . RESET STACKS AND TRY AGAIN         PATMAT     238
         EQ    SETSIPI                                                  PATMAT     239
*                                                                       PATMAT     240
YLEN     SB2   A0-1                . LEN PATTERN ELEMENT                PATMAT     241
         SB4   B4+1                                                     PATMAT     242
         SB2   X1+B2                                                    PATMAT     243
         LT    B3,B2,ALTLF         . TOO LONG                           PATMAT     244
         SA1   B4+0                                                     PATMAT     245
         SX6   B2+1                                                     PATMAT     246
         DF    X1,ENTERX6                                               PATMAT     247
         SX2   X6                                                       PATMAT     248
         SB2   A0                                                       PATMAT     249
         EQ    YTAB1               . GO TRY TO MATCH THE REST           PATMAT     250
*                                                                       PATMAT     251
YPOS     SA2   SBASE               . POS PATTERN ELEMENT                PATMAT     252
         SB4   B4+1                                                     PATMAT     253
YPOS1    SX7   A0-1                                                     PATMAT     254
         IX1   X1+X2               . CORE ADDRESS OF POSITION TO X1     PATMAT     255
         IX1   X1-X7                                                    PATMAT     256
         NG    X1,ALTLF            . POS ALREADY LEFT BEHIND            PATMAT     257
         NZ    X1,ALT              . POS NOT REACHED YET                PATMAT     258
         SA1   B4                                                       PATMAT     259
         SX6   A0                                                       PATMAT     260
         DF    X1,ENTERX6                                               PATMAT     261
         SB2   A0                                                       PATMAT     262
         SX2   A0                                                       PATMAT     263
         EQ    YTAB1               . GO TRY TO MATCH THE REST           PATMAT     264
*                                                                       PATMAT     265
YRPOS    BX1   -X1                 . RPOS PATTERN ELEMENT               PATMAT     266
         SB4   B4+1                                                     PATMAT     267
         SX2   B3                  . TRANSFORM INTO POS                 PATMAT     268
         EQ    YPOS1                                                    PATMAT     269
*                                                                       PATMAT     270
YTAB     SA2   SBASE               . TAB PATTERN ELEMENT                PATMAT     271
         SB4   B4+1                                                     PATMAT     272
YTAB2    IX1   X1+X2                                                    PATMAT     273
         SB2   A0                                                       PATMAT     274
         SX6   X1+1                                                     PATMAT     275
         SB2   B0-B2                                                    PATMAT     276
         SB2   X6+B2                                                    PATMAT     277
         LT    B2,B0,ALTLF         . TAB-STOP IS LEFT ALREADY           PATMAT     278
         SB2   X1                                                       PATMAT     279
         SA1   B4+0                                                     PATMAT     280
         LT    B3,B2,ALTLF                                              PATMAT     281
         DF    X1,ENTERX6                                               PATMAT     282
 YTAB0   SB2   A0                                                       PATMAT     283
         BX2   X6                                                       PATMAT     284
YTAB1    RJ    ASSIGNS             .                                    PATMAT     285
ENTERX6  SX7   B4                  . TRY TO MATCH THE REST              PATMAT     286
         SX1   A0                                                       PATMAT     287
         LX7   18                                                       PATMAT     288
         SA0   X6                                                       PATMAT     289
         BX7   X7+X1                                                    PATMAT     290
         RJ    ENTERA                                                   PATMAT     291
         EQ    ALTLFM              . SEEK ALTERNATE IF MATCH FAILS      PATMAT     292
*                                                                       PATMAT     293
YRTAB    BX1   -X1                 . RTAB PATTERN ELEMENT               PATMAT     294
         SX2   B3                  .  TRANSFORM INTO TAB                PATMAT     295
         SB4   B4+1                                                     PATMAT     296
         EQ    YTAB2                                                    PATMAT     297
*                                                                       PATMAT     298
YREM     SA1   B4+1                . REM PATTERN ELEMENT                PATMAT     299
         SB4   B4+1                                                     PATMAT     300
         SX6   B3+1                                                     PATMAT     301
         DF    X1,ENTERX6          . REST OF THE PATTERN WILL HAVE      PATMAT     302
         SB2   A0                  .  TO MACH THE NULL STRING           PATMAT     303
         BX2   X6                                                       PATMAT     304
         EQ    YTAB1                                                    PATMAT     305
*                                                                       PATMAT     306
YBAL     SB4   B4+1                . BAL PATTERN ELEMENT                PATMAT     307
         SX4   0                                                        PATMAT     308
YBAL1    SX6   1R)                                                      PATMAT     309
         SX7   1R(                                                      PATMAT     310
         SB2   A0                  . NOTE THAT BAL NEVER SIGNALS LENGTH PATMAT     311
         SB2   X4+B2               .  FAILURE                           PATMAT     312
         LT    B3,B2,ALT           . SEEK ALTERNATIVE IF END OF STRING  PATMAT     313
         SA1   B2                                                       PATMAT     314
         BX0   X1-X6                                                    PATMAT     315
         ZR    X0,ALT              . MISMATCH IF NEXT CHARACTER IS )    PATMAT     316
         SX0   0                   . X0 IS THE LEVEL COUNTER            PATMAT     317
YBAL2    SA1   B2                                                       PATMAT     318
         BX2   X1-X7                                                    PATMAT     319
         NZ    X2,YBAL3                                                 PATMAT     320
         SX0   X0+1                . IF ( ADD ONE                       PATMAT     321
         EQ    YBAL4                                                    PATMAT     322
YBAL3    BX2   X1-X6                                                    PATMAT     323
         NZ    X2,YBAL4                                                 PATMAT     324
         SX0   X0-1                . IF ) SUBTRACT ONE                  PATMAT     325
YBAL4    SB2   B2+1                                                     PATMAT     326
         ZR    X0,YBAL5            . LOOP UNTIL IT IS ZERO              PATMAT     327
         LT    B3,B2,ALT                                                PATMAT     328
         EQ    YBAL2                                                    PATMAT     329
YBAL5    SX4   A0                                                       PATMAT     330
         SA1   B4                                                       PATMAT     331
         BX4   -X4                 . NUMBER OF CHARACTERS SCANNED       PATMAT     332
         SX4   X4+B2               .  TO X4                             PATMAT     333
         SX6   B2                                                       PATMAT     334
         DF    X1,YBAL6                                                 PATMAT     335
         BX2   X6                                                       PATMAT     336
         SB2   A0                                                       PATMAT     337
         RJ    ASSIGNS                                                  PATMAT     338
YBAL6    SX1   B4                  . SET UP RECURSIVE CALL              PATMAT     339
         SX7   A0                                                       PATMAT     340
         SA0   X6                                                       PATMAT     341
         LX1   18                                                       PATMAT     342
         BX7   X1+X7                                                    PATMAT     343
         RJ    ENTERA              . TRY TO MATCH THE REST OF THE       PATMAT     344
         SX7   YBAL1               .  PATTERN                           PATMAT     345
         EQ    SETSIPI             . IF FAILS GO TO EXTEND BAL          PATMAT     346
*                                                                       PATMAT     347
YFAIL    SB4   B4+1                . FAIL PATTERN ELEMENT               PATMAT     348
         EQ    ALT                 .  SEEK ALTERNATIVE                  PATMAT     349
*                                                                       PATMAT     350
YFENCE   SB4   B4+1                . FENCE PATTERN ELEMENT              PATMAT     351
         SB2   A0                                                       PATMAT     352
         SX2   A0                                                       PATMAT     353
         RJ    ASSIGNS             . IF THE REST OF THE PATTERN DOES    PATMAT     354
         RJ    ENTERA              .  NOT MACH THEN                     PATMAT     355
*                                                                       PATMAT     356
YABORT   EQ    PMABT               . ABORT THE WHOLE PATTERN MATCH      PATMAT     357
*                                                                       PATMAT     358
YARBNO   SX4   B4                  . ARBNO PATTERN ELEMENT              PATMAT     359
         SB4   X1+B4                                                    PATMAT     360
         SA2   X4+1                                                     PATMAT     361
         SX7   A0                                                       PATMAT     362
         SX6   X2                                                       PATMAT     363
         ZR    X6,ALT              . ALTERNATIVE IF NO HOPE TO MATCH    PATMAT     364
         SX1   X6-MARK                                                  PATMAT     365
         NZ    X1,YARBNO1                                               PATMAT     366
         LX7   18                  . HAS NOT BEEN CALLED YET RECURSI-   PATMAT     367
         BX7   X2+X7               .  VELY - INITIALIZE                 PATMAT     368
         BX2   X7                                                       PATMAT     369
         SA7   A2                                                       PATMAT     370
YARBNO1  SA1   B4                  . MATCH A NULL STRING FIRST          PATMAT     371
         DF    X1,YARBNO2                                               PATMAT     372
         AX2   18                                                       PATMAT     373
         SB2   X2                                                       PATMAT     374
         SX2   A0                                                       PATMAT     375
         RJ    ASSIGNS                                                  PATMAT     376
YARBNO2  SB2   A0-1                                                     PATMAT     377
         SX1   X6-1                                                     PATMAT     378
         SX0   B3-B2                                                    PATMAT     379
         IX7   X1-X0               . SET HOPE TO THE NUMBER OF CHARAC-  PATMAT     380
         SA2   X4+1                .  TERS IN THE REST OF THE STRING    PATMAT     381
         LX4   42                  .  OR HOPE - 1 WHICHEVER IS SMALLER  PATMAT     382
         NG    X7,YARBNO3                                               PATMAT     383
         BX1   X0                                                       PATMAT     384
YARBNO3  MX0   42                                                       PATMAT     385
         BX4   X4+X6                                                    PATMAT     386
         BX7   X0*X2                                                    PATMAT     387
         LX4   18                                                       PATMAT     388
         BX6   X7+X1               . SET UP RECURSIVE CALL              PATMAT     389
         SA6   A2                                                       PATMAT     390
         SX7   B4                                                       PATMAT     391
         SX0   A0                                                       PATMAT     392
         LX7   18                                                       PATMAT     393
         BX7   X7+X0                                                    PATMAT     394
         RJ    ENTERA              . TRY TO MATCH THE REST OF THE       PATMAT     395
                                   .  STRING                            PATMAT     396
         SX7   YARBNO4                                                  PATMAT     397
         EQ    SETSIPI                                                  PATMAT     398
YARBNO4  SA1   B7                                                       PATMAT     399
         SX6   X4                  . IF IT FAILS WE STACK A RETURN      PATMAT     400
         LX6   18                  .  TO THIS ARBNO ELEMENT AND TRY     PATMAT     401
         BX6   X6+X3               .  TO MATCH THE ARGUMENT OF ARBNO    PATMAT     402
         NZ    X1,YARBNO5          .  IF IT MATCHES WE RETURN TO A      PATMAT     403
         RJ    MORFREE             .  NEW INCARNATION OF ARBNO WHICH    PATMAT     404
YARBNO5  SB7   X1                  .  WILL MATCH A NULL STRING FIRST    PATMAT     405
         SX3   A1                  .  ETC.                              PATMAT     406
         SA6   A1                                                       PATMAT     407
         SX7   B4                                                       PATMAT     408
         SB1   B1+1                                                     PATMAT     409
         SX0   A0+0                                                     PATMAT     410
         LX7   18                                                       PATMAT     411
         SB4   X4+2                                                     PATMAT     412
         BX7   X0+X7                                                    PATMAT     413
         RJ    ENTER                                                    PATMAT     414
YARBNO6  SA1   X4+1                . IF ALL THIS FAILS WE RESTORE       PATMAT     415
         MX0   42                  .  THE HOPE AND GO TO SEEK AN        PATMAT     416
         AX4   18                  .  ALTERNATIVE                       PATMAT     417
         BX1   X7*X0                                                    PATMAT     418
         BX7   X1+X4                                                    PATMAT     419
         SA7   A1+0                                                     PATMAT     420
         EQ    ALT                                                      PATMAT     421
*                                                                       PATMAT     422
YSTAR    SA2   X1+0                . DEFERRED EVALUATION (*) OPERATOR   PATMAT     423
         SB4   B4+1                                                     PATMAT     424
YSTAR1   BX7   X2                  . SVD OF ARGUMENT TO X7,X2           PATMAT     425
         AX2   55                                                       PATMAT     426
         SX0   X2-SSTY             . STRING                             PATMAT     427
         ZR    X0,YSTARS                                                PATMAT     428
         SX0   X2-PETY-1           . PATTERN  PS,PA OR PE               PATMAT     429
         NG    X0,YSTARP                                                PATMAT     430
         SX0   X2-INTY             . INPUT ASSOCIATED                   PATMAT     431
         ZR    X0,YSTARIN                                               PATMAT     432
         SX0   X2-OUTTY            . TYPE ERROR IF NOT OUTPUT           PATMAT     433
         NZ    X0,YERR24           . RESET B6 AND PROCESS ERROR         PATMAT     434
         SA2   X7+0                                                     PATMAT     435
         EQ    YSTAR1                                                   PATMAT     436
*                                                                       PATMAT     437
YERR24   SB6   B3+1                                                     PATMAT     438
         JP    ERR24                                                    PATMAT     439
*                                                                       PATMAT     440
YSTARS   SB2   A0                  . TREATMENT OF A STRING IS           PATMAT     441
         SX6   X7                  .  SIMILAR TO THE TREATMENT OF LIT   PATMAT     442
         MX0   54                                                       PATMAT     443
YSTARS1  ZR    X6,YSTARS3          . MATCHES IF END OF STRING           PATMAT     444
         SA1   X6+0                                                     PATMAT     445
         SX6   X1+0                . NEXT WORD TO X1                    PATMAT     446
         BX1   X1-X6                                                    PATMAT     447
YSTAR2   LX1   6                                                        PATMAT     448
         BX4   -X0*X1                                                   PATMAT     449
         ZR    X4,YSTARS1          . NEXT CHARACTER TO X4               PATMAT     450
         LT    B3,B2,ALTLF         . SEEK ALTERNATIVE IF NOT EQUAL      PATMAT     451
         SA2   B2                  .  TO CORRESPONDING CHARACTER IN     PATMAT     452
         SB2   B2+1                                                     PATMAT     453
         BX2   X4-X2               .  THE STRING                        PATMAT     454
         ZR    X2,YSTAR2                                                PATMAT     455
         EQ    ALT                                                      PATMAT     456
YSTARS3  SA1   B4                                                       PATMAT     457
         SX6   B2                                                       PATMAT     458
         DF    X1,ENTERX6                                               PATMAT     459
         BX2   X6                  . TRY TO MACH THE REST OF THE STRING PATMAT     460
         SB2   A0                                                       PATMAT     461
         EQ    YTAB1                                                    PATMAT     462
YSTARIN  BX6   X3                  . IF INPUT ASSOCIATED                PATMAT     463
         SX7   B1                                                       PATMAT     464
         SA6   PMSTX3                                                   PATMAT     465
         SA7   PMSTB1                                                   PATMAT     466
         SX6   B4                  . SAVE REGISTERS                     PATMAT     467
         SX7   A2                                                       PATMAT     468
         SA6   PMSTB4                                                   PATMAT     469
         SA7   PMSTB3                                                   PATMAT     470
         SB3   A2                                                       PATMAT     471
         RJ    INPUT               . CALL INPUT                         PATMAT     472
         SA1   PMSTB1                                                   PATMAT     473
         SA2   PMSTB3                                                   PATMAT     474
         SA3   PMSTX3                                                   PATMAT     475
         SA4   PMSTB4              . RESTORE REGISTERS                  PATMAT     476
         SB1   X1                                                       PATMAT     477
         SB4   X4                                                       PATMAT     478
         SA1   MAXSTAK                                                  PATMAT     479
         SA4   SLENGTH                                                  PATMAT     480
         SB5   X1                                                       PATMAT     481
         SB3   X4                                                       PATMAT     482
         SA1   X2                                                       PATMAT     483
         SB5   B0-B5                                                    PATMAT     484
         EQ    YSTARS              . TREAT THE STRING JUST INPUT        PATMAT     485
*                                                                       PATMAT     486
YSTARP   SA4   PCHAIN              . THE ARGUMENT IS A PATTERN          PATMAT     487
         SB2   A0-1                                                     PATMAT     488
YSTARP1  SA2   X4                                                       PATMAT     489
         SX4   X2                                                       PATMAT     490
         AX2   18                                                       PATMAT     491
         BX2   X2-X1               . FIND IT                            PATMAT     492
         NZ    X2,YSTARP1                                               PATMAT     493
         SX4   A2+1                                                     PATMAT     494
         SX6   A2+2                                                     PATMAT     495
         SA1   X4                                                       PATMAT     496
         LX4   18                                                       PATMAT     497
         ZR    X1,ALT              . SEEK ALTERNATIVE IF NO HOPE TO     PATMAT     498
         BX4   X4+X1               .  MATCH                             PATMAT     499
         SB2   B2-B3                                                    PATMAT     500
         SX7   X1-1                . BUMP SIB IN B1                     PATMAT     501
         SB1   B1+1                . SET HOPE TO THE NUMBER OF CHARAC-  PATMAT     502
         SX0   X7+B2               .  TERS IN THE REST OF THE STRING    PATMAT     503
         NG    X0,YSTARP2          .  OR TO HOPE - 1 WHICHEVER IS       PATMAT     504
         SX7   B0-B2               .  SMALLER                           PATMAT     505
YSTARP2  SB2   YSTARPR                                                  PATMAT     506
         SA7   A1+0                                                     PATMAT     507
         JP    POPS                . STACK RETURN INFORMATION           PATMAT     508
YSTARPR  SX3   A1                  .  (LIKE IN CASE OF EXP)             PATMAT     509
         SX7   B4                                                       PATMAT     510
         SX0   A0                                                       PATMAT     511
         LX7   18                                                       PATMAT     512
         SB4   X6                                                       PATMAT     513
         BX7   X7+X0                                                    PATMAT     514
         RJ    ENTER               . TRY TO MATCH THE PATTERN IN TH     PATMAT     515
         SX7   X4                  .  VARIABLE AND THE REST OF THIS     PATMAT     516
         AX4   18                  .  PATTERN                           PATMAT     517
         SA7   X4+0                                                     PATMAT     518
         EQ    ALTLFM              . SEEK ALTERNATIVE IF IT FAILS       PATMAT     519
*                                                                       PATMAT     520
YLIT     SB2   A0-2                . MATCH A LITERAL                    PATMAT     521
         SX7   B4+1                                                     PATMAT     522
         SB2   X1+B2                                                    PATMAT     523
         SB4   X1+B4                                                    PATMAT     524
         LT    B3,B2,ALTLF         . LITERAL TOO LONG                   PATMAT     525
         SB2   X1-2                                                     PATMAT     526
         SX6   A0+B2                                                    PATMAT     527
         SA4   B4                  . LIT MAY USE X4                     PATMAT     528
         SX6   X6+1                                                     PATMAT     529
         LT    B2,B0,YLIT2                                              PATMAT     530
YLIT1    SA1   A0+B2                                                    PATMAT     531
         SA2   X7+B2                                                    PATMAT     532
         SB2   B2-1                                                     PATMAT     533
         BX1   X1-X2                                                    PATMAT     534
         NZ    X1,ALT              . TRY ALTERNATIVE IF MISMATCH        PATMAT     535
         GE    B2,B0,YLIT1                                              PATMAT     536
YLIT2    DF    X4,ENTERX6                                               PATMAT     537
         SX2   X6                                                       PATMAT     538
         SB2   A0                                                       PATMAT     539
         RJ    ASSIGNS                                                  PATMAT     540
         EQ    ENTERX6                                                  PATMAT     541
*                                                                       PATMAT     542
 YANY    SB2   A0+0                . ANY-PATTERN ELEMENT                PATMAT     543
         SX7   0                   . DO NOT NEGATE BIT TABLE            PATMAT     544
 YANY1   SA2   A0                  . FETCH CHARACTER TO BE MATCHED      PATMAT     545
         SB4   B4+X1                                                    PATMAT     546
         LT    B3,B2,ALTLF         . STRING TOO SHORT                   PATMAT     547
         SA4   B4                                                       PATMAT     548
         LX2   59                                                       PATMAT     549
         SA1   B4-1                . FETCH EVEN OR ODD                  PATMAT     550
         NG    X2,YANY2            . BIT TABLE WORD DEPENDING           PATMAT     551
         SA1   B4-2                . ON THE CHARACTER                   PATMAT     552
 YANY2   SB2   X2                                                       PATMAT     553
         LX1   43                                                       PATMAT     554
         LX1   X1,B2               . SELECT BIT                         PATMAT     555
         BX1   X1-X7               . NEGATE BIT IF NOTANY               PATMAT     556
         PL    X1,ALT                                                   PATMAT     557
         SX6   A0+1                                                     PATMAT     558
         DF    X4,ENTERX6                                               PATMAT     559
         JP    YTAB0                                                    PATMAT     560
*                                                                       PATMAT     561
 YNOTANY SB2   A0                  . NOTANY-PATTERN ELEMENT             PATMAT     562
         MX7   60                  . NEGATE BIT TABLE                   PATMAT     563
         JP    YANY1                                                    PATMAT     564
 YSPAN   SB4   B4+X1               . SPAN PATTERN ELEMENT               PATMAT     565
         BX0   X0-X0               . 0 IN X0 FLAGS SPAN                 PATMAT     566
         JP    YBREAK1                                                  PATMAT     567
*                                                                       PATMAT     568
 YBREAK  SB4   B4+X1               . BREAK PATTERN ELEMENT              PATMAT     569
         MX0   42                  . AVOID -0                           PATMAT     570
         LX0   18                                                       PATMAT     571
 YBREAK1 SA1   B4-1                . FETCH BIT TABLES                   PATMAT     572
         SA4   B4-2                . X4-EVEN, X7-ODD                    PATMAT     573
         SB2   B0                  . COUNT NUMBER OF CHARS              PATMAT     574
         LX1   43                                                       PATMAT     575
         LX4   43                                                       PATMAT     576
         BX7   X1                                                       PATMAT     577
 YBREAK2 SX1   A0+B2                                                    PATMAT     578
         SX2   B3                                                       PATMAT     579
         IX2   X2-X1                                                    PATMAT     580
         SA1   X1                  . FETCH NEXT CHARACTER               PATMAT     581
         SX6   B2                  . SAVE B2 IN X6                      PATMAT     582
         NG    X2,YBREAK4          . END OF STRING REACHED              PATMAT     583
         LX1   59                                                       PATMAT     584
         BX2   X7                  . SELECT BIT TABLE WORD              PATMAT     585
         NG    X1,YBREAK3          . BRANCH IF ODD                      PATMAT     586
         BX2   X4                                                       PATMAT     587
 YBREAK3 SB2   X1+0                                                     PATMAT     588
         LX2   B2,X2               . SELECT BIT                         PATMAT     589
         BX2   X2-X0               . NEGATE IF BREAK                    PATMAT     590
         PL    X2,YBREAK5                                               PATMAT     591
         SB2   X6+1                . EXPAND MATCHED STRING              PATMAT     592
         EQ    YBREAK2                                                  PATMAT     593
 YBREAK4 NG    X0,ALTLF            . BRANCH IF BREAK AND END REACHED    PATMAT     594
 YBREAK5 BX2   X6-X0                                                    PATMAT     595
         SA1   B4                                                       PATMAT     596
         ZR    X2,ALT              . BRANCH IF SPAN AND NONE MATCHED    PATMAT     597
         SX2   A0                  . MATCH X6 CHARACTERS                PATMAT     598
         IX6   X6+X2                                                    PATMAT     599
         DF    X1,ENTERX6                                               PATMAT     600
         SB2   A0                                                       PATMAT     601
         BX2   X6                                                       PATMAT     602
         JP    YTAB1                                                    PATMAT     603
*                                                                       PATMAT     604
EXIT     SX7   EXIT1               . EXIT FROM THE RECURSIVE            PATMAT     605
         EQ    SETSIPI             .  PROCEDURE                         PATMAT     606
EXIT1    SB6   B6-4                . DECREASE STACK                     PATMAT     607
         SA1   B6+3                                                     PATMAT     608
         SA4   B6+1                . RESTORE X4,X5,A0,B4                PATMAT     609
         SA0   X1                                                       PATMAT     610
         AX1   18                                                       PATMAT     611
         SA5   B6+2                                                     PATMAT     612
         SB4   X1+0                                                     PATMAT     613
         JP    B6+4                . AND RETURN  (THE ADDRESSES CELL    PATMAT     614
                                   .  CONTAINS AN EQ JUMP)              PATMAT     615
*        X0,X1,X2,X7,B2                                                 PATMAT     616
*                                                                       PATMAT     617
ASSIGNS  NO                                                             PATMAT     618
+        SX0   -1                                                       PATMAT     619
         SX2   X2-1                . LAST IN STRING TO X2               PATMAT     620
ASGNS1   SX0   X0+1                                                     PATMAT     621
         SA1   X0+B4               . NEXT ASSIGNMENT                    PATMAT     622
         DF    X1,ASSIGNS          . RETURN IF NO MORE ASSIGNMENTS      PATMAT     623
         SX7   B2                                                       PATMAT     624
         NG    X1,ASGNS2           . BRANCH IN INSTANT ($) ASSIGNMENT   PATMAT     625
         SX7   X1                  . VARIABLE ADDRESS TO P STACK        PATMAT     626
         SA1   PIX                                                      PATMAT     627
         LX7   18                                                       PATMAT     628
         BX7   X7+X1                                                    PATMAT     629
         SA1   B7                                                       PATMAT     630
         NZ    X1,ASGNS3                                                PATMAT     631
         RJ    MORFREE                                                  PATMAT     632
ASGNS3   SA7   A1                                                       PATMAT     633
         SB7   X1                                                       PATMAT     634
         BX7   X2                  . PACK LAST AND FIRST IN STRING      PATMAT     635
         SX1   B2                  .  INTO X7                           PATMAT     636
         LX7   18                                                       PATMAT     637
         BX7   X1+X7                                                    PATMAT     638
         SX1   A1                                                       PATMAT     639
         LX7   18                                                       PATMAT     640
         BX7   X7+X1               . X7 TO P STACK                      PATMAT     641
         SA1   B7                                                       PATMAT     642
         NZ    X1,ASGNS4                                                PATMAT     643
         RJ    MORFREE                                                  PATMAT     644
ASGNS4   SA7   A1                                                       PATMAT     645
         SB7   X1+0                                                     PATMAT     646
         SX7   A1                  . CODE TO BUMP P STACK POINTER (PIX) PATMAT     647
         SA1   PIB                 .  AND WORD COUNT (PIB)              PATMAT     648
         SA7   PIX                                                      PATMAT     649
         SX7   X1+2                                                     PATMAT     650
         SA7   A1                                                       PATMAT     651
         EQ    ASGNS1                                                   PATMAT     652
ASGNS2   SA6   PMASX6              . $ TYPE ASSIGNMENT                  PATMAT     653
         SA7   PMASB2                                                   PATMAT     654
         BX7   X0                                                       PATMAT     655
         BX6   X3                                                       PATMAT     656
         SA7   PMASX0              . SAVE REGISTERS                     PATMAT     657
         SX3   X1                                                       PATMAT     658
         BX7   X2                                                       PATMAT     659
         SA6   PMASX3                                                   PATMAT     660
         SA7   PMASX2                                                   PATMAT     661
         BX7   X4                                                       PATMAT     662
         SX6   B1                                                       PATMAT     663
         SA7   PMASX4                                                   PATMAT     664
         SA6   PMASB1                                                   PATMAT     665
         SB3   X2                                                       PATMAT     666
         SX7   B4                                                       PATMAT     667
         SA7   PMASB4              . CONVERT PART OF THE STRING FROM    PATMAT     668
         RJ    STOSFX6             .  FIRST TO LAST INTO SF FORMAT      PATMAT     669
         SA6   TEMPDOL                                                  PATMAT     670
         SB2   TEMPDOL+1                                                PATMAT     671
         SA6   B2                  . MAKE SURE SF TYPE                  PATMAT     672
         RJ    SASSIGN                                                  PATMAT     673
         SA1   SLENGTH                                                  PATMAT     674
         SA2   MAXSTAK                                                  PATMAT     675
         SA3   PMASX0                                                   PATMAT     676
         SA4   PMASX6              . RESTORE REGISTERS                  PATMAT     677
         SB3   X1                                                       PATMAT     678
         SB5   X2                                                       PATMAT     679
         BX0   X3                                                       PATMAT     680
         BX6   X4                                                       PATMAT     681
         SA1   PMASB1                                                   PATMAT     682
         SA2   PMASB4                                                   PATMAT     683
         SA3   PMASX3                                                   PATMAT     684
         SA4   PMASX4                                                   PATMAT     685
         SB1   X1                                                       PATMAT     686
         SB4   X2                                                       PATMAT     687
         SA1   PMASB2                                                   PATMAT     688
         SA2   PMASX2                                                   PATMAT     689
         SB2   X1+0                                                     PATMAT     690
         SB5   B0-B5                                                    PATMAT     691
         EQ    ASGNS1                                                   PATMAT     692
*                                                                       PATMAT     693
         TITLE DEFINITIONS OF PM OPERATIONS                             PATMAT     694
*                                                                       PATMAT     695
PRDPM    EQU   1777B               . NOTE. POSITIVE INDEFINITE          PATMAT     696
DOLPM    EQU   6000B               .  NEGATIVE INDEFINITE               PATMAT     697
*                                                                       PATMAT     698
*                                                                       PATMAT     699
ENDEXPM  EQU   YENDEX-YSTAR+1777B  . NOTE NEGATIVE VALUES               PATMAT     700
ALTPM    EQU   YALTER-YSTAR+1777B                                       PATMAT     701
EXPPM    EQU   YEXP-YSTAR+1777B                                         PATMAT     702
ARBPM    EQU   YARB-YSTAR+1777B                                         PATMAT     703
LENPM    EQU   YLEN-YSTAR+1777B                                         PATMAT     704
POSPM    EQU   YPOS-YSTAR+1777B                                         PATMAT     705
RPOSPM   EQU   YRPOS-YSTAR+1777B                                        PATMAT     706
TABPM    EQU   YTAB-YSTAR+1777B                                         PATMAT     707
RTABPM   EQU   YRTAB-YSTAR+1777B                                        PATMAT     708
REMPM    EQU   YREM-YSTAR+1777B                                         PATMAT     709
BALPM    EQU   YBAL-YSTAR+1777B                                         PATMAT     710
FAILPM   EQU   YFAIL-YSTAR+1777B                                        PATMAT     711
FENCEPM  EQU   YFENCE-YSTAR+1777B                                       PATMAT     712
ABORTPM  EQU   YABORT-YSTAR+1777B                                       PATMAT     713
ARBNOPM  EQU   YARBNO-YSTAR+1777B                                       PATMAT     714
*                                                                       PATMAT     715
STARPM   EQU   YSTAR-YSTAR+2000B   . NOTE ZERO VALUE                    PATMAT     716
*                                                                       PATMAT     717
LITPM    EQU   YLIT-YSTAR+2000B    . NOTE POSITIVE VALUES               PATMAT     718
ANYPM    EQU   YANY-YSTAR+2000B    .  THE ELEMENTS ARE FOLLOWED         PATMAT     719
NTANYPM  EQU   YNOTANY-YSTAR+2000B .  BY A CHARACTER STRING             PATMAT     720
SPANPM   EQU   YSPAN-YSTAR+2000B                                        PATMAT     721
BREAKPM  EQU   YBREAK-YSTAR+2000B                                       PATMAT     722
*                                                                       PATMAT     723
NALTPMP  EQU   -ALTPM+1777B                                             PATMAT     724
*                                                                       PATMAT     725
         END                                                            PATMAT     726