Welcome to ZestCode’s documentation!
Attention
ZestCode is under heavy development, and we’d greatly appreciate any contributors! Consider joining our Discord Server if you are interested.
ZestCode is a truly open-source framework for the VEX V5. It’s a PROS fork, and exists to address some PROS issues, particularly in reliability, tooling, and community input.
WIP Why ZestCode?
designed to be easy to contribute to
can be built from source
public development discussions and decision making
superior contributor documentation
superior build system
more understandable compiler errors/warnings
faster build times
smarter package management
deterministic builds
FAQ
Acknowledgements
The authors of ZestCode would like to thank the developers of PROS for their years of service, and for paving the way for alternatives like ZestCode to even exist in the first place. We’d also like to thank the developers of vexide, ZestCode wouldn’t exist if not for their feats.
API Reference
-
struct gid_metadata
-
struct linked_list_s_t
Public Members
-
ll_node_s_t *head
-
ll_node_s_t *head
-
struct ll_node_s
-
struct set
- file cobs.h
- #include <stdint.h>
Consistent Overhead Byte Stuffing header
See common/cobs.c for discussion
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
- Copyright
Copyright (c) 2017-2024, Purdue University ACM SIGBots. All rights reserved.
Defines
-
COBS_ENCODE_MEASURE_MAX(src_len)
Functions
- int cobs_encode (uint8_t *restrict dest, const uint8_t *restrict src, const size_t src_len, const uint32_t prefix)
Encodes src in the Consistent Overhead Byte Stuffing algorithm, and writes the result to dest. dest must be sufficiently long. use cobs_encode_measure() to compute the size of the buff or use COBS_ENCODE_MEASURE_MAX(src_len) macro to get the max buffer size needed (e.g. for static allocation)
- Parameters
dest – [out] The location to write the stuffed data to
src – [in] The location of the incoming data
src_len – The length of the source data
prefix – The four character stream identifier
- Returns
The number of bytes written
- size_t cobs_encode_measure (const uint8_t *restrict src, const size_t src_len, const uint32_t prefix)
Same as cobs_encode() but doesn’t write to an output buffer. Used to determine how much space is needed for src.
- Parameters
src – [in] The location of the incoming data
src_len – The length of the source data
prefix – The four character stream identifier
- Returns
The size of src when encoded
- file gid.h
- #include <stdint.h>#include “api.h”
Globally unique Identifer facility header
See common/gid.c for discussion
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
- Copyright
Copyright (c) 2017-2024, Purdue University ACM SIGBots. All rights reserved.
Defines
-
UINT32_WIDTH
-
gid_size_to_words(size)
convert the maximum number of gids into a number of words needed to store the bitmap
Functions
-
void gid_init(struct gid_metadata *const metadata)
Initializes a gid_metadata structure by “freeing” all IDs in the bitmap
- Parameters
metadata – [in] The gid_metadata structure to initialize
-
uint32_t gid_alloc(struct gid_metadata *const metadata)
Allocates a gid from the gid structure and returns it.
- Parameters
metadata – [in] The gid_metadata to record to the gid structure
- Returns
The gid, or 0 if there are no more gids left.
-
void gid_free(struct gid_metadata *const metadata, uint32_t id)
Frees the gid specified from the structure.
- Parameters
metadata – [in] The gid_metadata to free from the gid structure
id – The gid value indicating the metadata’s position in the gid structure
-
bool gid_check(struct gid_metadata *metadata, uint32_t id)
Checks if the gid specified is allocated.
- Parameters
metadata – [in] The gid_metadata to check
id – The gid value indicating the metadata’s position in the gid structure
- Returns
True if the given metadata/id combo is present in the gid structure, false otherwise.
- file linkedlist.h
Typedefs
-
typedef void (*generic_fn_t)(void)
-
typedef void (*linked_list_foreach_fn_t)(ll_node_s_t*, void*)
Functions
-
ll_node_s_t *linked_list_init_func_node(generic_fn_t func)
Initialize a linked list node storing an arbitrary function pointer
- Parameters
func – Function pointer to store in the node
- Returns
A linked list node that stores a function pointer
-
ll_node_s_t *linked_list_init_data_node(void *data)
Initialize a linked list node storing a pointer to arbitrary data
- Parameters
data – [in] Pointer to data
- Returns
A linked list node that stores some data
-
linked_list_s_t *linked_list_init()
Initialize a linked list
- Returns
An initialized linked list
-
void linked_list_prepend_func(linked_list_s_t *list, generic_fn_t func)
Prepend a node containing a function pointer to a linked list
If the provided linked list is NULL, it will be initialized first.
- Parameters
list – [inout] Linked list to which the node will be prepended
func – Function pointer with which to initialize the node
-
void linked_list_prepend_data(linked_list_s_t *list, void *data)
Prepend a node containing some data to a linked list
If the provided linked list is NULL, it will be initialized first.
- Parameters
list – [inout] Linked list to which the node will be prepended
data – [in] Data with which to initialize the node
-
void linked_list_append_func(linked_list_s_t *list, generic_fn_t func)
Append a node containing a function pointer to a linked list
If the provided linked list is NULL, it will be initialized first.
- Parameters
list – [inout] Linked list to which the node will be appended
func – Function pointer with which to initialize the node
-
void linked_list_remove_func(linked_list_s_t *list, generic_fn_t func)
Removes the node containing the given function pointer from the linked list
- Parameters
list – [inout] Linked list from which the node will be removed
func – Function pointer to be removed
-
void linked_list_append_data(linked_list_s_t *list, void *data)
Append a node containing some data to a linked list
If the provided linked list is NULL, it will be initialized first.
- Parameters
list – [inout] Linked list to which the node will be appended
data – Data with which to initialize the node
-
void linked_list_remove_data(linked_list_s_t *list, void *data)
Remove the node containing the given data from the linked list
- Parameters
list – [inout] Linked list from which the node will be removed
data – Data to be removed
-
void linked_list_foreach(linked_list_s_t *list, linked_list_foreach_fn_t, void *extra_data)
Perform a function on every node in a linked list
If the provided linked list is NULL, the function will terminate.
- Parameters
list – Linked list upon which to perform the function
cb – Pointer to a callback function that will be provided the current node as well as some extra data
extra_data – Extra data to pass to the callback function
-
void linked_list_free(linked_list_s_t *list)
Frees a linked_list_s_t, making it no longer a valid list. This does not free any internal data, only the linekd_list structure.
- Parameters
list – List to free
-
typedef void (*generic_fn_t)(void)
- file set.h
- #include <stdbool.h>#include <stddef.h>#include <stdint.h>#include “kapi.h”
Kernel-allocated thread-safe simple sets header
See common/set.c for discussion
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
- Copyright
Copyright (c) 2017-2024, Purdue University ACM SIGBots. All rights reserved.
Functions
-
void set_initialize(struct set *const set)
Initializes a a set.
- Parameters
set – A pointer to a set structure
-
bool set_add(struct set *const set, uint32_t item)
Adds item to the set if it didn’t already exist
- Parameters
set – A pointer to the set structure
item – Item to add to the set
- Returns
Ttrue if the item was added to the set or was already present
-
bool set_rm(struct set *const set, uint32_t item)
Removes an item from the set
- Parameters
set – A pointer to the set structure
item – The item to remove
- Returns
True if the item was removed (or was already not present)
-
bool set_contains(struct set *set, uint32_t item)
Checks if the set contains an item
- Parameters
set – A pointer to the set structure
item – The item to check
- Returns
True if the item is in the set
-
bool list_contains(uint32_t const *const list, const size_t size, const uint32_t item)
Checks if the list contains an item
- Parameters
list – A pointer to a list of words
size – The number of items in the list
item – The item to check
- Returns
True if the item is in the list
- file string.h
Extra string functions header
See common/string.c for discussion
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
- Copyright
Copyright (c) 2017-2024, Purdue University ACM SIGBots. All rights reserved.
Functions
-
char *kstrdup(const char *s)
strdup but uses the kernel heap
- Parameters
s – Pointer to the string to duplicate
- Returns
The duplicate string
-
char *kstrndup(const char *s, size_t n)
strndup but uses the kernel heap
- Parameters
s – Pointer to the string to duplicate
n – The number of characters to duplicate
- Returns
The duplicate string
- dir /home/docs/checkouts/readthedocs.org/user_builds/zestcode/checkouts/latest/include/common
- dir /home/docs/checkouts/readthedocs.org/user_builds/zestcode/checkouts/latest/include