20000327-01:24 GMT+1 Victor Szakats <info@szelvesz.hu>

This commit is contained in:
Viktor Szakats
2000-03-26 23:34:42 +00:00
parent 3f44251800
commit b1f14b661e
15 changed files with 898 additions and 77 deletions

View File

@@ -1,3 +1,39 @@
20000327-01:24 GMT+1 Victor Szakats <info@szelvesz.hu>
- doc/cvshowto.txt
+ doc/howtocvs.txt
+ doc/howtomak.txt
+ Enhanced the CVS upload guide.
+ Added guide how to make Harbour binary from the source.
* makefile.*
+ C_USR and PRG_USR GNU-make style envvars are now working with MSVC
and Borland makefiles.
+ contrib/runjava/bld_java.bat
+ contrib/runjava/make_vc.bat
+ contrib/runjava/Harbour.java
+ contrib/runjava/hbrunj.h
+ contrib/runjava/runjava.c
+ contrib/runjava/makefile.vc
+ The JAVA runner contribution has been added to a new directory
along with all the support files needed to make it work.
Thanks to Matteo Baccan for this contribution.
; !! WARNING !! I could not test this since I don't have the java
tools needed.
* makefile.vc
* make_vc.bat
- The JAVA runtime generation feature removed. (see previous entry)
* source/vm/debug.c
* One static function renamed.
* include/clipdefs.h
! pascal keyword removed from here, too. So the rule has changed that
all mixed or lower case CLIPPER function names should be converted to
uppercase to make it work with Harbour.
20000326-16:58 EST Paul Tucker <ptucker@sympatico.ca>
* source/rtl/gtwin/gtwin.c
* further refinement on screen sizing. Size is now restored on exit.
@@ -32,7 +68,7 @@
* Now the HARBOUR keyword requires the function name to be in uppercase.
The compatibility CLIPPER keyword still allows for mixed case function
names on some platforms. The reason is that "pascal" keyword is
non-portable, and the above requiremenet was already there for some
non-portable, and the above requirement was already there for some
platforms, now it's a generic rule.
- Removed the __attribute__ ((stdcall)) for the __GNUC__ branch. Setting
any specific calling convention is not needed, since we don't need to
@@ -43,7 +79,7 @@
* source/pp/ppcore.c
+ Added predefined macro __HB_MAIN__. The macro is undefined or holds the
value of HARBOUR_START_PROCEDURE depending on the compiler.
Use this code to make your Harbour startup procedure platform
Use this code to make your Harbour startup procedure platform/compiler
independent:
#ifndef __HB_MAIN__
#define __HB_MAIN__ AppMain /* Or whatever you wish to call it */
@@ -52,7 +88,7 @@
+ contrib/hbclip/hbclip.h
+ Added header file which can be used to maintain common C source code
for CA-Cl*pper and Harbour. The legacy code need a one-time conversion
for CA-Cl*pper and Harbour. The legacy code needs a one-time conversion
to make this work.
* source/rtl/dir.c
@@ -189,9 +225,6 @@
*utils/hbdoc/genrtf.prg
source/tools/rtf.prg
* some fixes and a small enhacement
* source/pp/pragma.c
* contrib/dot/pp_harb.ch
* tests/inline_c.prg

View File

@@ -0,0 +1,17 @@
/*
* $Id$
*/
/**
* Harbour JAVA interface
* @author Matteo Baccan
* @version 1.0
*/
public class Harbour {
public static native long Run( int[] pCode );
// DLL to load
static { System.loadLibrary("hbrunjav"); }
}

View File

@@ -0,0 +1,26 @@
@echo off
rem
rem $Id$
rem
rem Harbour executable builder batch file
rem
rem Compiler: JAVA
rem Platform: 32-bit Windows
rem
if not "%1" == "" goto COMPILE
echo.
echo Usage: bld_java.bat name
echo.
echo - 'name' is the .prg filename *without* extension.
echo - Don't forget to make a MAIN function for you application.
echo - This batch file assumes you are two level deeper than the main harbour dir
exit
:COMPILE
..\..\bin\harbour %1.prg /n /gj /i..\..\include
javac %1.java

View File

