sds_buildlist

struct sds_resbuf *sds_buildlist (int rtype, ...);


Create a linked list of these items.


This function creates a linked list of types and values entered as argument pairs. The rtype argument consists of pairs. The first half of the pair describes the "type" of data to follow; the second half of the pair contains the data.

The type is either an RTxxx code (listed below) or a DXF group code:

Type Meaning
RTNONE No result.
RTREAL Real number.
RTPOINT 2D point (x,y-coordinate).
RTSHORT Short integer.
RTANG Angle.
RTSTR String.
RTENAME Entity name.
RTPICKS Pick set.
RTORINT Orientation.
RT3DPOINT 3D point (x,y,z coordinate).
RTLONG Long integer.
RTVOID Blank symbol.
RTNIL Nil.
RTDXF0 DXF code 0.
RTT The T (true) atom.
RTRESBUF Result buffer list.

The following types are not paired:

Type Meaning
RTLB Begin list.
RTLE End of list.
RTDOTE Dotted pair list.
RTNONE End of list.

When DXF group codes are used, group 0 must be represented by the result type code RTDXF0. Otherwise, sds_buildlist will think the list has been terminated.

There are four exceptions to the paired-data rule: the -3 code, which indicates the start of extended entity data; the rtlb (begin list); rtle (end list); and rtdote (dotted pair list).

Arguments in the sds_buildlist function are paired: ...,TYPE,value,.... Each pair consists of the argument type (such as RTREAL or RTSTR), followed by the value for that item in the list (for example 99.94 or "Einstein"). You may use any number of argument pairs.

The last argument is not a pair and must be 0 (zero) or RTNONE.

When you are done with the list, you must free the list using sds_relrb.

This function returns a pointer to the list; if it is not able to, it returns a NULL pointer. Failure can be due to bad arguments in the list or to a lack of memory.

Example

struct sds_resbuf *listbuf = NULL;

listbuf=sds_buildlist(RTREAL,3.57,RTSHORT,12,RTSTR,"My Cat",RTNONE);

sds_retlist(listbuf);

if(listbuf != NULL)

sds_relrb(listbuf);

Prints:

(3.57 12 "My Cat")

Tell me about...

Programming Overview of SDS™ (Solutions Development System™)

sds_retlist