Author Topic: (xdrx-begin)  (Read 1521 times)

0 Members and 1 Guest are viewing this topic.

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2153
  • class keyThumper<T>:ILazy<T>
(xdrx-begin)
« on: December 09, 2023, 06:10:56 PM »
Hi,

Could you provide some documentation of the intent of
(xdrx-begin) and (xdrx-end) ??

more generally, can you give an indication when the documentation will be translated ?


side note,
I noticed you use a go board in your splash-screen.
I assume you play ??
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

xdcad

  • Swamp Rat
  • Posts: 514
Re: (xdrx-begin)
« Reply #1 on: December 10, 2023, 05:50:43 AM »
Hi,

Could you provide some documentation of the intent of
(xdrx-begin) and (xdrx-end) ??

more generally, can you give an indication when the documentation will be translated ?


side note,
I noticed you use a go board in your splash-screen.
I assume you play ??

Thanks for the suggestion
There is a function manual in the installation package. I will post here to introduce the usage from typical applications and functions. The best way is to look at the code.

xdrx-begin does some initial settings, xdrx-end does some aftermath, such as restoring system variables, releasing dynamic objects, UNDO END, etc.
The operation between xdrx-begin and xdrx-end can be UNDO once

I only know a little bit about Go. I prefer the thinking of Go, which affects some codes.
The code I wrote uses XDRX-API,which can be downloaded from github.com and is updated at any time.
===================================
https://github.com/xdcad
https://sourceforge.net/projects/xdrx-api-zip/
http://bbs.xdcad.net

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2153
  • class keyThumper<T>:ILazy<T>
Re: (xdrx-begin)
« Reply #2 on: December 10, 2023, 02:45:43 PM »
OK , Thanks.

So, if the user calls xdrx-begin she should also use a local *ERROR* handler to call xdrx-end   to ensure that variables are restored and objects are released ??

