*** empty log message ***

This commit is contained in:
Martin Vogel
2001-04-20 08:55:10 +00:00
parent f3de1da8cb
commit 71dca700b4
14 changed files with 409 additions and 136 deletions

View File

@@ -1,3 +1,38 @@
2001-04-20 10:50 CET Martin Vogel <vogel@inttec.de>
+ contrib/libct/charevod.c
- contrib/libct/ctchrevn.c
- contrib/libct/ctchrodd.c
! CHAREVEN() & CHARODD() functions merged to one file, some corrections
* contrib/libct/Makefile
* changed lib name to "ct3" again (sorry !)
+ added contrib/libct/charevod.c
- removed contrib/libct/ctchrevn.c
- removed contrib/libct/ctchrodd.c
* contrib/libct/makefile.bc
* changed lib name to "ct3" again (sorry !)
+ added contrib/libct/charevod.c
- removed contrib/libct/ctchrevn.c
- removed contrib/libct/ctchrodd.c
* contrib/libct/makefile.vc
* changed lib name to "ct3" again (sorry !)
+ added contrib/libct/charevod.c
- removed contrib/libct/ctchrevn.c
- removed contrib/libct/ctchrodd.c
+ contrib/libct/tests/chareven.prg
! Small test program for chareven()
+ contrib/libct/tests/charodd.prg
! Small test program for charodd()
* contrib/libct/tests/Makefile
+ added contrib/libct/tests/chareven.prg
+ added contrib/libct/tests/charodd.prg
2001-04-20 01:35 UTC-0800 Ron Pinkas <ron@profit-master.com>
* hb_slex.bc
* Synched with makefile.bc

View File

@@ -8,12 +8,11 @@ C_SOURCES=\
addascii.c \
atadjust.c \
atnum.c \
charevod.c \
ctset.c \
ctstr.c \
ctchksum.c \
ctchrevn.c \
ctchrmix.c \
ctchrodd.c \
ctcolton.c \
ctcrypt.c \
ctposupp.c \
@@ -22,6 +21,6 @@ PRG_SOURCES=\
ctmisc.prg \
cttoken.prg \
LIBNAME=libct
LIBNAME=ct3
include $(TOP)$(ROOT)config/lib.cf

View File

@@ -114,7 +114,7 @@
* $PLATFORMS$
* All
* $FILES$
* Source is addascii.c, library is libct.
* Source is addascii.c, library is ct3.
* $SEEALSO$
* CSETREF()
* $END$

View File

@@ -92,7 +92,7 @@
* $PLATFORMS$
* All
* $FILES$
* Source is atadjust.c, library is libct.
* Source is atadjust.c, library is ct3.
* $SEEALSO$
* SETATLIKE() CSETATMUPA()
* $END$

View File

@@ -340,7 +340,7 @@ static void do_atnum (int iSwitch)
* $PLATFORMS$
* All
* $FILES$
* Source is atnum.c, library is libct.
* Source is atnum.c, library is ct3.
* $SEEALSO$
* ATNUM() BEFORATNUM() CSETATMUPA() SETATLIKE()
* $END$
@@ -405,7 +405,7 @@ HB_FUNC (AFTERATNUM)
* $PLATFORMS$
* All
* $FILES$
* Source is atnum.c, library is libct.
* Source is atnum.c, library is ct3.
* $SEEALSO$
* ATNUM() AFTERATNUM() CSETATMUPA() SETATLIKE()
* $END$

View File

