Commit 76146f60 by Ilya Dogolazky

using iodata-type-to-c++ compiler

1 parent 306a5a2c
timed (2.37) unstable; urgency=low
* new version
* compiling .type files into the timed binary
-- Ilya Dogolazky <ilya.dogolazky@nokia.com> Tue, 25 Jan 2011 13:20:56 +0200
-- Ilya Dogolazky <ilya.dogolazky@nokia.com> Sun, 30 Jan 2011 21:33:16 +0200
timed (2.36) unstable; urgency=low
......
# the old: usr/bin/timed
usr/bin/timed
usr/share/timed/typeinfo
# compiled in, don't install
# usr/share/timed/typeinfo
usr/share/contextkit/providers/com.nokia.time.context
......
......@@ -24,6 +24,9 @@
#include <iodata/iodata>
#include <iodata/storage>
#include "queue.type.h"
#include "settings.type.h"
#include "backup.h"
// The directory name, must match the path mentioned in timedbackup.conf:
......@@ -108,7 +111,7 @@ bool backup_t::save_queue_as(const string &path)
iodata::storage *backup = new iodata::storage ;
backup->set_primary_path(path) ;
backup->set_validator(timed->event_queue_type(), "event_queue_t") ;
backup->set_validator(events_data_validator(), "event_queue_t") ;
int res = backup->save(r) ;
delete backup ;
......@@ -133,7 +136,7 @@ bool backup_t::read_queue_from(const string &path)
iodata::storage *backup = new iodata::storage ;
backup->set_primary_path(backup_queue) ;
backup->set_validator(timed->event_queue_type(), "event_queue_t") ;
backup->set_validator(events_data_validator(), "event_queue_t") ;
iodata::record *r = backup->load() ;
......@@ -173,7 +176,7 @@ bool backup_t::save_settings_as(const string &path)
iodata::storage *backup = new iodata::storage ;
backup->set_primary_path(path) ;
backup->set_validator(timed->settings_file_type(), "settings_t") ;
backup->set_validator(settings_data_validator(), "settings_t") ;
int res = backup->save(r) ;
delete backup ;
......
_function = "etc_timed_rc_validator",
/*
const_t =
......
_function = "customization_data_validator",
customization_t =
[
{ name = "format24", type = $bytes, value = "True" },
......
_function = "events_data_validator",
event_queue_t =
[
{ name = "next_cookie", type = $integer, value = 1 },
......
......@@ -12,6 +12,8 @@ QMAKE_LIBDIR_FLAGS += -L../lib -L../voland
LIBS += -ltimed -ltimed-voland
CONFIG += qmlog
IODATA_TYPES = queue.type config.type settings.type customization.type tzdata.type
HEADERS += peer.h settings.h csd.h interfaces.h adaptor.h timed.h state.h cluster.h machine.h singleshot.h pinguin.h unix-signal.h onitz.h
SOURCES += peer.cpp tzdata.cpp cellular.cpp csd.cpp cluster.cpp machine.cpp state.cpp main.cpp timed.cpp timeutil.cpp event.cpp misc.cpp settings.cpp unix-signal.cpp onitz.cpp
......@@ -32,8 +34,8 @@ target.path = $$(DESTDIR)/usr/bin
xml.files = com.nokia.time.context
xml.path = $$(DESTDIR)/usr/share/contextkit/providers
typeinfo.files = queue.type config.type settings.type customization.type tzdata.type timed-cust-rc.type
typeinfo.path = $$(DESTDIR)/usr/share/timed/typeinfo
# typeinfo.files = queue.type config.type settings.type customization.type tzdata.type timed-cust-rc.type
# typeinfo.path = $$(DESTDIR)/usr/share/timed/typeinfo
backupconf.files = timedbackup.conf
backupconf.path = $$(DESTDIR)/usr/share/backup-framework/applications
......
_function = "settings_data_validator",
settings_t =
[
// The value '-1' means: use default value given by customization
......
......@@ -36,6 +36,11 @@
#include <timed/interface>
#include <qmlog>
#include "queue.type.h"
#include "config.type.h"
#include "customization.type.h"
#include "settings.type.h"
#include "interfaces.h"
#include "adaptor.h"
#include "backup.h"
......@@ -288,7 +293,7 @@ void Timed::init_configuration()
{
iodata::storage *config_storage = new iodata::storage ;
config_storage->set_primary_path(configuration_path()) ;
config_storage->set_validator(configuration_type(), "config_t") ;
config_storage->set_validator(etc_timed_rc_validator(), "config_t") ;
iodata::record *c = config_storage->load() ;
log_assert(c, "loading configuration settings failed") ;
......@@ -322,7 +327,7 @@ void Timed::init_customization()
{
iodata::storage *storage = new iodata::storage ;
storage->set_primary_path(customization_path()) ;
storage->set_validator(customization_type(), "customization_t") ;
storage->set_validator(customization_data_validator(), "customization_t") ;
iodata::record *c = storage->load() ;
log_assert(c, "loading customization settings failed") ;
......@@ -355,7 +360,7 @@ void Timed::init_read_settings()
settings_storage = new iodata::storage ;
settings_storage->set_primary_path(settings_path) ;
settings_storage->set_secondary_path(settings_path+".bak") ;
settings_storage->set_validator(settings_file_type(), "settings_t") ;
settings_storage->set_validator(settings_data_validator(), "settings_t") ;
iodata::record *tree = settings_storage->load() ;
......@@ -501,7 +506,7 @@ void Timed::init_load_events()
event_storage = new iodata::storage ;
event_storage->set_primary_path(events_path) ;
event_storage->set_secondary_path(events_path+".bak") ;
event_storage->set_validator(event_queue_type(), "event_queue_t") ;
event_storage->set_validator(events_data_validator(), "event_queue_t") ;
iodata::record *events = event_storage->load() ;
......
......@@ -50,14 +50,14 @@ struct Timed : public QCoreApplication
{
public:
inline const char *configuration_path() { return "/etc/timed.config" ; }
inline const char *configuration_type() { return "/usr/share/timed/typeinfo/config.type" ; }
// inline const char *configuration_type() { return "/usr/share/timed/typeinfo/config.type" ; }
inline const char *customization_path() { return "/usr/share/timed/customization.data" ; } // TODO: make it configurable
inline const char *customization_type() { return "/usr/share/timed/typeinfo/customization.type" ; }
// inline const char *customization_type() { return "/usr/share/timed/typeinfo/customization.type" ; }
inline const char *settings_file_type() { return "/usr/share/timed/typeinfo/settings.type" ; }
// inline const char *settings_file_type() { return "/usr/share/timed/typeinfo/settings.type" ; }
inline const char *event_queue_type() { return "/usr/share/timed/typeinfo/queue.type" ; }
// inline const char *event_queue_type() { return "/usr/share/timed/typeinfo/queue.type" ; }
private:
bool act_dead_mode ;
......
......@@ -138,7 +138,7 @@ string tzdata::set_str(const set<olson*> &x)
// --- initialization ---
static iodata::validator *tzdata_validator = iodata::validator::from_file("/usr/share/timed/typeinfo/tzdata.type") ;
#include "tzdata.type.h"
#if 0
static struct tz_distinct_t
......@@ -162,7 +162,7 @@ static iodata::record *open_database(const char *path, const char *type)
{
log_notice("opening file '%s', reading record of type '%s'", path, type) ;
iodata::storage file ;
file.set_validator(tzdata_validator, type) ;
file.set_validator(tzdata_validator(), type) ;
file.set_primary_path(path) ;
if (iodata::record *res = file.load())
return res ;
......
# TODO: check the names before moving stuff to tzdata package
# "list" is a horrible name, other are not much better!
_function = "tzdata_validator",
tz_single_t = [ { name="list", type=$array|$record|$mandatory, record="tz_single_info_t" } ],
tz_distinct_t = [ { name="list", type=$array|$record|$mandatory, record="tz_distinct_info_t" } ],
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!