|
![](/i/fill.gif) |
On Mon, 10 Nov 2003 07:19:09 +0100, "JC (Exether)" <no### [at] spam fr> wrote:
> That's great ! Is it going to be included in the official version some
> time too ?
I doubt it will be derived directly because it's kind of hack, but POV 4.0 is
supposed to be rewritten so nobody knows what will be included.
> I was actually trying to do a bit more than just printing an array, I
> wanted to write some general data structuring macros with type creation,
Well.. having arrays you can workaround it having second array with types
identification constants at the same positions. Look at below untested sample:
#declare UNDEFINED_TYPE = 0;
#declare STRING_TYPE = 1;
#declare FLOAT_TYPE = 2;
#declare OBJECT_TYPE = 3;
#macro Store(Value,Type)
#local A=array[2];
#local A[0]=array[1];
#local A[1]=array[1];
#local A[0][0]=Value;
#local A[1][0]=Type;
A
#end
#macro Store_String(String)
Store(String,STRING_TYPE)
#end
#macro Store_Float(Float)
Store(Float,FLOAT_TYPE)
#end
#macro Store_Object(Object)
Store(Object,OBJECT_TYPE)
#end
#macro Type_Of(Entry)
#local Type = UNDEFINED_TYPE;
#ifdef(Entry)
#ifdef(Entry[1])
#local A=Entry[1];
#ifdef(A[0])
#local Type = A[0];
#endif
#endif
#endif
Type
#end
#macro Is(Entry,Type)
( Type_Of(Entry) = Type )
#end
#macro Is_String(Entry)
Is(Entry,STRING_TYPE)
#end
#macro Is_Float(Entry)
Is(Entry,FLOAT_TYPE)
#end
#macro Is_Object(Entry)
Is(Entry,OBJECT_TYPE)
#end
#declare Array=array[10]; // Ten values
#declare Array[0] = StoreString( "test" );
#declare Array[1] = StoreFloat( 3.1415926 );
#declare Array[2] = StoreObject( sphere{ 0 1 } );
#if ( Is_String( Array[0] ) )
#debug "Array[0] is string\n"
#endif
> object instanciation and save/load. So I'm looking forward this feature. :-)
Thanks for patience :-)
ABX
Post a reply to this message
|
![](/i/fill.gif) |