diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 6e35539492..6fa4e2ed3d 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,9 @@ +19990619-14:35 CET Matteo Baccan + * makefile.vc, source/hbpp/hbpp.c, source/hbpp/hbppint.c, + source/rtl/environ.c, source/rtl/files.c, source/rtl/gt/gtwin.c, + source/tools/hb_f.c + Patches to allow for succesful compilation with MS Visual C++ + 19990619-14:00 Ryszard Glab * tests/working/testcgi.prg diff --git a/harbour/makefile.vc b/harbour/makefile.vc index 7330cea49d..a972d29332 100644 --- a/harbour/makefile.vc +++ b/harbour/makefile.vc @@ -15,6 +15,7 @@ COMPILER_DIR=source\compiler RTL_DIR=source\rtl +HBPP_DIR=source\hbpp TOOLS_DIR=source\tools VM_DIR=source\vm INCLUDE_DIR=include @@ -28,7 +29,8 @@ OBJ_DIR=obj CC=cl CFLAGS=-w -I$(INCLUDE_DIR) -CLIBFLAGS=$(CFLAGS) -c -Zi /TP +CLIBFLAGS=$(CFLAGS) -c /TP +CLIBFLAGSDEBUG=$(CFLAGS) -c -Zi /TP # # Macros to access our library names @@ -123,10 +125,17 @@ $(HARBOUR_EXE) : \ $(COMPILER_DIR)\harboury.c \ $(COMPILER_DIR)\harbourl.c \ $(COMPILER_DIR)\genobj32.c \ - $(COMPILER_DIR)\harbour.c - $(CC) $(CFLAGS) $(COMPILER_DIR)\harboury.c $(COMPILER_DIR)\harbourl.c $(COMPILER_DIR)\harbour.obj -o $(BIN_DIR)\harbour + $(COMPILER_DIR)\harbour.c \ + $(HBPP_DIR)\hbpp.c \ + $(HBPP_DIR)\hbppint.c \ + $(HBPP_DIR)\table.c + $(CC) $(CFLAGS) $(COMPILER_DIR)\harboury.c $(COMPILER_DIR)\harbourl.c $(COMPILER_DIR)\harbour.c $(HBPP_DIR)\hbppint.c $(HBPP_DIR)\hbpp.c $(HBPP_DIR)\table.c -o $(BIN_DIR)\harbour -del harboury.obj -del harbourl.obj + -del harbour.obj + -del hbppint.obj + -del hbpp.obj + -del table.obj # # Library depencies and build rules @@ -145,11 +154,11 @@ $(TERMINAL_LIB) : $(TERMINAL_LIB_OBJS) # Compiler source depencies and build rules # -#$(COMPILER_DIR)\harboury.c : $(COMPILER_DIR)\harbour.y -# bison -d -v $(COMPILER_DIR)\harbour.y -o$(COMPILER_DIR)\harboury.c -# -#$(COMPILER_DIR)\harbourl.c : $(COMPILER_DIR)\harbour.l -# flex -i -o$(COMPILER_DIR)\harbourl.c $(COMPILER_DIR)\harbour.l +$(COMPILER_DIR)\harboury.c : $(COMPILER_DIR)\harbour.y + bison -d -v $(COMPILER_DIR)\harbour.y -o$(COMPILER_DIR)\harboury.c + +$(COMPILER_DIR)\harbourl.c : $(COMPILER_DIR)\harbour.l + flex -i -o$(COMPILER_DIR)\harbourl.c $(COMPILER_DIR)\harbour.l # # RTL source depencies below. Add as needed @@ -195,7 +204,7 @@ $(OBJ_DIR)\extend.obj : $(RTL_DIR)\extend.c $(CC) $(CLIBFLAGS) -Fo$@ $** $(OBJ_DIR)\files.obj : $(RTL_DIR)\files.c - $(CC) $(CLIBFLAGS) /TC -Fo$@ $** + $(CC) $(CLIBFLAGS) -Fo$@ $** $(OBJ_DIR)\gtapi.obj : $(RTL_DIR)\gtapi.c $(CC) $(CLIBFLAGS) -Fo$@ $** @@ -293,7 +302,7 @@ $(OBJ_DIR)\genobj.obj : $(TOOLS_DIR)\genobj.c $(CC) $(CLIBFLAGS) -Fo$@ $** $(OBJ_DIR)\hb_f.obj : $(TOOLS_DIR)\hb_f.c - $(CC) $(CLIBFLAGS) /TC -Fo$@ $** + $(CC) $(CLIBFLAGS) -Fo$@ $** $(OBJ_DIR)\io.obj : $(TOOLS_DIR)\io.c $(CC) $(CLIBFLAGS) -Fo$@ $** diff --git a/harbour/source/hbpp/hbpp.c b/harbour/source/hbpp/hbpp.c index c38cbe2b64..0ac955027f 100644 --- a/harbour/source/hbpp/hbpp.c +++ b/harbour/source/hbpp/hbpp.c @@ -10,7 +10,7 @@ #include #include #else - #if defined(__IBMCPP__) + #if (defined(_MSC_VER) || defined(__IBMCPP__)) #include #else #include diff --git a/harbour/source/hbpp/hbppint.c b/harbour/source/hbpp/hbppint.c index 28ffedfc12..25fabd43b7 100644 --- a/harbour/source/hbpp/hbppint.c +++ b/harbour/source/hbpp/hbppint.c @@ -6,7 +6,7 @@ #include #include #else - #if defined(__IBMCPP__) || defined(__WATCOMC__) + #if (defined(_MSC_VER) || defined(__IBMCPP__) || defined(__WATCOMC__)) #include #include #else diff --git a/harbour/source/rtl/environ.c b/harbour/source/rtl/environ.c index a373d33af2..2dd10efb7d 100644 --- a/harbour/source/rtl/environ.c +++ b/harbour/source/rtl/environ.c @@ -9,7 +9,7 @@ #include #include -#if defined(__TURBOC__) || defined(__BORLANDC__) || defined(__DJGPP__) +#if defined(__TURBOC__) || defined(__BORLANDC__) || defined(__MSC__) || defined(_MSC_VER) || defined(__DJGPP__) #include #include #endif diff --git a/harbour/source/rtl/files.c b/harbour/source/rtl/files.c index 39e3e7a1dd..320ef04a15 100644 --- a/harbour/source/rtl/files.c +++ b/harbour/source/rtl/files.c @@ -35,19 +35,21 @@ #endif #endif -#if defined(__BORLANDC__) || defined(__IBMCPP__) +#if defined(__BORLANDC__) || defined(__IBMCPP__) || defined(_MSC_VER) #include #include #include #include - #if defined(__IBMCPP__) + #if defined(__IBMCPP__) || defined(_MSC_VER) #include #else #include #endif - #if !defined(HAVE_POSIX_IO) - #define HAVE_POSIX_IO + #if !defined(_MSC_VER) + #if !defined(HAVE_POSIX_IO) + #define HAVE_POSIX_IO + #endif #endif #endif @@ -438,6 +440,9 @@ BYTEP hb_fsCurDir ( USHORT uiDrive ) #else cwd_buff[0] = 0; last_error = FS_ERROR; +#endif +#if defined(_MSC_VER) + BYTEP dmm = cwd_buff; #endif return (BYTEP)cwd_buff; } diff --git a/harbour/source/rtl/gt/gtwin.c b/harbour/source/rtl/gt/gtwin.c index 1434b68f95..f34cc7080b 100644 --- a/harbour/source/rtl/gt/gtwin.c +++ b/harbour/source/rtl/gt/gtwin.c @@ -142,7 +142,7 @@ void gtPuts(char x, char y, char attr, char *str, int len) DWORD i, dwlen; COORD coord; LPWORD pwattr; - pwattr = malloc(strlen(str) * sizeof(*pwattr)); + pwattr = (LPWORD) malloc(strlen(str) * sizeof(*pwattr)); if (!pwattr) { return; @@ -165,12 +165,12 @@ void gtGetText(char x1, char y1, char x2, char y2, char *dest) LPWORD pwattr; char y, *pstr; width = (x2 - x1 + 1); - pwattr = malloc(width * sizeof(*pwattr)); + pwattr = (LPWORD) malloc(strlen(str) * sizeof(*pwattr)); if (!pwattr) { return; } - pstr = malloc(width); + pstr = (char *)malloc(width); if (!pstr) { free(pwattr); @@ -201,12 +201,12 @@ void gtPutText(char x1, char y1, char x2, char y2, char *srce) LPWORD pwattr; char y, *pstr; width = (x2 - x1 + 1); - pwattr = malloc(width * sizeof(*pwattr)); + pwattr = (LPWORD) malloc(strlen(str) * sizeof(*pwattr)); if (!pwattr) { return; } - pstr = malloc(width); + pstr = (char *)malloc(width); if (!pstr) { free(pwattr); diff --git a/harbour/source/tools/hb_f.c b/harbour/source/tools/hb_f.c index c4f1ca3e50..335e540b24 100644 --- a/harbour/source/tools/hb_f.c +++ b/harbour/source/tools/hb_f.c @@ -50,7 +50,7 @@ HARBOUR HB_HB_FUSE( void ) else open_flags = 0; - handles[area] = hb_fsOpen( hb_parc(1), open_flags ); + handles[area] = hb_fsOpen( (BYTEP) hb_parc(1), open_flags ); offset[area] = 0; recno[area] = 1; b = ( char * )hb_xgrab( b_size ); @@ -110,7 +110,7 @@ long hb_hbfskip( int recs ) if ( recs > 0 ) { for (y = 0; y < recs; y++ ) { hb_fsSeek( handles[area], offset[area], SEEK_SET ); - read_len = hb_fsRead( handles[area], b, b_size ); + read_len = hb_fsRead( handles[area], (BYTEP) b, b_size ); for (x = 0; x < read_len; x++ ) { if ( ((*(b + x) == 13) && (*(b + x + 1) == 10)) || ((*(b + x) == 10) && (*(b + x + 1) == 13)) ) { @@ -144,7 +144,7 @@ long hb_hbfskip( int recs ) } hb_fsSeek( handles[area], read_pos, SEEK_SET ); - read_len = hb_fsRead( handles[area], b, read_len ); + read_len = hb_fsRead( handles[area], (BYTEP) b, read_len ); for (x = read_len - 4; x >= 0; x-- ) { if ( ((*(b + x) == 13) && (*(b + x + 1) == 10)) || @@ -174,7 +174,7 @@ HARBOUR HB_HB_FREADLN( void ) long read; hb_fsSeek( handles[area], offset[area], SEEK_SET ); - read = hb_fsRead( handles[area], b, b_size ); + read = hb_fsRead( handles[area], (BYTEP) b, b_size ); for ( x = 0; x < b_size; x++ ) { if ( ((*(b + x) == 13) && (*(b + x + 1) == 10)) || @@ -242,7 +242,7 @@ HARBOUR HB_HB_FGOBOTTOM(void) do { hb_fsSeek( handles[area], offset[area], SEEK_SET ); - len = hb_fsRead( handles[area], c, c_size ); + len = hb_fsRead( handles[area], (BYTEP) c, c_size ); for ( x = 0; x < len; x++ ) { if ( ((*(c + x) == 13) && (*(c + x + 1) == 10)) || ((*(c + x) == 10) && (*(c + x + 1) == 13)) ||