Are there ang good tutorials on using the vlide debugging tools.

Are there ang good tutorials on using the vlide debugging tools.

stanovb
Advocate Advocate
2,951 Views
46 Replies
Message 1 of 47

Are there ang good tutorials on using the vlide debugging tools.

stanovb
Advocate
Advocate

 

I found this on here but are there other good video tutorials on how to use the vlide editor to debug your code?

 

https://www.youtube.com/watch?v=cBTQ0uHaI4Y

 

I have gotten two errors while trying to debug manually, but I could use some extra help.

 

One error was: ; error: bad argument type: streamp nil

bad argument type: streamp <value> A function requiring a file descriptor argument has been passed an argument of incorrect data type with the value noted in the error message. Usually a result of passing the close AutoLISP function a null or invalid argument.

Then while debugging this error i recieved this second error: bad argument type: fixnump: nil

bad argument type: fixnump: <value> A function requiring an integer argument has been passed an argument of incorrect data type with the value noted in the error message.

 

The problem is i dont know where the error is occurring. Is there a good tutorial that shows you how to pinpoint the error such as setting breakpoint on error & how to go about doing this?

 

I have two lisp routines that are working together so I'm not totally sure which file is causing the error. Someone showed me the trick of setting a variable throughout the code & then typing ! & then the variable name to see what it finally gets set 2 & it looks like now it is getting through the first routine & getting hung up on the second routine but I'm not sure why it is expecting an integer argument. I would post the files, but its quite a bit of code.

0 Likes
2,952 Views
46 Replies
Replies (46)
Message 2 of 47

Sea-Haven
Mentor
Mentor

Google should help, Lee-mac.com has a tutorial that may help also.

0 Likes
Message 3 of 47

ВeekeeCZ
Consultant
Consultant

@stanovb wrote:

One error was: ; error: bad argument type: streamp nil

bad argument type: streamp <value> A function requiring a file descriptor argument has been passed an argument of incorrect data type with the value noted in the error message. Usually a result of passing the close AutoLISP function a null or invalid argument.

Then while debugging this error i recieved this second error: bad argument type: fixnump: nil

bad argument type: fixnump: <value> A function requiring an integer argument has been passed an argument of incorrect data type with the value noted in the error message.

 

The problem is i dont know where the error is occurring. Is there a good tutorial that shows you how to pinpoint the error such as setting breakpoint on error & how to go about doing this?

 

I have two lisp routines that are working together so I'm not totally sure which file is causing the error. Someone showed me the trick of setting a variable throughout the code & then typing ! & then the variable name to see what it finally gets set 2 & it looks like now it is getting through the first routine & getting hung up on the second routine but I'm not sure why it is expecting an integer argument. I would post the files, but its quite a bit of code.


 

I remember THIS  thread of yours, there is plenty of good suggestions.

 

Not sure how big your routines are. If it's something of a reasonable size, you can try to post it so we could look at it and possibly show you how to find it. 

0 Likes
Message 4 of 47

stanovb
Advocate
Advocate

It's a little complicated, that's why I was hesitating posting it because nobody wants to look through a bunch of code. yes, I have posted about this a few times. I've been trying to figure it out, but I put it on the back shelf because I was sure it was going to take me some time. The person that created this has retired & it is up to me to try to get it to work. There are multiple files working together. There is a main Project Start file called "CDGProjectstart.lsp" & there is a file that sets up the directories called "ProjectDirectories.lsp". The file "CDGProjectstart.lsp" has some code in it that writes the different variables to an asci file based on the dcl selections. The first thing that happens is you get a dialog box where the user selects a client list.

i tried to post a screenshot but it did not work. I will upload as a photo file. Based on what you select, another dcl dialog box opens up & you populate the dialog box with things such as project Address, project name etc. For instance, of you select Wendy's, it opens up Wendys.dcl. I can only upload 3 files at a time; so I will have to post it in parts. I will send the main lisp files & one of the dcl files. i will send the screenshots in another post.

 

 

0 Likes
Message 5 of 47

stanovb
Advocate
Advocate

Here are the other files. When I use the break on error it gives me the error, but I don't know where it is occurring at.

0 Likes
Message 6 of 47

ВeekeeCZ
Consultant
Consultant

Well, your hesitation was justified. But for a different reason. It's not necessarily the length of it, but the inability to run it - due to how heavily it's tied to your disk file structure. And without it... begging that could possibly take some minutes with the ability to run it, now it's almost impossible to achieve. Nobody is able to trace theoretical values just in his head. 

 

