Source of S#PDADDR
%RECORD %FORMAT connect fm(%INTEGER start address, %C
type, %C
relative start, %C
relative finish)
)
%SYSTEM %ROUTINE %SPEC CONNECT(%STRING(31) file, %C
%INTEGER mode, %C
hole, %C
protection, %C
%RECORD (connect fm) %NAME info, %C
%INTEGER %NAME flag)
%RECORD %FORMAT header fm(%INTEGER relative finish, %C
relative start, %C
size, %C
type, %C
sum, date time, %C
directory start, %C
count)
%RECORD %FORMAT entry fm(%INTEGER relative start, %C
%STRING(11) name, %C
%INTEGER hole, %C
%INTEGER Spare5, Spare6, link)
%CONST %INTEGER SS pd file type = 6
%SYSTEM %INTEGER %FN pd addr(%STRING(255) file)
( S# pd addr
%SYSTEM %INTEGER %FN pd addr(%STRING(255) file)
Returns the connect address of 'file'. (connects if neccessary)
The file may be of any type, and pdfile members, and sub-sub- members
may be given.
result < 0 gives the system subsystem error number (negated)
result = 0 if the master file existed, but some subfile lookup failed
result > 0 when the file is found. (Result = connect address)
)
%INTEGER %FN pd(%INTEGER start address, %STRING(255)file)
%INTEGER directory start address, subfile start, next
%STRING(255) member
%RECORD (header fm) %NAME pd file
%RECORD (entry fm) %NAME sub file
%CONST %INTEGER entry length = 32
%CYCLE
pd file == RECORD(start address)
%RESULT = 0 %IF pd file_type#SS pd file type
member = "" %UNLESS file->file.("_").member
%RESULT = 0 %IF pd file_count=0 %AND member#""
directory start address = start address + pd file_directory start
%CYCLE next = %C
directory start address, %C
entry length, %C
directory start address+((pd file_count-1)*entry length)
sub file == RECORD(next)
%IF sub file_name=file %START
subfile start = start address+subfile_relative start
%RESULT = subfile start %IF member=""
! The following parameter exchange is in place
! of the recursive call %RESULT = pd(subfile start, member)
start address = subfile start
file = member
%FINISH
%REPEAT
%RESULT = 0 %IF member=""
%REPEAT
%END
%INTEGER flag
%STRING(255) member
%RECORD (connect fm) info
member = "" %UNLESS file->file.("_").member
CONNECT(file, 0, 0, 0, info, flag)
%RESULT = -flag %IF flag#0
%RESULT = info_start address %IF member=""
%RESULT = 0 %IF info_type#SS pd file type
%RESULT = pd(info_start address, member)
%END
%END %OF %FILE