Author Topic: About exit and quit functions  (Read 1171 times)

0 Members and 1 Guest are viewing this topic.

baitang36

  • Bull Frog
  • Posts: 213
About exit and quit functions
« on: November 06, 2021, 06:39:42 AM »
A friend asked, what is the difference between exit and quit? Can the information it displays be changed?

Let's do an experiment and enter it on the command line! Exit enter


command:!exit

#<SUBR @0d6753c0 QUIT>

Enter on the command line !Quit enter

Command:! quit

#<SUBR @0d6753c0 QUIT>

It is found that the displayed content is exactly the same, that is, exit is only an alias of quit, and there is no difference in function.

At the command line, enter (exit)

command: (exit)

; Error: quit / exit abort

The string "quit / exit abort" is too obvious. You can see that exit is called at a glance. Can you change it?

According to this information # < subr @ 0d6753c0 quit >, we found its address in the memory, and found its hometown through this address. The starting address is 3344h in the file vlaflb.fsl, and its program code (hexadecimal) is as follows:

14 01 00 00 01 ; Function start

09 B4 02 ;  string "vlmsg. DLL"

33 20 35 00 00 ; Integer 13600

51 02 B3 02 01 00 ; Call the function string resource

51 01 E2 02 01 00 ; Call function_ msg-err

16 ; End of function

; 2b4 vlmsg.dll

; 2b3 string-resource

; 2e2 _ msg-err

 decompile into source code is:

(defun quit()

( _msg-err( string-resource "vlmsg.dll" 13600 ))

)

It calls an unpublished reservation function _msg-err to exit and display information.

Because the reserved function can only be used in Fas and not in LSP, I made an  exit.fas and defined a function exit-msg to customize the exit information.

After loading, you can call the function exit-msg

Usage: (exit-msg  string)

For example (exit-msg "incorrect registration code!")

An unpublished reservation function was also found _Exit-process is used to exit acad.exe and directly return to the operating system.

Usage: (exit-process integer)

For example (exit-process 123)

This usage will exit the program directly and the unsaved diagram will be lost.


If you need exit.fas, please email me 5520971@qq.com

print1985

  • Mosquito
  • Posts: 2
Re: About exit and quit functions
« Reply #1 on: January 03, 2022, 08:53:30 AM »
Thank you very good

danAllen

  • Newt
  • Posts: 132
Re: About exit and quit functions
« Reply #2 on: January 03, 2022, 01:04:36 PM »
; Error: quit / exit abort

The string "quit / exit abort" is too obvious. You can see that exit is called at a glance. Can you change it?

why not define your own *error* function and output a different message?

see http://www.lee-mac.com/errorhandling.html