Next: 4.10.39 thd Up: 4.10 Classes Previous: 4.10.37 qr Contents Index
Subsections

- 4.10.38.1 API

##
4.10.38 qs

The qs macros implement operations on a stack. The type of the stack elements and which field of the elements to use are determined by arguments that are passed into the macros. The macros are optimized for speed and code size, which means that there is minimal error checking built in. As a result, care must be taken to assure that these macros are used as intended, or strange things can happen.

### 4.10.38.1 API

qs_head(<qs_type> a_type):

  Input(s):
    a_type:
      Data type for the qs.
  Output(s):
    A data structure that can be used as a qs head.
  Exception(s):
    None.
  Description:
    Generate code for a qs head data structure.

qs_head_initializer(<qs_type> *a_head):

  Input(s):
    a_head:
      Pointer to a qs head.
  Output(s):
    None.
  Exception(s):
    None.
  Description:
    Statically initialize a qs head.

qs_elm(<qs_elm_type> a_type):

  Input(s):
    a_type:
      Data type for the qs elements.
  Output(s):
    A data structure that can be used as a qs element.
  Exception(s):
    None.
  Description:
    Generate code for a qs element data structure.

void qs_new(<qs_type> *a_head):

  Input(s):
    a_head:
      Pointer to a qs head.
  Output(s):
    None.
  Exception(s):
    None.
  Description:
    Constructor.

void qs_elm_new(<qs_elm_type> *a_elm, <field_name> a_field):

  Input(s):
    a_head:
      Pointer to a qs element.
    a_field:
      Field within the qs elements to use.
  Output(s):
    None.
  Exception(s):
    None.
  Description:
    Constructor.

<qs_type> * qs_top(<qs_type> *a_head):

  Input(s):
    a_head:
      Pointer to a qs head.
  Output(s):
    retval:
      Pointer to the top element in the qs.
  Exception(s):
    None.
  Description:
    Return a pointer to the top element in the qs.

<qs_type> * qs_down(<qs_elm_type> *a_elm, <field_name> a_field):

  Input(s):
    a_elm:
      Pointer to a qs element.
    a_field:
      Field within the qs elements to use.
  Output(s):
    retval:
      non-NULL:
        Pointer to the next element in the qs.
      NULL:
        a_elm is the bottom element in the qs.
  Exception(s):
    None.
  Description:
    Return a pointer to the next element in the qs below a_elm.

void qs_push(<qs_type> *a_head, <qs_elm_type> *a_elm, <field_name> a_field):

  Input(s):
    a_head:
      Pointer to a qs head.
    a_elm:
      Pointer to an element.
    a_field:
      Field within the qs elements to use.
  Output(s):
    None.
  Exception(s):
    None.
  Description:
    Push a_elm onto the qs.

void qs_under_push(<qs_elm_type> *a_qselm, <qs_elm_type> *a_elm, <field_name> a_field):

  Input(s):
    a_qselm:
      Pointer to a qs element.
    a_elm:
      Pointer to an element.
    a_field:
      Field within the qs elements to use.
  Output(s):
    None.
  Exception(s):
    None.
  Description:
    Push a_elm under a_qselm.

void qs_pop(<qs_type> *a_head, <field_name> a_field):

  Input(s):
    a_head:
      Pointer to a qs head.
    a_field:
      Field within the qs elements to use.
  Output(s):
    None.
  Exception(s):
    None.
  Description:
    Pop an element off of a_head.

qs_foreach(<qs_elm_type> *a_var, <qs_type> *a_head, <field_name> a_field):

  Input(s):
    a_var:
      The name of a temporary variable to use for iteration.
    a_head:
      Pointer to a qs head.
    a_field:
      Field within the qs elements to use.
  Output(s):
    None.
  Exception(s):
    None.
  Description:
    Iterate down the qs, storing a pointer to each element in a_var along the way.

Next: 4.10.39 thd Up: 4.10 Classes Previous: 4.10.37 qr Contents Index