@@ -0,0 +1,55 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* Header file for the Cursor style constants
*
* Copyright 1999 Matteo Baccan <baccan@isanet.it>
* 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 <jni.h>
/* Header for class Harbour */
#ifndef HB_RUNJ_H_
#define HB_RUNJ_H_
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: Harbour
* Method: Run
* Signature: ([B)J
*/
JNIEXPORT jlong JNICALL Java_Harbour_Run
(JNIEnv *, jclass, jintArray);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,30 @@
@echo off
rem
rem $Id$
rem
if "%1" == "clean" goto CLEAN
if "%1" == "CLEAN" goto CLEAN
:BUILD
nmake /f makefile.vc %1 %2 %3 > make_vc.log
if errorlevel 1 goto BUILD_ERR
:BUILD_OK
copy ..\..\bin\vc\*.dll ..\..\bin\*.* > nul
copy ..\..\obj\vc\*.class ..\..\bin\*.* > nul
goto EXIT
:BUILD_ERR
notepad make_vc.log
goto EXIT
:CLEAN
goto EXIT
:EXIT

View File

@@ -0,0 +1,102 @@
#
# $Id$
#
#
# Makefile for Harbour Project JAVA support for Microsoft Visual C (32 bits)
#
#
# Directory macros. These should never have to change.
#
INCLUDE_DIR = ..\..\include
OBJ_DIR = ..\..\obj\vc
LIB_DIR = ..\..\lib\vc
BIN_DIR = ..\..\bin\vc
#
# C compiler definition and C flags. These should never have to change.
#
CFLAGS = -I$(INCLUDE_DIR) -I. -TP -W3 -nologo $(C_USR) $(CFLAGS)
CLIBFLAGS = -c $(CFLAGS) $(CLIBFLAGS)
CLIBFLAGSDEBUG = -Zi $(CLIBFLAGS)
#
# Macros to access our library names
#
COMMON_LIB = $(LIB_DIR)\common.lib
DBFCDX_LIB = $(LIB_DIR)\dbfcdx.lib
DBFNTX_LIB = $(LIB_DIR)\dbfntx.lib
DEBUG_LIB = $(LIB_DIR)\debug.lib
MACRO_LIB = $(LIB_DIR)\macro.lib
NULSYS_LIB = $(LIB_DIR)\nulsys.lib
PP_LIB = $(LIB_DIR)\pp.lib
RDD_LIB = $(LIB_DIR)\rdd.lib
RTL_LIB = $(LIB_DIR)\rtl.lib
TOOLS_LIB = $(LIB_DIR)\tools.lib
VM_LIB = $(LIB_DIR)\vm.lib
GTPCA_LIB = $(LIB_DIR)\gtpca.lib
GTSTD_LIB = $(LIB_DIR)\gtstd.lib
GTWIN_LIB = $(LIB_DIR)\gtwin.lib
#
# Macros to access our target names
#
HBRUNJAV_DLL = $(BIN_DIR)\hbrunjav.dll
HBRUNJAV_CLASS = $(OBJ_DIR)\Harbour.class
#
#
#
!ifndef HB_GT_LIB
HB_GT_LIB = $(GTWIN_LIB)
!endif
LIBLIST = \
$(RTL_LIB) \
$(COMMON_LIB) \
$(DEBUG_LIB) \
$(MACRO_LIB) \
$(PP_LIB) \
$(RDD_LIB) \
$(DBFCDX_LIB) \
$(DBFNTX_LIB) \
$(NULSYS_LIB) \
$(TOOLS_LIB) \
$(VM_LIB) \
$(HB_GT_LIB)
#
# macro.lib needs to be listed twice
#
LIBS = \
$(LIBLIST) \
$(MACRO_LIB)
#
# Our default target
#
all: \
$(HBRUNJAV_DLL) \
$(HBRUNJAV_CLASS)
#
# HBRUNJAV.DLL rules (to compile this you must have a JDK installed)
#
$(HBRUNJAV_DLL) : runjava.c
$(CC) $(CFLAGS) -Fo$(OBJ_DIR)\ runjava.c -o $(HBRUNJAV_DLL) /link-dll $(LIBS)
-del $(BIN_DIR)\hbrunjav.exp
-del $(BIN_DIR)\hbrunjav.lib
$(HBRUNJAV_CLASS) : Harbour.java
javac Harbour.java -d $(OBJ_DIR)\

View File

@@ -0,0 +1,475 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* Harbour Portable Object (.HRB) file runner
*
* Copyright 1999 Matteo Baccan <baccan@isanet.it>
* Based on runlib.c of Eddie Runia <eddie@runia.com>
* 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 "hbapi.h"
#include "hbapiitm.h"
#include "hbapierr.h"
#include "hbapifs.h"
#include "hbvm.h"
#include "hbpcode.h"
/* Specific define for java runner */
#include "hbrunj.h"
/* TODO: Separate the loading/unloading and the caller functions,
this way we could also call a specific function name from the
.HRB file. This way we have basically reproduced the DLL
functionality of Blinker.
hnd := __hrbLoad( "MYHRB.HRB" )
IF hnd != 0
__hrbDo( hnd, "MYINITFUNC", par1, par2 )
funhnd := __hrbGetHnd( hnd, "MYINITFUNC" )
__hrbDoHnd( funhnd, par1, par2 )
__hrbUnLoad( hnd )
ENDIF
*/
/* TODO: Fill the error codes with valid ones (instead of 9999) */
/* TOFIX: Change this assembler hack to something standard and portable */
/* TODO: Change the fopen()/fread()/fclose() calls to hb_fs*() */
/* TOFIX: Fix the memory leak on error. */
/* NOTE: This is the assembler output from : hb_vmExecute( pcode, symbols ). */
/* #if INTEL32 */
static BYTE prgFunction[] =
{
0x68, 0x00, 0x00, 0x00, 0x00, /* push offset pcode */
0x68, 0x00, 0x00, 0x00, 0x00, /* push offset symbols */
0xE8, 0x00, 0x00, 0x00, 0x00, /* call near relative hb_vmExecute */
0x83, 0xC4, 0x08, /* add esp, 8 */
0xC3 /* ret near */
};
/* #elseif INTEL16 */
/* #elseif MOTOROLA */
/* #elseif ... */
/* #endif */
typedef union
{
BYTE * pAsmData; /* The assembler bytes */
PHB_FUNC pFunPtr; /* The (dynamic) harbour
function */
} ASM_CALL, * PASM_CALL;
typedef struct
{
char * szName; /* Name of the function */
PASM_CALL pAsmCall; /* Assembler call */
BYTE * pCode; /* P-code */
} HB_DYNF, * PHB_DYNF;
#define SYM_NOLINK 0 /* Symbol does not have to
be linked */
#define SYM_FUNC 1 /* Defined function */
#define SYM_EXTERN 2 /* Prev. defined function */
#define SYM_NOT_FOUND 0xFFFFFFFF /* Symbol not found.
FindSymbol */
static ULONG hb_hrbFindSymbol( char * szName, PHB_DYNF pDynFunc, ULONG ulLoaded );
static PASM_CALL hb_hrbAsmCreateFun( PHB_SYMB pSymbols, BYTE * pCode ); /* Create a dynamic function*/
static void hb_hrbAsmPatch( BYTE * pCode, ULONG ulOffset, void * Address );
static void hb_hrbAsmPatchRelative( BYTE * pCode, ULONG ulOffset, void * Address, ULONG ulNext );
static void hb_hrbFileRead( char * file, char * cBuffer, int iSize, int iCount );
static BYTE hb_hrbFileReadByte( char * file );
static char * hb_hrbFileReadId( char * file );
static long hb_hrbFileReadLong( char * file );
static ULONG s_ulSymEntry = 0; /* Link enhancement */
JNIEXPORT jlong JNICALL Java_Harbour_Run( JNIEnv *env,
jclass obj,
jintArray pCode )
{
ULONG ulSymbols; /* Number of symbols */
ULONG ulFuncs; /* Number of functions */
ULONG ulSize; /* Size of function */
ULONG ul, ulPos;
PHB_SYMB pSymRead; /* Symbols read */
PHB_DYNF pDynFunc; /* Functions read */
PHB_DYNS pDynSym;
int i;
jlong bError = FALSE;
jint* dmm = env->GetIntArrayElements( pCode, 0 );
int nPos = env->GetArrayLength( pCode );
char * file = (char*)hb_xgrab( nPos );
while( nPos>0 ){
file[nPos-1] = (char)dmm[nPos-1];
nPos--;
}
env->ReleaseIntArrayElements( pCode, dmm, 0 );
/* initialize internal data structures */
hb_cmdargInit( __argc, __argv );
hb_vmInit( FALSE );
ulSymbols = hb_hrbFileReadLong( file );
pSymRead = ( PHB_SYMB ) hb_xgrab( ulSymbols * sizeof( HB_SYMB ) );
for( ul = 0; ul < ulSymbols; ul++ ) /* Read symbols in .HRB */
{
pSymRead[ ul ].szName = hb_hrbFileReadId( file );
pSymRead[ ul ].cScope = hb_hrbFileReadByte( file );
pSymRead[ ul ].pFunPtr = ( PHB_FUNC ) ( ULONG ) hb_hrbFileReadByte( file );
pSymRead[ ul ].pDynSym = NULL;
}
ulFuncs = hb_hrbFileReadLong( file ); /* Read number of functions */
pDynFunc = ( PHB_DYNF ) hb_xgrab( ulFuncs * sizeof( HB_DYNF ) );
for( ul = 0; ul < ulFuncs; ul++ ) /* Read symbols in .HRB */
{
pDynFunc[ ul ].szName = hb_hrbFileReadId( file );
ulSize = hb_hrbFileReadLong( file ); /* Read size of function */
pDynFunc[ ul ].pCode = ( BYTE * ) hb_xgrab( ulSize );
hb_hrbFileRead( file, ( char * ) pDynFunc[ ul ].pCode, 1, ulSize );
/* Read the block */
pDynFunc[ ul ].pAsmCall = hb_hrbAsmCreateFun( pSymRead,
pDynFunc[ ul ].pCode );
/* Create matching dynamic */
/* function */
}
s_ulSymEntry = 0;
for( ul = 0; ul < ulSymbols; ul++ ) /* Linker */
{
if( ( ( ULONG ) pSymRead[ ul ].pFunPtr ) == SYM_FUNC )
{
ulPos = hb_hrbFindSymbol( pSymRead[ ul ].szName, pDynFunc, ulFuncs );
if( ulPos != SYM_NOT_FOUND )
{
/* Exists and NOT static ? */
/* if( hb_dynsymFind( pSymRead[ ul ].szName ) &&
!( pSymRead[ ul ].cScope & FS_STATIC ) )
{
hb_errRT_BASE( EG_ARG, 9999, "Duplicate symbol", pSymRead[ ul ].szName );
bError = TRUE;
break;
}
*/
pSymRead[ ul ].pFunPtr = pDynFunc[ ulPos ].pAsmCall->pFunPtr;
}
else
pSymRead[ ul ].pFunPtr = ( PHB_FUNC ) SYM_EXTERN;
}
if( ( ( ULONG ) pSymRead[ ul ].pFunPtr ) == SYM_EXTERN )
{ /* External function */
pDynSym = hb_dynsymFind( pSymRead[ ul ].szName );
if( !pDynSym )
{
hb_errRT_BASE( EG_ARG, 9999, "Unknown or unregistered symbol", pSymRead[ ul ].szName );
bError = TRUE;
break;
}
pSymRead[ ul ].pFunPtr = pDynSym->pFunPtr;
}
}
if( ! bError )
{
PHB_ITEM pRetVal;
hb_vmProcessSymbols( pSymRead, ( USHORT ) ulSymbols );
/* Initialize static variables first
*/
for( ul = 0; ul < ulSymbols; ul++ ) /* Check INIT functions */
{
if( ( pSymRead[ ul ].cScope & HB_FS_INITEXIT ) == HB_FS_INITEXIT )
{
/* call (_INITSTATICS) function. This function assigns
* literal values to static variables only. There is no need
* to pass any parameters to this function because they
* cannot be used to initialize static variable.
*/
pSymRead[ ul ].pFunPtr();
}
}
for( ul = 0; ul < ulSymbols; ul++ ) /* Check INIT functions */
{
if( ( pSymRead[ ul ].cScope & HB_FS_INITEXIT ) == HB_FS_INIT )
{
hb_vmPushSymbol( pSymRead + ul );
hb_vmPushNil();
for( i = 0; i < ( hb_pcount() - 1 ); i++ )
hb_vmPush( hb_param( i + 2, IT_ANY ) );
/* Push other cmdline params*/
hb_vmDo( hb_pcount() - 1 ); /* Run init function */
}
}
hb_vmPushSymbol( pSymRead );
hb_vmPushNil();
for( i = 0; i < ( hb_pcount() - 1 ); i++ )
hb_vmPush( hb_param( i + 2, IT_ANY ) ); /* Push other cmdline params*/
hb_vmDo( hb_pcount() - 1 ); /* Run the thing !!! */
pRetVal = hb_itemNew( NULL );
hb_itemCopy( pRetVal, &hb_stack.Return );
for( ul = 0; ul < ulSymbols; ul++ ) /* Check EXIT functions */
{
if( ( pSymRead[ ul ].cScope & HB_FS_INITEXIT ) == HB_FS_EXIT )
{
hb_vmPushSymbol( pSymRead + ul );
hb_vmPushNil();
hb_vmDo( 0 ); /* Run exit function */
pSymRead[ ul ].cScope = pSymRead[ ul ].cScope & ( ~HB_FS_EXIT );
/* Exit function cannot be
handled by main in hvm.c */
}
}
hb_itemReturn( pRetVal );
hb_itemRelease( pRetVal );
}
for( ul = 0; ul < ulFuncs; ul++ )
{
hb_xfree( pDynFunc[ ul ].pAsmCall->pAsmData );
hb_xfree( pDynFunc[ ul ].pAsmCall );
hb_xfree( pDynFunc[ ul ].pCode );
hb_xfree( pDynFunc[ ul ].szName );
}
for( ul = 0; ul < ulSymbols; ul++ )
hb_xfree( pSymRead[ ul ].szName );
hb_xfree( pDynFunc );
hb_xfree( pSymRead );
hb_xfree(file);
hb_vmQuit();
return bError;
}
static ULONG hb_hrbFindSymbol( char * szName, PHB_DYNF pDynFunc, ULONG ulLoaded )
{
ULONG ulRet;
if( ( s_ulSymEntry < ulLoaded ) && /* Is it a normal list ? */
!strcmp( szName, pDynFunc[ s_ulSymEntry ].szName ) )
ulRet = s_ulSymEntry++;
else
{
BOOL bFound = FALSE;
ulRet = 0;
while( !bFound && ulRet < ulLoaded )
{
if( !strcmp( szName, pDynFunc[ ulRet ].szName ) )
bFound = TRUE;
else
ulRet++;
}
if( !bFound )
ulRet = SYM_NOT_FOUND;
}
return ulRet;
}
/* ReadId
Read the next (zero terminated) identifier */
static char * hb_hrbFileReadId( char * file )
{
char * szTemp; /* Temporary buffer */
char * szIdx;
char * szRet;
BOOL bCont = TRUE;
szTemp = ( char * ) hb_xgrab( 256 );
szIdx = szTemp;
do
{
hb_hrbFileRead( file, szIdx, 1, 1 );
if( *szIdx )
szIdx++;
else
bCont = FALSE;
} while( bCont );
szRet = ( char * ) hb_xgrab( szIdx - szTemp + 1 );
strcpy( szRet, szTemp );
hb_xfree( szTemp );
return szRet;
}
static BYTE hb_hrbFileReadByte( char * file )
{
BYTE bRet;
hb_hrbFileRead( file, ( char * ) &bRet, 1, 1 );
return bRet;
}
static long hb_hrbFileReadLong( char * file )
{
char cLong[ 4 ]; /* Temporary long */
hb_hrbFileRead( file, cLong, 4, 1 );
return ( ( BYTE ) cLong[ 0 ] ) +
( ( BYTE ) cLong[ 1 ] ) * 0x100 +
( ( BYTE ) cLong[ 2 ] ) * 0x10000 +
( ( BYTE ) cLong[ 3 ] ) * 0x1000000 ;
}
/* hb_hrbFileRead
Controlled read from file. If errornous -> Break */
static void hb_hrbFileRead( char * file, char * cBuffer, int iSize, int iCount )
{
static long nPos = 0;
long nChar = iSize*iCount;
while( nChar>0 ){
cBuffer[nChar-1] = ((char*)file+nPos)[nChar-1];
nChar--;
}
nPos += iSize*iCount;
}
/*
Create dynamic function.
This function is needed, since it will allow the existing strategy of
function pointers to work properly.
For each Harbour function a little program calling the virtual machine
should be present (see : *.c)
Since these programs no longer exists when using this system, they should
be create dynamically at run-time.
If a .PRG contains 10 functions, 10 dynamic functions are created which
are all the same :-) except for 2 pointers.
*/
static PASM_CALL hb_hrbAsmCreateFun( PHB_SYMB pSymbols, BYTE * pCode )
{
PASM_CALL asmRet;
HB_TRACE(HB_TR_DEBUG, ("hb_hrbAsmCreateFun(%p, %p)", pSymbols, pCode));
asmRet = ( PASM_CALL ) hb_xgrab( sizeof( ASM_CALL ) );
asmRet->pAsmData = ( BYTE * ) hb_xgrab( sizeof( prgFunction ) );
memcpy( asmRet->pAsmData, prgFunction, sizeof( prgFunction ) );
/* Copy new assembler code in */
/* #if INTEL32 */
hb_hrbAsmPatch( asmRet->pAsmData, 1, pSymbols ); /* Insert pointer to testsym */
hb_hrbAsmPatch( asmRet->pAsmData, 6, pCode ); /* Insert pointer to testcode */
hb_hrbAsmPatchRelative( asmRet->pAsmData, 11, hb_vmExecute, 15 );
/* Insert pointer to hb_vmExecute() */
/* #elseif INTEL16 */
/* #elseif MOTOROLA */
/* #elseif ... */
/* #endif */
return asmRet;
}
/* Patch an address of the dynamic function */
static void hb_hrbAsmPatch( BYTE * pCode, ULONG ulOffset, void * Address )
{
HB_TRACE(HB_TR_DEBUG, ("hb_hrbAsmPatch(%p, %lu, %p)", pCode, ulOffset, Address));
/* #if 32 bits and low byte first */
pCode[ ulOffset ] = ( BYTE ) ( ( ( ULONG ) Address ) & 0xFF );
pCode[ ulOffset + 1 ] = ( BYTE ) ( ( ( ULONG ) Address >> 8 ) & 0xFF );
pCode[ ulOffset + 2 ] = ( BYTE ) ( ( ( ULONG ) Address >> 16 ) & 0xFF );
pCode[ ulOffset + 3 ] = ( BYTE ) ( ( ( ULONG ) Address >> 24 ) & 0xFF );
/* #elseif 16 bits and low byte first */
/* #elseif 32 bits and high byte first */
/* #elseif ... */
/* #endif */
}
/* Intel specific ?? Patch an address relative to the next instruction */
static void hb_hrbAsmPatchRelative( BYTE * pCode, ULONG ulOffset,
void * Address, ULONG ulNext )
{
ULONG ulBase;
ULONG ulRelative;
HB_TRACE(HB_TR_DEBUG, ("hb_hrbAsmPatchRelative(%p, %lu, %p, %lu)", pCode, ulOffset, Address, ulNext));
/* #if 32 bits and low byte first */
ulBase = ( ULONG ) pCode + ulNext;
/* Relative to next instruction */
ulRelative = ( ULONG ) Address - ulBase;
pCode[ ulOffset ] = ( BYTE ) ( ( ulRelative ) & 0xFF );
pCode[ ulOffset + 1 ] = ( BYTE ) ( ( ulRelative >> 8 ) & 0xFF );
pCode[ ulOffset + 2 ] = ( BYTE ) ( ( ulRelative >> 16 ) & 0xFF );
pCode[ ulOffset + 3 ] = ( BYTE ) ( ( ulRelative >> 24 ) & 0xFF );
/* #elseif 16 bits and low byte first */
/* #elseif 32 bits and high byte first */
/* #elseif ... */
/* #endif */
}

View File

@@ -1,26 +0,0 @@
/*
* $Id$
*/
Here's how to upload your changes to the CVS server
==================================================
1.) Do the changes in the source, and in parallel modify ChangeLog
2.) Go online
3.) CVS LOGIN
4.) CVS UPDATE
5.) Resolve all conflicts (mostly ChangeLog)
6.) Copy the last ChangeLog entry to the clipboard
7.) CVS COMMIT (starts another task on my system)
8.) New email message, paste the new ChangeLog entry
9.) Copy and paste the date&time to the subject after "CHANGELOG: "
10.) The CVS pops up a window with the changed filenames
11.) Check if all the changed filenames are referred in the ChangeLog entry,
if not, make the corrections and start again
12.) Paste the date&time to the CVS window, save, exit
13.) CVS is now uploading,
if there are any errors, make the corrections and start again
14.) Send the email message containing the changes
15.) Go offline
Victor Szakats

