Lisp HUG Maillist Archive

Error with prompt-for-file inside of CAPI menu callback

I have the following code which is meant to display a file save dialog from a menu item on macOS:

(defun load-key (&optional (file (capi::prompt-for-file "Select the Key File to load."
:pathname *keys-folder*
:filter "*.ptekey")))
  (when file
    (setf *key* (with-open-file (s file)
 (read s)))))

(let ((text "Keys")
      (load-key-text "Load Key...")
      (generate-new-key-text "Generate New Key...")
      (save-key-text "Save Key..."))

  (defun keys-menu-callback (data interface)
    (cond
      ((string= data load-key-text) (load-key))))
  
  (defparameter *keys-menu* (make-instance 'capi:menu
:title text
:items (list load-key-text)
:callback 'keys-menu-callback)))

When I invoke the menu item, I get the following error in the console:

Error in generating the FLI template NIL FLI::DEFINE-PRECOMPILED-FOREIGN-OBJECT-TESTER-FUNCTIONS OBJC:OBJC-AT-QUESTION-MARK NIL

Error: An error of type FLI::MISSING-FORIEGN-TEMPLATE-CONDITION occured, arguments : (:TEMPLATE (FLI::DEFINE-PRECOMPILED-FOREIGN-OBJECT-TESTER-FUNCTIONS (#)))
  1 (abort) Return to Cocoa Event Loop

Type :b for backtrace or :c <option number> to proceed.
Type :bug-form "<subject>" for a bug report template or :? for other options.

CL-USER 1 : 1 >

I’m stumped.  Prompt-for-file has worked for me before and the only thing I can think of is that I’m calling it inside of a menu callback which might be causing the problem.  Any ideas?

—
Burton Samograd
BusFactor1@gmail.com
http://BusFactor1.ca

Re: Error with prompt-for-file inside of CAPI menu callback

That sounds like an error I had that was fixed by the latest patch. If you haven’t installed it, give it a try.

LW

On Mar 19, 2017, at 4:47 PM, Burton Samograd <busfactor1@gmail.com> wrote:

I have the following code which is meant to display a file save dialog from a menu item on macOS:

(defun load-key (&optional (file (capi::prompt-for-file "Select the Key File to load."
:pathname *keys-folder*
:filter "*.ptekey")))
  (when file
    (setf *key* (with-open-file (s file)
 (read s)))))

(let ((text "Keys")
      (load-key-text "Load Key...")
      (generate-new-key-text "Generate New Key...")
      (save-key-text "Save Key..."))

  (defun keys-menu-callback (data interface)
    (cond
      ((string= data load-key-text) (load-key))))
  
  (defparameter *keys-menu* (make-instance 'capi:menu
:title text
:items (list load-key-text)
:callback 'keys-menu-callback)))

When I invoke the menu item, I get the following error in the console:

Error in generating the FLI template NIL FLI::DEFINE-PRECOMPILED-FOREIGN-OBJECT-TESTER-FUNCTIONS OBJC:OBJC-AT-QUESTION-MARK NIL

Error: An error of type FLI::MISSING-FORIEGN-TEMPLATE-CONDITION occured, arguments : (:TEMPLATE (FLI::DEFINE-PRECOMPILED-FOREIGN-OBJECT-TESTER-FUNCTIONS (#)))
  1 (abort) Return to Cocoa Event Loop

Type :b for backtrace or :c <option number> to proceed.
Type :bug-form "<subject>" for a bug report template or :? for other options.

CL-USER 1 : 1 >

I’m stumped.  Prompt-for-file has worked for me before and the only thing I can think of is that I’m calling it inside of a menu callback which might be causing the problem.  Any ideas?

—
Burton Samograd
BusFactor1@gmail.com
http://BusFactor1.ca

Re: Error with prompt-for-file inside of CAPI menu callback

AFAIK I have all of the current patches installed as listed on this page: http://www.lispworks.com/downloads/patch-selection.html.

Burton

On Mar 19, 2017, at 5:00 PM, Laughing Water <lw@mt.net> wrote:

That sounds like an error I had that was fixed by the latest patch. If you haven’t installed it, give it a try.

LW

On Mar 19, 2017, at 4:47 PM, Burton Samograd <busfactor1@gmail.com> wrote:

I have the following code which is meant to display a file save dialog from a menu item on macOS:

(defun load-key (&optional (file (capi::prompt-for-file "Select the Key File to load."
:pathname *keys-folder*
:filter "*.ptekey")))
  (when file
    (setf *key* (with-open-file (s file)
 (read s)))))

(let ((text "Keys")
      (load-key-text "Load Key...")
      (generate-new-key-text "Generate New Key...")
      (save-key-text "Save Key..."))

  (defun keys-menu-callback (data interface)
    (cond
      ((string= data load-key-text) (load-key))))
  
  (defparameter *keys-menu* (make-instance 'capi:menu
:title text
:items (list load-key-text)
:callback 'keys-menu-callback)))

When I invoke the menu item, I get the following error in the console:

Error in generating the FLI template NIL FLI::DEFINE-PRECOMPILED-FOREIGN-OBJECT-TESTER-FUNCTIONS OBJC:OBJC-AT-QUESTION-MARK NIL

Error: An error of type FLI::MISSING-FORIEGN-TEMPLATE-CONDITION occured, arguments : (:TEMPLATE (FLI::DEFINE-PRECOMPILED-FOREIGN-OBJECT-TESTER-FUNCTIONS (#)))
  1 (abort) Return to Cocoa Event Loop

Type :b for backtrace or :c <option number> to proceed.
Type :bug-form "<subject>" for a bug report template or :? for other options.

CL-USER 1 : 1 >

I’m stumped.  Prompt-for-file has worked for me before and the only thing I can think of is that I’m calling it inside of a menu callback which might be causing the problem.  Any ideas?

—
Burton Samograd
BusFactor1@gmail.com
http://BusFactor1.ca


Re: Error with prompt-for-file inside of CAPI menu callback

Turns out my delivery level was set to 1 rather than 0, which was causing the missing templates error.  It’s working now.

Burton

On Mar 19, 2017, at 4:47 PM, Burton Samograd <busfactor1@gmail.com> wrote:

I have the following code which is meant to display a file save dialog from a menu item on macOS:

(defun load-key (&optional (file (capi::prompt-for-file "Select the Key File to load."
:pathname *keys-folder*
:filter "*.ptekey")))
  (when file
    (setf *key* (with-open-file (s file)
 (read s)))))

(let ((text "Keys")
      (load-key-text "Load Key...")
      (generate-new-key-text "Generate New Key...")
      (save-key-text "Save Key..."))

  (defun keys-menu-callback (data interface)
    (cond
      ((string= data load-key-text) (load-key))))
  
  (defparameter *keys-menu* (make-instance 'capi:menu
:title text
:items (list load-key-text)
:callback 'keys-menu-callback)))

When I invoke the menu item, I get the following error in the console:

Error in generating the FLI template NIL FLI::DEFINE-PRECOMPILED-FOREIGN-OBJECT-TESTER-FUNCTIONS OBJC:OBJC-AT-QUESTION-MARK NIL

Error: An error of type FLI::MISSING-FORIEGN-TEMPLATE-CONDITION occured, arguments : (:TEMPLATE (FLI::DEFINE-PRECOMPILED-FOREIGN-OBJECT-TESTER-FUNCTIONS (#)))
  1 (abort) Return to Cocoa Event Loop

Type :b for backtrace or :c <option number> to proceed.
Type :bug-form "<subject>" for a bug report template or :? for other options.

CL-USER 1 : 1 >

I’m stumped.  Prompt-for-file has worked for me before and the only thing I can think of is that I’m calling it inside of a menu callback which might be causing the problem.  Any ideas?

—
Burton Samograd
BusFactor1@gmail.com
http://BusFactor1.ca

Re: Error with prompt-for-file inside of CAPI menu callback

Hi Burton,

Okay, but you probably want to track down that information about missing templates anyway. Delivering at level 0 produces a humongous delivery blob, and might not be suitable for production use.

Cheers,

- DM

On Mar 19, 2017, at 16:09, Burton Samograd <busfactor1@gmail.com> wrote:

Turns out my delivery level was set to 1 rather than 0, which was causing the missing templates error.  It’s working now.

Burton

On Mar 19, 2017, at 4:47 PM, Burton Samograd <busfactor1@gmail.com> wrote:

I have the following code which is meant to display a file save dialog from a menu item on macOS:

(defun load-key (&optional (file (capi::prompt-for-file "Select the Key File to load."
:pathname *keys-folder*
:filter "*.ptekey")))
  (when file
    (setf *key* (with-open-file (s file)
 (read s)))))

(let ((text "Keys")
      (load-key-text "Load Key...")
      (generate-new-key-text "Generate New Key...")
      (save-key-text "Save Key..."))

  (defun keys-menu-callback (data interface)
    (cond
      ((string= data load-key-text) (load-key))))
  
  (defparameter *keys-menu* (make-instance 'capi:menu
:title text
:items (list load-key-text)
:callback 'keys-menu-callback)))

When I invoke the menu item, I get the following error in the console:

Error in generating the FLI template NIL FLI::DEFINE-PRECOMPILED-FOREIGN-OBJECT-TESTER-FUNCTIONS OBJC:OBJC-AT-QUESTION-MARK NIL

Error: An error of type FLI::MISSING-FORIEGN-TEMPLATE-CONDITION occured, arguments : (:TEMPLATE (FLI::DEFINE-PRECOMPILED-FOREIGN-OBJECT-TESTER-FUNCTIONS (#)))
  1 (abort) Return to Cocoa Event Loop

Type :b for backtrace or :c <option number> to proceed.
Type :bug-form "<subject>" for a bug report template or :? for other options.

CL-USER 1 : 1 >

I’m stumped.  Prompt-for-file has worked for me before and the only thing I can think of is that I’m calling it inside of a menu callback which might be causing the problem.  Any ideas?

—
Burton Samograd
BusFactor1@gmail.com
http://BusFactor1.ca


Updated at: 2020-12-10 08:31 UTC