Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


#Actualbollµ

Posted 04 March 2013 - 11:30 AM

Hi all!

 

I've been using Angelscript for some time now, and I've been frustrated with CScriptAny's lack of flexibility, and the fact that you NEED to know the type of the pointer that you have while you instantiate CScriptAny. Hence, I've been writing a small utility that mimics most (if not all) the features of C's void pointers, while adhering to Angelscript. I'd be honored if this helps anyone smile.png

 

Basically, it behaves similarly to CScriptAny, except for the fact that it does not need the type of the pointer that you pass it. of course, having the type information is not a problem. So, it acts as a general purpose wrapper around all void pointers in C++ code that does not need type information to instantiate it. It can then be passed to angelScript from where data can be accessed from the voidPtr, similar to how CScriptAny lets one access it's contents in the script side of things. If the voidPtr has been instantiated with type information, it behaves like CScriptAny, allowing conversion between int, float, double as well as betwen base class / derived class relationships. BUT without type information, this cannot be done. Hence, caution needs to be exercised while using this without type information(just like normal void pointers), since such conversion cannot be done automatically.

 

 

it's in a Visual Studio 2012 project. On executing the project, it shows off the features of the addon, (accessing primitives, object types and handle types from the script side  when the voidPtr class is created in the C++ side without type information). the main() function is present in voidPtr_Addon_Real/voidPtr_Addon_Real.cpp. I don't really have experience with Linux or Mac, so I'm sorry that I wasn't able to make it platform-agnostic. 

 

The two files that contain the addon are voidPtr.h and voidPtr.cpp.

The path is voidPtr_Addon_Real/voidPtr.h. The cpp is also in the same folder.

The script file is in script/voidPtr.as

The exe is in Release/voidPtr_addon_Real.exe

forgive the horrendous project name ;)

 

 

I've tried to keep it minimal. It does use templates for some ease of use, though it can be rewritten to not use them.

Also, I have a feeling I've missed one or two things while programming this (things like overflows for very large numbers) so do tell me if there's anything wrong with the code.

 

Here's the Google Drive linkhttps://docs.google.com/folder/d/0B_CmqmRQ2-AzS1plUWVSVXpNWDA/edit?usp=sharing

 

TL;DR - addon for angelScript that allows void pointer use without requiring type information. acts as a generic void pointer wrapper.

 

Thanks all!

~Bollu


#6bollµ

Posted 04 March 2013 - 11:27 AM

Hi all!

 

I've been using Angelscript for some time now, and I've been frustrated with CScriptAny's lack of flexibility, and the fact that you NEED to know the type of the pointer that you have while you instantiate CScriptAny. Hence, I've been writing a small utility that mimics most (if not all) the features of C's void pointers, while adhering to Angelscript. I'd be honored if this helps anyone smile.png

 

Basically, it behaves similarly to CScriptAny, except for the fact that it does not need the type of the pointer that you pass it. of course, having the type information is not a problem. So, it acts as a general purpose wrapper around all void pointers in C++ code that does not need type information to instantiate it. It can then be passed to angelScript from where data can be accessed from the voidPtr, similar to how CScriptAny lets one access it's contents in the script side of things. If the voidPtr has been instantiated with type information, it behaves like CScriptAny, allowing conversion between int, float, double as well as betwen base class / derived class relationships. BUT without type information, this cannot be done. Hence, caution needs to be exercised while using this without type information(just like normal void pointers), since such conversion cannot be done automatically.

 

 

it's in a Visual Studio 2012 project. On executing the project, it shows off the features of the addon, (accessing primitives, object types and handle types from the script side  when the voidPtr class is created in the C++ side without type information). the main() function is present in voidPtr_Addon_Real/voidPtr_Addon_Real.cpp. I don't really have experience with Linux or Mac, so I'm sorry that I wasn't able to make it platform-agnostic. 

 

The two files that contain the addon are voidPtr.h and voidPtr.cpp.

The path is voidPtr_Addon_Real/voidPtr.h. The cpp is also in the same folder.

The script file is in script/voidPtr.as

forgive the horrendous project name ;)

 

I've tried to keep it minimal. It does use templates for some ease of use, though it can be rewritten to not use them.

Also, I have a feeling I've missed one or two things while programming this (things like overflows for very large numbers) so do tell me if there's anything wrong with the code.

 

Here's the Google Drive linkhttps://docs.google.com/folder/d/0B_CmqmRQ2-AzS1plUWVSVXpNWDA/edit?usp=sharing

 

