Author Topic: Coverting LISP Code to Visual Lisp  (Read 9752 times)

0 Members and 1 Guest are viewing this topic.

ML

  • Guest
Coverting LISP Code to Visual Lisp
« on: March 05, 2007, 10:49:16 AM »

Does anyone happen to know how to cleanly and simply convert LISP routines into Visual LISP without re wriiting all the code?
Is there a clean coversion method?

Also, it would be great if I could convert LISP to VBA but I don't think that is possible; may be someone can proove me wrong?

Thank you

Mark

Tramber

  • Guest
Re: Coverting LISP Code to Visual Lisp
« Reply #1 on: March 05, 2007, 12:20:32 PM »
There is no more convertion tool between Kant philosophy and Pascals than between Autolisp and Vlisp.  :roll:

You need to know them both in order to re-write a code.
Unless you use ENT... functions, Autolisp sends commands to AutoCAD while Vlisp transforms entities through their properties.
The grammar is not the same.

JohnK

  • Administrator
  • Seagull
  • Posts: 10667
Re: Coverting LISP Code to Visual Lisp
« Reply #2 on: March 05, 2007, 12:53:35 PM »
*click*
I found this one in my doc's. Although its a conversion from lisp -> c it might help.
Code: [Select]
(defun convert2C (/ fname nfile fn nf char)
  (cond ((setq fname (getfiled "Convert file" "" "lsp" 0))
         (setq nfile (strcat (vl-filename-directory fname)
                             "\\"
                             (vl-filename-base fname)
                             ".cpp"))
         (cond ((and (setq nf (open nfile "w"))
                     (setq fn (open fname "r"))
                )
                (while (setq char (read-char fn))
                  (cond ((= char 10)
                         (princ (chr char) nf)
                        )
                        (T (princ "C" nf))
                  )
                )
                (princ (strcat "\nNew file: " nfile))
                (close nf)
                (close fn)
               ))
        )
  )
  (princ)
)

*Se8en: sits back to watch the show*
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

ML

  • Guest
Re: Coverting LISP Code to Visual Lisp
« Reply #3 on: March 05, 2007, 12:54:06 PM »
Thanks man; well it was worth a try  :-)

ML

  • Guest
Re: Coverting LISP Code to Visual Lisp
« Reply #4 on: March 05, 2007, 12:55:20 PM »

Thanks Seven

I will take a look

Mark   :?

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Coverting LISP Code to Visual Lisp
« Reply #5 on: March 05, 2007, 03:55:52 PM »

........ how to cleanly and simply convert LISP routines into Visual LISP without re wriiting all the code?
Is there a clean coversion method?


Mark, what do you see that needs converting ?
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Coverting LISP Code to Visual Lisp
« Reply #6 on: March 05, 2007, 05:09:09 PM »
Just to clarify something ..

Do you mean convert AutoLisp  or one of the mainline Lisp dialects ?? 

You do know that Autolisp code written before VisualLisp inception will still run in VisualLisp ? yes ?
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

daron

  • Guest
Re: Coverting LISP Code to Visual Lisp
« Reply #7 on: March 05, 2007, 05:22:34 PM »
Mark, there isn't too much to converting from one language to another and as Kerry is inquiring, if the code works, there's no need to convert from autolisp to visualisp. In many cases we've run test earlier on in the beginnings of this forum where we found that some of the autolisp functions worked better than their newer counterparts.

I get the impression that you are still of the mindset that lisp is nothing more than a scripting language and doesn't even have an if/then/else function. Well, if it ever didn't have it, it has had it for a long time.

ML

  • Guest
Re: Coverting LISP Code to Visual Lisp
« Reply #8 on: March 05, 2007, 10:50:37 PM »
Hey Kerry

I didn't know that, that is interesting. Actually I prefer program in VBA because it is basically what got me into programming and I saw the obvious benefits of VBA over LISP, however, it is also obvious to me that there seems to be so much more coding to necessary in VBA to get the same results you would get from LISP. Having said that, my boss has done amazing things with LISP, thing I never knew were possible with LISP but I just thought it would be cool if we could modernize his routines a bit by using VLISP.

I am not sure what I need to do to run an asci file LISP routine in VLISP but may be you could give me a brief explanation? I would really appreciate it

Mark

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Coverting LISP Code to Visual Lisp
« Reply #9 on: March 05, 2007, 11:12:25 PM »
...  saw the obvious benefits of VBA over LISP....


Really ?



... I am not sure what I need to do to run an asci file LISP routine in VLISP but may be you could give me a brief explanation? I would really appreciate it



Type APPLOAD at the command line.


kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

ML

  • Guest
Re: Coverting LISP Code to Visual Lisp
« Reply #10 on: March 06, 2007, 08:14:34 PM »


Kerry

You sound surprised about VBA    :lol:
They both serve a valuble purpose however VBA is built into all Microsoft products which is major benefit right there. I don't know very much about LISP but can you get ACAD to work with Excel using LISP? Also can you access type libraries of other programs using LISP?

Mark

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Coverting LISP Code to Visual Lisp
« Reply #11 on: March 06, 2007, 08:25:54 PM »
don't get into a pissing contest you can't win.

did you get the lisp loaded ?
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

ML

  • Guest
Re: Coverting LISP Code to Visual Lisp
« Reply #12 on: March 06, 2007, 08:32:11 PM »

Yeah you're right; who really cares. As long as the results are the same.
No I didn't try it yet but my boss said you can run you can copy an older LISP routine into VLISP no problem.
May be I will try it tomorrow. The extent of my LISP usag is maybe a few commandsin a menu macro; that is a definite benefit with LISP.

Jeff_M

  • King Gator
  • Posts: 4100
  • C3D user & customizer
Re: Coverting LISP Code to Visual Lisp
« Reply #13 on: March 06, 2007, 08:43:10 PM »
I don't know very much about LISP but can you get ACAD to work with Excel using LISP? Also can you access type libraries of other programs using LISP?
No, you can't use lisp from Excel....but you CAN use lisp to work within Excel FROM Acad.

Yes, you can access most any ActiveX library wth lisp. I have lisp routines I wrote back in AcadR9 that I still use today in R2007.

JohnK

  • Administrator
  • Seagull
  • Posts: 10667
Re: Coverting LISP Code to Visual Lisp
« Reply #14 on: March 06, 2007, 08:52:23 PM »
VisualLisp has an IDE (Just like VBA has an IDE) Its called the VLIDE. I think that is what he means; You cant ``copy an older LISP routine into VLISP'' (That just doesn't make sense.) but you can copy--open--a lisp in the VLIDE (which isnt ``VLISP'').

Dont worry, we will have you Lisp-ing soon enough. (We can get the terms down later).
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org