pangdudu-swiftly 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +57 -0
- data/external/include/swift.h +1040 -0
- data/external/include/swift_defs.h +132 -0
- data/external/include/swift_exports.h +45 -0
- data/external/include/swift_params.h +361 -0
- data/lib/Swiftly.c +47 -0
- data/lib/extconf.rb +14 -0
- data/test/test_swiftly.rb +11 -0
- metadata +63 -0
@@ -0,0 +1,132 @@
|
|
1
|
+
/* -*- c-file-style: "linux" -*- */
|
2
|
+
/* swift_defs.h: Forward declarations and enumerations for Swift TTS.
|
3
|
+
*
|
4
|
+
* Copyright (c) 2004-2006 Cepstral LLC. All rights reserved.
|
5
|
+
*
|
6
|
+
* Redistribution of this file, in whole or in part, with or without
|
7
|
+
* modification, is not allowed without express written permission of
|
8
|
+
* the copyright holder.
|
9
|
+
*/
|
10
|
+
|
11
|
+
#ifndef _SWIFT_DEFS_H_
|
12
|
+
#define _SWIFT_DEFS_H_
|
13
|
+
|
14
|
+
/**
|
15
|
+
* \file swift_defs.h
|
16
|
+
* Types and enumerations for the Swift text-to-speech API.
|
17
|
+
**/
|
18
|
+
|
19
|
+
/** Description of a voice available to the system. */
|
20
|
+
typedef struct swift_voice_desc_struct swift_voice;
|
21
|
+
|
22
|
+
/** A linked-list of swift_voice structs **/
|
23
|
+
typedef struct swift_voice_list_desc_struct swift_voice_list;
|
24
|
+
|
25
|
+
/** TTS Engine Object through which ports may be open. */
|
26
|
+
typedef struct swift_engine_struct swift_engine;
|
27
|
+
|
28
|
+
/** Swift Port Object through which speech synthesis is performed. */
|
29
|
+
typedef struct swift_port_struct swift_port;
|
30
|
+
|
31
|
+
/** Parameter list (key-value pairs). */
|
32
|
+
typedef struct cst_val_struct swift_params;
|
33
|
+
|
34
|
+
/** Generic value object. */
|
35
|
+
typedef struct cst_val_struct swift_val;
|
36
|
+
|
37
|
+
/** Waveform object. */
|
38
|
+
typedef struct cst_wave_struct swift_waveform;
|
39
|
+
|
40
|
+
/** ID of background synthesis job. */
|
41
|
+
typedef void * swift_background_t;
|
42
|
+
|
43
|
+
/** Synthesis event. */
|
44
|
+
typedef struct swift_event_struct swift_event;
|
45
|
+
|
46
|
+
/** Result (error/success) codes for API functions. */
|
47
|
+
typedef enum swift_result_t {
|
48
|
+
SWIFT_SUCCESS = 0, /**< Operation succeeded. */
|
49
|
+
SWIFT_UNKNOWN_ERROR = -1, /**< Unknown error. */
|
50
|
+
SWIFT_UNIMPLEMENTED = -2, /**< Function is not (yet) implemented. */
|
51
|
+
SWIFT_INTERNAL_ERROR = -3, /**< Engine internal error. */
|
52
|
+
SWIFT_INVALID_PARAM = -4, /**< Invalid parameter. */
|
53
|
+
SWIFT_INVALID_POINTER = -5, /**< Invalid NULL pointer in parameter. */
|
54
|
+
SWIFT_OBJECT_NOT_FOUND = -6, /**< File, voice, port, etc... not found. */
|
55
|
+
SWIFT_UNKNOWN_ENCODING = -7, /**< Unknown text/audio encoding. */
|
56
|
+
SWIFT_INTERRUPTED = -8, /**< Operation interrupted. */
|
57
|
+
SWIFT_INVALID_VOICE = -9, /**< Voice not present or corrupted. */
|
58
|
+
SWIFT_FILE_ERROR = -10, /**< A file could not be read/written. */
|
59
|
+
SWIFT_WRONG_EVENT = -11, /**< Wrong event type for the data requested.*/
|
60
|
+
SWIFT_ENGINE_INUSE = -12, /**< Engine still in use by some port. */
|
61
|
+
SWIFT_NETWORK_ERROR = -13, /**< Network communication failed. */
|
62
|
+
SWIFT_INVALID_KEY = -14, /**< An invalid license key was specified. */
|
63
|
+
SWIFT_QUEUE_FULL = -15, /**< The utterance queue is full. */
|
64
|
+
SWIFT_TOKEN_TIMEOUT = -16 /**< Get concurrecny token timed out. */
|
65
|
+
} swift_result_t;
|
66
|
+
|
67
|
+
/** Status of a background job. */
|
68
|
+
typedef enum swift_status_t {
|
69
|
+
SWIFT_STATUS_UNKNOWN = -1, /**< No such job. */
|
70
|
+
SWIFT_STATUS_DONE = 0, /**< Job has completed. */
|
71
|
+
SWIFT_STATUS_RUNNING = 1, /**< Job is currently running. */
|
72
|
+
SWIFT_STATUS_PAUSED = 2, /**< Job is currently paused. */
|
73
|
+
SWIFT_STATUS_QUEUED = 3 /**< Job is waiting to run. */
|
74
|
+
} swift_status_t;
|
75
|
+
|
76
|
+
/** Type of event for a callback (also used as a mask to request events). */
|
77
|
+
typedef enum swift_event_t {
|
78
|
+
SWIFT_EVENT_NONE = 0,
|
79
|
+
SWIFT_EVENT_AUDIO = (1<<0),
|
80
|
+
SWIFT_EVENT_ERROR = (1<<1),
|
81
|
+
SWIFT_EVENT_SENTENCE = (1<<2),
|
82
|
+
SWIFT_EVENT_PHRASE = (1<<3),
|
83
|
+
SWIFT_EVENT_TOKEN = (1<<4),
|
84
|
+
SWIFT_EVENT_WORD = (1<<5),
|
85
|
+
SWIFT_EVENT_BOOKMARK = (1<<6),
|
86
|
+
SWIFT_EVENT_SYLLABLE = (1<<7),
|
87
|
+
SWIFT_EVENT_PHONEME = (1<<8),
|
88
|
+
SWIFT_EVENT_START = (1<<9), /* Synthesis job started. */
|
89
|
+
SWIFT_EVENT_END = (1<<10), /* Synthesis job completed. */
|
90
|
+
SWIFT_EVENT_CANCELLED = (1<<11), /* User cancel request completed. */
|
91
|
+
SWIFT_EVENT_ALL = 0xffffffff,
|
92
|
+
SWIFT_EVENT_NOW = 0xffffffff /* Used for halt/pause. */
|
93
|
+
} swift_event_t;
|
94
|
+
|
95
|
+
/** Policy for retention of voice settings and parameters. */
|
96
|
+
typedef enum swift_voice_retention_policy_t {
|
97
|
+
SWIFT_VOICE_RETAIN_FOREVER = 0,
|
98
|
+
SWIFT_VOICE_RETAIN_PORT_USAGE = (1<<0),
|
99
|
+
SWIFT_VOICE_RETAIN_NONE = (1<<1)
|
100
|
+
} swift_voice_retention_policy_t;
|
101
|
+
|
102
|
+
/** No background job. */
|
103
|
+
#define SWIFT_ASYNC_NONE ((swift_background_t)0)
|
104
|
+
/** Any background job. */
|
105
|
+
#define SWIFT_ASYNC_ANY ((swift_background_t)-1)
|
106
|
+
/** Currently-running background job. */
|
107
|
+
#define SWIFT_ASYNC_CURRENT ((swift_background_t)-3)
|
108
|
+
|
109
|
+
/** Determine if an operation (in parentheses) failed. */
|
110
|
+
#define SWIFT_FAILED(r) ((r) < 0)
|
111
|
+
|
112
|
+
/* String encoding types. */
|
113
|
+
/** UTF-8 Encoding type **/
|
114
|
+
#define SWIFT_UTF8 "utf-8"
|
115
|
+
/** ASCII Encoding type **/
|
116
|
+
#define SWIFT_ASCII "us-ascii"
|
117
|
+
/** UTF-16 Encoding type **/
|
118
|
+
#define SWIFT_UTF16 "utf-16"
|
119
|
+
/** Unicode Encoding type (maps to UTF-16) **/
|
120
|
+
#define SWIFT_UNICODE "utf-16"
|
121
|
+
/** iso8859-1 Latin-1 Encoding type **/
|
122
|
+
#define SWIFT_LATIN_1 "iso8859-1"
|
123
|
+
/** iso8859-1 Encoding type **/
|
124
|
+
#define SWIFT_ISO_8859_1 "iso8859-1"
|
125
|
+
/** iso8859-15 Latin-9 Encoding type **/
|
126
|
+
#define SWIFT_LATIN_9 "iso8859-15"
|
127
|
+
/** iso8859-15 Encoding type **/
|
128
|
+
#define SWIFT_ISO_8859_15 "iso8859-15"
|
129
|
+
/** Default Encoding type - Latin 1 - iso8859-1 **/
|
130
|
+
#define SWIFT_DEFAULT_ENCODING SWIFT_LATIN_1
|
131
|
+
|
132
|
+
#endif /* _SWIFT_DEFS_H_ */
|
@@ -0,0 +1,45 @@
|
|
1
|
+
/* swift_exports.h: special Win32 DLL magic.
|
2
|
+
*
|
3
|
+
* Copyright (c) 2004-2006 Cepstral LLC, all rights reserved.
|
4
|
+
*
|
5
|
+
* Redistribution of this file, in whole or in part, with or without
|
6
|
+
* modification, is not allowed without express written permission of
|
7
|
+
* the copyright holder.
|
8
|
+
*/
|
9
|
+
|
10
|
+
/**
|
11
|
+
* \file swift_exports.h
|
12
|
+
* DLL import/export definitions for Windows platforms.
|
13
|
+
**/
|
14
|
+
|
15
|
+
#ifndef _SWIFT_EXPORTS_H__
|
16
|
+
#define _SWIFT_EXPORTS_H__
|
17
|
+
|
18
|
+
/**
|
19
|
+
* Tells API functions to be exported from swift.dll.
|
20
|
+
* This is ignored on non-Windows platforms.
|
21
|
+
**/
|
22
|
+
#if defined(_WIN32) && !defined(SWIFT_STATIC_LIBS)
|
23
|
+
# if defined SWIFT_EXPORTS
|
24
|
+
# define SWIFT_API __declspec(dllexport)
|
25
|
+
# else
|
26
|
+
# define SWIFT_API __declspec(dllimport)
|
27
|
+
# endif /* SWIFT_EXPORTS */
|
28
|
+
# if defined (_DEBUG)
|
29
|
+
# define DEBUG
|
30
|
+
# endif
|
31
|
+
#else
|
32
|
+
# define SWIFT_API
|
33
|
+
#endif /* WIN32 */
|
34
|
+
|
35
|
+
/**
|
36
|
+
* Declares exposed API functions as __cdecl for the PocketPC 2000 x86Emulator.
|
37
|
+
* It is ignored by all other platforms.
|
38
|
+
**/
|
39
|
+
#if defined (_WIN32_WCE_EMULATION)
|
40
|
+
# define SWIFT_CALLCONV __cdecl
|
41
|
+
#else
|
42
|
+
# define SWIFT_CALLCONV
|
43
|
+
#endif
|
44
|
+
|
45
|
+
#endif /* _SWIFT_EXPORTS_H__ */
|
@@ -0,0 +1,361 @@
|
|
1
|
+
/* -*- c-file-style: "linux" -*- */
|
2
|
+
/* swift_params.h: Parameter and value objects for the Swift TTS engine.
|
3
|
+
*
|
4
|
+
* Copyright (c) 2003-2006 Cepstral LLC. All rights reserved.
|
5
|
+
*
|
6
|
+
* Redistribution of this file, in whole or in part, with or without
|
7
|
+
* modification, is not allowed without express written permission of
|
8
|
+
* the copyright holder.
|
9
|
+
*/
|
10
|
+
|
11
|
+
#ifndef _SWIFT_PARAMS_H_
|
12
|
+
#define _SWIFT_PARAMS_H_
|
13
|
+
|
14
|
+
#include "swift_exports.h"
|
15
|
+
#include "swift_defs.h"
|
16
|
+
|
17
|
+
/**
|
18
|
+
* \file swift_params.h
|
19
|
+
* Parameter and value objects for the Swift TTS engine.
|
20
|
+
**/
|
21
|
+
|
22
|
+
/**
|
23
|
+
* Create a new parameter list.
|
24
|
+
*
|
25
|
+
* @param key The first parameter to set in the list.
|
26
|
+
* @return The newly created swift_params list.
|
27
|
+
*
|
28
|
+
* NOTE: There are optional parameters. You can pass in as many keys as
|
29
|
+
* you'd like.
|
30
|
+
**/
|
31
|
+
SWIFT_API
|
32
|
+
swift_params * SWIFT_CALLCONV swift_params_new(const char *key, ...);
|
33
|
+
|
34
|
+
/**
|
35
|
+
* Claim ownership of the parameter list (increase its reference count).
|
36
|
+
*
|
37
|
+
* @param params The parameters for which to increase the reference count.
|
38
|
+
* @return The reference-counted swift_params that were passed in.
|
39
|
+
*
|
40
|
+
* Note that in all cases where a swift_params* is passed to a function in
|
41
|
+
* swift.h, the Swift library claims ownership of the parameter list.
|
42
|
+
* Therefore, you must call swift_params_ref() on it if you wish to use it
|
43
|
+
* afterwards, and, conversely, you must not call swift_params_delete() on
|
44
|
+
* it unless you have used swift_params_ref() to claim ownership.
|
45
|
+
*
|
46
|
+
* In practical terms, what this means is that you should just call
|
47
|
+
* swift_params_new() in the argument list of these functions, like this:
|
48
|
+
*
|
49
|
+
* p = swift_open_port(swift_params_new(...));
|
50
|
+
*
|
51
|
+
* and not care about what happens to the object created, unless you really
|
52
|
+
* need to know.
|
53
|
+
**/
|
54
|
+
SWIFT_API
|
55
|
+
swift_params * SWIFT_CALLCONV swift_params_ref(swift_params *params);
|
56
|
+
|
57
|
+
/**
|
58
|
+
* Relinquish ownership of a parameter list (decrease its reference count).
|
59
|
+
*
|
60
|
+
* @param params The parameters for which to decrease the reference count.
|
61
|
+
* @return The reference-decreased swift_params that were passed in.
|
62
|
+
*
|
63
|
+
* NOTE: This function decreases the reference count for the swift_params list.
|
64
|
+
* If the reference count reaches zero, the parameters are deleted.
|
65
|
+
**/
|
66
|
+
SWIFT_API
|
67
|
+
swift_result_t SWIFT_CALLCONV swift_params_delete(swift_params *params);
|
68
|
+
|
69
|
+
/**
|
70
|
+
* Dump contents of a parameter list to standard error (for debugging).
|
71
|
+
*
|
72
|
+
* @param params The swift_params list to dump to standard error.
|
73
|
+
* @return SWIFT_SUCCESS, or SWIFT_INVALID_POINTER if params is NULL.
|
74
|
+
**/
|
75
|
+
SWIFT_API
|
76
|
+
swift_result_t SWIFT_CALLCONV swift_params_dump(swift_params *params);
|
77
|
+
|
78
|
+
/**
|
79
|
+
* Set a value for a key.
|
80
|
+
*
|
81
|
+
* @param params The swift_params list in which to find the key to set.
|
82
|
+
* @param name The name of the key to set.
|
83
|
+
* @param val The value to set for the key.
|
84
|
+
* @return The string value of the value set for the key.
|
85
|
+
**/
|
86
|
+
SWIFT_API
|
87
|
+
const char * SWIFT_CALLCONV swift_params_set_val(swift_params *params,
|
88
|
+
const char *name,
|
89
|
+
const swift_val *val);
|
90
|
+
|
91
|
+
/** Set an integer value in a swift_params **/
|
92
|
+
#define swift_params_set_int(p,n,i) \
|
93
|
+
swift_params_set_val(p,n,swift_val_int((int)(i)))
|
94
|
+
/** Set a floating point value in a swift_params **/
|
95
|
+
#define swift_params_set_float(p,n,f) \
|
96
|
+
swift_params_set_val(p,n,swift_val_float((float)(f)))
|
97
|
+
/** Set a string value in a swift_params **/
|
98
|
+
#define swift_params_set_string(p,n,s) \
|
99
|
+
swift_params_set_val(p,n,swift_val_string((const char *)(s)))
|
100
|
+
/** Set a wide-character string value in a swift_params **/
|
101
|
+
#define swift_params_set_string16(p,n,s) \
|
102
|
+
swift_params_set_val(p,n,swift_val_string16((const unsigned short *)(s)))
|
103
|
+
|
104
|
+
/**
|
105
|
+
* User-Defined function that iterates over a parameter list. Pointer to this
|
106
|
+
* function is passed to swift_params_foreach().
|
107
|
+
*
|
108
|
+
* @param params The list of parameters over which to iterate.
|
109
|
+
* @param name The name of the current feature being evaluated.
|
110
|
+
* @param val The value of the current feature being evaluated.
|
111
|
+
* @param udata The user data pointer passed to swift_params_foreach().
|
112
|
+
* @return You should define your function to return SWIFT_SUCCESS
|
113
|
+
* until you no longer want to iterate. Then return a non-
|
114
|
+
* SWIFT_SUCCESS value.
|
115
|
+
**/
|
116
|
+
typedef swift_result_t (*swift_params_iterator)(swift_params *params,
|
117
|
+
const char *name,
|
118
|
+
swift_val *val,
|
119
|
+
void *udata);
|
120
|
+
/**
|
121
|
+
* Iterate over a parameter list.
|
122
|
+
*
|
123
|
+
* This function calls itor for each key/value pair in params,
|
124
|
+
* stopping either when no more parameters remain, or if itor returns
|
125
|
+
* a non-SWIFT_SUCCESS value.
|
126
|
+
*
|
127
|
+
* @param params The list of parameters over which to iterate.
|
128
|
+
* @param itor Pointer to the user-defined function for iterating over
|
129
|
+
* the params.
|
130
|
+
* @param udata User Data - pointer to anything you want to pass to the
|
131
|
+
* iterator function.
|
132
|
+
* @return SWIFT_SUCCESS if all key/value pair is itorated upon
|
133
|
+
* successfully, SWIFT_INVALID_POINTER if params is NULL, or
|
134
|
+
* the return value of itor if it is non-SWIFT_SUCCESS.
|
135
|
+
**/
|
136
|
+
SWIFT_API
|
137
|
+
swift_result_t SWIFT_CALLCONV swift_params_foreach(swift_params *params,
|
138
|
+
swift_params_iterator itor,
|
139
|
+
void *udata);
|
140
|
+
|
141
|
+
/**
|
142
|
+
* Search within a list of params for a key matching the given name.
|
143
|
+
*
|
144
|
+
* @param params The list of params in which to search for the key.
|
145
|
+
* @param name The name of the key for which to search.
|
146
|
+
* @param def Default value to return if the value for which you are
|
147
|
+
* searching is not found.
|
148
|
+
* @return The swift_val matching the name, if found. If not found,
|
149
|
+
* the default value is returned.
|
150
|
+
**/
|
151
|
+
SWIFT_API
|
152
|
+
const swift_val * SWIFT_CALLCONV
|
153
|
+
swift_params_get_val(const swift_params *params,
|
154
|
+
const char *name,
|
155
|
+
const swift_val *def);
|
156
|
+
/**
|
157
|
+
* Search within a list of params for a key matching the given name.
|
158
|
+
*
|
159
|
+
* @param params The list of params in which to search for the key.
|
160
|
+
* @param name The name of the key for which to search.
|
161
|
+
* @param def The default string to return if the value for which you are
|
162
|
+
* searching is not found.
|
163
|
+
* @return The string value of the swift_val matching the given name,
|
164
|
+
* if found. If not found, the default string is returned.
|
165
|
+
*
|
166
|
+
* NOTE: The value is returned as an 8-bit string (which is UTF-8 encoded if
|
167
|
+
* you created it with swift_val_string16, otherwise the encoding is
|
168
|
+
* unspecified).
|
169
|
+
**/
|
170
|
+
SWIFT_API
|
171
|
+
const char * SWIFT_CALLCONV swift_params_get_string(const swift_params *params,
|
172
|
+
const char *name,
|
173
|
+
const char *def);
|
174
|
+
|
175
|
+
/**
|
176
|
+
* Search within a list of params for a key matching the given name.
|
177
|
+
*
|
178
|
+
* @param params The list of params in which to search for the key.
|
179
|
+
* @param name The name of the key for which to search.
|
180
|
+
* @param def The default integer value to return if the value for which
|
181
|
+
* you are searching is not found.
|
182
|
+
* @return The integer value of the swift_val matching the name given,
|
183
|
+
* if found. If not found, the default integer is returned.
|
184
|
+
**/
|
185
|
+
SWIFT_API
|
186
|
+
int SWIFT_CALLCONV swift_params_get_int(const swift_params *params,
|
187
|
+
const char *name,
|
188
|
+
int def);
|
189
|
+
|
190
|
+
/**
|
191
|
+
* Search within a list of params for a key matching the given name.
|
192
|
+
*
|
193
|
+
* @param params The list of params in which to search for the key.
|
194
|
+
* @param name The name of the key for which to search.
|
195
|
+
* @param def The default floating-point value to return if the value for
|
196
|
+
* which you are searching is not found.
|
197
|
+
* @return The floating-point value of the swift_val matching the name
|
198
|
+
* given, if found. If not found, the default floating-point
|
199
|
+
* value is returned.
|
200
|
+
**/
|
201
|
+
SWIFT_API
|
202
|
+
float SWIFT_CALLCONV swift_params_get_float(const swift_params *params,
|
203
|
+
const char *name,
|
204
|
+
float def);
|
205
|
+
|
206
|
+
/** Types of parameters that can be set in the engine, port, or voice. */
|
207
|
+
typedef enum {
|
208
|
+
SWIFT_PARAM_NONE = -1, /**< Invalid parameter. */
|
209
|
+
SWIFT_PARAM_FLAG, /**< True or false (1/0). */
|
210
|
+
SWIFT_PARAM_INT, /**< Integer value. */
|
211
|
+
SWIFT_PARAM_FLOAT, /**< Floating point value. */
|
212
|
+
SWIFT_PARAM_STRING, /**< String value. */
|
213
|
+
SWIFT_PARAM_ENUM /**< Enumerated value. */
|
214
|
+
} swift_param_type_t;
|
215
|
+
|
216
|
+
/** Descriptor for an engine/port/voice parameter. */
|
217
|
+
typedef struct swift_param_desc {
|
218
|
+
const char *name; /**< Name of parameter (passed to set function). */
|
219
|
+
const char *help; /**< Textual description of parameter. */
|
220
|
+
swift_param_type_t type; /**< Type of data accepted. */
|
221
|
+
int undocumented; /**< Undocumented. */
|
222
|
+
const char **enum_vals; /**< Enumeration values. */
|
223
|
+
void *reserved[3]; /**< Reserved for future use. */
|
224
|
+
} swift_param_desc;
|
225
|
+
|
226
|
+
/** List of descriptors for valid parameters. */
|
227
|
+
SWIFT_API
|
228
|
+
extern const swift_param_desc swift_param_descriptors[];
|
229
|
+
|
230
|
+
/**
|
231
|
+
* Validate a key/value pair based on swift_param_descriptors.
|
232
|
+
*
|
233
|
+
* @param name The name of the key to validate.
|
234
|
+
* @param val The value to validate against the descriptors.
|
235
|
+
* @return TRUE if the key/value pair is valid. FALSE if not.
|
236
|
+
**/
|
237
|
+
int swift_param_validate(const char *name,
|
238
|
+
const swift_val *val);
|
239
|
+
|
240
|
+
/**
|
241
|
+
* Copy and validate parameters from one swift_params list to another.
|
242
|
+
*
|
243
|
+
* @param to The list of swift_parms to which to copy.
|
244
|
+
* @param from The list of swift_params from which to copy.
|
245
|
+
* @return SWIFT_SUCCESS if all parameters are copied successfully,<br>
|
246
|
+
* SWIFT_INVALID_PARAM if any of the parameters don't validate.
|
247
|
+
**/
|
248
|
+
SWIFT_API
|
249
|
+
swift_result_t SWIFT_CALLCONV
|
250
|
+
swift_params_set_params(swift_params *to,
|
251
|
+
const swift_params *from);
|
252
|
+
|
253
|
+
/**
|
254
|
+
* Set one parameter in a parameter list, with validation.
|
255
|
+
*
|
256
|
+
* @param to The list of params in which to set the parameter.
|
257
|
+
* @param name The name of the parameter to set within the list of params.
|
258
|
+
* @param val The value of the parameter to set within the list of params.
|
259
|
+
* @return SWIFT_SUCCESS if the parameter is copied successfully,<br>
|
260
|
+
* SWIFT_INVALID_PARAM if the parameter does not validate.
|
261
|
+
**/
|
262
|
+
SWIFT_API
|
263
|
+
swift_result_t SWIFT_CALLCONV swift_params_set_param(swift_params *to,
|
264
|
+
const char *name,
|
265
|
+
const swift_val *val);
|
266
|
+
|
267
|
+
/**
|
268
|
+
* Create an integer-typed swift_val object.
|
269
|
+
*
|
270
|
+
* @param i The integer value to set within the swift_val.
|
271
|
+
* @return The newly-created integer-typed swift_val object.
|
272
|
+
**/
|
273
|
+
SWIFT_API
|
274
|
+
swift_val * SWIFT_CALLCONV swift_val_int(int i);
|
275
|
+
|
276
|
+
/**
|
277
|
+
* Create a floating-point-typed swift_val object.
|
278
|
+
*
|
279
|
+
* @param f The floating-point value to set within the swift_val.
|
280
|
+
* @return The newly-created floating-point-typed swift_val object.
|
281
|
+
**/
|
282
|
+
SWIFT_API
|
283
|
+
swift_val * SWIFT_CALLCONV swift_val_float(float f);
|
284
|
+
|
285
|
+
/**
|
286
|
+
* Create a character string-typed swift_val object.
|
287
|
+
*
|
288
|
+
* @param s The character string value to set within the swift_val.
|
289
|
+
* @return The newly-created character string-typed swift_val object.
|
290
|
+
**/
|
291
|
+
SWIFT_API
|
292
|
+
swift_val * SWIFT_CALLCONV swift_val_string(const char *s);
|
293
|
+
|
294
|
+
/**
|
295
|
+
* Create a UTF-16-encoded character string-typed swift_val object.
|
296
|
+
*
|
297
|
+
* @param s The UTF-16-encoded character string value to set within the
|
298
|
+
* swift_val.
|
299
|
+
* @return The newly-created UTF-16-encoded character string-typed swift_val
|
300
|
+
* object.
|
301
|
+
**/
|
302
|
+
SWIFT_API
|
303
|
+
swift_val * SWIFT_CALLCONV swift_val_string16(const unsigned short *s);
|
304
|
+
|
305
|
+
/**
|
306
|
+
* Claim ownership of the parameter list (increase its reference count).
|
307
|
+
*
|
308
|
+
* @param val The swift_val for which to increase the reference count.
|
309
|
+
* @return The reference-counted swift_val that was passed in.
|
310
|
+
**/
|
311
|
+
SWIFT_API
|
312
|
+
swift_val * SWIFT_CALLCONV swift_val_ref(swift_val *val);
|
313
|
+
|
314
|
+
/**
|
315
|
+
* Relinquish ownership of a swift_val object (decrease its reference count).
|
316
|
+
*
|
317
|
+
* @param val The swift_val for which to decrease the reference count.
|
318
|
+
* @return The reference-decreased swift_val that was passed in.
|
319
|
+
*
|
320
|
+
* NOTE: This function decreases the reference count for the swift_val.
|
321
|
+
* If the reference count reaches zero, the swift_val is deleted.
|
322
|
+
**/
|
323
|
+
SWIFT_API
|
324
|
+
swift_result_t SWIFT_CALLCONV swift_val_delete(swift_val *val);
|
325
|
+
|
326
|
+
/**
|
327
|
+
* Get the integer contents of a swift_val object.
|
328
|
+
*
|
329
|
+
* @param val The swift_val object from which to get the integer value
|
330
|
+
* @return The integer value of of the swift_val object
|
331
|
+
**/
|
332
|
+
SWIFT_API
|
333
|
+
int SWIFT_CALLCONV swift_val_get_int(const swift_val *val);
|
334
|
+
|
335
|
+
/**
|
336
|
+
* Get the floating-point contents of a swift_val object.
|
337
|
+
*
|
338
|
+
* @param val The swift_val object from which to get the floating-point value.
|
339
|
+
* @return The floating-point value of of the swift_val object
|
340
|
+
**/
|
341
|
+
SWIFT_API
|
342
|
+
float SWIFT_CALLCONV swift_val_get_float(const swift_val *val);
|
343
|
+
|
344
|
+
/**
|
345
|
+
* Get the string contents of a swift_val object.
|
346
|
+
*
|
347
|
+
* @param val The swift_val object from which to get the string value.
|
348
|
+
*
|
349
|
+
* Note that the swift_val object retains ownership of the string.
|
350
|
+
*
|
351
|
+
* If val is an integer or floating-point swift_val, it will be
|
352
|
+
* silently "promoted" to a string.
|
353
|
+
*
|
354
|
+
* The contents are returned as an 8-bit string (which is UTF-8
|
355
|
+
* encoded if you created it with swift_val_string16, otherwise the
|
356
|
+
* encoding is unspecified).
|
357
|
+
**/
|
358
|
+
SWIFT_API
|
359
|
+
const char * SWIFT_CALLCONV swift_val_get_string(const swift_val *val);
|
360
|
+
|
361
|
+
#endif /* _SWIFT_PARAMS_H_ */
|