TL;DR - addon for angelScript that allows void pointer use without requiring type information. acts as a generic void pointer wrapper.

 

Thanks all!

~Bollu


#5bollµ

Posted 04 March 2013 - 11:27 AM

Hi all!

 

I've been using Angelscript for some time now, and I've been frustrated with CScriptAny's lack of flexibility, and the fact that you NEED to know the type of the pointer that you have while you instantiate CScriptAny. Hence, I've been writing a small utility that mimics most (if not all) the features of C's void pointers, while adhering to Angelscript. I'd be honored if this helps anyone smile.png

 

Basically, it behaves similarly to CScriptAny, except for the fact that it does not need the type of the pointer that you pass it. of course, having the type information is not a problem. So, it acts as a general purpose wrapper around all void pointers in C++ code that does not need type information to instantiate it. It can then be passed to angelScript from where data can be accessed from the voidPtr, similar to how CScriptAny lets one access it's contents in the script side of things. If the voidPtr has been instantiated with type information, it behaves like CScriptAny, allowing conversion between int, float, double as well as betwen base class / derived class relationships. BUT without type information, this cannot be done. Hence, caution needs to be exercised while using this without type information(just like normal void pointers), since such conversion cannot be done automatically.

 

 

it's in a Visual Studio 2012 project. On executing the project, it shows off the features of the addon, (accessing primitives, object types and handle types from the script side  when the voidPtr class is created in the C++ side without type information). the main() function is present in voidPtr_Addon_Real/voidPtr_Addon_Real.cpp. I don't really have experience with Linux or Mac, so I'm sorry that I wasn't able to make it platform-agnostic. 

 

The two files that contain the addon are voidPtr.h and voidPtr.cpp.

The path is voidPtr_Addon_Real/voidPtr.h. The cpp is also in the same folder.

The script file is in script/voidPtr.as

forgive the horrendous project name ;)

 

I've tried to keep it minimal. It does use templates for some ease of use, though it can be rewritten to not use them.

Also, I have a feeling I've missed one or two things while programming this (things like overflows for very large numbers) so do tell me if there's anything wrong with the code.

 

Here's the Google Drive link: https://docs.google.com/folder/d/0B_CmqmRQ2-AzS1plUWVSVXpNWDA/edit?usp=sharing

 

TL;DR - addon for angelScript that allows void pointer use without requiring type information. acts as a generic void pointer wrapper.

 

Thanks all!

~Bollu


#4bollµ

Posted 04 March 2013 - 11:27 AM

Hi all!

 

I've been using Angelscript for some time now, and I've been frustrated with CScriptAny's lack of flexibility, and the fact that you NEED to know the type of the pointer that you have while you instantiate CScriptAny. Hence, I've been writing a small utility that mimics most (if not all) the features of C's void pointers, while adhering to Angelscript. I'd be honored if this helps anyone smile.png

 

Basically, it behaves similarly to CScriptAny, except for the fact that it does not need the type of the pointer that you pass it. of course, having the type information is not a problem. So, it acts as a general purpose wrapper around all void pointers in C++ code that does not need type information to instantiate it. It can then be passed to angelScript from where data can be accessed from the voidPtr, similar to how CScriptAny lets one access it's contents in the script side of things. If the voidPtr has been instantiated with type information, it behaves like CScriptAny, allowing conversion between int, float, double as well as betwen base class / derived class relationships. BUT without type information, this cannot be done. Hence, caution needs to be exercised while using this without type information(just like normal void pointers), since such conversion cannot be done automatically.

 

 

it's in a Visual Studio 2012 project. On executing the project, it shows off the features of the addon, (accessing primitives, object types and handle types from the script side  when the voidPtr class is created in the C++ side without type information). the main() function is present in voidPtr_Addon_Real/voidPtr_Addon_Real.cpp. I don't really have experience with Linux or Mac, so I'm sorry that I wasn't able to make it platform-agnostic. 

 

The two files that contain the addon are voidPtr.h and voidPtr.cpp.

The path is voidPtr_Addon_Real/voidPtr.h. The cpp is also in the same folder.

The script file is in script/voidPtr.as

forgive the horrendous project name ;)

 

I've tried to keep it minimal. It does use templates for some ease of use, though it can be rewritten to not use them.

Also, I have a feeling I've missed one or two things while programming this (things like overflows for very large numbers) so do tell me if there's anything wrong with the code.

 

Here's the Google Drive link: https://docs.google.com/folder/d/0B_CmqmRQ2-AzS1plUWVSVXpNWDA/edit?usp=sharing

 

