2007-10-15 18:36 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* source/rtl/tbcolumn.prg
! Strict C5.2e compatible behaviour made the default.
* source/rtl/inkey.c
+ Added handling of arrays of numbers in HB_KEYPUT().
(this was copied from __KEYBOARD()'s extended section)
+ Added handling of string parameter in HB_KEYPUT().
(this way we don't really need the hidden extensions
in __KEYBOARD() anymore. Also notice that __KEYBOARD()
doesn't clear the keyboard buffer when numeric or
array is passed, which is not consistent with the
Clipper compatible behaviour when strings are passed.)
* common.mak
* include/hbcompdf.h
* source/compiler/hbmain.c
* source/compiler/cmdcheck.c
* source/compiler/hbcomp.c
* source/compiler/harbour.l
* source/compiler/Makefile
* source/compiler/ppcomp.c
* source/compiler/hbusage.c
- source/compiler/genjava.c
- source/compiler/gencli.c
- Removed two non-working (experimental) output types:
Java, CLI
! Prefixed LANG_* enums with HB_
This commit is contained in:
@@ -8,6 +8,35 @@
|
||||
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
|
||||
*/
|
||||
|
||||
2007-10-15 18:36 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* source/rtl/tbcolumn.prg
|
||||
! Strict C5.2e compatible behaviour made the default.
|
||||
|
||||
* source/rtl/inkey.c
|
||||
+ Added handling of arrays of numbers in HB_KEYPUT().
|
||||
(this was copied from __KEYBOARD()'s extended section)
|
||||
+ Added handling of string parameter in HB_KEYPUT().
|
||||
(this way we don't really need the hidden extensions
|
||||
in __KEYBOARD() anymore. Also notice that __KEYBOARD()
|
||||
doesn't clear the keyboard buffer when numeric or
|
||||
array is passed, which is not consistent with the
|
||||
Clipper compatible behaviour when strings are passed.)
|
||||
|
||||
* common.mak
|
||||
* include/hbcompdf.h
|
||||
* source/compiler/hbmain.c
|
||||
* source/compiler/cmdcheck.c
|
||||
* source/compiler/hbcomp.c
|
||||
* source/compiler/harbour.l
|
||||
* source/compiler/Makefile
|
||||
* source/compiler/ppcomp.c
|
||||
* source/compiler/hbusage.c
|
||||
- source/compiler/genjava.c
|
||||
- source/compiler/gencli.c
|
||||
- Removed two non-working (experimental) output types:
|
||||
Java, CLI
|
||||
! Prefixed LANG_* enums with HB_
|
||||
|
||||
2007-10-15 17:39 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/include/hbpp.h
|
||||
* harbour/include/hbmath.h
|
||||
|
||||
@@ -329,10 +329,8 @@ COMPILER_LIB_OBJS = \
|
||||
$(OBJ_DIR)\ppcomp$(OBJEXT) \
|
||||
$(OBJ_DIR)\genc$(OBJEXT) \
|
||||
$(OBJ_DIR)\gencc$(OBJEXT) \
|
||||
$(OBJ_DIR)\gencli$(OBJEXT) \
|
||||
$(OBJ_DIR)\gencobj$(OBJEXT) \
|
||||
$(OBJ_DIR)\genobj32$(OBJEXT) \
|
||||
$(OBJ_DIR)\genjava$(OBJEXT) \
|
||||
$(OBJ_DIR)\genhrb$(OBJEXT) \
|
||||
$(OBJ_DIR)\expropta$(OBJEXT) \
|
||||
$(OBJ_DIR)\exproptb$(OBJEXT) \
|
||||
|
||||
@@ -65,14 +65,12 @@ HB_EXTERN_BEGIN
|
||||
/* Output types */
|
||||
typedef enum
|
||||
{
|
||||
LANG_C, /* C language (by default) <file.c> */
|
||||
LANG_CLI, /* .NET IL language */
|
||||
LANG_OBJ32, /* DOS/Windows 32 bits <file.obj> */
|
||||
LANG_JAVA, /* Java <file.java> */
|
||||
LANG_PORT_OBJ, /* Portable objects <file.hrb> */
|
||||
LANG_PORT_OBJ_BUF, /* Portable objects in memory buffer */
|
||||
LANG_OBJ_MODULE /* Platform dependant object module <file.obj> */
|
||||
} LANGUAGES; /* supported Harbour output languages */
|
||||
HB_LANG_C, /* C language (by default) <file.c> */
|
||||
HB_LANG_OBJ32, /* DOS/Windows 32 bits <file.obj> */
|
||||
HB_LANG_PORT_OBJ, /* Portable objects <file.hrb> */
|
||||
HB_LANG_PORT_OBJ_BUF, /* Portable objects in memory buffer */
|
||||
HB_LANG_OBJ_MODULE /* Platform dependant object module <file.obj> */
|
||||
} HB_LANGUAGES; /* supported Harbour output languages */
|
||||
|
||||
struct _COMCLASS; /* forward declaration */
|
||||
|
||||
|
||||
@@ -28,9 +28,7 @@ C_SOURCES=\
|
||||
gencc.c \
|
||||
gencobj.c \
|
||||
genhrb.c \
|
||||
genjava.c \
|
||||
genobj32.c \
|
||||
gencli.c \
|
||||
hbcmplib.c \
|
||||
hbcomp.c \
|
||||
hbdbginf.c \
|
||||
|
||||
@@ -256,7 +256,7 @@ static void hb_compChkEnvironVar( HB_COMP_DECL, char *szSwitch )
|
||||
{
|
||||
case 'c':
|
||||
case 'C':
|
||||
HB_COMP_PARAM->iLanguage = LANG_C;
|
||||
HB_COMP_PARAM->iLanguage = HB_LANG_C;
|
||||
|
||||
switch( *( s + 2 ) )
|
||||
{
|
||||
@@ -284,7 +284,7 @@ static void hb_compChkEnvironVar( HB_COMP_DECL, char *szSwitch )
|
||||
|
||||
case 'o':
|
||||
case 'O':
|
||||
HB_COMP_PARAM->iLanguage = LANG_OBJ_MODULE;
|
||||
HB_COMP_PARAM->iLanguage = HB_LANG_OBJ_MODULE;
|
||||
|
||||
switch( *( s + 2 ) )
|
||||
{
|
||||
@@ -310,24 +310,14 @@ static void hb_compChkEnvironVar( HB_COMP_DECL, char *szSwitch )
|
||||
}
|
||||
break;
|
||||
|
||||
case 'j':
|
||||
case 'J':
|
||||
HB_COMP_PARAM->iLanguage = LANG_JAVA;
|
||||
break;
|
||||
|
||||
case 'h':
|
||||
case 'H':
|
||||
HB_COMP_PARAM->iLanguage = LANG_PORT_OBJ;
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
case 'I':
|
||||
HB_COMP_PARAM->iLanguage = LANG_CLI;
|
||||
HB_COMP_PARAM->iLanguage = HB_LANG_PORT_OBJ;
|
||||
break;
|
||||
|
||||
case 'w':
|
||||
case 'W':
|
||||
HB_COMP_PARAM->iLanguage = LANG_OBJ32;
|
||||
HB_COMP_PARAM->iLanguage = HB_LANG_OBJ32;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,184 +0,0 @@
|
||||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
* Compiler Java source generation
|
||||
*
|
||||
* Copyright 1999 Matteo Baccan <baccan@isanet.it>
|
||||
* Based on a work 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.
|
||||
*
|
||||
* 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 "hbcomp.h"
|
||||
|
||||
#define SYM_NOLINK 0 /* Symbol does not have to be linked */
|
||||
#define SYM_FUNC 1 /* Defined function */
|
||||
#define SYM_EXTERN 2 /* Previously defined function */
|
||||
|
||||
static int hb_fputc( BYTE b, FILE * fOut, int nChar )
|
||||
{
|
||||
if( ++nChar > 1 )
|
||||
fprintf( fOut, ", " );
|
||||
|
||||
if( nChar == 9 )
|
||||
{
|
||||
fprintf( fOut, "\n " );
|
||||
nChar = 1;
|
||||
}
|
||||
|
||||
fprintf( fOut, "0x%02X", ( int ) b );
|
||||
|
||||
return nChar;
|
||||
}
|
||||
|
||||
static int hb_fputs( char * szName, FILE * fOut, int nChar )
|
||||
{
|
||||
unsigned int nPos = 0;
|
||||
|
||||
while( nPos < strlen( szName ) )
|
||||
nChar = hb_fputc( szName[ nPos++ ], fOut, nChar );
|
||||
|
||||
return nChar;
|
||||
}
|
||||
|
||||
void hb_compGenJava( HB_COMP_DECL, PHB_FNAME pFileName )
|
||||
{
|
||||
char szFileName[ _POSIX_PATH_MAX + 1 ], * szVer;
|
||||
PFUNCTION pFunc /*= HB_COMP_PARAM->functions.pFirst */;
|
||||
PCOMSYMBOL pSym = HB_COMP_PARAM->symbols.pFirst;
|
||||
ULONG lPCodePos;
|
||||
LONG lSymbols;
|
||||
ULONG ulCodeLength;
|
||||
FILE * fOut;
|
||||
int nChar;
|
||||
|
||||
if( ! pFileName->szExtension )
|
||||
pFileName->szExtension = ".java";
|
||||
hb_fsFNameMerge( szFileName, pFileName );
|
||||
|
||||
fOut = fopen( szFileName, "wb" );
|
||||
if( ! fOut )
|
||||
{
|
||||
hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'E', HB_COMP_ERR_CREATE_OUTPUT, szFileName, NULL );
|
||||
return;
|
||||
}
|
||||
|
||||
if( ! HB_COMP_PARAM->fQuiet )
|
||||
{
|
||||
char buffer[ 80 + _POSIX_PATH_MAX ];
|
||||
snprintf( buffer, sizeof( buffer ),
|
||||
"Generating Java source output to \'%s\'... ", szFileName );
|
||||
hb_compOutStd( HB_COMP_PARAM, buffer );
|
||||
}
|
||||
|
||||
nChar = 0;
|
||||
szVer = hb_verHarbour();
|
||||
fprintf( fOut, "/*\n * %s\n * Generated JAVA source code\n */\n\n", szVer );
|
||||
hb_xfree( szVer );
|
||||
|
||||
fprintf( fOut, "public class %s\n", pFileName->szName );
|
||||
fprintf( fOut, "{\n" );
|
||||
fprintf( fOut, " public static int[] pCode =\n" );
|
||||
fprintf( fOut, " {\n" );
|
||||
fprintf( fOut, " " );
|
||||
|
||||
/* writes the symbol table */
|
||||
|
||||
lSymbols = 0; /* Count number of symbols */
|
||||
while( pSym )
|
||||
{
|
||||
lSymbols++;
|
||||
pSym = pSym->pNext;
|
||||
}
|
||||
nChar = hb_fputc( ( BYTE ) ( ( lSymbols ) & 255 ), fOut, nChar ); /* Write number symbols */
|
||||
nChar = hb_fputc( ( BYTE ) ( ( lSymbols >> 8 ) & 255 ), fOut, nChar );
|
||||
nChar = hb_fputc( ( BYTE ) ( ( lSymbols >> 16 ) & 255 ), fOut, nChar );
|
||||
nChar = hb_fputc( ( BYTE ) ( ( lSymbols >> 24 ) & 255 ), fOut, nChar );
|
||||
|
||||
pSym = HB_COMP_PARAM->symbols.pFirst;
|
||||
while( pSym )
|
||||
{
|
||||
nChar = hb_fputs( pSym->szName, fOut, nChar );
|
||||
nChar = hb_fputc( 0, fOut, nChar );
|
||||
nChar = hb_fputc( pSym->cScope, fOut, nChar );
|
||||
|
||||
/* specify the function address if it is a defined function or a
|
||||
external called function */
|
||||
if( hb_compFunctionFind( HB_COMP_PARAM, pSym->szName ) ) /* is it a defined function ? */
|
||||
nChar = hb_fputc( SYM_FUNC, fOut, nChar );
|
||||
else
|
||||
{
|
||||
if( hb_compFunCallFind( HB_COMP_PARAM, pSym->szName ) )
|
||||
nChar = hb_fputc( SYM_EXTERN, fOut, nChar );
|
||||
else
|
||||
nChar = hb_fputc( SYM_NOLINK, fOut, nChar );
|
||||
}
|
||||
pSym = pSym->pNext;
|
||||
}
|
||||
|
||||
pFunc = HB_COMP_PARAM->functions.pFirst;
|
||||
|
||||
lSymbols = 0; /* Count number of symbols */
|
||||
while( pFunc )
|
||||
{
|
||||
lSymbols++;
|
||||
pFunc = pFunc->pNext;
|
||||
}
|
||||
nChar = hb_fputc( ( BYTE ) ( ( lSymbols ) & 255 ), fOut, nChar ); /* Write number symbols */
|
||||
nChar = hb_fputc( ( BYTE ) ( ( lSymbols >> 8 ) & 255 ), fOut, nChar );
|
||||
nChar = hb_fputc( ( BYTE ) ( ( lSymbols >> 16 ) & 255 ), fOut, nChar );
|
||||
nChar = hb_fputc( ( BYTE ) ( ( lSymbols >> 24 ) & 255 ), fOut, nChar );
|
||||
|
||||
/* Generate functions data
|
||||
*/
|
||||
pFunc = HB_COMP_PARAM->functions.pFirst;
|
||||
if( ! HB_COMP_PARAM->fStartProc )
|
||||
pFunc = pFunc->pNext;
|
||||
|
||||
while( pFunc )
|
||||
{
|
||||
nChar = hb_fputs( pFunc->szName, fOut, nChar );
|
||||
nChar = hb_fputc( 0, fOut, nChar );
|
||||
ulCodeLength = pFunc->lPCodePos;
|
||||
nChar = hb_fputc( ( BYTE ) ( ( ulCodeLength ) & 255 ), fOut, nChar ); /* Write size */
|
||||
nChar = hb_fputc( ( BYTE ) ( ( ulCodeLength >> 8 ) & 255 ), fOut, nChar );
|
||||
nChar = hb_fputc( ( BYTE ) ( ( ulCodeLength >> 16 ) & 255 ), fOut, nChar );
|
||||
nChar = hb_fputc( ( BYTE ) ( ( ulCodeLength >> 24 ) & 255 ), fOut, nChar );
|
||||
|
||||
lPCodePos = 0;
|
||||
while( lPCodePos < pFunc->lPCodePos )
|
||||
nChar = hb_fputc( pFunc->pCode[ lPCodePos++ ], fOut, nChar );
|
||||
|
||||
pFunc = pFunc->pNext;
|
||||
}
|
||||
|
||||
fprintf( fOut, "\n };\n\n" );
|
||||
fprintf( fOut, " static public void main( String argv[] )\n" );
|
||||
fprintf( fOut, " {\n" );
|
||||
fprintf( fOut, " Harbour.Run( %s.pCode ); \n", pFileName->szName );
|
||||
fprintf( fOut, " }\n\n" );
|
||||
fprintf( fOut, "}\n" );
|
||||
|
||||
fclose( fOut );
|
||||
|
||||
if( ! HB_COMP_PARAM->fQuiet )
|
||||
hb_compOutStd( HB_COMP_PARAM, "Done.\n" );
|
||||
}
|
||||
@@ -1025,7 +1025,7 @@ Separator {SpaceTab}
|
||||
}
|
||||
else
|
||||
{
|
||||
if( hb_comp_iLanguage != LANG_C && hb_comp_iLanguage != LANG_OBJ_MODULE )
|
||||
if( hb_comp_iLanguage != HB_LANG_C && hb_comp_iLanguage != HB_LANG_OBJ_MODULE )
|
||||
{
|
||||
hb_compGenError( HB_COMP_PARAM, hb_comp_szErrors, 'F', HB_COMP_ERR_REQUIRES_C, NULL, NULL );
|
||||
hb_xfree( ( void * ) pInline->pCode );
|
||||
|
||||
@@ -238,7 +238,7 @@ HB_COMP_PTR hb_comp_new( void )
|
||||
pComp->iWarnings = 0; /* enable parse warnings */
|
||||
pComp->iGenCOutput= HB_COMPGENC_VERBOSE; /* C code generation should be verbose (use comments) or not */
|
||||
pComp->iExitLevel = HB_EXITLEVEL_DEFAULT; /* holds if there was any warning during the compilation process */
|
||||
pComp->iLanguage = LANG_C; /* default Harbour generated output language */
|
||||
pComp->iLanguage = HB_LANG_C; /* default Harbour generated output language */
|
||||
}
|
||||
|
||||
return pComp;
|
||||
|
||||
@@ -104,7 +104,7 @@ int hb_compMain( int argc, char * argv[], BYTE ** pBufPtr, ULONG * pulSize,
|
||||
{
|
||||
if( pBufPtr && pulSize )
|
||||
{
|
||||
HB_COMP_PARAM->iLanguage = LANG_PORT_OBJ_BUF;
|
||||
HB_COMP_PARAM->iLanguage = HB_LANG_PORT_OBJ_BUF;
|
||||
}
|
||||
|
||||
if( HB_COMP_PARAM->fLogo )
|
||||
@@ -4054,31 +4054,23 @@ static void hb_compGenOutput( HB_COMP_DECL, int iLanguage )
|
||||
|
||||
switch( iLanguage )
|
||||
{
|
||||
case LANG_C:
|
||||
case HB_LANG_C:
|
||||
hb_compGenCCode( HB_COMP_PARAM, HB_COMP_PARAM->pFileName );
|
||||
break;
|
||||
|
||||
case LANG_CLI:
|
||||
hb_compGenILCode( HB_COMP_PARAM, HB_COMP_PARAM->pFileName );
|
||||
break;
|
||||
|
||||
case LANG_OBJ32:
|
||||
case HB_LANG_OBJ32:
|
||||
hb_compGenObj32( HB_COMP_PARAM, HB_COMP_PARAM->pFileName );
|
||||
break;
|
||||
|
||||
case LANG_JAVA:
|
||||
hb_compGenJava( HB_COMP_PARAM, HB_COMP_PARAM->pFileName );
|
||||
break;
|
||||
|
||||
case LANG_PORT_OBJ:
|
||||
case HB_LANG_PORT_OBJ:
|
||||
hb_compGenPortObj( HB_COMP_PARAM, HB_COMP_PARAM->pFileName );
|
||||
break;
|
||||
|
||||
case LANG_PORT_OBJ_BUF:
|
||||
case HB_LANG_PORT_OBJ_BUF:
|
||||
hb_compGenBufPortObj( HB_COMP_PARAM, &HB_COMP_PARAM->pOutBuf, &HB_COMP_PARAM->ulOutBufSize );
|
||||
break;
|
||||
|
||||
case LANG_OBJ_MODULE:
|
||||
case HB_LANG_OBJ_MODULE:
|
||||
hb_compGenCObj( HB_COMP_PARAM, HB_COMP_PARAM->pFileName );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -72,8 +72,6 @@ void hb_compPrintUsage( HB_COMP_DECL, char * szSelf )
|
||||
"\n %cgo output type: Platform dependant object module",
|
||||
"\n %cgw output type: Windows/DOS OBJ32 (.obj)",
|
||||
"\n %cgh output type: Harbour Portable Object (.hrb)",
|
||||
"\n %cgj output type: Java source (.java)",
|
||||
"\n %cgi output type: .NET platform (.il)",
|
||||
"\n %ci<path> #include file search path",
|
||||
"\n %ck compilation mode (type -k? for more data)",
|
||||
"\n %cl suppress line number information",
|
||||
|
||||
@@ -96,7 +96,7 @@ static void hb_pp_hb_inLine( void * cargo, char * szFunc,
|
||||
{
|
||||
HB_COMP_DECL = ( HB_COMP_PTR ) cargo;
|
||||
|
||||
if( HB_COMP_PARAM->iLanguage != LANG_C && HB_COMP_PARAM->iLanguage != LANG_OBJ_MODULE )
|
||||
if( HB_COMP_PARAM->iLanguage != HB_LANG_C && HB_COMP_PARAM->iLanguage != HB_LANG_OBJ_MODULE )
|
||||
{
|
||||
int iCurrLine = HB_COMP_PARAM->currLine;
|
||||
HB_COMP_PARAM->currLine = iLine;
|
||||
|
||||
@@ -594,6 +594,26 @@ HB_FUNC( HB_KEYPUT )
|
||||
{
|
||||
if( ISNUM( 1 ) )
|
||||
hb_inkeyPut( hb_parni( 1 ) );
|
||||
else if( ISCHAR( 1 ) )
|
||||
{
|
||||
PHB_ITEM pText = hb_param( 1, HB_IT_STRING );
|
||||
char * szText = hb_itemGetCPtr( pText );
|
||||
ULONG ulLen = hb_itemGetCLen( pText ), ulIndex;
|
||||
|
||||
for( ulIndex = 0; ulIndex < ulLen; ulIndex++ )
|
||||
hb_inkeyPut( szText[ ulIndex ] );
|
||||
}
|
||||
else if( ISARRAY( 1 ) )
|
||||
{
|
||||
PHB_ITEM pArray = hb_param( 1, HB_IT_ARRAY );
|
||||
ULONG ulElements = hb_arrayLen( pArray ), ulIndex;
|
||||
|
||||
for( ulIndex = 1; ulIndex <= ulElements; ulIndex++ )
|
||||
{
|
||||
if( hb_arrayGetType( pArray, ulIndex ) & HB_IT_NUMERIC )
|
||||
hb_inkeyPut( hb_arrayGetNI( pArray, ulIndex ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -215,17 +215,8 @@ METHOD setStyle( nStyle, lNewValue ) CLASS TBColumn
|
||||
|
||||
METHOD New( cHeading, bBlock ) CLASS TBColumn
|
||||
|
||||
/* NOTE: CA-Cl*pper will allow any types for the heading.
|
||||
In Harbour this would cause various errors inside the object, so we're
|
||||
not replicating this strange behaviour. [vszakats] */
|
||||
|
||||
#ifdef HB_C52_STRICT
|
||||
/* NOTE: CA-Cl*pper will allow any types for the heading here. [vszakats] */
|
||||
::cHeading := cHeading
|
||||
#else
|
||||
IF ISCHARACTER( cHeading )
|
||||
::cHeading := cHeading
|
||||
ENDIF
|
||||
#endif
|
||||
::bBlock := bBlock /* NOTE: CA-Cl*pper allows any types here. [vszakats] */
|
||||
|
||||
RETURN Self
|
||||
|
||||
Reference in New Issue
Block a user