19990917-04:58 GMT+1
This commit is contained in:
@@ -1,3 +1,17 @@
|
||||
19990917-04:58 GMT+1 Victor Szel <info@szelvesz.hu>
|
||||
|
||||
* source/vm/hvm.c
|
||||
+ Added WORD typedef for HARBOUR_OBJ_GENERATION section.
|
||||
* source/rtl/memofile.c
|
||||
+ Added, this time for sure.
|
||||
* makefile.vc
|
||||
! Now in alphabetical order.
|
||||
* source/compiler/harbour.y
|
||||
+ Now the compiler shows if a message is a YACC error.
|
||||
* source/rtl/console.c
|
||||
+ hb_max_row() now returns 23 for UNIXes and 24 otherwise.
|
||||
% fputs(" "...) -> fputc(' '...)
|
||||
|
||||
19990917-03:22 GMT+1 Victor Szel <info@szelvesz.hu>
|
||||
|
||||
* source/rtl/memofile.c
|
||||
|
||||
@@ -412,15 +412,15 @@ $(OBJ_DIR)\langapi.obj : $(RTL_DIR)\langapi.c
|
||||
$(OBJ_DIR)\math.obj : $(RTL_DIR)\math.c
|
||||
$(CC) $(CLIBFLAGS) -Fo$@ $**
|
||||
|
||||
$(OBJ_DIR)\memofile.obj : $(RTL_DIR)\memofile.c
|
||||
$(CC) $(CLIBFLAGS) -Fo$@ $**
|
||||
|
||||
$(RTL_DIR)\memvarbl.c : $(RTL_DIR)\memvarbl.prg
|
||||
$(HARBOUR_EXE) $** $(HARBOURFLAGS) -o$@
|
||||
|
||||
$(OBJ_DIR)\memvarbl.obj : $(RTL_DIR)\memvarbl.c
|
||||
$(CC) $(CLIBFLAGS) -Fo$@ $**
|
||||
|
||||
$(OBJ_DIR)\memofile.obj : $(RTL_DIR)\memofile.c
|
||||
$(CC) $(CLIBFLAGS) -Fo$@ $**
|
||||
|
||||
$(OBJ_DIR)\memvars.obj : $(RTL_DIR)\memvars.c
|
||||
$(CC) $(CLIBFLAGS) -Fo$@ $**
|
||||
|
||||
|
||||
@@ -307,7 +307,7 @@ char * _szCErrors[] =
|
||||
"Memory allocation error",
|
||||
"Memory reallocation error",
|
||||
"Freeing a NULL memory pointer",
|
||||
"%s", /* YACC error messages */
|
||||
"Parser says: \"%s\"",
|
||||
"Jump offset too long",
|
||||
"Can't create output file: \'%s\'",
|
||||
"Can't create preprocessed output file: \'%s\'",
|
||||
|
||||
@@ -156,7 +156,11 @@ USHORT hb_max_row( void )
|
||||
#ifdef HARBOUR_USE_GTAPI
|
||||
return hb_gtMaxRow();
|
||||
#else
|
||||
return 23; /* NOTE: Intentionally 23 to match Unix terminals */
|
||||
#if defined(HB_OS_UNIX_COMPATIBLE)
|
||||
return 23;
|
||||
#else
|
||||
return 24;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -498,7 +502,7 @@ void hb_setpos( USHORT row, USHORT col )
|
||||
for( uiCount = s_uiDevRow; uiCount < row; uiCount++ )
|
||||
fputs( s_szCrLf, stdout );
|
||||
for( uiCount = s_uiDevCol; uiCount < col; uiCount++ )
|
||||
fputs( " ", stdout );
|
||||
fputc( ' ', stdout );
|
||||
#endif
|
||||
|
||||
s_uiDevRow = row;
|
||||
|
||||
118
harbour/source/rtl/memofile.c
Normal file
118
harbour/source/rtl/memofile.c
Normal file
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* MEMOWRIT()/MEMOREAD() functions
|
||||
*
|
||||
* Copyright 1999 Victor Szel <info@szelvesz.hu>
|
||||
* www - http://www.harbour-project.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version, with one exception:
|
||||
*
|
||||
* The exception is that if you link the Harbour Runtime Library (HRL)
|
||||
* and/or the Harbour Virtual Machine (HVM) with other files to produce
|
||||
* an executable, this does not by itself cause the resulting executable
|
||||
* to be covered by the GNU General Public License. Your use of that
|
||||
* executable is in no way restricted on account of linking the HRL
|
||||
* and/or HVM code into it.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit
|
||||
* their web site at http://www.gnu.org/).
|
||||
*
|
||||
*/
|
||||
|
||||
#include "extend.h"
|
||||
#include "itemapi.h"
|
||||
#include "filesys.h"
|
||||
|
||||
/* NOTE: CA-Clipper has 64K (65516 bytes exactly) limit on read, in Harbour
|
||||
this limit is extended, so we are not *stricly* compatible here. */
|
||||
|
||||
HARBOUR HB_MEMOREAD( void )
|
||||
{
|
||||
PHB_ITEM pFileName = hb_param( 1, IT_STRING );
|
||||
|
||||
if( pFileName )
|
||||
{
|
||||
FHANDLE fhnd = hb_fsOpen( ( BYTE * ) hb_itemGetCPtr( pFileName ), FO_READ | FO_SHARED | FO_PRIVATE );
|
||||
|
||||
if( fhnd != FS_ERROR )
|
||||
{
|
||||
ULONG ulSize = hb_fsSeek( fhnd, -sizeof( BYTE ), FS_END ) + sizeof( BYTE );
|
||||
BYTE * pbyBuffer;
|
||||
|
||||
/* Don't read the file terminating EOF character */
|
||||
|
||||
#if ! defined(HB_OS_UNIX_COMPATIBLE)
|
||||
{
|
||||
BYTE byEOF = HB_CHAR_NUL;
|
||||
|
||||
hb_fsRead( fhnd, &byEOF, sizeof( BYTE ) );
|
||||
|
||||
if( byEOF == HB_CHAR_EOF )
|
||||
ulSize--;
|
||||
}
|
||||
#endif
|
||||
|
||||
pbyBuffer = ( BYTE * ) hb_xgrab( ulSize + sizeof( char ) );
|
||||
|
||||
hb_fsSeek( fhnd, 0, FS_SET );
|
||||
hb_fsReadLarge( fhnd, pbyBuffer, ulSize );
|
||||
|
||||
hb_fsClose( fhnd );
|
||||
|
||||
hb_itemPutCPtr( hb_itemReturnPtr(), ( char * ) pbyBuffer, ulSize );
|
||||
}
|
||||
else
|
||||
hb_retc( "" );
|
||||
}
|
||||
else
|
||||
hb_retc( "" );
|
||||
}
|
||||
|
||||
HARBOUR HB_MEMOWRIT( void )
|
||||
{
|
||||
PHB_ITEM pFileName = hb_param( 1, IT_STRING );
|
||||
PHB_ITEM pString = hb_param( 2, IT_STRING );
|
||||
BOOL bRetVal = FALSE;
|
||||
|
||||
if( pFileName && pString )
|
||||
{
|
||||
FHANDLE fhnd = hb_fsCreate( ( BYTE * ) hb_itemGetCPtr( pFileName ), FC_NORMAL );
|
||||
|
||||
if( fhnd != FS_ERROR )
|
||||
{
|
||||
ULONG ulSize = hb_itemGetCLen( pString );
|
||||
|
||||
bRetVal = ( hb_fsWriteLarge( fhnd, ( BYTE * ) hb_itemGetCPtr( pString ), ulSize ) == ulSize );
|
||||
|
||||
/* NOTE: CA-Clipper will add the EOF even if the write failed. */
|
||||
/* NOTE: CA-Clipper will not return .F. when the EOF could not be written. */
|
||||
#if ! defined(HB_OS_UNIX_COMPATIBLE)
|
||||
{
|
||||
BYTE byEOF = HB_CHAR_EOF;
|
||||
|
||||
hb_fsWrite( fhnd, &byEOF, sizeof( BYTE ) );
|
||||
}
|
||||
#endif
|
||||
|
||||
hb_fsClose( fhnd );
|
||||
}
|
||||
}
|
||||
|
||||
hb_retl( bRetVal );
|
||||
}
|
||||
|
||||
|
||||
@@ -78,6 +78,18 @@ static void hb_vmDebuggerEndProc( void ); /* notifies the debugger for an end
|
||||
static void hb_vmArrayNew( HB_ITEM_PTR, USHORT ); /* creates array */
|
||||
|
||||
#ifdef HARBOUR_OBJ_GENERATION
|
||||
|
||||
/* TODO: Remove these (WORD/DWORD) when the compiler is cleaned up from them. */
|
||||
#if defined(__IBMCPP__)
|
||||
#undef WORD /* 2 bytes unsigned */
|
||||
typedef unsigned short int WORD;
|
||||
#else
|
||||
#if ! defined(HB_DONT_DEFINE_BASIC_TYPES)
|
||||
#undef WORD /* 2 bytes unsigned */
|
||||
typedef unsigned short int WORD;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static void hb_vmProcessObjSymbols ( void ); /* process Harbour generated OBJ symbols */
|
||||
|
||||
typedef struct
|
||||
|
||||
Reference in New Issue
Block a user