diff --git a/harbour/ChangeLog b/harbour/ChangeLog index ea80a88b4d..e0254d9c5b 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,20 +1,27 @@ +20000510-22:01 GMT+2 Maurilio Longo + + * source/vm/fm.c + + Added OS/2 support to Memory() function + * source/compiler/harbour.c + ! fixed hb_compFunctionNew() define conflicting with actual implementation + 20000510-03:00 GMT-8 Ron Pinkas * include/hbcomp.h + Added new structures COMCLASS and COMMETHOD + Added new element pClass to structure VAR + Added: - extern PCOMCLASS hb_compClassAdd( char * ); - extern PCOMCLASS hb_compClassFind( char * ); - extern PCOMMETHOD hb_compMethodAdd( PCOMCLASS pClass, char * ); - extern PCOMMETHOD hb_compMethodFind( PCOMCLASS pClass, char * ); + extern PCOMCLASS hb_compClassAdd( char * ); + extern PCOMCLASS hb_compClassFind( char * ); + extern PCOMMETHOD hb_compMethodAdd( PCOMCLASS pClass, char * ); + extern PCOMMETHOD hb_compMethodFind( PCOMCLASS pClass, char * ); * source/compiler/harbour.c + Added: - PCOMCLASS hb_compClassAdd( char * ); - PCOMCLASS hb_compClassFind( char * ); - PCOMMETHOD hb_compMethodAdd( PCOMCLASS pClass, char * ); - PCOMMETHOD hb_compMethodFind( PCOMCLASS pClass, char * ); + PCOMCLASS hb_compClassAdd( char * ); + PCOMCLASS hb_compClassFind( char * ); + PCOMMETHOD hb_compMethodAdd( PCOMCLASS pClass, char * ); + PCOMMETHOD hb_compMethodFind( PCOMCLASS pClass, char * ); * Modified hb_compVariableAdd() to process params of declared class methods. * source/compiler/harbour.l diff --git a/harbour/source/compiler/harbour.c b/harbour/source/compiler/harbour.c index 75f8f89667..e9109e69ca 100644 --- a/harbour/source/compiler/harbour.c +++ b/harbour/source/compiler/harbour.c @@ -68,7 +68,7 @@ static void hb_compGenFieldPCode( BYTE , int, char *, PFUNCTION ); /* gener static void hb_compGenVariablePCode( BYTE , char * ); /* generates the pcode for undeclared variable */ static void hb_compGenVarPCode( BYTE , char * ); /* generates the pcode for undeclared variable */ -static PFUNCTION hb_compFunctionNew( char *, BYTE ); /* creates and initialises the _FUNC structure */ +static PFUNCTION hb_compFunctionNew( char *, HB_SYMBOLSCOPE ); /* creates and initialises the _FUNC structure */ static void hb_compCheckDuplVars( PVAR pVars, char * szVarName ); /*checks for duplicate variables definitions */ //int hb_compSort_ULONG( ULONG * ulLeft, ULONG * ulRight ); @@ -1083,7 +1083,7 @@ void hb_compFunctionAdd( char * szFunName, HB_SYMBOLSCOPE cScope, int iType ) hb_xfree( pBuffer ); } - hb_comp_bDontGenLineNum = FALSE; /* reset the flag */ + hb_comp_bDontGenLineNum = FALSE; /* reset the flag */ } /* create an ANNOUNCEd procedure diff --git a/harbour/source/vm/fm.c b/harbour/source/vm/fm.c index b43e018b75..990323ade4 100644 --- a/harbour/source/vm/fm.c +++ b/harbour/source/vm/fm.c @@ -55,6 +55,13 @@ #include #endif +#if (defined(__EMX__) && ! defined(__RSXNT__)) || defined(OS2) || defined(__OS2__) || defined(OS_2) + #define INCL_BASE + #define INCL_DOSMISC + #define INCL_DOSERRORS + #define INCL_DOSPROCESS +#endif + #include "hbapi.h" #include "hbapierr.h" #include "hbmemory.ch" @@ -485,6 +492,18 @@ ULONG hb_xquery( USHORT uiMode ) GlobalMemoryStatus( &memorystatus ); ulResult = memorystatus.dwAvailPhys / 1024; } + #elif defined(HB_OS_OS2) + { + ULONG ulSysInfo = 0; + APIRET rc; + + rc = DosQuerySysInfo(QSV_TOTAVAILMEM, QSV_TOTAVAILMEM, &ulSysInfo, sizeof(ULONG)); + if (rc != NO_ERROR) { + ulResult = 0; + } else { + ulResult = ulSysInfo / 1024; + } + } #else ulResult = 9999; #endif @@ -497,6 +516,18 @@ ULONG hb_xquery( USHORT uiMode ) GlobalMemoryStatus( &memorystatus ); ulResult = HB_MIN( memorystatus.dwAvailPhys, ULONG_MAX ) / 1024; } + #elif defined(HB_OS_OS2) + { + ULONG ulSysInfo = 0; + APIRET rc; + + rc = DosQuerySysInfo(QSV_TOTAVAILMEM, QSV_TOTAVAILMEM, &ulSysInfo, sizeof(ULONG)); + if (rc != NO_ERROR) { + ulResult = 0; + } else { + ulResult = HB_MIN(ulSysInfo, ULONG_MAX) / 1024; + } + } #else ulResult = 9999; #endif @@ -509,6 +540,18 @@ ULONG hb_xquery( USHORT uiMode ) GlobalMemoryStatus( &memorystatus ); ulResult = memorystatus.dwAvailPhys / 1024; } + #elif defined(HB_OS_OS2) + { + ULONG ulSysInfo = 0; + APIRET rc; + + rc = DosQuerySysInfo(QSV_TOTAVAILMEM, QSV_TOTAVAILMEM, &ulSysInfo, sizeof(ULONG)); + if (rc != NO_ERROR) { + ulResult = 0; + } else { + ulResult = ulSysInfo / 1024; + } + } #else ulResult = 9999; #endif @@ -521,13 +564,25 @@ ULONG hb_xquery( USHORT uiMode ) GlobalMemoryStatus( &memorystatus ); ulResult = memorystatus.dwAvailVirtual / 1024; } + #elif defined(HB_OS_OS2) + { + ULONG ulSysInfo = 0; + APIRET rc; + + rc = DosQuerySysInfo(QSV_TOTAVAILMEM, QSV_TOTAVAILMEM, &ulSysInfo, sizeof(ULONG)); + if (rc != NO_ERROR) { + ulResult = 0; + } else { + ulResult = ulSysInfo / 1024; + } + } #else ulResult = 9999; #endif break; case HB_MEM_EMS: /* UNDOCUMENTED! (Free Expanded Memory [KB]) (?) */ - #if defined(HB_OS_WIN_32) + #if defined(HB_OS_WIN_32) || defined(HB_OS_OS2) ulResult = 0; #else ulResult = 9999; @@ -541,13 +596,25 @@ ULONG hb_xquery( USHORT uiMode ) GlobalMemoryStatus( &memorystatus ); ulResult = memorystatus.dwTotalPhys / 1024; } + #elif defined(HB_OS_OS2) + { + ULONG ulSysInfo = 0; + APIRET rc; + + rc = DosQuerySysInfo(QSV_MAXPRMEM, QSV_MAXPRMEM, &ulSysInfo, sizeof(ULONG)); + if (rc != NO_ERROR) { + ulResult = 0; + } else { + ulResult = ulSysInfo / 1024; + } + } #else ulResult = 9999; #endif break; case HB_MEM_FMSEGS: /* UNDOCUMENTED! (Segments in Fixed Memory/Heap) (?) */ - #if defined(HB_OS_WIN_32) + #if defined(HB_OS_WIN_32) || defined(HB_OS_OS2) ulResult = 1; #else ulResult = 9999; @@ -561,13 +628,21 @@ ULONG hb_xquery( USHORT uiMode ) GlobalMemoryStatus( &memorystatus ); ulResult = memorystatus.dwAvailPageFile / 1024; } + #elif defined(HB_OS_OS2) + { + /* 10/05/2000 - maurilio.longo@libero.it + There is no way to know how much a swap file can grow on an OS/2 system. + I think we should return free space on DASD media which contains swap + file */ + ulResult = 0; + } #else ulResult = 9999; #endif break; case HB_MEM_CONV: /* UNDOCUMENTED! (Free Conventional [KB]) */ - #if defined(HB_OS_WIN_32) + #if defined(HB_OS_WIN_32) || defined(HB_OS_OS2) ulResult = 0; #else ulResult = 9999;