@@ -0,0 +1,201 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* CT3 string functions
* - CHAREVEN()
* - CHARODD()
*
* Copyright 2000 Victor Szakats <info@szelvesz.hu>
*
* Merged into one file for optimization and some small corrections:
* (c) 2001 IntTec GmbH, Neunlindenstr 32, 79106 Freiburg, Germany
* Author: Martin Vogel <vogel@inttec.de>
*
* 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, 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 "ct.h"
#define DO_CHAREVOD_CHAREVEN 0
#define DO_CHAREVOD_CHARODD 1
/* helper function */
static void do_charevod (int iSwitch)
{
if (ISCHAR (1))
{
char *pcString = hb_parc (1);
size_t sLen = hb_parclen (1);
char *pcResult;
size_t sPos, sResultPos;
if (sLen == 0)
{
hb_retc ("");
return;
}
pcResult = hb_xgrab ((sLen+1)/2);
if (iSwitch == DO_CHAREVOD_CHAREVEN)
sPos = 1;
else
sPos = 0;
sResultPos = 0;
for (; sPos < sLen; sPos+=2)
pcResult[sResultPos++] = pcString[sPos];
if (sResultPos == 0)
hb_retc ("");
else
hb_retclen (pcResult, sResultPos);
hb_xfree (pcResult);
}
else
{
hb_retc ("");
}
}
/* $DOC$
* $FUNCNAME$
* CHAREVEN()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Returns the characters on the even positions in a string
* $SYNTAX$
* CHAREVEN (<cString>) --> cEvenString
* $ARGUMENTS$
* <cString> processed string
* $RETURNS$
* <cEvenString> a string containing all character from even positions
* in <cString>
* $DESCRIPTION$
* The CHAREVEN() function looks for the characters on the even positions
* in a given string, collects them and returns them as a string.
* $EXAMPLES$
* ? CHAREVEN (" H E L L O !") -> "HELLO!"
* $TESTS$
* CHAREVEN (" 1 2 3 4 5") == "12345"
* CHAREVEN (" 1 2 3 4 ") == "1234"
* CHAREVEN (" ") == ""
* $STATUS$
* Ready
* $COMPLIANCE$
* CHAREVEN() is compatible with CT3's CHAREVEN().
* $PLATFORMS$
* All
* $FILES$
* Source is charevod.c, library is ct3.
* $SEEALSO$
* CHARODD() CHARMIX()
* $END$
*/
HB_FUNC (CHAREVEN)
{
do_charevod (DO_CHAREVOD_CHAREVEN);
return;
}
/* $DOC$
* $FUNCNAME$
* CHARODD()
* $CATEGORY$
* CT3 string functions
* $ONELINER$
* Returns the characters on the odd positions in a string
* $SYNTAX$
* CHARODD (<cString>) --> cOddString
* $ARGUMENTS$
* <cString> processed string
* $RETURNS$
* <cOddString> a string containing all character from odd positions
* in <cString>
* $DESCRIPTION$
* The CHARODD() function looks for the characters on the odd positions
* in a given string, collects them and returns them as a string.
* $EXAMPLES$
* ? CHARODD ("H E L L O ! ") -> "HELLO!"
* $TESTS$
* CHARODD ("1A2B3C4D5E") == "12345"
* CHARODD ("1A2B3C4D5") == "12345"
* $STATUS$
* Ready
* $COMPLIANCE$
* CHARODD() is compatible with CT3's CHARODD().
* $PLATFORMS$
* All
* $FILES$
* Source is charevod.c, library is ct3.
* $SEEALSO$
* CHAREVEN() CHARMIX()
* $END$
*/
HB_FUNC (CHARODD)
{
do_charevod (DO_CHAREVOD_CHARODD);
return;
}

View File

@@ -1,55 +0,0 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* CHAREVEN() CA-Tools function
*
* Copyright 2000 Victor Szakats <info@szelvesz.hu>
* 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 "hbapi.h"
HB_FUNC( CHAREVEN )
{
if( ISCHAR( 1 ) )
{
char * pszSource = hb_parc( 1 );
ULONG ulLen = hb_parclen( 1 );
ULONG i;
char * pszResult = ( char * ) hb_xgrab( ulLen / 2 );
for( i = 1; i <= ulLen; i += 2 )
pszResult[ ( i - 1 ) / 2 ] = pszSource[ i ];
hb_retclen( pszResult, ulLen );
hb_xfree( pszResult );
}
else
hb_retc( "" );
}

View File

