Jump to content

Malfunctions if I load many lisp


X11start

Recommended Posts

Why if I load and launch one of my lisp, then I load another ... the previous one has malfunctions? Ex. Asks me questions that are part of the 2nd lisp loaded? I thought that it was the fact that I use the same variables and that these were not "closed" inside the lisp (or placed at "nil" before exit). But then I found that this happens even when my lisp is "well done"!
I have never asked myself the problem and I have always solved it by loading immediately before using the lisp that interests me 🙂

Link to comment
Share on other sites

One may be setting a system or environmental variable that affects how the other works. Hard to tell without seeing both codes.

It's best to use error handling to make sure your routines reset any changes even when you use Esc to get out of them.

Do either of them use USER* system variables, global variables or reactors?

Link to comment
Share on other sites

You probably have an open paren or missing close in one of your lisp that is causing the error. That will sometimes make two lisp interact with each other.

Link to comment
Share on other sites

35 minutes ago, tombu said:

Uno potrebbe impostare un sistema o una variabile ambientale che influisce sul funzionamento dell'altro. Difficile da dire senza vedere entrambi i codici.

È meglio usare la gestione degli errori per assicurarti che le tue routine ripristinino le modifiche anche quando usi Esc per uscirne.

Entrambe utilizzano variabili di sistema USER *, variabili globali o reattori?

I don't use reactors or USERS variables. Maybe it's just a matter of variables
"normal" reused and not reported to NIL!


I don't think you can have non-closed brackets .... and a working lisp.


However, it is easily circumvented by doing LOAD once.
Thanks for the replies.

Link to comment
Share on other sites

Example:

- I open a new drawing, I load "Copiatxt" (it is used to copy a text from another),

- I execute the command and I make 2 texts equal.
- Load of "Freccia" (used to create an arrow made with a polyline), I also execute this command.
- Finally I launch (without loading!) in the command line "Copiatxt" .... it asks me for the vertex of the arrow!

COPIATXT.LSP FRECCIA.LSP

Link to comment
Share on other sites

Your using a lot of global variables maybe their is a shared few between the two lisp? its good house keeping to clear those out after the command is run.

 

(defun indati ()

to

(defun indati (/ modes stiletxt entl entbl ent entb lis lisl txt nuo lis2)

 

nm see your doing that in COPIATXT

 

in COPIATXT you have a function called indati
in FreeCCIA you have a function called INDATI

change the names of them and it will clear up your problem

when the function is called in FreeCCIA.lsp its going to the first time it sees that function and its in COPIATXT.lsp because it was loaded first

 

Edited by mhupp
Link to comment
Share on other sites

Se scrivo! INDATI dalla riga di comando ottengo:


# <SUBR @ 000000002EB9AC48 INDATI>


quindi forse potrei scrivere: (setq INDATI nil) alla fine di ogni lisp ... forse risolve il problema....

 

No i tried: it kill both lisp files!

Edited by X11start
Link to comment
Share on other sites

it needs to be named different because its going to go where it see it first and the lisp You load first that's where its going to go.

 

in COPIATXT name the function INDATI-C

in FreeCCIA name the function INDATI-F

 

When you load lisp they are essentially in one file and it reads top down. your tying to get to the 2nd INDATI function but it will always stop at the first one if they are named the same.

 

Edited by mhupp
Link to comment
Share on other sites

38 minutes ago, mhupp said:

its going to go where it see it first and the lisp You load first that's where its going to go.

This is not correct. Functions can be redefined by (re)loading Lisp files. So it is the function definition from the Lisp file that was loaded last that will be used.

Edited by Roy_043
  • Thanks 1
Link to comment
Share on other sites

Oops got it backwards. just know its not good to have multiple functions that do different things named the same.

Last in First out! Got it.

Link to comment
Share on other sites

In all my lisp "INDATI" is the routine that has the task of requesting all the data and then sending them to the various processing ... maybe I should simply move this task to the main routine: "DEFUN C : ..." which obviously has different names for each lisp.

 

 

thank you all

Edited by X11start
Link to comment
Share on other sites

Listen to mhupp and update all your code to use local variables!

 

Using localized variables for subfunctions as well would avoid even more issues.

Instead of changing and having to restore *error* Error handler simply add *error* as a local variable then define *error* inside your routine and it restores itself when you exit the routine.

Had you localized INDATI in each routine you wouldn't have had issues with it either.

Link to comment
Share on other sites

This may cause some problems using extended characters. Just a comment.

 

ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»

 

The 2 indati are very different also noted only runs once so a defun is not really needed as you suggested put in main code. 

Link to comment
Share on other sites


thanks everyone for the tips.

I apologize if I don't write well in English: I'm much better with Italian! 😜

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...