Programming I version 1.5.3
Programming I C Library
|
Type definitions for Programming I Library. More...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <time.h>
#include <stdbool.h>
Go to the source code of this file.
Data Structures | |
struct | AnyPair |
A pair of Anys. More... | |
struct | AnyTriple |
A tuple of three Anys. More... | |
struct | ByteOption |
A byte option represents either a byte or nothing. More... | |
struct | DoubleOption |
A double option represents either an double or nothing. More... | |
struct | DoublePair |
A pair of doubles. More... | |
struct | DoubleTriple |
Three doubles. More... | |
struct | IntOption |
An integer option represents either an integer or nothing. More... | |
struct | IntPair |
A pair of integers. More... | |
struct | IntTriple |
Three integers. More... | |
struct | StringOption |
A String option represents either a String or nothing. More... | |
struct | StringPair |
A pair of Strings. More... | |
struct | StringTriple |
A tuple of three Strings. More... | |
Typedefs | |
typedef void * | Any |
Represents a pointer to an unspecified type. | |
typedef void * | AnyFn |
Represents a pointer to a function of an unspecified type. | |
typedef unsigned char | Byte |
A Byte represents a single byte of memory. | |
typedef struct ByteOption | ByteOption |
A byte option represents either a byte or nothing. | |
typedef CmpResult(* | Comparator) (ConstAny a, ConstAny b) |
A comparator is a function that take two (comparable) entities, compares them and returns a comparison result. | |
typedef const void * | ConstAny |
Represents a constant pointer to an unspecified type. | |
typedef struct DoubleOption | DoubleOption |
A double option represents either an double or nothing. | |
typedef struct IntOption | IntOption |
An integer option represents either an integer or nothing. | |
typedef char * | String |
A String is a sequence of characters. | |
typedef struct StringOption | StringOption |
A String option represents either a String or nothing. | |
Enumerations | |
enum | CmpResult { LT = -1 , EQ = 0 , GT = 1 } |
The possible results of comparing two comparable entities a and b: More... | |
Functions | |
AnyPair | make_any_pair (Any a, Any b) |
Creates a pair of Anys (on the stack). | |
AnyTriple | make_any_triple (Any a, Any b, Any c) |
Creates a tuple of three Anys (on the stack). | |
ByteOption | make_byte_none (void) |
Creates a non-present byte option (on the stack). | |
ByteOption | make_byte_some (Byte some) |
Creates a byte option for some value (on the stack). | |
DoubleOption | make_double_none (void) |
Creates a non-present double option (on the stack). | |
DoublePair | make_double_pair (double i, double j) |
Creates a pair of doubles (on the stack). | |
DoubleOption | make_double_some (double some) |
Creates a double option for some value (on the stack). | |
DoubleTriple | make_double_triple (double i, double j, double k) |
Creates a pair of doubles (on the stack). | |
IntOption | make_int_none (void) |
Creates a non-present integer option (on the stack). | |
IntPair | make_int_pair (int i, int j) |
Creates a pair of integers (on the stack). | |
IntOption | make_int_some (int some) |
Creates an integer option for some value (on the stack). | |
IntTriple | make_int_triple (int i, int j, int k) |
Creates a pair of integers (on the stack). | |
StringOption | make_string_none (void) |
Creates a non-present String option (on the stack). | |
StringPair | make_string_pair (String a, String b) |
Creates a pair of Strings (on the stack). | |
StringOption | make_string_some (String some) |
Creates a String option for some value (on the stack). | |
StringTriple | make_string_triple (String a, String b, String c) |
Creates a tuple of three Strings (on the stack). | |
Type definitions for Programming I Library.
typedef void* Any |
Represents a pointer to an unspecified type.
A pointer to anything.
typedef void* AnyFn |
Represents a pointer to a function of an unspecified type.
typedef unsigned char Byte |
A Byte represents a single byte of memory.
typedef struct ByteOption ByteOption |
A byte option represents either a byte or nothing.
Option types are typically used with functions that may return a value of the given type or nothing (i.e. the return value is optional). The none
member is true if the value is not present. Otherwise the value can be accessed with the some
member.
Example:
A comparator is a function that take two (comparable) entities, compares them and returns a comparison result.
It is often used with sorting algorithms to encode the sorting criteria.
[in] | a | first entity to compare |
[in] | b | second entity to compare |
typedef const void* ConstAny |
Represents a constant pointer to an unspecified type.
A variable of this type cannot be modified.
typedef struct DoubleOption DoubleOption |
A double option represents either an double or nothing.
Option types are typically used with functions that may return a value of the given type or nothing (i.e. the return value is optional). The none
member is true if the value is not present. Otherwise the value can be accessed with the some
member.
Example:
An integer option represents either an integer or nothing.
Option types are typically used with functions that may return a value of the given type or nothing (i.e. the return value is optional). The none
member is true if the value is not present. Otherwise the value can be accessed with the some
member.
Example:
typedef char* String |
A String is a sequence of characters.
typedef struct StringOption StringOption |
A String option represents either a String or nothing.
Option types are typically used with functions that may return a value of the given type or nothing (i.e. the return value is optional). The none
member is true if the value is not present. Otherwise the value can be accessed with the some
member.
enum CmpResult |
Creates a pair of Anys (on the stack).
[in] | a | first element |
[in] | b | second element |
Creates a tuple of three Anys (on the stack).
[in] | a | first element |
[in] | b | second element |
[in] | c | third element |
ByteOption make_byte_none | ( | void | ) |
Creates a non-present byte option (on the stack).
ByteOption make_byte_some | ( | Byte | some | ) |
Creates a byte option for some value (on the stack).
[in] | some | some value |
DoubleOption make_double_none | ( | void | ) |
Creates a non-present double option (on the stack).
DoublePair make_double_pair | ( | double | i, |
double | j | ||
) |
Creates a pair of doubles (on the stack).
[in] | i | first element |
[in] | j | second element |
DoubleOption make_double_some | ( | double | some | ) |
Creates a double option for some value (on the stack).
[in] | some | some value |
DoubleTriple make_double_triple | ( | double | i, |
double | j, | ||
double | k | ||
) |
Creates a pair of doubles (on the stack).
[in] | i | first element |
[in] | j | second element |
[in] | k | third element |
IntOption make_int_none | ( | void | ) |
Creates a non-present integer option (on the stack).
IntPair make_int_pair | ( | int | i, |
int | j | ||
) |
Creates a pair of integers (on the stack).
[in] | i | first element |
[in] | j | second element |
IntOption make_int_some | ( | int | some | ) |
Creates an integer option for some value (on the stack).
[in] | some | some value |
IntTriple make_int_triple | ( | int | i, |
int | j, | ||
int | k | ||
) |
Creates a pair of integers (on the stack).
[in] | i | first element |
[in] | j | second element |
[in] | k | third element |
StringOption make_string_none | ( | void | ) |
Creates a non-present String option (on the stack).
StringPair make_string_pair | ( | String | a, |
String | b | ||
) |
Creates a pair of Strings (on the stack).
[in] | a | first element |
[in] | b | second element |
StringOption make_string_some | ( | String | some | ) |
Creates a String option for some value (on the stack).
[in] | some | some value |
StringTriple make_string_triple | ( | String | a, |
String | b, | ||
String | c | ||
) |
Creates a tuple of three Strings (on the stack).
[in] | a | first element |
[in] | b | second element |
[in] | c | third element |