Flabel.sa
Generated by gen_html_sa_files from ICSI. Contact gomes@icsi.berkeley.edu for details
-------------------------> GNU Sather - sourcefile <-------------------------
-- Copyright (C) 2000 by K Hopper, University of Waikato, New Zealand --
-- This file is part of the GNU Sather library. It is free software; you may --
-- redistribute and/or modify it under the terms of the GNU Library General --
-- Public License (LGPL) as published by the Free Software Foundation; --
-- either version 2 of the license, or (at your option) any later version. --
-- This library is distributed in the hope that it will be useful, but --
-- WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See Doc/LGPL for more details. --
-- The license text is also available from: Free Software Foundation, Inc., --
-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --
--------------> Please email comments to <bug-sather@gnu.org> <--------------
immutable class OS_DEVCODE
immutable class OS_DEVCODE is
-- This class is a 'low-level' object which is filled in an OS-dependent
-- manner by the component values returned by the FILE_SYS get_label routine.
-- This version is defined for linux gcc-lib conformance for a 32-bit
-- file system. A second quadbits component will be needed for a 64-bit
-- system.
-- Version 1.1 May 2001. Copyright K Hopper, U of Waikato
-- Development History
-- -------------------
-- Date Who By Detail
-- ---- ------ ------
-- 29 Sep 99 kh Original for Win32 unix version
-- 21 May 01 kh Modifed to conform to FOB style
private attr code_low : QUADBITS ;
create( val : QUADBITS) : SAME is
-- This is a simple creation from the argument given.
return code_low(val)
end ;
code_val : NUM_BITS is
-- This routine returns the code value as a number sized bit-pattern.
return NUM_BITS::create(code_low)
end ;
end ; -- OS_DEVCODE
immutable class OS_IDENT
immutable class OS_IDENT is
-- This class is a 'low-level' object which is filled in an OS-dependent
-- manner by the user/group values returned by the FILE_SYS get_label routine.
-- This version is defined for Win32 unixlib conformance.
-- Version 1.1 May 2001. Copyright K Hopper, U of Waikato
-- Development History
-- -------------------
-- Date Who By Detail
-- ---- ------ ------
-- 29 Sep 99 kh Original for Win32 unix version
-- 21 May 01 kh Modified to conform to FOB style
attr ident : QUADBITS ;
create(val : QUADBITS) : SAME is
-- This returns the operating system code-pattern indicating the given user.
return ident(val)
end ;
create(user : USER) : SAME is
-- This returns the operating system code-pattern indicating the given user.
return ident(QUADBITS::create(user.card))
end ;
create( group : GROUP) : SAME is
-- This returns the operating system code-pattern indicating the given group.
return ident(QUADBITS::create(group.card))
end ;
user : USER is
-- This routine returns the identity of the user corresponding operating system code.
return USER::create(ident.card)
end ;
group : GROUP is
-- This routine returns the identity of the user corresponding operating system code.
return GROUP::create(ident.card)
end ;
end ; -- OS_IDENT
immutable class OS_COUNT
immutable class OS_COUNT is
-- This class is a 'low-level' object which is filled in an OS-dependent
-- manner by the link count returned by the FILE_SYS get_label routine.
-- This version is defined for Win32 unixlib conformance.
-- Version 1.1 May 2001. Copyright K Hopper, U of Waikato
-- Development History
-- -------------------
-- Date Who By Detail
-- ---- ------ ------
-- 29 Sep 99 kh Original for Win32 unix version
-- 21 May 01 kh Revised to conform to FOB style
private attr count : QUADBITS ;
create( val : QUADBITS) : SAME is
-- This creation routine returns the argument as a value of type SAME.
return count(val)
end ;
link_count : CARD is
-- This routine returns the count of links for the file/directory
-- as a numeric value.
return count.card
end ;
end ; -- OS_COUNT
immutable class OS_FSTIME
immutable class OS_FSTIME is
-- This class is a 'low-level' object which is filled in an OS-dependent
-- manner by the time objects returned by the FILE_SYS get_label routine.
-- This version is defined for Win32 unixlib conformance. In this case
-- there is need for a sub-unit 'space' which has no value inserted - it is
-- provided as padding for the structure.
-- Version 1.1 May 2001. Copyright K Hopper, U of Waikato
-- Development History
-- -------------------
-- Date Who By Detail
-- ---- ------ ------
-- 29 Sep 99 kh Original for Win32 unix version
-- 21 May 01 kh Revised to conform to FOB style
attr units : CARD ;
attr sub_units : CARD ;
create(vals : OS_FLABEL, start : CARD) : SAME is
-- This routine takes as many hextets from the label starting at start
-- as are necessary to create a file time value, which is returned.
me : SAME ;
me := me.units(vals[start].card) ;
me := me.sub_units(vals[start + 1].card) ;
return me
end ;
end ; -- OS_FSTIME
class OS_FLABEL < $OPSYS_FILE_LABEL
class OS_FLABEL < $OPSYS_FILE_LABEL is
-- This class is a 'low-level' object which is filled in an OS-dependent
-- manner by the FILE_SYS get_label routine. It must contain at least the
-- following for use by the FILE_LABEL class.
--
-- A device code indicating the file-system involved.
--
-- A file code indicating the number of the fyle as known to the FS
--
-- A modes code which will need to be 'unhatched' for setting access.
--
-- An owner identity code
--
-- A project identity code (which may be void)
--
-- An object size in octets
--
-- Three times which may yield the same date/time stamp --
--
-- 1. The time-stamp when created.
--
-- 2. The time-stamp when last altered.
--
-- 3. The time-stamp when last used.
--
-- Device block-size for the object
--
-- The count of allocated blocks.
-- This version is defined for Posix conformant unix implementations!
-- Reference should be made to Posix specifications for further detail.
-- It is implemented as an arry of hextets togetyher with reading/writing
-- routines for all of the value components. Note that the first two hextets
-- are not used!!
-- Version 1.2 May 2001. Copyright K Hopper, U of Waikato
-- Development History
-- -------------------
-- Date Who By Detail
-- ---- ------ ------
-- 28 Sep 99 kh Original for Win32 cygwin libraries!
-- 11 Feb 00 nn Rework for GNU C-library on Linux
-- 19 May 01 kh Revised in line with FOB introduction
include AREF{QUADBITS} ;
-- The following list of constants is used to identify the particular
-- component(s) of the hextet array used when converting from bit-patterns to
-- model values. Note that the three values commented out will be needed
-- for a 64-bit large file system!
private const p_dev_code, -- 0
p_dev_high, -- 1
p_dummy_1,
p_file_code, -- 3
-- p_file_code_high -- 4*
p_mode_bits, -- 4 5*
p_links, -- 5 6*
p_user, -- 6 7*
p_group, -- 7 8*
p_real_dev_code, -- 8 9*
p_real_dev_high, -- 9 10*
p_dummy_2,
p_file_size, -- 11 12*
-- p_file_size_high -- 13*
p_block_size, -- 12 14*
p_block_count, -- 13 15*
-- p_block_count_high -- 16*
p_access, -- 14 17*
p_access_2,
p_modify, -- 16 19*
p_modify_2,
p_status_change, -- 18 21*
p_status_change_2,
p_dummy_5, p_dummy_6 ;
const Units_per_Second : CARD := 1 ;
-- For NTFS measures in seconds!
--const asize : CARD := p_dummy_6 + 1 ; -- number of quadbits
const asize : CARD := 22 ;
-- to get round asize compiler bug
create : SAME is
return SAME::create(asize)
end ;
device_code : OS_DEVCODE is
-- This routine creates and returns a new value of the given class.
return OS_DEVCODE::create([p_dev_code])
end ;
file_code : NUM_BITS is
-- This routine creates and returns a new value of the given class.
return NUM_BITS::create([p_file_code])
end ;
mode : NUM_BITS is
-- This routine creates and returns a new value of the given class.
return NUM_BITS::create([p_mode_bits])
end ;
mode(new_val : NUM_BITS) is
-- This routine is the writer routine corresponding to the above reader routine.
aset(p_mode_bits,new_val.quad)
end ;
link_cnt : OS_COUNT is
-- This routine creates and returns a new value of the given class.
return OS_COUNT::create([p_links])
end ;
user_id : OS_IDENT is
-- This routine creates and returns a new value of the given class.
return OS_IDENT::create([p_user])
end ;
user_id(new_val : OS_IDENT) is
-- This routine creates and returns a new value of the given class.
aset(p_user,new_val.ident)
end ;
group_id : OS_IDENT is
-- This routine creates and returns a new value of the given class.
return OS_IDENT::create([p_group])
end ;
group_id(new_val : OS_IDENT) is
-- This routine creates and returns a new value of the given class.
aset(p_group,new_val.ident)
end ;
real_device_code : OS_DEVCODE is
-- This routine creates and returns a new value of the given class.
return OS_DEVCODE::create([p_real_dev_code])
end ;
file_size : CARD is
-- This routine creates and returns a new value of the given class.
return [p_file_size].card
end ;
access_time : OS_FSTIME is
-- This routine creates and returns a new value of the given class.
return OS_FSTIME::create(self,p_access)
end ;
access_time(new_val : OS_FSTIME) is
-- This routine sets the array components indicating the modification
-- time to the new value given.
aset(p_access,QUADBITS::create(new_val.units)) ;
aset(p_access_2,QUADBITS::create(new_val.sub_units)) ;
end ;
modify_time : OS_FSTIME is
-- This routine creates and returns a new value of the given class.
return OS_FSTIME::create(self,p_modify)
end ;
modify_time(new_val : OS_FSTIME) is
-- This routine sets the array components indicating the modification
-- time to the new value given.
aset(p_modify,QUADBITS::create(new_val.units)) ;
aset(p_modify_2,QUADBITS::create(new_val.sub_units)) ;
end ;
status_change_time : OS_FSTIME is
-- This routine creates and returns a new value of the given class.
return OS_FSTIME::create(self,p_status_change)
end ;
created_time : OS_FSTIME is
-- This routine returns the file system time at which the file was
-- originally created.
return status_change_time ;
end ;
block_size : CARD is
-- This routine creates and returns a new value of the given class.
return [p_block_size].card
end ;
block_count : CARD is
-- This routine creates and returns a new value of the given class.
return [p_block_count].card
end ;
end ; -- OS_FLABEL