TheSwamp

Code Red => .NET => Topic started by: ProfWolfMan on June 11, 2012, 04:20:51 AM

Title: List of lisp functions which are defined as external subroutine & Lisp exception
Post by: ProfWolfMan on June 11, 2012, 04:20:51 AM
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 (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
Title: Re: List of lisp functions which are defined as external subroutine & Lisp exception
Post by: TheMaster on June 12, 2012, 06:47:33 AM

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
        )
    )

Title: Re: List of lisp functions which are defined as external subroutine & Lisp exception
Post by: ProfWolfMan on June 13, 2012, 10:02:25 PM
Hi,

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

I will post my result soon.

Thanks & regards,
Ganesan M