2011-01-17 20:52 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)

* contrib/hbmxml/hbmxml.c
    % In MXMLSAVEALLOCSTRING() strdup()-ed buffer passed directly
      to hb_retclen_buffer() replaced with plain hb_retclen() call.
      hb_retclen_buffer() is to be used only if there is already
      an allocated buffer to pass as is.
    ! MXMLSAVEALLOCSTRING() modified to not remove EOLs from
      buffers received from minixml lib. Reason two-fold: 1. hbmxml
      libs job is to be as transparent as possible, so it should not
      tamper with the contents 2. Do not make any assumptions about
      the size of EOL, which was 1, but now it can be 2 on certain
      platforms.
    ; Please review and test. There is no test code for this
      call, so I only did build tests.

  * contrib/hbfoxpro/hbfoxpro.hbp
  + contrib/hbfoxpro/misc.prg
    + Added very humble attempt to emulate SYS(). I'm no FoxPro user
      and don't have any facility to make tests against real FoxPro.
      Please fix and extend as you deem necessary.

  * bin/hb3rdpat.hbs
    + Changed tool detection to only require what's really to be
      used in a certain session.
    + Added detection to more tools.
    ; Thanks Tamas for the patch session.
This commit is contained in:
Viktor Szakats
2011-01-17 19:55:54 +00:00
parent 12280030c9
commit d985080994
5 changed files with 160 additions and 61 deletions

View File

@@ -16,6 +16,33 @@
The license applies to all entries newer than 2009-04-28.
*/
2011-01-17 20:52 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbmxml/hbmxml.c
% In MXMLSAVEALLOCSTRING() strdup()-ed buffer passed directly
to hb_retclen_buffer() replaced with plain hb_retclen() call.
hb_retclen_buffer() is to be used only if there is already
an allocated buffer to pass as is.
! MXMLSAVEALLOCSTRING() modified to not remove EOLs from
buffers received from minixml lib. Reason two-fold: 1. hbmxml
libs job is to be as transparent as possible, so it should not
tamper with the contents 2. Do not make any assumptions about
the size of EOL, which was 1, but now it can be 2 on certain
platforms.
; Please review and test. There is no test code for this
call, so I only did build tests.
* contrib/hbfoxpro/hbfoxpro.hbp
+ contrib/hbfoxpro/misc.prg
+ Added very humble attempt to emulate SYS(). I'm no FoxPro user
and don't have any facility to make tests against real FoxPro.
Please fix and extend as you deem necessary.
* bin/hb3rdpat.hbs
+ Changed tool detection to only require what's really to be
used in a certain session.
+ Added detection to more tools.
; Thanks Tamas for the patch session.
2011-01-17 19:38 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/ChangeLog
* added file name missing in my previous ChangeLog entry
@@ -46,7 +73,7 @@
2011-01-17 00:05 UTC+0200 Petr Chornyj (myorg63 at mail.ru)
* contrib/hbmxml/hbmxml.c
! Fixed warning reported by bcc55 in mxmlNewCustom()
! Fixed warning reported by bcc55 in mxmlNewCustom()
* contrib/hbmxml/tests/testmxml.prg
* Changed whitespace_cb() to respect official mxml test result
f.e. hb_eol() -> e"\n"
@@ -76,17 +103,17 @@
2011-01-16 00:40 UTC+0200 Petr Chornyj (myorg63 at mail.ru)
* contrib/hbmxml/hbmxml.c
+ Added experimental hb_mxmlGetAttrsCount(), hb_mxmlGetAttrs(),
+ Added experimental hb_mxmlGetAttrsCount(), hb_mxmlGetAttrs(),
hb_mxmlGetAttrsArray()
; WARNING: can be changed or even removed after final 2.7 miniXML release
2011-01-15 22:00 UTC+0200 Petr Chornyj (myorg63 at mail.ru)
* contrib/hbmxml/hbmxml.c
! Fixed mxmlIndexDelete(), simplified mxmlSaveString()
! Fixed mxmlIndexDelete(), simplified mxmlSaveString()
- contrib/hbmxml/tests/test.prg
- removed as unnecessary
* contrib/hbmxml/tests/testmxml.prg
* minor typo in comment
* minor typo in comment
2011-01-15 20:30 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* utils/hbmk2/hbmk2.prg

View File

