Commit 0b021d93 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Updated way to use vcard grammar in library

parent 43bbb9a5
......@@ -32,5 +32,4 @@ tests/belcard-tester
tests/belcard-folder
tests/belcard-unfolder
tests/belcard-parser
src/vcard_grammar.cpp
tools/output.vcf
......@@ -19,7 +19,6 @@
#ifndef vcard_grammar_hpp
#define vcard_grammar_hpp
extern unsigned char vcard_grammar[];
extern unsigned int vcard_grammar_len;
extern const char *vcard_grammar;
#endif
......@@ -20,13 +20,6 @@
#
############################################################################
add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/vcard_grammar.cpp
COMMAND ${CMAKE_COMMAND} -E echo "#include \"belcard/vcard_grammar.hpp\"" > ${CMAKE_CURRENT_SOURCE_DIR}/vcard_grammar.cpp
COMMAND ${CMAKE_COMMAND} -E xxd -i ${CMAKE_CURRENT_SOURCE_DIR}/vcard.grammar | sed s/}\;/,0x00}\;/ >> ${CMAKE_CURRENT_SOURCE_DIR}/vcard_grammar.cpp
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/vcard.grammar
)
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/vcard.grammar PROPERTIES GENERATED ON)
set(BELCARD_HEADER_FILES )
set(BELCARD_SOURCE_FILES_C )
set(BELCARD_SOURCE_FILES_CXX
......
lib_LTLIBRARIES=libbelcard.la
vcard_grammar.cpp: vcard.grammar
echo "#include \"belcard/vcard_grammar.hpp\"" > vcard_grammar.cpp
xxd -i vcard.grammar | sed s/}\;/,0x00}\;/ >> vcard_grammar.cpp
libbelcard_la_SOURCES=belcard_parser.cpp \
belcard_params.cpp \
belcard_property.cpp \
......
vcard-list = vcard *vcard
/*
vcard_grammar.cpp
Copyright (C) 2015 Belledonne Communications SARL
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "belcard/vcard_grammar.hpp"
const char *vcard_grammar = R"==GRAMMAR==(vcard-list = vcard *vcard
vcard = "BEGIN:VCARD" CRLF
"VERSION:4.0" CRLF
......@@ -496,3 +516,4 @@ regular = "art-lojban" ; these tags match the 'langtag'
/ "zh-xiang"
alphanum = (ALPHA / DIGIT) ; letters and numbers
)==GRAMMAR==";
\ No newline at end of file
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