99
harbour/doc/howtocvs.txt Normal file
View File

@@ -0,0 +1,99 @@
/*
* $Id$
*/
HOW TO USE THE CVS
------------------
Here's how to prepare for uploading to the CVS server
=====================================================
1) Read the Harbour FAQ (www.harbour-project.org), monitor the
mailing-list (Harbour at www.onelist.com), consult with the
developers, make contributions. This way your chances are high
to get a RW access to the CVS.
2) Before uploading anything you'll need Developer (RW) status for the
Harbour CVS server. To get this please make a request on the list,
or contact the Harbour Administrators. Note that getting Developer
status is not an automatic process.
3) You'll need a CVS client for your platform.
4) You'll need an SSH client for your platform.
5) You'll need to configure CVS and SSH for the Harbour Project.
(see: CVS_SSH.TXT)
6) Do a complete checkout to get the fresh source tree.
Here's how to upload your changes to the CVS server
===================================================
1) Do the changes in the source, and in parallel modify ChangeLog
2) Go online (if needed)
3) CVS LOGIN (if needed)
4) CVS UPDATE
5) Resolve all conflicts (mostly ChangeLog)
6) Copy the last ChangeLog entry to the clipboard
7) CVS COMMIT (starts another task on my system)
8) New email message, paste the new ChangeLog entry
9) Copy and paste the ChangeLog entry header to the subject after
"CHANGELOG: "
10) The CVS pops up a window with the changed filenames
11) Check if all the changed filenames are referred in the ChangeLog entry,
if not, make the corrections and start again
12) Paste the ChangeLog entry header to the CVS window, save, exit
13) CVS is now uploading,
if there are any errors, make the corrections and start again
14) Always check if the upload session ended without errors.
15) Send the email message containing the changes
16) Go offline (if needed)
Important notes:
1) *Always* add a ChangeLog entry when uploading to the CVS.
2) When adding a new file to the CVS, always use lower case 8.3
filenames (*), add a CVS ID header to the file, don't use tabs
in the file, end the file with a newline char.
Possibly consult other Developers about the new filename and file
placement.
Add the new filename to the related makefiles.
(*) There are two exceptions: ChangeLog.* and Makefile
3) When adding a new directory, always consult the Developers about
the name and placing of it. On the CVS, there's no way to completely
remove a directory, that's why this is important.
Here's how to format your ChangeLog entries
===========================================
- Always add new entries to the top of the ChangeLog file.
- Add an entry header using this format:
YYYYMMDD HH:MM GMT-+TZ Your Full Name <your_email_address>
- Add a entry body which lists all filenames changed, all of
them with full path spec. Mention the name of the changed function or
macro. Describe what you've changed, the reasons, and other comments
and explanations you find useful. If the change needs some related work
to be done by someone else (documentation, makefile), make note about this.
Group the related changes into logical sections separated by empty lines.
Sample:
* dir/filenam1.txt
+ dir/filenam2.txt
- dir/filenam3.txt
* Changed, bla-bla
! Fixed
% Optimized
+ Added
- Removed
; Comment
Note that using these specific marks is preferred although not a
requirement.
- Leave an empty line between the header and body and one after the body.
Here's how to use the CVS server in anonymous read-only mode
============================================================
(TODO)
Victor Szakats <info@szelvesz.hu>