So, here could be no other suggestion, no magic suggestion, just re-read the previous thread, one suggestion after another, pick some of it... and split the job into pieces, trace the value whether it's something expected, and be systematic. Good luck!

0 Likes
Message 7 of 47

stanovb
Advocate
Advocate

What about just the idea of setting the beak on error? All I get with that is the error that occurs, it doesn't tell me where the error is occurring. I already know the error because AutoCAD tells me that at the command line. That's why I was asking for some tutorials. I was actually hoping for a video similar to the one I posted a link to so I could follow along with the person & learn how its done.  What I'm having problems with is finding the location in the file that the error is occurring. Also because I'm using multiple files I don't know which lisp routine is causing the problem.

0 Likes
Message 8 of 47

ВeekeeCZ
Consultant
Consultant

Well, that sometimes happens, depending on the code. 

You need to locate that manually. Add your own breakpoint (F9) somewhere and run the code. If you reach your breakpoint without error, then move your breakpoint forward. If you get an error, move it back and repeat the process.

0 Likes
Message 9 of 47

ВeekeeCZ
Consultant
Consultant

Actually, I was able to run it and reach the same error. But...

Need to leave now. I'll look at that later.

0 Likes
Message 10 of 47

stanovb
Advocate
Advocate

ok. I was getting another error earlier, but while I was trying to fix that I created the other error lol. I'll keep looking  at it when I can & try to figure something out

0 Likes
Message 11 of 47

ВeekeeCZ
Consultant
Consultant

First of all, this portion of code is a serious f*ckup. It's not the one that causes the error but the logic is totally wrong and the code is basically useless (Hey, @ronjonp, was it you again? -- 😛 -- Ok, I'll stop 😎)

 

(if
	(progn
	  (or
	    (and (/= client nil pn nil pno nil pad nil city nil state nil));WE,SE,SC,MM,WR
	    (and (/= client nil pn nil pno nil pad nil city nil state nil stn nil pjt nil));KFC
	    (and (/= client nil pn nil pno nil pad nil city nil state nil pjtfl nil stn nil));FOOTLOCKER
	    (and (/= client nil pn nil pno nil pad nil city nil state nil base nil class nil owner nil pjt nil));WENDYS
	    (and (/= client nil pn nil pno nil pad nil city nil state nil projmin nil stn nil nsn nil region nil));MCDONALDS
	    )
	  )
	

 

@stanovb skilled enough to fix it?!

 

Spoiler alert

(if (and client pn pno pad city state ; mandatory to all
	 (or (wcmatch client "WE,SE,SC,MM,WR")	; only generals
	     (and (wcmatch client "KFC") stn pjt) ; all generals and some more
	     (and (wcmatch client "FOOTLOCKER") pjtfl stn) 
	     (and (wcmatch client "WENDYS") base class owner pjt)
	     ...))
  (progn

    ;;SET VARIABLES TO "N/A" IF NOT CHOSEN IN DIALOG
    (foreach var '("STN" "GAREA" "SAREA" "AUTH" "ZIP" "SNO" "SNO2" "PTN" "PTN2" "NSN"
		   "REGION" "CLASS" "BASE" "OWNER" "PJMIN" "PJTFL" "PJWEN")
      (set (read var) "N/A"))

    (/= PJT nil) ; - this does nothing!! What it should do...

 

0 Likes
Message 12 of 47

ВeekeeCZ
Consultant
Consultant

HERE  is a video from debugging.

You can see, that code stopped at the issue line correctly.

This issue is DH=nil.

 

But why, if the integer to DH is set by the line right above the while by load_dialog (video at 2:28''). Look inside the loop. You unload the dialog, set DH to nil... and go for another run of the loop... But this time the test-condition fails because it does not count that DH could be nil. You need to fix the while's test-condition - by the fix that you have already in the code, see your previous while loop!

HTH

 

0 Likes
Message 13 of 47

stanovb
Advocate
Advocate

ok thanks. Yeah this was not written by me. The guy who wrote it has retired & it was left up to me to get this working

0 Likes
Message 14 of 47

ВeekeeCZ
Consultant
Consultant

@stanovb wrote:

ok thanks. Yeah this was not written by me. The guy who wrote it has retired & it was left up to me to get this working


The question was whether you're able to fix it. Not who wrote it.

0 Likes
Message 15 of 47

stanovb
Advocate
Advocate

oh sorry. yeah i can fix that

0 Likes
Message 16 of 47

ronjonp
Advisor
Advisor

@ВeekeeCZ wrote:

First of all, this portion of code is a serious f*ckup. It's not the one that causes the error but the logic is totally wrong and the code is basically useless (Hey, @ronjonp, was it you again? -- 😛 -- Ok, I'll stop 😎)


I can be illogical but not that bad! 🤣

Message 17 of 47

ВeekeeCZ
Consultant
Consultant

@ronjonp wrote:

@ВeekeeCZ wrote:

First of all, this portion of code is a serious f*ckup. It's not the one that causes the error but the logic is totally wrong and the code is basically useless (Hey, @ronjonp, was it you again? -- 😛 -- Ok, I'll stop 😎)