@@ -1,55 +0,0 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* CHARODD() CA-Tools function
*
* Copyright 2000 Victor Szakats <info@szelvesz.hu>
* 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 "hbapi.h"
HB_FUNC( CHARODD )
{
if( ISCHAR( 1 ) )
{
char * pszSource = hb_parc( 1 );
ULONG ulLen = hb_parclen( 1 );
ULONG i;
char * pszResult = ( char * ) hb_xgrab( ulLen / 2 );
for( i = 0; i <= ulLen; i += 2 )
pszResult[ i / 2 ] = pszSource[ i ];
hb_retclen( pszResult, ulLen );
hb_xfree( pszResult );
}
else
hb_retc( "" );
}

View File

@@ -127,7 +127,7 @@ int ct_getref (void)
* $PLATFORMS$
* All
* $FILES$
* Source is ctset.c, library is libct.
* Source is ctset.c, library is ct3.
* $SEEALSO$
* ADDASCII() BLANK() CHARADD()
* CHARAND() CHARMIRR() CHARNOT()
@@ -209,7 +209,7 @@ int ct_getatmupa (void)
* $PLATFORMS$
* All
* $FILES$
* Source is ctset.c, library is libct.
* Source is ctset.c, library is ct3.
* $SEEALSO$
* ATNUM() AFTERATNUM() BEFORATNUM()
* ATREPL() NUMAT() ATADJUST()
@@ -322,7 +322,7 @@ char ct_getatlikechar (void)
* $PLATFORMS$
* All
* $FILES$
* Source is ctset.c, header is ct.ch, library is libct.
* Source is ctset.c, header is ct.ch, library is ct3.
* $SEEALSO$
* $END$
*/

View File

@@ -77,7 +77,7 @@ LDFLAGS = $(LDFLAGS)
# Macros to access our library names
#
TOOLS_LIB = $(LIB_DIR)\libct.lib
TOOLS_LIB = $(LIB_DIR)\ct3.lib
HARBOUR_EXE = $(BIN_DIR)\harbour.exe
@@ -93,12 +93,11 @@ TOOLS_LIB_OBJS = \
$(OBJ_DIR)\addascii.obj \
$(OBJ_DIR)\atadjust.obj \
$(OBJ_DIR)\atnum.obj \
$(OBJ_DIR)\charevod.obj \
$(OBJ_DIR)\ctset.obj \
$(OBJ_DIR)\ctstr.obj \
$(OBJ_DIR)\ctchksum.obj \
$(OBJ_DIR)\ctchrevn.obj \
$(OBJ_DIR)\ctchrmix.obj \
$(OBJ_DIR)\ctchrodd.obj \
$(OBJ_DIR)\ctcolton.obj \
$(OBJ_DIR)\ctcrypt.obj \
$(OBJ_DIR)\ctposupp.obj \
@@ -135,6 +134,10 @@ $(OBJ_DIR)\atnum.obj : $(TOOLS_DIR)\atnum.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,,
$(OBJ_DIR)\charevod.obj : $(TOOLS_DIR)\charevod.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,,
$(OBJ_DIR)\ctset.obj : $(TOOLS_DIR)\ctset.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,,
@@ -147,18 +150,10 @@ $(OBJ_DIR)\ctchksum.obj : $(TOOLS_DIR)\ctchksum.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,,
$(OBJ_DIR)\ctchrevn.obj : $(TOOLS_DIR)\ctchrevn.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,,
$(OBJ_DIR)\ctchrmix.obj : $(TOOLS_DIR)\ctchrmix.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,,
$(OBJ_DIR)\ctchrodd.obj : $(TOOLS_DIR)\ctchrodd.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,,
$(OBJ_DIR)\ctcolton.obj : $(TOOLS_DIR)\ctcolton.c
$(CC) $(CLIBFLAGS) -o$@ $**
tlib $(TOOLS_LIB) $(ARFLAGS) -+$@,,

View File