34
harbour/doc/howtomak.txt Normal file
View File

@@ -0,0 +1,34 @@
/*
* $Id$
*/
HOW TO BUILD HARBOUR FROM THE SOURCE
------------------------------------
You'll need these:
- Flex
- Bison (set BISON_SIMPLE envvar to point to bison.simple)
- A supported (check MAKE_TPL.BAT for a list) C compiler (with all the envvars set (path, lib, include, etc...))
- GNU-make if you want to use it with some other C compiler than GCC
- TASM for BCC
- TASM32 for BCC32
- MASM for MSVC
- Harbour source
- Around 10-15MB of free disk space for each separate platform/compiler
combinations.
To build Harbour using GNU-make:
- Set the required two envvars (check MAKE_GNU.* for them)
- Run MAKE_GNU.*
To build Harbour using non-GNU make with BCC 3.1:
- Run MAKE_B16.BAT
To build Harbour using non-GNU make with BCC 4.x, 5.x:
- MAKE_B32.BAT
To build Harbour using non-GNU make with MSVC:
- MAKE_VC.BAT
To build a final executable, see above, but use BIN/BLD*.*
instead of MAKE*.*
Victor Szakats <info@szelvesz.hu>

View File

@@ -96,11 +96,7 @@ typedef USHORT ( * FUNCP )( USHORT param, ...);
typedef FUNCP * FUNCPP;
#define HIDE static
#if defined(_MSC_VER) || defined(__IBMCPP__)
#define CLIPPER HARBOUR
#else
#define CLIPPER HARBOUR pascal
#endif
#define CLIPPER HARBOUR
#ifndef NIL
#define NIL '\0'

