15 byval txt
as zstring ptr _
30 byval token
as integer _
45 byval value
as uinteger _
46 )
as zstring ptr static
48 static as zstring * 8 + 1 res
50 dim as integer lgt, maxlen
52 static as integer hexTB(0
to 15) = _
54 asc(
"0" ),
asc(
"1" ),
asc(
"2" ),
asc(
"3" ), _
55 asc(
"4" ),
asc(
"5" ),
asc(
"6" ),
asc(
"7" ), _
56 asc(
"8" ),
asc(
"9" ),
asc(
"A" ),
asc(
"B" ), _
57 asc(
"C" ),
asc(
"D" ),
asc(
"E" ),
asc(
"F" ) _
61 if( value > 65535 )
then
69 *p = hexTB( value
and &h0000000F )
72 if( lgt = maxlen )
then
86 byval value
as double, _
87 byval dtype
as integer _
92 if( typeGet( dtype ) = FB_DATATYPE_DOUBLE )
then
93 function =
"0x" +
hex( *
cptr(
ulongint ptr, @value ), 16 )
95 dim as single singlevalue = value
98 function =
"0x" +
hex(
cuint( *
cptr(
ulong ptr, @singlevalue ) ), 8 )
105 byval tk
as integer _
108 dim as integer op =
any
110 select case as const tk
142 if(
open( *
filename,
for input,
as #f ) = 0 )
then
154 byval src
as const zstring ptr, _
155 byval dst
as zstring ptr _
159 dim as const zstring ptr s
189 byval src
as zstring ptr _
197 select case as const *p
201 case CHAR_AUPP
to CHAR_ZUPP, CHAR_ALOW
to CHAR_ZLOW, CHAR_0
to CHAR_9, CHAR_UNDER
243 dim as integer lp, p_found, p(1
to 2)
247 p(1) =
instr( lp+1, *
filename, RSLASH )
248 p(2) =
instr( lp+1, *
filename,
"/" )
249 if p(1)=0
or (p(2)>0
and p(2)<p(1))
then
254 if( p_found = 0 )
then
274 dim as integer lp, p_found, p(1
to 2)
278 p(1) =
instr( lp+1, *
filename, RSLASH )
279 p(2) =
instr( lp+1, *
filename,
"/" )
280 if p(1)=0
or (p(2)>0
and p(2)<p(1))
then
285 if( p_found = 0 )
then
302 byval fname
as zstring ptr _
310 p =
instr( lp+1, *fname,
"." )
320 res =
lcase(
mid( *fname, lp+1 ) )
321 if instr( res, RSLASH ) > 0
or instr( res,
"/" ) > 0
then
324 elseif(
len(res) > 0 )
then
326 if( res[0] =
asc( RSLASH )
or res[0] =
asc(
"/" ) )
then
337 for i
as integer = 0
to len( *s ) - 1
338 if( (s[i] = CHAR_RSLASH)
or (s[i] = CHAR_SLASH) )
then
345 dim as integer length =
len( path )
346 if( length > 0 )
then
348 select case( path[length] )
349 #if defined(
__FB_WIN32__ )
or defined(
__FB_DOS__ )
350 case asc(
"/"),
asc(
"\")
354 return left( path, length )
361 #if defined(
__FB_WIN32__ )
or defined(
__FB_DOS__ )
362 if( (*path)[0] <> 0 )
then
363 select case( (*path)[1] )
370 function = ((*path)[0] =
asc(
"\" ))
376 function = ((*path)[0] =
asc(
"/" ))
382 dim as FBFILE_FORMAT fmt
385 fmt = FBFILE_FORMAT_ASCII
387 if(
get( #f, 0, BOM ) = 0 )
then
388 if( BOM = &hFFFE0000 )
then
389 fmt = FBFILE_FORMAT_UTF32BE
391 elseif( BOM = &h0000FEFF )
then
392 fmt = FBFILE_FORMAT_UTF32LE
396 if( BOM = &h00BFBBEF )
then
397 fmt = FBFILE_FORMAT_UTF8
401 if( BOM = &h0000FEFF )
then
402 fmt = FBFILE_FORMAT_UTF16LE
404 elseif( BOM = &h0000FFFE )
then
405 fmt = FBFILE_FORMAT_UTF16BE
411 case FBFILE_FORMAT_ASCII
414 case FBFILE_FORMAT_UTF8
417 case FBFILE_FORMAT_UTF16LE, _
418 FBFILE_FORMAT_UTF16BE
435 if( sym = NULL )
then exit function
437 var symlen =
len( *sym )
439 if( symlen = 0 )
then exit function
441 if( (hIsChar(sym[0])
orelse (sym[0] =
asc(
"_"))) = FALSE )
then exit function
443 for i
as integer = 1
to symlen-1
444 if( ((hIsChar(sym[i]))
orelse (sym[i] =
asc(
"_"))
orelse (hIsCharNumeric(sym[i]))) = FALSE )
then exit function
453 dim as integer last =
len(s) - 1
458 return (((s[0] =
asc(
""""))
and (s[last] =
asc(
"""")))
or _
459 ((s[0] =
asc(
"'" ))
and (s[last] =
asc(
"'" ))))
464 return mid(s, 2,
len(s) - 2)