• Aucun résultat trouvé

File Management Units

Dans le document USERS' MANUAL SUPPLEMENT (Page 36-39)

The file management units may be used by Pascal programs to perform several of the tasks normally done by the filer. There are four units:

DIR.INFO.CODE WILD.COOE FILE.INFO.CODE SYS.INFO.COOE

DIR.INFO provides directory information and may be used to list directories; parse file names into volume 10, file name, file type, and size specifications; change file names; change the date associated with a file or volume; remove files; grant exclusive access rights to a directory by task; release those access rights.

WILD provides wild card string matching facilities.

FILE.INFO allows the programmer to determine if files are opened, find the length of a file, determine what device contains a given file, find the volume 10 that contains a file, extract the file title (with suffix) from a file name, find the starting block of a file, determine if a file is blocked or not, and retum a file date.

SYS.INFO allows the user to determine the volume name and title of the work code file, the file ti tIe of the work text file, the unit number of the device containing the system (*) volume, and the volume name of the system (*) volume.

S YS .INFO allows the user to determine and change the system (*) volume and the system date.

11-24

11.3.6.1 Directory Information (DIR.INFO)

Users' Manual Supplement, Version IV New and Upgraded Standard Facilities

Many applications require programs to access and modify directory information.

This uni t makes most directory operations easy to perform. There are other ways in which this might be done. The most common solution is to construct user programs that directly access the operating system's data structures. A better solution is to construct UCSD p-System Units that provide routines for accessing directory in formation in a can trolled manner. The interfaces provided by well-designed units make directory information access much safer and easier.

This section describes a directory information unit (named DIR_INFO) which provides user programs with access to file system information.

The directory information unit provides the following capabilities:

Directory Information Access. For anyon-line disk unit, DIR INFO returns the volume name, volume date, number of disk files on volume, amount of unused space, and attributes of individual disk files.

Directory Man ipulation. DIR INFO provides routines for changing the date or name of a disk file or volu-me, removing files from a volume, and taking volumes off-line.

Wild Cards. DIR INFO uses the UNIT WILD, which provides a wild card conven tion for pattern matching of string variables. Most DIR INFO routines recognize the wild card convention in their file name arguments.

Error Handling. DIR_INFO defines a standard error result (similar to UCSD p-System I/O results) for routines involved with file names and directory searches.

Multi-tasking Support. DIR _INFO provides routines for protecting file system information from contention between concurrent tasks. These routines ensure that only one task can modify file system information at a time.

11.3.6.1.1 Notation and Terminology

A variant of Extended Backus-Naur Form (EBNF) is used as a notation for describing the form of wild cards and file names. Meta-words are words that represent a class of words; they are shown in the text by the use of angle brackets < >. Thus, the words trout, salmon, and tuna are acceptable substitutions for the meta-word <fish>. The following expression is an example of the the substitution.

<fish>

=

trout

I

salmon

I

tuna

II-25

New and Upgraded Standard Facilities

The equal sign indicates that the meta-word on the left side can be substituted with the word on the right side. The bar (I) separates possible choices for substitution. The preceding example indicates that trout, salmon, or tuna can be substi tuted for < fish>.

An item enclosed in square brackets [ ] may be substituted into a textual expression. For example, [micro]computer can represent the text strings computer and microcomputer.

An item enclosed in braces { } can be substituted zero or more times into a textual expression. The following expression represents responses to jokes possessing varying degrees of humor.

<joke-response>

=

{hal

Literal occurrences of characters or strings of characters are delimited by quotes to avoid confusing them with notational definitions

F or example: left-bracket

=

n<"

I "" I 'tr'

The terminology used in describing the file system is defined in the Users Manual, Version IV.O. The term <file-object> is used throughout this document; it is a gen eric term encompassing serial and disk volumes, disk files, and unused areas of disk volumes.

11.3.6.1.2 Wild Cards

Most DIR INFO routines allow <wild cards> in their file name arguments. A description of wild card facilities and operation is given in the WILD UNIT definition.

II-26

Users' Manual Supplement, Version IV New and Upgraded Standard Facilities

".3.6.1.3 File Name Arguments

Most OIR INFO routines accept file name arguments. The file name specifies the volume and/or file to be accessed by the routine. See the Users Manual, Version IV.O for a complete description of UCSO p-System files and file names.

File name syntax:

<file-name> :

<volume-IO> :

<file-IO> :

<specifier> :

[volume-IO] (file-IO]

[ "II" uni t-number

":"1

volume-name n:

"I

":" I ''*

n

I ''*: " ]

[ti tIe suffix specifier]

'p'number',]"

I 'P'*',]"

Volume names and file titles may contain wild cards. Unit numbers and colons separating volume IDs and file IDs must appear literally; they must be independent of any wild card.

All OIR INFO routines except 0 Scan Title ignore file length specifiers. File name conven tions in DIR INFO differ slightly from UCSO p-System file name conventions in some cases:

OIR INFO considers an empty file name argument to specify the prefix volume;

i.e.,- < file-I 0> is empty (implying a volume reference), and <volume-ID> is empty (implying the prefixed volume). An empty string is not a valid file name in the p-System.

OIR INFO in terprets wild card file names of the form <vol-name>:: to be valid volume specifiers. This is consistent with OIR INFO's definition of the n=" wild card, but inconsistent with the UCSD p-System Filer's interpretation of the n:"

wild card; the filer does not accept file names of this form as volume specifiers.

Dans le document USERS' MANUAL SUPPLEMENT (Page 36-39)

Documents relatifs