TL;DR - addon for angelScript that allows void pointer use without requiring type information. acts as a generic void pointer wrapper.

 

Thanks all!

~Bollu


#3bollµ

Posted 04 March 2013 - 11:26 AM

Hi all!

 

I've been using Angelscript for some time now, and I've been frustrated with CScriptAny's lack of flexibility, and the fact that you NEED to know the type of the pointer that you have while you instantiate CScriptAny. Hence, I've been writing a small utility that mimics most (if not all) the features of C's void pointers, while adhering to Angelscript. I'd be honored if this helps anyone smile.png

 

Basically, it behaves similarly to CScriptAny, except for the fact that it does not need the type of the pointer that you pass it. of course, having the type information is not a problem. So, it acts as a general purpose wrapper around all void pointers in C++ code that does not need type information to instantiate it. It can then be passed to angelScript from where data can be accessed from the voidPtr, similar to how CScriptAny lets one access it's contents in the script side of things. If the voidPtr has been instantiated with type information, it behaves like CScriptAny, allowing conversion between int, float, double as well as betwen base class / derived class relationships. BUT without type information, this cannot be done. Hence, caution needs to be exercised while using this without type information(just like normal void pointers), since such conversion cannot be done automatically.

 

 

it's in a Visual Studio 2012 project. On executing the project, it shows off the features of the addon, (accessing primitives, object types and handle types from the script side  when the voidPtr class is created in the C++ side without type information). the main() function is present in voidPtr_Addon_Real/voidPtr_Addon_Real.cpp. I don't really have experience with Linux or Mac, so I'm sorry that I wasn't able to make it platform-agnostic. 

 

The two files that contain the addon are voidPtr.h and voidPtr.cpp.

The path is voidPtr_Addon_Real/voidPtr.h. The cpp is also in the same folder.

The script file is in script/voidPtr.as

forgive the horrendous project name ;)

 

I've tried to keep it minimal. It does use templates for some ease of use, though it can be rewritten to not use them.

Also, I have a feeling I've missed one or two things while programming this (things like overflows for very large numbers) so do tell me if there's anything wrong with the code.

 

Here's the Google Drive link: https://docs.google.com/folder/d/0B_CmqmRQ2-AzS1plUWVSVXpNWDA/edit?usp=sharing

 

Thanks all!

~Bollu


#2bollµ

Posted 04 March 2013 - 11:23 AM

Hi all!

 

I've been using Angelscript for some time now, and I've been frustrated with CScriptAny's lack of flexibility, and the fact that you NEED to know the type of the pointer that you have while you instantiate CScriptAny. Hence, I've been writing a small utility that mimics most (if not all) the features of C++ void pointers, while adhering to Angelscript. I'd be honored if this helps anyone smile.png

 

Basically, it behaves similarly to CScriptAny, except for the facet that it does not need the type of the pointer that you pass it. of course, having the type is not a problem. So it acts as a general purpose wrapper around all void pointers in C++ code that does not need type information to instantiate it. It can then be passed to angelScript from where data can be accessed from the voidPtr, similar to how CScriptAny lets one access it's contents in the script side of things. If it has type information, it behaves like CScriptAny, allowing conversion between int, float, double as well as been base class / derived class relationships. BUT without type information, this cannot be done. Hence, caution needs to be exercised while using this without type information(just like normal void pointers)

 

 

it's a Visual Studio 2012 project. On executing the project, it shows off the features of the addon, (accessing primitives, object types and handle types without having type information when the voidPtr class is created in the C++ side). the main file is voidPtr_Addon_Real/voidPtr_Addon_Real.cpp. I don't really have experience with Linux or Mac, so I'm sorry that I wasn't able to make it platform-agnostic. 

 

The two files that contain the addon are voidPtr.h and voidPtr.cpp.

The path is voidPtr_Addon_Real/voidPtr.h. The cpp is also in the same folder. (forgive the horrendous project name ;) )

The script file is in script/voidPtr.as

 

 

I've tried to keep it minimal. It does use templates for some ease of use, though it can be rewritten to not use them.

Also, I have a feeling I've missed one or two things while programming this (things like overflows for very large numbers) so do tell me if there's anything wrong with the code.

 

Here's the Google Drive link: https://docs.google.com/folder/d/0B_CmqmRQ2-AzS1plUWVSVXpNWDA/edit?usp=sharing

 

Thanks all!

~Bollu


PARTNERS