$PAGE "VALIDDEVTYPE"                                           <<CIPER>>00010000
LOGICAL PROCEDURE VALIDDEVTYPE (LDEV, FUNCTION, FLAGS);        <<CIPER>>00015000
  VALUE LDEV, FUNCTION;                                        <<CIPER>>00020000
                                                               <<CIPER>>00025000
<< Input parameters.                                        >> <<CIPER>>00030000
                                                               <<CIPER>>00035000
  INTEGER                                                      <<CIPER>>00040000
     LDEV,                                                     <<CIPER>>00045000
     FUNCTION;   << Desired ATTACHIO function code.         >> <<CIPER>>00050000
                                                               <<CIPER>>00055000
  LOGICAL                                                      <<CIPER>>00060000
     FLAGS;      << Returns request environment flags.      >> <<CIPER>>00065000
                                                               <<CIPER>>00070000
  OPTION                                                       <<CIPER>>00075000
     PRIVILEGED, UNCALLABLE;                                   <<CIPER>>00080000
                                                               <<CIPER>>00085000
COMMENT --                                                     <<CIPER>>00090000
                                                               <<CIPER>>00095000
Outputs:                                                       <<CIPER>>00100000
  Result:                                                      <<CIPER>>00105000
     TRUE if:                                                  <<CIPER>>00110000
        1.  Device is spooled (LDEV <= 0) and FUNCTION matches <<CIPER>>00115000
            any code in DEV'FLAG'TABLE,        -OR-            <<CIPER>>00120000
        2.  Device is not spooled (hot) and FUNCTION matches a <<CIPER>>00125000
            code in DEV'FLAG'TABLE which is supported  on  the <<CIPER>>00130000
            device type and subtype corresponding to LDEV.     <<CIPER>>00135000
     FALSE otherwise.                                          <<CIPER>>00140000
  FLAGS:  13:1 = 1 if device must be spooled to use this FUNC- <<CIPER>>00145000
                   TION.                                       <<CIPER>>00150000
          14:1 = 1 if device must not be spooled.              <<CIPER>>00155000
          15:1 = 1 if the user process must be privileged.     <<CIPER>>00160000
;                                                              <<CIPER>>00165000
BEGIN COMMENT --                                               <<CIPER>>00170000
  VALIDDEVTYPE is a utility procedure called from  FDEVICECON- <<CIPER>>00175000
TROL (user processes or via PLOADENVironment), CXDOWNLOAD (the <<CIPER>>00180000
:DOWNLOAD console command) or an output spooler (actual print- <<CIPER>>00185000
ing of a spoofle).  It accepts an ATTACHIO control code  (same<<CIPER>>00190000
as the FDEVICECONTROL code) and a logical device number (>0 if <<CIPER>>00195000
it is an actual devicefile, <= 0 if writing to an  open  spool <<CIPER>>00200000
file).  It  returns  a bitmask of required conditions for that <<CIPER>>00205000
code to be used with that device.  Current conditions are:     <<CIPER>>00210000
  1)  The device must be spooled.                              <<CIPER>>00215000
  2)  The device must not be spooled.                          <<CIPER>>00220000
  3)  The user process must be privileged to use this code.    <<CIPER>>00225000
Other conditions may be added as required.                     <<CIPER>>00230000
  For example, all code entries which pertain to a  2680  page <<CIPER>>00235000
printer  will  have the "must be spooled" condition.  The same <<CIPER>>00240000
code entry, if applicable to a 2608S, will not necessarily re- <<CIPER>>00245000
quire that the device be spooled. A code which implies reading <<CIPER>>00250000
device status or environment has the "must not be spooled" re- <<CIPER>>00255000
quirement.  A code which is capable of screwing up the  device <<CIPER>>00260000
or  (say) altering the page count used for logging and billing <<CIPER>>00265000
purposes will be restricted to the privileged user.            <<CIPER>>00270000
$PAGE                                                          <<CIPER>>00275000
  If the device is an open spoofle, we have a  ticklish  prob- <<CIPER>>00280000