@@ -12,14 +12,17 @@
* 1. CONFIGURATION
* ----------------
*
* For proper operation, the following external tools are required to be present
* somewhere in your $PATH:
* For proper operation, several of the following external tools are required to
* be present somewhere in your $PATH:
*
* - The GNU version of `patch', `diff' and `tar' (hb3rdpat will figure it out
* if you have them by the names of `gpatch', `gdiff' or `gtar')
*
* - curl, gzip, bzip2, xz and unzip (only the Info-ZIP version of unzip has been
* tested)
* - curl, gzip, bzip2, xz and unzip (only the Info-ZIP version of unzip has
* been tested)
*
* `curl' is unconditionally required for fetching source archives; the rest of the
* tools are checked for on an on-demand basis.
*
* hb3rdpat requires several meta data (in the form of specially formatted lines)
* in the component's Makefile (preferred) or .hbp file (if no Makefile is
@@ -537,7 +540,6 @@ STATIC PROCEDURE SetupTools()
#endif
LOCAL cPathComp
LOCAL cTool
LOCAL lError
/* Look for g$tool first, only attempt raw name if it isn't found
* Helps non-GNU userland systems with GNU tools installed.
@@ -558,19 +560,6 @@ STATIC PROCEDURE SetupTools()
NEXT
NEXT
lError := .F.
FOR EACH cTool in hb_HKeys( s_aTools )
IF s_aTools[ cTool ] == NIL
lError := .T.
OutStd( "E: Can not find " + cTool + hb_eol() )
ENDIF
NEXT
IF lError
ErrorLevel( 1 )
QUIT
ENDIF
RETURN
STATIC FUNCTION CombinePath( ... )
@@ -700,47 +689,58 @@ STATIC FUNCTION FetchAndExtract( cArchiveURL )
OutStd( "E: Can not find archiver for `" + ;
FNameNameExtGet( cArchiveURL ) + "'" + hb_eol() )
RETURN .F.
ELSE
/* Fetch */
cCommand := hb_strFormat( "%s -L -# -o %s %s", s_aTools[ "curl" ], ;
CombinePath( s_cTempDir, cFileName ), ;
FNameEscape( cArchiveURL ) )
TRACE( "Running " + cCommand )
nResult := hb_processRun( cCommand, , , @cStdErr, .F. )
SaveLog( "fetch", cStdOut, cStdErr )
IF nResult != 0
OutStd( "E: Error fetching " + cArchiveURL + hb_eol() )
ENDIF
/* Fetch */
IF s_aTools[ "curl" ] == NIL
OutStd( "E: Required `curl' was not found" + hb_eol() )
RETURN .F.
ENDIF
cCommand := hb_strFormat( "%s -L -# -o %s %s", s_aTools[ "curl" ], ;
CombinePath( s_cTempDir, cFileName ), FNameEscape( cArchiveURL ) )
TRACE( "Running " + cCommand )
nResult := hb_processRun( cCommand, , , @cStdErr, .F. )
SaveLog( "fetch", cStdOut, cStdErr )
IF nResult != 0
OutStd( "E: Error fetching " + cArchiveURL + hb_eol() )
RETURN .F.
ENDIF
/* Extract */
IF cExtractor != NIL /* May not need extraction */
IF s_aTools[ cExtractor ] == NIL
OutStd( "E: Required `" + cExtractor + "' was not found" + hb_eol() )
RETURN .F.
ENDIF
/* Extract */
IF cExtractor != NIL /* May not need extraction */
cCommand := hb_strFormat( "%s " + cExtractorArgs + " %s", ;
cExtractor, CombinePath( s_cTempDir, cFileName ) )
TRACE( "Running " + cCommand )
nResult := hb_processRun( cCommand, , @cStdOut, @cStdErr, .F. )
SaveLog( "extract", cStdOut, cStdErr )
IF nResult != 0
OutStd( "E: Error extracting " + cFileName + hb_eol() )
RETURN .F.
ENDIF
ELSE
cExtractedFileName := cFileName
ENDIF
/* Unarchive */
cCommand := hb_strFormat( "%s " + cArchiverArgs + " %s", ;
cArchiver, CombinePath( s_cTempDir, cExtractedFileName ) )
cCommand := hb_strFormat( "%s " + cExtractorArgs + " %s", ;
cExtractor, CombinePath( s_cTempDir, cFileName ) )
TRACE( "Running " + cCommand )
cCWD := hb_CurDrive() + hb_osDriveSeparator() + hb_ps() + CurDir()
DirChange( CombinePath( s_cTempDir, "root" ) )
nResult := hb_processRun( cCommand, , @cStdOut, @cStdErr, .F. )
DirChange( cCWD )
SaveLog( "archive", cStdOut, cStdErr )
SaveLog( "extract", cStdOut, cStdErr )
IF nResult != 0
OutStd( "E: Error unarchiving " + cFileName + hb_eol() )
OutStd( "E: Error extracting " + cFileName + hb_eol() )
RETURN .F.
ENDIF
ELSE
cExtractedFileName := cFileName
ENDIF
/* Unarchive */
IF s_aTools[ cArchiver ] == NIL
OutStd( "E: Required `" + cArchiver + "' was not found" + hb_eol() )
RETURN .F.
ENDIF
cCommand := hb_strFormat( "%s " + cArchiverArgs + " %s", ;
cArchiver, CombinePath( s_cTempDir, cExtractedFileName ) )
TRACE( "Running " + cCommand )
cCWD := hb_CurDrive() + hb_osDriveSeparator() + hb_ps() + CurDir()
DirChange( CombinePath( s_cTempDir, "root" ) )
nResult := hb_processRun( cCommand, , @cStdOut, @cStdErr, .F. )
DirChange( cCWD )
SaveLog( "archive", cStdOut, cStdErr )
IF nResult != 0
OutStd( "E: Error unarchiving " + cFileName + hb_eol() )
RETURN .F.
ENDIF
RETURN .T.

