2010-06-27 00:36 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)

* include/hbapicom.h
    ! Fixed missing HB_EXTERN_BEGIN/END
    + Added HB_EXTERN

  * external/patchup.prg
    ; Patch and log text by Tamas Tevesz:
    + don't let first `map' source be non-flat (would break
      tree top search)
    + on errors, also cite line numbers for easier makefile debugging
    + check and enforce destination files to fit in the 8+3 naming
      scheme
    + document (mis)features of, and requirements for `URL' + small
      clarifications
This commit is contained in:
Viktor Szakats
2010-06-26 22:39:46 +00:00
parent 1a199ad2d3
commit b38dbedf33
3 changed files with 82 additions and 31 deletions

View File

@@ -16,6 +16,21 @@
The license applies to all entries newer than 2009-04-28.
*/
2010-06-27 00:36 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* include/hbapicom.h
! Fixed missing HB_EXTERN_BEGIN/END
+ Added HB_EXTERN
* external/patchup.prg
; Patch and log text by Tamas Tevesz:
+ don't let first `map' source be non-flat (would break
tree top search)
+ on errors, also cite line numbers for easier makefile debugging
+ check and enforce destination files to fit in the 8+3 naming
scheme
+ document (mis)features of, and requirements for `URL' + small
clarifications
2010-06-27 00:08 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbqt/utils/hbqtui.prg
* contrib/hbqt/utils/hbqtui.hbp

View File

@@ -56,9 +56,18 @@
* patchup can currently unpack only `tar.gz', `tar.bz2', `tgz', `tbz',
* `tbz2' or `zip' archives -- one of these must be chosen.
*
* patchup will also use the URL parameter to figure out what type of
* file it is working with, so a URL containing this sort if information must
* be picked. As an example, SourceForge-style distributed download URLs like
* `http://sourceforge.net/projects/libpng/files/01-libpng-master/1.4.2/lpng142.zip/download'
* are OK, but `http://example.com/download/latest' is not, even if latter
* would ultimately result (perhaps by the server using Content-Disposition
* or similar headers) in a file named `example-pkg-54.tar.gz'.
*
* DIFF
* Takes one argument, the file name of the diff file containing local changes
* needed by Harbour.
* needed by Harbour. In `rediff' mode, this parameter is optional; if not
* specified, defaults to `$(component).dif'.
* Example: for PCRE, it is `pcre.dif'.
*
* MAP
@@ -78,6 +87,7 @@
* to the Harbour tree unchanged. In case of PCRE, `MAP LICENCE' being the
* first `MAP' line also means that patchup will use the directory
* containing this file as a base for all other files occurring later.
* Accordingly, the first `MAP' entry must be flat even on the source side.
*
* # MAP config.h.generic config.h
*
@@ -240,6 +250,7 @@ PROCEDURE Main( ... )
LOCAL cFile /* memoized Makefile */
LOCAL aRegexMatch /* regex match results */
LOCAL cMemoLine /* MemoLine */
LOCAL nMemoLine /* Line number */
LOCAL cDiffFile /* Local modifications */
LOCAL cCWD
LOCAL cThisComponent /* component being processed */
@@ -285,9 +296,12 @@ PROCEDURE Main( ... )
cFile := MemoRead( "Makefile" )
cDiffFile := NIL /* default to `no local diff' */
nMemoLine := 0
FOR EACH cMemoLine IN hb_ATokens( StrTran( cFile, Chr( 13 ) ), Chr( 10 ) )
cMemoLine := AllTrim( cMemoLine )
nMemoLine++
IF ! Empty( aRegexMatch := hb_regex( hRegexTake1Line, cMemoLine ) )
/* Process one-arg keywords */
@@ -303,14 +317,16 @@ PROCEDURE Main( ... )
IF aRegexMatch[ TWOARG_KW ] == "MAP"
/* Do not allow implicit destination with non-flat source spec */
IF Empty( aRegexMatch[ TWOARG_ARG1 ] ) .AND. "/" $ aRegexMatch[ TWOARG_ARG2 ]
OutStd( "E: Non-flat source spec with implicit destination, offending line:" + OSNL )
OutStd( hb_strFormat( "E: Non-flat source spec with implicit " + ;
"destination, offending line %d:%s:", nMemoLine, OSNL ) )
OutStd( aRegexMatch[ 1 ] + OSNL )
ErrorLevel( 2 )
QUIT
ENDIF
/* Do not allow tree spec in the destination ever */
IF "/" $ aRegexMatch[ TWOARG_ARG2 ]
OutStd( "E: Non-flat destination, offending line:" + OSNL )
OutStd( hb_strFormat( "E: Non-flat destination, offending line %d:%s", ;
nMemoLine, OSNL ) )
OutStd( aRegexMatch[ 1 ] + OSNL )
ErrorLevel( 2 )
QUIT
@@ -320,20 +336,36 @@ PROCEDURE Main( ... )
IF "/" $ aRegexMatch[ TWOARG_ARG1 ]
aRegexMatch[ TWOARG_ARG1 ] := StrTran( aRegexMatch[ TWOARG_ARG1 ], "/", OSPS )
ENDIF
/* The destination argument must fit in the 8+3 scheme */
IF Len( FN_NameGet( aRegexMatch[ TWOARG_ARG2 ] ) ) > 8 .OR. ;
Len( FN_ExtGet( aRegexMatch[ TWOARG_ARG2 ] ) ) > 3
OutStd( hb_strFormat( "E: Destination does not fit 8+3, offending "+ ;
"line %d:%s", nMemoLine, OSNL ) )
OutStd( aRegexMatch[ 1 ] + OSNL )
ErrorLevel( 2 )
QUIT
ENDIF
/* In case the priginal and the HB file names are identical, the
* second argument to `MAP' is optional. Due to the way the regex is
* constructed, in this case the last backref will contain the only
* file name, so shuffle arguments around accordingly
*/
AAdd( s_aChangeMap, { ;
iif( Empty( aRegexMatch[ TWOARG_ARG1 ] ), ;
aRegexMatch[ TWOARG_ARG2 ], ;
aRegexMatch[ TWOARG_ARG1 ] ), aRegexMatch[ TWOARG_ARG2 ] ;
AAdd( s_aChangeMap, { ;
iif( Empty( aRegexMatch[ TWOARG_ARG1 ] ), ;
aRegexMatch[ TWOARG_ARG2 ], ;
aRegexMatch[ TWOARG_ARG1 ] ), aRegexMatch[ TWOARG_ARG2 ] ;
} )
/* If this is the first MAP entry, treat the original part as the
* source tree root indicator */
IF Len( s_aChangeMap ) == 1
cTopIndicator := s_aChangeMap[ 1 ][ FN_ORIG ]
IF "/" $ cTopIndicator
OutStd( hb_strFormat( "E: First `MAP' entry is not flat, offending " + ;
"line %d:%s", nMemoLine, OSNL ) )
OutStd( aRegexMatch[ 1 ] + OSNL )
ErrorLevel( 2 )
QUIT
ENDIF
ENDIF
ENDIF
ENDIF

View File

@@ -56,6 +56,8 @@
#include "hbcom.ch"
#include "hbapi.h"
HB_EXTERN_BEGIN
#define HB_COM_PORT_MAX 256
#define HB_COM_DEV_NAME_MAX 64
@@ -65,29 +67,31 @@
#define HB_COM_ENABLED 1
#define HB_COM_OPEN 2
extern int hb_comLastNum( void );
extern int hb_comOpen( int iPort );
extern int hb_comClose( int iPort );
extern int hb_comInit( int iPort, int iBaud, int iParity, int iSize, int iStop );
extern long hb_comSend( int iPort, const void * data, long len, HB_MAXINT timeout );
extern long hb_comRecv( int iPort, void * data, long len, HB_MAXINT timeout );
extern int hb_comGetError( int iPort );
extern int hb_comGetOsError( int iPort );
extern int hb_comInputCount( int iPort );
extern int hb_comOutputCount( int iPort );
extern int hb_comFlush( int iPort, int iType );
extern int hb_comMCR( int iPort, int * piValue, int iClr, int iSet );
extern int hb_comMSR( int iPort, int * piValue );
extern int hb_comLSR( int iPort, int * piValue );
extern int hb_comSendBreak( int iPort, int iDurationInMilliSecs );
extern int hb_comFlowControl( int iPort, int *piFlow, int iFlow );
extern int hb_comFlowSet( int iPort, int iFlow );
extern int hb_comFlowChars( int iPort, int iXONchar, int iXOFFchar );
extern int hb_comDiscardChar( int iPort, int iChar );
extern int hb_comErrorChar( int iPort, int iChar );
extern int hb_comOutputState( int iPort );
extern int hb_comInputState( int iPort );
extern int hb_comSetDevice( int iPort, const char * szDevName );
extern const char * hb_comGetDevice( int iPort, char * buffer, int size );
extern HB_EXPORT int hb_comLastNum( void );
extern HB_EXPORT int hb_comOpen( int iPort );
extern HB_EXPORT int hb_comClose( int iPort );
extern HB_EXPORT int hb_comInit( int iPort, int iBaud, int iParity, int iSize, int iStop );
extern HB_EXPORT long hb_comSend( int iPort, const void * data, long len, HB_MAXINT timeout );
extern HB_EXPORT long hb_comRecv( int iPort, void * data, long len, HB_MAXINT timeout );
extern HB_EXPORT int hb_comGetError( int iPort );
extern HB_EXPORT int hb_comGetOsError( int iPort );
extern HB_EXPORT int hb_comInputCount( int iPort );
extern HB_EXPORT int hb_comOutputCount( int iPort );
extern HB_EXPORT int hb_comFlush( int iPort, int iType );
extern HB_EXPORT int hb_comMCR( int iPort, int * piValue, int iClr, int iSet );
extern HB_EXPORT int hb_comMSR( int iPort, int * piValue );
extern HB_EXPORT int hb_comLSR( int iPort, int * piValue );
extern HB_EXPORT int hb_comSendBreak( int iPort, int iDurationInMilliSecs );
extern HB_EXPORT int hb_comFlowControl( int iPort, int *piFlow, int iFlow );
extern HB_EXPORT int hb_comFlowSet( int iPort, int iFlow );
extern HB_EXPORT int hb_comFlowChars( int iPort, int iXONchar, int iXOFFchar );
extern HB_EXPORT int hb_comDiscardChar( int iPort, int iChar );
extern HB_EXPORT int hb_comErrorChar( int iPort, int iChar );
extern HB_EXPORT int hb_comOutputState( int iPort );
extern HB_EXPORT int hb_comInputState( int iPort );
extern HB_EXPORT int hb_comSetDevice( int iPort, const char * szDevName );
extern HB_EXPORT const char * hb_comGetDevice( int iPort, char * buffer, int size );
HB_EXTERN_END
#endif /* HB_APICOM_H_ */