slang-users mailing list

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

Re: [slang-users] push array structure into slang


Hi Joe,

>    for (int ww = 0; ww < arg2; ww++){
>    SLang_push_cstruct((VOID_STAR)&cp[ww], SLANG_XY);
>    SLang_pop_anytype (&any);

Have you tried popping the structure off as a structure,
instead of an anytype?  E.g. defining at the top

	SLang_Struct_Type *st = NULL;

and then having your loop do

	if (-1 == SLang_pop_struct(&st))
		return -1;

In S-Lang1 the struct pop function is quasi-public (not declared
statically, but is not in the public api), so when I needed to
use it I wound up doing something like

	#define SLang_pop_struct        _SLang_pop_struct

and prototyping it myself.  In SLang2 the SLang_pop_struct()
function is public, so you don't need to play those games.

For array creation it would be nice if one could create instances
of SLang_Struct_Type* directly in the C api (roughly analogous to
what SLang_create_mmt does for MMT types).  Then arrays of structs
could be created w/out resorting to using push/pop for each element,
but this was not supported in SLang1, nor does it appear to be
present in the SLang2 api.  I doubt the push/pop method, though,
is a big performance hit.

HTH,
-Mike

_______________________________________________
To unsubscribe, visit http://jedsoft.org/slang/mailinglists.html


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