2010-02-24 20:04 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)

* src/pp/ppcore.c
  * src/compiler/cmdcheck.c
  * src/compiler/hbusage.c
  * include/hbpp.h
    + Marked "multiline strings" feature as deprecated,
      with HB_LEGACY_LEVEL3.
      It's recommended to fix such code to be compatible
      with Clipper (and other compatible) languages.
         F.e.:
         ---
            cVar := "line 1;
            line 2;
            line 3"
         ---
         to standard:
         --- F.e.:
            cVar := "line 1" +;
            "line 2" +;
            "line 3"
         ---
         or to another Harbour extension:
         ---
            #pragma __cstream|cVar := %s
            line 1
            line 2
            line 3
            ENDTEXT
         ---
      ('+' operator will be optimized out by the compiler,
      so there won't be any performance drop.)

  * utils/hbmk2/hbmk2.prg
    * Formatting.
This commit is contained in:
Viktor Szakats
2010-02-24 19:07:18 +00:00
parent aede2707a1
commit 27af8d0dd3
6 changed files with 55 additions and 6 deletions

View File

@@ -17,6 +17,41 @@
past entries belonging to author(s): Viktor Szakats.
*/
2010-02-24 20:04 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* src/pp/ppcore.c
* src/compiler/cmdcheck.c
* src/compiler/hbusage.c
* include/hbpp.h
+ Marked "multiline strings" feature as deprecated,
with HB_LEGACY_LEVEL3.
It's recommended to fix such code to be compatible
with Clipper (and other compatible) languages.
F.e.:
---
cVar := "line 1;
line 2;
line 3"
---
to standard:
--- F.e.:
cVar := "line 1" +;
"line 2" +;
"line 3"
---
or to another Harbour extension:
---
#pragma __cstream|cVar := %s
line 1
line 2
line 3
ENDTEXT
---
('+' operator will be optimized out by the compiler,
so there won't be any performance drop.)
* utils/hbmk2/hbmk2.prg
* Formatting.
2010-02-24 16:10 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* src/pp/ppcore.c
* src/compiler/cmdcheck.c

View File

@@ -582,7 +582,9 @@ typedef struct
HB_BOOL fWriteTrace; /* write translation to file (.ppt) */
HB_PATHNAMES * pIncludePath; /* search path(s) for included files */
#ifdef HB_LEGACY_LEVEL3
HB_BOOL fMultiLine; /* 'multiline strings' compatibility feature enabled */
#endif
char * szOutFileName; /* output file name */
FILE * file_out; /* output file handle */
@@ -659,7 +661,9 @@ extern void hb_pp_readRules( PHB_PP_STATE pState, const char * szRulesFile );
extern void hb_pp_setStdRules( PHB_PP_STATE pState );
extern void hb_pp_setStdBase( PHB_PP_STATE pState );
extern void hb_pp_setStream( PHB_PP_STATE pState, int iMode );
#ifdef HB_LEGACY_LEVEL3
extern void hb_pp_setMultiLine( PHB_PP_STATE pState, HB_BOOL fMultiLine );
#endif
extern void hb_pp_addSearchPath( PHB_PP_STATE pState, const char * szPath, HB_BOOL fReplace );
extern HB_BOOL hb_pp_inBuffer( PHB_PP_STATE pState, const char * pBuffer, HB_SIZE ulLen );
extern HB_BOOL hb_pp_inFile( PHB_PP_STATE pState, const char * szFileName, HB_BOOL fSearchPath, FILE * file_in, HB_BOOL fError );

View File

@@ -407,6 +407,7 @@ static void hb_compChkEnvironVar( HB_COMP_DECL, const char *szSwitch )
HB_COMP_PARAM->supported &= ~HB_COMPFLAG_OPTJUMP;
break;
#ifdef HB_LEGACY_LEVEL3
case 'L':
case 'l':
if( s[i] == '-' )
@@ -417,7 +418,7 @@ static void hb_compChkEnvironVar( HB_COMP_DECL, const char *szSwitch )
else
hb_pp_setMultiLine( HB_COMP_PARAM->pLex->pPP, HB_TRUE );
break;
#endif
case 'm':
case 'M':
if( s[i] == '+' )

View File

@@ -143,7 +143,9 @@ void hb_compPrintModes( HB_COMP_DECL )
"\n s[-] allow indexed assignment on all types",
"\n x[-] extended Xbase++ mode",
"\n j[+] turn off jump optimization in pcode",
"\n l[-] enable support for multiline strings in PP",
#ifdef HB_LEGACY_LEVEL3
"\n l[-] enable support for multiline strings (deprecated)",
#endif
"\n m[+] turn off macrotext substitution",
"\n ? this info",
"\n"

View File

@@ -50,7 +50,6 @@
*
*/
/* #define HB_PP_MULTILINE_STRING */
/* #define HB_CLP_STRICT */
/* #define HB_PP_NO_LINEINFO_TOKEN */
/* #define HB_PP_STRICT_LINEINFO_TOKEN */
@@ -318,11 +317,13 @@ static void hb_membufFlush( PHB_MEM_BUFFER pBuffer )
pBuffer->ulLen = 0;
}
#ifdef HB_LEGACY_LEVEL3
static void hb_membufRemove( PHB_MEM_BUFFER pBuffer, HB_SIZE ulLeft )
{
if( ulLeft < pBuffer->ulLen )
pBuffer->ulLen = ulLeft;
}
#endif
static HB_SIZE hb_membufLen( const PHB_MEM_BUFFER pBuffer )
{
@@ -1112,6 +1113,7 @@ static void hb_pp_getLine( PHB_PP_STATE pState )
}
}
#ifdef HB_LEGACY_LEVEL3
if( pState->fMultiLine )
{
while( ul == ulLen )
@@ -1141,7 +1143,7 @@ static void hb_pp_getLine( PHB_PP_STATE pState )
break;
}
}
#endif
u = ch != '"' ? 2 : 1;
ulStrip = ul - u;
hb_strRemEscSeq( pBuffer + u, &ulStrip );
@@ -1195,6 +1197,7 @@ static void hb_pp_getLine( PHB_PP_STATE pState )
if( ch == '`' )
ch = '\'';
while( ++ul < ulLen && pBuffer[ ul ] != ch ) {};
#ifdef HB_LEGACY_LEVEL3
if( pState->fMultiLine )
{
while( ul == ulLen )
@@ -1220,7 +1223,7 @@ static void hb_pp_getLine( PHB_PP_STATE pState )
}
}
}
#endif
hb_pp_tokenAddNext( pState, pBuffer + 1, ul - 1,
HB_PP_TOKEN_STRING );
if( ul == ulLen )
@@ -5395,6 +5398,8 @@ void hb_pp_reset( PHB_PP_STATE pState )
hb_pp_ruleListNonStdFree( &pState->pCommands );
}
#ifdef HB_LEGACY_LEVEL3
/*
* set compatibility flag for multiline strings concatenated by ';'
* f.e.:
@@ -5410,6 +5415,8 @@ void hb_pp_setMultiLine( PHB_PP_STATE pState, HB_BOOL fMultiLine )
pState->fMultiLine = fMultiLine;
}
#endif
/*
* add search path for included files
*/

View File

@@ -7824,7 +7824,7 @@ STATIC FUNCTION MacOSXFiles( hbmk, nType, cPROGNAME )
SWITCH nType
CASE 1
#pragma __cstream|cString:=%s
#pragma __cstream|cString := %s
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="0.9">