hexsha
stringlengths
40
40
repo
stringlengths
5
105
path
stringlengths
3
173
license
sequence
language
stringclasses
1 value
identifier
stringlengths
1
438
return_type
stringlengths
1
106
original_string
stringlengths
21
40.7k
original_docstring
stringlengths
18
13.4k
docstring
stringlengths
11
3.24k
docstring_tokens
sequence
code
stringlengths
14
20.4k
code_tokens
sequence
short_docstring
stringlengths
0
4.36k
short_docstring_tokens
sequence
comment
sequence
parameters
list
docstring_params
dict
bfdd86bcc4fdc7b2a26b28e28613fb85c31f182f
thp/wipeout-pulse-shipedit
src/libkirk/ec.c
[ "Zlib", "MIT" ]
C
ec_pub_mult
void
void ec_pub_mult(u8 *k, u8 *Q) { struct point ec_temp; //bn_to_mon(k, ec_N, 21); point_mul(&ec_temp, k, &ec_Q); point_from_mon(&ec_temp); //bn_from_mon(k, ec_N, 21); memcpy(Q,ec_temp.x,20); memcpy(Q+20,ec_temp.y,20); }
// Modified from original to support kirk engine use - July 2011
Modified from original to support kirk engine use - July 2011
[ "Modified", "from", "original", "to", "support", "kirk", "engine", "use", "-", "July", "2011" ]
void ec_pub_mult(u8 *k, u8 *Q) { struct point ec_temp; point_mul(&ec_temp, k, &ec_Q); point_from_mon(&ec_temp); memcpy(Q,ec_temp.x,20); memcpy(Q+20,ec_temp.y,20); }
[ "void", "ec_pub_mult", "(", "u8", "*", "k", ",", "u8", "*", "Q", ")", "{", "struct", "point", "ec_temp", ";", "point_mul", "(", "&", "ec_temp", ",", "k", ",", "&", "ec_Q", ")", ";", "point_from_mon", "(", "&", "ec_temp", ")", ";", "memcpy", "(", "Q", ",", "ec_temp", ".", "x", ",", "20", ")", ";", "memcpy", "(", "Q", "+", "20", ",", "ec_temp", ".", "y", ",", "20", ")", ";", "}" ]
Modified from original to support kirk engine use - July 2011
[ "Modified", "from", "original", "to", "support", "kirk", "engine", "use", "-", "July", "2011" ]
[ "//bn_to_mon(k, ec_N, 21);", "//bn_from_mon(k, ec_N, 21);" ]
[ { "param": "k", "type": "u8" }, { "param": "Q", "type": "u8" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "k", "type": "u8", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "Q", "type": "u8", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cafaa1a2486e3d285264dff39c69db273dc2800a
sammer1107/lab0-c
queue.c
[ "BSD-2-Clause" ]
C
q_free
void
void q_free(queue_t *q) { if (!q) return; while (q->head) { list_ele_t *next; next = q->head->next; list_element_free(q->head); q->head = next; } free(q); }
/* Free all storage used by queue */
Free all storage used by queue
[ "Free", "all", "storage", "used", "by", "queue" ]
void q_free(queue_t *q) { if (!q) return; while (q->head) { list_ele_t *next; next = q->head->next; list_element_free(q->head); q->head = next; } free(q); }
[ "void", "q_free", "(", "queue_t", "*", "q", ")", "{", "if", "(", "!", "q", ")", "return", ";", "while", "(", "q", "->", "head", ")", "{", "list_ele_t", "*", "next", ";", "next", "=", "q", "->", "head", "->", "next", ";", "list_element_free", "(", "q", "->", "head", ")", ";", "q", "->", "head", "=", "next", ";", "}", "free", "(", "q", ")", ";", "}" ]
Free all storage used by queue
[ "Free", "all", "storage", "used", "by", "queue" ]
[]
[ { "param": "q", "type": "queue_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "q", "type": "queue_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cafaa1a2486e3d285264dff39c69db273dc2800a
sammer1107/lab0-c
queue.c
[ "BSD-2-Clause" ]
C
q_insert_head
bool
bool q_insert_head(queue_t *q, char *s) { list_ele_t *newh; if (q == NULL) { return false; } newh = list_element_new(s); if (!newh) return false; newh->next = q->head; q->head = newh; if (q->size == 0) { q->tail = q->head; } q->size += 1; return true; }
/* * Attempt to insert element at head of queue. * Return true if successful. * Return false if q is NULL or could not allocate space. * Argument s points to the string to be stored. * The function must explicitly allocate space and copy the string into it. */
Attempt to insert element at head of queue. Return true if successful. Return false if q is NULL or could not allocate space. Argument s points to the string to be stored. The function must explicitly allocate space and copy the string into it.
[ "Attempt", "to", "insert", "element", "at", "head", "of", "queue", ".", "Return", "true", "if", "successful", ".", "Return", "false", "if", "q", "is", "NULL", "or", "could", "not", "allocate", "space", ".", "Argument", "s", "points", "to", "the", "string", "to", "be", "stored", ".", "The", "function", "must", "explicitly", "allocate", "space", "and", "copy", "the", "string", "into", "it", "." ]
bool q_insert_head(queue_t *q, char *s) { list_ele_t *newh; if (q == NULL) { return false; } newh = list_element_new(s); if (!newh) return false; newh->next = q->head; q->head = newh; if (q->size == 0) { q->tail = q->head; } q->size += 1; return true; }
[ "bool", "q_insert_head", "(", "queue_t", "*", "q", ",", "char", "*", "s", ")", "{", "list_ele_t", "*", "newh", ";", "if", "(", "q", "==", "NULL", ")", "{", "return", "false", ";", "}", "newh", "=", "list_element_new", "(", "s", ")", ";", "if", "(", "!", "newh", ")", "return", "false", ";", "newh", "->", "next", "=", "q", "->", "head", ";", "q", "->", "head", "=", "newh", ";", "if", "(", "q", "->", "size", "==", "0", ")", "{", "q", "->", "tail", "=", "q", "->", "head", ";", "}", "q", "->", "size", "+=", "1", ";", "return", "true", ";", "}" ]
Attempt to insert element at head of queue.
[ "Attempt", "to", "insert", "element", "at", "head", "of", "queue", "." ]
[]
[ { "param": "q", "type": "queue_t" }, { "param": "s", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "q", "type": "queue_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "s", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cafaa1a2486e3d285264dff39c69db273dc2800a
sammer1107/lab0-c
queue.c
[ "BSD-2-Clause" ]
C
q_insert_tail
bool
bool q_insert_tail(queue_t *q, char *s) { list_ele_t *new; if (q == NULL) { return false; } new = list_element_new(s); if (!new) return false; if (q->size == 0) { q->head = q->tail = new; } else { q->tail->next = new; q->tail = new; } q->size += 1; return true; }
/* * Attempt to insert element at tail of queue. * Return true if successful. * Return false if q is NULL or could not allocate space. * Argument s points to the string to be stored. * The function must explicitly allocate space and copy the string into it. */
Attempt to insert element at tail of queue. Return true if successful. Return false if q is NULL or could not allocate space. Argument s points to the string to be stored. The function must explicitly allocate space and copy the string into it.
[ "Attempt", "to", "insert", "element", "at", "tail", "of", "queue", ".", "Return", "true", "if", "successful", ".", "Return", "false", "if", "q", "is", "NULL", "or", "could", "not", "allocate", "space", ".", "Argument", "s", "points", "to", "the", "string", "to", "be", "stored", ".", "The", "function", "must", "explicitly", "allocate", "space", "and", "copy", "the", "string", "into", "it", "." ]
bool q_insert_tail(queue_t *q, char *s) { list_ele_t *new; if (q == NULL) { return false; } new = list_element_new(s); if (!new) return false; if (q->size == 0) { q->head = q->tail = new; } else { q->tail->next = new; q->tail = new; } q->size += 1; return true; }
[ "bool", "q_insert_tail", "(", "queue_t", "*", "q", ",", "char", "*", "s", ")", "{", "list_ele_t", "*", "new", ";", "if", "(", "q", "==", "NULL", ")", "{", "return", "false", ";", "}", "new", "=", "list_element_new", "(", "s", ")", ";", "if", "(", "!", "new", ")", "return", "false", ";", "if", "(", "q", "->", "size", "==", "0", ")", "{", "q", "->", "head", "=", "q", "->", "tail", "=", "new", ";", "}", "else", "{", "q", "->", "tail", "->", "next", "=", "new", ";", "q", "->", "tail", "=", "new", ";", "}", "q", "->", "size", "+=", "1", ";", "return", "true", ";", "}" ]
Attempt to insert element at tail of queue.
[ "Attempt", "to", "insert", "element", "at", "tail", "of", "queue", "." ]
[]
[ { "param": "q", "type": "queue_t" }, { "param": "s", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "q", "type": "queue_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "s", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cafaa1a2486e3d285264dff39c69db273dc2800a
sammer1107/lab0-c
queue.c
[ "BSD-2-Clause" ]
C
q_remove_head
bool
bool q_remove_head(queue_t *q, char *sp, size_t bufsize) { if (!q || !q->head) return false; list_ele_t *removed = q->head; snprintf(sp, bufsize, "%s", removed->value); if (q->size == 1) { q->tail = q->head = NULL; } else { q->head = q->head->next; } list_element_free(removed); q->size -= 1; return true; }
/* * Attempt to remove element from head of queue. * Return true if successful. * Return false if queue is NULL or empty. * If sp is non-NULL and an element is removed, copy the removed string to *sp * (up to a maximum of bufsize-1 characters, plus a null terminator.) * The space used by the list element and the string should be freed. */
Attempt to remove element from head of queue. Return true if successful. Return false if queue is NULL or empty. If sp is non-NULL and an element is removed, copy the removed string to *sp (up to a maximum of bufsize-1 characters, plus a null terminator.) The space used by the list element and the string should be freed.
[ "Attempt", "to", "remove", "element", "from", "head", "of", "queue", ".", "Return", "true", "if", "successful", ".", "Return", "false", "if", "queue", "is", "NULL", "or", "empty", ".", "If", "sp", "is", "non", "-", "NULL", "and", "an", "element", "is", "removed", "copy", "the", "removed", "string", "to", "*", "sp", "(", "up", "to", "a", "maximum", "of", "bufsize", "-", "1", "characters", "plus", "a", "null", "terminator", ".", ")", "The", "space", "used", "by", "the", "list", "element", "and", "the", "string", "should", "be", "freed", "." ]
bool q_remove_head(queue_t *q, char *sp, size_t bufsize) { if (!q || !q->head) return false; list_ele_t *removed = q->head; snprintf(sp, bufsize, "%s", removed->value); if (q->size == 1) { q->tail = q->head = NULL; } else { q->head = q->head->next; } list_element_free(removed); q->size -= 1; return true; }
[ "bool", "q_remove_head", "(", "queue_t", "*", "q", ",", "char", "*", "sp", ",", "size_t", "bufsize", ")", "{", "if", "(", "!", "q", "||", "!", "q", "->", "head", ")", "return", "false", ";", "list_ele_t", "*", "removed", "=", "q", "->", "head", ";", "snprintf", "(", "sp", ",", "bufsize", ",", "\"", "\"", ",", "removed", "->", "value", ")", ";", "if", "(", "q", "->", "size", "==", "1", ")", "{", "q", "->", "tail", "=", "q", "->", "head", "=", "NULL", ";", "}", "else", "{", "q", "->", "head", "=", "q", "->", "head", "->", "next", ";", "}", "list_element_free", "(", "removed", ")", ";", "q", "->", "size", "-=", "1", ";", "return", "true", ";", "}" ]
Attempt to remove element from head of queue.
[ "Attempt", "to", "remove", "element", "from", "head", "of", "queue", "." ]
[]
[ { "param": "q", "type": "queue_t" }, { "param": "sp", "type": "char" }, { "param": "bufsize", "type": "size_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "q", "type": "queue_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "sp", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "bufsize", "type": "size_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cafaa1a2486e3d285264dff39c69db273dc2800a
sammer1107/lab0-c
queue.c
[ "BSD-2-Clause" ]
C
q_reverse
void
void q_reverse(queue_t *q) { if (!q) return; list_ele_t *cursor = NULL; q->tail = q->head; while (q->head) { list_ele_t *tmp = q->head->next; q->head->next = cursor; cursor = q->head; q->head = tmp; } q->head = cursor; }
/* * Reverse elements in queue * No effect if q is NULL or empty * This function should not allocate or free any list elements * (e.g., by calling q_insert_head, q_insert_tail, or q_remove_head). * It should rearrange the existing ones. */
Reverse elements in queue No effect if q is NULL or empty This function should not allocate or free any list elements . It should rearrange the existing ones.
[ "Reverse", "elements", "in", "queue", "No", "effect", "if", "q", "is", "NULL", "or", "empty", "This", "function", "should", "not", "allocate", "or", "free", "any", "list", "elements", ".", "It", "should", "rearrange", "the", "existing", "ones", "." ]
void q_reverse(queue_t *q) { if (!q) return; list_ele_t *cursor = NULL; q->tail = q->head; while (q->head) { list_ele_t *tmp = q->head->next; q->head->next = cursor; cursor = q->head; q->head = tmp; } q->head = cursor; }
[ "void", "q_reverse", "(", "queue_t", "*", "q", ")", "{", "if", "(", "!", "q", ")", "return", ";", "list_ele_t", "*", "cursor", "=", "NULL", ";", "q", "->", "tail", "=", "q", "->", "head", ";", "while", "(", "q", "->", "head", ")", "{", "list_ele_t", "*", "tmp", "=", "q", "->", "head", "->", "next", ";", "q", "->", "head", "->", "next", "=", "cursor", ";", "cursor", "=", "q", "->", "head", ";", "q", "->", "head", "=", "tmp", ";", "}", "q", "->", "head", "=", "cursor", ";", "}" ]
Reverse elements in queue No effect if q is NULL or empty This function should not allocate or free any list elements (e.g., by calling q_insert_head, q_insert_tail, or q_remove_head).
[ "Reverse", "elements", "in", "queue", "No", "effect", "if", "q", "is", "NULL", "or", "empty", "This", "function", "should", "not", "allocate", "or", "free", "any", "list", "elements", "(", "e", ".", "g", ".", "by", "calling", "q_insert_head", "q_insert_tail", "or", "q_remove_head", ")", "." ]
[]
[ { "param": "q", "type": "queue_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "q", "type": "queue_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
cafaa1a2486e3d285264dff39c69db273dc2800a
sammer1107/lab0-c
queue.c
[ "BSD-2-Clause" ]
C
q_sort
void
void q_sort(queue_t *q) { if (!q || !q->head) return; q->head = merge_sort_list(q->head); // update tail q->tail = q->head; while (q->tail->next) { q->tail = q->tail->next; } }
/* * Sort elements of queue in ascending order * No effect if q is NULL or empty. In addition, if q has only one * element, do nothing. */
Sort elements of queue in ascending order No effect if q is NULL or empty. In addition, if q has only one element, do nothing.
[ "Sort", "elements", "of", "queue", "in", "ascending", "order", "No", "effect", "if", "q", "is", "NULL", "or", "empty", ".", "In", "addition", "if", "q", "has", "only", "one", "element", "do", "nothing", "." ]
void q_sort(queue_t *q) { if (!q || !q->head) return; q->head = merge_sort_list(q->head); q->tail = q->head; while (q->tail->next) { q->tail = q->tail->next; } }
[ "void", "q_sort", "(", "queue_t", "*", "q", ")", "{", "if", "(", "!", "q", "||", "!", "q", "->", "head", ")", "return", ";", "q", "->", "head", "=", "merge_sort_list", "(", "q", "->", "head", ")", ";", "q", "->", "tail", "=", "q", "->", "head", ";", "while", "(", "q", "->", "tail", "->", "next", ")", "{", "q", "->", "tail", "=", "q", "->", "tail", "->", "next", ";", "}", "}" ]
Sort elements of queue in ascending order No effect if q is NULL or empty.
[ "Sort", "elements", "of", "queue", "in", "ascending", "order", "No", "effect", "if", "q", "is", "NULL", "or", "empty", "." ]
[ "// update tail" ]
[ { "param": "q", "type": "queue_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "q", "type": "queue_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }