; ; ; FILEID ; ; FILEID - RETURNS INFORMATION ABOUT DATABASE FILE STRUCTURES ; ; ROUTINE NAME: FILEID ; ; PURPOSE: To return all the information about a database ; file that was initalized by BLDHDR. ; ; CALLABLE: From FORTRAN only: ; CALL FILEID(ROOT,NLV[,LEVTAB][,DATYPE][,VERSION]) ; ; PARAMETERS: ; ROOT The database root block and I/O buffers. ; NLV The number of levels in the structure. ; LEVTAB A table which describes each level of the struc- ; ture. LEVTAB must be dimentioned to (3,NLV) or ; greater. (If you do not know how big NLV is be- ; forehand, you had better make extra room). The ; values returned for each level are: ; LEVTAB(1,N) The total size in bytes of a key at the ; Nth level of the structure. ; LEVTAB(2,N) The size of the scan section of a key at ; the N'th level of the structure. ; LEVTAB(3,N) The type of data stored in the data sec- ; tion in the N'th level, where 0=NONE, 1=INTEGER, ; 2=REAL, and 3=ASCII. These data types may be ORed ; in any combination. ; DATYPE The data type word for this file. The data type ; is any 16-bit bit pattern which is used to identi- ; fy the type of the file. Some programs, like FI- ; LEDIT will perform differently for different data ; types. Many programs will only work when they re- ; cognize the correct value in this word. ; VERSION The database routines version number. This number ; currently returns an integer value of 3. If ; changes are ever made in the way that the database ; primatives store data, this word will change to ; indicate a "new" type of database file. ; ; ROUTINES USED: None. ; ; EXAMPLE: ; CALL FILEID(ROOT,N) ; CALL FILEID(ROOT,N,,TYPE) ; ; AUTHOR: Mike Higgins ; ; SOURCE LANGUAGE: MACRO11 with SUPERMAC ; ; OBJECT MODULE NAME: FILEID ; ; LIBRARY: [60,100]DATABASE ; ; MAINTENANCE: See Mike Higgins ; ; ;REGESTERS TEM=R0 TEM1=R1 LEVEL=R2 LVD=R3 ROOT=R4 ; PARAMETERS RT=2 NLV=4 LEVTAB=6 DATYPE=10 VERSION=12 .MCALL SUPER SUPER PROCEDURE FILEID ;(ROOT,NLV[,LEVTAB][,DATYPE][,VERSION]) LET ROOT := RT(R5) ;GET THE ROOT BLOCK POINTER FORET RT.NLV(ROOT),NLV ;RETURN THE NUMBER OF LEVELS LET LEVEL := ROOT + #LV.1ST+LV.SIZE ;GET A POINTER TO THE FIRST LEVEL TABLE IF (R5) GE #LEVTAB/2 ;IS THERE A LEVEL TABLE PARAMETER? LET LVD := LEVTAB(R5) ;YES, GET IT'S ADDRESS IF LVD NE #-1 ;MAKE SURE IT IS NOT NULL THRU TEM ;LOOP FOR ALL LEVELS ;GET THE TOTAL SIZE OF A KEY LET (LVD)+ := LV.LEN(LEVEL) ;GET THE SCAN SIZE LET (LVD)+ := LV.SCN(LEVEL) ;GET THE DATA SECTION TYPE BITS LET TEM1 := LV.FLG(LEVEL) OFF.BY #^C LET (LVD)+ := TEM1 ;AND SEND THEM ALONG LET LEVEL := . + #LV.SIZE ;SKIP TO THE NEXT TABLE END END IF (R5) GE #DATYPE/2 ;IS THERE A DATYPE PARAMETER? IF DATYPE(R5) NE #-1 ;YES, MAKE SURE IT'S NOT NULL ;GET THE DATA FILE TYPE LET @DATYPE(R5) := RT.DTY(ROOT) END IF (R5) GE #VERSION/2 ;IS THERE A VERSION PARAMETER? ;YES, MAKE SURE IT'S NOT NULL IF VERSION(R5) NE #-1 ;RETURN THE VERSION NUMBER LET @VERSION(R5) := RT.VER(ROOT) END END END END ENDPROCEDURE FILEID .END