Commit 68ad803e authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Using xxd to compile vcard grammar into header

parent 8e2ffb56
......@@ -31,3 +31,4 @@ belcard.kdev4
tests/belcard-tester
tests/belcard-folder
tests/belcard-unfolder
include/belcard/vcard_grammar.hpp
......@@ -16,6 +16,12 @@ AC_PROG_CXX
CXXFLAGS="$CXXFLAGS -std=c++11 -Wall -Werror"
# Checks for libraries.
dnl Check for xxd
AC_CHECK_PROG(xxd_found, xxd, yes)
if test "$xxd_found" != yes ;then
AC_MSG_ERROR("xxd is required (provided by vim package)")
fi
# Checks for header files.
......
belcard_includedir=$(includedir)/belcard
belcard_include_HEADERS = belcard.hpp belcard_generic.hpp belcard_identification.hpp belcard_parser.hpp
vcard_grammar.hpp: vcard.grammar
xxd -i vcard.grammar | sed s/}\;/,0x00}\;/ > vcard_grammar.hpp
belcard_include_HEADERS = belcard.hpp belcard_generic.hpp belcard_identification.hpp belcard_parser.hpp vcard_grammar.hpp
EXTRA_DIST=$(belcard_include_HEADERS)
#include "belcard/belcard_parser.hpp"
#include "belcard/belcard.hpp"
#include "belcard/vcard_grammar.hpp"
using namespace::std;
using namespace::belr;
using namespace::belcard;
BelCardParser::BelCardParser() {
_grammar = _grammar_builder.createFromAbnf("vcardgrammar.txt", make_shared<CoreRules>());
_grammar = _grammar_builder.createFromAbnf((const char*)vcard_grammar, make_shared<CoreRules>());
}
BelCardParser::~BelCardParser() {
......
bin_PROGRAMS=belcard-folder belcard-unfolder
noinst_PROGRAMS=belcard-tester
bin_PROGRAMS=belcard-folder belcard-unfolder belcard-tester
belcard_tester_SOURCES=belcard-tester.cpp
belcard_tester_LDADD=$(top_builddir)/src/libbelcard.la -lbelr
......@@ -10,6 +9,4 @@ belcard_folder_LDADD=$(top_builddir)/src/libbelcard.la -lbelr
belcard_unfolder_SOURCES=belcard-unfolder.cpp
belcard_unfolder_LDADD=$(top_builddir)/src/libbelcard.la -lbelr
EXTRA_DIST=vcardgrammar.txt vcardtest.vcf
AM_CPPFLAGS=-I$(top_srcdir)/include
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment