2011-02-14 10:20 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)

* src/rtl/hbdoc.prg
    + Added logic to detect in which column the actual 
      content starts and read it accordingly.
      It uses the first content line as a base, so if 
      that one is wrong, the content will be read wrongly 
      and such NG sources should be fixed manually.
    * On output it will always start content in column 8 (base 1).

  * contrib/hbmysql/mysql.c
    ! MYSQL_REAL_ESCAPE_STRING() fixed taking wrong params.
      Reported by Bacco, thanks!

  * contrib/hbrun/pullext.prg
  * contrib/hbrun/hbrun.prg
  * contrib/hbrun/plugins.prg
  * contrib/hbrun/headers.prg
    * Formatting.
This commit is contained in:
Viktor Szakats
2011-02-14 09:21:22 +00:00
parent 8ac1677385
commit 73bdced7d3
7 changed files with 43 additions and 20 deletions

View File

@@ -16,6 +16,25 @@
The license applies to all entries newer than 2009-04-28.
*/
2011-02-14 10:20 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* src/rtl/hbdoc.prg
+ Added logic to detect in which column the actual
content starts and read it accordingly.
It uses the first content line as a base, so if
that one is wrong, the content will be read wrongly
and such NG sources should be fixed manually.
* On output it will always start content in column 8 (base 1).
* contrib/hbmysql/mysql.c
! MYSQL_REAL_ESCAPE_STRING() fixed taking wrong params.
Reported by Bacco, thanks!
* contrib/hbrun/pullext.prg
* contrib/hbrun/hbrun.prg
* contrib/hbrun/plugins.prg
* contrib/hbrun/headers.prg
* Formatting.
2011-02-14 01:04 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* src/rtl/hbdoc.prg
* tests/hbdocext.prg

View File

@@ -576,8 +576,8 @@ HB_FUNC( MYSQL_REAL_ESCAPE_STRING ) /* unsigned long STDCALL mysql_real_escape_s
if( mysql )
{
const char * from = hb_parcx( 1 );
unsigned long nSize = ( unsigned long ) hb_parclen( 1 );
const char * from = hb_parcx( 2 );
unsigned long nSize = ( unsigned long ) hb_parclen( 2 );
char * buffer = ( char * ) hb_xgrab( nSize * 2 + 1 );
nSize = mysql_real_escape_string( mysql, buffer, from, nSize );
hb_retclen_buffer( ( char * ) buffer, nSize );

View File

@@ -247,7 +247,7 @@ STATIC FUNCTION plugins_load( hPlugins, aParams )
SWITCH Lower( hb_FNameExt( cFile:__enumKey() ) )
CASE ".hbs"
CASE ".prg"
cFile := hb_compileFromBuf( cFile, "-n2", "-w", "-es2", "-q0" )
cFile := hb_compileFromBuf( cFile, hb_ProgName(), "-n2", "-w", "-es2", "-q0" )
IF cFile == NIL
EXIT
ENDIF
@@ -303,7 +303,7 @@ STATIC FUNCTION plugins_valid_id( plugins, cID )
RETURN .F.
STATIC FUNCTION plugins_valid_list( plugins )
STATIC FUNCTION plugins_valid_id_list( plugins )
LOCAL plugin
LOCAL aList := {}
@@ -345,11 +345,11 @@ STATIC PROCEDURE hbrun_Prompt( aParams, cCommand )
hbrun_HistoryLoad()
AADD( s_aHistory, padr( "quit", HB_LINE_LEN ) )
AAdd( s_aHistory, padr( "quit", HB_LINE_LEN ) )
nHistIndex := Len( s_aHistory ) + 1
IF ISCHARACTER( cCommand )
AADD( s_aHistory, PadR( cCommand, HB_LINE_LEN ) )
AAdd( s_aHistory, PadR( cCommand, HB_LINE_LEN ) )
hbrun_Info( cCommand )
hbrun_Exec( cCommand )
ELSE
@@ -378,7 +378,7 @@ STATIC PROCEDURE hbrun_Prompt( aParams, cCommand )
nMaxCol := MaxCol()
@ nMaxRow, 0 SAY cDomain + "."
@ nMaxRow, Col() GET cLine ;
PICTURE "@KS" + hb_NToS( nMaxCol - Col() + 1 )
PICTURE "@KS" + hb_ntos( nMaxCol - Col() + 1 )
SetCursor( iif( ReadInsert(), SC_INSERT, SC_NORMAL ) )
@@ -402,7 +402,7 @@ STATIC PROCEDURE hbrun_Prompt( aParams, cCommand )
SetKey( K_INS, bKeyIns )
SetKey( HB_K_RESIZE, bKeyResize )
IF LastKey() == K_ESC .OR. EMPTY( cLine ) .OR. ;
IF LastKey() == K_ESC .OR. Empty( cLine ) .OR. ;
( lResize .AND. LastKey() == K_ENTER )
IF lResize
lResize := .F.
@@ -438,7 +438,7 @@ STATIC PROCEDURE hbrun_Prompt( aParams, cCommand )
ELSEIF plugins_valid_id( plugins, SubStr( cCommand, 2 ) )
cDomain := SubStr( cCommand, 2 )
ELSE
FOR EACH tmp IN plugins_valid_list( plugins )
FOR EACH tmp IN plugins_valid_id_list( plugins )
hbrun_ToConsole( "." + tmp )
NEXT
ENDIF
@@ -573,7 +573,7 @@ STATIC PROCEDURE hbrun_Err( oErr, cCommand )
ELSEIF ISCHARACTER( oErr )
cMessage += oErr
ENDIF
cMessage += ";;" + ProcName( 2 ) + "(" + hb_NToS( ProcLine( 2 ) ) + ")"
cMessage += ";;" + ProcName( 2 ) + "(" + hb_ntos( ProcLine( 2 ) ) + ")"
Alert( cMessage )
@@ -593,7 +593,7 @@ STATIC PROCEDURE hbrun_Exec( cCommand )
BEGIN SEQUENCE WITH {|oErr| hbrun_Err( oErr, cCommand ) }
cHRB := HB_COMPILEFROMBUF( cFunc, hb_ProgName(), "-n2", "-q2" )
cHRB := hb_compileFromBuf( cFunc, hb_ProgName(), "-n2", "-q2" )
IF cHRB == NIL
EVAL( ErrorBlock(), "Syntax error." )
ELSE

View File

@@ -4,7 +4,7 @@
/*
* Harbour Project source code:
* Header puller
* header puller
*
* Copyright 2010-2011 Przemyslaw Czerpak <druzus / at / priv.onet.pl>
* www - http://harbour-project.org

View File

@@ -4,7 +4,7 @@
/*
* Harbour Project source code:
* plugin puller
* plugin container
*
* Copyright 2011 Viktor Szakats (harbour.01 syenar.hu)
* www - http://harbour-project.org
@@ -54,9 +54,7 @@
#pragma __streaminclude <(cFile)>|<hash>\[ <(cFile)> \] := %s
FUNCTION __hbrun_plugins()
LOCAL hPlugins
hPlugins := { => }
LOCAL hPlugins := { => }
ADD PLUGIN TO hPlugins FILE "netioeng.prg"

View File

@@ -50,11 +50,11 @@
*
*/
#xtranslate PULLEXT <cName> => REQUEST __HBEXTERN__<cName>__ ; AAdd( aList, Lower( <"cName"> ) )
FUNCTION __hbrun_extensions()
LOCAL aList := {}
#xtranslate PULLEXT <cName> => REQUEST __HBEXTERN__<cName>__ ; AAdd( aList, Lower( <"cName"> ) )
PULLEXT hbct
PULLEXT hbexpat
PULLEXT hbmemio

