TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: xiaxiang on March 31, 2011, 05:35:26 AM
-
Some matter bothered me. If I load one program,how can I list all the values of the Variables?
I kown the way of "! mw" ( if Variables "mw" exit).
Supposed that I have loaded a function aa:
(defun c:aa (/ a b c d)
...
)
I just want a function such as:
(defun c:bb ( aa/ )
...
)
Then
(load bb.lsp)
Return values of a,b,c and d.
Any suggestion?
-
try something like this
(defun
c:var_val ()
(mapcar
'(lambda (x)
(print (list (eval x) (vl-princ-to-string (eval (read x)))))
)
(vl-remove-if
'(lambda (X)
(or (wcmatch
x
"*-*,*_*,C:,AC*,PI,@@@@@@@@@@@*,INITSTRING,PAUSE"
)
(not
(or (eq (type (eval (read x))) 'INT)
(eq (type (eval (read x))) 'REAL)
(eq (type (eval (read x))) 'LIST)
(eq (type (eval (read x))) 'STR)
)
)
)
)
(atoms-family 1)
)
)
(princ)
)
-
Certainly not conclusive, but maybe more succinct:
(defun c:var_val nil
(mapcar
(function
(lambda ( x ) (print (list (read x) (eval (read x)))))
)
(vl-remove-if
(function
(lambda ( x )
(or (wcmatch x ":*,AC*,PI,T,PAUSE,INITSTRING,AI_SYSVAR,VLAX-*,VLR-*")
(member (type (eval (read x))) '(SUBR USUBR EXRXSUBR))
)
)
)
(atoms-family 1)
)
)
(princ)
)
-
xiaxiang,
If I understand correctly, you want to determine the value of variables that are declared local to a VLX function.
The VLX is compiled so you won't know the variable symbols.
The Variables are local to the function, so will only be in scope while the function is processing.
So short answer is NO, you cant write a function to determine the variable values.
-
Isn't the short answer "You don't need to." ? They are all nil, since they are localized to the function until its running :-)
-
Thank you all guys.
If I search the Physical memory using winhex, I can get Variable name something like "MW" with luck. So I'm certain that "MW" is local to the function.
You said that they were all Nil,but when I use "!MW" I can get the value.
-
Thanks for reply#1 by pBe and reply#2 by Lee.
I've used your code,and it worked.
I will post the values of the Variables I get as doing copy from command line.The name of attached file is Variables.txt.
But I think that there were more Variables than I've get.So I will post my vlx file(y.vlx) ,maybe as a Challenge.
Maybe you can use the code to do more than I can.
Thanks !
-
xiaxiang
From your text file
What are the variables ?
In which function are they defined ?
What are their values ?
-
xiaxiang
From your text file
What are the variables ?
In which function are they defined ?
What are their values ?
Sorry ,Kerry
The text file is got from the command line which is returned from the code that Lee posted in reply#2.
You should load y.vlx firstly.
I only know that "mw" ----License Code
"I"-------something relevant to License
...
and many Empty strings.
I want to get more information about this vlx program for Special use.
Thanks.
-
Xiaxiang,
Many users (including me) will be hesitant to run a compiled vlx file from an unknown source (and quite rightly so), since you can't be sure of what is lurking in the code.
Lee
-
Particularly as it's reading/Writing the registry so much
-
I only know that "mw" ----License Code
"I"-------something relevant to License
...
and many Empty strings.
I want to get more information about this vlx program for Special use.
Thanks.
Whoa, there - that looks like an attempt to bypass someones protection scheme. If you don't know whats inside the VLX can't be yours. :police: