aboutsummaryrefslogtreecommitdiff
path: root/c++-libbu++/src/gatsc/main.cpp
diff options
context:
space:
mode:
authorMike Buland <mike@xagasoft.com>2016-09-21 12:56:11 -0600
committerMike Buland <mike@xagasoft.com>2016-09-21 12:56:11 -0600
commit10f61f1285190986498221cfa82b2d3b9fe9f391 (patch)
tree78a469517d56aa423dbc231cd49544ffb4969738 /c++-libbu++/src/gatsc/main.cpp
parenta9e52e201f401860e394a87ec3634206aedc440b (diff)
downloadlibgats-10f61f1285190986498221cfa82b2d3b9fe9f391.tar.gz
libgats-10f61f1285190986498221cfa82b2d3b9fe9f391.tar.bz2
libgats-10f61f1285190986498221cfa82b2d3b9fe9f391.tar.xz
libgats-10f61f1285190986498221cfa82b2d3b9fe9f391.zip
Accumulated changes.
Diffstat (limited to 'c++-libbu++/src/gatsc/main.cpp')
-rw-r--r--c++-libbu++/src/gatsc/main.cpp11
1 files changed, 10 insertions, 1 deletions
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
22public: 23public:
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 );