Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
5,501 additions
and
1,323 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,225 @@ | ||
# Dale | ||
|
||
[Previous](./2-9-concepts.md) | [Next](./2-11-derivations.md) | ||
|
||
## 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](./2-9-concepts.md) | [Next](./2-11-derivations.md) | ||
|
Oops, something went wrong.