Module stack_graphs::c [−][src]
Expand description
Defines a C API for working with stack graphs in other languages.
Structs
Connects two nodes in a stack graph.
A source file that we have extracted stack graph data from.
An array of all of the files in a stack graph. File handles are indices into this array. There will never be a valid file at index 0; a handle with the value 0 represents a missing file.
Implements a phased forward partial path stitching algorithm.
Implements a phased forward path-stitching algorithm.
A node in a stack graph.
Uniquely identifies a node in a stack graph.
An array of all of the nodes in a stack graph. Node handles are indices into this array. There will never be a valid node at index 0; a handle with the value 0 represents a missing node.
A portion of a name-binding path.
Manages the state of a collection of partial paths to be used in the path-stitching algorithm.
Contains a “database” of partial paths.
Details about one of the edges in a partial path
The edges in a path keep track of precedence information so that we can correctly handle shadowed definitions.
An element of a partial path edge list.
The array of all of the partial path edge list content in a partial path arena.
A list of paths found by the path-finding algorithm.
An array of all of the partial paths in a partial path database. Partial path handles are indices into this array. There will never be a valid partial path at index 0; a handle with the value 0 represents a missing partial path.
A pattern that might match against a scope stack. Consists of a (possibly empty) list of exported scopes, along with an optional scope stack variable.
An element of a partial scope stack.
The array of all of the partial scope stack content in a partial path arena.
A symbol with an unknown, but possibly empty, list of exported scopes attached to it.
A pattern that might match against a symbol stack. Consists of a (possibly empty) list of partial scoped symbols.
An element of a partial symbol stack.
The array of all of the partial symbol stack content in a partial path arena.
A sequence of edges from a stack graph. A complete path represents a full name binding in a source language.
Manages the state of a collection of paths built up as part of the path-finding algorithm.
Details about one of the edges in a name-binding path
The edges in a path keep track of precedence information so that we can correctly handle shadowed definitions.
An element of a path edge list.
The array of all of the path edge list content in a path arena.
A list of paths found by the path-finding algorithm.
A sequence of exported scopes, used to pass name-binding context around a stack graph.
An element of a scope stack.
The array of all of the scope stack content in a path arena.
A symbol with a possibly empty list of exported scopes attached to it.
Contains all of the nodes and edges that make up a stack graph.
A name that we are trying to resolve using stack graphs.
A sequence of symbols that describe what we are currently looking for while in the middle of the path-finding algorithm.
An element of a symbol stack.
The array of all of the symbol stack content in a path arena.
An array of all of the symbols in a stack graph. Symbol handles are indices into this array. There will never be a valid symbol at index 0; a handle with the value 0 represents a missing symbol.
Enums
Describes in which direction the content of a deque is stored in memory.
The different kinds of node that can appear in a stack graph.
Constants
The handle of the singleton “jump to scope” node.
The local_id of the singleton “jump to scope” node.
The handle of an empty list.
The handle of the singleton root node.
The local_id of the singleton root node.
Functions
Frees a forward path stitcher.
Creates a new forward partial path stitcher that is “seeded” with a set of starting stack graph nodes.
Runs the next phase of the algorithm. We will have built up a set of incomplete partial paths
during the previous phase. Before calling this function, you must ensure that db
contains
all of the possible partial paths that we might want to extend any of those candidate partial
paths with.
Frees a forward path stitcher.
Creates a new forward path stitcher that is “seeded” with a set of starting stack graph nodes.
Runs the next phase of the path-stitching algorithm. We will have built up a set of
incomplete paths during the previous phase. Before calling this function, you must
ensure that db
contains all of the possible partial paths that we might want to extend
any of those paths with.
Adds new partial path edge lists to the partial path arena. count
is the number of partial
path edge lists you want to create. The content of each partial path edge list comes from two
arrays. The lengths
array must have count
elements, and provides the number of edges in
each partial path edge list. The edges
array contains the contents of each of these partial
path edge lists in one contiguous array. Its length must be the sum of all of the counts in
the lengths
array.
Adds new partial scope stacks to the partial path arena. count
is the number of partial
scope stacks you want to create. The content of each partial scope stack comes from three
arrays. The lengths
array must have count
elements, and provides the number of scopes in
each scope stack. The scopes
array contains the contents of each of these scope stacks in
one contiguous array. Its length must be the sum of all of the counts in the lengths
array.
The variables
array must have count
elements, and provides the optional scope stack
variable for each partial scope stack.
Adds new partial symbol stacks to the partial path arena. count
is the number of partial
symbol stacks you want to create. The content of each partial symbol stack comes from two
arrays. The lengths
array must have count
elements, and provides the number of symbols in
each partial symbol stack. The symbols
array contains the contents of each of these partial
symbol stacks in one contiguous array. Its length must be the sum of all of the counts in the
lengths
array. The variables
array must have count
elements, and provides the optional
symbol stack variable for each partial symbol stack.
Finds all partial paths in a file that are productive and as complete as possible, placing
the result into the partial_path_list
output parameter. You must free the path list when you
are done with it by calling sg_partial_path_list_done
.
Frees a path arena, and all of its contents.
Creates a new, initially empty partial path arena.
Returns a reference to the array of partial path edge list content in a partial path arena. The resulting array pointer is only valid until the next call to any function that mutates the partial path arena.
Returns a reference to the array of partial scope stack content in a partial path arena. The resulting array pointer is only valid until the next call to any function that mutates the partial path arena.
Returns a reference to the array of partial symbol stack content in a partial path arena. The resulting array pointer is only valid until the next call to any function that mutates the path arena.
Adds new partial paths to the partial path database. paths
is the array of partial paths
that you want to add; count
is the number of them.
Frees a partial path database, and all of its contents.
Creates a new, initially empty partial path database.
Returns a reference to the array of partial path data in this partial path database. The resulting array pointer is only valid until the next call to any function that mutates the partial path database.
Creates a new, empty sg_partial_path_list.
Adds new path edge lists to the path arena. count
is the number of path edge lists you want
to create. The content of each path edge list comes from two arrays. The lengths
array must
have count
elements, and provides the number of edges in each path edge list. The edges
array contains the contents of each of these path edge lists in one contiguous array. Its
length must be the sum of all of the counts in the lengths
array.
Adds new scope stacks to the path arena. count
is the number of scope stacks you want to
create. The content of each scope stack comes from two arrays. The lengths
array must have
count
elements, and provides the number of scopes in each scope stack. The scopes
array
contains the contents of each of these scope stacks in one contiguous array. Its length must
be the sum of all of the counts in the lengths
array.
Adds new symbol stacks to the path arena. count
is the number of symbol stacks you want to
create. The content of each symbol stack comes from two arrays. The lengths
array must have
count
elements, and provides the number of symbols in each symbol stack. The symbols
array
contains the contents of each of these symbol stacks in one contiguous array. Its length must
be the sum of all of the counts in the lengths
array.
Finds all complete paths reachable from a set of starting nodes, placing the result into the
path_list
output parameter. You must free the path list when you are done with it by calling
sg_path_list_done
.
Frees a path arena, and all of its contents.
Creates a new, initially empty path arena.
Returns a reference to the array of path edge list content in a path arena. The resulting array pointer is only valid until the next call to any function that mutates the path arena.
Returns a reference to the array of scope stack content in a path arena. The resulting array pointer is only valid until the next call to any function that mutates the path arena.
Returns a reference to the array of symbol stack content in a path arena. The resulting array pointer is only valid until the next call to any function that mutates the path arena.
Creates a new, empty sg_path_list.
Adds new edges to the stack graph. You provide an array of struct sg_edges
instances. A
stack graph can contain at most one edge between any two nodes. It is not an error if you try
to add an edge that already exists, but it won’t have any effect on the graph.
Adds new files to the stack graph. You provide all of the file content concatenated together
into a single string, and an array of the lengths of each file. You also provide an output
array, which must have the same size as lengths
. We will place each file’s handle in the
output array.
Adds new symbols to the stack graph. You provide all of the symbol content concatenated
together into a single string, and an array of the lengths of each symbol. You also provide an
output array, which must have the same size as lengths
. We will place each symbol’s handle
in the output array.
Returns a reference to the array of file data in this stack graph. The resulting array pointer is only valid until the next call to any function that mutates the stack graph.
Frees a stack graph, and all of its contents.
Adds new nodes to the stack graph. You provide an array of struct sg_node
instances. You
also provide an output array, which must have the same length as nodes
, in which we will
place each node’s handle in the stack graph.
Creates a new, initially empty stack graph.
Returns a reference to the array of nodes in this stack graph. The resulting array pointer is only valid until the next call to any function that mutates the stack graph.
Returns a reference to the array of symbol data in this stack graph. The resulting array pointer is only valid until the next call to any function that mutates the stack graph.
Type Definitions
A handle to a file in a stack graph. A zero handle represents a missing file.
A handle to a node in a stack graph. A zero handle represents a missing node.
A handle to an element of a partial path edge list. A zero handle represents a missing partial path edge list. A UINT32_MAX handle represents an empty partial path edge list.
A handle to a partial path in a partial path database. A zero handle represents a missing partial path.
A handle to an element of a partial scope stack. A zero handle represents a missing partial scope stack. A UINT32_MAX handle represents an empty partial scope stack.
A handle to an element of a partial symbol stack. A zero handle represents a missing partial symbol stack. A UINT32_MAX handle represents an empty partial symbol stack.
A handle to an element of a path edge list. A zero handle represents a missing path edge list. A UINT32_MAX handle represents an empty path edge list.
A handle to an element of a scope stack. A zero handle represents a missing scope stack. A UINT32_MAX handle represents an empty scope stack.
Represents an unknown list of exported scopes.
A handle to a symbol in a stack graph. A zero handle represents a missing symbol.
A handle to an element of a symbol stack. A zero handle represents a missing symbol stack. A UINT32_MAX handle represents an empty symbol stack.
Represents an unknown list of scoped symbols.