diff --git a/sflphone-common/configure.ac b/sflphone-common/configure.ac index 0cf89b3821fa0b9276e98b3003d8d6bb00f16080..e057d6f955e2917e739c89e13500be1efdea8199 100644 --- a/sflphone-common/configure.ac +++ b/sflphone-common/configure.ac @@ -265,9 +265,24 @@ fi xml_CFLAGS= xml_LIBS=-lexpat - AC_SUBST(xml_CFLAGS) +AC_SUBST(xml_CFLAGS) AC_SUBST(xml_LIBS) +AC_CHECK_LIB([yaml], yaml_parser_initialize, + [AC_CHECK_HEADERS(expat.h, have_expat=true, have_expat=false)], + have_yaml = false) + +if ! $have_yaml; then +AC_MSG_ERROR([You need the eXpat xml parser] + [http://expat.sourceforge.net/]) +fi + +yaml_CFLAGS= +yaml_LIBS=lyaml + +AC_SUBST(yaml_CFLAGS) +AC_SUBST(yaml_LIBS) + AC_CHECK_LIB([pthread], pthread_create, [AC_CHECK_HEADERS(pthread.h, have_pthread=true, have_pthread=false)], have_pthread=false) @@ -292,6 +307,7 @@ AC_SUBST(PCRE_CFLAGS) + # For the tools/, we need libdbus-c++ for the "build" architecture as well AM_CONDITIONAL(CROSS_COMPILING, test "$cross_compiling" = "yes") diff --git a/sflphone-common/src/config/Makefile.am b/sflphone-common/src/config/Makefile.am index d72225850fc3415ab1c5818cace8bc740401fe29..d3c2bb709a165ed1421515f5fa41659cb2ede24e 100644 --- a/sflphone-common/src/config/Makefile.am +++ b/sflphone-common/src/config/Makefile.am @@ -3,4 +3,21 @@ SUBDIRS = noinst_LTLIBRARIES = libconfig.la libconfig_la_SOURCES = \ - config.cpp config.h + config.cpp \ + yamlengine.cpp \ + yamlemitter.cpp \ + yamlparser.cpp + +noinst_HEADERS = \ + config.h \ + engine.h \ + serializable.h \ + yamlengine.h \ + yamlemitter.h \ + yamlparser.h + +libconfig_la_LDFLAGS = \ + ${yaml_LIBS} + +libconfig_la_CFLAGS = \ + ${yaml_CFLAGS} \ No newline at end of file diff --git a/sflphone-common/src/config/yamlengine.h b/sflphone-common/src/config/yamlengine.h index 22cb6198d89388bc676605d232925bafdac1eb71..665330be88e6911e2977f2b367af4dcaa46542a4 100644 --- a/sflphone-common/src/config/yamlengine.h +++ b/sflphone-common/src/config/yamlengine.h @@ -31,10 +31,11 @@ #ifndef __YAMLENGINE_H__ #define __YAMLENGINE_H__ +#include "engine.h" #include "yamlparser.h" -#include "yamlemiter.h" +#include "yamlemitter.h" -class YamlEngine : Engine { +class YamlEngine : public Engine { public: @@ -54,7 +55,7 @@ class YamlEngine : Engine { YamlParser *parser; - YamlEmiter *emiter; + YamlEmitter *emitter; }; diff --git a/sflphone-common/src/config/yamlparser.cpp b/sflphone-common/src/config/yamlparser.cpp index 8a3040234362e123549d911f110b68a6e2196fc7..0d34db1760a81473dff6ba19b9c6a98aedc2482b 100644 --- a/sflphone-common/src/config/yamlparser.cpp +++ b/sflphone-common/src/config/yamlparser.cpp @@ -34,7 +34,7 @@ YamlParser::YamlParser() { - memset(buffer, 0, BUFFER_SIZE); + memset(buffer, 0, PARSER_BUFFERSIZE); open(); } @@ -69,12 +69,12 @@ void YamlParser::close() void YamlParser::parse() { - bool done; + bool done = false; yaml_event_t event; while(!done) { - if(!yaml_parser_parse(&parse, &event)) + if(!yaml_parser_parse(&parser, &event)) throw 20; done = (event.type == YAML_STREAM_END_EVENT); diff --git a/sflphone-common/src/config/yamlparser.h b/sflphone-common/src/config/yamlparser.h index b1e8dcef7e792980ce8f51ffc9a5f7a9fdab8dc1..510cf00f8bdccc18d9e480b33dae0ccb5d67d02c 100644 --- a/sflphone-common/src/config/yamlparser.h +++ b/sflphone-common/src/config/yamlparser.h @@ -43,7 +43,7 @@ class YamlParser { YamlParser(); - ~YamlParsere(); + ~YamlParser(); void open(); @@ -68,7 +68,7 @@ class YamlParser { /** * The event structure array. */ - yaml_event_t event[PARSER_MAXEVENT]; + yaml_event_t events[PARSER_MAXEVENT]; /** *