lem -- we  can't restrict control codes to a particular device <<CIPER>>00285000
type and subtype if they are supported by any device.  This is <<CIPER>>00290000
because  the ultimate logical device used to print the spoofle <<CIPER>>00295000
is not known when we are called.  Indeed that device  may  not <<CIPER>>00300000
even  exist  on this machine (although its class must or FOPEN <<CIPER>>00305000
will fail).  An example might be generating a spoofle destined <<CIPER>>00310000
for a 2680, complete with environment file, then SPOOKing  the <<CIPER>>00315000
file off to the system that actually has the 2680.  This would <<CIPER>>00320000
be impossible if VALIDDEVTYPE failed because the user  used  a <<CIPER>>00325000
control  code  valid  only for a 2680 on a system which didn't <<CIPER>>00330000
have one.                                                      <<CIPER>>00335000
  To get around this problem, we allow a negative LDEV parame- <<CIPER>>00340000
ter when the device is  actually  spooled.  VALIDDEVTYPE  will <<CIPER>>00345000
then  check  only that the CTRL parameter matches some code in <<CIPER>>00350000
the table.  It will not search further for a device  type/sub- <<CIPER>>00355000
type  match.  This  feature  is a band-aid for user processes, <<CIPER>>00360000
writing to a spoofle, which use an FDEVICECONTROL  code  which <<CIPER>>00365000
is  not  supported by any device or which violates one or more <<CIPER>>00370000
of the FLAGS conditions.  The user is made aware of the  error <<CIPER>>00375000
when  the process runs rather than when examining his/her out- <<CIPER>>00380000
put later.  The lack of type/subtype check imposes the further <<CIPER>>00385000
restriction that all devices supported by a  particular  FUNC- <<CIPER>>00390000
TION  must  have the same setting of the NS and PM fields (see <<CIPER>>00395000
below).  Otherwise VALIDDEVTYPE could behave inconsistently.   <<CIPER>>00400000
  FDEVICECONTROL is also called by PLOADENVironment  when  the <<CIPER>>00405000
user  specifies  an  ENV  parameter  in his/her FOPEN or :FILE <<CIPER>>00410000
equation.  Errors resulting from these calls  are  ignored  by <<CIPER>>00415000
PLOADENV,  whether  the device is hot or spooled.  This allows <<CIPER>>00420000
error-free use of an ENV parameter to devices which don't sup- <<CIPER>>00425000
port environment files.  It would be nice if  FOPEN  supported <<CIPER>>00430000
some kind of warning mechanism for situations like this. Maybe <<CIPER>>00435000
another time.....                                              <<CIPER>>00440000
  Output spoolers ignore FALSE VALIDDEVTYPE  returns  for  the <<CIPER>>00445000
same reason. Note that spoolers, CXDOWNLOAD and FDEVICECONTROL <<CIPER>>00450000
(for hot devices) always call VALIDDEVTYPE with  a  real  (>0) <<CIPER>>00455000
LDEV.  For  them, FUNCTION is fully checked for a valid device <<CIPER>>00460000
type and subtype.                                              <<CIPER>>00465000
  The reason for the separate routine  is  to  keep  the  data <<CIPER>>00470000
structure which associates code, device and environment depen- <<CIPER>>00475000
dencies independent of the routines which use it.  Changes  to <<CIPER>>00480000
the data structure then affect only this routine.  The current <<CIPER>>00485000
implementation is a PB-relative array.  This was done  because <<CIPER>>00490000
of time constraints and will certainly have to change as codes <<CIPER>>00495000
and devices are added.  Otherwise we will run  out  of  direct <<CIPER>>00500000
PB-address space.                                              <<CIPER>>00505000
$PAGE                                                          <<CIPER>>00510000
  The table currently looks like this:                         <<CIPER>>00515000
                                                               <<CIPER>>00520000
  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15               <<CIPER>>00525000
+-----------------------+-----------------------+              <<CIPER>>00530000
|        CODE           | # of device entries   |     0        <<CIPER>>00535000
+-----------------------+-----------+-----------+              <<CIPER>>00540000
|  Hardware type        | Subtype   |//|SP|NS|PM|     1        <<CIPER>>00545000
+-----------------------+-----------+--+--+--+--+              <<CIPER>>00550000
|                       .                       |     .        <<CIPER>>00555000
|                       .                       |     .        <<CIPER>>00560000
+-----------------------+-----------------------+              <<CIPER>>00565000
| CODE = 0 to terminate |           0           |     n        <<CIPER>>00570000
+-----------------------+-----------------------+              <<CIPER>>00575000
                                                               <<CIPER>>00580000
  where  SP = must be spooled                                  <<CIPER>>00585000
         NS = must not be spooled                              <<CIPER>>00590000
         PM = user process must be privileged.                 <<CIPER>>00595000
