annotate Mac/Modules/macspeechmodule.c @ 4566:6403c94de50d legacy-trunk

Added safeguard against failure in __del__.
author Guido van Rossum <guido@python.org>
date Wed, 27 Nov 1996 19:39:58 +0000
parents 22cd22bf4384
children 44bdf0b56c0b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1922
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
1 /***********************************************************
2091
b4d982c648bb 1995 copyright
Guido van Rossum <guido@python.org>
parents: 2027
diff changeset
2 Copyright 1991-1995 by Stichting Mathematisch Centrum, Amsterdam,
b4d982c648bb 1995 copyright
Guido van Rossum <guido@python.org>
parents: 2027
diff changeset
3 The Netherlands.
1922
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
4
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
5 All Rights Reserved
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
6
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
7 Permission to use, copy, modify, and distribute this software and its
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
8 documentation for any purpose and without fee is hereby granted,
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
9 provided that the above copyright notice appear in all copies and that
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
10 both that copyright notice and this permission notice appear in
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
11 supporting documentation, and that the names of Stichting Mathematisch
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
12 Centrum or CWI not be used in advertising or publicity pertaining to
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
13 distribution of the software without specific, written prior permission.
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
14
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
15 STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
16 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
17 FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
18 FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
19 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
20 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
21 OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
22
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
23 ******************************************************************/
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
24
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
25 /* xx module */
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
26
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
27 #include "allobjects.h"
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
28 #include "modsupport.h"
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
29
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
30 #include <GestaltEqu.h>
2027
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
31 #include "Speech.h"
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
32
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
33 #ifdef __MWERKS__
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
34 #include <Strings.h>
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
35 #define c2pstr C2PStr
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
36 #define p2cstr P2CStr
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
37 #else
1922
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
38 #include "pascal.h"
2027
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
39 #endif /* __MWERKS__ */
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
40
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
41 #ifdef __powerc
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
42 #include <FragLoad.h>
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
43 int lib_available;
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
44 #endif /* __powerc */
1922
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
45
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
46 /* Somehow the Apple Fix2X and X2Fix don't do what I expect */
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
47 #define fixed2double(x) (((double)(x))/32768.0)
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
48 #define double2fixed(x) ((Fixed)((x)*32768.0))
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
49
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
50 char *CurrentSpeech;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
51 object *ms_error_object;
2027
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
52 int speech_available;
1922
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
53
2027
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
54 static
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
55 init_available() {
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
56 OSErr err;
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
57 long result;
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
58
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
59 #ifdef __powerc
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
60 lib_available = ((ProcPtr)SpeakString != (ProcPtr)0);
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
61 #endif
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
62 err = Gestalt(gestaltSpeechAttr, &result);
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
63 if ( err == noErr && (result & (1<<gestaltSpeechMgrPresent)))
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
64 return 1;
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
65 return 0;
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
66 }
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
67
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
68 static
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
69 check_available() {
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
70 if ( !speech_available ) {
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
71 err_setstr(ms_error_object, "Speech Mgr not available");
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
72 return 0;
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
73 }
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
74 #ifdef __powerc
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
75 if ( !lib_available ) {
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
76 err_setstr(ms_error_object, "Speech Mgr available, but shared lib missing");
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
77 return 0;
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
78 }
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
79 #endif
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
80 return 1;
1922
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
81 }
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
82
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
83 /* -------------
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
84 **
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
85 ** Part one - the speech channel object
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
86 */
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
87 typedef struct {
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
88 OB_HEAD
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
89 SpeechChannel chan;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
90 object *curtext; /* If non-NULL current text being spoken */
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
91 } scobject;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
92
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
93 staticforward typeobject sctype;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
94
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
95 #define is_scobject(v) ((v)->ob_type == &sctype)
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
96
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
97 static scobject *
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
98 newscobject(arg)
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
99 VoiceSpec *arg;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
100 {
2027
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
101 scobject *self;
1922
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
102 OSErr err;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
103
2027
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
104 self = NEWOBJ(scobject, &sctype);
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
105 if (self == NULL)
1922
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
106 return NULL;
2027
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
107 if ( (err=NewSpeechChannel(arg, &self->chan)) != 0) {
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
108 DECREF(self);
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
109 return (scobject *)PyErr_Mac(ms_error_object, err);
1922
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
110 }
2027
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
111 self->curtext = NULL;
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
112 return self;
1922
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
113 }
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
114
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
115 /* sc methods */
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
116
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
117 static void
2027
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
118 sc_dealloc(self)
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
119 scobject *self;
1922
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
120 {
2027
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
121 DisposeSpeechChannel(self->chan);
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
122 DEL(self);
1922
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
123 }
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
124
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
125 static object *
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
126 sc_Stop(self, args)
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
127 scobject *self;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
128 object *args;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
129 {
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
130 OSErr err;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
131
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
132 if (!getnoarg(args))
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
133 return NULL;
2027
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
134 if ((err=StopSpeech(self->chan)) != 0) {
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
135 PyErr_Mac(ms_error_object, err);
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
136 return NULL;
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
137 }
1922
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
138 if ( self->curtext ) {
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
139 DECREF(self->curtext);
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
140 self->curtext = NULL;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
141 }
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
142 INCREF(None);
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
143 return None;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
144 }
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
145
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
146 static object *
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
147 sc_SpeakText(self, args)
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
148 scobject *self;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
149 object *args;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
150 {
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
151 OSErr err;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
152 char *str;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
153 int len;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
154
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
155 if (!getargs(args, "s#", &str, &len))
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
156 return NULL;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
157 if ( self->curtext ) {
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
158 StopSpeech(self->chan);
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
159 DECREF(self->curtext);
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
160 self->curtext = NULL;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
161 }
2027
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
162 if ((err=SpeakText(self->chan, (Ptr)str, (long)len)) != 0) {
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
163 PyErr_Mac(ms_error_object, err);
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
164 return 0;
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
165 }
1922
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
166 (void)getargs(args, "O", &self->curtext); /* Or should I check this? */
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
167 INCREF(self->curtext);
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
168 INCREF(None);
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
169 return None;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
170 }
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
171
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
172 static object *
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
173 sc_GetRate(self, args)
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
174 scobject *self;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
175 object *args;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
176 {
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
177 OSErr err;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
178 Fixed farg;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
179
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
180 if (!getnoarg(args))
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
181 return NULL;
2027
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
182 if ((err=GetSpeechRate(self->chan, &farg)) != 0) {
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
183 PyErr_Mac(ms_error_object, err);
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
184 return 0;
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
185 }
1922
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
186 return newfloatobject(fixed2double(farg));
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
187 }
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
188
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
189 static object *
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
190 sc_GetPitch(self, args)
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
191 scobject *self;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
192 object *args;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
193 {
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
194 OSErr err;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
195 Fixed farg;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
196
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
197 if (!getnoarg(args))
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
198 return NULL;
2027
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
199 if ((err=GetSpeechPitch(self->chan, &farg)) != 0) {
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
200 PyErr_Mac(ms_error_object, err);
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
201 return 0;
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
202 }
1922
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
203 return newfloatobject(fixed2double(farg));
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
204 }
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
205
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
206 static object *
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
207 sc_SetRate(self, args)
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
208 scobject *self;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
209 object *args;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
210 {
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
211 OSErr err;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
212 double darg;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
213
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
214 if (!getargs(args, "d", &darg))
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
215 return NULL;
2027
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
216 if ((err=SetSpeechRate(self->chan, double2fixed(darg))) != 0) {
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
217 PyErr_Mac(ms_error_object, err);
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
218 return 0;
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
219 }
1922
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
220 INCREF(None);
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
221 return None;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
222 }
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
223
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
224 static object *
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
225 sc_SetPitch(self, args)
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
226 scobject *self;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
227 object *args;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
228 {
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
229 OSErr err;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
230 double darg;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
231
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
232 if (!getargs(args, "d", &darg))
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
233 return NULL;
2027
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
234 if ((err=SetSpeechPitch(self->chan, double2fixed(darg))) != 0) {
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
235 PyErr_Mac(ms_error_object, err);
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
236 return NULL;
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
237 }
1922
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
238 INCREF(None);
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
239 return None;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
240 }
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
241
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
242 static struct methodlist sc_methods[] = {
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
243 {"Stop", (method)sc_Stop},
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
244 {"SetRate", (method)sc_SetRate},
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
245 {"GetRate", (method)sc_GetRate},
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
246 {"SetPitch", (method)sc_SetPitch},
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
247 {"GetPitch", (method)sc_GetPitch},
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
248 {"SpeakText", (method)sc_SpeakText},
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
249 {NULL, NULL} /* sentinel */
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
250 };
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
251
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
252 static object *
2027
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
253 sc_getattr(self, name)
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
254 scobject *self;
1922
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
255 char *name;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
256 {
2027
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
257 return findmethod(sc_methods, (object *)self, name);
1922
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
258 }
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
259
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
260 static typeobject sctype = {
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
261 OB_HEAD_INIT(&Typetype)
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
262 0, /*ob_size*/
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
263 "MacSpeechChannel", /*tp_name*/
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
264 sizeof(scobject), /*tp_basicsize*/
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
265 0, /*tp_itemsize*/
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
266 /* methods */
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
267 (destructor)sc_dealloc, /*tp_dealloc*/
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
268 0, /*tp_print*/
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
269 (getattrfunc)sc_getattr, /*tp_getattr*/
2027
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
270 0, /*tp_setattr*/
1922
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
271 0, /*tp_compare*/
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
272 0, /*tp_repr*/
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
273 0, /*tp_as_number*/
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
274 0, /*tp_as_sequence*/
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
275 0, /*tp_as_mapping*/
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
276 0, /*tp_hash*/
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
277 };
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
278
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
279 /* -------------
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
280 **
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
281 ** Part two - the voice object
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
282 */
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
283 typedef struct {
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
284 OB_HEAD
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
285 int initialized;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
286 VoiceSpec vs;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
287 VoiceDescription vd;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
288 } mvobject;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
289
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
290 staticforward typeobject mvtype;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
291
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
292 #define is_mvobject(v) ((v)->ob_type == &mvtype)
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
293
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
294 static mvobject *
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
295 newmvobject()
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
296 {
2027
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
297 mvobject *self;
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
298 self = NEWOBJ(mvobject, &mvtype);
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
299 if (self == NULL)
1922
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
300 return NULL;
2027
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
301 self->initialized = 0;
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
302 return self;
1922
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
303 }
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
304
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
305 static int
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
306 initmvobject(self, ind)
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
307 mvobject *self;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
308 int ind;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
309 {
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
310 OSErr err;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
311
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
312 if ( (err=GetIndVoice((short)ind, &self->vs)) != 0 ) {
2027
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
313 PyErr_Mac(ms_error_object, err);
1922
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
314 return 0;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
315 }
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
316 if ( (err=GetVoiceDescription(&self->vs, &self->vd, sizeof self->vd)) != 0) {
2027
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
317 PyErr_Mac(ms_error_object, err);
1922
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
318 return 0;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
319 }
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
320 self->initialized = 1;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
321 return 1;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
322 }
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
323 /* mv methods */
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
324
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
325 static void
2027
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
326 mv_dealloc(self)
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
327 mvobject *self;
1922
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
328 {
2027
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
329 DEL(self);
1922
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
330 }
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
331
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
332 static object *
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
333 mv_getgender(self, args)
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
334 mvobject *self;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
335 object *args;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
336 {
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
337 object *rv;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
338
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
339 if (!getnoarg(args))
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
340 return NULL;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
341 if (!self->initialized) {
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
342 err_setstr(ms_error_object, "Uninitialized voice");
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
343 return NULL;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
344 }
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
345 rv = newintobject(self->vd.gender);
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
346 return rv;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
347 }
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
348
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
349 static object *
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
350 mv_newchannel(self, args)
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
351 mvobject *self;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
352 object *args;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
353 {
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
354 if (!getnoarg(args))
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
355 return NULL;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
356 if (!self->initialized) {
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
357 err_setstr(ms_error_object, "Uninitialized voice");
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
358 return NULL;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
359 }
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
360 return (object *)newscobject(&self->vs);
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
361 }
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
362
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
363 static struct methodlist mv_methods[] = {
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
364 {"GetGender", (method)mv_getgender},
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
365 {"NewChannel", (method)mv_newchannel},
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
366 {NULL, NULL} /* sentinel */
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
367 };
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
368
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
369 static object *
2027
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
370 mv_getattr(self, name)
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
371 mvobject *self;
1922
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
372 char *name;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
373 {
2027
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
374 return findmethod(mv_methods, (object *)self, name);
1922
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
375 }
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
376
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
377 static typeobject mvtype = {
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
378 OB_HEAD_INIT(&Typetype)
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
379 0, /*ob_size*/
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
380 "MacVoice", /*tp_name*/
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
381 sizeof(mvobject), /*tp_basicsize*/
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
382 0, /*tp_itemsize*/
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
383 /* methods */
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
384 (destructor)mv_dealloc, /*tp_dealloc*/
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
385 0, /*tp_print*/
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
386 (getattrfunc)mv_getattr, /*tp_getattr*/
2027
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
387 0, /*tp_setattr*/
1922
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
388 0, /*tp_compare*/
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
389 0, /*tp_repr*/
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
390 0, /*tp_as_number*/
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
391 0, /*tp_as_sequence*/
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
392 0, /*tp_as_mapping*/
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
393 0, /*tp_hash*/
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
394 };
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
395
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
396
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
397 /* -------------
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
398 **
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
399 ** Part three - The module interface
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
400 */
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
401
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
402 /* See if Speech manager available */
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
403
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
404 static object *
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
405 ms_Available(self, args)
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
406 object *self; /* Not used */
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
407 object *args;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
408 {
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
409
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
410 if (!getnoarg(args))
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
411 return NULL;
2027
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
412 return newintobject(speech_available);
1922
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
413 }
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
414
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
415 /* Count number of busy speeches */
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
416
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
417 static object *
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
418 ms_Busy(self, args)
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
419 object *self; /* Not used */
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
420 object *args;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
421 {
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
422 short result;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
423
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
424 if (!getnoarg(args))
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
425 return NULL;
2027
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
426 if ( !check_available() )
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
427 return NULL;
1922
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
428 result = SpeechBusy();
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
429 return newintobject(result);
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
430 }
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
431
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
432 /* Say something */
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
433
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
434 static object *
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
435 ms_SpeakString(self, args)
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
436 object *self; /* Not used */
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
437 object *args;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
438 {
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
439 OSErr err;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
440 char *str;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
441 int len;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
442
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
443 if (!getstrarg(args, &str))
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
444 return NULL;
2027
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
445 if ( !check_available())
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
446 return NULL;
1922
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
447 if (CurrentSpeech) {
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
448 /* Free the old speech, after killing it off
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
449 ** (note that speach is async and c2pstr works inplace)
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
450 */
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
451 SpeakString("\p");
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
452 free(CurrentSpeech);
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
453 }
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
454 len = strlen(str);
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
455 CurrentSpeech = malloc(len+1);
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
456 strcpy(CurrentSpeech, str);
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
457 err = SpeakString(c2pstr(CurrentSpeech));
2027
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
458 if ( err ) {
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
459 PyErr_Mac(ms_error_object, err);
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
460 return NULL;
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
461 }
1922
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
462 INCREF(None);
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
463 return None;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
464 }
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
465
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
466
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
467 /* Count number of available voices */
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
468
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
469 static object *
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
470 ms_CountVoices(self, args)
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
471 object *self; /* Not used */
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
472 object *args;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
473 {
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
474 short result;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
475
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
476 if (!getnoarg(args))
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
477 return NULL;
2027
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
478 if ( !check_available())
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
479 return NULL;
1922
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
480 CountVoices(&result);
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
481 return newintobject(result);
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
482 }
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
483
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
484 static object *
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
485 ms_GetIndVoice(self, args)
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
486 object *self; /* Not used */
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
487 object *args;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
488 {
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
489 mvobject *rv;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
490 long ind;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
491
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
492 if( !getargs(args, "i", &ind))
2027
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
493 return NULL;
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
494 if ( !check_available() )
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
495 return NULL;
1922
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
496 rv = newmvobject();
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
497 if ( !initmvobject(rv, ind) ) {
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
498 DECREF(rv);
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
499 return NULL;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
500 }
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
501 return (object *)rv;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
502 }
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
503
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
504
2027
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
505 static object *
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
506 ms_Version(self, args)
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
507 object *self; /* Not used */
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
508 object *args;
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
509 {
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
510 NumVersion v;
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
511
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
512 if (!getnoarg(args))
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
513 return NULL;
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
514 if ( !check_available())
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
515 return NULL;
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
516 v = SpeechManagerVersion();
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
517 return newintobject(*(int *)&v);
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
518 }
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
519
1922
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
520
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
521 /* List of functions defined in the module */
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
522
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
523 static struct methodlist ms_methods[] = {
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
524 {"Available", ms_Available},
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
525 {"CountVoices", ms_CountVoices},
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
526 {"Busy", ms_Busy},
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
527 {"SpeakString", ms_SpeakString},
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
528 {"GetIndVoice", ms_GetIndVoice},
2027
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
529 {"Version", ms_Version},
1922
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
530 {NULL, NULL} /* sentinel */
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
531 };
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
532
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
533 /* Initialization function for the module (*must* be called initmacspeech) */
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
534
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
535 void
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
536 initmacspeech()
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
537 {
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
538 object *m, *d;
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
539
2027
5c74c3aeda74 - Added Version method
Jack Jansen <jack.jansen@cwi.nl>
parents: 1922
diff changeset
540 speech_available = init_available();
1922
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
541 /* Create the module and add the functions */
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
542 m = initmodule("macspeech", ms_methods);
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
543
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
544 /* Add some symbolic constants to the module */
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
545 d = getmoduledict(m);
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
546 ms_error_object = newstringobject("macspeech.error");
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
547 dictinsert(d, "error", ms_error_object);
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
548
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
549 /* Check for errors */
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
550 if (err_occurred())
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
551 fatal("can't initialize module macspeech");
3850713f6aea Add files by Jack
Guido van Rossum <guido@python.org>
parents:
diff changeset
552 }