Node:Wisdom Import, Next:, Previous:Wisdom Export, Up:Wisdom

4.6.2 Wisdom Import

int fftw_import_system_wisdom(void);
int fftw_import_wisdom_from_file(FILE *input_file);
int fftw_import_wisdom_from_string(const char *input_string);
int fftw_import_wisdom(int (*read_char)(void *), void *data);

These functions import wisdom into a program from data stored by the fftw_export_wisdom functions above. (See Words of Wisdom-Saving Plans.) The imported wisdom replaces any wisdom already accumulated by the running program.

fftw_import_wisdom imports wisdom from any input medium, as specified by the callback function read_char. read_char is a getc-like function that returns the next character in the input; its parameter is the data pointer passed to fftw_import_wisdom. If the end of the input data is reached (which should never happen for valid data), read_char should return EOF (as defined in <stdio.h>). For convenience, the following two "wrapper" routines are provided:

fftw_import_wisdom_from_file reads wisdom from the current position in input_file, which should be open with read permission. Upon exit, the file remains open, but the position of the read pointer is unspecified.

fftw_import_wisdom_from_string reads wisdom from the NULL-terminated string input_string.

fftw_import_system_wisdom reads wisdom from an implementation-defined standard file (/etc/fftw/wisdom on Unix and GNU systems).

The return value of these import routines is 1 if the wisdom was read successfully and 0 otherwise. Note that, in all of these functions, any data in the input stream past the end of the wisdom data is simply ignored.