From c1671404ae1de6a02b003de3eabce70cff8d8eaf Mon Sep 17 00:00:00 2001 From: Maurilio Longo Date: Fri, 12 May 2000 22:26:40 +0000 Subject: [PATCH] 20000513-00:19 GMT+2 Maurilio Longo --- harbour/ChangeLog | 11 ++++++ harbour/source/rtl/stringsx.c | 71 ++++++++++++++++------------------ harbour/source/rtl/teditor.prg | 2 +- 3 files changed, 45 insertions(+), 39 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 0429c1938f..d343c703a4 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,14 @@ +20000513-00:19 GMT+2 Maurilio Longo + + * 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 * source/compiler/harbour.y diff --git a/harbour/source/rtl/stringsx.c b/harbour/source/rtl/stringsx.c index ade5a3e252..7e31f98832 100644 --- a/harbour/source/rtl/stringsx.c +++ b/harbour/source/rtl/stringsx.c @@ -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(""); -} diff --git a/harbour/source/rtl/teditor.prg b/harbour/source/rtl/teditor.prg index 7dff9e009a..a455812a1e 100644 --- a/harbour/source/rtl/teditor.prg +++ b/harbour/source/rtl/teditor.prg @@ -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