View File

@@ -12,3 +12,4 @@
-instfile=inc:hbfoxpro.ch
dll.prg
misc.prg

View File

@@ -0,0 +1,71 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* Misc FoxPro functions (feel free to expand/fix it as you like)
*
* Copyright 2010 Viktor Szakats (harbour.01 syenar.hu)
* www - http://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, 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 software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
#include "setcurs.ch"
FUNCTION SYS( nValue, xPar1 )
SWITCH nValue
CASE 0
RETURN NetName() + " # " + hb_UserName()
CASE 2
RETURN hb_ntos( Seconds() )
CASE 2002
IF ! hb_isNumeric( xPar1 )
xPar1 := SC_NONE
ENDIF
RETURN SetCursor( xPar1 )
OTHERWISE
/* Throw RTE? */
ENDSWITCH
RETURN NIL

View File

@@ -1402,7 +1402,7 @@ HB_FUNC( MXMLSAVEALLOCSTRING )
if( bytes <= 0 )
hb_retc_null();
else if( bytes < ( int ) sizeof( buffer ) )
hb_retclen_buffer( hb_strdup( buffer ), bytes - 1 ); /* Without EOL */
hb_retclen( buffer, bytes );
else
{
char * s = ( char * ) hb_xalloc( bytes + 1 );
@@ -1412,7 +1412,7 @@ HB_FUNC( MXMLSAVEALLOCSTRING )
else
{
mxmlSaveString( node, s, bytes + 1, cb );
hb_retclen_buffer( s, bytes - 1 );
hb_retclen_buffer( s, bytes );
}
}
}
@@ -1748,7 +1748,7 @@ HB_FUNC( MXMLNEWCUSTOM )
PHB_ITEM pItem = hb_itemClone( hb_param( 2, HB_IT_ANY ) );
mxml_node_t * parent = NULL;
mxml_node_t * node = NULL;
if( HB_ISNIL( 1 ) || ( HB_ISNUM( 1 ) && hb_parni( 1 ) == MXML_NO_PARENT ) )
node = mxmlNewCustom( MXML_NO_PARENT, pItem, custom_destroy_cb );
else
@@ -1927,7 +1927,7 @@ HB_FUNC( HB_MXMLGETATTRSARRAY )
mxml_attr_t * attr;
for ( i = node->value.element.num_attrs, attr = node->value.element.attrs;
i > 0;
i > 0;
i--, attr++ )
{
PHB_ITEM pAttr = hb_itemArrayNew( 2 );
@@ -1959,7 +1959,7 @@ HB_FUNC( HB_MXMLGETATTRS )
hb_hashSetFlags( pAttrs, HB_HASH_KEEPORDER );
for ( i = node->value.element.num_attrs, attr = node->value.element.attrs;
i > 0;
i > 0;
i--, attr++ )
{
PHB_ITEM pKey = hb_itemPutStrUTF8( NULL, attr->name );