diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 29ef318b98..1d14d73fcf 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,12 @@ +19990727-16:30 EDT David G. Holm + * source/rtl/dir.c + + Added support for IBM Visual Age C++ compiler + * source/rtl/gt/gtos2.c + ! Corrected function declration for gtSetAttribute() + * tests/working/dirtest.prg + * Changed QOUT() to OUTSTD() to allow the directory listing to be + redirected, regardless of whether or not the GT API is linked in + 19990727-22:20 CET Victor Szel + tests/broken/lnlenli1.prg + tests/broken/lnlenli2.prg diff --git a/harbour/source/rtl/dir.c b/harbour/source/rtl/dir.c index 0bfb5d50dd..b39082c5a3 100644 --- a/harbour/source/rtl/dir.c +++ b/harbour/source/rtl/dir.c @@ -13,6 +13,10 @@ * been requested. * */ +#if defined(__IBMCPP__) + #define INCL_DOSFILEMGR + #define INCL_DOSERRORS +#endif #include #include @@ -58,6 +62,20 @@ #define _chmod chmod #endif +#if defined(__IBMCPP__) + #include +// #include +// #include +// #include +// #include +// #include + #include + + #if !defined(HAVE_POSIX_IO) + #define HAVE_POSIX_IO + #endif +#endif + #if defined(__BORLANDC__) #include #include @@ -133,6 +151,12 @@ HARBOUR HB_DIRECTORY( void ) #if defined(_MSC_VER ) struct _finddata_t entry; long hFile; +#elif defined(__IBMCPP__) + FILEFINDBUF3 entry; + HDIR hFind = HDIR_CREATE; + ULONG fileTypes = FILE_ARCHIVED | FILE_DIRECTORY | FILE_SYSTEM | FILE_HIDDEN | FILE_READONLY; + ULONG findSize = sizeof( entry ); + ULONG findCount = 1; #else struct dirent *entry; DIR * dir; @@ -237,7 +261,14 @@ HARBOUR HB_DIRECTORY( void ) do { strcpy(string,entry.name); - +#elif defined(__IBMCPP__) + strcpy(string,dirname); + strcat(string,pattern); + if( DosFindFirst( string, &hFind, fileTypes, &entry, findSize, &findCount, FIL_STANDARD ) == NO_ERROR && findCount > 0 ) + { + do + { + strcpy(string,entry.achName); #else dir = opendir( dirname ); if (NULL == dir) @@ -286,6 +317,8 @@ HARBOUR HB_DIRECTORY( void ) #if defined(_MSC_VER) strcpy(filename,entry.name); +#elif defined(__IBMCPP__) + strcpy( filename, entry.achName ); #else strcpy(filename,entry->d_name); #endif @@ -339,7 +372,20 @@ HARBOUR HB_DIRECTORY( void ) if( S_ISSOCK(statbuf.st_mode) ) strcat( aatrib, "K" ); #else - #ifdef _MSC_VER + #if defined(__IBMCPP__) + attrib = entry.attrFile; + if( attrib & FILE_ARCHIVED ) + strcat( aatrib, "A" ); + if( attrib & FILE_DIRECTORY ) + strcat( aatrib, "D" ); + if( attrib & FILE_HIDDEN ) + strcat( aatrib, "H" ); + if( attrib & FILE_READONLY ) + strcat( aatrib, "R" ); + if( attrib & FILE_SYSTEM ) + strcat( aatrib, "S" ); + #else + #if defined(_MSC_VER) attrib = entry.attrib; #else attrib = _chmod(fullfile,0); @@ -378,7 +424,7 @@ HARBOUR HB_DIRECTORY( void ) strcat(aatrib,"O"); if (attrib & FA_NOTINDEXED) strcat(aatrib,"X"); - + #endif #endif /* TODO: attribute match rtn */ pos = string; @@ -421,8 +467,10 @@ HARBOUR HB_DIRECTORY( void ) } #if defined(_MSC_VER) while( _findnext( hFile, &entry ) == 0 ); - _findclose( hFile ); +#elif defined(__IBMCPP__) + while( DosFindNext (hFind, &entry, findSize, &findCount) == NO_ERROR && findCount > 0 ); + DosFindClose( hFind ); #else closedir( dir ); #endif @@ -431,7 +479,7 @@ HARBOUR HB_DIRECTORY( void ) hb_itemRelease(pdir); -#if defined(_MSC_VER) +#if defined(_MSC_VER) || defined(__IBMCPP__) } #endif diff --git a/harbour/source/rtl/gt/gtos2.c b/harbour/source/rtl/gt/gtos2.c index b0b3f6fccb..54a0e36d43 100644 --- a/harbour/source/rtl/gt/gtos2.c +++ b/harbour/source/rtl/gt/gtos2.c @@ -127,6 +127,6 @@ void gtPutText(char x1, char y1, char x2, char y2, char *srce) } } -void gtSetAttribute(char x, char y, char attr, char *str, int len) +void gtSetAttribute( char x1, char y1, char x2, char y2, char attribute ) { } diff --git a/harbour/tests/working/dirtest.prg b/harbour/tests/working/dirtest.prg index b440b035da..c5f9d7883d 100644 --- a/harbour/tests/working/dirtest.prg +++ b/harbour/tests/working/dirtest.prg @@ -11,12 +11,16 @@ local x := 0 adir := asort( directory(filespec,attribs),,, {|x,y|upper(x[1]) < upper(y[1])} ) for x := 1 to len(adir) - qout(padr(adir[x,1], 20), "|", ; - padl(adir[x,2], 10), "|", ; - padr(adir[x,3], 8), "|", ; - padr(adir[x,4], 8), "|", ; - adir[x,5]) +#ifdef __HARBOUR__ + outstd(chr(10)) +#else + outstd(chr(13)+chr(10)) +#endif + outstd(padr(adir[x,1], 20), "|", ; + padl(adir[x,2], 10), "|", ; + padr(adir[x,3], 8), "|", ; + padr(adir[x,4], 8), "|", ; + adir[x,5]) next x return nil -