|
[Sponsors] |
December 2, 2009, 10:41 |
RP_Set_List_of_Integer
|
#1 |
Senior Member
Illya Shevchuk
Join Date: Aug 2009
Location: Darmstadt, Germany
Posts: 176
Rep Power: 16 |
Hi everyone,
I have a problem with using RP_Set_List_of_Integer macro. Does somebody know how does it work? For example I define a global variable <testlist> in the Fluent text interface or in a scheme file first: (rp-var-define 'testlist '() 'integer-list #f) Next I write a simple UDF to test the macro: Code:
DEFINE_ON_DEMAND(demand_test_list_set) { int a=10, b=20, c=30; RP_Set_List_of_Integer("testlist", &a, 1); RP_Set_List_of_Integer("testlist", &b, 2); RP_Set_List_of_Integer("testlist", &c, 3); Message("Length of the list: %i\n",RP_Get_List_Length("testlist")); Message("1st element of the list: %i\n",RP_Get_List_Ref_Int("testlist",0)); Message("2nd element of the list: %i\n",RP_Get_List_Ref_Int("testlist",1)); Message("3rd element of the list: %i\n",RP_Get_List_Ref_Int("testlist",2)); } Code:
Length of the list: 3 1st element of the list: 30 2nd element of the list: 20 3rd element of the list: 10 But if I pass the &a-pointer twice (a.e. if I want the third element of the list to be the same as the 1st): Code:
RP_Set_List_of_Integer("testlist", &a, 1); RP_Set_List_of_Integer("testlist", &b, 2); RP_Set_List_of_Integer("testlist", &a, 3); Code:
1st element of the list: 10 2nd element of the list: -1213829304 3rd element of the list: -1214887304 I went on trying and it seems not to work with arrays also: Code:
int d[3]; d[0]=10; d[1]=20; d[2]=30; RP_Set_List_of_Integer("testlist", d, 1); RP_Set_List_of_Integer("testlist", (d+1), 2); RP_Set_List_of_Integer("testlist", (d+2), 3); Can somebody please help me and tell me, how to use the RP_Set_List_of_Integer macro properly? I need to store some arrays globally and as I want to do it anytime I want, I can not use the DEFINE_RW_FILE macro. So, the only way I see is to store them as RP-variables. I would be grateful if you had some advices for me. |
|
|
|