@@ -76,7 +76,7 @@ LDFLAGS = $(LDFLAGS)
# Macros to access our library names
#
TOOLS_LIB = $(LIB_DIR)\libct.lib
TOOLS_LIB = $(LIB_DIR)\ct3.lib
HARBOUR_EXE = $(BIN_DIR)\harbour.exe
@@ -113,12 +113,11 @@ TOOLS_LIB_OBJS = \
$(OBJ_DIR)\addascii.obj \
$(OBJ_DIR)\atadjust.obj \
$(OBJ_DIR)\atnum.obj \
$(OBJ_DIR)\charevod.obj \
$(OBJ_DIR)\ctset.obj \
$(OBJ_DIR)\ctstr.obj \
$(OBJ_DIR)\ctchksum.obj \
$(OBJ_DIR)\ctchrevn.obj \
$(OBJ_DIR)\ctchrmix.obj \
$(OBJ_DIR)\ctchrodd.obj \
$(OBJ_DIR)\ctcolton.obj \
$(OBJ_DIR)\ctcrypt.obj \
$(OBJ_DIR)\ctposupp.obj \
@@ -138,12 +137,11 @@ CLEAN:
-@if exist $(OBJ_DIR)\addascii.* del $(OBJ_DIR)\addascii.*
-@if exist $(OBJ_DIR)\atadjust.* del $(OBJ_DIR)\atadjust.*
-@if exist $(OBJ_DIR)\atnum.* del $(OBJ_DIR)\atnum.*
-@if exist $(OBJ_DIR)\charevod.* del $(OBJ_DIR)\charevod.*
-@if exist $(OBJ_DIR)\ctset.* del $(OBJ_DIR)\ctset.*
-@if exist $(OBJ_DIR)\ctstr.* del $(OBJ_DIR)\ctstr.*
-@if exist $(OBJ_DIR)\ctchksum.* del $(OBJ_DIR)\ctchksum.*
-@if exist $(OBJ_DIR)\ctchrevn.* del $(OBJ_DIR)\ctchrevn.*
-@if exist $(OBJ_DIR)\ctchrmix.* del $(OBJ_DIR)\ctchrmix.*
-@if exist $(OBJ_DIR)\ctchrodd.* del $(OBJ_DIR)\ctchrodd.*
-@if exist $(OBJ_DIR)\ctcolton.* del $(OBJ_DIR)\ctcolton.*
-@if exist $(OBJ_DIR)\ctcrypt.* del $(OBJ_DIR)\ctcrypt.*
-@if exist $(OBJ_DIR)\ctposupp.* del $(OBJ_DIR)\ctposupp.*

View File

@@ -35,6 +35,8 @@ PRG_SOURCES=\
atadjust.prg \
atnum.prg \
beforatn.prg \
chareven.prg \
charodd.prg \
csetref.prg \
csetatmu.prg \
setatlik.prg \

View File

@@ -0,0 +1,77 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* Test CT3 function CHAREVEN()
*
* Copyright 2001 IntTec GmbH, Neunlindenstr 32, 79106 Freiburg, Germany
* Author: Martin Vogel <vogel@inttec.de>
*
* 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, 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 "../ct.ch"
procedure main
qout ("Begin test of CHAREVEN()")
qout ("")
// simple tests
qout ("Simple tests:")
qout ([ chareven (" 1 2 3 4 5") == "12345" ? --> "] + chareven (" 1 2 3 4 5") + ["])
qout ([ chareven (" 1 2 3 4 ") == "1234" ? --> "] + chareven (" 1 2 3 4 ") + ["])
qout ([ chareven (" ") == "" ? --> "] + chareven (" ") + ["])
qout ("End test of CHAREVEN()")
qout ("")
return

View File

@@ -0,0 +1,76 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* Test CT3 function CHARODD()
*
* Copyright 2001 IntTec GmbH, Neunlindenstr 32, 79106 Freiburg, Germany
* Author: Martin Vogel <vogel@inttec.de>
*
* 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, 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 "../ct.ch"
procedure main
qout ("Begin test of CHARODD()")
qout ("")
// simple tests
qout ("Simple tests:")
qout ([ charodd ("1A2B3C4D5E") == "12345" ? --> "] + charodd ("1A2B3C4D5E") + ["])
qout ([ charodd ("1A2B3C4D5") == "12345" ? --> "] + charodd ("1A2B3C4D5") + ["])
qout ("End test of CHARODD()")
qout ("")
return