Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • hammer/hammer
  • mlp/hammer
  • xentrac/hammer
  • pesco/hammer
  • letitiali/hammer
  • nobody/hammer
  • kia/hammer-sandbox
  • vyrus001/hammer
  • denleylam/hammer
9 results
Show changes
Commits on Source (4)
......@@ -2,6 +2,9 @@ language: c
compiler:
- gcc
- clang
before_install:
- sudo apt-get update -qq
- sudo apt-get install libboost1.49-dev
script: scons
notifications:
irc: "irc.upstandinghackers.com#hammer"
# -*- python -*-
import os
import os.path
env = Environment()
env.MergeFlags("-std=gnu99 -Wall -Wextra -Werror -Wno-unused-parameter -Wno-attributes -lrt")
......@@ -28,8 +29,13 @@ else:
if os.getenv("CC") == "clang":
env.Replace(CC="clang",
CXX="clang++")
#rootpath = env['ROOTPATH'] = os.path.abspath('.')
#env.Append(CPPPATH=os.path.join('#', "hammer"))
Export('env')
env.SConscript(["src/SConscript"], variant_dir='build/$VARIANT/src')
env.SConscript(["examples/SConscript"], variant_dir='build/$VARIANT/examples')
......
# -*- python -*-
Import('env')
bindings = ['cpp']
parsers = ['parsers/%s.c'%s for s in
['action',
'and',
......@@ -50,11 +52,17 @@ tests = ['t_benchmark.c',
't_grammar.c',
't_misc.c']
libhammer = env.SharedLibrary('hammer', parsers + backends + misc_hammer_parts)
libhammer = env.StaticLibrary('hammer', parsers + backends + misc_hammer_parts)
libhammer_shared = env.SharedLibrary('hammer', parsers + backends + misc_hammer_parts)
libhammer_static = env.StaticLibrary('hammer', parsers + backends + misc_hammer_parts)
testenv = env.Clone()
testenv.ParseConfig('pkg-config --cflags --libs glib-2.0')
testenv.Append(LIBS=['hammer'], LIBPATH=['.'])
testenv.Program('test_suite', tests + ['test_suite.c'])
Export("libhammer_static libhammer_shared")
for b in bindings:
env.SConscript(["bindings/%s/SConscript" % b])
# -*- python -*-
print "In CPP"
Import("libhammer_shared")
Import("libhammer_static")
Import("env")
env.Append(CPPPATH=["../.."])
binding_sources = ['hammer.cxx']
libhammerxx_shared = env.SharedLibrary("hammer++", binding_sources + [libhammer_shared])
libhammerxx_static = env.StaticLibrary("hammer++", binding_sources + [libhammer_static])
......@@ -5,8 +5,8 @@ namespace hammer {
typedef variant<BytesResult, UintResult, IntResult, NullResult, SequenceResult> AnyResult;
const BytesResult::result_type BytesResult::result() { return _bytes; }
const UintResult::result_type UintResult::result() { return _uint; }
const IntResult::result_type IntResult::result() { return _sint; }
UintResult::result_type UintResult::result() { return _uint; }
IntResult::result_type IntResult::result() { return _sint; }
const SequenceResult::result_type SequenceResult::result() { return _seq; }
template<>
......@@ -47,13 +47,13 @@ namespace hammer {
template<>
NullResult Parser<NullResult>::parse(const string &input) {
HParseResult *res = h_parse(_parser, reinterpret_cast<const uint8_t*>(input.c_str()), input.size());
h_parse(_parser, reinterpret_cast<const uint8_t*>(input.c_str()), input.size());
return NullResult();
}
template<>
NullResult Parser<NullResult>::parse(const uint8_t *input, size_t length) {
HParseResult *res = h_parse(_parser, input, length);
h_parse(_parser, input, length);
return NullResult();
}
......
......@@ -34,7 +34,7 @@ namespace hammer {
public:
typedef uint64_t result_type;
UintResult(const uint64_t res) : _uint(res) { }
const result_type result();
result_type result();
private:
UintResult() { }
result_type _uint;
......@@ -44,7 +44,7 @@ namespace hammer {
public:
typedef int64_t result_type;
IntResult(const int64_t res) : _sint(res) { }
const result_type result();
result_type result();
private:
IntResult() { }
result_type _sint;
......@@ -54,7 +54,7 @@ namespace hammer {
public:
NullResult() { }
typedef void* result_type;
const result_type result() { return NULL; }
result_type result() { return NULL; }
};
class SequenceResult : public ParseResult<vector<variant<BytesResult, UintResult, IntResult, NullResult, SequenceResult> > > {
......@@ -73,7 +73,7 @@ namespace hammer {
template<class T> class Optional;
class RepeatN;
class Ignore;
class Indirect;
template<class T> class Indirect;
template<class T> class IntRange;
template<typename T>
......@@ -491,9 +491,11 @@ namespace hammer {
}
*/
Indirect() : _p(0) {}
bind(Parser<T> &p) {
Indirect bind(Parser<T> &p) {
this->_parser = h_indirect();
this->_p = p;
h_bind_indirect(this->_parser, p.parser());
return *this;
}
private:
Parser<T> _p;
......