• Home
  • Raw
  • Download

Lines Matching full:input

2  * \file input.c
3 * \brief Generic stdio-like input interface
7 * Generic stdio-like input interface
10 * Input object
39 int (*close)(snd_input_t *input);
40 int (*scan)(snd_input_t *input, const char *format, va_list args);
41 char *(*(gets))(snd_input_t *input, char *str, size_t size);
42 int (*getch)(snd_input_t *input);
43 int (*ungetch)(snd_input_t *input, int c);
54 * \brief Closes an input handle.
55 * \param input The input handle to be closed.
58 int snd_input_close(snd_input_t *input) in snd_input_close() argument
60 int err = input->ops->close(input); in snd_input_close()
61 free(input); in snd_input_close()
66 * \brief Reads formatted input (like \c fscanf(3)) from an input handle.
67 * \param input The input handle.
70 * \return The number of input items assigned, or \c EOF.
74 int snd_input_scanf(snd_input_t *input, const char *format, ...) in snd_input_scanf() argument
79 result = input->ops->scan(input, format, args); in snd_input_scanf()
85 * \brief Reads a line from an input handle (like \c fgets(3)).
86 * \param input The input handle.
94 char *snd_input_gets(snd_input_t *input, char *str, size_t size) in snd_input_gets() argument
96 return (input->ops->gets)(input, str, size); in snd_input_gets()
100 * \brief Reads a character from an input handle (like \c fgetc(3)).
101 * \param input The input handle.
104 int snd_input_getc(snd_input_t *input) in snd_input_getc() argument
106 return input->ops->getch(input); in snd_input_getc()
110 * \brief Puts the last character read back to an input handle (like \c ungetc(3)).
111 * \param input The input handle.
115 int snd_input_ungetc(snd_input_t *input, int c) in snd_input_ungetc() argument
117 return input->ops->ungetch(input, c); in snd_input_ungetc()
126 static int snd_input_stdio_close(snd_input_t *input ATTRIBUTE_UNUSED) in snd_input_stdio_close()
128 snd_input_stdio_t *stdio = input->private_data; in snd_input_stdio_close()
135 static int snd_input_stdio_scan(snd_input_t *input, const char *format, va_list args) in snd_input_stdio_scan() argument
137 snd_input_stdio_t *stdio = input->private_data; in snd_input_stdio_scan()
142 static char *snd_input_stdio_gets(snd_input_t *input, char *str, size_t size) in snd_input_stdio_gets() argument
144 snd_input_stdio_t *stdio = input->private_data; in snd_input_stdio_gets()
148 static int snd_input_stdio_getc(snd_input_t *input) in snd_input_stdio_getc() argument
150 snd_input_stdio_t *stdio = input->private_data; in snd_input_stdio_getc()
154 static int snd_input_stdio_ungetc(snd_input_t *input, int c) in snd_input_stdio_ungetc() argument
156 snd_input_stdio_t *stdio = input->private_data; in snd_input_stdio_ungetc()
170 * \brief Creates a new input object using an existing stdio \c FILE pointer.
171 * \param inputp The function puts the pointer to the new input object
181 snd_input_t *input; in snd_input_stdio_attach() local
187 input = calloc(1, sizeof(*input)); in snd_input_stdio_attach()
188 if (!input) { in snd_input_stdio_attach()
194 input->type = SND_INPUT_STDIO; in snd_input_stdio_attach()
195 input->ops = &snd_input_stdio_ops; in snd_input_stdio_attach()
196 input->private_data = stdio; in snd_input_stdio_attach()
197 *inputp = input; in snd_input_stdio_attach()
202 * \brief Creates a new input object reading from a file.
203 * \param inputp The functions puts the pointer to the new input object
231 static int snd_input_buffer_close(snd_input_t *input) in snd_input_buffer_close() argument
233 snd_input_buffer_t *buffer = input->private_data; in snd_input_buffer_close()
239 static int snd_input_buffer_scan(snd_input_t *input, const char *format, va_list args) in snd_input_buffer_scan() argument
241 snd_input_buffer_t *buffer = input->private_data; in snd_input_buffer_scan()
248 static char *snd_input_buffer_gets(snd_input_t *input, char *str, size_t size) in snd_input_buffer_gets() argument
250 snd_input_buffer_t *buffer = input->private_data; in snd_input_buffer_gets()
266 static int snd_input_buffer_getc(snd_input_t *input) in snd_input_buffer_getc() argument
268 snd_input_buffer_t *buffer = input->private_data; in snd_input_buffer_getc()
275 static int snd_input_buffer_ungetc(snd_input_t *input, int c) in snd_input_buffer_ungetc() argument
277 snd_input_buffer_t *buffer = input->private_data; in snd_input_buffer_ungetc()
296 * \brief Creates a new input object from a memory buffer.
297 * \param inputp The function puts the pointer to the new input object
299 * \param buf Address of the input buffer.
300 * \param size Size of the input buffer.
303 * This functions creates a copy of the input buffer, so the application is
308 snd_input_t *input; in snd_input_buffer_open() local
314 input = calloc(1, sizeof(*input)); in snd_input_buffer_open()
315 if (!input) { in snd_input_buffer_open()
323 free(input); in snd_input_buffer_open()
331 input->type = SND_INPUT_BUFFER; in snd_input_buffer_open()
332 input->ops = &snd_input_buffer_ops; in snd_input_buffer_open()
333 input->private_data = buffer; in snd_input_buffer_open()
334 *inputp = input; in snd_input_buffer_open()