File: wisdom.lisp

package info (click to toggle)
cl-fftw3 1.0-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 100 kB
  • sloc: lisp: 903; makefile: 38; ansic: 6
file content (35 lines) | stat: -rw-r--r-- 1,349 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
;;;; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10 -*-
;;;; *************************************************************************
;;;; FILE IDENTIFICATION
;;;;
;;;; Name:          wisdowm.lisp
;;;; Purpose:       Functions for handling FFTW wisdom
;;;; Programmer:    Kevin M. Rosenberg
;;;; Date Started:  March 2009
;;;;
;;;; $Id$
;;;;
;;;; This file, part of FFTW3, is Copyright (c) 2009 by Kevin M. Rosenberg
;;;;
;;;; FFTW3 users are granted the rights to distribute and use this software
;;;; as governed by the terms of the Lisp Lesser GNU Public License
;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
;;;; *************************************************************************

(in-package #:fftw3)

(defun import-user-wisdom ()
  (let ((file-contents (kmrcl:read-file-to-string *user-wisdom-file*)))
    (when (and (stringp file-contents) (plusp (length file-contents)))
      (fftw-import-wisdom-from-string file-contents))))

(defun export-user-wisdom ()
  (let ((str+ptr (fftw-export-wisdom-to-string)))
    (when (probe-file *user-wisdom-file*)
      (delete-file *user-wisdom-file*))
    (with-open-file (out *user-wisdom-file* :direction :output :if-exists :overwrite
                         :if-does-not-exist :create)
      (format out "~A" (first str+ptr)))
    (free (second str+ptr))))