Fix:Core:Renamed src to navit for cleanup of includes
[navit-package] / navit / speech.c
1 #include <glib.h>
2 #include <string.h>
3 #include "debug.h"
4 #include "speech.h"
5 #include "plugin.h"
6
7 struct speech {
8         struct speech_priv *priv;
9         struct speech_methods meth;
10 };
11
12 struct speech *
13 speech_new(const char *type, const char *data) 
14 {
15         struct speech *this_;
16         struct speech_priv *(*speech_new)(const char *data, struct speech_methods *meth);
17
18         dbg(1,"enter type=%s data=%s\n", type, data);
19         speech_new=plugin_get_speech_type(type);
20         dbg(1,"new=%p\n", speech_new);
21         if (! speech_new) {
22                 return NULL;
23         }
24         this_=g_new0(struct speech, 1);
25         this_->priv=speech_new(data, &this_->meth);
26         dbg(1, "say=%p\n", this_->meth.say);
27         dbg(1,"priv=%p\n", this_->priv);
28         if (! this_->priv) {
29                 g_free(this_);
30                 return NULL;
31         }
32         dbg(1,"return %p\n", this_);
33         return this_;
34 }
35
36 int
37 speech_say(struct speech *this_, const char *text)
38 {
39         dbg(1, "this_=%p text='%s' calling %p\n", this_, text, this_->meth.say);
40         return (this_->meth.say)(this_->priv, text);
41 }