See ChangeLog entry 2004-04-22 17:30 UTC-0500 David G. Holm <dholm@jsd-llc.com>
This commit is contained in:
@@ -8,6 +8,15 @@
|
||||
2002-12-01 23:12 UTC+0100 Foo Bar <foo.bar@foobar.org>
|
||||
*/
|
||||
|
||||
2004-04-22 17:30 UTC-0500 David G. Holm <dholm@jsd-llc.com>
|
||||
* contrib/libct/files.c
|
||||
* contrib/libnf/color2n.c
|
||||
* contrib/libnf/dispc.c
|
||||
* contrib/libnf/n2color.c
|
||||
* contrib/rdd_ads/ads1.c
|
||||
* source/vm/memvars.c
|
||||
! Eliminated most warnings issued by MinGW GCC compiler.
|
||||
|
||||
2004-04-22 10:57 UTC+0300 Chen Kedem <niki@actcom.co.il>
|
||||
* doc/dirstruc.txt
|
||||
+ Add oneliner description for: contrib/hbzlib/include,
|
||||
|
||||
@@ -190,20 +190,20 @@ HB_FUNC(FILEATTR)
|
||||
iAttri = _chmod( szFile, 0 );
|
||||
#endif
|
||||
hb_retni(iAttri);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#elif defined(HB_OS_WIN_32)
|
||||
{
|
||||
{
|
||||
DWORD dAttr;
|
||||
|
||||
LPCTSTR cFile=hb_parc(1);
|
||||
dAttr=GetFileAttributes(cFile);
|
||||
hb_retnl(dAttr);
|
||||
}
|
||||
}
|
||||
#else
|
||||
{
|
||||
hb_retnl(-1);
|
||||
hb_retnl(-1);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -269,10 +269,10 @@ HB_FUNC(SETFATTR)
|
||||
case (FA_RDONLY|FA_ARCH|FA_HIDDEN|FA_SYSTEM) :
|
||||
iReturn=_chmod(szFile,1,FA_RDONLY|FA_ARCH|FA_HIDDEN|FA_SYSTEM);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
hb_retni(iReturn);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#elif defined(HB_OS_WIN_32)
|
||||
@@ -297,9 +297,11 @@ HB_FUNC(SETFATTR)
|
||||
lSuccess=SetFileAttributes(cFile,dwFlags);
|
||||
if (lSuccess)
|
||||
hb_retni(dwLastError);
|
||||
else {
|
||||
else
|
||||
{
|
||||
dwLastError=GetLastError();
|
||||
switch (dwLastError) {
|
||||
switch (dwLastError)
|
||||
{
|
||||
case ERROR_FILE_NOT_FOUND :
|
||||
hb_retni(-2);
|
||||
break;
|
||||
@@ -309,58 +311,63 @@ HB_FUNC(SETFATTR)
|
||||
case ERROR_ACCESS_DENIED:
|
||||
hb_retni(-5);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
{
|
||||
hb_retnl(-1);
|
||||
hb_retnl(-1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
HB_FUNC(FILESEEK)
|
||||
HB_FUNC(FILESEEK)
|
||||
{
|
||||
|
||||
#if defined(HB_OS_WIN_32) && !defined(__CYGWIN__)
|
||||
{
|
||||
LPCTSTR szFile;
|
||||
DWORD dwFlags=FILE_ATTRIBUTE_ARCHIVE;
|
||||
int iAttr;
|
||||
if (hb_pcount() >=1){
|
||||
if (hb_pcount() >=1)
|
||||
{
|
||||
szFile=hb_parc(1);
|
||||
if (ISNUM(2)) {
|
||||
iAttr=hb_parnl(2);}
|
||||
else{
|
||||
iAttr=63;
|
||||
if (ISNUM(2))
|
||||
{
|
||||
iAttr=hb_parnl(2);
|
||||
}
|
||||
if( iAttr & FA_RDONLY )
|
||||
dwFlags |= FILE_ATTRIBUTE_READONLY;
|
||||
else
|
||||
{
|
||||
iAttr=63;
|
||||
}
|
||||
if( iAttr & FA_RDONLY )
|
||||
dwFlags |= FILE_ATTRIBUTE_READONLY;
|
||||
|
||||
if( iAttr & FA_HIDDEN )
|
||||
dwFlags |= FILE_ATTRIBUTE_HIDDEN;
|
||||
if( iAttr & FA_HIDDEN )
|
||||
dwFlags |= FILE_ATTRIBUTE_HIDDEN;
|
||||
|
||||
if( iAttr & FA_SYSTEM )
|
||||
dwFlags |= FILE_ATTRIBUTE_SYSTEM;
|
||||
if( iAttr & FA_NORMAL )
|
||||
dwFlags |= FILE_ATTRIBUTE_NORMAL;
|
||||
|
||||
hLastFind = FindFirstFile(szFile,&Lastff32);
|
||||
if (hLastFind != INVALID_HANDLE_VALUE){
|
||||
hb_retc(Lastff32.cFileName);
|
||||
}
|
||||
if( iAttr & FA_SYSTEM )
|
||||
dwFlags |= FILE_ATTRIBUTE_SYSTEM;
|
||||
if( iAttr & FA_NORMAL )
|
||||
dwFlags |= FILE_ATTRIBUTE_NORMAL;
|
||||
|
||||
hLastFind = FindFirstFile(szFile,&Lastff32);
|
||||
if (hLastFind != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
hb_retc(Lastff32.cFileName);
|
||||
}
|
||||
else {
|
||||
if (FindNextFile(hLastFind,&Lastff32))
|
||||
hb_retc(Lastff32.cFileName);
|
||||
else {
|
||||
FindClose(hLastFind);
|
||||
hLastFind=NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (FindNextFile(hLastFind,&Lastff32))
|
||||
hb_retc(Lastff32.cFileName);
|
||||
else
|
||||
{
|
||||
FindClose(hLastFind);
|
||||
hLastFind=NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#elif defined(HB_OS_DOS)
|
||||
{
|
||||
int iFind;
|
||||
@@ -369,30 +376,34 @@ hb_retnl(-1);
|
||||
if (hb_pcount()>=1)
|
||||
{
|
||||
szFiles=hb_parc(1);
|
||||
if(ISNUM(2)){
|
||||
if(ISNUM(2))
|
||||
{
|
||||
iAttr=hb_parnl(2);
|
||||
}
|
||||
else{
|
||||
}
|
||||
else
|
||||
{
|
||||
iAttr=32;
|
||||
}
|
||||
}
|
||||
iFind=findfirst(szFiles,&fsOldFiles,iAttr);
|
||||
if (!iFind){
|
||||
if (!iFind)
|
||||
{
|
||||
hb_retc(fsOldFiles.ff_name);
|
||||
}
|
||||
}
|
||||
else {
|
||||
iFind=findnext(&fsOldFiles);
|
||||
if (!iFind)
|
||||
hb_retc(fsOldFiles.ff_name);
|
||||
#if !defined (__DJGPP__)
|
||||
else
|
||||
findclose(&fsOldFiles);
|
||||
#endif
|
||||
else
|
||||
{
|
||||
iFind=findnext(&fsOldFiles);
|
||||
if (!iFind)
|
||||
hb_retc(fsOldFiles.ff_name);
|
||||
#if !defined (__DJGPP__)
|
||||
else
|
||||
findclose(&fsOldFiles);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#else
|
||||
{
|
||||
hb_retc("");
|
||||
hb_retc("");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -401,77 +412,90 @@ HB_FUNC(FILESIZE)
|
||||
|
||||
#if defined(HB_OS_WIN_32) && !defined(__CYGWIN__)
|
||||
{
|
||||
DWORD dwFileSize=0;
|
||||
LPCTSTR szFile;
|
||||
DWORD dwFlags=FILE_ATTRIBUTE_ARCHIVE;
|
||||
HANDLE hFind;
|
||||
WIN32_FIND_DATA hFilesFind;
|
||||
DWORD dwFileSize=0;
|
||||
LPCTSTR szFile;
|
||||
DWORD dwFlags=FILE_ATTRIBUTE_ARCHIVE;
|
||||
HANDLE hFind;
|
||||
WIN32_FIND_DATA hFilesFind;
|
||||
|
||||
int iAttr;
|
||||
if (hb_pcount() >=1){
|
||||
if (hb_pcount() >=1)
|
||||
{
|
||||
szFile=hb_parc(1);
|
||||
if (ISNUM(2)) {
|
||||
if (ISNUM(2))
|
||||
{
|
||||
iAttr=hb_parnl(2);
|
||||
}
|
||||
else{
|
||||
iAttr=63;
|
||||
else
|
||||
{
|
||||
iAttr=63;
|
||||
}
|
||||
if( iAttr & FA_RDONLY )
|
||||
dwFlags |= FILE_ATTRIBUTE_READONLY;
|
||||
if( iAttr & FA_RDONLY )
|
||||
dwFlags |= FILE_ATTRIBUTE_READONLY;
|
||||
|
||||
if( iAttr & FA_HIDDEN )
|
||||
dwFlags |= FILE_ATTRIBUTE_HIDDEN;
|
||||
if( iAttr & FA_HIDDEN )
|
||||
dwFlags |= FILE_ATTRIBUTE_HIDDEN;
|
||||
|
||||
if( iAttr & FA_SYSTEM )
|
||||
dwFlags |= FILE_ATTRIBUTE_SYSTEM;
|
||||
if( iAttr & FA_NORMAL )
|
||||
dwFlags |= FILE_ATTRIBUTE_NORMAL;
|
||||
|
||||
hFind = FindFirstFile(szFile,&hFilesFind);
|
||||
if (hFind != INVALID_HANDLE_VALUE){
|
||||
if (dwFlags & hFilesFind.dwFileAttributes) {
|
||||
if(hFilesFind.nFileSizeHigh>0)
|
||||
hb_retnl((hFilesFind.nFileSizeHigh*MAXDWORD)+hFilesFind.nFileSizeLow);
|
||||
else
|
||||
hb_retnl(hFilesFind.nFileSizeLow);
|
||||
}
|
||||
else
|
||||
hb_retnl(-1);
|
||||
}
|
||||
if( iAttr & FA_SYSTEM )
|
||||
dwFlags |= FILE_ATTRIBUTE_SYSTEM;
|
||||
if( iAttr & FA_NORMAL )
|
||||
dwFlags |= FILE_ATTRIBUTE_NORMAL;
|
||||
|
||||
hFind = FindFirstFile(szFile,&hFilesFind);
|
||||
if (hFind != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
if (dwFlags & hFilesFind.dwFileAttributes)
|
||||
{
|
||||
if(hFilesFind.nFileSizeHigh>0)
|
||||
{
|
||||
hb_retnl((hFilesFind.nFileSizeHigh*MAXDWORD)+hFilesFind.nFileSizeLow);
|
||||
}
|
||||
else
|
||||
{
|
||||
hb_retnl(hFilesFind.nFileSizeLow);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
hb_retnl(-1);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if(Lastff32.nFileSizeHigh>0)
|
||||
dwFileSize=(Lastff32.nFileSizeHigh*MAXDWORD)+Lastff32.nFileSizeLow;
|
||||
else
|
||||
dwFileSize=Lastff32.nFileSizeLow;
|
||||
hb_retnl(dwFileSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(Lastff32.nFileSizeHigh>0)
|
||||
dwFileSize=(Lastff32.nFileSizeHigh*MAXDWORD)+Lastff32.nFileSizeLow;
|
||||
else
|
||||
dwFileSize=Lastff32.nFileSizeLow;
|
||||
hb_retnl(dwFileSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
#elif defined(HB_OS_DOS)
|
||||
{
|
||||
{
|
||||
int iFind;
|
||||
if (hb_pcount() >0) {
|
||||
if (hb_pcount() >0)
|
||||
{
|
||||
char *szFiles=hb_parc(1);
|
||||
int iAttr=0 ;
|
||||
struct ffblk fsFiles;
|
||||
|
||||
if (ISNUM(2))
|
||||
{
|
||||
iAttr=hb_parni(2);
|
||||
iFind=findfirst(szFiles,&fsFiles,iAttr);
|
||||
if (!iFind)
|
||||
if ((iAttr>0) & (iAttr&fsFiles.ff_attrib))
|
||||
hb_retnl(fsFiles.ff_fsize);
|
||||
else
|
||||
hb_retnl(fsFiles.ff_fsize);
|
||||
else
|
||||
hb_retnl(-1);
|
||||
}
|
||||
iFind=findfirst(szFiles,&fsFiles,iAttr);
|
||||
if (!iFind)
|
||||
{
|
||||
/* if ((iAttr>0) & (iAttr&fsFiles.ff_attrib))
|
||||
hb_retnl(fsFiles.ff_fsize);
|
||||
else */
|
||||
hb_retnl(fsFiles.ff_fsize);
|
||||
}
|
||||
else hb_retnl(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
hb_retnl(fsOldFiles.ff_fsize);
|
||||
else
|
||||
{
|
||||
hb_retnl(fsOldFiles.ff_fsize);
|
||||
}
|
||||
}
|
||||
#elif defined(OS_UNIX_COMPATIBLE)
|
||||
@@ -482,99 +506,111 @@ HB_FUNC(FILESIZE)
|
||||
USHORT usFileAttr;
|
||||
struct stat sStat;
|
||||
if (ISNUM(2))
|
||||
{
|
||||
ushbMask=hb_parni(2);
|
||||
if (stat(szFile,&sStat )!=-1){
|
||||
usFileAttr=osToHarbourMask(sStat.st_mode);
|
||||
if ((ushbMask>0) & (ushbMask&usFileAttr))
|
||||
hb_retnl(sStat.st_size);
|
||||
else
|
||||
hb_retnl(sStat.st_size);
|
||||
}
|
||||
}
|
||||
if (stat(szFile,&sStat )!=-1)
|
||||
{
|
||||
usFileAttr=osToHarbourMask(sStat.st_mode);
|
||||
/* if ((ushbMask>0) & (ushbMask&usFileAttr))
|
||||
hb_retnl(sStat.st_size);
|
||||
else */
|
||||
hb_retnl(sStat.st_size);
|
||||
}
|
||||
else
|
||||
hb_retnl(-1);
|
||||
}
|
||||
hb_retnl(-1);
|
||||
}
|
||||
}
|
||||
#else
|
||||
{
|
||||
hb_retl(-1);
|
||||
hb_retl(-1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
HB_FUNC(FILEDATE)
|
||||
{
|
||||
|
||||
#if defined(HB_OS_WIN_32) && !defined(__CYGWIN__)
|
||||
{
|
||||
LPCTSTR szFile;
|
||||
LPTSTR szDateString;
|
||||
DWORD dwFlags=FILE_ATTRIBUTE_ARCHIVE;
|
||||
HANDLE hFind;
|
||||
WIN32_FIND_DATA hFilesFind;
|
||||
|
||||
int iAttr;
|
||||
if (hb_pcount() >=1){
|
||||
szFile=hb_parc(1);
|
||||
if (ISNUM(2)) {
|
||||
int iAttr;
|
||||
if (hb_pcount() >=1)
|
||||
{
|
||||
szFile=hb_parc(1);
|
||||
if (ISNUM(2))
|
||||
{
|
||||
iAttr=hb_parnl(2);
|
||||
}
|
||||
else{
|
||||
}
|
||||
else
|
||||
{
|
||||
iAttr=63;
|
||||
}
|
||||
if( iAttr & FA_RDONLY )
|
||||
dwFlags |= FILE_ATTRIBUTE_READONLY;
|
||||
}
|
||||
if( iAttr & FA_RDONLY )
|
||||
dwFlags |= FILE_ATTRIBUTE_READONLY;
|
||||
|
||||
if( iAttr & FA_HIDDEN )
|
||||
dwFlags |= FILE_ATTRIBUTE_HIDDEN;
|
||||
if( iAttr & FA_HIDDEN )
|
||||
dwFlags |= FILE_ATTRIBUTE_HIDDEN;
|
||||
|
||||
if( iAttr & FA_SYSTEM )
|
||||
dwFlags |= FILE_ATTRIBUTE_SYSTEM;
|
||||
if( iAttr & FA_NORMAL )
|
||||
dwFlags |= FILE_ATTRIBUTE_NORMAL;
|
||||
if( iAttr & FA_SYSTEM )
|
||||
dwFlags |= FILE_ATTRIBUTE_SYSTEM;
|
||||
if( iAttr & FA_NORMAL )
|
||||
dwFlags |= FILE_ATTRIBUTE_NORMAL;
|
||||
|
||||
hFind = FindFirstFile(szFile,&hFilesFind);
|
||||
if (hFind != INVALID_HANDLE_VALUE)
|
||||
if (dwFlags & hFilesFind.dwFileAttributes)
|
||||
hb_retds(GetDate(&hFilesFind.ftLastWriteTime));
|
||||
else
|
||||
hb_retds(GetDate(&hFilesFind.ftLastWriteTime));
|
||||
|
||||
else
|
||||
hb_retds(" ");
|
||||
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
LPTSTR szDateString;
|
||||
szDateString=GetDate(&Lastff32.ftLastWriteTime);
|
||||
hb_retds(szDateString);
|
||||
|
||||
}
|
||||
hFind = FindFirstFile(szFile,&hFilesFind);
|
||||
if (hFind != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
szDateString = GetDate(&hFilesFind.ftLastWriteTime);
|
||||
/* if (dwFlags & hFilesFind.dwFileAttributes)
|
||||
hb_retds(GetDate(&hFilesFind.ftLastWriteTime));
|
||||
else */
|
||||
hb_retds(szDateString);
|
||||
hb_xfree(szDateString);
|
||||
}
|
||||
else
|
||||
hb_retds(" ");
|
||||
}
|
||||
else
|
||||
{
|
||||
szDateString=GetDate(&Lastff32.ftLastWriteTime);
|
||||
hb_retds(szDateString);
|
||||
hb_xfree(szDateString);
|
||||
}
|
||||
}
|
||||
#elif defined(HB_OS_DOS)
|
||||
{
|
||||
int iFind;
|
||||
if (hb_pcount() >0) {
|
||||
if (hb_pcount() >0)
|
||||
{
|
||||
char *szFiles=hb_parc(1);
|
||||
int iAttr=0 ;
|
||||
struct ffblk fsFiles;
|
||||
if (ISNUM(2))
|
||||
{
|
||||
iAttr=hb_parni(2);
|
||||
iFind=findfirst(szFiles,&fsFiles,iAttr);
|
||||
if (!iFind)
|
||||
if ((iAttr>0) & (iAttr&fsFiles.ff_attrib))
|
||||
hb_retd( (long) (fsFiles.ff_fdate >> 9) +1980 , (long) ((fsFiles.ff_fdate & ~0xFE00) >> 5) ,(long)fsFiles.ff_fdate & ~0xFFE0);
|
||||
else
|
||||
hb_retd( (long) (fsFiles.ff_fdate >> 9) +1980 , (long) ((fsFiles.ff_fdate & ~0xFE00) >> 5) ,(long)fsFiles.ff_fdate & ~0xFFE0);
|
||||
else
|
||||
hb_retds(" ");
|
||||
}
|
||||
iFind=findfirst(szFiles,&fsFiles,iAttr);
|
||||
if (!iFind)
|
||||
{
|
||||
/* if ((iAttr>0) & (iAttr&fsFiles.ff_attrib))
|
||||
hb_retd( (long) (fsFiles.ff_fdate >> 9) +1980 , (long) ((fsFiles.ff_fdate & ~0xFE00) >> 5), (long)fsFiles.ff_fdate & ~0xFFE0);
|
||||
else */
|
||||
hb_retd( (long) (fsFiles.ff_fdate >> 9) +1980 , (long) ((fsFiles.ff_fdate & ~0xFE00) >> 5), (long)fsFiles.ff_fdate & ~0xFFE0);
|
||||
}
|
||||
else
|
||||
hb_retds(" ");
|
||||
}
|
||||
else
|
||||
hb_retd( (long) (fsOldFiles.ff_fdate >> 9) +1980, (long) ((fsOldFiles.ff_fdate & ~0xFE00) >> 5), (long)fsOldFiles.ff_fdate & ~0xFFE0);
|
||||
}
|
||||
else
|
||||
hb_retd( (long) (fsOldFiles.ff_fdate >> 9) +1980 , (long) ((fsOldFiles.ff_fdate & ~0xFE00) >> 5) ,(long)fsOldFiles.ff_fdate & ~0xFFE0);
|
||||
}
|
||||
#elif defined(OS_UNIX_COMPATIBLE)
|
||||
{
|
||||
if (hb_pcount() >0) {
|
||||
if (hb_pcount() >0)
|
||||
{
|
||||
const char *szFile=hb_parc(1);
|
||||
struct stat sStat;
|
||||
time_t tm_t=0;
|
||||
@@ -583,24 +619,27 @@ HB_FUNC(FILEDATE)
|
||||
USHORT ushbMask = FA_ARCH;
|
||||
USHORT usFileAttr;
|
||||
if (ISNUM(2))
|
||||
{
|
||||
ushbMask=hb_parni(2);
|
||||
if (stat(szFile,&sStat) != -1) {
|
||||
}
|
||||
if (stat(szFile,&sStat) != -1)
|
||||
{
|
||||
tm_t = sStat.st_mtime;
|
||||
filedate = localtime(&tm_t);
|
||||
sprintf(szDate,"%04d%02d%02d",filedate->tm_year+1900,filedate->tm_mon+1,filedate->tm_mday);
|
||||
usFileAttr=osToHarbourMask(sStat.st_mode);
|
||||
if ((ushbMask>0) & (ushbMask&usFileAttr))
|
||||
/* if ((ushbMask>0) & (ushbMask&usFileAttr))
|
||||
hb_retds(szDate);
|
||||
else */
|
||||
hb_retds(szDate);
|
||||
}
|
||||
else
|
||||
hb_retds(szDate);
|
||||
}
|
||||
else
|
||||
hb_retds(" ");
|
||||
hb_retds(" ");
|
||||
}
|
||||
}
|
||||
#else
|
||||
{
|
||||
hb_retds(" ");
|
||||
hb_retds(" ");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -615,72 +654,77 @@ HB_FUNC(FILETIME)
|
||||
HANDLE hFind;
|
||||
WIN32_FIND_DATA hFilesFind;
|
||||
|
||||
int iAttr;
|
||||
if (hb_pcount() >=1){
|
||||
szFile=hb_parc(1);
|
||||
if (ISNUM(2)) {
|
||||
int iAttr;
|
||||
if (hb_pcount() >=1)
|
||||
{
|
||||
szFile=hb_parc(1);
|
||||
if (ISNUM(2))
|
||||
{
|
||||
iAttr=hb_parnl(2);
|
||||
}
|
||||
else{
|
||||
}
|
||||
else
|
||||
{
|
||||
iAttr=63;
|
||||
}
|
||||
if( iAttr & FA_RDONLY )
|
||||
dwFlags |= FILE_ATTRIBUTE_READONLY;
|
||||
}
|
||||
if( iAttr & FA_RDONLY )
|
||||
dwFlags |= FILE_ATTRIBUTE_READONLY;
|
||||
|
||||
if( iAttr & FA_HIDDEN )
|
||||
dwFlags |= FILE_ATTRIBUTE_HIDDEN;
|
||||
if( iAttr & FA_HIDDEN )
|
||||
dwFlags |= FILE_ATTRIBUTE_HIDDEN;
|
||||
|
||||
if( iAttr & FA_SYSTEM )
|
||||
dwFlags |= FILE_ATTRIBUTE_SYSTEM;
|
||||
if( iAttr & FA_NORMAL )
|
||||
dwFlags |= FILE_ATTRIBUTE_NORMAL;
|
||||
if( iAttr & FA_SYSTEM )
|
||||
dwFlags |= FILE_ATTRIBUTE_SYSTEM;
|
||||
if( iAttr & FA_NORMAL )
|
||||
dwFlags |= FILE_ATTRIBUTE_NORMAL;
|
||||
|
||||
hFind = FindFirstFile(szFile,&hFilesFind);
|
||||
if (hFind != INVALID_HANDLE_VALUE)
|
||||
if (dwFlags & hFilesFind.dwFileAttributes)
|
||||
hb_retc(GetTime(&hFilesFind.ftLastWriteTime));
|
||||
else
|
||||
hb_retc(GetTime(&hFilesFind.ftLastWriteTime));
|
||||
|
||||
else
|
||||
hb_retc(" : ");
|
||||
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
szDateString=GetTime(&Lastff32.ftLastWriteTime);
|
||||
|
||||
hb_retc(szDateString);
|
||||
hFind = FindFirstFile(szFile,&hFilesFind);
|
||||
if (hFind != INVALID_HANDLE_VALUE)
|
||||
{
|
||||
/* if (dwFlags & hFilesFind.dwFileAttributes)
|
||||
hb_retc(GetTime(&hFilesFind.ftLastWriteTime));
|
||||
else */
|
||||
szDateString = GetTime(&hFilesFind.ftLastWriteTime);
|
||||
hb_retc(szDateString);
|
||||
hb_xfree(szDateString);
|
||||
}
|
||||
else
|
||||
hb_retc(" : ");
|
||||
}
|
||||
else
|
||||
{
|
||||
szDateString=GetTime(&Lastff32.ftLastWriteTime);
|
||||
hb_retc(szDateString);
|
||||
hb_xfree(szDateString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined(HB_OS_DOS)
|
||||
{
|
||||
|
||||
char szTime[7];
|
||||
int iFind;
|
||||
if (hb_pcount() >0) {
|
||||
if (hb_pcount() >0)
|
||||
{
|
||||
char *szFiles=hb_parc(1);
|
||||
int iAttr=0 ;
|
||||
struct ffblk fsFiles;
|
||||
if (ISNUM(2))
|
||||
{
|
||||
iAttr=hb_parni(2);
|
||||
iFind=findfirst(szFiles,&fsFiles,iAttr);
|
||||
if (!iFind){
|
||||
if ((iAttr>0) & (iAttr&fsFiles.ff_attrib))
|
||||
sprintf(szTime,"%2.2u:%2.2u",(fsFiles.ff_ftime >> 11) & 0x1f,(fsFiles.ff_ftime>> 5) & 0x3f);
|
||||
else
|
||||
sprintf(szTime,"%2.2u:%2.2u",(fsFiles.ff_ftime >> 11) & 0x1f,(fsFiles.ff_ftime>> 5) & 0x3f);
|
||||
hb_retc(szTime);
|
||||
}
|
||||
|
||||
else
|
||||
hb_retc(" : ");
|
||||
}
|
||||
iFind=findfirst(szFiles,&fsFiles,iAttr);
|
||||
if (!iFind)
|
||||
{
|
||||
/* if ((iAttr>0) & (iAttr&fsFiles.ff_attrib))
|
||||
sprintf(szTime,"%2.2u:%2.2u",(fsFiles.ff_ftime >> 11) & 0x1f,(fsFiles.ff_ftime>> 5) & 0x3f);
|
||||
else */
|
||||
sprintf(szTime,"%2.2u:%2.2u",(fsFiles.ff_ftime >> 11) & 0x1f,(fsFiles.ff_ftime>> 5) & 0x3f);
|
||||
hb_retc(szTime);
|
||||
}
|
||||
else
|
||||
hb_retc(" : ");
|
||||
}
|
||||
else {
|
||||
sprintf(szTime,"%2.2u:%2.2u",(fsOldFiles.ff_ftime >> 11) & 0x1f,(fsOldFiles.ff_ftime>> 5) & 0x3f);
|
||||
hb_retc(szTime);
|
||||
sprintf(szTime,"%2.2u:%2.2u",(fsOldFiles.ff_ftime >> 11) & 0x1f,(fsOldFiles.ff_ftime>> 5) & 0x3f);
|
||||
hb_retc(szTime);
|
||||
}
|
||||
}
|
||||
#elif defined(OS_UNIX_COMPATIBLE)
|
||||
@@ -696,73 +740,65 @@ HB_FUNC(FILETIME)
|
||||
sprintf( szTime, "%02d:%02d:%02d",ft->tm_hour, ft->tm_min, ft->tm_sec );
|
||||
hb_retc(szTime);
|
||||
}
|
||||
|
||||
#else
|
||||
{
|
||||
hb_retc(" : ");
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#if (defined(HB_OS_WIN_32) || defined(__MINGW32__)) && !defined(__CYGWIN__) && !defined(__RSXNT__)
|
||||
|
||||
#include <tchar.h>
|
||||
|
||||
LPTSTR GetDate(FILETIME *rTime)
|
||||
{
|
||||
static const LPTSTR tszFormat = "yyyyMMdd";
|
||||
FILETIME ft;
|
||||
int iSize;
|
||||
if (FileTimeToLocalFileTime(rTime, &ft))
|
||||
{
|
||||
SYSTEMTIME time;
|
||||
if (FileTimeToSystemTime(&ft, &time))
|
||||
LPTSTR GetDate(FILETIME *rTime)
|
||||
{
|
||||
static const LPTSTR tszFormat = "yyyyMMdd";
|
||||
FILETIME ft;
|
||||
if (FileTimeToLocalFileTime(rTime, &ft))
|
||||
{
|
||||
SYSTEMTIME time;
|
||||
if (FileTimeToSystemTime(&ft, &time))
|
||||
{
|
||||
int iSize = GetDateFormat(0, 0, &time, tszFormat, NULL, 0);
|
||||
if ( iSize )
|
||||
{
|
||||
LPTSTR tszDateString = (LPTSTR)hb_xgrab(iSize+sizeof(TCHAR));
|
||||
if ( tszDateString )
|
||||
{
|
||||
|
||||
if ( iSize = GetDateFormat(NULL, 0, &time, tszFormat, NULL, 0))
|
||||
{
|
||||
LPTSTR tszDateString;
|
||||
if ( tszDateString = (LPTSTR)malloc(iSize+sizeof(TCHAR)))
|
||||
{
|
||||
if (GetDateFormat(NULL, 0, &time, tszFormat, tszDateString, iSize))
|
||||
return tszDateString;
|
||||
free(tszDateString);
|
||||
}
|
||||
}
|
||||
if (GetDateFormat(0, 0, &time, tszFormat, tszDateString, iSize))
|
||||
return tszDateString;
|
||||
free(tszDateString);
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
LPTSTR GetTime(FILETIME *rTime)
|
||||
{
|
||||
static const LPTSTR tszFormat = "HH':'mm";/*_T("MM'\\'dd'\\'yyyy");*/
|
||||
FILETIME ft;
|
||||
LPTSTR GetTime(FILETIME *rTime)
|
||||
{
|
||||
static const LPTSTR tszFormat = "HH':'mm";/*_T("MM'\\'dd'\\'yyyy");*/
|
||||
FILETIME ft;
|
||||
|
||||
if (FileTimeToLocalFileTime(rTime, &ft))
|
||||
{
|
||||
SYSTEMTIME time;
|
||||
if (FileTimeToSystemTime(&ft, &time))
|
||||
if (FileTimeToLocalFileTime(rTime, &ft))
|
||||
{
|
||||
SYSTEMTIME time;
|
||||
if (FileTimeToSystemTime(&ft, &time))
|
||||
{
|
||||
int iSize = GetTimeFormat(0, 0, &time, tszFormat, NULL, 0);
|
||||
if ( iSize )
|
||||
{
|
||||
LPTSTR tszDateString = (LPTSTR)hb_xgrab(iSize+sizeof(TCHAR));
|
||||
if ( tszDateString )
|
||||
{
|
||||
int iSize;
|
||||
if ( iSize = GetTimeFormat(NULL, 0, &time, tszFormat, NULL, 0))
|
||||
{
|
||||
LPTSTR tszDateString;
|
||||
if ( tszDateString = (LPTSTR)malloc(iSize+sizeof(TCHAR)))
|
||||
{
|
||||
if (GetTimeFormat(NULL, 0, &time, tszFormat, tszDateString, iSize))
|
||||
return tszDateString;
|
||||
free(tszDateString);
|
||||
}
|
||||
}
|
||||
if (GetTimeFormat(0, 0, &time, tszFormat, tszDateString, iSize))
|
||||
return tszDateString;
|
||||
free(tszDateString);
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -13,6 +13,10 @@
|
||||
* Modification history:
|
||||
* ---------------------
|
||||
*
|
||||
* Rev 1.1 22 Apr 2004 15:44:00 DGH
|
||||
* Fixed compiler warnings about pointer vs. integer by changing NULL to 0.
|
||||
* Commented out #ifdef and #endif lines, because there is nothing that is
|
||||
* even remotely DOS- or Windows-specific in the code.
|
||||
* Rev 1.0 01 Jan 1995 03:01:00 TED
|
||||
* Initial release
|
||||
*
|
||||
@@ -55,8 +59,8 @@ static char * _ftStripIt( char * cColor );
|
||||
|
||||
HB_FUNC(FT_COLOR2N)
|
||||
{
|
||||
#if defined(HB_OS_DOS) || defined(HB_OS_WIN_32)
|
||||
{
|
||||
/* #if defined(HB_OS_DOS) || defined(HB_OS_WIN_32)
|
||||
{ */
|
||||
|
||||
int iRet = 0;
|
||||
|
||||
@@ -68,8 +72,8 @@ HB_FUNC(FT_COLOR2N)
|
||||
hb_retni( iRet );
|
||||
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
/* }
|
||||
#endif */
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +92,7 @@ static int _ftColor2I( char * cColor )
|
||||
// copy the Clipper string to buffer, check for attributes, and
|
||||
// make lower case
|
||||
|
||||
while ( ( cFore[ i ] = cColor[ i ] ) != NULL )
|
||||
while ( ( cFore[ i ] = cColor[ i ] ) != 0 )
|
||||
{
|
||||
// check for a blink attrib
|
||||
|
||||
@@ -107,12 +111,12 @@ static int _ftColor2I( char * cColor )
|
||||
|
||||
// check for the background color
|
||||
|
||||
while ( cColor[ iBack++ ] != '/' && cColor[ iBack ] != NULL );
|
||||
while ( cColor[ iBack++ ] != '/' && cColor[ iBack ] != 0 );
|
||||
|
||||
if ( cColor[--iBack ] == '/' )
|
||||
{
|
||||
cBack = cFore + iBack + 1;
|
||||
cFore[ iBack ] = NULL;
|
||||
cFore[ iBack ] = 0;
|
||||
}
|
||||
|
||||
// calculate and return the value
|
||||
|
||||
@@ -13,6 +13,12 @@
|
||||
* Modification history:
|
||||
* ---------------------
|
||||
*
|
||||
* Rev 1.10 22 Apr 2004 15:32:00 David G. Holm <dholm@jsd-llc.com>
|
||||
* Corrected all hb_fsSeek calls to use FS_ defines instead of using
|
||||
* redefined SEEK_ ones that conflict with the C-level SEEK_ defines.
|
||||
* Rev 1.9 ? ?
|
||||
* An unknown number of changes were made between Rev 1.8 and Rev 1.10.
|
||||
*
|
||||
* Rev 1.8 24 May 2002 19:25:00 David G. Holm <dholm@jsd-llc.com>
|
||||
* Fixed some problems that caused C++ compiles to fail.
|
||||
*
|
||||
@@ -70,10 +76,6 @@
|
||||
#define LF ((char) 10)
|
||||
#define FEOF ((char) 26)
|
||||
|
||||
#define SEEK_END 2 /* file seek directions */
|
||||
#define SEEK_CUR 1
|
||||
#define SEEK_SET 0
|
||||
|
||||
#define READONLY 0 /* open file modes */
|
||||
#define WRITEONLY 1
|
||||
#define READWRITE 2
|
||||
@@ -171,7 +173,7 @@ static long getblock(long offset)
|
||||
the beginning of the file.
|
||||
*/
|
||||
|
||||
hb_fsSeek( infile, offset, SEEK_SET );
|
||||
hb_fsSeek( infile, offset, FS_SET );
|
||||
|
||||
/* read in the file and set the buffer bottom variable equal */
|
||||
/* to the number of bytes actually read in. */
|
||||
@@ -183,16 +185,16 @@ static long getblock(long offset)
|
||||
if (( buffbot != buffsize ) && ( fsize > buffsize ))
|
||||
{
|
||||
if ( offset > 0 )
|
||||
hb_fsSeek( infile, (long) -buffsize, SEEK_END );
|
||||
hb_fsSeek( infile, (long) -buffsize, FS_END );
|
||||
else
|
||||
hb_fsSeek( infile, (long) buffsize, SEEK_SET );
|
||||
hb_fsSeek( infile, (long) buffsize, FS_SET );
|
||||
|
||||
buffbot = hb_fsReadLarge( infile, buffer, buffsize );
|
||||
}
|
||||
|
||||
/* return the actual file position */
|
||||
|
||||
return( hb_fsSeek( infile, 0L, SEEK_CUR ) - buffbot);
|
||||
return( hb_fsSeek( infile, 0L, FS_RELATIVE ) - buffbot);
|
||||
}
|
||||
|
||||
|
||||
@@ -623,11 +625,11 @@ HB_FUNC( _FT_DFINIT )
|
||||
|
||||
/* get file size */
|
||||
|
||||
fsize = hb_fsSeek( infile, 0L, SEEK_END ) - 1;
|
||||
fsize = hb_fsSeek( infile, 0L, FS_END ) - 1;
|
||||
|
||||
/* get the first block */
|
||||
|
||||
hb_fsSeek( infile, 0L, SEEK_SET );
|
||||
hb_fsSeek( infile, 0L, FS_SET );
|
||||
|
||||
/* if block less than buffsize */
|
||||
|
||||
|
||||
@@ -13,6 +13,12 @@
|
||||
* Modification history:
|
||||
* ---------------------
|
||||
*
|
||||
* Rev 2.1 22 Apr 2004 15:47:00 DGH
|
||||
* Made definitions of _ftI2Color and _ftGetColorStr static to match
|
||||
* their forward declarations. Commented out the extremely useless
|
||||
* #if defined(HB_OS_DOS) line and corresponding #endif line. (There
|
||||
* is nothing that is even remotely DOS-specific in the code!) And
|
||||
* converted tabs to spaces.
|
||||
* Rev 2.0 03 Mar 1997 03:05:01 JO / Phil Barnett
|
||||
* commented out : if ( iColor > 15 ) in _ftI2Color()
|
||||
* Rev 1.0 01 Jan 1995 03:01:00 TED
|
||||
@@ -52,23 +58,21 @@ static int _ftGetColorStr( int iColor, char * cColor );
|
||||
|
||||
HB_FUNC(FT_N2COLOR )
|
||||
{
|
||||
#if defined(HB_OS_DOS)
|
||||
{
|
||||
|
||||
/* #if defined(HB_OS_DOS)
|
||||
{ */
|
||||
char * cColor = " ";
|
||||
|
||||
// make sure parameter is a numeric type
|
||||
|
||||
if ( ISNUM(1))
|
||||
_ftI2Color( hb_parni( 1 ), cColor );
|
||||
else
|
||||
cColor = NULL;
|
||||
else
|
||||
cColor = NULL;
|
||||
|
||||
hb_retc( cColor );
|
||||
hb_retc( cColor );
|
||||
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
/* }
|
||||
#endif */
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +85,7 @@ HB_FUNC(FT_N2COLOR )
|
||||
// Returns : void (string is modified directly)
|
||||
// ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
|
||||
void _ftI2Color( int iColor, char * cColor )
|
||||
static void _ftI2Color( int iColor, char * cColor )
|
||||
{
|
||||
unsigned int iBack = 0, iFore = 0, i = 0;
|
||||
|
||||
@@ -141,7 +145,7 @@ void _ftI2Color( int iColor, char * cColor )
|
||||
// Returns : length of added color string
|
||||
// ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ
|
||||
|
||||
int _ftGetColorStr( int iColor, char * cColor )
|
||||
static int _ftGetColorStr( int iColor, char * cColor )
|
||||
{
|
||||
int iLen = 0;
|
||||
|
||||
|
||||
@@ -688,7 +688,7 @@ static ERRCODE adsSkip( ADSAREAP pArea, LONG lToSkip )
|
||||
return SUCCESS; /*bh: dbskip(0) created infinite loop; this should never move the record pointer via skipfilter */
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
if ( lToSkip < 0 )
|
||||
{
|
||||
lCount = ( 0 - lToSkip); /* abs(lToSkip) for the for loop */
|
||||
@@ -2384,8 +2384,14 @@ static ERRCODE adsOrderInfo( ADSAREAP pArea, USHORT uiIndex, LPDBORDERINFO pOrde
|
||||
pus16++; /* skip past the minus */
|
||||
|
||||
while ( pus16 < pusLen )
|
||||
aucBuffer[pus16] = (SIGNED8) 0x5C - aucBuffer[pus16++];
|
||||
|
||||
{
|
||||
aucBuffer[pus16] = (SIGNED8) 0x5C - aucBuffer[pus16];
|
||||
pus16++; // Moved the auto-increment off of prvious
|
||||
// line, because the behaviour of doing it
|
||||
// on a variable that is used on both sides
|
||||
// of an assignment is undefined and may
|
||||
// have unintended side-effects.
|
||||
}
|
||||
}
|
||||
|
||||
hb_itemPutND( pOrderInfo->itmResult, hb_strVal((char*)aucBuffer, pusLen));
|
||||
|
||||
@@ -1631,4 +1631,4 @@ PHB_ITEM hb_memvarGetValueByHandle( HB_HANDLE hMemvar )
|
||||
return &s_globalTable[ hMemvar ].item;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user