×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

LISP

LISP

(OP)
Hi there,

is it possible that when i'm executing a lisp program and i'm aborting it in the middle of the run with "Escape" that when that happens a few codelines will be executed.

Yes? Tell me how to write tis down please.

regards,
HMO

RE: LISP

If error handling in the lisp is faulty or non-existing you will get an error message and a bunch of undiscernable code.

   <Yes? Tell me how to write tis down please>

I'm not understanding this question.  Could uou please rephrase it?

RE: LISP

I think you are asking for a clean way to exit a LISP routine by pressing ESC and you don't want to see the normal garbage.  There is a way.  The following statements go inside your LISP routine:

1) Save the existing error function with this statement:
(setq olderr *error*)

2) Define a new function to intercept the ESC or other errors with something like this:

(DEFUN NewErr(s) ; Error handler
 (SetVar "OSMODE" om)
 (SetVar "CMDECHO" 0)
 (setq *error* olderr)
 (setq ans "An Error has ocurred")
 (prompt ans)
 (princ)
)

3) After the DEFUN in (2) above include the following:
(setq *error* NewErr)

3) At the end of your LISP routine, to make sure the error functin is restored to it's previous setting, add:
(setq *error* olderr)

This will hopefully get you started.

RE: LISP

(OP)
Look, i've got a lisp-function which sets at the begining a few variabels (osmode, ..) (and also saves the original values). At the end of the lisp-function this variables will be set back to the original values whiwh are saved at the beginning of the function.
However when i'm in the middle of the function and i want to abort it with "escape" the variables will not be set back to their original values saved in the beginning of the function.
Is it possibles to program the function so that when i'm aborting the function in the middle of the program that the original values of the variables saved in the beginning of that function will be set back to theirsoriginal values?

I'm just aasking of this is possibles and if the answer is yes how to do this?

RE: LISP

Look yourself at my earlier reply perhaps a little closer this time.  The key is to make a new error handler function within your LISP program.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources