Skip to content

Latest commit

 

History

History
225 lines (130 loc) · 4.36 KB

2-10-utility.md

File metadata and controls

225 lines (130 loc) · 4.36 KB

Dale

Previous | Next

2.10 utility

Details

Module: utility

Description

Provides the common functions and macros used by the container and algorithm modules.

Functions

make-type-string

Linkage: extern Returns: bool Parameters:

  • (mc (p MContext)): An MContext.
  • (prefix (p (const char))): The type string prefix.
  • (T (p DNode)): The type node.
  • (buf (p char)): The buffer for the type string.

Writes the prefix, and the internal string representation of the type node, to the provided buffer. If the type node is a token that begins with a digit, then the token's contents are written to the buffer instead.

make-type-string

Linkage: extern Returns: bool Parameters:

  • (mc (p MContext)): An MContext.
  • (prefix (p (const char))): The type string prefix.
  • (T1 (p DNode)): The first type node.
  • (T2 (p DNode)): The second type node.
  • (buf (p char)): The buffer for the type string.

As per the earlier implementation, except that it takes two type nodes.

make-type-string

Linkage: extern Returns: bool Parameters:

  • (mc (p MContext)): An MContext.
  • (prefix (p (const char))): The type string prefix.
  • (T1 (p DNode)): The first type node.
  • (T2 (p DNode)): The second type node.
  • (T3 (p DNode)): The third type node.
  • (buf (p char)): The buffer for the type string.

As per the earlier implementation, except that it takes three type nodes.

make-type-display-string

Linkage: extern Returns: bool Parameters:

  • (mc (p MContext)): An MContext.
  • (prefix (p (const char))): The type display string prefix.
  • (T (p DNode)): The type node.
  • (buf (p char)): The buffer for the type display string.

Similar to make-type-string, except that it adds the display representation (i.e. the one set by way of register-type, if applicable) to the buffer, rather than the internal representation.

make-type-display-string

Linkage: extern Returns: bool Parameters:

  • (mc (p MContext)): An MContext.
  • (prefix (p (const char))): The type display string prefix.
  • (T1 (p DNode)): The first type node.
  • (T2 (p DNode)): The second type node.
  • (buf (p char)): The buffer for the type display string.

As per the earlier implementation, except that it takes two type nodes.

make-type-display-string

Linkage: extern Returns: bool Parameters:

  • (mc (p MContext)): An MContext.
  • (prefix (p (const char))): The type display string prefix.
  • (T1 (p DNode)): The first type node.
  • (T2 (p DNode)): The second type node.
  • (T3 (p DNode)): The third type node.
  • (buf (p char)): The buffer for the type display string.

As per the earlier implementation, except that it takes two type nodes.

Concept macros

Pair

Linkage: extern Parameters:

  • (T1 Type): The first type node.
  • (T2 Type): The second type node.

Expands to a struct definition with two members, named first and second.

Triple

Linkage: extern Parameters:

  • (T1 Type): The first type node.
  • (T2 Type): The second type node.
  • (T3 Type): The third type node.

Expands to a struct definition with three members, named first, second and third.

Macros

def-type-macro

Linkage: extern Parameters:

  • name: The type macro name.

Takes a node as its single argument. Constructs a macro with that name that takes one arbitrary type and expands to the concatenation of that name and the stringification of the type.

Iterator

Linkage: extern Parameters:

  • T: The type node.

Expands to a string that can be used as the Iterator type name for the argument type.

ReverseIterator

Linkage: extern Parameters:

  • T: The type node.

Expands to a string that can be used as the Iterator type name for the argument type.

Pair

Linkage: extern Parameters:

  • T1: The first type node.
  • T2: The second type node.

Expands to the concrete type name of the Pair generated by way of the concept macro.

Triple

Linkage: extern Parameters:

  • T1: The first type node.
  • T2: The second type node.
  • T3: The third type node.

Expands to the concrete type name of the Triple generated by way of the concept macro.

Previous | Next