aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Buland <mike@xagasoft.com>2016-09-21 12:54:23 -0600
committerMike Buland <mike@xagasoft.com>2016-09-21 12:54:23 -0600
commita612205584558c52ae2fedd616d7eb735d5ba84a (patch)
treec82e28a16d8e63dc69f604be64afd544b424e9a5
parent4de5cbe4330bf65cf8157ab98b9c8cbc203dc1cb (diff)
downloadlibbu++-a612205584558c52ae2fedd616d7eb735d5ba84a.tar.gz
libbu++-a612205584558c52ae2fedd616d7eb735d5ba84a.tar.bz2
libbu++-a612205584558c52ae2fedd616d7eb735d5ba84a.tar.xz
libbu++-a612205584558c52ae2fedd616d7eb735d5ba84a.zip
Tweaks to make building on windows easier.
Also, just building without bzip2 or lzma easier.
Diffstat (limited to '')
-rw-r--r--.gitignore12
-rw-r--r--src/stable/bzip2.cpp3
-rw-r--r--src/stable/bzip2.h5
-rw-r--r--src/stable/condition.cpp4
-rw-r--r--src/stable/lzma.cpp4
-rw-r--r--src/stable/lzma.h5
-rw-r--r--src/tools/bin2cpp.cpp43
7 files changed, 69 insertions, 7 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..323adf8
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,12 @@
1*.o
2*.a
3*.exe
4/autoconfig.exe
5/bin2cpp.exe
6/mkunit.exe
7/myriad.exe
8.*.swp
9/src/autoconfig.h
10/src/signals.h
11/src/version.h
12/bu
diff --git a/src/stable/bzip2.cpp b/src/stable/bzip2.cpp
index b48af37..b634a2c 100644
--- a/src/stable/bzip2.cpp
+++ b/src/stable/bzip2.cpp
@@ -8,6 +8,7 @@
8#include "bu/bzip2.h" 8#include "bu/bzip2.h"
9#include "bu/trace.h" 9#include "bu/trace.h"
10 10
11#ifdef BU_HAS_BZIP2
11#include <bzlib.h> 12#include <bzlib.h>
12 13
13#define pState ((bz_stream *)prState) 14#define pState ((bz_stream *)prState)
@@ -234,3 +235,5 @@ Bu::size Bu::BZip2::getCompressedSize()
234 return sTotalOut; 235 return sTotalOut;
235} 236}
236 237
238#endif
239
diff --git a/src/stable/bzip2.h b/src/stable/bzip2.h
index e2c2753..6b5d9a9 100644
--- a/src/stable/bzip2.h
+++ b/src/stable/bzip2.h
@@ -11,6 +11,9 @@
11#include <stdint.h> 11#include <stdint.h>
12 12
13#include "bu/filter.h" 13#include "bu/filter.h"
14#include "bu/autoconfig.h"
15
16#ifdef BU_HAS_BZIP2
14 17
15namespace Bu 18namespace Bu
16{ 19{
@@ -47,3 +50,5 @@ namespace Bu
47} 50}
48 51
49#endif 52#endif
53
54#endif
diff --git a/src/stable/condition.cpp b/src/stable/condition.cpp
index 7719d7b..b82626d 100644
--- a/src/stable/condition.cpp
+++ b/src/stable/condition.cpp
@@ -5,10 +5,10 @@
5 * terms of the license contained in the file LICENSE. 5 * terms of the license contained in the file LICENSE.
6 */ 6 */
7 7
8#include <sys/time.h>
9
10#include "bu/condition.h" 8#include "bu/condition.h"
11 9
10#include <sys/time.h>
11
12Bu::Condition::Condition() 12Bu::Condition::Condition()
13{ 13{
14 pthread_cond_init( &cond, NULL ); 14 pthread_cond_init( &cond, NULL );
diff --git a/src/stable/lzma.cpp b/src/stable/lzma.cpp
index d05c79f..c8e8960 100644
--- a/src/stable/lzma.cpp
+++ b/src/stable/lzma.cpp
@@ -8,6 +8,8 @@
8#include "bu/lzma.h" 8#include "bu/lzma.h"
9#include "bu/trace.h" 9#include "bu/trace.h"
10 10
11#ifdef BU_HAS_LZMA
12
11#include <lzma.h> 13#include <lzma.h>
12 14
13#define pState ((lzma_stream *)prState) 15#define pState ((lzma_stream *)prState)
@@ -246,3 +248,5 @@ Bu::size Bu::Lzma::getCompressedSize()
246 return sTotalOut; 248 return sTotalOut;
247} 249}
248 250
251#endif
252
diff --git a/src/stable/lzma.h b/src/stable/lzma.h
index f4a6e28..3685546 100644
--- a/src/stable/lzma.h
+++ b/src/stable/lzma.h
@@ -11,6 +11,9 @@
11#include <stdint.h> 11#include <stdint.h>
12 12
13#include "bu/filter.h" 13#include "bu/filter.h"
14#include "bu/autoconfig.h"
15
16#ifdef BU_HAS_LZMA
14 17
15namespace Bu 18namespace Bu
16{ 19{
@@ -57,3 +60,5 @@ namespace Bu
57} 60}
58 61
59#endif 62#endif
63
64#endif
diff --git a/src/tools/bin2cpp.cpp b/src/tools/bin2cpp.cpp
index e0eab28..65e48ed 100644
--- a/src/tools/bin2cpp.cpp
+++ b/src/tools/bin2cpp.cpp
@@ -4,6 +4,7 @@
4#include <bu/streamstack.h> 4#include <bu/streamstack.h>
5#include <bu/strfilter.h> 5#include <bu/strfilter.h>
6#include <bu/taf.h> 6#include <bu/taf.h>
7#include <bu/autoconfig.h>
7 8
8#ifdef BU_HAS_DEFLATE 9#ifdef BU_HAS_DEFLATE
9#include <bu/deflate.h> 10#include <bu/deflate.h>
@@ -18,6 +19,16 @@
18#include <bu/base64.h> 19#include <bu/base64.h>
19#include <bu/hex.h> 20#include <bu/hex.h>
20 21
22Bu::String cescape( const Bu::String &sIn )
23{
24 Bu::String sOut;
25 for( Bu::String::const_iterator i = sIn.begin(); i; i++ )
26 {
27 sOut += Bu::String("\\x%1").arg( (int)*i, Bu::Fmt(2).hex() );
28 }
29 return sOut;
30}
31
21using namespace Bu; 32using namespace Bu;
22 33
23class Options : public OptParser 34class Options : public OptParser
@@ -223,12 +234,34 @@ int main( int argc, char *argv[] )
223 << "\t{" << fSrc.nl; 234 << "\t{" << fSrc.nl;
224 235
225 int idx = 0; 236 int idx = 0;
226 for( Bu::StringList::iterator i = opt.slInput.begin(); i; i++ )
227 { 237 {
228 fSrc << "\t\tcase " << Bu::__calcHashCode( *i ) << "UL: // \"" 238 typedef Bu::List<Bu::StringList::iterator> IterList;
229 << *i << "\"" << fSrc.nl 239 typedef Bu::Hash<uint32_t, IterList> IterHashList;
230 << "\t\t\treturn aFile[" << idx << "];" << fSrc.nl; 240 typedef Bu::Hash<Bu::String, int> IdxHash;
231 idx++; 241
242 IdxHash hIdx;
243 IterHashList hCodes;
244 for( Bu::StringList::iterator i = opt.slInput.begin(); i; i++ )
245 {
246 uint32_t uc = Bu::__calcHashCode( *i );
247 if( !hCodes.has( uc ) )
248 {
249 hCodes.insert( uc, IterList() );
250 }
251 hCodes.get( uc ).append( i );
252 hIdx.insert( *i, idx++ );
253 }
254 for( IterHashList::iterator r = hCodes.begin(); r; r++ )
255 {
256 fSrc << "\t\tcase " << r.getKey() << "UL:" << fSrc.nl;
257 for( IterList::iterator i = r.getValue().begin(); i; i++ )
258 {
259 fSrc << "\t\t\tif( sName == \"" << cescape(*(*i)) << "\" ) // "
260 << *(*i) << fSrc.nl
261 << "\t\t\t\treturn aFile[" << hIdx.get(*(*i)) << "];" << fSrc.nl;
262 }
263 fSrc << "\t\t\tbreak;" << fSrc.nl;
264 }
232 } 265 }
233 fSrc << "\t}" << fSrc.nl 266 fSrc << "\t}" << fSrc.nl
234 << "\tthrow Bu::ExceptionBase(\"No file matching \\\"%s\\\" found.\", sName.getStr() );" << fSrc.nl 267 << "\tthrow Bu::ExceptionBase(\"No file matching \\\"%s\\\" found.\", sName.getStr() );" << fSrc.nl