View File

@@ -156,6 +156,7 @@ STATIC PROCEDURE __hbdoc__read_stream( aEntry, cFile, cFileName, hMeta, aErrMsg
LOCAL cSection
LOCAL tmp
LOCAL nLine
LOCAL nStartCol
cFile := StrTran( cFile, Chr( 13 ) )
cFile := StrTran( cFile, Chr( 9 ), " " )
@@ -203,8 +204,13 @@ STATIC PROCEDURE __hbdoc__read_stream( aEntry, cFile, cFileName, hMeta, aErrMsg
ELSEIF ! Empty( cSection )
IF ! Empty( hEntry[ cSection ] )
hEntry[ cSection ] += Chr( 13 ) + Chr( 10 )
ELSE
/* some "heuristics" to detect in which column the real content starts,
we assume the first line of content is correct, and use this with all
consecutive lines. [vszakats] */
nStartCol := Len( cLine ) - Len( LTrim( cLine ) ) + 1
ENDIF
hEntry[ cSection ] += cLine
hEntry[ cSection ] += SubStr( cLine, nStartCol )
ELSEIF ! Empty( cLine )
_HBDOC_ADD_MSG( aErrMsg, hb_StrFormat( "Warning: %1$s: %2$s: Content outside section", cFileName, hb_ntos( nLine ) ) )
ENDIF
@@ -232,7 +238,7 @@ FUNCTION __hbdoc_ToSource( aEntry )
!( Left( item:__enumKey(), 1 ) == "_" )
cSource += " * $" + item:__enumKey() + "$" + hb_eol()
FOR EACH cLine IN hb_ATokens( StrTran( item, Chr( 13 ) ), Chr( 10 ) )
cSource += " * " + cLine + hb_eol()
cSource += " * " + Space( 4 ) + cLine + hb_eol()
NEXT
ENDIF
NEXT