Author Topic: ADDING a function to VLISP libary  (Read 3965 times)

0 Members and 1 Guest are viewing this topic.

John Kaul (Se7en)

  • Administrator
  • Needs a day job
  • Posts: 8841
Re: ADDING a function to VLISP libary
« Reply #15 on: October 26, 2009, 01:29:02 pm »
Ah...My take on the situation (1 cent worth):
I have added a custom syntax group in my language syntax file for Vim for any personal library functions i have built (more project based then generic--i dont use a global lib-.). This way im allowed to color my syntax groups separately; (if we are talking lisp) ``lispFunc'' may show up yellow while ``lispCustFunction'' can show green.

This way, i dont have just one barrel of functions.
“Common sense is not so common.” ~Voltaire

--> Donate to TheSwamp.org <--

ArgV

  • Guest
Re: ADDING a function to VLISP libary
« Reply #16 on: October 28, 2009, 11:58:31 pm »
Is this kind of what you had in mine ArgV?

Code: [Select]
(defun AT-Load-Com (/ #Dir #List)
  (cond
    ((setq #Dir (findfile "c:\\AlanThompson\\LSP\\_Subs"))
     (foreach x (vl-directory-files #Dir)
       (if (wcmatch (strcase x) "*.LSP")
         (load (strcat #Dir "\\" x) nil)
       ) ;_ if
     ) ;_ foreach
     (setq #List (mapcar 'read
                         (vl-remove-if-not
                           '(lambda (x) (wcmatch (strcase x) "AT*"))
                           (atoms-family 1)
                         ) ;_ vl-remove-if-not
                 ) ;_ mapcar
     ) ;_ setq
     (eval (list 'pragma (list 'quote (list (cons 'unprotect-assign #List)))))
     (eval (list 'pragma (list 'quote (list (cons 'protect-assign #List)))))
     T
    )
  ) ;_ cond
) ;_ defun

This is what I was thinking for myself. Load all my subroutines in my _Subs folder, then create a list, based on what matches "AT*" from (atoms-family 1) and add them accordingly.

Is there a way to check if a function is already assigned? If i run this a second time (not that I would need to) and vlide is open, I have to OK through redefining each.

From only looking at it, and not running it, yes. I believe so. Just wanted my own "vl-load-com" to load because I've written alot of useful functions that I use alot. :)

thanks, if this is what I'm looking for. Won't know till tommorow. :(

ArgV

  • Guest
Re: ADDING a function to VLISP libary
« Reply #17 on: October 29, 2009, 12:03:02 am »
Ah...My take on the situation (1 cent worth):
I have added a custom syntax group in my language syntax file for Vim for any personal library functions i have built (more project based then generic--i dont use a global lib-.). This way im allowed to color my syntax groups separately; (if we are talking lisp) ``lispFunc'' may show up yellow while ``lispCustFunction'' can show green.

This way, i dont have just one barrel of functions.

Nice. :)

ArgV

  • Guest
Re: ADDING a function to VLISP libary
« Reply #18 on: October 29, 2009, 12:06:58 am »
>>>
Sweet, that is a good step in the right direction. Now, of course, to take it a step further, is it possible to include my functions with the (vl-load-com) statement, or can I make my own version of the (vl-load-com) statement to use to import my functions?

Thank you very much. I learned all kinds of stuff looking up these new subrs, but most of it talks about objectARX, which I haven't started using quite yet.

-ArgV



>>>  is it possible to include my functions with the (vl-load-com) statement

Sorry, don't understand your intent.


>>>  can I make my own version of the (vl-load-com) statement to use to import my functions?

Sorry, don't understand your intent.


>>> I learned all kinds of stuff looking up these new subrs, but most of it talks about objectARX

This is just basic VisualLisp, nothing to do with ObjectARX.




Sorry. I suck at writing what I want. (you have to see the hand gestures!)  :roll:

I think Alan got it. I've made a library of functions I would like to call. Some just take an argument and return something.. a list.. whatever. Just handy I guess.

-ArgV

alanjt

  • Needs a day job
  • Posts: 5313
  • Standby for witty remark...
Re: ADDING a function to VLISP libary
« Reply #19 on: October 29, 2009, 08:45:17 am »
>>>
Sweet, that is a good step in the right direction. Now, of course, to take it a step further, is it possible to include my functions with the (vl-load-com) statement, or can I make my own version of the (vl-load-com) statement to use to import my functions?

Thank you very much. I learned all kinds of stuff looking up these new subrs, but most of it talks about objectARX, which I haven't started using quite yet.

-ArgV



>>>  is it possible to include my functions with the (vl-load-com) statement

Sorry, don't understand your intent.


>>>  can I make my own version of the (vl-load-com) statement to use to import my functions?

Sorry, don't understand your intent.


>>> I learned all kinds of stuff looking up these new subrs, but most of it talks about objectARX

This is just basic VisualLisp, nothing to do with ObjectARX.




Sorry. I suck at writing what I want. (you have to see the hand gestures!)  :roll:

I think Alan got it. I've made a library of functions I would like to call. Some just take an argument and return something.. a list.. whatever. Just handy I guess.

-ArgV

There's one problem with it, if you have one of the same loaded subs localized in a routine and vlide has been opened, it will give the redefine error.

I think my attempt was more proof-of-concept.
Civil 3D 2017 ~ Windohz 7 64bit
Dropbox

ArgV

  • Guest
Re: ADDING a function to VLISP libary
« Reply #20 on: October 31, 2009, 01:52:48 am »
>>>
Sweet, that is a good step in the right direction. Now, of course, to take it a step further, is it possible to include my functions with the (vl-load-com) statement, or can I make my own version of the (vl-load-com) statement to use to import my functions?

Thank you very much. I learned all kinds of stuff looking up these new subrs, but most of it talks about objectARX, which I haven't started using quite yet.

-ArgV



>>>  is it possible to include my functions with the (vl-load-com) statement

Sorry, don't understand your intent.


>>>  can I make my own version of the (vl-load-com) statement to use to import my functions?

Sorry, don't understand your intent.


>>> I learned all kinds of stuff looking up these new subrs, but most of it talks about objectARX

This is just basic VisualLisp, nothing to do with ObjectARX.




Sorry. I suck at writing what I want. (you have to see the hand gestures!)  :roll:

I think Alan got it. I've made a library of functions I would like to call. Some just take an argument and return something.. a list.. whatever. Just handy I guess.

-ArgV

There's one problem with it, if you have one of the same loaded subs localized in a routine and vlide has been opened, it will give the redefine error.

I think my attempt was more proof-of-concept.

Thats cool. I can roll with it. Now that I'm leaning OOP programming, I'm starting to appreciate the idea of overloaded functions. Oh well. :)