aggpas removed file_util_.pas for lcl

git-svn-id: trunk@21953 -
This commit is contained in:
mattias 2009-10-01 17:14:57 +00:00
parent fdf7bc3def
commit c5887d7016
4 changed files with 62 additions and 843 deletions

1
.gitattributes vendored
View File

@ -301,7 +301,6 @@ components/aggpas/src/pf_rgb565_gamma.inc svneol=native#text/plain
components/aggpas/src/pf_rgb565_pre.inc svneol=native#text/plain components/aggpas/src/pf_rgb565_pre.inc svneol=native#text/plain
components/aggpas/src/pf_rgba32.inc svneol=native#text/plain components/aggpas/src/pf_rgba32.inc svneol=native#text/plain
components/aggpas/src/pf_rgba32_pre.inc svneol=native#text/plain components/aggpas/src/pf_rgba32_pre.inc svneol=native#text/plain
components/aggpas/src/platform/lcl/file_utils_.pas svneol=native#text/plain
components/aggpas/src/platform/linux/agg_linux_mini_libc.pas svneol=native#text/plain components/aggpas/src/platform/linux/agg_linux_mini_libc.pas svneol=native#text/plain
components/aggpas/src/platform/linux/agg_platform_support.pas svneol=native#text/plain components/aggpas/src/platform/linux/agg_platform_support.pas svneol=native#text/plain
components/aggpas/src/platform/linux/file_utils_.pas svneol=native#text/plain components/aggpas/src/platform/linux/file_utils_.pas svneol=native#text/plain

View File

