20000513-00:19 GMT+2 Maurilio Longo <maurilio.longo@libero.it>

This commit is contained in:
Maurilio Longo
2000-05-12 22:26:40 +00:00
parent 7ef7990cc1
commit c1671404ae
3 changed files with 45 additions and 39 deletions

View File

@@ -1,3 +1,14 @@
20000513-00:19 GMT+2 Maurilio Longo <maurilio.longo@libero.it>
* source/rtl/stringsx.c
* Changed StrToken() to __StrToken()
- removed unused functions
+ added standard copyright, please note that __StrToken() is NOT my work.
* source/rtl/teditor.prg
* StrToken() now is __StrToken()
* ChangeLog, now saved as unix file, only cr at end of line, forced my editor to save all files
as unix files regardless of their actual state.
20000512-08:00 GMT-8 Ron Pinkas <Ron@Profit-Master.com>
* source/compiler/harbour.y

View File

@@ -2,9 +2,38 @@
* $Id$
*/
#include "hbapi.h"
/*
* Harbour Project source code:
* __STRTOKEN() helper routine for TEDITOR.PRG
*
* Copyright 2000 Harbour project.
* 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/).
*
*/
/* TODO: search this file for TODO and find 'em! */
#include "hbapi.h"
char *hb_strtoken(char *szText,
long lText,
@@ -17,7 +46,7 @@ char *hb_strtoken(char *szText,
long wCounter = 0;
HB_TRACE(HB_TR_DEBUG, ("hb_strtoken(%s, %ld, %ld, %d, %p)", szText, lText, lIndex, (int) cDelimiter, lLen));
do
{
wStart = wEnd;
@@ -57,7 +86,7 @@ char *hb_strtoken(char *szText,
}
/* returns the nth occurence of a substring within a token-delimited string */
HB_FUNC( STRTOKEN )
HB_FUNC( __STRTOKEN )
{
char *szText;
long lIndex = hb_parnl(2);
@@ -73,37 +102,3 @@ HB_FUNC( STRTOKEN )
hb_retclen(szText, lLen);
}
/* debug function to dump the ASCII values of an entire string */
HB_FUNC( STRDUMP )
{
char *szText = hb_parc(1);
long i, lLength = hb_parclen(1);
for( i = 0; i < lLength; i++ )
printf("%d ", szText[i]);
printf("\n");
}
HB_FUNC( ROT13 )
{
if( ISCHAR(1) )
{
char *szText = hb_parc( 1 );
ULONG i, lLen = hb_parclen( 1 );
char *szResult = (char*)hb_xgrab(lLen + 1);
for( i = 0; i < lLen; i++ )
{
char c = szText[i];
if( (c >= 'A' && c <= 'M') || (c >= 'a' && c <= 'm') )
c += 13;
else if( (c >= 'N' && c <= 'Z') || (c >= 'n' && c <= 'z') )
c -= 13;
szResult[i] = c;
}
hb_retclen(szResult, lLen);
hb_xfree(szResult);
}
else
hb_retc("");
}

View File

@@ -122,7 +122,7 @@ STATIC function Text2Array(cString)
ncSLen := Len(cString)
while nRetLen < ncSLen
cLine := StrToken(cString, nTokNum++, cEOL)
cLine := __StrToken(cString, nTokNum++, cEOL)
nRetLen += Len(cLine) + iif(nEOLLen > 1, nEOLLen - 1, 1)
if nEOLLen > 1