;                                                              <<CIPER>>00600000
                                                               <<6031>> 00605000
COMMENT --                                                     <<6031>> 00610000
  Change History:  Change #1, made 11/82 by E. Wei             <<6031>> 00615000
                                                               <<6031>> 00620000
WHY:   These modifications were made to accomodate the 6031    <<6031>> 00625000
       enhancements for user-definable terminal types.         <<6031>> 00630000
                                                               <<6031>> 00635000
WHAT:  Control code 192 (%300) for the FDEVICECONTROL intrin-  <<6031>> 00640000
       sic was added, enabling access to current terminal      <<6031>> 00645000
       type information.  Possible types and subtypes for this <<6031>> 00650000
       control code are:  type 16 (terminal), subtypes 0-15,   <<6031>> 00655000
       and type 32 (printer), subtypes 14-15.                  <<6031>> 00660000
       Although type 16 devices are not spoolable, the NS      <<6031>> 00665000
       (must not be spooled) bit has been left unset in its    <<6031>> 00670000
       table entries.  In practice, code executed prior to     <<6031>> 00675000
       calling this procedure will assure that a spooling pro- <<6031>> 00680000
       cess will never exist for a terminal.  This kludge is   <<6031>> 00685000
       for handling the case of an open spoofle (LDEV=-1),     <<6031>> 00690000
       which does not attempt to find a matching type/subtype  <<6031>> 00695000
       for the given control code, to prevent its picking up   <<6031>> 00700000
       a set NS bit in the flag bits accidentally.             <<6031>> 00705000
                                                               <<6031>> 00710000
WHERE: A new set of table entries has been added for code 192. <<6031>> 00715000
       An EQUATE statement for a terminal type (TERM=16) has   <<6031>> 00720000
       also been added.                                        <<6031>> 00725000
                                                               <<06770>>00730000
    Change #2 -- made 4/83 by E. Wei                           <<06770>>00735000
                                                               <<06770>>00740000
WHY:   Modifications for accessing information about NRJE      <<06770>>00745000
       spool files.                                            <<06770>>00750000
                                                               <<06770>>00755000
WHAT:  Control code 193 (%301) was added to FDEVICECONTROL to  <<06770>>00760000
       record NRJE spool file processing information.  The     <<06770>>00765000
       only legal entry for this code is the NRJE pseudo card  <<06770>>00770000
       reader, type 22, subtype 2.                             <<06770>>00775000
                                                               <<06770>>00780000
WHERE: Table entries for code 193, and EQUATE's for READER(=22)<<06770>>00785000
       and NRJE(=2) have been added.                           <<06770>>00790000
;                                                              <<06770>>00795000
EQUATE                                                         <<CIPER>>00800000
   A2608        =  4,   << Hardware subtype of 2608A.       >> <<CIPER>>00805000
   BLANK        =%40,                                          <<CIPER>>00810000
   DEVC'ENTRY   =  1,   << Length of each device entry.     >> <<CIPER>>00815000
   END'OF'TABLE =  0,                                          <<CIPER>>00820000
   EPOC         =  8,   << Hardware subtype of 2680.        >> <<CIPER>>00825000
   KANJI'10     = 10,   << One of three Kanji subtypes.     >> <<CIPER>>00830000
   KANJI'11     = 11,   << One of three Kanji subtypes.     >> <<CIPER>>00835000
   KANJI'12     = 12,   << One of three Kanji subtypes.     >> <<CIPER>>00840000
   TERM         = 16,   << Terminal type  >>                   <<6031>> 00845000
   P2631        =  5,   << Hardware subtype of 2631.        >> <<CIPER>>00850000
   PRINTER      = 32,   << Hardware type of printer.        >> <<CIPER>>00855000
   S2608'FEAT   =  9,   << 2608S subtype w/ feature access. >> <<CIPER>>00860000
   S2608'TRANSP = 13,   << 2608S subtype, transparency mode >> <<CIPER>>00865000
   READER       = 22,   << pseudo card reader type          >> <<06770>>00870000
   NRJE         =  2,   << NRJE pseudo card reader subtype  >> <<06770>>00875000
   NS           =  1,   << "Must not be spooled" bit.       >> <<CIPER>>00880000
   PM           =  1,   << "Caller must be privileged" bit. >> <<CIPER>>00885000
   SP           =  1;   << "Must be spooled" bit.           >> <<CIPER>>00890000
                                                               <<CIPER>>00895000
