Author Topic: List of lisp functions which are defined as external subroutine & Lisp exception  (Read 1934 times)

0 Members and 1 Guest are viewing this topic.

ProfWolfMan

  • Guest
Hi all,

In one of my project, i am using gile's 'LispExtensions' class found in below thread.

http://www.theswamp.org/index.php?topic=35714

It is working very fine for my needs.

Now, i am working around below tasks.

1) /***The LISP function must be defined as an external subroutine using the c: prefix or invoking vl-acad-defun.***/

I want to get list of  'lisp functions which are defined as external subroutine'?
Is there is any functions to do that?

2) Is there is anyway to throw a exception from Lisp functions to dotnet when i invoking that lisp function from dotnet.

Kindly share your thoughts.

Thanks & Regards,
Ganesan M

TheMaster

  • Guest

2) Is there is anyway to throw a exception from Lisp functions to dotnet when i invoking that lisp function from dotnet.


You can't throw exceptions from LISP that can be caught by calling
.NET code.

If you use acedInvoke(), you will get an error result code if a call
to a LISP function resulted in an error, and that doesn't tell you
much about what exactly happened.

You could try calling vl-exit-with-error to raise an error from a
called LISP function (never tried that), and see what acedInvoke()
returns.

You could also define a LISP wrapper function that your .NET code
calls via acedInvoke(), which passes the actual LISP function that
you want to call as a string, and then have it catch any error that
gets thrown and conveys it back to the calling .NET code.

Code: [Select]

   ;; (untested)

   (defun invoke-wrapper( func arglist / result )
        (setq *invoke-error* nil)
        (setq result (vl-catch-all-apply (read func) arglist))
        (if (vl-catch-all-error-p result)
            (progn
                (setq *invoke-error* (vl-catch-all-error-message result))
                (vl-exit-with-error *invoke-error*)
            )
            result
        )
    )


ProfWolfMan

  • Guest
Hi,

Thanks for your valuable reply. :-)
It seems better for nothing.

I will post my result soon.

Thanks & regards,
Ganesan M