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