libprime-devel-cvs Mailing List for libprime
Status: Inactive
Brought to you by:
simmo
You can subscribe to this list here.
| 2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(39) |
Jul
(7) |
Aug
(1) |
Sep
(1) |
Oct
(2) |
Nov
|
Dec
(40) |
|---|
|
From: Andrew S. <si...@us...> - 2001-12-08 14:13:05
|
Update of /cvsroot/libprime/libprime/src/tests/prime-rng In directory usw-pr-cvs1:/tmp/cvs-serv3775/src/tests/prime-rng Modified Files: Makefile.in Log Message: make the build system even better Index: Makefile.in =================================================================== RCS file: /cvsroot/libprime/libprime/src/tests/prime-rng/Makefile.in,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Makefile.in 2001/12/06 08:57:48 1.1 +++ Makefile.in 2001/12/08 14:13:02 1.2 @@ -22,8 +22,7 @@ include $(topsrcdir)/build/autoconf.mk -LIB_EXPORT = -EXPORT = prime-rng +EXE_EXPORT = prime-rng SOURCES = prime-range.cpp prime-range-inputs.cpp OBJECTS = prime-range.o prime-range-inputs.o LIBS = ../../libprime/libprime.a |
|
From: Andrew S. <si...@us...> - 2001-12-08 14:13:05
|
Update of /cvsroot/libprime/libprime/src/tests/prime-val In directory usw-pr-cvs1:/tmp/cvs-serv3775/src/tests/prime-val Modified Files: Makefile.in Log Message: make the build system even better Index: Makefile.in =================================================================== RCS file: /cvsroot/libprime/libprime/src/tests/prime-val/Makefile.in,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Makefile.in 2001/12/06 08:56:57 1.1 +++ Makefile.in 2001/12/08 14:13:02 1.2 @@ -22,8 +22,7 @@ include $(topsrcdir)/build/autoconf.mk -LIB_EXPORT = -EXPORT = prime-val +EXE_EXPORT = prime-val SOURCES = prime-validator.cpp OBJECTS = prime-validator.o LIBS = ../../libprime/libprime.a |
|
From: Andrew S. <si...@us...> - 2001-12-08 14:13:04
|
Update of /cvsroot/libprime/libprime/src/tests/prime-inc In directory usw-pr-cvs1:/tmp/cvs-serv3775/src/tests/prime-inc Modified Files: Makefile.in Log Message: make the build system even better Index: Makefile.in =================================================================== RCS file: /cvsroot/libprime/libprime/src/tests/prime-inc/Makefile.in,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Makefile.in 2001/12/06 08:57:48 1.1 +++ Makefile.in 2001/12/08 14:13:01 1.2 @@ -22,7 +22,7 @@ include $(topsrcdir)/build/autoconf.mk -EXPORT = prime-inc +EXE_EXPORT = prime-inc SOURCES = prime-increment.cpp OBJECTS = prime-increment.o LIBS = ../../libprime/libprime.a |
|
From: Andrew S. <si...@us...> - 2001-12-08 14:13:04
|
Update of /cvsroot/libprime/libprime/src/libprime In directory usw-pr-cvs1:/tmp/cvs-serv3775/src/libprime Modified Files: Makefile.in Log Message: make the build system even better Index: Makefile.in =================================================================== RCS file: /cvsroot/libprime/libprime/src/libprime/Makefile.in,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- Makefile.in 2001/12/06 08:57:48 1.6 +++ Makefile.in 2001/12/08 14:13:01 1.7 @@ -22,8 +22,8 @@ include $(topsrcdir)/build/autoconf.mk -LIB_EXPORT = libprime.a libprime.so -EXPORT = +STATIC_EXPORT = libprime.a +SHARED_EXPORT = libprime.so SOURCES = princ.cpp prval.cpp prrange.cpp OBJECTS = princ.o prval.o prrange.o INCLUDES = -I../include |
|
From: Andrew S. <si...@us...> - 2001-12-08 14:13:04
|
Update of /cvsroot/libprime/libprime/build
In directory usw-pr-cvs1:/tmp/cvs-serv3775/build
Modified Files:
autoconf.mk.in rules.mk.in
Log Message:
make the build system even better
Index: autoconf.mk.in
===================================================================
RCS file: /cvsroot/libprime/libprime/build/autoconf.mk.in,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- autoconf.mk.in 2001/12/08 13:54:57 1.3
+++ autoconf.mk.in 2001/12/08 14:13:01 1.4
@@ -15,20 +15,20 @@
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-SHELL = @SHELL@
+SHELL = @SHELL@
-CXX = @CXX@
-CXXFLAGS = @CXXFLAGS@
+CXX = @CXX@
+CXXFLAGS = @CXXFLAGS@
-AR = @AR@
-AS = @AS@
-LD = @LD@
-RANLIB = @RANLIB@
+AR = @AR@
+AS = @AS@
+LD = @LD@
+RANLIB = @RANLIB@
-OBJ_SUFFIX = @OBJ_SUFFIX@
-LIB_SUFFIX = @LIB_SUFFIX@
-DLL_SUFFIX = @DLL_SUFFIX@
-ASM_SUFFIX = @ASM_SUFFIX@
+OBJ_SUFFIX = @OBJ_SUFFIX@
+LIB_SUFFIX = @LIB_SUFFIX@
+DLL_SUFFIX = @DLL_SUFFIX@
+ASM_SUFFIX = @ASM_SUFFIX@
-LIBPRIME_TESTS = @LIBPRIME_TESTS@
+LIBPRIME_TESTS = @LIBPRIME_TESTS@
Index: rules.mk.in
===================================================================
RCS file: /cvsroot/libprime/libprime/build/rules.mk.in,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- rules.mk.in 2001/12/08 13:54:57 1.3
+++ rules.mk.in 2001/12/08 14:13:01 1.4
@@ -22,25 +22,24 @@
done
endif
-
-all:: $(OBJECTS) $(EXPORT) $(LIB_EXPORT)
- +$(LOOP_OVER_DIRS)
-
-install::
+all:: $(OBJECTS) $(EXE_EXPORT) $(STATIC_EXPORT) $(SHARED_EXPORT)
+$(LOOP_OVER_DIRS)
-$(EXPORT): $(OBJECTS)
- $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBS) -o $@
-
%.o: %.cpp
$(CXX) -c $< $(CXXFLAGS) $(COMPILE_FLAGS) $(INCLUDES) -o $@
-%.a: $(OBJECTS)
+$(EXE_EXPORT): $(OBJECTS) $(LIBS)
+ $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBS) -o $@
+
+$(STATIC_EXPORT): $(OBJECTS)
ar cru $@ $?
ranlib $@
+
+$(SHARED_EXPORT): $(OBJECTS) $(LIBS)
+ $(CXX) -shared -Wl,-soname,$@ $(LIBS) $(CXXFLAGS) -o $@ $?
-%.so: $(OBJECTS)
- $(CXX) -shared -Wl,-soname,$@ $(CXXFLAGS) -o $@ $?
+install::
+ +$(LOOP_OVER_DIRS)
clean clobber realclean clobber_all::
-rm -f *.o *.a *.so *.mk $(EXPORT) $(LIB_EXPORT)
|
|
From: Andrew S. <si...@us...> - 2001-12-08 13:55:03
|
Update of /cvsroot/libprime/libprime/src/tests/prime-val
In directory usw-pr-cvs1:/tmp/cvs-serv869/src/tests/prime-val
Modified Files:
prime-validator.cpp
Log Message:
working towards a 0.2 libprime release
Index: prime-validator.cpp
===================================================================
RCS file: /cvsroot/libprime/libprime/src/tests/prime-val/prime-validator.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- prime-validator.cpp 2001/12/06 08:56:57 1.1
+++ prime-validator.cpp 2001/12/08 13:54:57 1.2
@@ -1,7 +1,6 @@
/*
* libprime
- * prime-validator.cpp
- * Contributors: si...@ii...
+ * Copyright (c) 2001 Andrew Simmonds <si...@ii...>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -21,32 +20,24 @@
#include "libprime.h"
using namespace std;
-int main(int argc, char* argv[])
-{ //Is a certain prime real.
-
- cfloat version = static_cast<cfloat>(0.01);
- const string appname = "prime-validator";
+int main(int argc, char *argv[])
+{
+ if (argc != 2) {
+ cerr << "Not Enough Parameters\n";
+ return 0;
+ }
+
+ for (uint i = 1; i < strlen(argv[1]); i++) {
+ if (!isdigit(argv[1][i])) {
+ cerr << "Not a Number\n";
+ return 0;
+ }
+ }
- //TODO Process argv and argc for stuff!
+ ulong TestPrime = atol(argv[1]);
- cout << appname
- << " "
- << version
- << endl
- << endl;
+ bool answer = GetIsPrime(TestPrime);
- ulong TestPrime;
- cout << "Enter a number: ";
- cin >> TestPrime;
-
-
- bool answer = GetIsPrime(TestPrime);
-
- cout << endl
- << "Prime = "
- << (answer?"True":"False")
- << endl;
-
- return 0;
-
+ cout << (answer ? "True" : "False") << endl;
+ return 0;
}
|
|
From: Andrew S. <si...@us...> - 2001-12-08 13:55:02
|
Update of /cvsroot/libprime/libprime/src/libprime
In directory usw-pr-cvs1:/tmp/cvs-serv869/src/libprime
Modified Files:
princ.cpp prrange.cpp prval.cpp
Log Message:
working towards a 0.2 libprime release
Index: princ.cpp
===================================================================
RCS file: /cvsroot/libprime/libprime/src/libprime/princ.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- princ.cpp 2001/12/06 08:57:48 1.5
+++ princ.cpp 2001/12/08 13:54:57 1.6
@@ -1,21 +1,21 @@
/*
- libprime
- princ.cpp
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
+ * libprime
+ * Copyright (c) 2001 Andrew Simmonds <si...@ii...>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
#include "libprime.h"
using namespace std;
Index: prrange.cpp
===================================================================
RCS file: /cvsroot/libprime/libprime/src/libprime/prrange.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- prrange.cpp 2001/12/06 08:57:48 1.5
+++ prrange.cpp 2001/12/08 13:54:57 1.6
@@ -1,77 +1,84 @@
/*
- libprime
- prrange.cpp
+ * libprime
+ * Copyright (c) 2001 Andrew Simmonds <si...@ii...>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
#include "libprime.h"
using namespace std;
+
+PrimeRange::PrimeRange(culong culMaxPrimeNumber):culMaxPrime(culMaxPrimeNumber)
+{
+ ulHits = 1;
+ uchar *ucTest;
-PrimeRange::PrimeRange(culong culMaxPrimeNumber) : culMaxPrime(culMaxPrimeNumber) {
- ulHits = 1;
- uchar *ucTest;
-
- //Create PrimeStorage Space in Memory.
- culong culAllocatedMemorySize = (culMaxPrime>>4)+1;
- ucPrimeStorage = ucTest = new uchar [culAllocatedMemorySize];
+ culong culAllocatedMemorySize = (culMaxPrime >> 4) + 1;
+ ucPrimeStorage = ucTest = new uchar[culAllocatedMemorySize];
- for (ulCount = 0; ulCount<culAllocatedMemorySize; ulCount++)
+ for (ulCount = 0; ulCount < culAllocatedMemorySize; ulCount++)
*ucTest++ = 0x00;
}
-PrimeRange::~PrimeRange() {
- delete []ucPrimeStorage;
+PrimeRange::~PrimeRange()
+{
+ delete[]ucPrimeStorage;
}
-ulong PrimeRange::InitPrimeRange() { //Search for the individual primes and add them to 'feld'
- ulong BlehTest=1, BlehIndex=0;
-
- while ((BlehTest+=2) < culMaxPrime) {
- if (!TestOfPrimeness(ucPrimeStorage, BlehTest)) {
- ++ulHits;
-
- for (BlehIndex = 3*BlehTest; BlehIndex<culMaxPrime; BlehIndex += BlehTest<<1)
- SetPrimes(ucPrimeStorage, BlehIndex);
- }
- }
- return ulHits;
+ulong PrimeRange::init()
+{
+ ulong BlehTest = 1, BlehIndex = 0;
+
+ while ((BlehTest += 2) < culMaxPrime) {
+ if (!TestOfPrimeness(ucPrimeStorage, BlehTest)) {
+ ++ulHits;
+
+ for (BlehIndex = 3 * BlehTest; BlehIndex < culMaxPrime;
+ BlehIndex += BlehTest << 1)
+ SetPrimes(ucPrimeStorage, BlehIndex);
+ }
+ }
+ return ulHits;
}
-inline bool PrimeRange::TestOfPrimeness(uchar *PrimeStore, ulong PrimeCount) {
- return (*(PrimeStore+((PrimeCount)>>4))&(1<<(((PrimeCount)&15L)>>1)))?true:false;
+inline bool PrimeRange::TestOfPrimeness(uchar * PrimeStore, ulong PrimeCount)
+{
+ return (*(PrimeStore + ((PrimeCount) >> 4)) &
+ (1 << (((PrimeCount) & 15L) >> 1))) ? true : false;
}
-inline bool PrimeRange::SetPrimes(uchar *PrimeStore, ulong PrimeCount) {
- return (*(PrimeStore+((PrimeCount)>>4))|=1<<(((PrimeCount)&15L)>>1))?true:false;
+inline bool PrimeRange::SetPrimes(uchar * PrimeStore, ulong PrimeCount)
+{
+ return (*(PrimeStore + ((PrimeCount) >> 4)) |=
+ 1 << (((PrimeCount) & 15L) >> 1)) ? true : false;
}
-
-ulong PrimeRange::GetPrimeRange(ulong ulStartOfRange, ulong ulEndOfRange, aulong& PrimeList) {
- ulong ulLocalHits = 0;
- ulCount = ulStartOfRange-2;
- if (ulStartOfRange%2==0)
- ulCount++; //Make it an odd number.
-
- while ((ulCount+=2)<=ulEndOfRange)
- {
- if (!TestOfPrimeness(ucPrimeStorage, ulCount))
- {
- PrimeList[ ulLocalHits ] = ulCount;
- ulLocalHits++;
- }
- }
- return ulLocalHits;
+ulong PrimeRange::get(ulong ulStartOfRange, ulong ulEndOfRange,
+ aulong & PrimeList)
+{
+ ulong ulLocalHits = 0;
+
+ ulCount = ulStartOfRange - 2;
+ if (ulStartOfRange % 2 == 0)
+ ulCount++;
+
+ while ((ulCount += 2) <= ulEndOfRange) {
+ if (!TestOfPrimeness(ucPrimeStorage, ulCount)) {
+ PrimeList[ulLocalHits] = ulCount;
+ ulLocalHits++;
+ }
+ }
+ return ulLocalHits;
}
Index: prval.cpp
===================================================================
RCS file: /cvsroot/libprime/libprime/src/libprime/prval.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- prval.cpp 2001/12/06 08:57:48 1.5
+++ prval.cpp 2001/12/08 13:54:57 1.6
@@ -1,30 +1,31 @@
/*
- libprime
- prval.cpp
+ * libprime
+ * Copyright (c) 2001 Andrew Simmonds <si...@ii...>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
#include "libprime.h"
using namespace std;
-bool GetIsPrime(ulong TestPrimeNumber) {
- bool isPrime = true;
- for(ulong i=2;i<=(TestPrimeNumber / 2);i++)
- if((TestPrimeNumber%i) == 0)
- isPrime = false;
+bool GetIsPrime(ulong TestPrimeNumber)
+{
+ bool isPrime = true;
+ for (ulong i = 2; i <= (TestPrimeNumber / 2); i++)
+ if ((TestPrimeNumber % i) == 0)
+ isPrime = false;
- return isPrime;
+ return isPrime;
}
|
|
From: Andrew S. <si...@us...> - 2001-12-08 13:55:02
|
Update of /cvsroot/libprime/libprime/src In directory usw-pr-cvs1:/tmp/cvs-serv869/src Modified Files: Makefile.in Log Message: working towards a 0.2 libprime release Index: Makefile.in =================================================================== RCS file: /cvsroot/libprime/libprime/src/Makefile.in,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- Makefile.in 2001/12/06 10:06:57 1.4 +++ Makefile.in 2001/12/08 13:54:57 1.5 @@ -19,12 +19,13 @@ srcdir = @srcdir@ VPATH = @srcdir@ +include $(topsrcdir)/build/autoconf.mk + ifdef LIBPRIME_TESTS SUBDIRS = libprime tests else SUBDIRS = libprime endif -include $(topsrcdir)/build/autoconf.mk include $(topsrcdir)/build/rules.mk |
|
From: Andrew S. <si...@us...> - 2001-12-08 13:55:02
|
Update of /cvsroot/libprime/libprime/build In directory usw-pr-cvs1:/tmp/cvs-serv869/build Modified Files: autoconf.mk.in rules.mk.in Log Message: working towards a 0.2 libprime release Index: autoconf.mk.in =================================================================== RCS file: /cvsroot/libprime/libprime/build/autoconf.mk.in,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- autoconf.mk.in 2001/12/06 10:06:57 1.2 +++ autoconf.mk.in 2001/12/08 13:54:57 1.3 @@ -18,6 +18,7 @@ SHELL = @SHELL@ CXX = @CXX@ +CXXFLAGS = @CXXFLAGS@ AR = @AR@ AS = @AS@ Index: rules.mk.in =================================================================== RCS file: /cvsroot/libprime/libprime/build/rules.mk.in,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- rules.mk.in 2001/12/06 10:06:57 1.2 +++ rules.mk.in 2001/12/08 13:54:57 1.3 @@ -40,13 +40,13 @@ ranlib $@ %.so: $(OBJECTS) - $(CXX) -shared -Wl,-soname,$@ -o $@ $? + $(CXX) -shared -Wl,-soname,$@ $(CXXFLAGS) -o $@ $? clean clobber realclean clobber_all:: - -rm -f *.o *.a *.so $(EXPORT) $(LIB_EXPORT) + -rm -f *.o *.a *.so *.mk $(EXPORT) $(LIB_EXPORT) +$(LOOP_OVER_DIRS) distclean:: +$(LOOP_OVER_DIRS) - -rm -f *.o *.a *.so $(EXPORT) $(LIB_EXPORT) + -rm -f *.o *.a *.so *.mk $(EXPORT) $(LIB_EXPORT) -rm -f Makefile |
|
From: Andrew S. <si...@us...> - 2001-12-08 13:55:02
|
Update of /cvsroot/libprime/libprime/src/tests/prime-rng
In directory usw-pr-cvs1:/tmp/cvs-serv869/src/tests/prime-rng
Modified Files:
prime-range.cpp
Log Message:
working towards a 0.2 libprime release
Index: prime-range.cpp
===================================================================
RCS file: /cvsroot/libprime/libprime/src/tests/prime-rng/prime-range.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- prime-range.cpp 2001/12/06 08:57:48 1.1
+++ prime-range.cpp 2001/12/08 13:54:57 1.2
@@ -1,7 +1,6 @@
/*
* libprime
- * prime-range.cpp
- * Contributors: si...@ii...
+ * Copyright (c) 2001 Andrew Simmonds <si...@ii...>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -21,69 +20,39 @@
#include "libprime.h"
using namespace std;
-void RangeFrontEnd(PrimeRange*& Bleh, ulong culMaxPrime);
-void PrimeInput(ulong& ulStartOfRange, ulong& ulEndOfRange, culong culMaxPrime);
-bool RangeSearchContinueLooping();
-bool RangeInputType();
-
-int main(int argc, char* argv[])
-{
- cfloat version = static_cast<const float>(0.01);
- const string appname = "prime-range";
-
- //TODO Process argv and argc for stuff!
-
- cerr << appname
- << " "
- << version
- << endl
- << endl;
-
- //Get primes between ranges
- culong max = static_cast<ulong>(10000000);
- PrimeRange *TestRange = new PrimeRange(max);
- RangeFrontEnd(TestRange, max);
- delete TestRange;
- cout << endl;
-
- return 0;
-}
-
-void RangeFrontEnd(PrimeRange*& Bleh, ulong culMaxPrime)
+int main(int argc, char *argv[])
{
-
- ulong ulStartOfRange = 0;
- ulong ulEndOfRange = 1;
+ if (argc != 3) {
+ cerr << "Not Enough Parameters\n";
+ return 0;
+ }
+
+ for (uint j = 1; j < 3; j++) {
+ for (uint i = 1; i < strlen(argv[j]); i++) {
+ if (!isdigit(argv[j][i])) {
+ cerr << "Not a Number\n";
+ return 0;
+ }
+ }
+ }
+
+ culong lowNumber = abs(atol(argv[1]));
+ culong highNumber = abs(atol(argv[2]));
+
+ PrimeRange *childPrimeRange = new PrimeRange(highNumber);
+
+ ulong tHits = childPrimeRange->init();
+ aulong PrimeList(tHits);
+
+ ulong Hits = childPrimeRange->get(lowNumber, highNumber, PrimeList);
+ delete childPrimeRange;
+
+ for (ulong i = 0; i < Hits; i++) {
+ ulong out = PrimeList[i];
+ cout << out << "\t";
+ }
- ulong tHits = Bleh->InitPrimeRange();
- aulong PrimeList(tHits);
+ cerr << endl << endl << Hits << " prime hit(s)." << endl;
- bool bContLooping = true;
- while (bContLooping)
- {
- ulStartOfRange = 0;
- ulEndOfRange = 1;
-
- do
- {
- PrimeInput(ulStartOfRange, ulEndOfRange, culMaxPrime);
- } while ((ulStartOfRange>ulEndOfRange) || (ulEndOfRange>culMaxPrime) || (ulEndOfRange<0));
-
-
- ulong Hits = Bleh->GetPrimeRange(ulStartOfRange, ulEndOfRange, PrimeList);
- for(ulong i=0; i<Hits; i++)
- {
- ulong out = PrimeList[i];
- cout << out;
- cout << "\t";
- }
- cout << endl
- << endl
- << Hits
- << " prime hit(s)."
- << endl;
-
- bContLooping = RangeSearchContinueLooping();
- }
+ return 0;
}
-
|
|
From: Andrew S. <si...@us...> - 2001-12-08 13:55:02
|
Update of /cvsroot/libprime/libprime/src/include
In directory usw-pr-cvs1:/tmp/cvs-serv869/src/include
Modified Files:
libprime.h
Log Message:
working towards a 0.2 libprime release
Index: libprime.h
===================================================================
RCS file: /cvsroot/libprime/libprime/src/include/libprime.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- libprime.h 2001/12/06 08:57:48 1.4
+++ libprime.h 2001/12/08 13:54:57 1.5
@@ -1,22 +1,22 @@
/*
- libprime
- libprime.h
+ * libprime
+ * Copyright (c) 2001 Andrew Simmonds <si...@ii...>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library 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
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
#ifndef LIBPRIME_H
#define LIBPRIME_H
@@ -31,31 +31,31 @@
typedef const char cchar;
typedef const float cfloat;
typedef const ulong culong;
-typedef std::vector<ulong> aulong;
+typedef std::vector < ulong > aulong;
class NextPrime {
-private:
+ private:
ulong prime_number;
-public:
+ public:
NextPrime(ulong prime_in);
ulong get();
- ulong operator++();
- ulong operator()();
+ ulong operator++ ();
+ ulong operator() ();
};
class PrimeRange {
-private:
- inline bool TestOfPrimeness(uchar *PrimeStore, ulong PrimeCount);
- inline bool SetPrimes(uchar *PrimeStore, ulong PrimeCount);
+ private:
+ inline bool TestOfPrimeness(uchar * PrimeStore, ulong PrimeCount);
+ inline bool SetPrimes(uchar * PrimeStore, ulong PrimeCount);
uchar *ucPrimeStorage;
culong culMaxPrime;
ulong ulCount;
ulong ulHits;
-public:
+ public:
PrimeRange(culong culMaxPrimeNumber);
~PrimeRange();
- ulong InitPrimeRange();
- ulong GetPrimeRange(ulong ulStartOfRange, ulong ulEndOfRange, aulong& PrimeList);
+ ulong init();
+ ulong get(ulong ulStartOfRange, ulong ulEndOfRange, aulong & PrimeList);
};
bool GetIsPrime(ulong TestPrimeNumber);
|
|
From: Andrew S. <si...@us...> - 2001-12-08 13:55:02
|
Update of /cvsroot/libprime/libprime/src/tests/prime-inc
In directory usw-pr-cvs1:/tmp/cvs-serv869/src/tests/prime-inc
Modified Files:
prime-increment.cpp
Log Message:
working towards a 0.2 libprime release
Index: prime-increment.cpp
===================================================================
RCS file: /cvsroot/libprime/libprime/src/tests/prime-inc/prime-increment.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- prime-increment.cpp 2001/12/06 08:57:48 1.1
+++ prime-increment.cpp 2001/12/08 13:54:57 1.2
@@ -1,7 +1,6 @@
/*
* libprime
* Copyright (c) 2001 Andrew Simmonds <si...@ii...>
- * prime-increment.cpp
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -21,24 +20,24 @@
#include "libprime.h"
using namespace std;
-int main(uint argc, char* argv[]) {
- if(argc == 1) {
+int main(uint argc, char *argv[])
+{
+ if (argc != 2) {
cerr << "Not Enough Parameters\n";
return 0;
}
- for(uint i=1; i<strlen(argv[1]); i++) {
- if(!isdigit(argv[1][i])) {
+ for (uint i = 1; i < strlen(argv[1]); i++) {
+ if (!isdigit(argv[1][i])) {
cerr << "Not a Number\n";
return 0;
}
}
-
+
ulong baseNumber = atol(argv[1]);
NextPrime xPrime(baseNumber);
- cout << ++xPrime
- << endl;
+ cout << ++xPrime << endl;
return 0;
}
|
|
From: Andrew S. <si...@us...> - 2001-12-06 10:30:34
|
Update of /cvsroot/libprime/libprime/build In directory usw-pr-cvs1:/tmp/cvs-serv16876 Added Files: .cvsignore Log Message: new cvsignroe --- NEW FILE: .cvsignore --- rules.mk autoconf.mk Makefile |
|
From: Andrew S. <si...@us...> - 2001-12-06 10:28:14
|
Update of /cvsroot/libprime/libprime/src/tests/prime-inc In directory usw-pr-cvs1:/tmp/cvs-serv16427/tests/prime-inc Added Files: .cvsignore Log Message: new .cvsignore file due to new dirs being made --- NEW FILE: .cvsignore --- Makefile |
|
From: Andrew S. <si...@us...> - 2001-12-06 10:28:13
|
Update of /cvsroot/libprime/libprime/src/tests/prime-val In directory usw-pr-cvs1:/tmp/cvs-serv16427/tests/prime-val Added Files: .cvsignore Log Message: new .cvsignore file due to new dirs being made --- NEW FILE: .cvsignore --- Makefile |
|
From: Andrew S. <si...@us...> - 2001-12-06 10:28:13
|
Update of /cvsroot/libprime/libprime/src/tests/prime-rng In directory usw-pr-cvs1:/tmp/cvs-serv16427/tests/prime-rng Added Files: .cvsignore Log Message: new .cvsignore file due to new dirs being made --- NEW FILE: .cvsignore --- Makefile |
|
From: Andrew S. <si...@us...> - 2001-12-06 10:28:13
|
Update of /cvsroot/libprime/libprime/src/tests In directory usw-pr-cvs1:/tmp/cvs-serv16427/tests Added Files: .cvsignore Log Message: new .cvsignore file due to new dirs being made --- NEW FILE: .cvsignore --- Makefile |
|
From: Andrew S. <si...@us...> - 2001-12-06 10:28:13
|
Update of /cvsroot/libprime/libprime/src/libprime In directory usw-pr-cvs1:/tmp/cvs-serv16427/libprime Added Files: .cvsignore Log Message: new .cvsignore file due to new dirs being made --- NEW FILE: .cvsignore --- Makefile |
|
From: Andrew S. <si...@us...> - 2001-12-06 10:28:13
|
Update of /cvsroot/libprime/libprime/src In directory usw-pr-cvs1:/tmp/cvs-serv16427 Added Files: .cvsignore Log Message: new .cvsignore file due to new dirs being made --- NEW FILE: .cvsignore --- Makefile |
|
From: Andrew S. <si...@us...> - 2001-12-06 10:24:02
|
Update of /cvsroot/libprime/libprime
In directory usw-pr-cvs1:/tmp/cvs-serv15532
Added Files:
install-sh
Log Message:
new install file
--- NEW FILE: install-sh ---
#!/bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5 (mit/util/scripts/install.sh).
#
# Copyright 1991 by the Massachusetts Institute of Technology
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. M.I.T. makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
transformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd="$stripprog"
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
else
true
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d $dst ]; then
instcmd=:
chmodcmd=""
else
instcmd=mkdir
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f $src -o -d $src ]
then
true
else
echo "install: $src does not exist"
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
exit 1
else
true
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
then
dst="$dst"/`basename $src`
else
true
fi
fi
## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-${defaultIFS}}"
oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}"
shift
if [ ! -d "${pathcomp}" ] ;
then
$mkdirprog "${pathcomp}"
else
true
fi
pathcomp="${pathcomp}/"
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd $dst &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename $dst`
else
dstfile=`basename $dst $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
then
dstfile=`basename $dst`
else
true
fi
# Make a temp file name in the proper directory.
dsttmp=$dstdir/#inst.$$#
# Move or copy the file name to the temp name
$doit $instcmd $src $dsttmp &&
trap "rm -f ${dsttmp}" 0 &&
# and set any options; do chmod last to preserve setuid bits
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
# Now rename the file to the real destination.
$doit $rmcmd -f $dstdir/$dstfile &&
$doit $mvcmd $dsttmp $dstdir/$dstfile
fi &&
exit 0
|
|
From: Andrew S. <si...@us...> - 2001-12-06 10:07:00
|
Update of /cvsroot/libprime/libprime
In directory usw-pr-cvs1:/tmp/cvs-serv11308
Modified Files:
configure configure.in
Log Message:
fixed configure so that tests can be disabled with --disable-tests
Index: configure
===================================================================
RCS file: /cvsroot/libprime/libprime/configure,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- configure 2001/12/06 08:57:48 1.9
+++ configure 2001/12/06 10:06:57 1.10
@@ -537,14 +537,14 @@
ac_env_target_alias_value=$target_alias
ac_cv_env_target_alias_set=${target_alias+set}
ac_cv_env_target_alias_value=$target_alias
-ac_env_CXX_set=${CXX+set}
-ac_env_CXX_value=$CXX
-ac_cv_env_CXX_set=${CXX+set}
-ac_cv_env_CXX_value=$CXX
-ac_env_CXXFLAGS_set=${CXXFLAGS+set}
-ac_env_CXXFLAGS_value=$CXXFLAGS
-ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set}
-ac_cv_env_CXXFLAGS_value=$CXXFLAGS
[...1954 lines suppressed...]
echo "$as_me: error: cannot find input file: $f" >&2;}
{ (exit 1); exit 1; }; }
echo $f;;
@@ -2511,7 +3351,7 @@
echo $srcdir/$f
else
# /dev/null tree
- { { echo "$as_me:2514: error: cannot find input file: $f" >&5
+ { { echo "$as_me:3354: error: cannot find input file: $f" >&5
echo "$as_me: error: cannot find input file: $f" >&2;}
{ (exit 1); exit 1; }; }
fi;;
@@ -2528,6 +3368,7 @@
s,@configure_input@,$configure_input,;t t
s,@srcdir@,$ac_srcdir,;t t
s,@top_srcdir@,$ac_top_srcdir,;t t
+s,@INSTALL@,$ac_INSTALL,;t t
" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
rm -f $tmp/stdin
if test x"$ac_file" != x-; then
Index: configure.in
===================================================================
RCS file: /cvsroot/libprime/libprime/configure.in,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- configure.in 2001/12/06 08:57:48 1.10
+++ configure.in 2001/12/06 10:06:57 1.11
@@ -1,27 +1,42 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(INSTALL)
+AC_PROG_CC
AC_PROG_CXX
AC_PROG_RANLIB
-dnl AC_PROG_INSTALL
+AC_PROG_INSTALL
+AC_PATH_PROGS(AS, as, $CC)
+AC_PATH_PROGS(AR, ar, :)
+AC_PATH_PROGS(LD, ld, :)
+AC_PATH_PROGS(MAKE, gmake make, :)
+AC_PROG_LN_S
+
AC_LANG_CPLUSPLUS
AC_REQUIRE_CPP
-
AC_CHECK_LIB(stdc++, main,,AC_MSG_ERROR(Requires libstdc++))
AC_CHECK_HEADERS(iostream,,AC_MSG_ERROR(STL class 'iostream' missing))
AC_CHECK_HEADERS(string,,AC_MSG_ERROR(STL classe 'string' missing))
AC_CHECK_HEADERS(vector,,AC_MSG_ERROR(STL class 'vector' missing))
AC_CHECK_HEADERS(deque,,AC_MSG_ERROR(STL class 'deque' missing))
-AC_ARG_ENABLE( tests, [ --disable-tests disable test building],, enable_tests="yes")
+AC_ARG_ENABLE( tests, [ --disable-tests disable test building], , enable_tests="yes")
if test "$enable_tests" = "yes"; then
- LIBPRIME_TESTS="1"
- AC_DEFINE(LIBPRIME_TESTS)
+ LIBPRIME_TESTS=1
+ AC_SUBST(LIBPRIME_TESTS)
fi
+DLL_SUFFIX=so
+OBJ_SUFFIX=o
+LIB_SUFFIX=a
+ASM_SUFFIX=s
+AC_SUBST(DLL_SUFFIX)
+AC_SUBST(OBJ_SUFFIX)
+AC_SUBST(LIB_SUFFIX)
+AC_SUBST(ASM_SUFFIX)
+
AC_OUTPUT(
Makefile
src/Makefile
@@ -33,5 +48,3 @@
build/rules.mk
build/autoconf.mk
)
-
-
|
|
From: Andrew S. <si...@us...> - 2001-12-06 10:07:00
|
Update of /cvsroot/libprime/libprime/src In directory usw-pr-cvs1:/tmp/cvs-serv11308/src Modified Files: Makefile.in Log Message: fixed configure so that tests can be disabled with --disable-tests Index: Makefile.in =================================================================== RCS file: /cvsroot/libprime/libprime/src/Makefile.in,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Makefile.in 2001/12/06 08:57:48 1.3 +++ Makefile.in 2001/12/06 10:06:57 1.4 @@ -18,12 +18,12 @@ topsrcdir = @top_srcdir@ srcdir = @srcdir@ VPATH = @srcdir@ -#ifdef LIBPRIME_TESTS -#SUBDIRS = libprime tests -#else -#SUBDIRS = libprime -#endif -SUBDIRS = libprime tests + +ifdef LIBPRIME_TESTS +SUBDIRS = libprime tests +else +SUBDIRS = libprime +endif include $(topsrcdir)/build/autoconf.mk include $(topsrcdir)/build/rules.mk |
|
From: Andrew S. <si...@us...> - 2001-12-06 10:07:00
|
Update of /cvsroot/libprime/libprime/build In directory usw-pr-cvs1:/tmp/cvs-serv11308/build Modified Files: autoconf.mk.in rules.mk.in Log Message: fixed configure so that tests can be disabled with --disable-tests Index: autoconf.mk.in =================================================================== RCS file: /cvsroot/libprime/libprime/build/autoconf.mk.in,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- autoconf.mk.in 2001/12/06 08:57:48 1.1 +++ autoconf.mk.in 2001/12/06 10:06:57 1.2 @@ -15,33 +15,19 @@ # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - SHELL = @SHELL@ CXX = @CXX@ AR = @AR@ -AR_FLAGS = @AR_FLAGS@ -AR_EXTRACT = @AR_EXTRACT@ -AR_LIST = @AR_LIST@ -AR_DELETE = @AR_DELETE@ AS = @AS@ -ASFLAGS = @ASFLAGS@ -AS_DASH_C_FLAG = @AS_DASH_C_FLAG@ LD = @LD@ -AUTOCONF = @AUTOCONF@ RANLIB = @RANLIB@ OBJ_SUFFIX = @OBJ_SUFFIX@ LIB_SUFFIX = @LIB_SUFFIX@ DLL_SUFFIX = @DLL_SUFFIX@ -BIN_SUFFIX = @BIN_SUFFIX@ ASM_SUFFIX = @ASM_SUFFIX@ - LIBPRIME_TESTS = @LIBPRIME_TESTS@ - - - - Index: rules.mk.in =================================================================== RCS file: /cvsroot/libprime/libprime/build/rules.mk.in,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- rules.mk.in 2001/12/06 08:57:48 1.1 +++ rules.mk.in 2001/12/06 10:06:57 1.2 @@ -26,6 +26,9 @@ all:: $(OBJECTS) $(EXPORT) $(LIB_EXPORT) +$(LOOP_OVER_DIRS) +install:: + +$(LOOP_OVER_DIRS) + $(EXPORT): $(OBJECTS) $(CXX) $(CXXFLAGS) $(OBJECTS) $(LIBS) -o $@ @@ -40,9 +43,10 @@ $(CXX) -shared -Wl,-soname,$@ -o $@ $? clean clobber realclean clobber_all:: - -rm -f *.o *.a *.so + -rm -f *.o *.a *.so $(EXPORT) $(LIB_EXPORT) +$(LOOP_OVER_DIRS) -distclean:: clean +distclean:: +$(LOOP_OVER_DIRS) + -rm -f *.o *.a *.so $(EXPORT) $(LIB_EXPORT) -rm -f Makefile |
|
From: Andrew S. <si...@us...> - 2001-12-06 09:08:03
|
Update of /cvsroot/libprime/libprime/src/tests In directory usw-pr-cvs1:/tmp/cvs-serv27100 Removed Files: prime-increment.cpp prime-range-inputs.cpp prime-range.cpp prime-validator.cpp Log Message: get rid of old files --- prime-increment.cpp DELETED --- --- prime-range-inputs.cpp DELETED --- --- prime-range.cpp DELETED --- --- prime-validator.cpp DELETED --- |
|
From: Andrew S. <si...@us...> - 2001-12-06 08:57:52
|
Update of /cvsroot/libprime/libprime/src/tests/prime-inc
In directory usw-pr-cvs1:/tmp/cvs-serv25186/src/tests/prime-inc
Added Files:
Makefile.in prime-increment.cpp
Log Message:
big overhaul part two
--- NEW FILE: Makefile.in ---
# libprime
# Copyright (c) 2001 Andrew Simmonds <si...@ii...>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library 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
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
SUBDIRS =
include $(topsrcdir)/build/autoconf.mk
EXPORT = prime-inc
SOURCES = prime-increment.cpp
OBJECTS = prime-increment.o
LIBS = ../../libprime/libprime.a
INCLUDES = -I../../include
include $(topsrcdir)/build/rules.mk
--- NEW FILE: prime-increment.cpp ---
/*
* libprime
* Copyright (c) 2001 Andrew Simmonds <si...@ii...>
* prime-increment.cpp
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "libprime.h"
using namespace std;
int main(uint argc, char* argv[]) {
if(argc == 1) {
cerr << "Not Enough Parameters\n";
return 0;
}
for(uint i=1; i<strlen(argv[1]); i++) {
if(!isdigit(argv[1][i])) {
cerr << "Not a Number\n";
return 0;
}
}
ulong baseNumber = atol(argv[1]);
NextPrime xPrime(baseNumber);
cout << ++xPrime
<< endl;
return 0;
}
|