I can be illogical but not that bad🤣


 

Thanks for the hint. I guess we all are learning every day. Never knew that the /= func behaves differently than I've expected. Found the note in HELP .

 

Note: The behavior of /= does not quite conform to other LISP dialects. The standard behavior is to return T if no two arguments in the list have the same value. In AutoLISP, /= returns T if no successive arguments have the same value; see the examples that follow.

 

 

 

@stanovb 

Not sure if you understand why the logic is wrong. Its about OR and AND functions, the way they work.

 

OR is testing one condition after another UNTIL finds True. If True is returned by the first condition, the second and all subsequent ones are never tested.

AND is testing one condition after another UNTIL finds False. If False is returned by the first condition, the second and all subsequent ones are never tested.

 

So if we strip the code from the PROGN wrapper (useless because OR does the wrapping job for us) and AND with a single argument (again, it does not do anything useful), the code looks like this:

 

(if (or (/= client nil pn nil pno nil pad nil city nil state nil);WE,SE,SC,MM,WR
	(/= client nil pn nil pno nil pad nil city nil state nil stn nil pjt nil);KFC
	(/= client nil pn nil pno nil pad nil city nil state nil pjtfl nil stn nil);FOOTLOCKER
	(/= client nil pn nil pno nil pad nil city nil state nil base nil class nil owner nil pjt nil);WENDYS
	(/= client nil pn nil pno nil pad nil city nil state nil projmin nil stn nil nsn nil region nil);MCDONALDS
	)
  (progn for then...)

 

Now, say you did not fill the owner  (= owner nil) for WENDYS but all the other data are filled. So I guess that False is expected for the IF statement. But it returns True. Just test it, trace it, see why is that. See my previous video, use a Watch and *last-value* or all the vars. Possibly try to fix it. 

0 Likes
Message 18 of 47

stanovb
Advocate
Advocate

Thanks for the video & the fixed file. This is the kind of video that I was looking for on youtube to see how someone uses the editor for debugging. I might have to watch this multiple times. This is very close now. I have to figure where it is getting 22LTRS100 from when it should be 22IA100. IA being the variable assigned to PJT

 

stanovb_0-1659445199775.png

 

It's not copying the files over & its not writing the asc file to the folder, but i might have commented something out. I'm not getting the errors i was getting before & it ends with the number 10.

 

stanovb_1-1659445375002.png

 

0 Likes
Message 19 of 47

stanovb
Advocate
Advocate

yes thanks for the info. I have learned about how the "OR" & "AND" operators work from another programing course that I have taken. I understand that for the "OR" only one of the options needs to be true assuming you are testing for that, then the rest of the statement is not run & for the AND operator there are two things that need to be true for the statement to be true. I could be wrong but I believe that code has something to do with the fact that some things for certain project types are not selected such as the region variable. This only gets populated for McDonald's projects.

0 Likes
Message 20 of 47

ВeekeeCZ
Consultant
Consultant

@stanovb wrote:

yes thanks for the info. I have learned about how the "OR" & "AND" operators work from another programing course that I have taken. I understand that for the "OR" only one of the options needs to be true assuming you are testing for that, then the rest of the statement is not run & for the AND operator there are two ALL things that need to be true for the statement to be true. I could be wrong but I believe that code has something to do with the fact that some things for certain project types are not selected such as the region variable. This only gets populated for McDonald's projects. Yes, I think so too, but the quoted part of the code does not work that way. Either try to follow and fix it by my previous msg or take the spoiler from mgs #11. This portion of code was not fixed in my posted lsp file.


 

0 Likes