From 9ac4a23debcc57515bcd06029d54aaecb3ab0774 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sat, 11 Dec 1999 15:03:10 +0000 Subject: [PATCH] 19991211-14:51 GMT+1 Victor Szel --- harbour/ChangeLog | 20 +++++- harbour/include/extend.h | 1 + harbour/source/common/reserved.c | 7 +-- harbour/source/compiler/cmdcheck.c | 7 ++- harbour/source/compiler/harbour.y | 2 + harbour/source/macro/macro.y | 1 - harbour/source/rtl/harbinit.prg | 72 ++++++++++++++++++++++ harbour/source/vm/cmdarg.c | 98 ++++++++++++++++++++++++++++++ harbour/source/vm/hvm.c | 16 +---- 9 files changed, 202 insertions(+), 22 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 907993315c..d15d0e2474 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,20 @@ +19991211-14:51 GMT+1 Victor Szel + * source/compiler/harbour.y + + Missing #include added. + * source/vm/hvm.c + source/vm/cmdarg.c + include/extend.h + + Added //BUILD internal command line switch. + * Internal command line switch check moved to cmdarg.c from hvm.c. + Contribution by Jose Lalin + * source/rtl/harbinit.prg + + Added documentation by Chen Kedem. + * source/compiler/cmdcheck.c + * Some functions put under a separate copyright holder (unkown BTW). + * source/common/reserved.c + * Reapplied some minor changes. + ( I could not test any of these, since I cannot build Harbour right now ) + 19991211-12:47 GMT+1 Antonio Linares * updated makefile.b32 for reserved.c file. @@ -124,7 +141,8 @@ NOTE: Add macro.lib to all non-GNU make scripts or batch files. include/compiler.h + Additional function renaming (prefixing with hb_comp), some functions moved to other files. Declarations fixed, some static vars prefixed - with s_. + with s_. Some functions made static, some declaration moved to + compiler.h. hb_Chk*() -> hb_compChk*() Print*() -> hb_compPrint*() Gen*() -> hb_Gen*() diff --git a/harbour/include/extend.h b/harbour/include/extend.h index 66e3f10637..d4ace83094 100644 --- a/harbour/include/extend.h +++ b/harbour/include/extend.h @@ -375,6 +375,7 @@ extern BOOL hb_cmdargIsInternal( const char * szArg ); extern BOOL hb_cmdargCheck( const char * pszName ); /* Check if a given internal switch (like //INFO) was set */ extern char * hb_cmdargString( const char * pszName ); /* Returns the string value of an internal switch (like //TEMPPATH:"C:\") */ extern int hb_cmdargNum( const char * pszName ); /* Returns the numeric value of an internal switch (like //F:90) */ +extern void hb_cmdargProcessVM( void ); /* Symbol management */ extern PHB_SYMB hb_symbolNew( char * szName ); diff --git a/harbour/source/common/reserved.c b/harbour/source/common/reserved.c index 1868c6cc18..dcc7a93794 100644 --- a/harbour/source/common/reserved.c +++ b/harbour/source/common/reserved.c @@ -104,6 +104,7 @@ static const char * s_szReservedFun[] = { "WORD" , "YEAR" }; + #define RESERVED_FUNCTIONS sizeof( s_szReservedFun ) / sizeof( char * ) char * hb_compReservedName( char * szName ) @@ -123,9 +124,7 @@ char * hb_compReservedName( char * szName ) iFound = strncmp( szName, s_szReservedFun[ wNum ], strlen( szName ) ); ++wNum; } - if( iFound ) - return NULL; - else - return (char *) s_szReservedFun[ wNum - 1 ]; + + return iFound == 0 ? ( char * ) s_szReservedFun[ wNum - 1 ] : NULL; } diff --git a/harbour/source/compiler/cmdcheck.c b/harbour/source/compiler/cmdcheck.c index a3101b558b..43975827c0 100644 --- a/harbour/source/compiler/cmdcheck.c +++ b/harbour/source/compiler/cmdcheck.c @@ -37,6 +37,11 @@ * The following parts are Copyright of the individual authors. * www - http://www.harbour-project.org * + * Copyright 1999 {list of individual authors and e-mail addresses} + * hb_compChkEnvironVar() + * hb_compCheckPaths() + * AddSearchPath() + * * Copyright 1999 Victor Szel * PackDateTime() * @@ -80,7 +85,7 @@ static void AddSearchPath( char * szPath, PATHNAMES * * pSearchList ) is only stored in 6 bits, 1980 will result in the same bit pattern as 2044. The purpose of this value is only used to *differenciate* between the dates ( the exact dates are not significant ), so this - can be used here without problems. */ + can be used here without problems. [vszel] */ /* 76543210765432107654321076543210 |.......|.......|.......|....... diff --git a/harbour/source/compiler/harbour.y b/harbour/source/compiler/harbour.y index d587030107..6815f1a8f3 100644 --- a/harbour/source/compiler/harbour.y +++ b/harbour/source/compiler/harbour.y @@ -41,6 +41,8 @@ * 4) Support this syntax: nPtr := @Hello() */ +#include + #include "compiler.h" /* Compile using: bison -d -v harbour.y */ diff --git a/harbour/source/macro/macro.y b/harbour/source/macro/macro.y index 38ad552084..5c91e223ea 100644 --- a/harbour/source/macro/macro.y +++ b/harbour/source/macro/macro.y @@ -1,4 +1,3 @@ -%pure_parser %{ /* * $Id$ diff --git a/harbour/source/rtl/harbinit.prg b/harbour/source/rtl/harbinit.prg index b0adbe8aba..024dff459b 100644 --- a/harbour/source/rtl/harbinit.prg +++ b/harbour/source/rtl/harbinit.prg @@ -33,6 +33,18 @@ * */ +/* + * The following parts are Copyright of the individual authors. + * www - http://www.harbour-project.org + * + * Copyright 1999 Chen Kedem + * CLIPINIT() documentation + * __SETHELPK() documentation + * + * See doc/license.txt for licensing terms. + * + */ + #include "inkey.ch" ANNOUNCE SysInit @@ -41,6 +53,38 @@ ANNOUNCE SysInit ANNOUNCE CLIPPER520 ANNOUNCE CLIPPER530 +/* $DOC$ + * $FUNCNAME$ + * CLIPINIT() + * $CATEGORY$ + * Internal + * $ONELINER$ + * Initialize various Harbour sub-systems + * $SYNTAX$ + * CLIPINIT() --> NIL + * $ARGUMENTS$ + * none. + * $RETURNS$ + * CLIPINIT() always return NIL. + * $DESCRIPTION$ + * CLIPINIT() is one of the pre-defined INIT PROCEDURE and is executed + * at program startup. It declare an empty MEMVAR PUBLIC array called + * GetList that is going to be used by the Get system, It activate the + * default error handler, and (at least for the moment) call the + * function that set the default help key. + * $EXAMPLES$ + * $TESTS$ + * $STATUS$ + * $COMPLIANCE$ + * It is said that CLIPINIT() should not call that function that set + * the default help key since CA-Clipper do it in some other place. + * $PLATFORMS$ + * $FILES$ + * $SEEALSO$ + * INIT PROCEDURE + * $END$ + */ + INIT PROCEDURE ClipInit MEMVAR GetList @@ -55,6 +99,34 @@ INIT PROCEDURE ClipInit RETURN +/* $DOC$ + * $FUNCNAME$ + * __SetHelpK() + * $CATEGORY$ + * Internal + * $ONELINER$ + * Set F1 as the default help key + * $SYNTAX$ + * __SetHelpK() --> NIL + * $ARGUMENTS$ + * none. + * $RETURNS$ + * __SetHelpK() always return NIL. + * $DESCRIPTION$ + * Set F1 to execute a function called HELP if such a function is + * linked into the program. + * $EXAMPLES$ + * $TESTS$ + * $STATUS$ + * $COMPLIANCE$ + * __SetHelpK() works exactly like CA-Clipper's __SetHelpK() + * $PLATFORMS$ + * $FILES$ + * $SEEALSO$ + * __XHelp(), SET KEY, SETKEY() + * $END$ + */ + PROCEDURE __SetHelpK SET KEY K_F1 TO __XHELP diff --git a/harbour/source/vm/cmdarg.c b/harbour/source/vm/cmdarg.c index a0952d5ad4..53b593a3e3 100644 --- a/harbour/source/vm/cmdarg.c +++ b/harbour/source/vm/cmdarg.c @@ -34,6 +34,7 @@ */ #include "extend.h" +#include "hbmemory.ch" /* Command line argument management */ static int s_argc = 0; @@ -268,3 +269,100 @@ void hb_cmdargTEST( void ) #endif +/* Check for command line internal arguments */ +void hb_cmdargProcessVM( void ) +{ + if( hb_cmdargCheck( "INFO" ) ) + { + char * pszVersion = hb_version( 1 ); + char buffer[ 128 ]; + + hb_outerr( pszVersion, 0 ); + hb_outerr( hb_consoleGetNewLine(), 0 ); + sprintf( buffer, "DS avail=%luKB OS avail=%luKB EMM avail=%luKB", hb_xquery( HB_MEM_BLOCK ), hb_xquery( HB_MEM_VM ), hb_xquery( HB_MEM_EMS ) ); + hb_outerr( buffer, 0 ); + hb_outerr( hb_consoleGetNewLine(), 0 ); + + hb_xfree( pszVersion ); + } + + if( hb_cmdargCheck( "BUILD" ) ) + { + hb_outerr( "Harbour Compiler Build Info", 0 ); + hb_outerr( hb_consoleGetNewLine(), 0 ); +/* + hb_outerr( "---------------------------", 0 ); + hb_outerr( hb_consoleGetNewLine(), 0 ); +*/ +#if defined( HARBOUR_STRICT_CLIPPER_COMPATIBILITY ) + hb_outerr( "* Strict CA-Clipper compatibility: Yes", 0 ); + hb_outerr( hb_consoleGetNewLine(), 0 ); +#else + hb_outerr( "* Strict CA-Clipper compatibility: No", 0 ); + hb_outerr( hb_consoleGetNewLine(), 0 ); +#endif + +#if defined( HB_COMPAT_XPP ) || defined( HB_COMPAT_XPP ) || defined( HB_COMPAT_VO ) + hb_outerr( " With some support for:", 0 ); + hb_outerr( hb_consoleGetNewLine(), 0 ); + +#if defined( HB_COMPAT_C53 ) + hb_outerr( " CA-Clipper 5.3[a,b]", 0 ); + hb_outerr( hb_consoleGetNewLine(), 0 ); +#endif + +#if defined( HB_COMPAT_XPP ) + hb_outerr( " Alaska XBase++", 0 ); + hb_outerr( hb_consoleGetNewLine(), 0 ); +#endif + +#if defined( HB_COMPAT_VO ) + hb_outerr( " CA-Visual Objects", 0 ); + hb_outerr( hb_consoleGetNewLine(), 0 ); +#endif + +#endif + +#if defined( HARBOUR_USE_GTAPI ) + hb_outerr( "* GT API: ", 0 ); +#if defined( HARBOUR_USE_STD_GTAPI ) + hb_outerr( "Standard", 0 ); +#elif defined( HARBOUR_USE_DOS_GTAPI ) + hb_outerr( "DOS", 0 ); +#elif defined( HARBOUR_USE_OS2_GTAPI ) + hb_outerr( "OS/2", 0 ); +#elif defined( HARBOUR_USE_WIN_GTAPI ) + hb_outerr( "Windows", 0 ); +#elif defined( HARBOUR_USE_CRS_GTAPI ) + hb_outerr( "Unix Curses", 0 ); +#elif defined( HARBOUR_USE_SLN_GTAPI ) + hb_outerr( "Unix Slang", 0 ); +#endif + +#else + hb_outerr( "* GT API: No", 0 ); +#endif + hb_outerr( hb_consoleGetNewLine(), 0 ); + +#if defined( HARBOUR_OBJ_GENERATION ) + hb_outerr( "With object file generation", 0 ); + hb_outerr( hb_consoleGetNewLine(), 0 ); +#endif + + hb_outerr( "* ANSI C: ", 0 ); +#if defined( HARBOUR_STRICT_ANSI_C ) + hb_outerr( "Strict", 0 ); +#else + hb_outerr( "Non Strict", 0 ); +#endif + hb_outerr( hb_consoleGetNewLine(), 0 ); + + hb_outerr( "* Debug mode: ", 0 ); +#if defined( HARBOUR_YYDEBUG ) + hb_outerr( "On", 0 ); +#else + hb_outerr( "Off", 0 ); +#endif + hb_outerr( hb_consoleGetNewLine(), 0 ); + } +} diff --git a/harbour/source/vm/hvm.c b/harbour/source/vm/hvm.c index 5f6c602cde..1b19ce451e 100644 --- a/harbour/source/vm/hvm.c +++ b/harbour/source/vm/hvm.c @@ -59,7 +59,6 @@ #include "pcode.h" #include "set.h" #include "inkey.h" -#include "hbmemory.ch" typedef struct _SYMBOLS { @@ -243,20 +242,7 @@ void hb_vmInit( BOOL bStartMainProc ) hb_vmSymbolInit_RT(); /* initialize symbol table with runtime support functions */ /* Check for some internal switches */ - - if( hb_cmdargCheck( "INFO" ) ) - { - char * pszVersion = hb_version( 1 ); - char buffer[ 128 ]; - - hb_outerr( pszVersion, 0 ); - hb_outerr( hb_consoleGetNewLine(), 0 ); - sprintf( buffer, "DS avail=%luKB OS avail=%luKB EMM avail=%luKB", hb_xquery( HB_MEM_BLOCK ), hb_xquery( HB_MEM_VM ), hb_xquery( HB_MEM_EMS ) ); - hb_outerr( buffer, 0 ); - hb_outerr( hb_consoleGetNewLine(), 0 ); - - hb_xfree( pszVersion ); - } + hb_cmdargProcessVM(); /* Call functions that initializes static variables * Static variables have to be initialized before any INIT functions