slang-users mailing list

[2007 Date Index] [2007 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

[slang-users] export an array of structs


I am able to gain access to my shm from the interpreter.  But so far
its only been to the really simple parts of my shm.  One part of my
shm is an array of structs.  How do I make an array of structs
available to the interpreter?  Its application managed and of a fixed
size.  I tried this to get the very first element of the array, but
I'm getting an error.  The array really has about 10k elements.  I
thought with this I'd be able to see the first struct in the array,
but I'm getting this error:

Null_Type does not permit structure access
./site.sl:2:<top-level>:Not Implemented

I think its due to the fact that the array is empty right now so its
all zeroed out.  But how would I export the entire array?  I see a
SLANG_ARRAY_TYPE, but how would I tell the interpreter the size of the
array, because MAKE_ISTRUCT_FIELD seems to have no slot for array
size?

Here is what I've tried in order to get a peek at the first element of
the array of structs:

static SLang_IStruct_Field_Type slang_struct_array_in_shm [] = {
   MAKE_ISTRUCT_FIELD(post_req_t, value1, "value1", SLANG_ULLONG_TYPE, 1),
   MAKE_ISTRUCT_FIELD(post_req_t, total_num, "total_size",
SLANG_ULLONG_TYPE, 1),
   MAKE_ISTRUCT_FIELD(post_req_t, cur_num, "cur_size", SLANG_ULLONG_TYPE, 1),
   MAKE_ISTRUCT_FIELD(post_req_t, rtime, "max_time", SLANG_ULLONG_TYPE, 1),
   SLANG_END_ISTRUCT_TABLE
};


   if (-1 == SLadd_istruct_table (slang_struct_array_in_shm,
                                  (VOID_STAR) &shm_ptr->my_struct_array[0],
                                  "my_array_item"))
     exit (1);


I try to get it through the interpreter like this:

() = printf("struct 1:value1:%llu:\n", my_array_item.value1);



[2007 date index] [2007 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]