View File

@@ -13,7 +13,6 @@ if "%1" == "CLEAN" goto CLEAN
:BUILD_OK
if exist bin\vc\*.dll copy bin\vc\*.dll bin\*.* > nul
copy bin\vc\*.exe bin\*.* > nul
copy lib\vc\*.lib lib\*.* > nul
goto EXIT
@@ -26,7 +25,6 @@ if "%1" == "CLEAN" goto CLEAN
:CLEAN
if exist bin\vc\*.exe del bin\vc\*.exe
if exist bin\vc\*.dll del bin\vc\*.dll
if exist bin\vc\*.pdb del bin\vc\*.pdb
if exist bin\vc\*.ilk del bin\vc\*.ilk
if exist bin\vc\*.map del bin\vc\*.map

View File

@@ -12,10 +12,14 @@
#
# CFLAGS - Extra C compiler options for libraries and for
# executables
# C_USR - Extra C compiler options for libraries and for
# executables (GNU make compatible envvar)
# CLIBFLAGS - Extra C compiler options for the libraries
# HARBOURFLAGS - Extra Harbour compiler options
# PRG_USR - Extra Harbour compiler options
# (GNU make compatible envvar)
# HB_GT_LIB - To override the default GT driver
# (search for HB_GT_LIBS for a list)
# (search for HB_GT_LIBS for a list of values)
#
#
@@ -40,9 +44,6 @@ LIB_DIR = lib\b16
CC = bcc32
AS = tasm32
# Borland C/C++ (Windows 32 bits)
CFLAGS = $(CFLAGS)
BIN_DIR = bin\b32
OBJ_DIR = obj\b32
LIB_DIR = lib\b32
@@ -75,10 +76,10 @@ HBDOC_DIR = utils\hbdoc
# C compiler definition and C flags. These should never have to change.
#
CFLAGS = -I$(INCLUDE_DIR) -d $(CFLAGS)
CFLAGS = -I$(INCLUDE_DIR) -d $(C_USR) $(CFLAGS)
CLIBFLAGS = -c $(CFLAGS) $(CLIBFLAGS)
CLIBFLAGSDEBUG = -v $(CLIBFLAGS)
HARBOURFLAGS = -i$(INCLUDE_DIR) -n -q0 -w -es2 -gc0 $(HARBOURFLAGS)
HARBOURFLAGS = -i$(INCLUDE_DIR) -n -q0 -w -es2 -gc0 $(PRG_USR) $(HARBOURFLAGS)
#
# Macros to access our library names

