anchor.diff:  ;;;; -*- coding: utf-8; indent-tabs-mode: nil -*-
   
   (defpackage #:perfpiece
  -    (:use #:cl #:cffi)
  +  (:use #:cl #:cffi)
     (:import-from #:alexandria
                   #:make-keyword #:switch #:when-let #:with-unique-names
                   #:symbolicate #:mean #:standard-deviation #:once-only))
  +
   (in-package #:perfpiece)
   
   ;;;; Errors
  
positive.code: 
  ;;;; Initialization
  
  (defconstant +papi-not-inited+ 0)
  
  (defcfun "PAPI_is_initialized" :int)
  
negative.code:   (event-code (:pointer :uint))
    (modifier :int))
  
  (defconstant +papi-enum-event+ 0)
  (defconstant +papi-enum-first+ 1)
  (defconstant +papi-preset-enum-avail+ 2)
  
  (defun papi-events-to-hash-table ()
    (initialize-papi-if-necessary)
    (with-foreign-objects ((info 'event-info)
                           (code :uint))
      (let ((hash-table (make-hash-table)))
        (flet ((push-events (mask enumerator)
                 (setf (mem-ref code :uint) mask)
                 (papi-enum-event code +papi-enum-first+)
                 (loop for event = (papi-code-to-event (mem-ref code :uint) info)
                       do (setf (gethash (event-name event) hash-table) event)
                       while (ignore-errors
                               ;; Sometimes PAPI-ENUM-EVENT signals
                               ;; PAPI-EBUG, not sure why...
                               (zerop (papi-enum-event code enumerator))))))
          (push-events +papi-preset-mask+ +papi-preset-enum-avail+)
          (push-events +papi-native-mask+ +papi-enum-event+))
        hash-table)))
  
  (defvar *events* (papi-events-to-hash-table))
  
  (defmacro define-event (name description)
    `(setf (gethash ,name *events*)
  