• Aucun résultat trouvé

! PACK 6 CHARACTERS TO RADIX-50

Dans le document RSTS/E Programming Manual (Page 108-112)

The function FNPO$ returns a 4-character string which is the Radix-50 representation of the first six characters of A$. (Note that no error handling is included and that errors can occur.) The me name string scan call is the only function in BASIC-PLUS which packs a string in Radix-50 format. To pack strings longer than six characters; the user must make multiple calls to the SYS function. Up to 9 characters can be packed in a single call if a period separates 6 characters and 3 characters (the me name and extension format).

The two words in bytes 27 and 28 and in bytes 29 and 30 hold easily accessible flags indicating exactly what fields in the source string were found and what kind of information they contained. For the purposes of the discussion, it is assumed that the returned string was converted by a CHANGE statement to an integer array, Mo/o{30%). The flag words are then created by doing the proper arithmetic operations on the bytes, as shown:

flag word 1: SO% = M%{27%)+SW APo/c{Mo/o{28%)) flag word 2: SI %

=

Mo/o{29%)+SWAPo/o{Mo/o{30%))

Once these two words are created, the information in them is accessible by means of an AND operation between the word and the bit relating to a particular piece of information. Each bit of the PDP-II word can be used to hold a YES or NO answer.

Flag word 1 indicates whether me specification switches were detected in the string passed. Flag word 2 gives information concerning elements found in the file specification. The high byte of flag word 1 is retained for com-patibility with previous versions of RSTS/E.

Table 7-3 File Name String Scan Flag Word 1 Flag Word 1: where SO% = M%(27%)+SW AP%(M%(28%»

Bit Comparison Meaning

0 (SO% AND 1%)

<

> 0% The /CLUSTERSIZE:n switch was specified (SO% AND 1 %) = 0% No /CLUSTERSIZE:n was found

1 (SO% AND 2%) <

>

0% Either the /MODE:n or /RONLY switch was specified (SO% AND 2%) = 0% Neither /MODE:n nor /RONLY was found

2 (SO% AND 4%) <

>

0% Either the /FILESIZE:n or /SIZE:n switch was specified (SO% AND 4%) = 0% Neither the /FILESIZE:n nor /SIZE:n switch was found

3-7 Not used

8 (SO% AND 256%)<>0% A fIlename was found in the source string (and is returned in Radix-50 format in bytes 7 through 10)

(SO% AND 256%) = 0% No ftlename found

9 (SO% AND 512%) <

>

0% A dot was found in source string

(SO% AND 512%) = 0% No dot was found in source string implying that no extension could have been specified either

10 (SO% AND 1024%) < > 0% A project-programmer number was found in source string (SO% AND 1024%) = 0% No project-programmer number was found

11 (SO% AND 2048%) < > 0% A left angle bracket «) was found in source string implying that a protection code was found

(SO% AND 2048%) = 0% No left angle bracket (<) was found (no protection was specified) 12 (SO% AND 4096%) < > 0% A colon (but not necessarily a device name) was found

(SO% AND 4096%) = 0% No colon was found implying that no device could have been specified

13 (SO% AND 8192%) <> 0% Device name was specified and specified device name was a logical device name

(SO% AND 8192%) = 0% Device name (if specified) was an absolute (non-logical) device name (if device name was not specified, this will be 0) 15 SO%<O% Source string contained wild card characters (either? or

*

or

both) in fIlename, extension or project-programmer number fields. In addition, the device name specified, though a valid logical device name, possibly does not correspond to any of the logical device assignments currently in effect. The user program must test bits of flag word 2 for wild card charac-ters and device name found.

7-22

Table 7-4 File Name String Scan Flag Word 2 Flag Word 2: where SI %

=

MO/o(29%)+SW APo/oCMo/o(30%))

Bit Comparison Meaning

0 (SI% AND 1%) < > 0% File name was found in the source string

(SI% AND 1%)

=

0% No me name was found (and the following two comparisons return 0)

1 (SI% AND 2%) < > 0% File name was an * character and is returned in bytes 7 through 10 as the Radix-50 representation of the string

"??????".

(SI % AND 2%)

=

0% File name was not an * character

2 (SI% AND 4%) < > 0% Filename contained at least one? character

(S~% AND 4%)

=

0% Filename did not contain any ? characters 3 (SI% AND 8%) < > 0% A dot (.) was found

(SI % AND 8%)

=

0% No dot was found implying that no extension was specified (and the following three comparisons return 0)

4 (SI%AND 16%)<>0% An extension was found (that is, the field after the dot was not null)

(SI% AND 16%)=0% No extension was found (the field after the dot was null- the following two comparisons return 0)

5 (SI % AND 32%) < > 0% Extension was an * character and is returned in bytes 11 and 12 as the Radix-50 representation of the string "???"

(SI% AND 32%) = 0% Extension was not an * character

6 (SI % AND 64%) < > 0% Extension contained at least one? character (SI% AND 64%)

=

0% Extension did not contain any? characters 7 (SI%AND 128%)<>0% A project-programmer number was found

(SI% AND 128%)

=

0% No project-programmer number was found (the following two comparisons return 0)

81 (SI % AND 256%) < > 0% Project number was an * character (that is the project-programmer number was of the form [* ,PROG]) and is returned in byte 6 as 255

(S 1 % AND 256%)

=

0% Project number was not an * character

91 (SI% AND 512%) < > 0% Programmer number was an * character (that is, the project-programmer number was of the form [PROJ, *1) and is returned in byte 5 as 255

(SI% AND 512%)

=

0% Programmer number was not an * character

Table 7-4 File Name String Scan Flag Word 2 (Cont.)

Bit Comparison Meaning

11 (81 % AND 2048%) <

>

0% The protection code currently set as default by the current job was used

(SI % AND 2048%) = 0% The assignable protection code was not used (protection code given is either the system default, 60, or that found in the source string)

14 (81% AND 16384%)<>0% Device name specified was a logical device name

(81 % AND 16384%) = 0% Device name specified was an actual device name; the following comparison returns 0

15 SI%<O% The device name specified was logical and is not assigned to some actual device; the logical name is returned in bytes 23 through 26 as a Radix-50 string.

81%>= 0% The device name specified, if any, was either an actual device name, or a logical device name to which a physical device has been assigned. The physical device name is returned in bytes 23 and 24 and the unit information is returned in bytes 25 and 26.

Since flag word 2 contains all the information returned in flag word 1 plus more information, it is the more useful of the two words. The following program uses this word. It prints out a list of all the bits returned in the word.

5 DIM M%(30%) -ASSIGN'D PROTECTION USED R

220 IF Sl% AND 4096%

The following examples show some of the above messages:

STRING TO SCAN? ABCDEF.EXT

STRING TO SCAN? SY:FILENM.EXT[1,203J FILENAME FOUND

STRING TO SCAN? SV:FILENM.EXT[2,103J<52) FILENAME FOUND

STRING TO SCAN? SY:FILENM.EXT[*,201J

FILENAME FOUND

Dans le document RSTS/E Programming Manual (Page 108-112)