Valik Posted July 20, 2004 Share Posted July 20, 2004 I've made the changes I mentioned in my above post and they all seem to work well. The example I posted for getting the VarEntry (And thus the Variant) for any variable that may be ByRef works exactly as described. I've also written and tested my NameOf() function. It will be included in the package I send Jon with all my changes. Tomorrow, I intend to write Assign() which completes the functions I want to see so that pointers can be emulated (Eval to read data, Assign to write data, and NameOf for run-time acquisition of variable names for use with the other two). I also want to submit a thin printf() wrapper, just so we have a way of doing debug printing to editor's like SciTE. I will try to get all this done and submitted by noon EST (GMT -5). That's the plan, anyway. I'm never good with time estimates. Link to comment Share on other sites More sharing options...
Administrators Jon Posted July 20, 2004 Administrators Share Posted July 20, 2004 I will try to get all this done and submitted by noon EST (GMT -5). That's the plan, anyway. I'm never good with time estimates.I'd leave it for now as i'm not adding any submissions until I release a stable 3.0.102 and I'll just lose any submissions if they sit in my email for too long. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Administrators Jon Posted July 20, 2004 Administrators Share Posted July 20, 2004 This is where I'm unclear on how the Variant class works. What is the pValue() return when a Variant references another Variant which also happens to reference a real Variant object. Does the pValue of the local Variant return the real Variant object, or does it return a pointer to the Variant object one scope below it (With that Variant, which is out of scope, returning the address of the real Variant?). For example, in order to take a variant and find the object it refers to, would this be one way to do it? *myVariant; // A pointer to a Variant which is a reference to another Variant while (myVariant->pValue() != NULL) myVariant = myVariant->pValue(); // myVariant should now point to the real object that needs manipulation, regardless // of what scope it is in. Or, does myVariant->pValue() automatically give you the address of the real object, no matter if it's been passed through a dozen functions with ByRef parameters?pVariant always points to a real "original" object no matter how many times it goes through byref functions. Just looked at the code and this is very hard to work out now (it used to be easier) but this is the case. Every time you do GetRef on a variable the pointer you get back is to the original copy. So if you then do a new CreateRef with this pointer then the new reference is still pointing at the original copy no matter how many times you do it. This works fine because scope always increases when you call a function so there is no danger of the original getting deleted. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Valik Posted July 20, 2004 Share Posted July 20, 2004 I'd leave it for now as i'm not adding any submissions until I release a stable 3.0.102 and I'll just lose any submissions if they sit in my email for too long.Okay, I'll put it on my space on here for now in case David wants to have a look. I'll send it to your email after stable 3.0.102 comes out.pVariant always points to a real "original" object no matter how many times it goes through byref functions.Just looked at the code and this is very hard to work out now (it used to be easier) but this is the case. Every time you do GetRef on a variable the pointer you get back is to the original copy. So if you then do a new CreateRef with this pointer then the new reference is still pointing at the original copy no matter how many times you do it. This works fine because scope always increases when you call a function so there is no danger of the original getting deleted.That's good to know. I was wondering how that all worked. Thanks for clearing it up.I'll post again after I've uploaded my sources. Link to comment Share on other sites More sharing options...
Valik Posted July 20, 2004 Share Posted July 20, 2004 (edited) The changes can be found http://www.autoitscript.com/fileman/users/Valik/Uploads/vartablerelated.zipThere isn't a binary included as the bulk of the changes are internal. The NameOf() function does do a nice job of testing the internal changes, so anybody needing to see how the code I added can be used, have a look at F_NameOf in script_misc.cpp.The changes are based on July 15's sources. For the most part, however, it shouldn't matter, almost all the code is an addition and not a change.Edit: Fixed typo. Edited July 20, 2004 by Valik Link to comment Share on other sites More sharing options...
Nutster Posted July 20, 2004 Author Share Posted July 20, 2004 Oh, David is interested. I will take a look at what you have done and see how it matches up with my ideas. After 3.0.102 stable release, we should make a unified submission to Jon so we do not give conflicting code for the same area. David NuttallNuttall Computer Consulting An Aquarius born during the Age of Aquarius AutoIt allows me to re-invent the wheel so much faster. I'm off to write a wizard, a wonderful wizard of odd... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now