From 20a998205f7e53e52d990ae23fc8e39844a0c79b Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 29 Nov 1999 22:10:47 +0000 Subject: [PATCH] 19991129-22:22 GMT+1 Victor Szel --- harbour/ChangeLog | 30 +++ harbour/doc/pragma.txt | 79 ++++++++ harbour/include/compiler.h | 5 + harbour/include/hbdefs.h | 4 +- harbour/include/hberrors.h | 1 + harbour/source/compiler/harbour.c | 5 - harbour/source/pp/hbpp.c | 312 +++++++++++++++++++++++++++++- harbour/source/pp/hbpplib.c | 12 ++ harbour/source/pp/stdalone/hbpp.c | 12 ++ harbour/source/rtl/alert.prg | 3 +- harbour/source/rtl/asort.prg | 2 +- harbour/source/rtl/memvars.c | 2 +- harbour/source/rtl/trace.c | 12 -- harbour/tests/Makefile | 1 + harbour/tests/tstprag.prg | 31 +++ 15 files changed, 488 insertions(+), 23 deletions(-) create mode 100644 harbour/doc/pragma.txt create mode 100644 harbour/tests/tstprag.prg diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 8379683e76..6c5a627888 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,33 @@ +19991129-22:22 GMT+1 Victor Szel + * source/compiler/harbour.c + include/compiler.h + * HB_EXITLEVEL_* constants moved to the central header file. + * source/rtl/alert.prg + source/rtl/asort.prg + ! Minor fixes. + * include/hbdefs.h + ! HB_HANDLE - LONG -> ULONG, to suppress Borland warning in memvars.c + * source/rtl/memvars.c + ! cast added to suppress Borland warning. + * source/pp/stdalone/hbpp.c + source/pp/hbpplib.c + + Dummy compiler flag variables added for #pragma support. + * source/rtl/trace.c + - Copyright removed. + +19991129-22:22 GMT+1 Jose Lalin + * source/pp/hbpp.c + + Added support for #pragma directives + Now we can include compiler settings inside PRG's + * include/hberrors.h + + Added new #define ERR_PRAGMA_BAD_VALUE + + tests/tstprag.prg + tests/Makefile + + New test for pragma directives + + doc/pragma.txt + + a bit of info on Harbour pragmas implementation + (Uploaded by Victor Szel) + Mon Nov 29 12:45:05 1999 Gonzalo A. Diethelm * include/hbtrace.h: diff --git a/harbour/doc/pragma.txt b/harbour/doc/pragma.txt new file mode 100644 index 0000000000..639afda94d --- /dev/null +++ b/harbour/doc/pragma.txt @@ -0,0 +1,79 @@ +# +# $Id: +# + +INTRODUCTION +============ +This file explains what is and how to use #pragma directive in Harbour. + +PRAGMA +====== +The #pragma is a directive used in many compilers to change at compile +time some flags inside the compiler itself. + +USAGE +===== +Currently the #pragma directive can be used in two ways: switch mode and +command mode. + +The syntax is: #pragma [=On/Off] or + #pragma -CompilerFlag[+|-] + +Remember thar you can use both modes mixed in the same module and +upper/lower case without worry. + +To enable/disable a command you simply do: =On/Off and +for switches you do: /+/- + + Example: #pragma AddDebugInfo=Off /* Suppress debug info */ + #pragma /B+ /* Add debug info from here */ + + +IMPLEMENTATION +============== + +This is the list of the supported commands and switchs: + + * Command Switch + ----------------------------------------------- + * AUTOMEMVARS = /A<+/-> + * DEBUGINFO = /B<+/-> + * ENABLEWARNINGS = /W<+/-> + * EXITSEVERITY = /E + * FORCEMEMVARS = /V<+/-> + * LINEINFO = /L<+/-> + * NOSTARTPROC = /N<+/-> + * PREPROCESSING = /P<+/-> + * WARNINGLEVEL = /W + * SHORTCUTTING = /Z<+/-> + + The switchs have the same behaviour as the corresponding compiler ones + and the commands are sinonyms for the switchs. + + * TRACEPRAGMAS + This command shows pragma activity when enabled. + + NOTE: you can use the abbreviated commands mode by typing only the + first ten chars. + +NOTES +===== +This directive is not supported in the standalone version of the Harbour +preprocessor. + +EXAMPLES +======== + +#pragma NoStartProc=Off +/* #pragma /N- */ + +function Test() +return nil + +This is the same as calling Harbour with the -n switch in the command line, +but with the great benefit that if you forgot to pass the switch if will be +used anyway because it is included inside the source. + +======= +Regards, +Jose Lalin diff --git a/harbour/include/compiler.h b/harbour/include/compiler.h index 86c8130b03..670c2ccd1f 100644 --- a/harbour/include/compiler.h +++ b/harbour/include/compiler.h @@ -325,6 +325,11 @@ extern USHORT hb_comp_wCaseCounter; extern char * hb_comp_szErrors[]; extern char * hb_comp_szWarnings[]; +/* /ES command line setting types */ +#define HB_EXITLEVEL_DEFAULT 0 +#define HB_EXITLEVEL_SETEXIT 1 +#define HB_EXITLEVEL_DELTARGET 2 + HB_EXPR_PTR hb_compExprNewEmpty( void ); HB_EXPR_PTR hb_compExprNewNil( void ); diff --git a/harbour/include/hbdefs.h b/harbour/include/hbdefs.h index f41a71c499..730d21aa5a 100644 --- a/harbour/include/hbdefs.h +++ b/harbour/include/hbdefs.h @@ -134,8 +134,8 @@ typedef BYTE HB_ATTR; typedef HARBOUR ( * PHB_FUNC )( void ); typedef PHB_FUNC HB_FUNC_PTR; -typedef LONG HB_HANDLE; /* handle to memvar value */ -typedef char HB_SYMBOLSCOPE; /* stores symbol's scope */ +typedef ULONG HB_HANDLE; /* handle to memvar value */ +typedef char HB_SYMBOLSCOPE; /* stores symbol's scope */ /* Some common character constants */ diff --git a/harbour/include/hberrors.h b/harbour/include/hberrors.h index a44d7b7032..55aad66d8d 100644 --- a/harbour/include/hberrors.h +++ b/harbour/include/hberrors.h @@ -115,6 +115,7 @@ #define ERR_PPMEMALLOC 11 #define ERR_PPMEMREALLOC 12 #define ERR_PPMEMFREE 13 +#define ERR_PRAGMA_BAD_VALUE 14 #define WARN_NONDIRECTIVE 1 diff --git a/harbour/source/compiler/harbour.c b/harbour/source/compiler/harbour.c index 7d626ab965..62aaab4b0e 100644 --- a/harbour/source/compiler/harbour.c +++ b/harbour/source/compiler/harbour.c @@ -40,11 +40,6 @@ extern unsigned _stklen = UINT_MAX; #endif -/* /ES command line setting types */ -#define HB_EXITLEVEL_DEFAULT 0 -#define HB_EXITLEVEL_SETEXIT 1 -#define HB_EXITLEVEL_DELTARGET 2 - typedef enum { LANG_C, /* C language (by default) */ diff --git a/harbour/source/pp/hbpp.c b/harbour/source/pp/hbpp.c index 901455d99c..6f0b6cfdac 100644 --- a/harbour/source/pp/hbpp.c +++ b/harbour/source/pp/hbpp.c @@ -33,6 +33,18 @@ * */ +/* + * The following parts are Copyright of the individual authors. + * www - http://www.harbour-project.org + * + * Copyright 1999 Jose Lalin + * Support for #pragma directive and related functions + * See doc/pragma.txt + * + * See doc/license.txt for licensing terms. + * + */ + /* * Avoid tracing in preprocessor/compiler. */ @@ -48,6 +60,7 @@ #include #include "hbpp.h" #include "hberrors.h" +#include "compiler.h" static COMMANDS * AddCommand( char * ); /* Add new #command to an array */ static COMMANDS * AddTranslate( char * ); /* Add new #translate to an array */ @@ -89,6 +102,15 @@ static int NextName( char **, char * ); static int NextParm( char **, char * ); static BOOL OpenInclude( char *, PATHNAMES *, PHB_FNAME, FILE **, BOOL bStandardOnly, char * ); +/* These are related to pragma support */ +static int ParsePragma( char * ); +static BOOL StringToBool( char *, BOOL ); +static int StringToInt( char *, int ); +static BOOL IsOnOffSwitch( char *, BOOL ); +static void DebugPragma( char *, int, BOOL ); + +static BOOL s_bTracePragma = FALSE; + #define ISNAME( c ) ( isalnum( c ) || ( c ) == '_' || ( c ) > 0x7E ) #define MAX_NAME 255 #define MAX_EXP 1024 @@ -138,7 +160,8 @@ char * hb_pp_szErrors[] = "#error: \'%s\'", "Memory allocation error", "Memory reallocation error", - "Freeing a NULL memory pointer" + "Freeing a NULL memory pointer", + "Value out of range in #pragma directive" }; /* Table with parse warnings */ @@ -243,6 +266,10 @@ int hb_pp_ParseDirective( char * sLine ) else if( i == 4 && memcmp( sDirective, "LINE", 4 ) == 0 ) return -1; + + else if( i == 6 && memcmp( sDirective, "PRAGMA", 6 ) == 0 ) + ParsePragma( sLine ); /* --- #pragma --- */ + else hb_compGenError( hb_pp_szErrors, 'F', ERR_WRONG_DIRECTIVE, sDirective, NULL ); } @@ -2258,3 +2285,286 @@ static BOOL OpenInclude( char * szFileName, PATHNAMES * pSearch, PHB_FNAME pMain return ( *fptr ? TRUE : FALSE ); } + +/* Size of abreviated pragma commands */ +#define PRAGMAS_LEN 8 + +/* TODO: Add support for: + CompileModule /M + QuietMode /Q + RequestLib /R + TempPath /T + StdHeader /U + CheckSyntax /S +*/ + +static int ParsePragma( char * sLine ) +{ + char pragma[ MAX_NAME ]; + + HB_TRACE(HB_TR_DEBUG, ("ParsePragma(%s)", sLine)); + + HB_SKIPTABSPACES( sLine ); + + NextWord( &sLine, pragma, FALSE ); + + if( HB_ISOPTSEP( pragma[ 0 ] ) ) + { + switch( pragma[ 1 ] ) + { + case 'a': + case 'A': + hb_comp_bAutoMemvarAssume = IsOnOffSwitch( pragma, hb_comp_bAutoMemvarAssume ); + DebugPragma( pragma, -1, hb_comp_bAutoMemvarAssume ); + break; + + case 'b': + case 'B': + hb_comp_bDebugInfo = IsOnOffSwitch( pragma, hb_comp_bDebugInfo ); + hb_comp_bLineNumbers = hb_comp_bDebugInfo; + DebugPragma( pragma, -1, hb_comp_bDebugInfo ); + break; + + case 'e': + case 'E': + + if( pragma[ 2 ] == 's' || + pragma[ 2 ] == 'S' ) + { + switch( pragma[ 3 ] ) + { + case '\0': + case '0': + hb_comp_iExitLevel = HB_EXITLEVEL_DEFAULT; + break; + + case '1': + hb_comp_iExitLevel = HB_EXITLEVEL_SETEXIT; + break; + + case '2': + hb_comp_iExitLevel = HB_EXITLEVEL_DELTARGET; + break; + + default: + hb_compGenError( hb_pp_szErrors, 'F', ERR_PRAGMA_BAD_VALUE, NULL, NULL ); + } + DebugPragma( pragma, hb_comp_iExitLevel, FALSE ); + } + + break; + + case 'l': + case 'L': + hb_comp_bLineNumbers = IsOnOffSwitch( pragma, hb_comp_bLineNumbers ); + DebugPragma( pragma, -1, hb_comp_bLineNumbers ); + break; + + case 'n': + case 'N': + hb_comp_bStartProc = IsOnOffSwitch( pragma, hb_comp_bStartProc ); + DebugPragma( pragma, -1, hb_comp_bStartProc ); + break; + + case 'p': + case 'P': + hb_comp_bPPO = IsOnOffSwitch( pragma, hb_comp_bPPO ); + DebugPragma( pragma, -1, hb_comp_bPPO ); + break; + + case 'v': + case 'V': + hb_comp_bForceMemvars = IsOnOffSwitch( pragma, hb_comp_bForceMemvars ); + DebugPragma( pragma, -1, hb_comp_bForceMemvars ); + break; + + case 'w': + case 'W': + if( pragma[ 2 ] != '\0' ) + { + /* Check for +/- */ + if( pragma[ strlen( pragma ) - 1 ] == '+' || + pragma[ strlen( pragma ) - 1 ] == '-' ) + hb_comp_iWarnings = IsOnOffSwitch( pragma, hb_comp_iWarnings != 0 ) ? 1 : 0; + else + { + /* There is -w<0,1,2,3> probably */ + hb_comp_iWarnings = pragma[ 2 ] - '0'; + if( hb_comp_iWarnings < 0 || hb_comp_iWarnings > 3 ) + hb_compGenError( hb_pp_szErrors, 'F', ERR_PRAGMA_BAD_VALUE, NULL, NULL ); + + DebugPragma( pragma, -1, hb_comp_iWarnings ); + } + } + break; + + case 'z': + case 'Z': + hb_comp_bShortCuts = IsOnOffSwitch( pragma, hb_comp_bShortCuts ); + DebugPragma( pragma, -1, hb_comp_bShortCuts ); + break; + + default: + break; + } + } + else + { + char * temp = hb_strupr( pragma ); + + if( memcmp( pragma, "AUTOMEMVARS", PRAGMAS_LEN ) == 0 ) + { + hb_comp_bAutoMemvarAssume = StringToBool( temp, hb_comp_bAutoMemvarAssume ); + DebugPragma( pragma, -1, hb_comp_bAutoMemvarAssume ); + } + else if( memcmp( temp, "DEBUGINFO", PRAGMAS_LEN ) == 0 ) + { + hb_comp_bDebugInfo = StringToBool( temp, hb_comp_bDebugInfo ); + hb_comp_bLineNumbers = hb_comp_bDebugInfo; + DebugPragma( pragma, -1, hb_comp_bDebugInfo ); + } + else if( memcmp( temp, "ENABLEWARNINGS", PRAGMAS_LEN ) == 0 ) + { + hb_comp_iWarnings = StringToBool( temp, hb_comp_iWarnings != 0 ) ? 1 : 0; + DebugPragma( pragma, hb_comp_iWarnings, FALSE ); + } + else if( memcmp( temp, "EXITSEVERITY", PRAGMAS_LEN ) == 0 ) + { + hb_comp_iExitLevel = StringToInt( temp, hb_comp_iExitLevel ); + if( hb_comp_iExitLevel < 0 || hb_comp_iExitLevel > 2 ) + hb_compGenError( hb_pp_szErrors, 'F', ERR_PRAGMA_BAD_VALUE, NULL, NULL ); + DebugPragma( pragma, hb_comp_iExitLevel, FALSE ); + } + else if( memcmp( temp, "FORCEMEMVARS", PRAGMAS_LEN ) == 0 ) + { + hb_comp_bForceMemvars = StringToBool( temp, hb_comp_bForceMemvars ); + DebugPragma( pragma, -1, hb_comp_bForceMemvars ); + } + else if( memcmp( temp, "LINEINFO", PRAGMAS_LEN ) == 0 ) + { + hb_comp_bLineNumbers = StringToBool( temp, hb_comp_bLineNumbers ); + DebugPragma( pragma, -1, hb_comp_bLineNumbers ); + } + else if( memcmp( temp, "NOSTARTPROC", PRAGMAS_LEN ) == 0 ) + { + hb_comp_bStartProc = StringToBool( temp, hb_comp_bStartProc ); + DebugPragma( pragma, hb_comp_bStartProc, FALSE ); + } + else if( memcmp( temp, "PREPROCESSING", PRAGMAS_LEN ) == 0 ) + { + hb_comp_bPPO = StringToBool( temp, hb_comp_bPPO ); + DebugPragma( pragma, -1, hb_comp_bPPO ); + } + else if( memcmp( temp, "SHORTCUTTING", PRAGMAS_LEN ) == 0 ) + { + hb_comp_bShortCuts = StringToBool( temp, hb_comp_bShortCuts ); + DebugPragma( pragma, -1, hb_comp_bShortCuts ); + } + else if( memcmp( temp, "WARNINGLEVEL", PRAGMAS_LEN ) == 0 ) + { + hb_comp_iWarnings = StringToInt( temp, hb_comp_iWarnings ); + if( hb_comp_iWarnings < 0 || hb_comp_iWarnings > 3 ) + hb_compGenError( hb_pp_szErrors, 'F', ERR_PRAGMA_BAD_VALUE, NULL, NULL ); + DebugPragma( pragma, -1, hb_comp_iWarnings ); + } + else if( memcmp( temp, "TRACEPRAGMAS", PRAGMAS_LEN ) == 0 ) + { + s_bTracePragma = StringToBool( temp, s_bTracePragma ); + DebugPragma( pragma, -1, s_bTracePragma ); + } + } + + return 0; +} + +/* Checks for ON/OFF within the string, sets bDefault if not found */ +static BOOL StringToBool( char * str, BOOL bDefault ) +{ + char * pos; + BOOL bRet = bDefault; + + pos = strchr( str, '=' ); + + if( pos ) + { + long lPos = pos - str + 1; + + if( str[ lPos ] == 'O' ) + { + if( strlen( str ) >= 2 && + str[ lPos + 1 ] == 'N' ) + bRet = TRUE; + else if( strlen( str ) >= 3 && + str[ lPos + 1 ] == 'F' && + str[ lPos + 2 ] == 'F' ) + bRet = FALSE; + } + } + + return bRet; +} + +/* Checks for +/- within the string, sets bDefault if not found */ +static BOOL IsOnOffSwitch( char * str, BOOL bDefault ) +{ + BOOL bRet = bDefault; + long lPos = strlen( str ) - 1; + + if( str[ lPos ] == '+' ) + bRet = TRUE; + else if( str[ lPos ] == '-' ) + bRet = FALSE; + + return bRet; +} + +/* Returns value after =, sets iDefault if not found */ +static int StringToInt( char * str, int iDefault ) +{ + char * pos; + int iRet = iDefault; + + pos = strchr( str, '=' ); + + if( pos ) + { + long lPos = pos - str + 1; + + if( lPos && str[ lPos ] ) + iRet = str[ lPos ] - '0'; + } + + return iRet; +} + +/* This is only to debug pragmas now */ +static void DebugPragma( char * szStr, int iValue, BOOL bValue ) +{ + if( s_bTracePragma ) + { + char * ptr = strchr( szStr, '=' ); + char * temp = hb_xgrab( strlen( szStr ) + 1 ); + BOOL bIsSwitch = TRUE; + + * temp = '\0'; + + /* strip =... from szStr. Just cosmetic */ + if( ptr ) + { + int i = 0; + + while( szStr[ i ] != '=' ) + temp[ i ] = szStr[ i++ ]; + + temp[ i ] = '\0'; + bIsSwitch = FALSE; + } + + if( iValue > 0 ) + printf( "#pragma %s set to %i\n", bIsSwitch ? szStr : temp, iValue ); + else + printf( "#pragma %s is %s\n", bIsSwitch ? szStr : temp, bValue ? "ON" : "OFF" ); + + hb_xfree( temp ); + } +} diff --git a/harbour/source/pp/hbpplib.c b/harbour/source/pp/hbpplib.c index c07d054d9c..6abc6842e9 100644 --- a/harbour/source/pp/hbpplib.c +++ b/harbour/source/pp/hbpplib.c @@ -46,6 +46,7 @@ #include #include "hbpp.h" +#include "compiler.h" #include "extend.h" #include "itemapi.h" #include "errorapi.h" @@ -54,6 +55,17 @@ PATHNAMES * hb_comp_pIncludePath = NULL; PHB_FNAME hb_comp_pFileName = NULL; +/* These are need for the PP #pragma support */ +BOOL hb_comp_bPPO = FALSE; /* flag indicating, is ppo output needed */ +BOOL hb_comp_bStartProc = TRUE; /* holds if we need to create the starting procedure */ +BOOL hb_comp_bLineNumbers = TRUE; /* holds if we need pcodes with line numbers */ +BOOL hb_comp_bShortCuts = TRUE; /* .and. & .or. expressions shortcuts */ +int hb_comp_iWarnings = 0; /* enable parse warnings */ +BOOL hb_comp_bAutoMemvarAssume = FALSE; /* holds if undeclared variables are automatically assumed MEMVAR (-a)*/ +BOOL hb_comp_bForceMemvars = FALSE; /* holds if memvars are assumed when accesing undeclared variable (-v)*/ +BOOL hb_comp_bDebugInfo = FALSE; /* holds if generate debugger required info */ +int hb_comp_iExitLevel = HB_EXITLEVEL_DEFAULT; /* holds if there was any warning during the compilation process */ + static jmp_buf s_env; /* TODO: Extend the function to allow directives diff --git a/harbour/source/pp/stdalone/hbpp.c b/harbour/source/pp/stdalone/hbpp.c index 3889510706..195733a14e 100644 --- a/harbour/source/pp/stdalone/hbpp.c +++ b/harbour/source/pp/stdalone/hbpp.c @@ -49,6 +49,7 @@ #include "hbpp.h" #include "hberrors.h" #include "hbver.h" +#include "compiler.h" static void AddSearchPath( char * szPath, PATHNAMES * * pSearchList ); static void OutTable( DEFINES * endDefine, COMMANDS * endCommand ); @@ -61,6 +62,17 @@ static int s_iWarnings = 0; PATHNAMES * hb_comp_pIncludePath = NULL; PHB_FNAME hb_comp_pFileName = NULL; +/* These are need for the PP #pragma support */ +BOOL hb_comp_bPPO = FALSE; /* flag indicating, is ppo output needed */ +BOOL hb_comp_bStartProc = TRUE; /* holds if we need to create the starting procedure */ +BOOL hb_comp_bLineNumbers = TRUE; /* holds if we need pcodes with line numbers */ +BOOL hb_comp_bShortCuts = TRUE; /* .and. & .or. expressions shortcuts */ +int hb_comp_iWarnings = 0; /* enable parse warnings */ +BOOL hb_comp_bAutoMemvarAssume = FALSE; /* holds if undeclared variables are automatically assumed MEMVAR (-a)*/ +BOOL hb_comp_bForceMemvars = FALSE; /* holds if memvars are assumed when accesing undeclared variable (-v)*/ +BOOL hb_comp_bDebugInfo = FALSE; /* holds if generate debugger required info */ +int hb_comp_iExitLevel = HB_EXITLEVEL_DEFAULT; /* holds if there was any warning during the compilation process */ + int main( int argc, char * argv[] ) { FILE * handl_i; diff --git a/harbour/source/rtl/alert.prg b/harbour/source/rtl/alert.prg index 4ee8929003..ebbef338c4 100644 --- a/harbour/source/rtl/alert.prg +++ b/harbour/source/rtl/alert.prg @@ -16,7 +16,8 @@ * www - http://www.harbour-project.org * * Copyright 1999 Victor Szel - * Changes for higher Clipper compatibility + * Changes for higher Clipper compatibility, console mode, extensions + * __NONOALERT() * * Copyright 1999 Chen Kedem * Documentation diff --git a/harbour/source/rtl/asort.prg b/harbour/source/rtl/asort.prg index 8aa5147892..bd1a94ccc1 100644 --- a/harbour/source/rtl/asort.prg +++ b/harbour/source/rtl/asort.prg @@ -95,7 +95,7 @@ * * // sort two-dimensional array according to 2nd element of each pair * aPair := { {"Sun",8}, {"Mon",1}, {"Tue",57}, {"Wed",-6} } - * ASORT( aPair,,, {| x, y | x[2] > y[2] } ) + * ASORT( aPair,,, {| x, y | x[2] < y[2] } ) * // result: { {"Wed",-6}, {"Mon",1}, {"Sun",8}, {"Tue",57} } * $TESTS$ * $STATUS$ diff --git a/harbour/source/rtl/memvars.c b/harbour/source/rtl/memvars.c index ea3a27a87f..867de4cf01 100644 --- a/harbour/source/rtl/memvars.c +++ b/harbour/source/rtl/memvars.c @@ -826,7 +826,7 @@ static HB_ITEM_PTR hb_memvarDebugVariable( int iScope, int iPos, char * *pszName } else { - if( iPos < s_privateStackCnt ) + if( ( ULONG ) iPos < s_privateStackCnt ) { HB_DYNS_PTR pDynSym = s_privateStack[ iPos ]; diff --git a/harbour/source/rtl/trace.c b/harbour/source/rtl/trace.c index 9f5d21542a..2d1014f19e 100644 --- a/harbour/source/rtl/trace.c +++ b/harbour/source/rtl/trace.c @@ -33,18 +33,6 @@ * */ - -/* - * The following parts are Copyright of the individual authors. - * www - http://www.harbour-project.org - * - * Copyright 1999 Victor Szel - * HB_HB_TRACEENABLE() - * - * See doc/license.txt for licensing terms. - * - */ - #include "extend.h" HARBOUR HB_HB_TRACESTATE( void ) diff --git a/harbour/tests/Makefile b/harbour/tests/Makefile index 2b4d7e37a8..7f1066b7b9 100644 --- a/harbour/tests/Makefile +++ b/harbour/tests/Makefile @@ -143,6 +143,7 @@ PRG_SOURCES=\ testwarn.prg \ tstalias.prg \ tstcolor.prg \ + tstprag.prg \ version.prg \ while.prg \ diff --git a/harbour/tests/tstprag.prg b/harbour/tests/tstprag.prg new file mode 100644 index 0000000000..bb3f3522b1 --- /dev/null +++ b/harbour/tests/tstprag.prg @@ -0,0 +1,31 @@ +/* + * $Id$ + */ + +#pragma TracePragmas=On +#pragma ExitSeverity=1 + +/* Unknow pragmas will be ignored silently */ +#pragma BadPragma=off +#pragma /Y+ + +function Main() + +#pragma ShortCutting=On +/* or #pragma /Z+ */ + + if .t. .and. .f. + ? "Always" + endif + + if .f. .and. .t. + ? "Never" + endif + +#pragma /Z- +/* or #pragma ShortCutting=Off */ + +/* Pragmas with bad values will cause an error */ +#pragma WarningLevel=8 + +return nil