diff --git a/harbour/ChangeLog b/harbour/ChangeLog index fbb121d1a0..08236c04d8 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,12 @@ +19991004-18:06 GMT+1 Victor Szel + + source/rtl/mlcount.c + source/rtl/Makefile + doc/funclist.txt + + MLCOUNT() added + (thanks to Ignacio Ortiz de Zúniga ) + - source/runner/stdalone/runner.prg + - Removed (now for sure) + 19991004-16:25 GMT+1 Victor Szel * source/runner/stdalone/runner.c -> hbrun.c source/runner/stdalone/Makefile diff --git a/harbour/doc/funclist.txt b/harbour/doc/funclist.txt index dfa41723c8..45ad3830ce 100644 --- a/harbour/doc/funclist.txt +++ b/harbour/doc/funclist.txt @@ -166,7 +166,7 @@ MEMOTRAN ;R; MEMOWRIT ;R; MEMVARBLOCK ;R; MIN ;R; -MLCOUNT ;N; +MLCOUNT ;R; MLCTOPOS ;N; MLPOS ;N; MOD ;R; diff --git a/harbour/source/rtl/Makefile b/harbour/source/rtl/Makefile index 842b7c2f35..e262c2d954 100644 --- a/harbour/source/rtl/Makefile +++ b/harbour/source/rtl/Makefile @@ -27,6 +27,7 @@ C_SOURCES=\ math.c \ memofile.c \ memvars.c \ + mlcount.c \ mouseapi.c \ mtran.c \ set.c \ diff --git a/harbour/source/rtl/mlcount.c b/harbour/source/rtl/mlcount.c new file mode 100644 index 0000000000..4e83a67b0c --- /dev/null +++ b/harbour/source/rtl/mlcount.c @@ -0,0 +1,103 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * MLCOUNT() function + * + * Copyright 1999 Ignacio Ortiz de Zúniga + * www - http://www.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 of the License, or + * (at your option) any later version, with one exception: + * + * The exception is that if you link the Harbour Runtime Library (HRL) + * and/or the Harbour Virtual Machine (HVM) 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 HRL + * and/or HVM code into it. + * + * 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 program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit + * their web site at http://www.gnu.org/). + * + */ + +#include "extend.h" + +HARBOUR HB_MLCOUNT( void ) +{ + char * pString = hb_parc( 1 ); + BYTE bLineLength = ISNUM( 2 ) ? hb_parni( 2 ) : 79; + BYTE bTabLength = ISNUM( 3 ) ? hb_parni( 3 ) : 4; + BYTE bLastSpace = 0; + BYTE bCurLength = 0; + BOOL bWordWrap = ISLOG( 4 ) ? hb_parl( 4 ) : TRUE; + ULONG ulLen = hb_parclen( 1 ); + ULONG ulLines = 0; + ULONG ulPos; + + if( bLineLength < 4 || bLineLength > 254 ) + bLineLength = 79; + + if( bTabLength > bLineLength ) + bTabLength = bLineLength - 1; + + for( ulPos = 0; ulPos < ulLen; ulPos++ ) + { + switch( pString[ ulPos ] ) + { + case HB_CHAR_HT: + bCurLength += bTabLength; + break; + + case HB_CHAR_LF: + bCurLength = 0; + bLastSpace = 0; + ulLines++; + break; + + case HB_CHAR_CR: + break; + + case ' ': + bCurLength++; + bLastSpace = bCurLength; + break; + + default: + bCurLength++; + } + + if( bCurLength > bLineLength ) + { + if( bWordWrap ) + { + if( bLastSpace == 0 ) + bCurLength = 1; + else + bCurLength = bCurLength - bLastSpace; + } + else + bCurLength = 1; + + ulLines++; + bLastSpace = 0; + } + } + + if( bCurLength > 0 ) + ulLines++; + + hb_retnl( ulLines ); +} diff --git a/harbour/source/runner/stdalone/runner.prg b/harbour/source/runner/stdalone/runner.prg deleted file mode 100644 index d1b9d99a6e..0000000000 --- a/harbour/source/runner/stdalone/runner.prg +++ /dev/null @@ -1,51 +0,0 @@ -/* - * $Id$ - */ - -/* - * Harbour Project source code: - * Standalone Harbour Portable Object file runner - * - * Copyright 1999 Ryszard Glab - * www - http://www.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 of the License, or - * (at your option) any later version, with one exception: - * - * The exception is that if you link the Harbour Runtime Library (HRL) - * and/or the Harbour Virtual Machine (HVM) 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 HRL - * and/or HVM code into it. - * - * 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 program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit - * their web site at http://www.gnu.org/). - * - */ - -#include "external.ch" - -FUNCTION Main( cHRBFile, cPar1, cPar2, cPar3, cPar4, cPar5, cPar6, cPar7, cPar8, cPar9 ) - LOCAL xRetVal - - IF Empty( cHRBFile ) - ?? "Harbour Runner" - ? "Copyright 1999, http://www.harbour-project.org" - ? - ? "Syntax: runner [parameters]" - ELSE - xRetVal := __hrbRun( cHRBFile, cPar1, cPar2, cPar3, cPar4, cPar5, cPar6, cPar7, cPar8, cPar9 ) - ENDIF - - RETURN xRetVal -