update upload time
[cl-fftw3.git] / wisdom.lisp
1 ;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
4 ;;;;
5 ;;;; Name:          wisdowm.lisp
6 ;;;; Purpose:       Functions for handling FFTW wisdom
7 ;;;; Programmer:    Kevin M. Rosenberg
8 ;;;; Date Started:  March 2009
9 ;;;;
10 ;;;; $Id$
11 ;;;;
12 ;;;; This file, part of FFTW3, is Copyright (c) 2009 by Kevin M. Rosenberg
13 ;;;;
14 ;;;; FFTW3 users are granted the rights to distribute and use this software
15 ;;;; as governed by the terms of the Lisp Lesser GNU Public License
16 ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
17 ;;;; *************************************************************************
18
19 (in-package #:fftw3)
20
21 (defun import-user-wisdom ()
22   (let ((file-contents (kmrcl:read-file-to-string *user-wisdom-file*)))
23     (when (and (stringp file-contents) (plusp (length file-contents)))
24       (fftw-import-wisdom-from-string file-contents))))
25
26 (defun export-user-wisdom ()
27   (let ((str+ptr (fftw-export-wisdom-to-string)))
28     (when (probe-file *user-wisdom-file*)
29       (delete-file *user-wisdom-file*))
30     (with-open-file (out *user-wisdom-file* :direction :output :if-exists :overwrite
31                          :if-does-not-exist :create)
32       (format out "~A" (first str+ptr)))
33     (free (second str+ptr))))
34
35