text
stringlengths
0
234
or else C = '%'
or else C = '&'
or else C = '''
or else C = '('
or else C = ')'
or else C = '-'
or else C = '@'
or else C = '^'
or else C = '_'
or else C = '`'
or else C = '{'
or else C = '}'
or else C = '~');
Block_Off : Natural;
Status : Status_Code;
DEntry : FAT_Node;
SName : Short_Name := (others => ' ');
SExt : Extension := (others => ' ');
Index : Entry_Index;
-- Retrieve the number of VFAT entries that are needed, plus one for
-- the regular FAT entry.
N_Entries : Natural := Get_Num_VFAT_Entries (Name) + 1;
Bytes : Entry_Data;
procedure To_Short_Name
(Name : FAT_Name;
SName : out Short_Name;
Ext : out Extension);
-- Translates a long name into short 8.3 name
-- If the long name is mixed or lower case. then 8.3 will be uppercased
-- If the long name contains characters not allowed in an 8.3 name, then
-- the name is stripped of invalid characters such as space and extra
-- periods. Other unknown characters are changed to underscores.
-- The stripped name is then truncated, followed by a ~1. Inc_SName
-- below will increase the digit number in case there's overloaded 8.3
-- names.
-- If the long name is longer than 8.3, then ~1 suffix will also be
-- used.
function To_Upper (C : Character) return Character is
(if C in 'a' .. 'z'
then Character'Val
(Character'Pos (C) + Character'Pos ('A') - Character'Pos ('a'))
else C);
function Value (S : String) return Natural;
-- For a positive int represented in S, returns its value
procedure Inc_SName (SName : in out String);
-- Increment the suffix of the short FAT name
-- e.g.:
-- ABCDEFGH => ABCDEF~1
-- ABC => ABC~1
-- ABC~9 => ABC~10
-- ABCDEF~9 => ABCDE~10
procedure To_WString
(S : FAT_Name;
Idx : in out Natural;
WS : in out Wide_String);
-- Dumps S (Idx .. Idx + WS'Length - 1) into WS and increments Idx
-----------
-- Value --
-----------
function Value (S : String) return Natural
is
Val : constant String := Trim (S);
Digit : Natural;
Ret : Natural := 0;
begin
for J in Val'Range loop
Digit := Character'Pos (Val (J)) - Character'Pos ('0');
Ret := Ret * 10 + Digit;
end loop;
return Ret;
end Value;
-------------------
-- To_Short_Name --
-------------------
procedure To_Short_Name
(Name : FAT_Name;
SName : out Short_Name;
Ext : out Extension)
is
S_Idx : Natural := 0;
Add_Tilde : Boolean := False;
Last : Natural := Name.Len;
begin
-- Copy the file extension
Ext := (others => ' ');