sort of like this:
Code - Auto/Visual Lisp: [Select]
  1. ;; kdub Revised 20060521
  2. ;; mods RMK 2018.11.27
  3. ;; kdub 241:2021.04.23
  4.  
  5. (defun c:FU     (/ *error*  esel)
  6.   (defun *Error* (Msg /)
  7.      (kdub:on-error Msg)
  8.      (xdrx-end)
  9.   )
  10.   (vla-endundomark *:actived                                  ;; End Any Open Undo Group
  11.   (vla-startundomark *:activedoc)
  12.   (xdrx-begin)
  13.   (kdub:savesysvar '(("CMDECHO" 0) ("OSMODE" 0) ("EXPERT" 5) ("PICKBOX" 8)))
  14.  
  15.   (setvar "PICKBOX" 10)                                          ;; rmk
  16.   (while (setq esel (entsel "\nSelect Entity to FlickOff"))
  17.         (vla-startundomark *:activedoc)
  18.         (vl-cmdf ".erase" (car esel) "")
  19.         (vla-endundomark *:activedoc)
  20.   )
  21.   (*error* nil)
  22.   (princ)
  23. )
  24.  

This functionality is important to be known.
If  we had access to the source code we could determine some of these details ourselves,
if not, we rely on good, complete documentation.

Regards
« Last Edit: December 10, 2023, 02:51:10 PM by kdub_nz »
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

xdcad

  • Swamp Rat
  • Posts: 514
Re: (xdrx-begin)
« Reply #3 on: December 10, 2023, 03:01:17 PM »
OK , Thanks.

So, if the user calls xdrx-begin she should also use a local *ERROR* handler to call xdrx-end   to ensure that variables are restored and objects are released ??

sort of like this:
Code - Auto/Visual Lisp: [Select]
  1. ;; kdub Revised 20060521
  2. ;; mods RMK 2018.11.27
  3. ;; kdub 241:2021.04.23
  4.  
  5. (defun c:FU     (/ *error*  esel)
  6.   (defun *Error* (Msg /)
  7.      (kdub:on-error Msg)
  8.      (xdrx-end)
  9.   )
  10.   (vla-endundomark *:actived                                  ;; End Any Open Undo Group
  11.   (vla-startundomark *:activedoc)
  12.   (xdrx-begin)
  13.   (kdub:savesysvar '(("CMDECHO" 0) ("OSMODE" 0) ("EXPERT" 5) ("PICKBOX" 8)))
  14.  
  15.   (setvar "PICKBOX" 10)                                          ;; rmk
  16.   (while (setq esel (entsel "\nSelect Entity to FlickOff"))
  17.         (vla-startundomark *:activedoc)
  18.         (vl-cmdf ".erase" (car esel) "")
  19.         (vla-endundomark *:activedoc)
  20.   )
  21.   (*error* nil)
  22.   (princ)
  23. )
  24.  

This functionality is important to be known.
If  we had access to the source code we could determine some of these details ourselves,
if not, we rely on good, complete documentation.

Regards
Users can define their own error function processing. In addition to C++'s ARX, the XDRX-API installation package will also load xd-lisp-lib.vlx written in LISP. In this, there are definitions of xd::begin, xd::end

xdrx-end can ensure that the geometric objects generated by ARX are released. Although xdrx-object-release can be used to explicitly release them in the program, something will be forgotten if they are not kept intact. xdrx-end will release some currently generated memory objects, such as AcGe ,AcDbEntity, etc., all release memory

Defined in xd-lisp-lib.vlx:

Code - Auto/Visual Lisp: [Select]
  1. (defun XD::Begin ()
  2.    (setq *CAD::Error* *error*
  3. *error* *XD:Error*
  4. *XD:PREC* (xdrx_document_getprec)
  5.    )
  6.    (xdrx_begin)
  7.    (xdrx_sysvar_push
  8.      '("layer" "0")
  9.      '("cmdecho" 0)
  10.      '("blipmode" 0)
  11.    )
  12. )
  13. (defun XD::End ()
  14.    (redraw)
  15.    (xdrx_sysvar_pop)
  16.    (xdrx_end)
  17.    (apply 'xdrx_document_setprec *XD:PREC*)
  18.    (setq *error* *CAD::Error*
  19.            *CAD::Error* nil
  20.            *XD:PREC* nil
  21.    )
  22.    (setvar "nomutt" 0)
  23.    (xdrx_pointmonitor) ;;Make sure to turn off the point monitor
  24.    (princ)
  25. )
  26.  

Users can also define their own error functions. If using the XDRX API, just put xdrx-begin and xdrx-end in to ensure that the ARX memory objects are well managed.
The code I wrote uses XDRX-API,which can be downloaded from github.com and is updated at any time.
===================================
https://github.com/xdcad
https://sourceforge.net/projects/xdrx-api-zip/
http://bbs.xdcad.net

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2153
  • class keyThumper<T>:ILazy<T>
Re: (xdrx-begin)
« Reply #4 on: December 10, 2023, 03:09:25 PM »
ok, thanks.

in that case, I believe the samples posted should call XD::Begin and XD::End instead of xdrx-begin and xdrx-end
and users be made aware that there is an *error* handler defined.
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

xdcad

  • Swamp Rat
  • Posts: 514
Re: (xdrx-begin)
« Reply #5 on: December 10, 2023, 03:34:46 PM »
ok, thanks.

in that case, I believe the samples posted should call XD::Begin and XD::End instead of xdrx-begin and xdrx-end
and users be made aware that there is an *error* handler defined.

xd-lisp-lib.vlx Open source LISP function source code can be seen in the open source function library sub-forum at http:://bbs.xdcad.net. There are nearly a thousand of them.

http://bbs.xdcad.net/forum-260-1.html
The code I wrote uses XDRX-API,which can be downloaded from github.com and is updated at any time.
===================================
https://github.com/xdcad
https://sourceforge.net/projects/xdrx-api-zip/
http://bbs.xdcad.net

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2153
  • class keyThumper<T>:ILazy<T>
Re: (xdrx-begin)
« Reply #6 on: December 10, 2023, 11:47:10 PM »
I've sent you a message.
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8825
  • AKA Daniel
Re: (xdrx-begin)
« Reply #7 on: December 11, 2023, 03:08:30 AM »
A xdrx-end function seems reasonable since it may be impossible to hook in to lisp’s garbage collection.
I actually don’t even know how lisp’s GC works lol.

xdrx-end will probably need to be wrapped in vl-catch-all-error-p for serious applications to avoid leaks, leaving objects open
kinda like .net's transation

edit, already mentioned by K ...

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2153
  • class keyThumper<T>:ILazy<T>
Re: (xdrx-begin)
« Reply #8 on: December 17, 2023, 02:49:52 AM »
The file
xd-lisp-lib-2020-02-08.rar
Is noted on this page
http://bbs.xdcad.net/thread-669133-1-1.html
as "  The functions are all open source, and the source code can be found on this site       "

The .rar when downloaded holds xd-lisp-lib.VLX.

Please provide the open source documents as per your web site link

Regards,
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

xdcad

  • Swamp Rat
  • Posts: 514
Re: (xdrx-begin)
« Reply #9 on: December 17, 2023, 03:23:18 AM »
The file
xd-lisp-lib-2020-02-08.rar
Is noted on this page
http://bbs.xdcad.net/thread-669133-1-1.html
as "  The functions are all open source, and the source code can be found on this site       "

The .rar when downloaded holds xd-lisp-lib.VLX.

Please provide the open source documents as per your web site link

Regards,

In the API installation package manual, there are some usages of functions of the general LISP function library, and most of the source codes are in the link below.

The manual is currently only in Chinese, but the function usage should be easy to see.

http://bbs.xdcad.net/forum-260-1.html
The code I wrote uses XDRX-API,which can be downloaded from github.com and is updated at any time.
===================================
https://github.com/xdcad
https://sourceforge.net/projects/xdrx-api-zip/
http://bbs.xdcad.net

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8825
  • AKA Daniel
Re: (xdrx-begin)
« Reply #10 on: December 17, 2023, 03:47:54 AM »
OpenDCL is GNU General Public License version 2.0 (GPLv2)
I don’t know if your allowed to embed it on a closed source project, are you?

SQLitelisp is Copyright
CppSQLite3U is Copyright, Tyushkov Nikolay and Rob Groves

it’s my understanding that it may be illegal to use XDRX API. At least a company could not. Is this right?

That’s why I post my source code, I don’t even want to get sued  :laugh:

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2153
  • class keyThumper<T>:ILazy<T>
Re: (xdrx-begin)
« Reply #11 on: December 17, 2023, 04:11:35 AM »
What you say is correct  Daniel, but we don't know what licencing arrangements have been made.
The package is not for sale, so that aspect is covered.

I've been asked my opinion on this package and at the moment I just don't know.

The real potential for problems is if the owner decides to restrict access.
Then there is the issue of documentation.
It seems to me that a lot of the functions are replications of the VLisp ActiveX methods, which are supported and mostly documentated.
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8825
  • AKA Daniel
Re: (xdrx-begin)
« Reply #12 on: December 17, 2023, 04:40:18 AM »
“The package is not for sale”
I don’t think this matters, does it? I think the key word is distribute…
at least for GPL (not to be confused with LGPL), i'm not a lawyer though  :mrgreen:

Anyway, I’m interested in this for my project as I’m using open-source libraries, wxPython and Boost
wxPython is licensed under the "wxWindows Library Licence".
Boost Software License - Version 1.0 - August 17th, 2003

these can be seen here
https://github.com/CEXT-Dan/PyRx/blob/main/credits.txt

hope I’m in the clear.