summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-05-03 06:30:36 +0000
committerMike Buland <eichlan@xagasoft.com>2012-05-03 06:30:36 +0000
commitdf6a899ad6c9a1c792582ef1a3b838c7eb6d330c (patch)
treeff9e17d0fd00585bc1e329a63c20f90d155b4ea8
parent343bffafecd4329ce5ae6625fc6b2c1ea9759f36 (diff)
downloadlibbu++-df6a899ad6c9a1c792582ef1a3b838c7eb6d330c.tar.gz
libbu++-df6a899ad6c9a1c792582ef1a3b838c7eb6d330c.tar.bz2
libbu++-df6a899ad6c9a1c792582ef1a3b838c7eb6d330c.tar.xz
libbu++-df6a899ad6c9a1c792582ef1a3b838c7eb6d330c.zip
Rearranging some stuff.
Diffstat (limited to '')
-rw-r--r--Makefile16
-rw-r--r--default.bld5
-rw-r--r--src/experimental/blowfish.cpp4
-rw-r--r--src/stable/ringbuffer.h35
-rw-r--r--src/tests/bnfcompile.cpp (renamed from src/tools/bnfcompile.cpp)0
-rw-r--r--src/tests/parser.cpp (renamed from src/tools/parser.cpp)0
6 files changed, 48 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index ea8b1db..60a31b8 100644
--- a/Makefile
+++ b/Makefile
@@ -5,18 +5,26 @@
5# terms of the license contained in the file LICENSE. 5# terms of the license contained in the file LICENSE.
6# 6#
7 7
8PREFIX := /home/eichlan/testroot
8OBJECTS := $(patsubst %.cpp,%.o,$(wildcard src/stable/*.cpp src/unstable/*.cpp src/experimental/*.cpp)) 9OBJECTS := $(patsubst %.cpp,%.o,$(wildcard src/stable/*.cpp src/unstable/*.cpp src/experimental/*.cpp))
9HEADERS := bu bu/signals.h bu/autoconfig.h bu/version.h bu/config.h $(foreach fn,$(wildcard src/stable/*.h src/unstable/*.h src/experimental/*.h),bu/$(notdir ${fn})) $(patsubst src/%,bu/%,$(wildcard src/compat/*.h)) 10HEADERS := bu/signals.h bu/autoconfig.h bu/version.h bu/config.h $(foreach fn,$(wildcard src/stable/*.h src/unstable/*.h src/experimental/*.h),bu/$(notdir ${fn})) $(patsubst src/%,bu/%,$(wildcard src/compat/*.h))
10TOOLS := $(patsubst src/tools/%.cpp,%,$(wildcard src/tools/*.cpp)) 11TOOLS := $(patsubst src/tools/%.cpp,%,$(wildcard src/tools/*.cpp))
11UNITS := $(patsubst src/unit/%.unit,unit/%,$(wildcard src/unit/*.unit)) 12UNITS := $(patsubst src/unit/%.unit,unit/%,$(wildcard src/unit/*.unit))
12TESTS := $(patsubst src/tests/%.cpp,tests/%,$(wildcard src/tests/*.cpp)) 13TESTS := $(patsubst src/tests/%.cpp,tests/%,$(wildcard src/tests/*.cpp))
13 14
14.PHONY: default all headers clean tests 15.PHONY: default all headers clean tests install
15 16
16default: libbu++.a tools 17default: libbu++.a tools
17 18
18all: default tests 19all: default tests
19 20
21install: libbu++.a tools
22 install -d ${PREFIX}/{include/bu/compat,lib,bin}
23 install -m u=rw,go=r $(filter-out bu/compat/%,${HEADERS}) ${PREFIX}/include/bu
24 install -m u=rw,go=r $(filter bu/compat/%,${HEADERS}) ${PREFIX}/include/bu/compat
25 install -m u=rw,go=r libbu++.a ${PREFIX}/lib
26 install ${TOOLS} ${PREFIX}/bin
27
20tests: ${UNITS} ${TESTS} 28tests: ${UNITS} ${TESTS}
21 29
22clean: 30clean:
@@ -49,7 +57,7 @@ src/autoconfig.h src/version.h: autoconfig
49src/signals.h: pregen/signals.h 57src/signals.h: pregen/signals.h
50 cp $< $@ 58 cp $< $@
51 59
52headers: ${HEADERS} 60headers: bu ${HEADERS}
53 61
54tools: ${TOOLS} 62tools: ${TOOLS}
55 63
@@ -93,6 +101,6 @@ tests/lzma:
93tests/threadid: 101tests/threadid:
94 g++ -ggdb -W -Wall -I. -L. $< -o $@ -lbu++ -lpthread 102 g++ -ggdb -W -Wall -I. -L. $< -o $@ -lbu++ -lpthread
95 103
96libbu++.a: ${HEADERS} ${OBJECTS} 104libbu++.a: bu ${HEADERS} ${OBJECTS}
97 ar -r libbu++.a ${OBJECTS} 105 ar -r libbu++.a ${OBJECTS}
98 106
diff --git a/default.bld b/default.bld
index 3e7b692..b828713 100644
--- a/default.bld
+++ b/default.bld
@@ -244,6 +244,7 @@ target PKG_BASE
244 "LICENSE", 244 "LICENSE",
245 "Doxyfile", 245 "Doxyfile",
246 "Makefile", 246 "Makefile",
247 "version",
247 files("*.bld"), 248 files("*.bld"),
248 "support/vim/syntax/taf.vim", 249 "support/vim/syntax/taf.vim",
249 "support/vim/ftdetect/taf.vim", 250 "support/vim/ftdetect/taf.vim",
@@ -311,10 +312,10 @@ target PKG_BASE + ".xz"
311rule "tarball" 312rule "tarball"
312{ 313{
313 input matches("LICENSE", "Makefile", "*.cpp", "*.h", "*.conf", "*.bld", 314 input matches("LICENSE", "Makefile", "*.cpp", "*.h", "*.conf", "*.bld",
314 "Doxyfile", "*.vim", "*.sh", "*.unit", "api"); 315 "Doxyfile", "*.vim", "*.sh", "*.unit", "api", "version");
315 profile "build" 316 profile "build"
316 { 317 {
317 OUTDIR = OUTPUT.replace(".tar.bz2",""); 318 OUTDIR = OUTPUT.replace(".tar","");
318 execute("tar -f ./${OUTPUT} --transform=\"s@^@${OUTDIR}/@\" -c ${INPUT}"); 319 execute("tar -f ./${OUTPUT} --transform=\"s@^@${OUTDIR}/@\" -c ${INPUT}");
319 } 320 }
320} 321}
diff --git a/src/experimental/blowfish.cpp b/src/experimental/blowfish.cpp
index d01ecd3..7ff8a4d 100644
--- a/src/experimental/blowfish.cpp
+++ b/src/experimental/blowfish.cpp
@@ -1,2 +1,6 @@
1#include "bu/blowfish.h" 1#include "bu/blowfish.h"
2 2
3template class Bu::CipherModeEcb<8, Bu::Blowfish<1> >;
4template class Bu::CipherModeCfb<8, Bu::Blowfish<1> >;
5template class Bu::CipherModeCbc<8, Bu::Blowfish<1> >;
6template class Bu::CipherModeOfb<8, Bu::Blowfish<1> >;
diff --git a/src/stable/ringbuffer.h b/src/stable/ringbuffer.h
index d4b5993..79c5a15 100644
--- a/src/stable/ringbuffer.h
+++ b/src/stable/ringbuffer.h
@@ -67,16 +67,15 @@ namespace Bu
67 iStart = 0; 67 iStart = 0;
68 iEnd = 1; 68 iEnd = 1;
69 va.construct( &aData[0], v ); 69 va.construct( &aData[0], v );
70 return;
70 } 71 }
71 else if( iStart == iEnd ) 72 else if( iStart == iEnd )
72 { 73 {
73 throw ExceptionBase("Hey, it's full!"); 74 // The ringbuffer is full
74 } 75 dequeue();
75 else
76 {
77 va.construct( &aData[iEnd], v );
78 iEnd = (iEnd+1)%iCapacity;
79 } 76 }
77 va.construct( &aData[iEnd], v );
78 iEnd = (iEnd+1)%iCapacity;
80 } 79 }
81 80
82 value dequeue() 81 value dequeue()
@@ -104,6 +103,16 @@ namespace Bu
104 return aData[(iIndex+iStart)%iCapacity]; 103 return aData[(iIndex+iStart)%iCapacity];
105 } 104 }
106 105
106 value &first()
107 {
108 return aData[iStart];
109 }
110
111 value &last()
112 {
113 return aData[(iEnd-1+iCapacity)%iCapacity];
114 }
115
107 int getSize() 116 int getSize()
108 { 117 {
109 if( iStart < 0 ) 118 if( iStart < 0 )
@@ -201,6 +210,20 @@ namespace Bu
201 return core->get( 0 ); 210 return core->get( 0 );
202 } 211 }
203 212
213 virtual value &first()
214 {
215 _hardCopy();
216
217 return core->first();
218 }
219
220 virtual value &last()
221 {
222 _hardCopy();
223
224 return core->last();
225 }
226
204 value &operator[]( int iIndex ) 227 value &operator[]( int iIndex )
205 { 228 {
206 _hardCopy(); 229 _hardCopy();
diff --git a/src/tools/bnfcompile.cpp b/src/tests/bnfcompile.cpp
index af7a0eb..af7a0eb 100644
--- a/src/tools/bnfcompile.cpp
+++ b/src/tests/bnfcompile.cpp
diff --git a/src/tools/parser.cpp b/src/tests/parser.cpp
index af53bc8..af53bc8 100644
--- a/src/tools/parser.cpp
+++ b/src/tests/parser.cpp