View File

@@ -12,12 +12,14 @@
#
# CFLAGS - Extra C compiler options for libraries and for
# executables
# C_USR - Extra C compiler options for libraries and for
# executables (GNU make compatible envvar)
# CLIBFLAGS - Extra C compiler options for the libraries
# HARBOURFLAGS - Extra Harbour compiler options
# PRG_USR - Extra Harbour compiler options
# (GNU make compatible envvar)
# HB_GT_LIB - To override the default GT driver
# (search for HB_GT_LIBS for a list)
# DO_HBRUNJAV - Defines this if you want HBRUNJAV.DLL to be built.
# (you must have a JDK installed for this)
# (search for HB_GT_LIBS for a list of values)
#
#
@@ -77,10 +79,10 @@ HBDOC_DIR = utils\hbdoc
#
AS = masm
CFLAGS = -I$(INCLUDE_DIR) -TP -W3 -nologo $(CFLAGS)
CFLAGS = -I$(INCLUDE_DIR) -TP -W3 -nologo $(C_USR) $(CFLAGS)
CLIBFLAGS = -c $(CFLAGS) $(CLIBFLAGS)
CLIBFLAGSDEBUG = -Zi $(CLIBFLAGS)
HARBOURFLAGS = -i$(INCLUDE_DIR) -n -q0 -w -es2 -gc0 $(HARBOURFLAGS)
HARBOURFLAGS = -i$(INCLUDE_DIR) -n -q0 -w -es2 -gc0 $(PRG_USR) $(HARBOURFLAGS)
#
# Macros to access our library names
@@ -98,7 +100,6 @@ RTL_LIB = $(LIB_DIR)\rtl.lib
TOOLS_LIB = $(LIB_DIR)\tools.lib
VM_LIB = $(LIB_DIR)\vm.lib
GTDOS_LIB = $(LIB_DIR)\gtdos.lib
GTPCA_LIB = $(LIB_DIR)\gtpca.lib
GTSTD_LIB = $(LIB_DIR)\gtstd.lib
GTWIN_LIB = $(LIB_DIR)\gtwin.lib
@@ -108,7 +109,6 @@ HBPP_EXE = $(BIN_DIR)\hbpp.exe
HBRUN_EXE = $(BIN_DIR)\hbrun.exe
HBTEST_EXE = $(BIN_DIR)\hbtest.exe
HBDOC_EXE = $(BIN_DIR)\hbdoc.exe
HBRUNJAV_DLL = $(BIN_DIR)\hbrunjav.dll
!ifndef HB_GT_LIB
HB_GT_LIB = $(GTWIN_LIB)
@@ -597,10 +597,7 @@ all: zot \
$(HBRUN_EXE) \
$(HBPP_EXE) \
$(HBTEST_EXE) \
$(HBDOC_EXE) \
!ifdef DO_HBRUNJAV
$(HBRUNJAV_DLL)
!endif
$(HBDOC_EXE)
MK_FLAGS = $(MK_FLAGS:A=)
@@ -610,7 +607,6 @@ zot:
-@if exist $(OBJ_DIR)\*.h del $(OBJ_DIR)\*.h > nul
-@if exist $(BIN_DIR)\*.exe del $(BIN_DIR)\*.exe > nul
-@if exist $(BIN_DIR)\*.map del $(BIN_DIR)\*.map > nul
-@if exist $(BIN_DIR)\*.dll del $(BIN_DIR)\*.dll > nul
!else
@@ -633,10 +629,7 @@ all: \
$(HBRUN_EXE) \
$(HBPP_EXE) \
$(HBTEST_EXE) \
$(HBDOC_EXE) \
!ifdef DO_HBRUNJAV
$(HBRUNJAV_DLL)
!endif
$(HBDOC_EXE)
!endif
@@ -654,19 +647,6 @@ $(HBRUN_EXE) : \
$(HARBOUR_EXE) $(HARBOURFLAGS) -o$(OBJ_DIR)\ $**
$(CC) $(CFLAGS) -Fo$(OBJ_DIR)\ $(OBJ_DIR)\hbrun.c $(OBJ_DIR)\exttools.c -o $(HBRUN_EXE) /link $(LIBS2)
!ifdef DO_HBRUNJAV
#
# HBRUNJAV.DLL rules (to compile this you must have a JDK installed)
#
$(HBRUNJAV_DLL) : $(HBRUN_DIR)\runjava.c
$(CC) $(CFLAGS) -Fo$(OBJ_DIR)\ $(HBRUN_DIR)\runjava.c -o $(HBRUNJAV_DLL) /link-dll $(LIBS)
-del $(BIN_DIR)\runjava.exp
-del $(BIN_DIR)\runjava.lib
!endif
#
# HBTEST.EXE rules
#

View File

@@ -108,22 +108,23 @@ HB_FUNC( __VMSTKGLIST )
* $FuncName$ <nVars> __vmStkLCount()
* $Description$ Returns the length of the stack of the calling function
* $End$ */
static USHORT StackLen( void )
static USHORT hb_stackLen( void )
{
PHB_ITEM pItem;
PHB_ITEM pBase;
USHORT uiCount = 0;
HB_TRACE(HB_TR_DEBUG, ("hb_StackLen()"));
HB_TRACE(HB_TR_DEBUG, ("hb_stackLen()"));
pBase = hb_stack.pItems + hb_stack.pBase->item.asSymbol.stackbase;
for( pItem = pBase; pItem < hb_stack.pBase; pItem++, uiCount++ );
return uiCount;
}
HB_FUNC( __VMSTKLCOUNT )
{
hb_retni( StackLen() );
hb_retni( hb_stackLen() );
}
/* $Doc$