@ -410,7 +410,7 @@ begin
end; end;
{ handleUnknownEncoding {..} { handleUnknownEncoding ..}
function handleUnknownEncoding(parser : XML_Parser; encodingName : XML_Char_ptr ) : XML_Error; function handleUnknownEncoding(parser : XML_Parser; encodingName : XML_Char_ptr ) : XML_Error;
begin begin
end; end;
@ -422,7 +422,7 @@ var
ok : int; ok : int;
begin begin
{$IFDEF XML_UNICODE {..} {$IFDEF XML_UNICODE ..}
{$ELSE } {$ELSE }
@ -442,12 +442,12 @@ begin
end; end;
{ reportDefault {..} { reportDefault ..}
procedure reportDefault(parser : XML_Parser; enc : ENCODING_ptr; start ,end_ : char_ptr ); procedure reportDefault(parser : XML_Parser; enc : ENCODING_ptr; start ,end_ : char_ptr );
begin begin
end; end;
{ getContext {..} { getContext ..}
function getContext(parser : XML_Parser ) : XML_Char_ptr; function getContext(parser : XML_Parser ) : XML_Char_ptr;
begin begin
end; end;

View File

@ -23,7 +23,7 @@
<License Value="Permission to copy, use, modify, sell and distribute this software is granted provided this copyright notice appears in all copies. <License Value="Permission to copy, use, modify, sell and distribute this software is granted provided this copyright notice appears in all copies.
This software is provided &quot;as is&quot; without express or implied warranty, and with no claim as to its suitability for any purpose."/> This software is provided &quot;as is&quot; without express or implied warranty, and with no claim as to its suitability for any purpose."/>
<Version Major="1"/> <Version Major="1"/>
<Files Count="209"> <Files Count="208">
<Item1> <Item1>
<Filename Value="../src/Agg2D.pas"/> <Filename Value="../src/Agg2D.pas"/>
<AddToUsesPkgSection Value="False"/> <AddToUsesPkgSection Value="False"/>
@ -744,146 +744,142 @@ This software is provided &quot;as is&quot; without express or implied warranty,
<Type Value="Include"/> <Type Value="Include"/>
</Item176> </Item176>
<Item177> <Item177>
<Filename Value="../src/platform/lcl/file_utils_.pas"/>
<UnitName Value="file_utils_"/>
</Item177>
<Item178>
<Filename Value="../src/platform/linux/agg_linux_mini_libc.pas"/> <Filename Value="../src/platform/linux/agg_linux_mini_libc.pas"/>
<AddToUsesPkgSection Value="False"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="agg_linux_mini_libc"/> <UnitName Value="agg_linux_mini_libc"/>
</Item178> </Item177>
<Item179> <Item178>
<Filename Value="../src/platform/linux/agg_platform_support.pas"/> <Filename Value="../src/platform/linux/agg_platform_support.pas"/>
<AddToUsesPkgSection Value="False"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="agg_platform_support"/> <UnitName Value="agg_platform_support"/>
</Item179> </Item178>
<Item180> <Item179>
<Filename Value="../src/platform/linux/file_utils_.pas"/> <Filename Value="../src/platform/linux/file_utils_.pas"/>
<AddToUsesPkgSection Value="False"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="file_utils_"/> <UnitName Value="file_utils_"/>
</Item180> </Item179>
<Item181> <Item180>
<Filename Value="../src/platform/mac/agg_mac_pmap.pas"/> <Filename Value="../src/platform/mac/agg_mac_pmap.pas"/>
<AddToUsesPkgSection Value="False"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="agg_mac_pmap"/> <UnitName Value="agg_mac_pmap"/>
</Item181> </Item180>
<Item182> <Item181>
<Filename Value="../src/platform/mac/agg_platform_support.pas"/> <Filename Value="../src/platform/mac/agg_platform_support.pas"/>
<AddToUsesPkgSection Value="False"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="agg_platform_support"/> <UnitName Value="agg_platform_support"/>
</Item182> </Item181>
<Item183> <Item182>
<Filename Value="../src/platform/mac/file_utils_.pas"/> <Filename Value="../src/platform/mac/file_utils_.pas"/>
<AddToUsesPkgSection Value="False"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="file_utils_"/> <UnitName Value="file_utils_"/>
</Item183> </Item182>
<Item184> <Item183>
<Filename Value="../src/platform/win/agg_platform_support.pas"/> <Filename Value="../src/platform/win/agg_platform_support.pas"/>
<AddToUsesPkgSection Value="False"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="agg_platform_support"/> <UnitName Value="agg_platform_support"/>
</Item184> </Item183>
<Item185> <Item184>
<Filename Value="../src/platform/win/agg_win32_bmp.pas"/> <Filename Value="../src/platform/win/agg_win32_bmp.pas"/>
<AddToUsesPkgSection Value="False"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="agg_win32_bmp"/> <UnitName Value="agg_win32_bmp"/>
</Item185> </Item184>
<Item186> <Item185>
<Filename Value="../src/platform/win/file_utils_.pas"/> <Filename Value="../src/platform/win/file_utils_.pas"/>
<AddToUsesPkgSection Value="False"/> <AddToUsesPkgSection Value="False"/>
<UnitName Value="file_utils_"/> <UnitName Value="file_utils_"/>
</Item186> </Item185>
<Item187> <Item186>
<Filename Value="../src/svg/agg_svg_exception.pas"/> <Filename Value="../src/svg/agg_svg_exception.pas"/>
<UnitName Value="agg_svg_exception"/> <UnitName Value="agg_svg_exception"/>
</Item186>
<Item187>
<Filename Value="../src/svg/agg_svg_parser_lcl.pas"/>
<UnitName Value="agg_svg_parser_lcl"/>
</Item187> </Item187>
<Item188> <Item188>
<Filename Value="../src/svg/agg_svg_parser.pas"/>
<UnitName Value="agg_svg_parser"/>
</Item188>
<Item189>
<Filename Value="../src/svg/agg_svg_path_renderer.pas"/> <Filename Value="../src/svg/agg_svg_path_renderer.pas"/>
<UnitName Value="agg_svg_path_renderer"/> <UnitName Value="agg_svg_path_renderer"/>
</Item189> </Item188>
<Item190> <Item189>
<Filename Value="../src/svg/agg_svg_path_tokenizer.pas"/> <Filename Value="../src/svg/agg_svg_path_tokenizer.pas"/>
<UnitName Value="agg_svg_path_tokenizer"/> <UnitName Value="agg_svg_path_tokenizer"/>
</Item190> </Item189>
<Item191> <Item190>
<Filename Value="../src/util/agg_color_conv.pas"/> <Filename Value="../src/util/agg_color_conv.pas"/>
<UnitName Value="agg_color_conv"/> <UnitName Value="agg_color_conv"/>
</Item190>
<Item191>
<Filename Value="../expat-pas/ascii.inc"/>
<Type Value="Include"/>
</Item191> </Item191>
<Item192> <Item192>
<Filename Value="../expat-pas/ascii.inc"/> <Filename Value="../expat-pas/asciitab.inc"/>
<Type Value="Include"/> <Type Value="Include"/>
</Item192> </Item192>
<Item193> <Item193>
<Filename Value="../expat-pas/asciitab.inc"/> <Filename Value="../expat-pas/asciitab_bt_colon_.inc"/>
<Type Value="Include"/> <Type Value="Include"/>
</Item193> </Item193>
<Item194> <Item194>
<Filename Value="../expat-pas/asciitab_bt_colon_.inc"/>
<Type Value="Include"/>
</Item194>
<Item195>
<Filename Value="../expat-pas/expat.pas"/> <Filename Value="../expat-pas/expat.pas"/>
<UnitName Value="expat"/> <UnitName Value="expat"/>
</Item195> </Item194>
<Item196> <Item195>
<Filename Value="../expat-pas/expat_basics.pas"/> <Filename Value="../expat-pas/expat_basics.pas"/>
<UnitName Value="expat_basics"/> <UnitName Value="expat_basics"/>
</Item196> </Item195>
<Item197> <Item196>
<Filename Value="../expat-pas/expat_external.inc"/> <Filename Value="../expat-pas/expat_external.inc"/>
<Type Value="Include"/> <Type Value="Include"/>
</Item197> </Item196>
<Item198> <Item197>
<Filename Value="../expat-pas/expat_external.pas"/> <Filename Value="../expat-pas/expat_external.pas"/>
<UnitName Value="expat_external"/> <UnitName Value="expat_external"/>
</Item197>
<Item198>
<Filename Value="../expat-pas/expat_mode.inc"/>
<Type Value="Include"/>
</Item198> </Item198>
<Item199> <Item199>
<Filename Value="../expat-pas/expat_mode.inc"/> <Filename Value="../expat-pas/iasciitab.inc"/>
<Type Value="Include"/> <Type Value="Include"/>
</Item199> </Item199>
<Item200> <Item200>
<Filename Value="../expat-pas/iasciitab.inc"/> <Filename Value="../expat-pas/iasciitab_bt_colon_.inc"/>
<Type Value="Include"/> <Type Value="Include"/>
</Item200> </Item200>
<Item201> <Item201>
<Filename Value="../expat-pas/iasciitab_bt_colon_.inc"/>
<Type Value="Include"/>
</Item201>
<Item202>
<Filename Value="../expat-pas/readme.txt"/> <Filename Value="../expat-pas/readme.txt"/>
<Type Value="Text"/> <Type Value="Text"/>
</Item201>
<Item202>
<Filename Value="../expat-pas/utf8tab.inc"/>
<Type Value="Include"/>
</Item202> </Item202>
<Item203> <Item203>
<Filename Value="../expat-pas/utf8tab.inc"/> <Filename Value="../expat-pas/winconfig.inc"/>
<Type Value="Include"/> <Type Value="Include"/>
</Item203> </Item203>
<Item204> <Item204>
<Filename Value="../expat-pas/winconfig.inc"/> <Filename Value="../expat-pas/xmlparse.inc"/>
<Type Value="Include"/> <Type Value="Include"/>
</Item204> </Item204>
<Item205> <Item205>
<Filename Value="../expat-pas/xmlparse.inc"/>
<Type Value="Include"/>
</Item205>
<Item206>
<Filename Value="../expat-pas/xmlrole.pas"/> <Filename Value="../expat-pas/xmlrole.pas"/>
<UnitName Value="xmlrole"/> <UnitName Value="xmlrole"/>
</Item206> </Item205>
<Item207> <Item206>
<Filename Value="../expat-pas/xmltok.pas"/> <Filename Value="../expat-pas/xmltok.pas"/>
<UnitName Value="xmltok"/> <UnitName Value="xmltok"/>
</Item207> </Item206>
<Item208> <Item207>
<Filename Value="../expat-pas/xmltok_impl.inc"/> <Filename Value="../expat-pas/xmltok_impl.inc"/>
<Type Value="Include"/> <Type Value="Include"/>
</Item208> </Item207>
<Item209> <Item208>
<Filename Value="../expat-pas/xmltok_ns.inc"/> <Filename Value="../expat-pas/xmltok_ns.inc"/>
<Type Value="Include"/> <Type Value="Include"/>
</Item209> </Item208>
</Files> </Files>
<Type Value="RunAndDesignTime"/> <Type Value="RunAndDesignTime"/>
<RequiredPkgs Count="2"> <RequiredPkgs Count="2">

View File

@ -1,776 +0,0 @@
//
// AggPas 2.4 RM3 demo framework file utility library
// Milan Marusinec alias Milano (c) 2006
//
unit
file_utils_ ;
INTERFACE
{$I agg_mode.inc }
{$I- }
uses
sysutils, FileUtil, agg_basics;
{ TYPES DEFINITION }
type
api_file_ptr = ^api_file;
api_file = record
fileName : shortstring;
isOpened : boolean;
fSize ,
fRead : int;
// FSOpenFork parameters
df : file;
end;
{ GLOBAL PROCEDURES }
function cut_str(s : shortstring ) : shortstring;
function up_str (s : shortstring ) : shortstring;
function cmp_str(s : shortstring ) : shortstring;
function str_dir(s : shortstring ) : shortstring;
function dir_str(s : shortstring ) : shortstring;
function str_disk(fn : shortstring ) : shortstring;
function str_path(fn : shortstring ) : shortstring;
function str_name(fn : shortstring ) : shortstring;
function str_ext (fn : shortstring ) : shortstring;
function fold_name (p ,n ,x : shortstring ) : shortstring;
procedure spread_name(fn : shortstring; var p ,n ,x : shortstring );
function file_exists(fn : shortstring ) : boolean;
function api_open_file (var af : api_file; fname : shortstring ) : boolean;
function api_read_file (var af : api_file; buff : pointer; aloc : int; var read : int ) : boolean;
function api_close_file(var af : api_file ) : boolean;
function param_count : int;
function param_str(i : int ) : shortstring;
IMPLEMENTATION
{ LOCAL VARIABLES & CONSTANTS }
type
tSCAN = (
SCAN_0 ,
SCAN_1 ,SCAN_2 ,SCAN_3 ,SCAN_4 ,SCAN_5 ,SCAN_6 ,SCAN_7 ,SCAN_8 ,SCAN_9 ,
SCAN_A ,SCAN_B ,SCAN_C ,SCAN_D ,SCAN_E ,SCAN_F ,SCAN_G ,SCAN_H ,SCAN_I ,
SCAN_J ,SCAN_K ,SCAN_L ,SCAN_M ,SCAN_N ,SCAN_O ,SCAN_P ,SCAN_Q ,SCAN_R ,
SCAN_S ,SCAN_T ,SCAN_U ,SCAN_V ,SCAN_W ,SCAN_X ,SCAN_Y ,SCAN_Z
);
tITEM = (
ITEM_0 ,
ITEM_1 ,ITEM_2 ,ITEM_3 ,ITEM_4 ,ITEM_5 ,ITEM_6 ,ITEM_7 ,ITEM_8 ,ITEM_9 ,
ITEM_A ,ITEM_B ,ITEM_C ,ITEM_D ,ITEM_E ,ITEM_F ,ITEM_G ,ITEM_H ,ITEM_I ,
ITEM_J ,ITEM_K ,ITEM_L ,ITEM_M ,ITEM_N ,ITEM_O ,ITEM_P ,ITEM_Q ,ITEM_R ,
ITEM_S ,ITEM_T ,ITEM_U ,ITEM_V ,ITEM_W ,ITEM_X ,ITEM_Y ,ITEM_Z
);
const
dir_slash = PathDelim;
pageEqHigh : shortstring =
#1#2#3#4#5#6#7#8#9#10#11#12#13#14#15#16 +
#17#18#19#20#21#22#23#24#25#26#27#28#29#30#31#32 +
#33#34#35#36#37#38#39#40#41#42#43#44#45#46#47#48 +
#49#50#51#52#53#54#55#56#57#58#59#60#61#62#63#64 +
#65#66#67#68#69#70#71#72#73#74#75#76#77#78#79#80 +
#81#82#83#84#85#86#87#88#89#90#91#92#93#94#95#96 +
#65#66#67#68#69#70#71#72#73#74#75#76#77#78#79#80 +
#81#82#83#84#85#86#87#88#89#90#123#124#125#126#127#128 +
#129#130#131#132#133#134#135#136#137#138#139#140#141#142#143#144 +
#145#146#147#148#149#150#151#152#153#154#155#156#157#158#159#160 +
#161#162#163#164#165#166#167#168#169#170#171#172#173#174#175#176 +
#177#178#179#180#181#182#183#184#185#186#187#188#189#190#191#192 +
#193#194#195#196#197#198#199#200#201#202#203#204#205#206#207#208 +
#209#210#211#212#213#214#215#216#217#218#219#220#221#222#223#224 +
#225#226#227#228#229#230#231#232#233#234#235#236#237#238#239#240 +
#241#242#243#244#245#246#247#248#249#250#251#252#253#254#255;
{ UNIT IMPLEMENTATION }
{ CUT_STR }
function cut_str(s : shortstring ) : shortstring;
var
fcb : byte;
scn : tSCAN;
begin
result:='';
scn:=SCAN_1;
if length(s ) > 0 then
for fcb:=length(s ) downto 1 do
case scn of
SCAN_1 :
case s[fcb ] of
' ' :
else
begin
result:=s[fcb ];
scn:=SCAN_2;
end;
end;
SCAN_2 :
result:=s[fcb ] + result;
end;
end;
{ CMP_STR }
function cmp_str(s : shortstring ) : shortstring;
begin
cmp_str:=up_str(cut_str(s ) );
end;
{ UP_STR }
function up_str(s : shortstring ) : shortstring;
var
fcb : byte;
begin
if length(s ) > 0 then
for fcb:=1 to length(s ) do
if byte(s[fcb ] ) > 0 then
s[fcb ]:=pageEqHigh[byte(s[fcb ] ) ];
result:=s;
end;
{ STR_DIR }
function str_dir(s : shortstring ) : shortstring;
begin
s:=cut_str(s );
if length(s ) > 0 then
if s[length(s ) ] <> dir_slash then
s:=s + dir_slash;
result:=s;
end;
{ DIR_STR }
function dir_str(s : shortstring ) : shortstring;
begin
s:=cut_str(s );
if length(s ) > 0 then
if s[length(s ) ] = dir_slash then
dec(byte(s[0 ] ) );
result:=s;
end;
{ STR_DISK }
function str_disk(fn : shortstring ) : shortstring;
var
fcb : byte;
str : shortstring;
itm : tITEM;
begin
str:='';
itm:=ITEM_1;
if length(fn ) > 0 then
for fcb:=1 to length(fn ) do
case itm of
ITEM_1 :
case fn[fcb ] of
'a'..'z' ,'A'..'Z' :
begin
str:=fn[fcb ];
itm:=ITEM_2;
end;
'\' ,'/' :
begin
str:=fn[fcb ];
itm:=ITEM_3;
end;
else
break;
end;
ITEM_2 :
case fn[fcb ] of
':' :
begin
str:=str + fn[fcb ];
itm:=ITEM_F;
break;
end;
else
break;
end;
ITEM_3 :
case fn[fcb ] of
'\' ,'/' :
begin
str:=str + fn[fcb ];
itm:=ITEM_4;
end;
else
break;
end;
ITEM_4 :
case fn[fcb ] of
'\' ,'/' ,':' ,'<' ,'>' ,'.' ,'"' ,'|' ,#0..#31 :
break;
else
begin
str:=str + fn[fcb ];
itm:=ITEM_F;
end;
end;
ITEM_F :
case fn[fcb ] of
'\' ,'/' :
break;
else
str:=str + fn[fcb ];
end;
end;
if itm = ITEM_F then
result:=str
else
result:='';
end;
{ STR_PATH }
function str_path(fn : shortstring ) : shortstring;
var
fcb : byte;
pth ,
str : shortstring;
itm : tITEM;
begin
pth:='';
str:='';
itm:=ITEM_1;
if length(fn ) > 0 then
for fcb:=1 to length(fn ) do
case itm of
ITEM_1 :
case fn[fcb ] of
'\' ,'/' :
begin
str:=fn[fcb ];
itm:=ITEM_2;
end;
else
begin
str:=fn[fcb ];
itm:=ITEM_3;
end;
end;
ITEM_2 :
case fn[fcb ] of
'\' ,'/' :
begin
str:=str + fn[fcb ];
itm:=ITEM_3;
end;
else
begin
pth:=str;
str:=fn[fcb ];
itm:=ITEM_A;
end;
end;
ITEM_3 :
case fn[fcb ] of
'\' ,'/' :
begin
pth:=fn[fcb ];
str:='';
itm:=ITEM_A;
end;
else
str:=str + fn[fcb ];
end;
ITEM_A :
case fn[fcb ] of
'\' ,'/' :
begin
pth:=pth + str + fn[fcb ];
str:='';
end;
else
str:=str + fn[fcb ];
end;
end;
result:=pth;
end;
{ STR_NAME }
function str_name(fn : shortstring ) : shortstring;
var
fcb : byte;
str ,
ext : shortstring;
itm : tITEM;
begin
str:='';
ext:='';
itm:=ITEM_1;
if length(fn ) > 0 then
for fcb:=1 to length(fn ) do
case itm of
ITEM_1 :
case fn[fcb ] of
'\' ,'/' :
itm:=ITEM_2;
'a'..'z' ,'A'..'Z' :
begin
ext:=fn[fcb ];
itm:=ITEM_4;
end;
'.' :
begin
str:='';
ext:=fn[fcb ];
itm:=ITEM_B;
end;
else
begin
str:=fn[fcb ];
itm:=ITEM_A;
end;
end;
ITEM_2 :
case fn[fcb ] of
'\' ,'/' :
itm:=ITEM_3;
'.' :
begin
str:='';
ext:=fn[fcb ];
itm:=ITEM_B;
end;
else
begin
str:=fn[fcb ];
itm:=ITEM_A;
end;
end;
ITEM_3 :
case fn[fcb ] of
'\' ,'/' :
begin
str:='';
itm:=ITEM_A;
end;
end;
ITEM_4 :
case fn[fcb ] of
'\' ,'/' :
begin
str:='';
itm:=ITEM_A;
end;
':' :
itm:=ITEM_5;
'.' :
begin
str:=ext;
ext:=fn[fcb ];
itm:=ITEM_B;
end;
else
begin
str:=ext + fn[fcb ];
ext:='';
itm:=ITEM_A;
end;
end;
ITEM_5 :
case fn[fcb ] of
'\' ,'/' :
begin
str:='';
itm:=ITEM_A;
end;
'.' :
begin
str:='';
ext:=fn[fcb ];
itm:=ITEM_B;
end;
else
begin
str:=fn[fcb ];
itm:=ITEM_A;
end;
end;
ITEM_A :
case fn[fcb ] of
'\' ,'/' :
begin
str:='';
ext:='';
end;
'.' :
begin
ext:=fn[fcb ];
itm:=ITEM_B;
end;
else
str:=str + fn[fcb ];
end;
ITEM_B :
case fn[fcb ] of
'\' ,'/' :
begin
str:='';
ext:='';
itm:=ITEM_A;
end;
'.' :
begin
str:=str + ext;
ext:=fn[fcb ];
end;
end;
end;
result:=str;
end;
{ STR_EXT }
function str_ext(fn : shortstring ) : shortstring;
var
fcb : byte;
ext : shortstring;
itm : tITEM;
begin
ext:='';
itm:=ITEM_1;
if length(fn ) > 0 then
for fcb:=1 to length(fn ) do
case itm of
ITEM_1 :
case fn[fcb ] of
'\' ,'/' :
itm:=ITEM_2;
'.' :
begin
ext:=fn[fcb ];
itm:=ITEM_B;
end;
else
itm:=ITEM_A;
end;
ITEM_2 :
case fn[fcb ] of
'\' ,'/' :
itm:=ITEM_3;
'.' :
begin
ext:=fn[fcb ];
itm:=ITEM_B;
end;
else
itm:=ITEM_A;
end;
ITEM_3 :
case fn[fcb ] of
'\' ,'/' :
itm:=ITEM_A;
end;
ITEM_A :
case fn[fcb ] of
'.' :
begin
ext:=fn[fcb ];
itm:=ITEM_B;
end;
end;
ITEM_B :
case fn[fcb ] of
'\' ,'/' :
begin
ext:='';
itm:=ITEM_A;
end;
'.' :
ext:=fn[fcb ];
else
ext:=ext + fn[fcb ];
end;
end;
result:=cut_str(ext );
if result = '.' then
result:='';
end;
{ FOLD_NAME }
function fold_name(p ,n ,x : shortstring ) : shortstring;
var
dsk ,
nme ,
pth ,
ext : shortstring;
begin
dsk:=str_disk(p );
pth:=str_dir (str_path(p ) );
nme:=str_name(n );
ext:=str_ext (x );
result:=dsk + pth + nme + ext;
end;
{ SPREAD_NAME }
procedure spread_name(fn : shortstring; var p ,n ,x : shortstring );
begin
p:=str_disk(fn ) + str_dir(str_path(fn ) );
n:=str_name(fn );
x:=str_ext (fn );
end;
{ FILE_EXISTS }
function file_exists(fn : shortstring ) : boolean;
var
f : file;
begin
AssignFile(f ,fn );
reset (f );
if IOResult = 0 then
begin
close(f );
result:=true;
end
else
result:=false;
end;
{ API_OPEN_FILE }
function api_open_file(var af : api_file; fname : shortstring ) : boolean;
begin
result:=false;
fillchar(af ,sizeof(api_file ) ,0 );
af.fileName:=fname;
af.isOpened:=false;
IOResult;
AssignFile(af.df ,fname );
reset (af.df ,1 );
if IOResult = 0 then
begin
af.isOpened:=true;
af.fSize:=System.filesize(af.df );
af.fRead:=0;
end;
result:=af.isOpened;
end;
{ API_READ_FILE }
function api_read_file(var af : api_file; buff : pointer; aloc : int; var read : int ) : boolean;
begin
result:=false;
read :=0;
if af.isOpened then
begin
if aloc > af.fSize - af.fRead then
aloc:=af.fSize - af.fRead;
blockread(af.df ,buff^ ,aloc ,read );
if aloc = read then
begin
inc(af.fRead ,read );
result:=true;
end
else
read:=0;
end;
end;
{ API_CLOSE_FILE }
function api_close_file(var af : api_file ) : boolean;
begin
result:=false;
if af.isOpened then
begin
system.close(af.df );
af.isOpened:=false;
result:=true;
end;
end;
{ PARAM_COUNT }
function param_count: int;
begin
result:=ParamCount;
end;
{ PARAM_STR }
function param_str(i : int ) : shortstring;
begin
result:=ParamStr(i );
end;
END.