diff options
Diffstat (limited to 'c++-libbu++')
| -rw-r--r-- | c++-libbu++/Makefile | 21 | ||||
| -rw-r--r-- | c++-libbu++/src/boolean.cpp | 1 | ||||
| -rw-r--r-- | c++-libbu++/src/gatsc/main.cpp | 11 |
3 files changed, 32 insertions, 1 deletions
diff --git a/c++-libbu++/Makefile b/c++-libbu++/Makefile new file mode 100644 index 0000000..5ff9292 --- /dev/null +++ b/c++-libbu++/Makefile | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | OBJECTS := $(patsubst %.cpp,%.o,$(wildcard src/*.cpp)) | ||
| 2 | |||
| 3 | .PHONY: default all headers clean tests install | ||
| 4 | |||
| 5 | default: libgats.a | ||
| 6 | |||
| 7 | all: default tests | ||
| 8 | |||
| 9 | clean: | ||
| 10 | -rm ${HEADERS} ${OBJECTS} libgats.a ${TOOLS} ${UNITS} ${TESTS} | ||
| 11 | |||
| 12 | $(foreach fn,$(wildcard src/*.h),bu/$(notdir ${fn})): bu/%: src/% | ||
| 13 | ln -s ../$< $@ | ||
| 14 | |||
| 15 | ${OBJECTS}: %.o: %.cpp | ||
| 16 | ${CXX} -ggdb -W -Wall -I. -I../../libbu++ ${CXXFLAGS} $< -c -o $@ | ||
| 17 | |||
| 18 | libgats.a: ${HEADERS} ${OBJECTS} | ||
| 19 | ar -r libgats.a ${OBJECTS} | ||
| 20 | |||
| 21 | |||
diff --git a/c++-libbu++/src/boolean.cpp b/c++-libbu++/src/boolean.cpp index 2ee0227..e442c2c 100644 --- a/c++-libbu++/src/boolean.cpp +++ b/c++-libbu++/src/boolean.cpp | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | #include "gats/boolean.h" | 8 | #include "gats/boolean.h" |
| 9 | 9 | ||
| 10 | #include <bu/formatter.h> | 10 | #include <bu/formatter.h> |
| 11 | #include <bu/string.h> | ||
| 11 | #include <bu/stream.h> | 12 | #include <bu/stream.h> |
| 12 | 13 | ||
| 13 | Gats::Boolean::Boolean() : | 14 | Gats::Boolean::Boolean() : |
diff --git a/c++-libbu++/src/gatsc/main.cpp b/c++-libbu++/src/gatsc/main.cpp index 5291a33..c95b914 100644 --- a/c++-libbu++/src/gatsc/main.cpp +++ b/c++-libbu++/src/gatsc/main.cpp | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | #include <bu/sio.h> | 11 | #include <bu/sio.h> |
| 12 | #include <bu/streamstack.h> | 12 | #include <bu/streamstack.h> |
| 13 | #include <bu/deflate.h> | 13 | #include <bu/deflate.h> |
| 14 | #include <bu/hex.h> | ||
| 14 | 15 | ||
| 15 | #include "gats/types.h" | 16 | #include "gats/types.h" |
| 16 | #include "gats/gatsstream.h" | 17 | #include "gats/gatsstream.h" |
| @@ -22,7 +23,8 @@ class Options : public OptParser | |||
| 22 | public: | 23 | public: |
| 23 | Options( int argc, char *argv[] ) : | 24 | Options( int argc, char *argv[] ) : |
| 24 | bCompile( true ), | 25 | bCompile( true ), |
| 25 | bCompress( false ) | 26 | bCompress( false ), |
| 27 | bHex( false ) | ||
| 26 | { | 28 | { |
| 27 | addHelpBanner("Gats Compiler\nUsage: gatsc [options] [input]\n"); | 29 | addHelpBanner("Gats Compiler\nUsage: gatsc [options] [input]\n"); |
| 28 | 30 | ||
| @@ -33,6 +35,7 @@ public: | |||
| 33 | "Convert binary gats to text gats."); | 35 | "Convert binary gats to text gats."); |
| 34 | 36 | ||
| 35 | addOption( bCompress, 'z', "compress", "Compress with deflate."); | 37 | addOption( bCompress, 'z', "compress", "Compress with deflate."); |
| 38 | addOption( bHex, 'x', "hex", "Encode output as hex."); | ||
| 36 | 39 | ||
| 37 | addHelpOption('h', "help", "This Help"); | 40 | addHelpOption('h', "help", "This Help"); |
| 38 | 41 | ||
| @@ -40,6 +43,7 @@ public: | |||
| 40 | 43 | ||
| 41 | setOverride("decompile", false ); | 44 | setOverride("decompile", false ); |
| 42 | setOverride("compress", true ); | 45 | setOverride("compress", true ); |
| 46 | setOverride("hex", true ); | ||
| 43 | 47 | ||
| 44 | parse( argc, argv ); | 48 | parse( argc, argv ); |
| 45 | } | 49 | } |
| @@ -52,6 +56,7 @@ public: | |||
| 52 | 56 | ||
| 53 | bool bCompile; | 57 | bool bCompile; |
| 54 | bool bCompress; | 58 | bool bCompress; |
| 59 | bool bHex; | ||
| 55 | String sInput; | 60 | String sInput; |
| 56 | String sOutput; | 61 | String sOutput; |
| 57 | }; | 62 | }; |
| @@ -83,6 +88,10 @@ int main( int argc, char *argv[] ) | |||
| 83 | { | 88 | { |
| 84 | ssOut.pushFilter<Deflate>(); | 89 | ssOut.pushFilter<Deflate>(); |
| 85 | } | 90 | } |
| 91 | if( opt.bHex ) | ||
| 92 | { | ||
| 93 | ssOut.pushFilter<Hex>(); | ||
| 94 | } | ||
| 86 | Gats::GatsStream gs( ssOut ); | 95 | Gats::GatsStream gs( ssOut ); |
| 87 | Gats::Object *pObj = Gats::Object::strToGats( fIn.readAll() ); | 96 | Gats::Object *pObj = Gats::Object::strToGats( fIn.readAll() ); |
| 88 | gs.writeObject( pObj ); | 97 | gs.writeObject( pObj ); |