EQUATE                                                         <<06770>>00900000
   SIZE'OF'GETDEVINFO = 13;  << depends on LDT/LPDT format >>  <<06770>>00905000
                                                               <<06770>>00910000
INTEGER                                                        <<CIPER>>00915000
   CODE'ENTRY,          << First word of current code entry >> <<CIPER>>00920000
   ENTRY'COUNT,         << Loop counter.                    >> <<CIPER>>00925000
   INDEX;               << First word of current device en- >> <<CIPER>>00930000
                        <<   try in current code entry.     >> <<CIPER>>00935000
                                                               <<CIPER>>00940000
BYTE ARRAY                                                     <<CIPER>>00945000
   LDEV'ALPHA (0:9);    << Holds LDEV string  (e.g.,  "11", >> <<CIPER>>00950000
                        << required by GETDEVINFO.          >> <<CIPER>>00955000
                                                               <<CIPER>>00960000
LOGICAL ARRAY                                                  <<CIPER>>00965000
   << GETDEVINFO returns type/subtype >>                       <<06770>>00970000
   DEVINFO (0 : SIZE'OF'GETDEVINFO-1);                         <<06770>>00975000
$PAGE                                                          <<CIPER>>00980000
DEFINE                                                         <<CIPER>>00985000
   CODE              = DEV'FLAG'TABLE (CODE'ENTRY).(0:8)#,     <<CIPER>>00990000
   DEVICE'FLAGS      = DEV'FLAG'TABLE (CODE'ENTRY+INDEX)       <<CIPER>>00995000
                                      .(12:4)#,                <<CIPER>>01000000
   DEVICE'SPOOLED    = LDEV <= 0#,                             <<CIPER>>01005000
   DEV'SUBTYPE       = DEV'FLAG'TABLE (CODE'ENTRY+INDEX)       <<CIPER>>01010000
                                      .(8:4)#,                 <<CIPER>>01015000
   DEV'TYPE          = DEV'FLAG'TABLE (CODE'ENTRY+INDEX)       <<CIPER>>01020000
                                      .(0:8)#,                 <<04359>>01025000
   NUMBER'OF'ENTRIES = INTEGER (DEV'FLAG'TABLE (CODE'ENTRY)    <<CIPER>>01030000
                               .(8:8))#,                       <<CIPER>>01035000
   SUBTYPE           = DEVINFO(3).(12:4)#,                     <<CIPER>>01040000
   TYPE              = DEVINFO(1)#;                            <<CIPER>>01045000
                                                               <<CIPER>>01050000
LOGICAL ARRAY DEV'FLAG'TABLE (0:99) = PB :=                    <<06770>>01055000
                                                               <<CIPER>>01060000
<< Code =  64 = %100:  Download VFC.                        >> <<CIPER>>01065000
  [8/%100, 8/4],                                               <<CIPER>>01070000
  [8/PRINTER, 4/A2608, 1/00, 1/00, 1/00, 1/00],                <<CIPER>>01075000
  [8/PRINTER, 4/P2631, 1/00, 1/00, 1/00, 1/00],                <<CIPER>>01080000
  [8/PRINTER, 4/S2608'FEAT, 1/00, 1/00, 1/00, 1/00],           <<CIPER>>01085000
  [8/PRINTER, 4/S2608'TRANSP, 1/00, 1/00, 1/00, 1/00],         <<CIPER>>01090000
                                                               <<CIPER>>01095000
<< Code =  65 = %101:  Set left margin.                     >> <<CIPER>>01100000
  [8/%101, 8/3],                                               <<CIPER>>01105000
  [8/PRINTER, 4/A2608, 1/00, 1/00, 1/00, 1/00],                <<CIPER>>01110000
  [8/PRINTER, 4/S2608'FEAT, 1/00, 1/00, 1/00, 1/00],           <<CIPER>>01115000
  [8/PRINTER, 4/S2608'TRANSP, 1/00, 1/00, 1/00, 1/00],         <<CIPER>>01120000
                                                               <<CIPER>>01125000
<< Code = 128 = %200:  Select primary/secondary char set.   >> <<CIPER>>01130000
  [8/%200, 8/1],                                               <<CIPER>>01135000
  [8/PRINTER, 4/EPOC,  1/00, 1/SP, 1/00, 1/00],                <<CIPER>>01140000
                                                               <<CIPER>>01145000
<< Code = 129 = %201:  Select logical pages/forms.          >> <<CIPER>>01150000
  [8/%201, 8/1],                                               <<CIPER>>01155000
  [8/PRINTER, 4/EPOC,  1/00, 1/SP, 1/00, 1/00],                <<CIPER>>01160000
                                                               <<CIPER>>01165000
<< Code = 130 = %202:  Move pen relative.                   >> <<CIPER>>01170000
  [8/%202, 8/1],                                               <<CIPER>>01175000
  [8/PRINTER, 4/EPOC,  1/00, 1/SP, 1/00, 1/00],                <<CIPER>>01180000
                                                               <<CIPER>>01185000
<< Code = 131 = %203:  Move pen absolute.                   >> <<CIPER>>01190000
  [8/%203, 8/1],                                               <<CIPER>>01195000
  [8/PRINTER, 4/EPOC,  1/00, 1/SP, 1/00, 1/00],                <<CIPER>>01200000
                                                               <<CIPER>>01205000
<< Code = 132 = %204:  Define job characteristics.          >> <<CIPER>>01210000
  [8/%204, 8/1],                                               <<CIPER>>01215000
  [8/PRINTER, 4/EPOC,  1/00, 1/SP, 1/00, 1/00],                <<CIPER>>01220000
                                                               <<CIPER>>01225000
<< Code = 133 = %205:  Download physical page definition.   >> <<CIPER>>01230000
  [8/%205, 8/1],                                               <<CIPER>>01235000
  [8/PRINTER, 4/EPOC,  1/00, 1/SP, 1/00, 1/00],                <<CIPER>>01240000
                                                               <<CIPER>>01245000
<< Code = 134 = %206:  Download/delete character set.       >> <<CIPER>>01250000
  [8/%206, 8/1],                                               <<CIPER>>01255000
  [8/PRINTER, 4/EPOC,  1/00, 1/SP, 1/00, 1/00],                <<CIPER>>01260000
                                                               <<CIPER>>01265000
<< Code = 135 = %207:  Download/delete forms.               >> <<CIPER>>01270000
  [8/%207, 8/1],                                               <<CIPER>>01275000
  [8/PRINTER, 4/EPOC,  1/00, 1/SP, 1/00, 1/00],                <<CIPER>>01280000
                                                               <<CIPER>>01285000
<< Code = 136 = %210:  Download logical page table.         >> <<CIPER>>01290000
  [8/%210, 8/1],                                               <<CIPER>>01295000
  [8/PRINTER, 4/EPOC,  1/00, 1/SP, 1/00, 1/00],                <<CIPER>>01300000
                                                               <<CIPER>>01305000
<< Code = 137 = %211:  Download multi-copy form overlay tbl >> <<CIPER>>01310000
  [8/%211, 8/1],                                               <<CIPER>>01315000
  [8/PRINTER, 4/EPOC,  1/00, 1/SP, 1/00, 1/00],                <<CIPER>>01320000
                                                               <<CIPER>>01325000
<< Code = 138 = %212:  Download/delete VFC.                 >> <<CIPER>>01330000
  [8/%212, 8/1],                                               <<CIPER>>01335000
  [8/PRINTER, 4/EPOC,  1/00, 1/SP, 1/00, 1/00],                <<CIPER>>01340000
                                                               <<CIPER>>01345000
<< Code = 139 = %213:  Download/delete picture.             >> <<CIPER>>01350000
  [8/%213, 8/1],                                               <<CIPER>>01355000
  [8/PRINTER, 4/EPOC,  1/00, 1/SP, 1/00, 1/00],                <<CIPER>>01360000
                                                               <<CIPER>>01365000
<< Code = 140 = %214:  Page control.                        >> <<CIPER>>01370000
  [8/%214, 8/1],                                               <<CIPER>>01375000
  [8/PRINTER, 4/EPOC,  1/00, 1/SP, 1/00, 1/00],                <<CIPER>>01380000
                                                               <<CIPER>>01385000
<< Code = 141 = %215:  Clear environment.                   >> <<CIPER>>01390000
  [8/%215, 8/1],                                               <<CIPER>>01395000
  [8/PRINTER, 4/EPOC,  1/00, 1/SP, 1/00, 1/00],                <<CIPER>>01400000
                                                               <<CIPER>>01405000
<< Code = 142 = %216:  Job start (requires PM).             >> <<CIPER>>01410000
  [8/%216, 8/1],                                               <<CIPER>>01415000
  [8/PRINTER, 4/EPOC,  1/00, 1/SP, 1/00, 1/PM],                <<CIPER>>01420000
                                                               <<CIPER>>01425000
<< Code = 143 = %217:  Load default environment.            >> <<CIPER>>01430000
  [8/%217, 8/1],                                               <<CIPER>>01435000
  [8/PRINTER, 4/EPOC,  1/00, 1/SP, 1/00, 1/00],                <<CIPER>>01440000
                                                               <<CIPER>>01445000
<< Code = 144 = %220:  Print picture.                       >> <<CIPER>>01450000
  [8/%220, 8/1],                                               <<CIPER>>01455000
  [8/PRINTER, 4/EPOC,  1/00, 1/SP, 1/00, 1/00],                <<CIPER>>01460000
                                                               <<CIPER>>01465000
<< Code = 146 = %222:  Set/clear device extended cap. mode. >> <<CIPER>>01470000
  [8/%222, 8/2],                                               <<CIPER>>01475000
  [8/PRINTER, 4/S2608'FEAT, 1/00, 1/00, 1/00, 1/00],           <<CIPER>>01480000
  [8/PRINTER, 4/S2608'TRANSP, 1/00, 1/00, 1/00, 1/00],         <<CIPER>>01485000
                                                               <<CIPER>>01490000
<< Code = 192 = %300:  Access terminal config file >>          <<6031>> 01495000
  [8/%300, 8/18],                                              <<6031>> 01500000
  [8/TERM, 4/0, 1/00, 1/00, 1/00, 1/00],                       <<6031>> 01505000
  [8/TERM, 4/1, 1/00, 1/00, 1/00, 1/00],                       <<6031>> 01510000
  [8/TERM, 4/2, 1/00, 1/00, 1/00, 1/00],                       <<6031>> 01515000
  [8/TERM, 4/3, 1/00, 1/00, 1/00, 1/00],                       <<6031>> 01520000
  [8/TERM, 4/4, 1/00, 1/00, 1/00, 1/00],                       <<6031>> 01525000
  [8/TERM, 4/5, 1/00, 1/00, 1/00, 1/00],                       <<6031>> 01530000
  [8/TERM, 4/6, 1/00, 1/00, 1/00, 1/00],                       <<6031>> 01535000
  [8/TERM, 4/7, 1/00, 1/00, 1/00, 1/00],                       <<6031>> 01540000
  [8/TERM, 4/8, 1/00, 1/00, 1/00, 1/00],                       <<6031>> 01545000
  [8/TERM, 4/9, 1/00, 1/00, 1/00, 1/00],                       <<6031>> 01550000
  [8/TERM, 4/10, 1/00, 1/00, 1/00, 1/00],                      <<6031>> 01555000
  [8/TERM, 4/11, 1/00, 1/00, 1/00, 1/00],                      <<6031>> 01560000
  [8/TERM, 4/12, 1/00, 1/00, 1/00, 1/00],                      <<6031>> 01565000
  [8/TERM, 4/13, 1/00, 1/00, 1/00, 1/00],                      <<6031>> 01570000
  [8/TERM, 4/14, 1/00, 1/00, 1/00, 1/00],                      <<6031>> 01575000
  [8/TERM, 4/15, 1/00, 1/00, 1/00, 1/00],                      <<6031>> 01580000
  [8/PRINTER, 4/14, 1/00, 1/00, 1/00, 1/00],                   <<6031>> 01585000
  [8/PRINTER, 4/15, 1/00, 1/00, 1/00, 1/00],                   <<6031>> 01590000
                                                               <<6031>> 01595000
<< Code = 193 = %301:  Record NRJE spoolfile information    >> <<06770>>01600000
  [8/%301, 8/1],                                               <<06770>>01605000
  [8/READER, 4/NRJE, 1/00, 1/00, 1/00, 1/00],                  <<06770>>01610000
                                                               <<06770>>01615000
<< Code = 248 = %370:  Kanji function.                      >> <<CIPER>>01620000
  [8/%370, 8/3],                                               <<CIPER>>01625000
  [8/PRINTER, 4/KANJI'10, 1/00, 1/00, 1/00, 1/00],             <<CIPER>>01630000
  [8/PRINTER, 4/KANJI'11, 1/00, 1/00, 1/00, 1/00],             <<CIPER>>01635000
  [8/PRINTER, 4/KANJI'12, 1/00, 1/00, 1/00, 1/00],             <<CIPER>>01640000
                                                               <<CIPER>>01645000
<< Code = 249 = %371:  Kanji function.                      >> <<CIPER>>01650000
  [8/%371, 8/3],                                               <<CIPER>>01655000
  [8/PRINTER, 4/KANJI'10, 1/00, 1/00, 1/00, 1/00],             <<CIPER>>01660000
  [8/PRINTER, 4/KANJI'11, 1/00, 1/00, 1/00, 1/00],             <<CIPER>>01665000
  [8/PRINTER, 4/KANJI'12, 1/00, 1/00, 1/00, 1/00],             <<CIPER>>01670000
                                                               <<CIPER>>01675000
<< Code = 250 = %372:  Kanji function.                      >> <<CIPER>>01680000
  [8/%372, 8/3],                                               <<CIPER>>01685000
  [8/PRINTER, 4/KANJI'10, 1/00, 1/00, 1/00, 1/00],             <<CIPER>>01690000
  [8/PRINTER, 4/KANJI'11, 1/00, 1/00, 1/00, 1/00],             <<CIPER>>01695000
  [8/PRINTER, 4/KANJI'12, 1/00, 1/00, 1/00, 1/00],             <<CIPER>>01700000
                                                               <<CIPER>>01705000
<< Code = 251 = %373:  Kanji function.                      >> <<CIPER>>01710000
  [8/%373, 8/3],                                               <<CIPER>>01715000
  [8/PRINTER, 4/KANJI'10, 1/00, 1/00, 1/00, 1/00],             <<CIPER>>01720000
  [8/PRINTER, 4/KANJI'11, 1/00, 1/00, 1/00, 1/00],             <<CIPER>>01725000
  [8/PRINTER, 4/KANJI'12, 1/00, 1/00, 1/00, 1/00],             <<CIPER>>01730000
                                                               <<CIPER>>01735000
<< Code = 252 = %374:  Kanji function.                      >> <<CIPER>>01740000
  [8/%374, 8/3],                                               <<CIPER>>01745000
  [8/PRINTER, 4/KANJI'10, 1/00, 1/00, 1/00, 1/00],             <<CIPER>>01750000
  [8/PRINTER, 4/KANJI'11, 1/00, 1/00, 1/00, 1/00],             <<CIPER>>01755000
  [8/PRINTER, 4/KANJI'12, 1/00, 1/00, 1/00, 1/00],             <<CIPER>>01760000
                                                               <<CIPER>>01765000
<< Code = 253 = %375:  Kanji function.                      >> <<CIPER>>01770000
  [8/%375, 8/3],                                               <<CIPER>>01775000
  [8/PRINTER, 4/KANJI'10, 1/00, 1/00, 1/00, 1/00],             <<CIPER>>01780000
  [8/PRINTER, 4/KANJI'11, 1/00, 1/00, 1/00, 1/00],             <<CIPER>>01785000
  [8/PRINTER, 4/KANJI'12, 1/00, 1/00, 1/00, 1/00],             <<CIPER>>01790000
                                                               <<CIPER>>01795000
<< Code = 254 = %376:  Kanji function.                      >> <<CIPER>>01800000
  [8/%376, 8/3],                                               <<CIPER>>01805000
  [8/PRINTER, 4/KANJI'10, 1/00, 1/00, 1/00, 1/00],             <<CIPER>>01810000
  [8/PRINTER, 4/KANJI'11, 1/00, 1/00, 1/00, 1/00],             <<CIPER>>01815000
  [8/PRINTER, 4/KANJI'12, 1/00, 1/00, 1/00, 1/00],             <<CIPER>>01820000
                                                               <<CIPER>>01825000
<< Code = 255 = %377:  Kanji function.                      >> <<CIPER>>01830000
  [8/%377, 8/3],                                               <<CIPER>>01835000
  [8/PRINTER, 4/KANJI'10, 1/00, 1/00, 1/00, 1/00],             <<CIPER>>01840000
  [8/PRINTER, 4/KANJI'11, 1/00, 1/00, 1/00, 1/00],             <<CIPER>>01845000
  [8/PRINTER, 4/KANJI'12, 1/00, 1/00, 1/00, 1/00],             <<CIPER>>01850000
                                                               <<CIPER>>01855000
                   0;                  << End of table.     >> <<CIPER>>01860000
$PAGE                                                          <<CIPER>>01865000
<<             VALIDDEVTYPE starts here.                    >> <<CIPER>>01870000
                                                               <<CIPER>>01875000
VALIDDEVTYPE := FALSE;                                         <<CIPER>>01880000
IF NOT LOGICAL (DEVICE'SPOOLED) THEN                           <<CIPER>>01885000
   BEGIN   << Make sure device exists on system.            >> <<CIPER>>01890000
   CHECKLDEV (LDEV);   << Doesn't use or modify DB.         >> <<CIPER>>01895000
   IF < THEN RETURN;   << Device doesn't exist.             >> <<CIPER>>01900000
   LDEV'ALPHA (ASCII (LDEV, 10, LDEV'ALPHA)) := BLANK;         <<CIPER>>01905000
   IF GETDEVINFO (LDEV'ALPHA, DEVINFO) <> 0 THEN RETURN;       <<CIPER>>01910000
   END;   << Make sure device exists on system.             >> <<CIPER>>01915000
CODE'ENTRY := 0;   << Set to first entry in table.          >> <<CIPER>>01920000
WHILE CODE <> END'OF'TABLE DO                                  <<CIPER>>01925000
   IF INTEGER (CODE) = FUNCTION                                <<CIPER>>01930000
      THEN       << Search all entries for this code.       >> <<CIPER>>01935000
         BEGIN   << ...unless device is spooled.            >> <<CIPER>>01940000
         ENTRY'COUNT := INDEX := 1;                            <<CIPER>>01945000
         DO IF DEVICE'SPOOLED                                  <<CIPER>>01950000
               OR DEV'TYPE = TYPE AND DEV'SUBTYPE = SUBTYPE    <<CIPER>>01955000
               THEN                                            <<CIPER>>01960000
                  BEGIN   << Found our entry.               >> <<CIPER>>01965000
                  FLAGS := DEVICE'FLAGS;                       <<CIPER>>01970000
                  VALIDDEVTYPE := TRUE;                        <<CIPER>>01975000
                  RETURN;   << This is normal exit.         >> <<CIPER>>01980000
                  END     << Found our entry.               >> <<CIPER>>01985000
               ELSE                                            <<CIPER>>01990000
                  INDEX := INDEX + DEVC'ENTRY                  <<CIPER>>01995000
          UNTIL (ENTRY'COUNT := ENTRY'COUNT + 1) >             <<CIPER>>02000000
                NUMBER'OF'ENTRIES;                             <<CIPER>>02005000
                                                               <<CIPER>>02010000
<< Error if we're here, code is undefined for this  device. >> <<CIPER>>02015000
                                                               <<04359>>02020000
         RETURN; << Error exit -- no type/subtype match.    >> <<04359>>02025000
         END     << Search all entries for this code.       >> <<CIPER>>02030000
      ELSE       << No code match yet.                      >> <<CIPER>>02035000
         CODE'ENTRY := CODE'ENTRY +                            <<CIPER>>02040000
                       DEVC'ENTRY * NUMBER'OF'ENTRIES + 1;     <<CIPER>>02045000
                                                               <<CIPER>>02050000
<< If we're here,  either  the  FUNCTION  parameter  hasn't >> <<CIPER>>02055000
<< matched  any  code in the table, or FUNCTION is not sup- >> <<CIPER>>02060000
<< ported on LDEV's type and subtype.                       >> <<CIPER>>02065000
                                                               <<CIPER>>02070000
END;   << of VALIDDEVTYPE.                                  >> <<CIPER>>02075000
