id
int64
0
79.7k
docstring_tokens
sequence
code_tokens
sequence
fun_name
stringlengths
1
108
repo
stringlengths
7
49
starting
stringclasses
3 values
partition
stringclasses
3 values
__index_level_0__
int64
0
58.8k
0
[ "DMB", "is", "supported", "on", "CM0" ]
[ "'void", "__dmb", "()", "{", "__asm__", "volatile", "(\"dmb\");", "}'" ]
__dmb
PX4/Bootloader
single_line
train
0
1
[ "returns", "1", "if", "the", "lock", "was", "acquired" ]
[ "'uint32_t", "mutex_trylock", "(", "mutex_t", "*", "m", ")", "{", "uint32_t", "status", "=", "1", ";", "/*", "If", "the", "mutex", "is", "unlocked.", "*/", "if", "(", "__ldrex", "(", "m", ")", "==", "MUTEX_UNLOCKED", ")", "{", "/*", "Try", "to", "lock", "it.", "*/", "status", "=", "__strex", "(", "MUTEX_LOCKED", ",", "m", ")", ";", "}", "/*", "Execute", "the", "mysterious", "Data", "Memory", "Barrier", "instruction!", "*/", "__dmb", "()", ";", "/*", "Did", "we", "get", "the", "lock?", "If", "not", "then", "try", "again", "*", "by", "calling", "this", "function", "once", "more.", "*/", "return", "status", "==", "0", ";", "}'" ]
mutex_trylock
PX4/Bootloader
single_line
train
1
2
[ "returns", "0", "if", "no", "more", "work", "needs", "to", "be", "been", "done,", "and", "1", "if", "time", "is", "up", "and", "more", "work", "is", "needed" ]
[ "\"int", "defragLaterStep", "(", "redisDb", "*", "db", ",", "long", "long", "endtime", ")", "{", "unsigned", "int", "iterations", "=", "0", ";", "unsigned", "long", "long", "prev_defragged", "=", "server", ".", "stat_active_defrag_hits", ";", "unsigned", "long", "long", "prev_scanned", "=", "server", ".", "stat_active_defrag_scanned", ";", "long", "long", "key_defragged", ";", "do", "{", "/*", "if", "we're", "not", "continuing", "a", "scan", "from", "the", "last", "call", "or", "loop,", "start", "a", "new", "one", "*/", "if", "(", "!", "defrag_later_cursor", ")", "{", "listNode", "*", "head", "=", "listFirst", "(", "db", "->", "defrag_later", ")", ";", "/*", "Move", "on", "to", "next", "key", "*/", "if", "(", "defrag_later_current_key", ")", "{", "serverAssert", "(", "defrag_later_current_key", "==", "head", "->", "value", ")", ";", "listDelNode", "(", "db", "->", "defrag_later", ",", "head", ")", ";", "defrag_later_cursor", "=", "0", ";", "defrag_later_current_key", "=", "NULL", ";", "}", "/*", "stop", "if", "we", "reached", "the", "last", "one.", "*/", "head", "=", "listFirst", "(", "db", "->", "defrag_later", ")", ";", "if", "(", "!", "head", ")", "return", "0", ";", "/*", "start", "a", "new", "key", "*/", "defrag_later_current_key", "=", "head", "->", "value", ";", "defrag_later_cursor", "=", "0", ";", "}", "/*", "each", "time", "we", "enter", "this", "function", "we", "need", "to", "fetch", "the", "key", "from", "the", "dict", "again", "(if", "it", "still", "exists)", "*/", "dictEntry", "*", "de", "=", "dictFind", "(", "db", "->", "dict", ",", "defrag_later_current_key", ")", ";", "key_defragged", "=", "server", ".", "stat_active_defrag_hits", ";", "do", "{", "int", "quit", "=", "0", ";", "if", "(", "defragLaterItem", "(", "de", ",", "&", "defrag_later_cursor", ",", "endtime", ")", ")", "quit", "=", "1", ";", "/*", "time", "is", "up,", "we", "didn't", "finish", "all", "the", "work", "*/", "/*", "Once", "in", "16", "scan", "iterations,", "512", "pointer", "reallocations,", "or", "64", "fields", "*", "(if", "we", "have", "a", "lot", "of", "pointers", "in", "one", "hash", "bucket,", "or", "rehashing),", "*", "check", "if", "we", "reached", "the", "time", "limit.", "*/", "if", "(", "quit", "||", "(", "++", "iterations", ">", "16", "||", "server", ".", "stat_active_defrag_hits", "-", "prev_defragged", ">", "512", "||", "server", ".", "stat_active_defrag_scanned", "-", "prev_scanned", ">", "64", ")", ")", "{", "if", "(", "quit", "||", "ustime", "()", ">", "endtime", ")", "{", "if", "(", "key_defragged", "!=", "server", ".", "stat_active_defrag_hits", ")", "server", ".", "stat_active_defrag_key_hits", "++", ";", "else", "server", ".", "stat_active_defrag_key_misses", "++", ";", "return", "1", ";", "}", "iterations", "=", "0", ";", "prev_defragged", "=", "server", ".", "stat_active_defrag_hits", ";", "prev_scanned", "=", "server", ".", "stat_active_defrag_scanned", ";", "}", "}", "while", "(", "defrag_later_cursor", ")", ";", "if", "(", "key_defragged", "!=", "server", ".", "stat_active_defrag_hits", ")", "server", ".", "stat_active_defrag_key_hits", "++", ";", "else", "server", ".", "stat_active_defrag_key_misses", "++", ";", "}", "while", "(", "1", ")", ";", "}\"" ]
defragLaterStep
repsheet/repsheet-nginx
single_line
train
2
3
[ "returns", "0", "if", "no", "more", "work", "needs", "to", "be", "been", "done,", "and", "1", "if", "time", "is", "up", "and", "more", "work", "is", "needed" ]
[ "'int", "scanLaterStraemListpacks", "(", "robj", "*", "ob", ",", "unsigned", "long", "*", "cursor", ",", "long", "long", "endtime", ",", "long", "long", "*", "defragged", ")", "{", "static", "unsigned", "char", "last", "[", "sizeof", "(", "streamID", ")", "]", ";", "raxIterator", "ri", ";", "long", "iterations", "=", "0", ";", "if", "(", "ob", "->", "type", "!=", "OBJ_STREAM", "||", "ob", "->", "encoding", "!=", "OBJ_ENCODING_STREAM", ")", "{", "*", "cursor", "=", "0", ";", "return", "0", ";", "}", "stream", "*", "s", "=", "ob", "->", "ptr", ";", "raxStart", "(", "&", "ri", ",", "s", "->", "rax", ")", ";", "if", "(", "*", "cursor", "==", "0", ")", "{", "/*", "if", "cursor", "is", "0,", "we", "start", "new", "iteration", "*/", "defragRaxNode", "(", "&", "s", "->", "rax", "->", "head", ")", ";", "/*", "assign", "the", "iterator", "node", "callback", "before", "the", "seek,", "so", "that", "the", "*", "initial", "nodes", "that", "are", "processed", "till", "the", "first", "item", "are", "covered", "*/", "ri", ".", "node_cb", "=", "defragRaxNode", ";", "raxSeek", "(", "&", "ri", ",", "\"^\"", ",", "NULL", ",", "0", ")", ";", "}", "else", "{", "/*", "if", "cursor", "is", "non-zero,", "we", "seek", "to", "the", "static", "\\'last\\'", "*/", "if", "(", "!", "raxSeek", "(", "&", "ri", ",", "\">\"", ",", "last", ",", "sizeof", "(", "last", ")", ")", ")", "{", "*", "cursor", "=", "0", ";", "raxStop", "(", "&", "ri", ")", ";", "return", "0", ";", "}", "/*", "assign", "the", "iterator", "node", "callback", "after", "the", "seek,", "so", "that", "the", "*", "initial", "nodes", "that", "are", "processed", "till", "now", "aren\\'t", "covered", "*/", "ri", ".", "node_cb", "=", "defragRaxNode", ";", "}", "(", "*", "cursor", ")", "++", ";", "while", "(", "raxNext", "(", "&", "ri", ")", ")", "{", "void", "*", "newdata", "=", "activeDefragAlloc", "(", "ri", ".", "data", ")", ";", "if", "(", "newdata", ")", "raxSetData", "(", "ri", ".", "node", ",", "ri", ".", "data", "=", "newdata", ")", ",", "(", "*", "defragged", ")", "++", ";", "server", ".", "stat_active_defrag_scanned", "++", ";", "if", "(", "++", "iterations", ">", "128", ")", "{", "if", "(", "ustime", "()", ">", "endtime", ")", "{", "serverAssert", "(", "ri", ".", "key_len", "==", "sizeof", "(", "last", ")", ")", ";", "memcpy", "(", "last", ",", "ri", ".", "key", ",", "ri", ".", "key_len", ")", ";", "raxStop", "(", "&", "ri", ")", ";", "return", "1", ";", "}", "iterations", "=", "0", ";", "}", "}", "raxStop", "(", "&", "ri", ")", ";", "*", "cursor", "=", "0", ";", "return", "0", ";", "}'" ]
scanLaterStraemListpacks
repsheet/repsheet-nginx
single_line
train
3
4
[ "Defrag", "a", "dict", "with", "sds", "key", "and", "optional", "value", "(either", "ptr,", "sds", "or", "robj", "string)" ]
[ "'long", "activeDefragSdsDict", "(", "dict", "*", "d", ",", "int", "val_type", ")", "{", "dictIterator", "*", "di", ";", "dictEntry", "*", "de", ";", "long", "defragged", "=", "0", ";", "di", "=", "dictGetIterator", "(", "d", ")", ";", "while", "(", "(", "de", "=", "dictNext", "(", "di", ")", ")", "!=", "NULL", ")", "{", "sds", "sdsele", "=", "dictGetKey", "(", "de", ")", ",", "<type", "ref=\"prev\"/>", "newsds", ";", "if", "(", "(", "newsds", "=", "activeDefragSds", "(", "sdsele", ")", ")", ")", "de", "->", "key", "=", "newsds", ",", "defragged", "++", ";", "/*", "defrag", "the", "value", "*/", "if", "(", "val_type", "==", "DEFRAG_SDS_DICT_VAL_IS_SDS", ")", "{", "sdsele", "=", "dictGetVal", "(", "de", ")", ";", "if", "(", "(", "newsds", "=", "activeDefragSds", "(", "sdsele", ")", ")", ")", "de", "->", "v", ".", "val", "=", "newsds", ",", "defragged", "++", ";", "}", "<if", "type=\"elseif\">", "else", "if", "(", "val_type", "==", "DEFRAG_SDS_DICT_VAL_IS_STROB", ")", "{", "robj", "*", "newele", ",", "<type", "ref=\"prev\">", "*", "ele", "=", "dictGetVal", "(", "de", ")", ";", "if", "(", "(", "newele", "=", "activeDefragStringOb", "(", "ele", ",", "&", "defragged", ")", ")", ")", "de", "->", "v", ".", "val", "=", "newele", ";", "}", "<if", "type=\"elseif\">", "else", "if", "(", "val_type", "==", "DEFRAG_SDS_DICT_VAL_VOID_PTR", ")", "{", "void", "*", "newptr", ",", "<type", "ref=\"prev\">", "*", "ptr", "=", "dictGetVal", "(", "de", ")", ";", "if", "(", "(", "newptr", "=", "activeDefragAlloc", "(", "ptr", ")", ")", ")", "de", "->", "v", ".", "val", "=", "newptr", ",", "defragged", "++", ";", "}", "defragged", "+=", "dictIterDefragEntry", "(", "di", ")", ";", "}", "dictReleaseIterator", "(", "di", ")", ";", "return", "defragged", ";", "}'" ]
activeDefragSdsDict
repsheet/repsheet-nginx
single_line
train
4
5
[ "decide", "if", "defrag", "is", "needed,", "and", "at", "what", "CPU", "effort", "to", "invest", "in", "it" ]
[ "'void", "computeDefragCycles", "()", "{", "size_t", "frag_bytes", ";", "float", "frag_pct", "=", "getAllocatorFragmentation", "(", "&", "frag_bytes", ")", ";", "/*", "If", "we\\'re", "not", "already", "running,", "and", "below", "the", "threshold,", "exit.", "*/", "if", "(", "!", "server", ".", "active_defrag_running", ")", "{", "if", "(", "frag_pct", "<", "server", ".", "active_defrag_threshold_lower", "||", "frag_bytes", "<", "server", ".", "active_defrag_ignore_bytes", ")", "return", ";", "}", "/*", "Calculate", "the", "adaptive", "aggressiveness", "of", "the", "defrag", "*/", "int", "cpu_pct", "=", "INTERPOLATE", "(", "frag_pct", ",", "server", ".", "active_defrag_threshold_lower", ",", "server", ".", "active_defrag_threshold_upper", ",", "server", ".", "active_defrag_cycle_min", ",", "server", ".", "active_defrag_cycle_max", ")", ";", "cpu_pct", "=", "LIMIT", "(", "cpu_pct", ",", "server", ".", "active_defrag_cycle_min", ",", "server", ".", "active_defrag_cycle_max", ")", ";", "/*", "We", "allow", "increasing", "the", "aggressiveness", "during", "a", "scan,", "but", "don\\'t", "*", "reduce", "it.", "*/", "if", "(", "!", "server", ".", "active_defrag_running", "||", "cpu_pct", ">", "server", ".", "active_defrag_running", ")", "{", "server", ".", "active_defrag_running", "=", "cpu_pct", ";", "serverLog", "(", "LL_VERBOSE", ",", "\"Starting", "active", "defrag,", "frag=%.0f%%,", "frag_bytes=%zu,", "cpu=%d%%\"", ",", "frag_pct", ",", "frag_bytes", ",", "cpu_pct", ")", ";", "}", "}'" ]
computeDefragCycles
repsheet/repsheet-nginx
single_line
train
5
6
[ "Defrag", "scan", "callback", "for", "the", "main", "db", "dictionary" ]
[ "'void", "defragScanCallback", "(", "void", "*", "privdata", ",", "const", "dictEntry", "*", "de", ")", "{", "long", "defragged", "=", "defragKey", "(", "(", "redisDb", "*", ")", "privdata", ",", "(", "dictEntry", "*", ")", "de", ")", ";", "server", ".", "stat_active_defrag_hits", "+=", "defragged", ";", "if", "(", "defragged", ")", "server", ".", "stat_active_defrag_key_hits", "++", ";", "else", "server", ".", "stat_active_defrag_key_misses", "++", ";", "server", ".", "stat_active_defrag_scanned", "++", ";", "}'" ]
defragScanCallback
repsheet/repsheet-nginx
single_line
train
6
7
[ "returns", "0", "if", "no", "more", "work", "needs", "to", "be", "been", "done,", "and", "1", "if", "time", "is", "up", "and", "more", "work", "is", "needed" ]
[ "'long", "scanLaterList", "(", "robj", "*", "ob", ",", "unsigned", "long", "*", "cursor", ",", "long", "long", "endtime", ",", "long", "long", "*", "defragged", ")", "{", "quicklist", "*", "ql", "=", "ob", "->", "ptr", ";", "quicklistNode", "*", "node", ";", "long", "iterations", "=", "0", ";", "int", "bookmark_failed", "=", "0", ";", "if", "(", "ob", "->", "type", "!=", "OBJ_LIST", "||", "ob", "->", "encoding", "!=", "OBJ_ENCODING_QUICKLIST", ")", "return", "0", ";", "if", "(", "*", "cursor", "==", "0", ")", "{", "/*", "if", "cursor", "is", "0,", "we", "start", "new", "iteration", "*/", "node", "=", "ql", "->", "head", ";", "}", "else", "{", "node", "=", "quicklistBookmarkFind", "(", "ql", ",", "\"_AD\"", ")", ";", "if", "(", "!", "node", ")", "{", "/*", "if", "the", "bookmark", "was", "deleted,", "it", "means", "we", "reached", "the", "end.", "*/", "*", "cursor", "=", "0", ";", "return", "0", ";", "}", "node", "=", "node", "->", "next", ";", "}", "(", "*", "cursor", ")", "++", ";", "while", "(", "node", ")", "{", "(", "*", "defragged", ")", "+=", "activeDefragQuickListNode", "(", "ql", ",", "&", "node", ")", ";", "server", ".", "stat_active_defrag_scanned", "++", ";", "if", "(", "++", "iterations", ">", "128", "&&", "!", "bookmark_failed", ")", "{", "if", "(", "ustime", "()", ">", "endtime", ")", "{", "if", "(", "!", "quicklistBookmarkCreate", "(", "&", "ql", ",", "\"_AD\"", ",", "node", ")", ")", "{", "bookmark_failed", "=", "1", ";", "}", "else", "{", "ob", "->", "ptr", "=", "ql", ";", "/*", "bookmark", "creation", "may", "have", "re-allocated", "the", "quicklist", "*/", "return", "1", ";", "}", "}", "iterations", "=", "0", ";", "}", "node", "=", "node", "->", "next", ";", "}", "quicklistBookmarkDelete", "(", "ql", ",", "\"_AD\"", ")", ";", "*", "cursor", "=", "0", ";", "return", "bookmark_failed", "?", "1", ":", "0", ";", "}'" ]
scanLaterList
repsheet/repsheet-nginx
single_line
train
7
8
[ "Defrag", "a", "list", "of", "sds", "values", "and", "a", "dict", "with", "the", "same", "sds", "keys" ]
[ "'long", "activeDefragSdsListAndDict", "(", "list", "*", "l", ",", "dict", "*", "d", ",", "int", "dict_val_type", ")", "{", "long", "defragged", "=", "0", ";", "sds", "newsds", ",", "<type", "ref=\"prev\"/>", "sdsele", ";", "listNode", "*", "ln", ",", "<type", "ref=\"prev\">", "*", "newln", ";", "dictIterator", "*", "di", ";", "dictEntry", "*", "de", ";", "/*", "Defrag", "the", "list", "and", "it\\'s", "sds", "values", "*/", "for", "(", "ln", "=", "l", "->", "head", ";", "ln", ";", "ln", "=", "ln", "->", "next", ")", "{", "if", "(", "(", "newln", "=", "activeDefragAlloc", "(", "ln", ")", ")", ")", "{", "if", "(", "newln", "->", "prev", ")", "newln", "->", "prev", "->", "next", "=", "newln", ";", "else", "l", "->", "head", "=", "newln", ";", "if", "(", "newln", "->", "next", ")", "newln", "->", "next", "->", "prev", "=", "newln", ";", "else", "l", "->", "tail", "=", "newln", ";", "ln", "=", "newln", ";", "defragged", "++", ";", "}", "sdsele", "=", "ln", "->", "value", ";", "if", "(", "(", "newsds", "=", "activeDefragSds", "(", "sdsele", ")", ")", ")", "{", "/*", "When", "defragging", "an", "sds", "value,", "we", "need", "to", "update", "the", "dict", "key", "*/", "uint64_t", "hash", "=", "dictGetHash", "(", "d", ",", "newsds", ")", ";", "replaceSateliteDictKeyPtrAndOrDefragDictEntry", "(", "d", ",", "sdsele", ",", "newsds", ",", "hash", ",", "&", "defragged", ")", ";", "ln", "->", "value", "=", "newsds", ";", "defragged", "++", ";", "}", "}", "/*", "Defrag", "the", "dict", "values", "(keys", "were", "already", "handled)", "*/", "di", "=", "dictGetIterator", "(", "d", ")", ";", "while", "(", "(", "de", "=", "dictNext", "(", "di", ")", ")", "!=", "NULL", ")", "{", "if", "(", "dict_val_type", "==", "DEFRAG_SDS_DICT_VAL_IS_SDS", ")", "{", "sds", "newsds", ",", "<type", "ref=\"prev\"/>", "sdsele", "=", "dictGetVal", "(", "de", ")", ";", "if", "(", "(", "newsds", "=", "activeDefragSds", "(", "sdsele", ")", ")", ")", "de", "->", "v", ".", "val", "=", "newsds", ",", "defragged", "++", ";", "}", "<if", "type=\"elseif\">", "else", "if", "(", "dict_val_type", "==", "DEFRAG_SDS_DICT_VAL_IS_STROB", ")", "{", "robj", "*", "newele", ",", "<type", "ref=\"prev\">", "*", "ele", "=", "dictGetVal", "(", "de", ")", ";", "if", "(", "(", "newele", "=", "activeDefragStringOb", "(", "ele", ",", "&", "defragged", ")", ")", ")", "de", "->", "v", ".", "val", "=", "newele", ",", "defragged", "++", ";", "}", "<if", "type=\"elseif\">", "else", "if", "(", "dict_val_type", "==", "DEFRAG_SDS_DICT_VAL_VOID_PTR", ")", "{", "void", "*", "newptr", ",", "<type", "ref=\"prev\">", "*", "ptr", "=", "dictGetVal", "(", "de", ")", ";", "if", "(", "(", "newptr", "=", "activeDefragAlloc", "(", "ptr", ")", ")", ")", "ln", "->", "value", "=", "newptr", ",", "defragged", "++", ";", "}", "defragged", "+=", "dictIterDefragEntry", "(", "di", ")", ";", "}", "dictReleaseIterator", "(", "di", ")", ";", "return", "defragged", ";", "}'" ]
activeDefragSdsListAndDict
repsheet/repsheet-nginx
single_line
train
8
9
[ "!PARAMS_IN_REGISTRY", "around", "whole", "file" ]
[ "'void", "d_r_config_init", "(", "void", ")", "{", "}'" ]
d_r_config_init
DynamoRIO/drmemory
single_line
train
9
10
[ "Convert", "tm", "structure", "and", "offset", "into", "julian", "day", "and", "seconds" ]
[ "'static", "int", "julian_adj", "(", "const", "struct", "tm", "*", "tm", ",", "int", "off_day", ",", "long", "offset_sec", ",", "long", "*", "pday", ",", "int", "*", "psec", ")", "{", "int", "offset_hms", ",", "<type", "ref=\"prev\"/>", "offset_day", ";", "long", "time_jd", ";", "int", "time_year", ",", "<type", "ref=\"prev\"/>", "time_month", ",", "<type", "ref=\"prev\"/>", "time_day", ";", "/*", "split", "offset", "into", "days", "and", "day", "seconds", "*/", "offset_day", "=", "offset_sec", "/", "SECS_PER_DAY", ";", "/*", "Avoid", "sign", "issues", "with", "%", "operator", "*/", "offset_hms", "=", "offset_sec", "-", "(", "offset_day", "*", "SECS_PER_DAY", ")", ";", "offset_day", "+=", "off_day", ";", "/*", "Add", "current", "time", "seconds", "to", "offset", "*/", "offset_hms", "+=", "tm", "->", "tm_hour", "*", "3600", "+", "tm", "->", "tm_min", "*", "60", "+", "tm", "->", "tm_sec", ";", "/*", "Adjust", "day", "seconds", "if", "overflow", "*/", "if", "(", "offset_hms", ">=", "SECS_PER_DAY", ")", "{", "offset_day", "++", ";", "offset_hms", "-=", "SECS_PER_DAY", ";", "}", "<if", "type=\"elseif\">", "else", "if", "(", "offset_hms", "<", "0", ")", "{", "offset_day", "--", ";", "offset_hms", "+=", "SECS_PER_DAY", ";", "}", "/*", "*", "Convert", "date", "of", "time", "structure", "into", "a", "Julian", "day", "number.", "*/", "time_year", "=", "tm", "->", "tm_year", "+", "1900", ";", "time_month", "=", "tm", "->", "tm_mon", "+", "1", ";", "time_day", "=", "tm", "->", "tm_mday", ";", "time_jd", "=", "date_to_julian", "(", "time_year", ",", "time_month", ",", "time_day", ")", ";", "/*", "Work", "out", "Julian", "day", "of", "new", "date", "*/", "time_jd", "+=", "offset_day", ";", "if", "(", "time_jd", "<", "0", ")", "return", "0", ";", "*", "pday", "=", "time_jd", ";", "*", "psec", "=", "offset_hms", ";", "return", "1", ";", "}'" ]
julian_adj
jens-maus/amissl
single_line
train
10
11
[ "Returns", "the", "length", "in", "characters", "of", "the", "last", "element", "of", "a", "path" ]
[ "'size_t", "nameonlylength", "(", "const", "char", "*", "s", ")", "{", "size_t", "j", ",", "<type", "ref=\"prev\"/>", "len", "=", "strlen", "(", "s", ")", ";", "for", "(", "j", "=", "len", ";", "j", "!=", "(", "size_t", ")", "-", "1", ";", "j", "--", ")", "if", "(", "(", "s", "[", "j", "]", "==", "\\'\\\\\\\\\\'", ")", "||", "(", "s", "[", "j", "]", "==", "\\':\\'", ")", "||", "(", "s", "[", "j", "]", "==", "\\'/\\'", ")", ")", "return", "len", "-", "j", "-", "1", ";", "return", "len", ";", "}'" ]
nameonlylength
STJr/SRB2
double_slash
train
11
12
[ "Functions", "cut", "and", "pasted", "from", "Doomatic", ":)" ]
[ "'void", "nameonly", "(", "char", "*", "s", ")", "{", "size_t", "j", ",", "<type", "ref=\"prev\"/>", "len", ";", "void", "*", "ns", ";", "for", "(", "j", "=", "strlen", "(", "s", ")", ";", "j", "!=", "(", "size_t", ")", "-", "1", ";", "j", "--", ")", "if", "(", "(", "s", "[", "j", "]", "==", "\\'\\\\\\\\\\'", ")", "||", "(", "s", "[", "j", "]", "==", "\\':\\'", ")", "||", "(", "s", "[", "j", "]", "==", "\\'/\\'", ")", ")", "{", "ns", "=", "&", "(", "s", "[", "j", "+", "1", "]", ")", ";", "len", "=", "strlen", "(", "ns", ")", ";", "#", "if", "0", "M_Memcpy(s,", "ns,", "len+1);", "#", "else", "memmove", "(", "s", ",", "ns", ",", "len", "+", "1", ")", ";", "#", "endif", "return", ";", "}", "}'" ]
nameonly
STJr/SRB2
double_slash
train
12
13
[ "convert", "char", ">", "6bit", "value" ]
[ "'static", "inline", "uint32_t", "b64val", "(", "char", "c", ")", "{", "if", "(", "\\'A\\'", "<=", "c", "&&", "c", "<=", "\\'Z\\'", ")", "return", "c", "-", "\\'A\\'", "+", "0", ";", "<if", "type=\"elseif\">", "else", "if", "(", "\\'a\\'", "<=", "c", "&&", "c", "<=", "\\'z\\'", ")", "return", "c", "-", "\\'a\\'", "+", "26", ";", "<if", "type=\"elseif\">", "else", "if", "(", "\\'0\\'", "<=", "c", "&&", "c", "<=", "\\'9\\'", ")", "return", "c", "-", "\\'0\\'", "+", "52", ";", "<if", "type=\"elseif\">", "else", "if", "(", "\\'+\\'", "==", "c", ")", "return", "62", ";", "<if", "type=\"elseif\">", "else", "if", "(", "\\'/\\'", "==", "c", ")", "return", "63", ";", "<if", "type=\"elseif\">", "else", "if", "(", "\\'=\\'", "==", "c", ")", "return", "1", "<<", "24", ";", "/*", "special", "trick", "*/", "else", "return", "0", ";", "}'" ]
b64val
creytiv/rem
single_line
train
13
14
[ "Decode", "a", "Base64", "encoded", "string" ]
[ "'int", "base64_decode", "(", "const", "char", "*", "in", ",", "size_t", "ilen", ",", "uint8_t", "*", "out", ",", "size_t", "*", "olen", ")", "{", "const", "char", "*", "in_end", "=", "in", "+", "ilen", ";", "const", "uint8_t", "*", "o", "=", "out", ";", "if", "(", "!", "in", "||", "!", "out", "||", "!", "olen", ")", "return", "EINVAL", ";", "if", "(", "*", "olen", "<", "3", "*", "(", "ilen", "/", "4", ")", ")", "return", "EOVERFLOW", ";", "for", "(", ";", "in", "+", "3", "<", "in_end", ";", ")", "{", "uint32_t", "v", ";", "v", "=", "b64val", "(", "*", "in", "++", ")", "<<", "18", ";", "v", "|=", "b64val", "(", "*", "in", "++", ")", "<<", "12", ";", "v", "|=", "b64val", "(", "*", "in", "++", ")", "<<", "6", ";", "v", "|=", "b64val", "(", "*", "in", "++", ")", "<<", "0", ";", "*", "out", "++", "=", "v", ">>", "16", ";", "if", "(", "!", "(", "v", "&", "(", "1", "<<", "30", ")", ")", ")", "*", "out", "++", "=", "(", "v", ">>", "8", ")", "&", "0xff", ";", "if", "(", "!", "(", "v", "&", "(", "1", "<<", "24", ")", ")", ")", "*", "out", "++", "=", "(", "v", ">>", "0", ")", "&", "0xff", ";", "}", "*", "olen", "=", "out", "-", "o", ";", "return", "0", ";", "}'" ]
base64_decode
creytiv/rem
multi_line
train
14
15
[ "Base64", "encode", "a", "buffer" ]
[ "\"int", "base64_encode", "(", "const", "uint8_t", "*", "in", ",", "size_t", "ilen", ",", "char", "*", "out", ",", "size_t", "*", "olen", ")", "{", "const", "uint8_t", "*", "in_end", "=", "in", "+", "ilen", ";", "const", "char", "*", "o", "=", "out", ";", "if", "(", "!", "in", "||", "!", "out", "||", "!", "olen", ")", "return", "EINVAL", ";", "if", "(", "*", "olen", "<", "4", "*", "(", "(", "ilen", "+", "2", ")", "/", "3", ")", ")", "return", "EOVERFLOW", ";", "for", "(", ";", "in", "<", "in_end", ";", ")", "{", "uint32_t", "v", ";", "int", "pad", "=", "0", ";", "v", "=", "*", "in", "++", "<<", "16", ";", "if", "(", "in", "<", "in_end", ")", "{", "v", "|=", "*", "in", "++", "<<", "8", ";", "}", "else", "{", "++", "pad", ";", "}", "if", "(", "in", "<", "in_end", ")", "{", "v", "|=", "*", "in", "++", "<<", "0", ";", "}", "else", "{", "++", "pad", ";", "}", "*", "out", "++", "=", "b64_table", "[", "v", ">>", "18", "&", "0x3f", "]", ";", "*", "out", "++", "=", "b64_table", "[", "v", ">>", "12", "&", "0x3f", "]", ";", "*", "out", "++", "=", "(", "pad", ">=", "2", ")", "?", "'='", ":", "b64_table", "[", "v", ">>", "6", "&", "0x3f", "]", ";", "*", "out", "++", "=", "(", "pad", ">=", "1", ")", "?", "'='", ":", "b64_table", "[", "v", ">>", "0", "&", "0x3f", "]", ";", "}", "*", "olen", "=", "out", "-", "o", ";", "return", "0", ";", "}\"" ]
base64_encode
creytiv/rem
multi_line
train
15
16
[ "CSE", "with", "explicit", "search", "limit" ]
[ "'TRef", "LJ_FASTCALL", "lj_opt_cselim", "(", "jit_State", "*", "J", ",", "IRRef", "lim", ")", "{", "IRRef", "ref", "=", "J", "->", "chain", "[", "fins", "->", "o", "]", ";", "IRRef2", "op12", "=", "(", "IRRef2", ")", "fins", "->", "op1", "+", "(", "(", "IRRef2", ")", "fins", "->", "op2", "<<", "16", ")", ";", "while", "(", "ref", ">", "lim", ")", "{", "if", "(", "IR", "(", "ref", ")", "->", "op12", "==", "op12", ")", "return", "ref", ";", "ref", "=", "IR", "(", "ref", ")", "->", "prev", ";", "}", "return", "lj_ir_emit", "(", "J", ")", ";", "}'" ]
lj_opt_cselim
tilkinsc/LuaConsole
single_line
train
16
17
[ "Constant", "folding", "for", "64", "bit", "integers" ]
[ "'static", "uint64_t", "kfold_int64arith", "(", "uint64_t", "k1", ",", "uint64_t", "k2", ",", "IROp", "op", ")", "{", "switch", "(", "op", ")", "{", "#", "if", "LJ_64", "||", "LJ_HASFFI", "case", "IR_ADD", ":", "k1", "+=", "k2", ";", "break;", "case", "IR_SUB", ":", "k1", "-=", "k2", ";", "break;", "#", "endif", "#", "if", "LJ_HASFFI", "case", "IR_MUL", ":", "k1", "*=", "k2", ";", "break;", "case", "IR_BAND", ":", "k1", "&=", "k2", ";", "break;", "case", "IR_BOR", ":", "k1", "|=", "k2", ";", "break;", "case", "IR_BXOR", ":", "k1", "^=", "k2", ";", "break;", "#", "endif", "default:", "UNUSED", "(", "k2", ")", ";", "lua_assert", "(", "0", ")", ";", "break;", "}", "return", "k1", ";", "}'" ]
kfold_int64arith
tilkinsc/LuaConsole
single_line
train
17
18
[ "Do", "the", "first", "for", "part" ]
[ "'void", "tag_for", "(", "parser_status", "*", "st", ",", "list", "*", "l", ")", "{", "function_add_code", "(", "st", ",", "\"", "{\\\"", "\"", "onion_dict", "*loopdict=NULL;\\\"", ")", ";", "variable_solve", "(", "st", ",", "tag_value_arg", "(", "l", ",", "3", ")", ",", "\"loopdict\"", ",", "2", ")", ";", "//", "\"", "onion_dict_get_dict(context,", "\\\\\"%s\\\\\");\\\",", "tag_value_arg", "(l,3));", "function_add_code", "(", "st", ",", "\"", "onion_dict", "*tmpcontext=onion_dict_hard_dup(context);\\\"", "\"", "if", "(loopdict){\\\"", "\"", "dict_res", "dr={", ".dict", "=", "tmpcontext,", ".res=res", "};\\\"", "\"", "onion_dict_preorder(loopdict,", "\"", ")", ";", "function_data", "*", "d", "=", "function_new", "(", "st", ",", "NULL", ")", ";", "d", "->", "signature", "=", "\"dict_res", "*dr,", "const", "char", "*key,", "const", "void", "*value,", "int", "flags\"", ";", "function_add_code", "(", "st", ",", "\"", "onion_dict_add(dr->dict,", "\\\\\"%s\\\\\",", "value,", "OD_DUP_VALUE|OD_REPLACE|(flags&OD_TYPE_MASK));\\\"", ",", "tag_value_arg", "(", "l", ",", "1", ")", ")", ";", "function_new", "(", "st", ",", "NULL", ")", ";", "}'" ]
tag_for
davidmoreno/onion
double_slash
train
18
19
[ "Include", "an", "external", "html" ]
[ "'void", "tag_include", "(", "parser_status", "*", "st", ",", "list", "*", "l", ")", "{", "assert", "(", "st", "!=", "NULL", ")", ";", "//", "Tell", "coverty", "that", "at", "function_new", "it", "will", "keep", "a", "pointer", "to", "the", "original,", "always.", "function_data", "*", "d", "=", "function_new", "(", "st", ",", "\"%s\"", ",", "tag_value_arg", "(", "l", ",", "1", ")", ")", ";", "function_pop", "(", "st", ")", ";", "onion_block_free", "(", "d", "->", "code", ")", ";", "//", "This", "means", "no", "impl", "d", "->", "code", "=", "NULL", ";", "function_add_code", "(", "st", ",", "\"", "%s(context,", "res);\\\"", ",", "d", "->", "id", ")", ";", "}'" ]
tag_include
davidmoreno/onion
double_slash
train
19
20
[ "Loads", "an", "external", "handler", "set" ]
[ "'void", "tag_load", "(", "parser_status", "*", "st", ",", "list", "*", "l", ")", "{", "list_item", "*", "it", "=", "l", "->", "head", "->", "next", ";", "while", "(", "it", ")", "{", "const", "char", "*", "modulename", "=", "(", "(", "tag_token", "*", ")", "it", "->", "data", ")", "->", "data", ";", "//ONION_WARNING(\"Loading", "external", "module", "%s", "not", "implemented", "yet.\",modulename);", "if", "(", "load_external", "(", "modulename", ")", "!=", "0", ")", "{", "ONION_ERROR", "(", "\"%s:%d", "here\"", ",", "st", "->", "infilename", ",", "st", "->", "line", ")", ";", "st", "->", "status", "=", "1", ";", "}", "it", "=", "it", "->", "next", ";", "}", "}'" ]
tag_load
davidmoreno/onion
double_slash
train
20
22
[ "inserts", "\"inst\"", "before", "\"where\"", "(\"inst\"", "can", "be", "a", "chain", "of", "insts)" ]
[ "'void", "instrlist_preinsert", "(", "instrlist_t", "*", "ilist", ",", "instr_t", "*", "where", ",", "instr_t", "*", "inst", ")", "{", "instr_t", "*", "whereprev", ";", "instr_t", "*", "top", "=", "inst", ";", "instr_t", "*", "bot", ";", "if", "(", "where", "==", "NULL", ")", "{", "/*", "if", "where", "is", "NULL", "there", "is", "no", "inst", "to", "send", "for", "a", "\"before\"", "*/", "instrlist_append", "(", "ilist", ",", "inst", ")", ";", "return", ";", "}", "CLIENT_ASSERT", "(", "where", "!=", "NULL", ",", "\"instrlist_preinsert:", "where", "cannot", "be", "NULL\"", ")", ";", "CLIENT_ASSERT", "(", "instr_get_prev", "(", "inst", ")", "==", "NULL", ",", "\"instrlist_preinsert:", "cannot", "add", "middle", "of", "list\"", ")", ";", "whereprev", "=", "instr_get_prev", "(", "where", ")", ";", "check_translation", "(", "ilist", ",", "inst", ")", ";", "while", "(", "instr_get_next", "(", "inst", ")", ")", "{", "inst", "=", "instr_get_next", "(", "inst", ")", ";", "check_translation", "(", "ilist", ",", "inst", ")", ";", "}", "bot", "=", "inst", ";", "if", "(", "whereprev", ")", "{", "instr_set_next", "(", "whereprev", ",", "top", ")", ";", "instr_set_prev", "(", "top", ",", "whereprev", ")", ";", "}", "else", "{", "ilist", "->", "first", "=", "top", ";", "}", "instr_set_next", "(", "bot", ",", "where", ")", ";", "instr_set_prev", "(", "where", ",", "bot", ")", ";", "}'" ]
instrlist_preinsert
DynamoRIO/drmemory
single_line
train
21
23
[ "frees", "the", "Instrs", "in", "the", "instrlist_t", "and", "the", "instrlist_t", "object", "itself" ]
[ "'void", "instrlist_clear_and_destroy", "(", "dcontext_t", "*", "dcontext", ",", "instrlist_t", "*", "ilist", ")", "{", "instrlist_clear", "(", "dcontext", ",", "ilist", ")", ";", "instrlist_destroy", "(", "dcontext", ",", "ilist", ")", ";", "}'" ]
instrlist_clear_and_destroy
DynamoRIO/drmemory
single_line
train
22
24
[ "appends", "inst", "to", "the", "list", "(\"inst\"", "can", "be", "a", "chain", "of", "insts)" ]
[ "'void", "instrlist_append", "(", "instrlist_t", "*", "ilist", ",", "instr_t", "*", "inst", ")", "{", "instr_t", "*", "top", "=", "inst", ";", "instr_t", "*", "bot", ";", "CLIENT_ASSERT", "(", "instr_get_prev", "(", "inst", ")", "==", "NULL", ",", "\"instrlist_append:", "cannot", "add", "middle", "of", "list\"", ")", ";", "check_translation", "(", "ilist", ",", "inst", ")", ";", "while", "(", "instr_get_next", "(", "inst", ")", ")", "{", "inst", "=", "instr_get_next", "(", "inst", ")", ";", "check_translation", "(", "ilist", ",", "inst", ")", ";", "}", "bot", "=", "inst", ";", "if", "(", "ilist", "->", "last", ")", "{", "instr_set_next", "(", "ilist", "->", "last", ",", "top", ")", ";", "instr_set_prev", "(", "top", ",", "ilist", "->", "last", ")", ";", "ilist", "->", "last", "=", "bot", ";", "}", "else", "{", "ilist", "->", "first", "=", "top", ";", "ilist", "->", "last", "=", "bot", ";", "}", "}'" ]
instrlist_append
DynamoRIO/drmemory
single_line
train
23
25
[ "returns", "the", "first", "inst", "in", "the", "list" ]
[ "'instr_t", "*", "instrlist_first", "(", "instrlist_t", "*", "ilist", ")", "{", "return", "ilist", "->", "first", ";", "}'" ]
instrlist_first
DynamoRIO/drmemory
single_line
train
24
26
[ "removes", "\"inst\"", "from", "the", "instrlist_t", "it", "currently", "belongs", "to" ]
[ "'void", "instrlist_remove", "(", "instrlist_t", "*", "ilist", ",", "instr_t", "*", "inst", ")", "{", "if", "(", "instr_get_prev", "(", "inst", ")", ")", "instr_set_next", "(", "instr_get_prev", "(", "inst", ")", ",", "instr_get_next", "(", "inst", ")", ")", ";", "else", "ilist", "->", "first", "=", "instr_get_next", "(", "inst", ")", ";", "if", "(", "instr_get_next", "(", "inst", ")", ")", "instr_set_prev", "(", "instr_get_next", "(", "inst", ")", ",", "instr_get_prev", "(", "inst", ")", ")", ";", "else", "ilist", "->", "last", "=", "instr_get_prev", "(", "inst", ")", ";", "instr_set_prev", "(", "inst", ",", "NULL", ")", ";", "instr_set_next", "(", "inst", ",", "NULL", ")", ";", "}'" ]
instrlist_remove
DynamoRIO/drmemory
single_line
train
25
27
[ "frees", "the", "Instrs", "in", "the", "instrlist_t" ]
[ "'void", "instrlist_clear", "(", "dcontext_t", "*", "dcontext", ",", "instrlist_t", "*", "ilist", ")", "{", "instr_t", "*", "instr", ";", "while", "(", "NULL", "!=", "(", "instr", "=", "instrlist_first", "(", "ilist", ")", ")", ")", "{", "instrlist_remove", "(", "ilist", ",", "instr", ")", ";", "instr_destroy", "(", "dcontext", ",", "instr", ")", ";", "}", "}'" ]
instrlist_clear
DynamoRIO/drmemory
single_line
train
26
28
[ "returns", "the", "first", "app", "(nonmeta)", "inst", "in", "the", "list" ]
[ "'instr_t", "*", "instrlist_first_app", "(", "instrlist_t", "*", "ilist", ")", "{", "instr_t", "*", "first", "=", "ilist", "->", "first", ";", "if", "(", "first", "==", "NULL", ")", "return", "NULL", ";", "if", "(", "instr_is_app", "(", "first", ")", ")", "return", "first", ";", "return", "instr_get_next_app", "(", "first", ")", ";", "}'" ]
instrlist_first_app
DynamoRIO/drmemory
single_line
train
27
29
[ "frees", "the", "instrlist_t", "object" ]
[ "'void", "instrlist_destroy", "(", "dcontext_t", "*", "dcontext", ",", "instrlist_t", "*", "ilist", ")", "{", "CLIENT_ASSERT", "(", "ilist", "->", "first", "==", "NULL", "&&", "ilist", "->", "last", "==", "NULL", ",", "\"instrlist_destroy:", "list", "not", "empty\"", ")", ";", "heap_free", "(", "dcontext", ",", "ilist", ",", "sizeof", "(", "instrlist_t", ")", "HEAPACCT", "(", "ACCT_IR", ")", ")", ";", "}'" ]
instrlist_destroy
DynamoRIO/drmemory
single_line
train
28
30
[ "inserts", "\"inst\"", "after", "\"where\"", "(\"inst\"", "can", "be", "a", "chain", "of", "insts)" ]
[ "'void", "instrlist_postinsert", "(", "instrlist_t", "*", "ilist", ",", "instr_t", "*", "where", ",", "instr_t", "*", "inst", ")", "{", "instr_t", "*", "wherenext", ";", "instr_t", "*", "top", "=", "inst", ";", "instr_t", "*", "bot", ";", "if", "(", "where", "==", "NULL", ")", "{", "/*", "if", "where", "is", "NULL", "there", "is", "no", "inst", "to", "send", "for", "an", "\"after\"", "*/", "instrlist_prepend", "(", "ilist", ",", "inst", ")", ";", "return", ";", "}", "CLIENT_ASSERT", "(", "where", "!=", "NULL", ",", "\"instrlist_postinsert:", "where", "cannot", "be", "NULL\"", ")", ";", "CLIENT_ASSERT", "(", "instr_get_prev", "(", "inst", ")", "==", "NULL", ",", "\"instrlist_postinsert:", "cannot", "add", "middle", "of", "list\"", ")", ";", "wherenext", "=", "instr_get_next", "(", "where", ")", ";", "check_translation", "(", "ilist", ",", "inst", ")", ";", "while", "(", "instr_get_next", "(", "inst", ")", ")", "{", "inst", "=", "instr_get_next", "(", "inst", ")", ";", "check_translation", "(", "ilist", ",", "inst", ")", ";", "}", "bot", "=", "inst", ";", "instr_set_next", "(", "where", ",", "top", ")", ";", "instr_set_prev", "(", "top", ",", "where", ")", ";", "if", "(", "wherenext", ")", "{", "instr_set_next", "(", "bot", ",", "wherenext", ")", ";", "instr_set_prev", "(", "wherenext", ",", "bot", ")", ";", "}", "else", "{", "ilist", "->", "last", "=", "bot", ";", "}", "}'" ]
instrlist_postinsert
DynamoRIO/drmemory
single_line
train
29
31
[ "initializes", "an", "instrlist_t", "object" ]
[ "'void", "instrlist_init", "(", "instrlist_t", "*", "ilist", ")", "{", "CLIENT_ASSERT", "(", "ilist", "!=", "NULL", ",", "\"instrlist_create:", "NULL", "parameter\"", ")", ";", "ilist", "->", "first", "=", "ilist", "->", "last", "=", "NULL", ";", "ilist", "->", "flags", "=", "0", ";", "/*", "no", "flags", "set", "*/", "ilist", "->", "translation_target", "=", "NULL", ";", "#", "ifdef", "CLIENT_INTERFACE", "ilist", "->", "fall_through_bb", "=", "NULL", ";", "#", "ifdef", "ARM", "ilist", "->", "auto_pred", "=", "DR_PRED_NONE", ";", "#", "endif", "#", "endif", "}'" ]
instrlist_init
DynamoRIO/drmemory
single_line
train
30
32
[ "returns", "an", "empty", "instrlist_t", "object" ]
[ "'instrlist_t", "*", "instrlist_create", "(", "dcontext_t", "*", "dcontext", ")", "{", "instrlist_t", "*", "ilist", "=", "(", "instrlist_t", "*", ")", "heap_alloc", "(", "dcontext", ",", "sizeof", "(", "instrlist_t", ")", "HEAPACCT", "(", "ACCT_IR", ")", ")", ";", "CLIENT_ASSERT", "(", "ilist", "!=", "NULL", ",", "\"instrlist_create:", "allocation", "error\"", ")", ";", "instrlist_init", "(", "ilist", ")", ";", "return", "ilist", ";", "}'" ]
instrlist_create
DynamoRIO/drmemory
single_line
train
31
33
[ "check", "assumptions", "about", "type", "sizes" ]
[ "'void", "cgc_types_check", "()", "{", "c", "(", "uint8", ",", "1", ")", ";", "c", "(", "sint8", ",", "1", ")", ";", "c", "(", "uint16", ",", "2", ")", ";", "c", "(", "sint16", ",", "2", ")", ";", "c", "(", "uint32", ",", "4", ")", ";", "c", "(", "sint32", ",", "4", ")", ";", "c", "(", "uint64", ",", "8", ")", ";", "c", "(", "sint64", ",", "8", ")", ";", "c", "(", "float32", ",", "4", ")", ";", "c", "(", "float64", ",", "8", ")", ";", "}'" ]
cgc_types_check
trailofbits/cb-multios
double_slash
train
32
34
[ "Debugging", "version", "of", "struct", "sym_fns" ]
[ "'static", "void", "debug_sym_new_init", "(", "struct", "objfile", "*", "objfile", ")", "{", "const", "struct", "debug_sym_fns_data", "*", "debug_data", "=", "objfile_data", "(", "objfile", ",", "symfile_debug_objfile_data_key", ")", ";", "fprintf_filtered", "(", "gdb_stdlog", ",", "\"sf->sym_new_init", "(%s)\\\"", ",", "objfile_debug_name", "(", "objfile", ")", ")", ";", "debug_data", "->", "real_sf", "->", "sym_new_init", "(", "objfile", ")", ";", "}'" ]
debug_sym_new_init
SuperHouse/esp-open-rtos
single_line
train
33
35
[ "Debugging", "version", "of", "struct", "quick_symbol_functions" ]
[ "'static", "int", "debug_qf_has_symbols", "(", "struct", "objfile", "*", "objfile", ")", "{", "const", "struct", "debug_sym_fns_data", "*", "debug_data", "=", "objfile_data", "(", "objfile", ",", "symfile_debug_objfile_data_key", ")", ";", "int", "retval", ";", "retval", "=", "debug_data", "->", "real_sf", "->", "qf", "->", "has_symbols", "(", "objfile", ")", ";", "fprintf_filtered", "(", "gdb_stdlog", ",", "\"qf->has_symbols", "(%s)", "=", "%d\\\"", ",", "objfile_debug_name", "(", "objfile", ")", ",", "retval", ")", ";", "return", "retval", ";", "}'" ]
debug_qf_has_symbols
SuperHouse/esp-open-rtos
single_line
train
34
36
[ "Return", "nonzero", "if", "symfile", "debug", "logging", "is", "installed" ]
[ "'static", "int", "symfile_debug_installed", "(", "struct", "objfile", "*", "objfile", ")", "{", "return", "(", "objfile", "->", "sf", "!=", "NULL", "&&", "objfile_data", "(", "objfile", ",", "symfile_debug_objfile_data_key", ")", "!=", "NULL", ")", ";", "}'" ]
symfile_debug_installed
SuperHouse/esp-open-rtos
single_line
train
35
37
[ "Free", "the", "copy", "of", "sym_fns", "recorded", "in", "the", "registry" ]
[ "'static", "void", "symfile_debug_free_objfile", "(", "struct", "objfile", "*", "objfile", ",", "void", "*", "datum", ")", "{", "xfree", "(", "datum", ")", ";", "}'" ]
symfile_debug_free_objfile
SuperHouse/esp-open-rtos
single_line
train
36
50
[ "Returns", "the", "last", "I2Cx", "Event" ]
[ "'uint32_t", "I2C_GetLastEvent", "(", "I2C_TypeDef", "*", "I2Cx", ")", "{", "uint32_t", "lastevent", "=", "0", ";", "uint32_t", "flag1", "=", "0", ",", "<type", "ref=\"prev\"/>", "flag2", "=", "0", ";", "/*", "Check", "the", "parameters", "*/", "assert_param", "(", "IS_I2C_ALL_PERIPH", "(", "I2Cx", ")", ")", ";", "/*", "Read", "the", "I2Cx", "status", "register", "*/", "flag1", "=", "I2Cx", "->", "SR1", ";", "flag2", "=", "I2Cx", "->", "SR2", ";", "flag2", "=", "flag2", "<<", "16", ";", "/*", "Get", "the", "last", "event", "value", "from", "I2C", "status", "register", "*/", "lastevent", "=", "(", "flag1", "|", "flag2", ")", "&", "FLAG_Mask", ";", "/*", "Return", "status", "*/", "return", "lastevent", ";", "}'" ]
I2C_GetLastEvent
librepilot/LibrePilot
multi_line
train
37
51
[ "Returns", "the", "most", "recent", "received", "data", "by", "the", "I2Cx", "peripheral" ]
[ "'uint8_t", "I2C_ReceiveData", "(", "I2C_TypeDef", "*", "I2Cx", ")", "{", "/*", "Check", "the", "parameters", "*/", "assert_param", "(", "IS_I2C_ALL_PERIPH", "(", "I2Cx", ")", ")", ";", "/*", "Return", "the", "data", "in", "the", "DR", "register", "*/", "return", "(", "uint8_t", ")", "I2Cx", "->", "DR", ";", "}'" ]
I2C_ReceiveData
librepilot/LibrePilot
multi_line
train
38
52
[ "Selects", "the", "specified", "I2C", "NACK", "position", "in", "master", "receiver", "mode" ]
[ "'void", "I2C_NACKPositionConfig", "(", "I2C_TypeDef", "*", "I2Cx", ",", "uint16_t", "I2C_NACKPosition", ")", "{", "/*", "Check", "the", "parameters", "*/", "assert_param", "(", "IS_I2C_ALL_PERIPH", "(", "I2Cx", ")", ")", ";", "assert_param", "(", "IS_I2C_NACK_POSITION", "(", "I2C_NACKPosition", ")", ")", ";", "/*", "Check", "the", "input", "parameter", "*/", "if", "(", "I2C_NACKPosition", "==", "I2C_NACKPosition_Next", ")", "{", "/*", "Next", "byte", "in", "shift", "register", "is", "the", "last", "received", "byte", "*/", "I2Cx", "->", "CR1", "|=", "I2C_NACKPosition_Next", ";", "}", "else", "{", "/*", "Current", "byte", "in", "shift", "register", "is", "the", "last", "received", "byte", "*/", "I2Cx", "->", "CR1", "&=", "I2C_NACKPosition_Current", ";", "}", "}'" ]
I2C_NACKPositionConfig
librepilot/LibrePilot
multi_line
train
39
56
[ "Custom", "free", "function", "for", "copied", "namespace", "nodes" ]
[ "'static", "void", "rxml_xpath_namespace_free", "(", "xmlNsPtr", "xns", ")", "{", "xmlFreeNs", "(", "xns", ")", ";", "}'" ]
rxml_xpath_namespace_free
xml4r/libxml-ruby
single_line
train
40
57
[ "add", "an", "overlay", "to", "a", "particular", "backend" ]
[ "'int", "overlay_config", "(", "BackendDB", "*", "be", ",", "const", "char", "*", "ov", ",", "int", "idx", ",", "BackendInfo", "*", "*", "res", ",", "ConfigReply", "*", "cr", ")", "{", "slap_overinst", "*", "on", "=", "NULL", ",", "<type", "ref=\"prev\">", "*", "on2", "=", "NULL", ",", "<type", "ref=\"prev\">", "*", "*", "prev", ";", "slap_overinfo", "*", "oi", "=", "NULL", ";", "BackendInfo", "*", "bi", "=", "NULL", ";", "if", "(", "res", ")", "*", "res", "=", "NULL", ";", "on", "=", "overlay_find", "(", "ov", ")", ";", "if", "(", "!", "on", ")", "{", "Debug", "(", "LDAP_DEBUG_ANY", ",", "\"overlay", "\\\\\"%s\\\\\"", "not", "found\\\"", ",", "ov", ")", ";", "return", "1", ";", "}", "/*", "If", "this", "is", "the", "first", "overlay", "on", "this", "backend,", "set", "up", "the", "*", "overlay", "info", "structure", "*/", "if", "(", "!", "overlay_is_over", "(", "be", ")", ")", "{", "int", "isglobal", "=", "0", ";", "/*", "NOTE:", "the", "first", "time", "a", "global", "overlay", "is", "configured,", "*", "frontendDB", "gets", "this", "flag;", "it", "is", "used", "later", "by", "overlays", "*", "to", "determine", "if", "they\\'re", "stacked", "on", "top", "of", "the", "frontendDB", "*/", "if", "(", "be", "->", "bd_info", "==", "frontendDB", "->", "bd_info", "||", "SLAP_ISGLOBALOVERLAY", "(", "be", ")", ")", "{", "isglobal", "=", "1", ";", "if", "(", "on", "->", "on_bi", ".", "bi_flags", "&", "SLAPO_BFLAG_DBONLY", ")", "{", "Debug", "(", "LDAP_DEBUG_ANY", ",", "\"overlay_config():", "\"", "\"overlay", "\\\\\"%s\\\\\"", "cannot", "be", "global.\\\"", ",", "ov", ")", ";", "return", "1", ";", "}", "}", "<if", "type=\"elseif\">", "else", "if", "(", "on", "->", "on_bi", ".", "bi_flags", "&", "SLAPO_BFLAG_GLOBONLY", ")", "{", "Debug", "(", "LDAP_DEBUG_ANY", ",", "\"overlay_config():", "\"", "\"overlay", "\\\\\"%s\\\\\"", "can", "only", "be", "global.\\\"", ",", "ov", ")", ";", "return", "1", ";", "}", "oi", "=", "ch_malloc", "(", "sizeof", "(", "slap_overinfo", ")", ")", ";", "oi", "->", "oi_orig", "=", "be", "->", "bd_info", ";", "oi", "->", "oi_bi", "=", "*", "be", "->", "bd_info", ";", "oi", "->", "oi_origdb", "=", "be", ";", "if", "(", "isglobal", ")", "{", "SLAP_DBFLAGS", "(", "be", ")", "|=", "SLAP_DBFLAG_GLOBAL_OVERLAY", ";", "}", "/*", "Save", "a", "pointer", "to", "ourself", "in", "bi_private.", "*/", "oi", "->", "oi_bi", ".", "bi_private", "=", "oi", ";", "oi", "->", "oi_list", "=", "NULL", ";", "bi", "=", "(", "BackendInfo", "*", ")", "oi", ";", "bi", "->", "bi_type", "=", "(", "char", "*", ")", "overtype", ";", "bi", "->", "bi_db_config", "=", "over_db_config", ";", "bi", "->", "bi_db_open", "=", "over_db_open", ";", "bi", "->", "bi_db_close", "=", "over_db_close", ";", "bi", "->", "bi_db_destroy", "=", "over_db_destroy", ";", "bi", "->", "bi_op_bind", "=", "over_op_bind", ";", "bi", "->", "bi_op_unbind", "=", "over_op_unbind", ";", "bi", "->", "bi_op_search", "=", "over_op_search", ";", "bi", "->", "bi_op_compare", "=", "over_op_compare", ";", "bi", "->", "bi_op_modify", "=", "over_op_modify", ";", "bi", "->", "bi_op_modrdn", "=", "over_op_modrdn", ";", "bi", "->", "bi_op_add", "=", "over_op_add", ";", "bi", "->", "bi_op_delete", "=", "over_op_delete", ";", "bi", "->", "bi_op_abandon", "=", "over_op_abandon", ";", "bi", "->", "bi_op_cancel", "=", "over_op_cancel", ";", "bi", "->", "bi_extended", "=", "over_op_extended", ";", "/*", "*", "this", "is", "fine", "because", "it", "has", "the", "same", "*", "args", "of", "the", "operations;", "we", "need", "to", "rework", "*", "all", "the", "hooks", "to", "share", "the", "same", "args", "*", "of", "the", "operations...", "*/", "bi", "->", "bi_operational", "=", "over_aux_operational", ";", "bi", "->", "bi_chk_referrals", "=", "over_aux_chk_referrals", ";", "bi", "->", "bi_chk_controls", "=", "over_aux_chk_controls", ";", "/*", "these", "have", "specific", "arglists", "*/", "bi", "->", "bi_entry_get_rw", "=", "over_entry_get_rw", ";", "bi", "->", "bi_entry_release_rw", "=", "over_entry_release_rw", ";", "bi", "->", "bi_access_allowed", "=", "over_access_allowed", ";", "bi", "->", "bi_acl_group", "=", "over_acl_group", ";", "bi", "->", "bi_acl_attribute", "=", "over_acl_attribute", ";", "bi", "->", "bi_connection_init", "=", "over_connection_init", ";", "bi", "->", "bi_connection_destroy", "=", "over_connection_destroy", ";", "be", "->", "bd_info", "=", "bi", ";", "}", "else", "{", "if", "(", "overlay_is_inst", "(", "be", ",", "ov", ")", ")", "{", "if", "(", "SLAPO_SINGLE", "(", "be", ")", ")", "{", "Debug", "(", "LDAP_DEBUG_ANY", ",", "\"overlay_config():", "\"", "\"overlay", "\\\\\"%s\\\\\"", "already", "in", "list\\\"", ",", "ov", ")", ";", "return", "1", ";", "}", "}", "oi", "=", "be", "->", "bd_info", "->", "bi_private", ";", "}", "/*", "Insert", "new", "overlay", "into", "list.", "By", "default", "overlays", "are", "*", "added", "to", "head", "of", "list", "and", "executed", "in", "LIFO", "order.", "*/", "on2", "=", "ch_calloc", "(", "1", ",", "sizeof", "(", "slap_overinst", ")", ")", ";", "*", "on2", "=", "*", "on", ";", "on2", "->", "on_info", "=", "oi", ";", "prev", "=", "&", "oi", "->", "oi_list", ";", "/*", "Do", "we", "need", "to", "find", "the", "insertion", "point?", "*/", "if", "(", "idx", ">=", "0", ")", "{", "int", "i", ";", "/*", "count", "current", "overlays", "*/", "for", "(", "i", "=", "0", ",", "on", "=", "oi", "->", "oi_list", ";", "on", ";", "on", "=", "on", "->", "on_next", ",", "i", "++", ")", ";", "/*", "are", "we", "just", "appending", "a", "new", "one?", "*/", "if", "(", "idx", ">=", "i", ")", "idx", "=", "-", "1", ";", "}", "overlay_insert", "(", "be", ",", "on2", ",", "&", "prev", ",", "idx", ")", ";", "/*", "Any", "initialization", "needed?", "*/", "if", "(", "on2", "->", "on_bi", ".", "bi_db_init", ")", "{", "int", "rc", ";", "be", "->", "bd_info", "=", "(", "BackendInfo", "*", ")", "on2", ";", "rc", "=", "on2", "->", "on_bi", ".", "bi_db_init", "(", "be", ",", "cr", ")", ";", "be", "->", "bd_info", "=", "(", "BackendInfo", "*", ")", "oi", ";", "if", "(", "rc", ")", "{", "*", "prev", "=", "on2", "->", "on_next", ";", "ch_free", "(", "on2", ")", ";", "on2", "=", "NULL", ";", "return", "rc", ";", "}", "}", "if", "(", "res", ")", "*", "res", "=", "&", "on2", "->", "on_bi", ";", "return", "0", ";", "}'" ]
overlay_config
erthink/ReOpenLDAP
single_line
train
41
58
[ "DMAMUX", "Set", "Request", "Generator", "Trigger", "GNBREQ" ]
[ "'void", "dmamux_set_request_generator_trigger_gnbreq", "(", "uint32_t", "dmamux", ",", "uint8_t", "rg_channel", ",", "uint8_t", "gnbreq", ")", "{", "uint32_t", "reg32", "=", "DMAMUX_RGxCR", "(", "dmamux", ",", "rg_channel", ")", ";", "reg32", "&=", "~", "(", "DMAMUX_RGxCR_GNBREQ_MASK", "<<", "DMAMUX_RGxCR_GNBREQ_SHIFT", ")", ";", "reg32", "|=", "(", "(", "gnbreq", "&", "DMAMUX_RGxCR_GNBREQ_MASK", ")", "<<", "DMAMUX_RGxCR_GNBREQ_SHIFT", ")", ";", "DMAMUX_RGxCR", "(", "dmamux", ",", "rg_channel", ")", "=", "reg32", ";", "}'" ]
dmamux_set_request_generator_trigger_gnbreq
libopencm3/libopencm3
multi_line
train
42
59
[ "DMAMUX", "Set", "DMA", "Request", "Synchronization", "Event", "Polarity" ]
[ "'void", "dmamux_set_dma_request_sync_pol", "(", "uint32_t", "dmamux", ",", "uint8_t", "channel", ",", "uint8_t", "polarity", ")", "{", "uint32_t", "reg32", "=", "DMAMUX_CxCR", "(", "dmamux", ",", "channel", ")", ";", "reg32", "&=", "~", "(", "DMAMUX_CxCR_SPOL_MASK", "<<", "DMAMUX_CxCR_SPOL_SHIFT", ")", ";", "reg32", "|=", "(", "(", "polarity", "&", "DMAMUX_CxCR_SPOL_MASK", ")", "<<", "DMAMUX_CxCR_SPOL_SHIFT", ")", ";", "DMAMUX_CxCR", "(", "dmamux", ",", "channel", ")", "=", "reg32", ";", "}'" ]
dmamux_set_dma_request_sync_pol
libopencm3/libopencm3
multi_line
train
43
60
[ "DMAMUX", "Clear", "DMA", "Request", "Synchronization", "Overrun", "Interrupt", "Flag" ]
[ "'void", "dmamux_clear_dma_request_sync_overrun", "(", "uint32_t", "dmamux", ",", "uint8_t", "channel", ")", "{", "DMAMUX_CFR", "(", "dmamux", ")", "=", "DMAMUX_CFR_CSOF", "(", "channel", ")", ";", "}'" ]
dmamux_clear_dma_request_sync_overrun
libopencm3/libopencm3
multi_line
train
44
61
[ "DMAMUX", "Get", "DMA", "Request", "Synchronization", "Overrun", "Interrupt", "Flag" ]
[ "'uint32_t", "dmamux_get_dma_request_sync_overrun", "(", "uint32_t", "dmamux", ",", "uint8_t", "channel", ")", "{", "return", "DMAMUX_CSR", "(", "dmamux", ")", "&", "DMAMUX_CSR_SOF", "(", "channel", ")", ";", "}'" ]
dmamux_get_dma_request_sync_overrun
libopencm3/libopencm3
multi_line
train
45
62
[ "DMAMUX", "Reset", "Request", "Generator", "Channel" ]
[ "'void", "dmamux_reset_request_generator_channel", "(", "uint32_t", "dmamux", ",", "uint8_t", "rg_channel", ")", "{", "DMAMUX_CxCR", "(", "dmamux", ",", "rg_channel", ")", "=", "0", ";", "dmamux_clear_request_generator_trigger_overrun_interrupt", "(", "dmamux", ",", "rg_channel", ")", ";", "}'" ]
dmamux_reset_request_generator_channel
libopencm3/libopencm3
multi_line
train
46
63
[ "DMAMUX", "Disable", "DMA", "Request", "Event", "Generation" ]
[ "'void", "dmamux_disable_dma_request_event_generation", "(", "uint32_t", "dmamux", ",", "uint8_t", "channel", ")", "{", "DMAMUX_CxCR", "(", "dmamux", ",", "channel", ")", "&=", "~", "DMAMUX_CxCR_EGE", ";", "}'" ]
dmamux_disable_dma_request_event_generation
libopencm3/libopencm3
multi_line
train
47
64
[ "DMAMUX", "Set", "DMA", "Channel", "Request" ]
[ "'void", "dmamux_set_dma_channel_request", "(", "uint32_t", "dmamux", ",", "uint8_t", "channel", ",", "uint8_t", "request_id", ")", "{", "uint32_t", "reg32", "=", "DMAMUX_CxCR", "(", "dmamux", ",", "channel", ")", ";", "reg32", "&=", "~", "(", "DMAMUX_CxCR_DMAREQ_ID_MASK", "<<", "DMAMUX_CxCR_DMAREQ_ID_SHIFT", ")", ";", "reg32", "|=", "(", "(", "request_id", "&", "DMAMUX_CxCR_DMAREQ_ID_MASK", ")", "<<", "DMAMUX_CxCR_DMAREQ_ID_SHIFT", ")", ";", "DMAMUX_CxCR", "(", "dmamux", ",", "channel", ")", "=", "reg32", ";", "}'" ]
dmamux_set_dma_channel_request
libopencm3/libopencm3
multi_line
train
48
66
[ "The", "caller", "can", "assume", "that", "this", "removes", "any", "secret", "data", "from", "the", "context" ]
[ "'int", "EVP_DigestFinal", "(", "EVP_MD_CTX", "*", "ctx", ",", "unsigned", "char", "*", "md", ",", "unsigned", "int", "*", "size", ")", "{", "int", "ret", ";", "ret", "=", "EVP_DigestFinal_ex", "(", "ctx", ",", "md", ",", "size", ")", ";", "EVP_MD_CTX_cleanup", "(", "ctx", ")", ";", "return", "ret", ";", "}'" ]
EVP_DigestFinal
libressl-portable/portable
single_line
train
49
67
[ "currently", "the", "longest", "string", "is", "\"", "12", "\\0\"", "(5", "chars)" ]
[ "'int", "allowedGametype", "(", "const", "char", "*", "gametypeStr", ")", "{", "char", "tempStr", "[", "MAX_GAMETYPENAME_LENGTH", "]", ";", "int", "length", ";", "char", "voteGametypes", "[", "MAX_CVAR_VALUE_STRING", "]", ";", "trap_Cvar_VariableStringBuffer", "(", "\"g_voteGametypes\"", ",", "voteGametypes", ",", "sizeof", "(", "voteGametypes", ")", ")", ";", "if", "(", "Q_strequal", "(", "voteGametypes", ",", "\"*\"", ")", ")", "return", "qtrue", ";", "//if", "star,", "everything", "is", "allowed", "length", "=", "strlen", "(", "gametypeStr", ")", ";", "if", "(", "length", ">", "MAX_GAMETYPENAME_LENGTH", "-", "3", ")", "{", "//Error:", "too", "long", "return", "qfalse", ";", "}", "tempStr", "[", "0", "]", "=", "\\'/\\'", ";", "strncpy", "(", "&", "tempStr", "[", "1", "]", ",", "gametypeStr", ",", "length", ")", ";", "tempStr", "[", "length", "+", "1", "]", "=", "\\'/\\'", ";", "tempStr", "[", "length", "+", "2", "]", "=", "\\'\\\\0\\'", ";", "if", "(", "Q_stristr", "(", "voteGametypes", ",", "tempStr", ")", "!=", "NULL", ")", "return", "qtrue", ";", "else", "{", "return", "qfalse", ";", "}", "}'" ]
allowedGametype
OpenArena/gamecode
double_slash
train
50
68
[ "Map", "synthetic", "interrupt", "controller" ]
[ "'static", "void", "hv_map_synic", "(", "struct", "hv_hypervisor", "*", "hv", ")", "{", "uint64_t", "simp", ";", "uint64_t", "siefp", ";", "uint64_t", "scontrol", ";", "/*", "Zero", "SynIC", "message", "and", "event", "pages", "*/", "memset", "(", "hv", "->", "synic", ".", "message", ",", "0", ",", "PAGE_SIZE", ")", ";", "memset", "(", "hv", "->", "synic", ".", "event", ",", "0", ",", "PAGE_SIZE", ")", ";", "/*", "Map", "SynIC", "message", "page", "*/", "simp", "=", "rdmsr", "(", "HV_X64_MSR_SIMP", ")", ";", "simp", "&=", "(", "PAGE_SIZE", "-", "1", ")", ";", "simp", "|=", "(", "virt_to_phys", "(", "hv", "->", "synic", ".", "message", ")", "|", "HV_SIMP_ENABLE", ")", ";", "DBGC2", "(", "hv", ",", "\"HV", "%p", "SIMP", "MSR", "is", "%#08llx\\\"", ",", "hv", ",", "simp", ")", ";", "wrmsr", "(", "HV_X64_MSR_SIMP", ",", "simp", ")", ";", "/*", "Map", "SynIC", "event", "page", "*/", "siefp", "=", "rdmsr", "(", "HV_X64_MSR_SIEFP", ")", ";", "siefp", "&=", "(", "PAGE_SIZE", "-", "1", ")", ";", "siefp", "|=", "(", "virt_to_phys", "(", "hv", "->", "synic", ".", "event", ")", "|", "HV_SIEFP_ENABLE", ")", ";", "DBGC2", "(", "hv", ",", "\"HV", "%p", "SIEFP", "MSR", "is", "%#08llx\\\"", ",", "hv", ",", "siefp", ")", ";", "wrmsr", "(", "HV_X64_MSR_SIEFP", ",", "siefp", ")", ";", "/*", "Enable", "SynIC", "*/", "scontrol", "=", "rdmsr", "(", "HV_X64_MSR_SCONTROL", ")", ";", "scontrol", "|=", "HV_SCONTROL_ENABLE", ";", "DBGC2", "(", "hv", ",", "\"HV", "%p", "SCONTROL", "MSR", "is", "%#08llx\\\"", ",", "hv", ",", "scontrol", ")", ";", "wrmsr", "(", "HV_X64_MSR_SCONTROL", ",", "scontrol", ")", ";", "}'" ]
hv_map_synic
ipxe/ipxe
multi_line
train
51
69
[ "Wait", "for", "received", "message" ]
[ "'int", "hv_wait_for_message", "(", "struct", "hv_hypervisor", "*", "hv", ",", "unsigned", "int", "sintx", ")", "{", "struct", "hv_message", "*", "msg", "=", "&", "hv", "->", "message", "->", "received", ";", "struct", "hv_message", "*", "src", "=", "&", "hv", "->", "synic", ".", "message", "[", "sintx", "]", ";", "unsigned", "int", "retries", ";", "size_t", "len", ";", "/*", "Wait", "for", "message", "to", "arrive", "*/", "for", "(", "retries", "=", "0", ";", "retries", "<", "HV_MESSAGE_MAX_WAIT_MS", ";", "retries", "++", ")", "{", "/*", "Check", "for", "message", "*/", "if", "(", "src", "->", "type", ")", "{", "/*", "Copy", "message", "*/", "memset", "(", "msg", ",", "0", ",", "sizeof", "(", "*", "msg", ")", ")", ";", "len", "=", "src", "->", "len", ";", "assert", "(", "len", "<=", "sizeof", "(", "*", "msg", ")", ")", ";", "memcpy", "(", "msg", ",", "src", ",", "(", "offsetof", "(", "typeof", "(", "*", "msg", ")", ",", "data", ")", "+", "len", ")", ")", ";", "DBGC2", "(", "hv", ",", "\"HV", "%p", "SINT%d", "received", "message", "type", "\"", "\"%#08x:\\\"", ",", "hv", ",", "sintx", ",", "le32_to_cpu", "(", "msg", "->", "type", ")", ")", ";", "DBGC2_HDA", "(", "hv", ",", "0", ",", "msg", "->", "data", ",", "len", ")", ";", "/*", "Consume", "message", "*/", "src", "->", "type", "=", "0", ";", "return", "0", ";", "}", "/*", "Trigger", "message", "delivery", "*/", "wrmsr", "(", "HV_X64_MSR_EOM", ",", "0", ")", ";", "/*", "Delay", "*/", "mdelay", "(", "1", ")", ";", "}", "DBGC", "(", "hv", ",", "\"HV", "%p", "SINT%d", "timed", "out", "waiting", "for", "message\\\"", ",", "hv", ",", "sintx", ")", ";", "return", "-", "ETIMEDOUT", ";", "}'" ]
hv_wait_for_message
ipxe/ipxe
multi_line
train
52
70
[ "Delay", "for", "a", "fixed", "number", "of", "microseconds" ]
[ "'static", "void", "hv_udelay", "(", "unsigned", "long", "usecs", ")", "{", "uint32_t", "start", ";", "uint32_t", "elapsed", ";", "uint32_t", "threshold", ";", "/*", "Spin", "until", "specified", "number", "of", "10MHz", "ticks", "have", "elapsed", "*/", "start", "=", "rdmsr", "(", "HV_X64_MSR_TIME_REF_COUNT", ")", ";", "threshold", "=", "(", "usecs", "*", "(", "HV_TIMER_HZ", "/", "1000000", ")", ")", ";", "do", "{", "elapsed", "=", "(", "rdmsr", "(", "HV_X64_MSR_TIME_REF_COUNT", ")", "-", "start", ")", ";", "}", "while", "(", "elapsed", "<", "threshold", ")", ";", "}'" ]
hv_udelay
ipxe/ipxe
multi_line
train
53
73
[ "Accumulate", "data", "with", "MD4", "algorithm" ]
[ "'static", "void", "md4_update", "(", "void", "*", "ctx", ",", "const", "void", "*", "data", ",", "size_t", "len", ")", "{", "struct", "md4_context", "*", "context", "=", "ctx", ";", "const", "uint8_t", "*", "byte", "=", "data", ";", "size_t", "offset", ";", "/*", "Accumulate", "data", "a", "byte", "at", "a", "time,", "performing", "the", "digest", "*", "whenever", "we", "fill", "the", "data", "buffer", "*/", "while", "(", "len", "--", ")", "{", "offset", "=", "(", "context", "->", "len", "%", "sizeof", "(", "context", "->", "ddd", ".", "dd", ".", "data", ")", ")", ";", "context", "->", "ddd", ".", "dd", ".", "data", ".", "byte", "[", "offset", "]", "=", "*", "(", "byte", "++", ")", ";", "context", "->", "len", "++", ";", "if", "(", "(", "context", "->", "len", "%", "sizeof", "(", "context", "->", "ddd", ".", "dd", ".", "data", ")", ")", "==", "0", ")", "md4_digest", "(", "context", ")", ";", "}", "}'" ]
md4_update
ipxe/ipxe
multi_line
train
54
74
[ "f(b,c,d,w)", "for", "steps", "32", "to", "47" ]
[ "'static", "uint32_t", "md4_f_32_47", "(", "struct", "md4_variables", "*", "v", ",", "unsigned", "int", "i", ")", "{", "static", "const", "uint8_t", "reverse", "[", "16", "]", "=", "{", "0", ",", "8", ",", "4", ",", "12", ",", "2", ",", "10", ",", "6", ",", "14", ",", "1", ",", "9", ",", "5", ",", "13", ",", "3", ",", "11", ",", "7", ",", "15", "}", ";", "return", "(", "(", "v", "->", "b", "^", "v", "->", "c", "^", "v", "->", "d", ")", "+", "v", "->", "w", "[", "reverse", "[", "i", "]", "]", ")", ";", "}'" ]
md4_f_32_47
ipxe/ipxe
multi_line
train
55
75
[ "f(b,c,d,w)", "for", "steps", "16", "to", "31" ]
[ "'static", "uint32_t", "md4_f_16_31", "(", "struct", "md4_variables", "*", "v", ",", "unsigned", "int", "i", ")", "{", "return", "(", "(", "(", "v", "->", "b", "&", "v", "->", "c", ")", "|", "(", "v", "->", "b", "&", "v", "->", "d", ")", "|", "(", "v", "->", "c", "&", "v", "->", "d", ")", ")", "+", "v", "->", "w", "[", "(", "(", "i", "<<", "2", ")", "|", "(", "i", ">>", "2", ")", ")", "%", "16", "]", ")", ";", "}'" ]
md4_f_16_31
ipxe/ipxe
multi_line
train
56
76
[ "f(b,c,d,w)", "for", "steps", "0", "to", "15" ]
[ "'static", "uint32_t", "md4_f_0_15", "(", "struct", "md4_variables", "*", "v", ",", "unsigned", "int", "i", ")", "{", "return", "(", "(", "(", "v", "->", "b", "&", "v", "->", "c", ")", "|", "(", "~", "v", "->", "b", "&", "v", "->", "d", ")", ")", "+", "v", "->", "w", "[", "i", "]", ")", ";", "}'" ]
md4_f_0_15
ipxe/ipxe
multi_line
train
57
77
[ "public", "functions", "Show", "file", "history", "and", "return", "the", "selected", "file" ]
[ "'char", "*", "show_file_history", "(", "const", "Widget", "*", "w", ",", "int", "*", "action", ")", "{", "GList", "*", "file_list", ";", "size_t", "len", ";", "history_descriptor_t", "hd", ";", "file_list", "=", "file_history_list_read", "()", ";", "if", "(", "file_list", "==", "NULL", ")", "return", "NULL", ";", "len", "=", "g_list_length", "(", "file_list", ")", ";", "file_list", "=", "g_list_last", "(", "file_list", ")", ";", "history_descriptor_init", "(", "&", "hd", ",", "w", "->", "y", ",", "w", "->", "x", ",", "file_list", ",", "0", ")", ";", "/*", "redefine", "list-specific", "functions", "*/", "hd", ".", "create", "=", "file_history_create_item", ";", "hd", ".", "release", "=", "file_history_release_item", ";", "hd", ".", "free", "=", "file_history_free_item", ";", "history_show", "(", "&", "hd", ")", ";", "hd", ".", "list", "=", "g_list_first", "(", "hd", ".", "list", ")", ";", "/*", "Has", "history", "cleaned", "up", "or", "not?", "*/", "if", "(", "len", "!=", "g_list_length", "(", "hd", ".", "list", ")", ")", "file_history_list_write", "(", "hd", ".", "list", ")", ";", "g_list_free_full", "(", "hd", ".", "list", ",", "(", "GDestroyNotify", ")", "file_history_free_item", ")", ";", "*", "action", "=", "hd", ".", "action", ";", "return", "hd", ".", "text", ";", "}'" ]
show_file_history
MidnightCommander/mc
multi_line
train
58
78
[ "teamnames", "must", "be", "static", "storage,", "pointers", "to", "it", "will", "not", "be", "freed" ]
[ "'static", "void", "q3parseteams", "(", "struct", "server", "*", "s", ",", "const", "unsigned", "numteams", ",", "char", "*", "*", "playerteamrules", ",", "//", "which", "rule", "holds", "the", "numbers", "that", "indicate", "which", "player", "is", "in", "what", "team", "char", "*", "*", "teamnames", ",", "//", "default", "names", "for", "team", "char", "*", "*", "teamnamesrules", ")", "//", "which", "rules", "hold", "the", "team", "names", "{", "//", "bitmask", "of", "players", "for", "each", "team", "long", "*", "teams", "=", "NULL", ";", "char", "*", "*", "info_ptr", "=", "NULL", ";", "unsigned", "i", "=", "0", ",", "<type", "ref=\"prev\"/>", "n", "=", "0", ";", "unsigned", "team", "=", "numteams", ";", "GSList", "*", "plist", "=", "NULL", ";", "struct", "player", "*", "p", "=", "NULL", ";", "char", "*", "*", "teamnames_fromrules", "=", "NULL", ";", "if", "(", "!", "s", "||", "!", "playerteamrules", "||", "numteams", "<", "2", ")", "return", ";", "teams", "=", "g_malloc0", "(", "sizeof", "(", "long", ")", "*", "numteams", ")", ";", "if", "(", "!", "teams", ")", "return", ";", "teamnames_fromrules", "=", "g_malloc0", "(", "sizeof", "(", "char", "*", ")", "*", "numteams", ")", ";", "if", "(", "!", "teamnames_fromrules", ")", "return", ";", "for", "(", "info_ptr", "=", "s", "->", "info", ";", "info_ptr", "&&", "*", "info_ptr", ";", "info_ptr", "+=", "2", ")", "{", "for", "(", "i", "=", "0", ";", "i", "<", "numteams", ";", "++", "i", ")", "{", "if", "(", "strcmp", "(", "*", "info_ptr", ",", "playerteamrules", "[", "i", "]", ")", "==", "0", ")", "{", "team", "=", "i", ";", "break;", "}", "if", "(", "teamnamesrules", "&&", "teamnamesrules", "[", "i", "]", "&&", "strcmp", "(", "*", "info_ptr", ",", "teamnamesrules", "[", "i", "]", ")", "==", "0", ")", "{", "teamnames_fromrules", "[", "i", "]", "=", "info_ptr", "[", "1", "]", ";", "}", "}", "if", "(", "team", "!=", "numteams", ")", "{", "char", "*", "e", "=", "NULL", ";", "char", "*", "p", "=", "info_ptr", "[", "1", "]", ";", "for", "(", ";", ";", "p", "=", "e", ",", "e", "=", "NULL", ")", "{", "long", "pnr", "=", "strtol", "(", "p", ",", "&", "e", ",", "10", ")", ";", "if", "(", "p", "==", "e", "||", "(", "e", "&&", "!", "*", "e", ")", ")", "{", "break;", "}", "if", "(", "pnr", "!=", "LONG_MIN", "&&", "pnr", "!=", "LONG_MAX", "&&", "pnr", "<=", "(", "long", ")", "(", "sizeof", "(", "teams", "[", "team", "]", ")", "*", "8", ")", "&&", "pnr", ">", "0", ")", "{", "teams", "[", "team", "]", "|=", "2", "<<", "(", "pnr", "-", "1", ")", ";", "}", "}", "team", "=", "numteams", ";", "}", "}", "for", "(", "plist", "=", "s", "->", "players", ",", "n", "=", "0", ";", "plist", ";", "plist", "=", "plist", "->", "next", ",", "++", "n", ")", "{", "for", "(", "team", "=", "0", ";", "team", "!=", "numteams", ";", "++", "team", ")", "{", "if", "(", "teams", "[", "team", "]", "&", "(", "2", "<<", "n", ")", ")", "{", "p", "=", "plist", "->", "data", ";", "if", "(", "teamnames_fromrules", "[", "team", "]", ")", "{", "p", "->", "model", "=", "teamnames_fromrules", "[", "team", "]", ";", "}", "else", "{", "p", "->", "model", "=", "teamnames", "[", "team", "]", ";", "}", "}", "}", "}", "g_free", "(", "teams", ")", ";", "g_free", "(", "teamnames_fromrules", ")", ";", "}'" ]
q3parseteams
XQF/xqf
single_line
train
59
79
[ "ip", "for", "hostname", "resolved" ]
[ "'static", "void", "stat_name_resolved_callback", "(", "char", "*", "id", ",", "struct", "host", "*", "h", ",", "enum", "dns_status", "status", ",", "void", "*", "data", ")", "{", "struct", "stat_job", "*", "job", "=", "(", "struct", "stat_job", "*", ")", "data", ";", "struct", "userver", "*", "us", ";", "GSList", "*", "list", ";", "GSList", "*", "tmp", ";", "debug", "(", "6", ",", "\"%s,%p,%d,%p\"", ",", "id", ",", "h", ",", "status", ",", "data", ")", ";", "if", "(", "!", "job", "||", "!", "id", ")", "{", "return", ";", "}", "list", "=", "job", "->", "names", ";", "while", "(", "list", ")", "{", "us", "=", "(", "struct", "userver", "*", ")", "list", "->", "data", ";", "if", "(", "strcmp", "(", "us", "->", "hostname", ",", "id", ")", "==", "0", ")", "{", "if", "(", "h", ")", "{", "userver_set_host", "(", "us", ",", "h", ")", ";", "}", "/*", "automatically", "add", "it", "to", "the", "list", "of", "servers", "to", "refresh", "*/", "if", "(", "us", "->", "s", ")", "{", "if", "(", "us", "->", "s", "->", "type", "!=", "us", "->", "type", ")", "{", "us", "->", "s", "->", "type", "=", "us", "->", "type", ";", "server_free_info", "(", "us", "->", "s", ")", ";", "}", "us", "->", "s", "->", "server_query_type", "=", "us", "->", "server_query_type", ";", "/*", "o", "When", "the", "job", "is", "freed,", "the", "list", "will", "be", "freed", "as", "well.", "This", "will", "take", "care", "of", "the", "reference", "counting.", "*/", "job", "->", "servers", "=", "server_list_prepend", "(", "job", "->", "servers", ",", "us", "->", "s", ")", ";", "}", "for", "(", "tmp", "=", "job", "->", "name_handlers", ";", "tmp", ";", "tmp", "=", "tmp", "->", "next", ")", "{", "(", "*", "(", "name_func", ")", "tmp", "->", "data", ")", "(", "job", ",", "us", ",", "status", ")", ";", "}", "//", "TODO", "optimizable,", "no", "need", "to", "start", "from", "start", "of", "list.", "on", "the", "other", "//", "hand,", "it\\'s", "unlikely", "that", "the", "list", "is", "big", "anyway...", "list", "=", "job", "->", "names", "=", "g_slist_remove", "(", "job", "->", "names", ",", "us", ")", ";", "userver_unref", "(", "us", ")", ";", "continue;", "}", "list", "=", "list", "->", "next", ";", "}", "if", "(", "job", "->", "names", "==", "NULL", ")", "{", "dns_set_callback", "(", "NULL", ",", "NULL", ")", ";", "stat_next", "(", "job", ")", ";", "}", "}'" ]
stat_name_resolved_callback
XQF/xqf
double_slash
train
60
80
[ "the", "function", "should", "return", "FALSE", "if", "the", "event", "source", "should", "be", "removed" ]
[ "'static", "gboolean", "stat_master_input_callback", "(", "GIOChannel", "*", "chan", ",", "GIOCondition", "condition", ",", "struct", "stat_conn", "*", "conn", ")", "{", "struct", "stat_job", "*", "job", "=", "conn", "->", "job", ";", "gchar", "*", "buf", "=", "g_malloc", "(", "sizeof", "(", "gchar", "*", ")", "*", "BUFFER_MINSIZE", ")", ";", "gsize", "res", "=", "0", ";", "GError", "*", "err", "=", "NULL", ";", "GIOStatus", "status", ";", "GSList", "*", "strings", ",", "<type", "ref=\"prev\">", "*", "current", ";", "debug_increase_indent", "()", ";", "debug", "(", "3", ",", "\"stat_master_input_callback(%p,%d,...)\"", ",", "conn", ",", "chan", ")", ";", "/*", "return", "FALSE", "when", "there", "is", "nothing", "(more)", "to", "do", "*/", "while", "(", "TRUE", ")", "{", "status", "=", "g_io_channel_read_chars", "(", "chan", ",", "buf", ",", "BUFFER_MINSIZE", ",", "&", "res", ",", "&", "err", ")", ";", "conn", "->", "bufsize", "+=", "res", ";", "if", "(", "conn", "->", "buf", "==", "NULL", ")", "{", "conn", "->", "buf", "=", "g_malloc", "(", "sizeof", "(", "gchar", "*", ")", "*", "conn", "->", "bufsize", ")", ";", "}", "else", "{", "conn", "->", "buf", "=", "g_realloc", "(", "conn", "->", "buf", ",", "sizeof", "(", "gchar", "*", ")", "*", "conn", "->", "bufsize", ")", ";", "}", "strncpy", "(", "conn", "->", "buf", "+", "(", "conn", "->", "bufsize", "-", "res", ")", ",", "buf", ",", "res", ")", ";", "if", "(", "status", "==", "G_IO_STATUS_EOF", ")", "{", "gboolean", "unsuccessful", "=", "FALSE", ";", "debug", "(", "3", ",", "\"stat_master_input_callback", "--", "eof\"", ")", ";", "debug", "(", "6", ",", "\"conn->buf:", "[%d]\"", ",", "buf", ")", ";", "strings", "=", "stat_buffer_to_strings", "(", "conn", "->", "buf", ",", "conn", "->", "bufsize", ")", ";", "current", "=", "strings", ";", "while", "(", "current", ")", "{", "if", "(", "strlen", "(", "current", "->", "data", ")", ")", "{", "debug", "(", "6", ",", "\"parse_master_output:", "[%s]\"", ",", "current", "->", "data", ")", ";", "if", "(", "!", "parse_master_output", "(", "current", "->", "data", ",", "conn", ")", ")", "{", "unsuccessful", "=", "TRUE", ";", "}", "}", "current", "=", "current", "->", "next", ";", "}", "if", "(", "unsuccessful", ")", "{", "stat_master_update_done", "(", "conn", ",", "job", ",", "conn", "->", "master", ",", "conn", "->", "master", "->", "state", ")", ";", "}", "else", "{", "stat_master_update_done", "(", "conn", ",", "job", ",", "conn", "->", "master", ",", "SOURCE_UP", ")", ";", "}", "stat_update_masters", "(", "job", ")", ";", "debug_decrease_indent", "()", ";", "g_free", "(", "buf", ")", ";", "return", "FALSE", ";", "}", "<if", "type=\"elseif\">", "else", "if", "(", "status", "==", "G_IO_STATUS_AGAIN", ")", "{", "debug", "(", "3", ",", "\"stat_master_input_callback", "--", "unavailable\"", ")", ";", "debug_decrease_indent", "()", ";", "g_free", "(", "buf", ")", ";", "return", "TRUE", ";", "}", "<if", "type=\"elseif\">", "else", "if", "(", "status", "==", "G_IO_STATUS_ERROR", ")", "{", "debug", "(", "3", ",", "\"stat_master_input_callback", "--", "error\"", ")", ";", "debug", "(", "6", ",", "\"conn->buf:", "[%d]\"", ",", "buf", ")", ";", "failed", "(", "\"read\"", ",", "NULL", ")", ";", "stat_master_update_done", "(", "conn", ",", "job", ",", "conn", "->", "master", ",", "SOURCE_ERROR", ")", ";", "stat_update_masters", "(", "job", ")", ";", "debug_decrease_indent", "()", ";", "g_free", "(", "buf", ")", ";", "return", "FALSE", ";", "}", "/*", "G_IO_STATUS_NORMAL", "*/", "debug", "(", "3", ",", "\"stat_master_input_callback", "--", "chars", "read\"", ")", ";", "/*", "loop", "*/", "}", "//", "infinite", "loop", "end,", "next", "lines", "are", "never", "read", "}'" ]
stat_master_input_callback
XQF/xqf
single_line
train
61
81
[ "returns", "position", "relative", "to", "last", "mark" ]
[ "'int", "cgc_io_tell", "(", "io_t", "*", "io", ")", "{", "return", "io", "->", "pos", "-", "io", "->", "mark", ";", "}'" ]
cgc_io_tell
trailofbits/cb-multios
single_line
train
62
82
[ "seeks", "to", "a", "position", "relative", "to", "last", "mark" ]
[ "'int", "cgc_io_seek", "(", "io_t", "*", "io", ",", "int", "pos", ")", "{", "int", "new_pos", "=", "io", "->", "mark", "+", "pos", ";", "if", "(", "new_pos", ">", "io", "->", "length", ")", "return", "0", ";", "io", "->", "pos", "=", "new_pos", ";", "return", "1", ";", "}'" ]
cgc_io_seek
trailofbits/cb-multios
single_line
train
63
83
[ "threads", "suspended", "until", "the", "fork", "finishes" ]
[ "\"void", "scp_lock_init", "(", "void", ")", "{", "/*", "initializing", "fork", "lock", "*/", "pthread_mutexattr_init", "(", "&", "lock_fork_attr", ")", ";", "pthread_mutex_init", "(", "&", "lock_fork", ",", "&", "lock_fork_attr", ")", ";", "lock_fork_req", "=", "tc_sem_create", "(", "0", ")", ";", "lock_fork_wait", "=", "tc_sem_create", "(", "0", ")", ";", "/*", "here", "we", "don't", "use", "locking", "because", "lock_init()", "should", "be", "called", "BEFORE", "*/", "/*", "any", "thread", "is", "created", "*/", "lock_fork_blockers_count", "=", "0", ";", "lock_fork_waiting_count", "=", "0", ";", "lock_fork_forkers_count", "=", "0", ";", "}\"" ]
scp_lock_init
neutrinolabs/xrdp
single_line
train
64
84
[ "RCC", "Set", "the", "PLL", "Multiplication", "Factor" ]
[ "'void", "rcc_set_pll_multiplication_factor", "(", "uint32_t", "mul", ")", "{", "RCC_CFGR", "=", "(", "RCC_CFGR", "&", "~", "RCC_CFGR_PLLMUL", ")", "|", "mul", ";", "}'" ]
rcc_set_pll_multiplication_factor
Bulebots/bulebule
multi_line
train
65
85
[ "RCC", "Set", "the", "Source", "for", "the", "RTC", "clock" ]
[ "'void", "rcc_set_rtc_clock_source", "(", "enum", "rcc_osc", "clk", ")", "{", "switch", "(", "clk", ")", "{", "case", "RCC_HSE", ":", "RCC_BDCR", "=", "(", "RCC_BDCR", "&", "~", "RCC_BDCR_RTCSEL", ")", "|", "RCC_BDCR_RTCSEL_HSE", ";", "break;", "case", "RCC_LSE", ":", "RCC_BDCR", "=", "(", "RCC_BDCR", "&", "~", "RCC_BDCR_RTCSEL", ")", "|", "RCC_BDCR_RTCSEL_LSE", ";", "break;", "case", "RCC_LSI", ":", "RCC_BDCR", "=", "(", "RCC_BDCR", "&", "~", "RCC_BDCR_RTCSEL", ")", "|", "RCC_BDCR_RTCSEL_LSI", ";", "break;", "default:", "/*", "do", "nothing", "*/", "break;", "}", "}'" ]
rcc_set_rtc_clock_source
Bulebots/bulebule
multi_line
train
66
86
[ "RCC", "Turn", "off", "an", "Oscillator" ]
[ "\"void", "rcc_osc_off", "(", "enum", "rcc_osc", "osc", ")", "{", "switch", "(", "osc", ")", "{", "case", "RCC_HSI48", ":", "RCC_CR2", "&=", "~", "RCC_CR2_HSI48ON", ";", "break;", "case", "RCC_HSI14", ":", "RCC_CR2", "&=", "~", "RCC_CR2_HSI14ON", ";", "break;", "case", "RCC_HSI", ":", "RCC_CR", "&=", "~", "RCC_CR_HSION", ";", "break;", "case", "RCC_HSE", ":", "RCC_CR", "&=", "~", "RCC_CR_HSEON", ";", "break;", "case", "RCC_LSE", ":", "RCC_BDCR", "&=", "~", "RCC_BDCR_LSEON", ";", "break;", "case", "RCC_LSI", ":", "RCC_CSR", "&=", "~", "RCC_CSR_LSION", ";", "break;", "case", "RCC_PLL", ":", "/*", "don't", "do", "anything", "*/", "break;", "}", "}\"" ]
rcc_osc_off
Bulebots/bulebule
multi_line
train
67
87
[ "RCC", "Get", "the", "System", "Clock", "Source" ]
[ "'enum", "rcc_osc", "rcc_system_clock_source", "(", "void", ")", "{", "/*", "Return", "the", "clock", "source", "which", "is", "used", "as", "system", "clock.", "*/", "switch", "(", "RCC_CFGR", "&", "RCC_CFGR_SWS", ")", "{", "case", "RCC_CFGR_SWS_HSI", ":", "return", "RCC_HSI", ";", "case", "RCC_CFGR_SWS_HSE", ":", "return", "RCC_HSE", ";", "case", "RCC_CFGR_SWS_PLL", ":", "return", "RCC_PLL", ";", "case", "RCC_CFGR_SWS_HSI48", ":", "return", "RCC_HSI48", ";", "}", "cm3_assert_not_reached", "()", ";", "}'" ]
rcc_system_clock_source
Bulebots/bulebule
multi_line
train
68
88
[ "RCC", "Enable", "the", "Clock", "Security", "System" ]
[ "'void", "rcc_css_enable", "(", "void", ")", "{", "RCC_CR", "|=", "RCC_CR_CSSON", ";", "}'" ]
rcc_css_enable
Bulebots/bulebule
multi_line
train
69
89
[ "RCC", "Set", "the", "APB", "Prescale", "Factor" ]
[ "'void", "rcc_set_ppre", "(", "uint32_t", "ppre", ")", "{", "RCC_CFGR", "=", "(", "RCC_CFGR", "&", "~", "RCC_CFGR_PPRE", ")", "|", "ppre", ";", "}'" ]
rcc_set_ppre
Bulebots/bulebule
multi_line
train
70
90
[ "RCC", "Set", "the", "Source", "for", "the", "System", "Clock" ]
[ "'void", "rcc_set_sysclk_source", "(", "enum", "rcc_osc", "clk", ")", "{", "switch", "(", "clk", ")", "{", "case", "RCC_HSI", ":", "RCC_CFGR", "=", "(", "RCC_CFGR", "&", "~", "RCC_CFGR_SW", ")", "|", "RCC_CFGR_SW_HSI", ";", "break;", "case", "RCC_HSE", ":", "RCC_CFGR", "=", "(", "RCC_CFGR", "&", "~", "RCC_CFGR_SW", ")", "|", "RCC_CFGR_SW_HSE", ";", "break;", "case", "RCC_PLL", ":", "RCC_CFGR", "=", "(", "RCC_CFGR", "&", "~", "RCC_CFGR_SW", ")", "|", "RCC_CFGR_SW_PLL", ";", "break;", "case", "RCC_HSI48", ":", "RCC_CFGR", "=", "(", "RCC_CFGR", "&", "~", "RCC_CFGR_SW", ")", "|", "RCC_CFGR_SW_HSI48", ";", "break;", "case", "RCC_LSI", ":", "case", "RCC_LSE", ":", "case", "RCC_HSI14", ":", "/*", "do", "nothing", "*/", "break;", "}", "}'" ]
rcc_set_sysclk_source
Bulebots/bulebule
multi_line
train
71
91
[ "RCC", "Set", "the", "Source", "for", "the", "USB", "Clock" ]
[ "'void", "rcc_set_usbclk_source", "(", "enum", "rcc_osc", "clk", ")", "{", "switch", "(", "clk", ")", "{", "case", "RCC_PLL", ":", "RCC_CFGR3", "|=", "RCC_CFGR3_USBSW", ";", "break;", "case", "RCC_HSI48", ":", "RCC_CFGR3", "&=", "~", "RCC_CFGR3_USBSW", ";", "break;", "case", "RCC_HSI", ":", "case", "RCC_HSE", ":", "case", "RCC_LSI", ":", "case", "RCC_LSE", ":", "case", "RCC_HSI14", ":", "/*", "do", "nothing", "*/", "break;", "}", "}'" ]
rcc_set_usbclk_source
Bulebots/bulebule
multi_line
train
72
92
[ "RCC", "Turn", "on", "an", "Oscillator" ]
[ "'void", "rcc_osc_on", "(", "enum", "rcc_osc", "osc", ")", "{", "switch", "(", "osc", ")", "{", "case", "RCC_HSI48", ":", "RCC_CR2", "|=", "RCC_CR2_HSI48ON", ";", "break;", "case", "RCC_HSI14", ":", "RCC_CR2", "|=", "RCC_CR2_HSI14ON", ";", "break;", "case", "RCC_HSI", ":", "RCC_CR", "|=", "RCC_CR_HSION", ";", "break;", "case", "RCC_HSE", ":", "RCC_CR", "|=", "RCC_CR_HSEON", ";", "break;", "case", "RCC_LSE", ":", "RCC_BDCR", "|=", "RCC_BDCR_LSEON", ";", "break;", "case", "RCC_LSI", ":", "RCC_CSR", "|=", "RCC_CSR_LSION", ";", "break;", "case", "RCC_PLL", ":", "RCC_CR", "|=", "RCC_CR_PLLON", ";", "break;", "}", "}'" ]
rcc_osc_on
Bulebots/bulebule
multi_line
train
73
93
[ "RCC", "Disable", "the", "Clock", "Security", "System" ]
[ "'void", "rcc_css_disable", "(", "void", ")", "{", "RCC_CR", "&=", "~", "RCC_CR_CSSON", ";", "}'" ]
rcc_css_disable
Bulebots/bulebule
multi_line
train
74
94
[ "RCC", "Disable", "the", "RTC", "clock" ]
[ "'void", "rcc_disable_rtc_clock", "(", "void", ")", "{", "RCC_BDCR", "&=", "~", "RCC_BDCR_RTCEN", ";", "}'" ]
rcc_disable_rtc_clock
Bulebots/bulebule
multi_line
train
75
95
[ "RCC", "Enable", "the", "RTC", "clock" ]
[ "'void", "rcc_enable_rtc_clock", "(", "void", ")", "{", "RCC_BDCR", "|=", "RCC_BDCR_RTCEN", ";", "}'" ]
rcc_enable_rtc_clock
Bulebots/bulebule
multi_line
train
76
96
[ "RCC", "Clear", "the", "Clock", "Security", "System", "Interrupt", "Flag" ]
[ "'void", "rcc_css_int_clear", "(", "void", ")", "{", "RCC_CIR", "|=", "RCC_CIR_CSSC", ";", "}'" ]
rcc_css_int_clear
Bulebots/bulebule
multi_line
train
77
97
[ "logs", "directly,", "returns", "EXIT_SUCCESS,", "EXIT_FAILURE,", "1" ]
[ "'int", "fill_yin_type", "(", "struct", "lys_module", "*", "module", ",", "struct", "lys_node", "*", "parent", ",", "struct", "lyxml_elem", "*", "yin", ",", "struct", "lys_type", "*", "type", ",", "int", "parenttype", ",", "struct", "unres_schema", "*", "unres", ")", "{", "const", "char", "*", "value", ",", "<type", "ref=\"prev\">", "*", "name", ",", "<type", "ref=\"prev\">", "*", "module_name", "=", "NULL", ";", "struct", "lys_node", "*", "siter", ";", "struct", "lyxml_elem", "*", "next", ",", "<type", "ref=\"prev\">", "*", "next2", ",", "<type", "ref=\"prev\">", "*", "node", ",", "<type", "ref=\"prev\">", "*", "child", ",", "<type", "ref=\"prev\"/>", "exts", ";", "struct", "lys_restr", "*", "*", "restrs", ",", "<type", "ref=\"prev\">", "*", "restr", ";", "struct", "lys_type_bit", "bit", ",", "<type", "ref=\"prev\">", "*", "bits_sc", "=", "NULL", ";", "struct", "lys_type_enum", "*", "enms_sc", "=", "NULL", ";", "/*", "shortcut", "*/", "struct", "lys_type", "*", "dertype", ";", "struct", "ly_ctx", "*", "ctx", "=", "module", "->", "ctx", ";", "int", "rc", ",", "<type", "ref=\"prev\"/>", "val_set", ",", "<type", "ref=\"prev\"/>", "c_ftrs", ",", "<type", "ref=\"prev\"/>", "c_ext", "=", "0", ";", "unsigned", "int", "i", ",", "<type", "ref=\"prev\"/>", "j", ";", "int", "ret", "=", "-", "1", ";", "int64_t", "v", ",", "<type", "ref=\"prev\"/>", "v_", ";", "int64_t", "p", ",", "<type", "ref=\"prev\"/>", "p_", ";", "size_t", "len", ";", "int", "in_grp", "=", "0", ";", "char", "*", "buf", ",", "<type", "ref=\"prev\"/>", "modifier", ";", "/*", "init", "*/", "memset", "(", "&", "exts", ",", "0", ",", "sizeof", "exts", ")", ";", "GETVAL", "(", "ctx", ",", "value", ",", "yin", ",", "\"name\"", ")", ";", "value", "=", "transform_schema2json", "(", "module", ",", "value", ")", ";", "if", "(", "!", "value", ")", "{", "goto", "error", ";", "}", "i", "=", "parse_identifier", "(", "value", ")", ";", "if", "(", "i", "<", "1", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_INCHAR", ",", "LY_VLOG_NONE", ",", "NULL", ",", "value", "[", "-", "i", "]", ",", "&", "value", "[", "-", "i", "]", ")", ";", "lydict_remove", "(", "ctx", ",", "value", ")", ";", "goto", "error", ";", "}", "/*", "module", "name", "*/", "name", "=", "value", ";", "if", "(", "value", "[", "i", "]", ")", "{", "module_name", "=", "lydict_insert", "(", "ctx", ",", "value", ",", "i", ")", ";", "name", "+=", "i", ";", "if", "(", "(", "name", "[", "0", "]", "!=", "\\':\\'", ")", "||", "(", "parse_identifier", "(", "name", "+", "1", ")", "<", "1", ")", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_INCHAR", ",", "LY_VLOG_NONE", ",", "NULL", ",", "name", "[", "0", "]", ",", "name", ")", ";", "lydict_remove", "(", "ctx", ",", "module_name", ")", ";", "lydict_remove", "(", "ctx", ",", "value", ")", ";", "goto", "error", ";", "}", "/*", "name", "is", "in", "dictionary,", "but", "moved", "*/", "++", "name", ";", "}", "rc", "=", "resolve_superior_type", "(", "name", ",", "module_name", ",", "module", ",", "parent", ",", "&", "type", "->", "der", ")", ";", "if", "(", "rc", "==", "-", "1", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_INMOD", ",", "LY_VLOG_NONE", ",", "NULL", ",", "module_name", ")", ";", "lydict_remove", "(", "ctx", ",", "module_name", ")", ";", "lydict_remove", "(", "ctx", ",", "value", ")", ";", "goto", "error", ";", "/*", "the", "type", "could", "not", "be", "resolved", "or", "it", "was", "resolved", "to", "an", "unresolved", "typedef", "*/", "}", "<if", "type=\"elseif\">", "else", "if", "(", "rc", "==", "EXIT_FAILURE", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_NORESOLV", ",", "LY_VLOG_NONE", ",", "NULL", ",", "\"type\"", ",", "name", ")", ";", "lydict_remove", "(", "ctx", ",", "module_name", ")", ";", "lydict_remove", "(", "ctx", ",", "value", ")", ";", "ret", "=", "EXIT_FAILURE", ";", "goto", "error", ";", "}", "lydict_remove", "(", "ctx", ",", "module_name", ")", ";", "lydict_remove", "(", "ctx", ",", "value", ")", ";", "if", "(", "type", "->", "value_flags", "&", "LY_VALUE_UNRESGRP", ")", "{", "/*", "resolved", "type", "in", "grouping,", "decrease", "the", "grouping\\'s", "nacm", "number", "to", "indicate", "that", "one", "less", "*", "unresolved", "item", "left", "inside", "the", "grouping,", "LYTYPE_GRP", "used", "as", "a", "flag", "for", "types", "inside", "a", "grouping.", "*/", "for", "(", "siter", "=", "parent", ";", "siter", "&&", "(", "siter", "->", "nodetype", "!=", "LYS_GROUPING", ")", ";", "siter", "=", "lys_parent", "(", "siter", ")", ")", ";", "if", "(", "siter", ")", "{", "assert", "(", "(", "(", "struct", "lys_node_grp", "*", ")", "siter", ")", "->", "unres_count", ")", ";", "(", "(", "struct", "lys_node_grp", "*", ")", "siter", ")", "->", "unres_count", "--", ";", "}", "else", "{", "LOGINT", "(", "ctx", ")", ";", "goto", "error", ";", "}", "type", "->", "value_flags", "&=", "~", "LY_VALUE_UNRESGRP", ";", "}", "type", "->", "base", "=", "type", "->", "der", "->", "type", ".", "base", ";", "/*", "check", "status", "*/", "if", "(", "lyp_check_status", "(", "type", "->", "parent", "->", "flags", ",", "type", "->", "parent", "->", "module", ",", "type", "->", "parent", "->", "name", ",", "type", "->", "der", "->", "flags", ",", "type", "->", "der", "->", "module", ",", "type", "->", "der", "->", "name", ",", "parent", ")", ")", "{", "return", "-", "1", ";", "}", "/*", "parse", "extension", "instances", "*/", "LY_TREE_FOR_SAFE", "(", "yin->child", ",", "next", ",", "node", ")", "{", "if", "(", "!", "node", "->", "ns", ")", "{", "/*", "garbage", "*/", "lyxml_free", "(", "ctx", ",", "node", ")", ";", "continue;", "}", "<if", "type=\"elseif\">", "else", "if", "(", "!", "strcmp", "(", "node", "->", "ns", "->", "value", ",", "LY_NSYIN", ")", ")", "{", "/*", "YANG", "(YIN)", "statements", "-", "process", "later", "*/", "continue;", "}", "YIN_CHECK_ARRAY_OVERFLOW_GOTO", "(", "ctx", ",", "c_ext", ",", "type", "->", "ext_size", ",", "\"extensions\"", ",", "\"type\"", ",", "error", ")", ";", "lyxml_unlink_elem", "(", "ctx", ",", "node", ",", "2", ")", ";", "lyxml_add_child", "(", "ctx", ",", "&", "exts", ",", "node", ")", ";", "c_ext", "++", ";", "}", "if", "(", "c_ext", ")", "{", "type", "->", "ext", "=", "calloc", "(", "c_ext", ",", "sizeof", "*", "type", "->", "ext", ")", ";", "LY_CHECK_ERR_GOTO", "(", "!", "type", "->", "ext", ",", "LOGMEM", "(", "ctx", ")", ",", "error", ")", ";", "LY_TREE_FOR_SAFE", "(", "exts.child", ",", "next", ",", "node", ")", "{", "rc", "=", "lyp_yin_fill_ext", "(", "type", ",", "LYEXT_PAR_TYPE", ",", "0", ",", "0", ",", "module", ",", "node", ",", "&", "type", "->", "ext", ",", "type", "->", "ext_size", ",", "unres", ")", ";", "type", "->", "ext_size", "++", ";", "if", "(", "rc", ")", "{", "goto", "error", ";", "}", "}", "}", "switch", "(", "type", "->", "base", ")", "{", "case", "LY_TYPE_BITS", ":", "/*", "RFC", "6020", "9.7.4", "-", "bit", "*/", "/*", "get", "bit", "specifications,", "at", "least", "one", "must", "be", "present", "*/", "LY_TREE_FOR_SAFE", "(", "yin->child", ",", "next", ",", "node", ")", "{", "if", "(", "!", "strcmp", "(", "node", "->", "name", ",", "\"bit\"", ")", ")", "{", "YIN_CHECK_ARRAY_OVERFLOW_CODE", "(", "ctx", ",", "type->info.bits.count", ",", "type->info.bits.count", ",", "\"bits\"", ",", "\"type\"", ",", "type->info.bits.count", "=", "0", ";", "goto", "error", ")", ";", "type", "->", "info", ".", "bits", ".", "count", "++", ";", "}", "else", "{", "LOGVAL", "(", "ctx", ",", "LYE_INSTMT", ",", "LY_VLOG_NONE", ",", "NULL", ",", "node", "->", "name", ")", ";", "type", "->", "info", ".", "bits", ".", "count", "=", "0", ";", "goto", "error", ";", "}", "}", "dertype", "=", "&", "type", "->", "der", "->", "type", ";", "if", "(", "!", "dertype", "->", "der", ")", "{", "if", "(", "!", "type", "->", "info", ".", "bits", ".", "count", ")", "{", "/*", "type", "is", "derived", "directly", "from", "buit-in", "bits", "type", "and", "bit", "statement", "is", "required", "*/", "LOGVAL", "(", "ctx", ",", "LYE_MISSCHILDSTMT", ",", "LY_VLOG_NONE", ",", "NULL", ",", "\"bit\"", ",", "\"type\"", ")", ";", "goto", "error", ";", "}", "}", "else", "{", "for", "(", ";", "!", "dertype", "->", "info", ".", "enums", ".", "count", ";", "dertype", "=", "&", "dertype", "->", "der", "->", "type", ")", ";", "if", "(", "module", "->", "version", "<", "2", "&&", "type", "->", "info", ".", "bits", ".", "count", ")", "{", "/*", "type", "is", "not", "directly", "derived", "from", "buit-in", "bits", "type", "and", "bit", "statement", "is", "prohibited,", "*", "since", "YANG", "1.1", "the", "bit", "statements", "can", "be", "used", "to", "restrict", "the", "base", "bits", "type", "*/", "LOGVAL", "(", "ctx", ",", "LYE_INSTMT", ",", "LY_VLOG_NONE", ",", "NULL", ",", "\"bit\"", ")", ";", "type", "->", "info", ".", "bits", ".", "count", "=", "0", ";", "goto", "error", ";", "}", "}", "type", "->", "info", ".", "bits", ".", "bit", "=", "calloc", "(", "type", "->", "info", ".", "bits", ".", "count", ",", "sizeof", "*", "type", "->", "info", ".", "bits", ".", "bit", ")", ";", "LY_CHECK_ERR_GOTO", "(", "!", "type", "->", "info", ".", "bits", ".", "bit", ",", "LOGMEM", "(", "ctx", ")", ",", "error", ")", ";", "p", "=", "0", ";", "i", "=", "0", ";", "LY_TREE_FOR", "(", "yin->child", ",", "next", ")", "{", "c_ftrs", "=", "0", ";", "GETVAL", "(", "ctx", ",", "value", ",", "next", ",", "\"name\"", ")", ";", "if", "(", "lyp_check_identifier", "(", "ctx", ",", "value", ",", "LY_IDENT_SIMPLE", ",", "NULL", ",", "NULL", ")", ")", "{", "goto", "error", ";", "}", "type", "->", "info", ".", "bits", ".", "bit", "[", "i", "]", ".", "name", "=", "lydict_insert", "(", "ctx", ",", "value", ",", "strlen", "(", "value", ")", ")", ";", "if", "(", "read_yin_common", "(", "module", ",", "NULL", ",", "&", "type", "->", "info", ".", "bits", ".", "bit", "[", "i", "]", ",", "LYEXT_PAR_TYPE_BIT", ",", "next", ",", "0", ",", "unres", ")", ")", "{", "type", "->", "info", ".", "bits", ".", "count", "=", "i", "+", "1", ";", "goto", "error", ";", "}", "if", "(", "!", "dertype", "->", "der", ")", "{", "/*", "directly", "derived", "type", "from", "bits", "built-in", "type", "*/", "/*", "check", "the", "name", "uniqueness", "*/", "for", "(", "j", "=", "0", ";", "j", "<", "i", ";", "j", "++", ")", "{", "if", "(", "!", "strcmp", "(", "type", "->", "info", ".", "bits", ".", "bit", "[", "j", "]", ".", "name", ",", "type", "->", "info", ".", "bits", ".", "bit", "[", "i", "]", ".", "name", ")", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_BITS_DUPNAME", ",", "LY_VLOG_NONE", ",", "NULL", ",", "type", "->", "info", ".", "bits", ".", "bit", "[", "i", "]", ".", "name", ")", ";", "type", "->", "info", ".", "bits", ".", "count", "=", "i", "+", "1", ";", "goto", "error", ";", "}", "}", "}", "else", "{", "/*", "restricted", "bits", "type", "-", "the", "name", "MUST", "be", "used", "in", "the", "base", "type", "*/", "bits_sc", "=", "dertype", "->", "info", ".", "bits", ".", "bit", ";", "for", "(", "j", "=", "0", ";", "j", "<", "dertype", "->", "info", ".", "bits", ".", "count", ";", "j", "++", ")", "{", "if", "(", "ly_strequal", "(", "bits_sc", "[", "j", "]", ".", "name", ",", "value", ",", "1", ")", ")", "{", "break;", "}", "}", "if", "(", "j", "==", "dertype", "->", "info", ".", "bits", ".", "count", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_BITS_INNAME", ",", "LY_VLOG_NONE", ",", "NULL", ",", "value", ")", ";", "type", "->", "info", ".", "bits", ".", "count", "=", "i", "+", "1", ";", "goto", "error", ";", "}", "}", "p_", "=", "-", "1", ";", "LY_TREE_FOR_SAFE", "(", "next->child", ",", "next2", ",", "node", ")", "{", "if", "(", "!", "node", "->", "ns", ")", "{", "/*", "garbage", "*/", "continue;", "}", "<if", "type=\"elseif\">", "else", "if", "(", "strcmp", "(", "node", "->", "ns", "->", "value", ",", "LY_NSYIN", ")", ")", "{", "/*", "extension", "*/", "if", "(", "lyp_yin_parse_subnode_ext", "(", "module", ",", "&", "type", "->", "info", ".", "bits", ".", "bit", "[", "i", "]", ",", "LYEXT_PAR_TYPE_BIT", ",", "node", ",", "LYEXT_SUBSTMT_SELF", ",", "0", ",", "unres", ")", ")", "{", "goto", "error", ";", "}", "}", "<if", "type=\"elseif\">", "else", "if", "(", "!", "strcmp", "(", "node", "->", "name", ",", "\"position\"", ")", ")", "{", "if", "(", "p_", "!=", "-", "1", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_TOOMANY", ",", "LY_VLOG_NONE", ",", "NULL", ",", "node", "->", "name", ",", "next", "->", "name", ")", ";", "type", "->", "info", ".", "bits", ".", "count", "=", "i", "+", "1", ";", "goto", "error", ";", "}", "GETVAL", "(", "ctx", ",", "value", ",", "node", ",", "\"value\"", ")", ";", "p_", "=", "strtoll", "(", "value", ",", "NULL", ",", "10", ")", ";", "/*", "range", "check", "*/", "if", "(", "p_", "<argument_list", "type=\"generic\">", "<", "0", "||", "p_", ">", "UINT32_MAX", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_INARG", ",", "LY_VLOG_NONE", ",", "NULL", ",", "value", ",", "\"bit/position\"", ")", ";", "type", "->", "info", ".", "bits", ".", "count", "=", "i", "+", "1", ";", "goto", "error", ";", "}", "type", "->", "info", ".", "bits", ".", "bit", "[", "i", "]", ".", "pos", "=", "(", "uint32_t", ")", "p_", ";", "if", "(", "!", "dertype", "->", "der", ")", "{", "/*", "directly", "derived", "type", "from", "bits", "built-in", "type", "*/", "/*", "keep", "the", "highest", "enum", "value", "for", "automatic", "increment", "*/", "if", "(", "type", "->", "info", ".", "bits", ".", "bit", "[", "i", "]", ".", "pos", ">=", "p", ")", "{", "p", "=", "type", "->", "info", ".", "bits", ".", "bit", "[", "i", "]", ".", "pos", ";", "p", "++", ";", "}", "else", "{", "/*", "check", "that", "the", "value", "is", "unique", "*/", "for", "(", "j", "=", "0", ";", "j", "<", "i", ";", "j", "++", ")", "{", "if", "(", "type", "->", "info", ".", "bits", ".", "bit", "[", "j", "]", ".", "pos", "==", "type", "->", "info", ".", "bits", ".", "bit", "[", "i", "]", ".", "pos", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_BITS_DUPVAL", ",", "LY_VLOG_NONE", ",", "NULL", ",", "type", "->", "info", ".", "bits", ".", "bit", "[", "i", "]", ".", "pos", ",", "type", "->", "info", ".", "bits", ".", "bit", "[", "i", "]", ".", "name", ",", "type", "->", "info", ".", "bits", ".", "bit", "[", "j", "]", ".", "name", ")", ";", "type", "->", "info", ".", "bits", ".", "count", "=", "i", "+", "1", ";", "goto", "error", ";", "}", "}", "}", "}", "if", "(", "lyp_yin_parse_subnode_ext", "(", "module", ",", "&", "type", "->", "info", ".", "bits", ".", "bit", "[", "i", "]", ",", "LYEXT_PAR_TYPE_BIT", ",", "node", ",", "LYEXT_SUBSTMT_POSITION", ",", "0", ",", "unres", ")", ")", "{", "goto", "error", ";", "}", "for", "(", "j", "=", "0", ";", "j", "<", "type", "->", "info", ".", "bits", ".", "bit", "[", "i", "]", ".", "ext_size", ";", "++", "j", ")", "{", "/*", "set", "flag,", "which", "represent", "LYEXT_OPT_VALID", "*/", "if", "(", "type", "->", "info", ".", "bits", ".", "bit", "[", "i", "]", ".", "ext", "[", "j", "]", "->", "flags", "&", "LYEXT_OPT_VALID", ")", "{", "type", "->", "parent", "->", "flags", "|=", "LYS_VALID_EXT", ";", "break;", "}", "}", "}", "<if", "type=\"elseif\">", "else", "if", "(", "(", "module", "->", "version", ">=", "2", ")", "&&", "!", "strcmp", "(", "node", "->", "name", ",", "\"if-feature\"", ")", ")", "{", "YIN_CHECK_ARRAY_OVERFLOW_GOTO", "(", "ctx", ",", "c_ftrs", ",", "type", "->", "info", ".", "bits", ".", "bit", "[", "i", "]", ".", "iffeature_size", ",", "\"if-features\"", ",", "\"bit\"", ",", "error", ")", ";", "c_ftrs", "++", ";", "}", "else", "{", "LOGVAL", "(", "ctx", ",", "LYE_INSTMT", ",", "LY_VLOG_NONE", ",", "NULL", ",", "node", "->", "name", ")", ";", "goto", "error", ";", "}", "}", "if", "(", "!", "dertype", "->", "der", ")", "{", "/*", "directly", "derived", "type", "from", "bits", "built-in", "type", "*/", "if", "(", "p_", "==", "-", "1", ")", "{", "/*", "assign", "value", "automatically", "*/", "if", "(", "p", ">", "UINT32_MAX", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_INARG", ",", "LY_VLOG_NONE", ",", "NULL", ",", "\"4294967295\"", ",", "\"bit/position\"", ")", ";", "type", "->", "info", ".", "bits", ".", "count", "=", "i", "+", "1", ";", "goto", "error", ";", "}", "type", "->", "info", ".", "bits", ".", "bit", "[", "i", "]", ".", "pos", "=", "(", "uint32_t", ")", "p", ";", "type", "->", "info", ".", "bits", ".", "bit", "[", "i", "]", ".", "flags", "|=", "LYS_AUTOASSIGNED", ";", "p", "++", ";", "}", "}", "else", "{", "/*", "restricted", "bits", "type", "*/", "if", "(", "p_", "==", "-", "1", ")", "{", "/*", "automatically", "assign", "position", "from", "base", "type", "*/", "type", "->", "info", ".", "bits", ".", "bit", "[", "i", "]", ".", "pos", "=", "bits_sc", "[", "j", "]", ".", "pos", ";", "type", "->", "info", ".", "bits", ".", "bit", "[", "i", "]", ".", "flags", "|=", "LYS_AUTOASSIGNED", ";", "}", "else", "{", "/*", "check", "that", "the", "assigned", "position", "corresponds", "to", "the", "original", "*", "position", "of", "the", "bit", "in", "the", "base", "type", "*/", "if", "(", "p_", "!=", "bits_sc", "[", "j", "]", ".", "pos", ")", "{", "/*", "p_", "-", "assigned", "position", "in", "restricted", "bits", "*", "bits_sc[j].pos", "-", "position", "assigned", "to", "the", "corresponding", "bit", "(detected", "above)", "in", "base", "type", "*/", "LOGVAL", "(", "ctx", ",", "LYE_BITS_INVAL", ",", "LY_VLOG_NONE", ",", "NULL", ",", "type", "->", "info", ".", "bits", ".", "bit", "[", "i", "]", ".", "pos", ",", "type", "->", "info", ".", "bits", ".", "bit", "[", "i", "]", ".", "name", ",", "bits_sc", "[", "j", "]", ".", "pos", ")", ";", "type", "->", "info", ".", "bits", ".", "count", "=", "i", "+", "1", ";", "goto", "error", ";", "}", "}", "}", "/*", "if-features", "*/", "if", "(", "c_ftrs", ")", "{", "bits_sc", "=", "&", "type", "->", "info", ".", "bits", ".", "bit", "[", "i", "]", ";", "bits_sc", "->", "iffeature", "=", "calloc", "(", "c_ftrs", ",", "sizeof", "*", "bits_sc", "->", "iffeature", ")", ";", "if", "(", "!", "bits_sc", "->", "iffeature", ")", "{", "LOGMEM", "(", "ctx", ")", ";", "type", "->", "info", ".", "bits", ".", "count", "=", "i", "+", "1", ";", "goto", "error", ";", "}", "LY_TREE_FOR", "(", "next->child", ",", "node", ")", "{", "if", "(", "!", "strcmp", "(", "node", "->", "name", ",", "\"if-feature\"", ")", ")", "{", "rc", "=", "fill_yin_iffeature", "(", "(", "struct", "lys_node", "*", ")", "type", "->", "parent", ",", "0", ",", "node", ",", "&", "bits_sc", "->", "iffeature", "[", "bits_sc", "->", "iffeature_size", "]", ",", "unres", ")", ";", "bits_sc", "->", "iffeature_size", "++", ";", "if", "(", "rc", ")", "{", "type", "->", "info", ".", "bits", ".", "count", "=", "i", "+", "1", ";", "goto", "error", ";", "}", "}", "}", "}", "/*", "keep", "them", "ordered", "by", "position", "*/", "j", "=", "i", ";", "while", "(", "j", "&&", "type", "->", "info", ".", "bits", ".", "bit", "[", "j", "-", "1", "]", ".", "pos", ">", "type", "->", "info", ".", "bits", ".", "bit", "[", "j", "]", ".", "pos", ")", "{", "/*", "switch", "them", "*/", "memcpy", "(", "&", "bit", ",", "&", "type", "->", "info", ".", "bits", ".", "bit", "[", "j", "]", ",", "sizeof", "bit", ")", ";", "memcpy", "(", "&", "type", "->", "info", ".", "bits", ".", "bit", "[", "j", "]", ",", "&", "type", "->", "info", ".", "bits", ".", "bit", "[", "j", "-", "1", "]", ",", "sizeof", "bit", ")", ";", "memcpy", "(", "&", "type", "->", "info", ".", "bits", ".", "bit", "[", "j", "-", "1", "]", ",", "&", "bit", ",", "sizeof", "bit", ")", ";", "j", "--", ";", "}", "++", "i", ";", "}", "break;", "case", "LY_TYPE_DEC64", ":", "/*", "RFC", "6020", "9.2.4", "-", "range", "and", "9.3.4", "-", "fraction-digits", "*/", "LY_TREE_FOR", "(", "yin->child", ",", "node", ")", "{", "if", "(", "!", "strcmp", "(", "node", "->", "name", ",", "\"range\"", ")", ")", "{", "if", "(", "type", "->", "info", ".", "dec64", ".", "range", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_TOOMANY", ",", "LY_VLOG_NONE", ",", "NULL", ",", "node", "->", "name", ",", "yin", "->", "name", ")", ";", "goto", "error", ";", "}", "GETVAL", "(", "ctx", ",", "value", ",", "node", ",", "\"value\"", ")", ";", "type", "->", "info", ".", "dec64", ".", "range", "=", "calloc", "(", "1", ",", "sizeof", "*", "type", "->", "info", ".", "dec64", ".", "range", ")", ";", "LY_CHECK_ERR_GOTO", "(", "!", "type", "->", "info", ".", "dec64", ".", "range", ",", "LOGMEM", "(", "ctx", ")", ",", "error", ")", ";", "type", "->", "info", ".", "dec64", ".", "range", "->", "expr", "=", "lydict_insert", "(", "ctx", ",", "value", ",", "0", ")", ";", "/*", "get", "possible", "substatements", "*/", "if", "(", "read_restr_substmt", "(", "module", ",", "type", "->", "info", ".", "dec64", ".", "range", ",", "node", ",", "unres", ")", ")", "{", "goto", "error", ";", "}", "for", "(", "j", "=", "0", ";", "j", "<", "type", "->", "info", ".", "dec64", ".", "range", "->", "ext_size", ";", "++", "j", ")", "{", "/*", "set", "flag,", "which", "represent", "LYEXT_OPT_VALID", "*/", "if", "(", "type", "->", "info", ".", "dec64", ".", "range", "->", "ext", "[", "j", "]", "->", "flags", "&", "LYEXT_OPT_VALID", ")", "{", "type", "->", "parent", "->", "flags", "|=", "LYS_VALID_EXT", ";", "break;", "}", "}", "}", "<if", "type=\"elseif\">", "else", "if", "(", "!", "strcmp", "(", "node", "->", "name", ",", "\"fraction-digits\"", ")", ")", "{", "if", "(", "type", "->", "info", ".", "dec64", ".", "dig", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_TOOMANY", ",", "LY_VLOG_NONE", ",", "NULL", ",", "node", "->", "name", ",", "yin", "->", "name", ")", ";", "goto", "error", ";", "}", "GETVAL", "(", "ctx", ",", "value", ",", "node", ",", "\"value\"", ")", ";", "v", "=", "strtol", "(", "value", ",", "NULL", ",", "10", ")", ";", "/*", "range", "check", "*/", "if", "(", "v", "<argument_list", "type=\"generic\">", "<", "1", "||", "v", ">", "18", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_INARG", ",", "LY_VLOG_NONE", ",", "NULL", ",", "value", ",", "node", "->", "name", ")", ";", "goto", "error", ";", "}", "type", "->", "info", ".", "dec64", ".", "dig", "=", "(", "uint8_t", ")", "v", ";", "type", "->", "info", ".", "dec64", ".", "div", "=", "10", ";", "for", "(", "i", "=", "1", ";", "i", "<", "v", ";", "i", "++", ")", "{", "type", "->", "info", ".", "dec64", ".", "div", "*=", "10", ";", "}", "/*", "extensions", "*/", "if", "(", "lyp_yin_parse_subnode_ext", "(", "module", ",", "type", ",", "LYEXT_PAR_TYPE", ",", "node", ",", "LYEXT_SUBSTMT_DIGITS", ",", "0", ",", "unres", ")", ")", "{", "goto", "error", ";", "}", "}", "else", "{", "LOGVAL", "(", "ctx", ",", "LYE_INSTMT", ",", "LY_VLOG_NONE", ",", "NULL", ",", "node", "->", "name", ")", ";", "goto", "error", ";", "}", "}", "/*", "mandatory", "sub-statement(s)", "check", "*/", "if", "(", "!", "type", "->", "info", ".", "dec64", ".", "dig", "&&", "!", "type", "->", "der", "->", "type", ".", "der", ")", "{", "/*", "decimal64", "type", "directly", "derived", "from", "built-in", "type", "requires", "fraction-digits", "*/", "LOGVAL", "(", "ctx", ",", "LYE_MISSCHILDSTMT", ",", "LY_VLOG_NONE", ",", "NULL", ",", "\"fraction-digits\"", ",", "\"type\"", ")", ";", "goto", "error", ";", "}", "if", "(", "type", "->", "info", ".", "dec64", ".", "dig", "&&", "type", "->", "der", "->", "type", ".", "der", ")", "{", "/*", "type", "is", "not", "directly", "derived", "from", "buit-in", "type", "and", "fraction-digits", "statement", "is", "prohibited", "*/", "LOGVAL", "(", "ctx", ",", "LYE_INSTMT", ",", "LY_VLOG_NONE", ",", "NULL", ",", "\"fraction-digits\"", ")", ";", "goto", "error", ";", "}", "/*", "copy", "fraction-digits", "specification", "from", "parent", "type", "for", "easier", "internal", "use", "*/", "if", "(", "type", "->", "der", "->", "type", ".", "der", ")", "{", "type", "->", "info", ".", "dec64", ".", "dig", "=", "type", "->", "der", "->", "type", ".", "info", ".", "dec64", ".", "dig", ";", "type", "->", "info", ".", "dec64", ".", "div", "=", "type", "->", "der", "->", "type", ".", "info", ".", "dec64", ".", "div", ";", "}", "if", "(", "type", "->", "info", ".", "dec64", ".", "range", "&&", "lyp_check_length_range", "(", "ctx", ",", "type", "->", "info", ".", "dec64", ".", "range", "->", "expr", ",", "type", ")", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_INARG", ",", "LY_VLOG_NONE", ",", "NULL", ",", "value", ",", "\"range\"", ")", ";", "goto", "error", ";", "}", "break;", "case", "LY_TYPE_ENUM", ":", "/*", "RFC", "6020", "9.6", "-", "enum", "*/", "/*", "get", "enum", "specifications,", "at", "least", "one", "must", "be", "present", "*/", "LY_TREE_FOR_SAFE", "(", "yin->child", ",", "next", ",", "node", ")", "{", "if", "(", "!", "strcmp", "(", "node", "->", "name", ",", "\"enum\"", ")", ")", "{", "YIN_CHECK_ARRAY_OVERFLOW_CODE", "(", "ctx", ",", "type->info.enums.count", ",", "type->info.enums.count", ",", "\"enums\"", ",", "\"type\"", ",", "type->info.enums.count", "=", "0", ";", "goto", "error", ")", ";", "type", "->", "info", ".", "enums", ".", "count", "++", ";", "}", "else", "{", "LOGVAL", "(", "ctx", ",", "LYE_INSTMT", ",", "LY_VLOG_NONE", ",", "NULL", ",", "node", "->", "name", ")", ";", "type", "->", "info", ".", "enums", ".", "count", "=", "0", ";", "goto", "error", ";", "}", "}", "dertype", "=", "&", "type", "->", "der", "->", "type", ";", "if", "(", "!", "dertype", "->", "der", ")", "{", "if", "(", "!", "type", "->", "info", ".", "enums", ".", "count", ")", "{", "/*", "type", "is", "derived", "directly", "from", "buit-in", "enumeartion", "type", "and", "enum", "statement", "is", "required", "*/", "LOGVAL", "(", "ctx", ",", "LYE_MISSCHILDSTMT", ",", "LY_VLOG_NONE", ",", "NULL", ",", "\"enum\"", ",", "\"type\"", ")", ";", "goto", "error", ";", "}", "}", "else", "{", "for", "(", ";", "!", "dertype", "->", "info", ".", "enums", ".", "count", ";", "dertype", "=", "&", "dertype", "->", "der", "->", "type", ")", ";", "if", "(", "module", "->", "version", "<", "2", "&&", "type", "->", "info", ".", "enums", ".", "count", ")", "{", "/*", "type", "is", "not", "directly", "derived", "from", "built-in", "enumeration", "type", "and", "enum", "statement", "is", "prohibited", "*", "in", "YANG", "1.0,", "since", "YANG", "1.1", "enum", "statements", "can", "be", "used", "to", "restrict", "the", "base", "enumeration", "type", "*/", "LOGVAL", "(", "ctx", ",", "LYE_INSTMT", ",", "LY_VLOG_NONE", ",", "NULL", ",", "\"enum\"", ")", ";", "type", "->", "info", ".", "enums", ".", "count", "=", "0", ";", "goto", "error", ";", "}", "}", "type", "->", "info", ".", "enums", ".", "enm", "=", "calloc", "(", "type", "->", "info", ".", "enums", ".", "count", ",", "sizeof", "*", "type", "->", "info", ".", "enums", ".", "enm", ")", ";", "LY_CHECK_ERR_GOTO", "(", "!", "type", "->", "info", ".", "enums", ".", "enm", ",", "LOGMEM", "(", "ctx", ")", ",", "error", ")", ";", "v", "=", "0", ";", "i", "=", "0", ";", "LY_TREE_FOR", "(", "yin->child", ",", "next", ")", "{", "c_ftrs", "=", "0", ";", "GETVAL", "(", "ctx", ",", "value", ",", "next", ",", "\"name\"", ")", ";", "if", "(", "!", "value", "[", "0", "]", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_INARG", ",", "LY_VLOG_NONE", ",", "NULL", ",", "value", ",", "\"enum", "name\"", ")", ";", "LOGVAL", "(", "ctx", ",", "LYE_SPEC", ",", "LY_VLOG_NONE", ",", "NULL", ",", "\"Enum", "name", "must", "not", "be", "empty.\"", ")", ";", "goto", "error", ";", "}", "type", "->", "info", ".", "enums", ".", "enm", "[", "i", "]", ".", "name", "=", "lydict_insert", "(", "ctx", ",", "value", ",", "strlen", "(", "value", ")", ")", ";", "if", "(", "read_yin_common", "(", "module", ",", "NULL", ",", "&", "type", "->", "info", ".", "enums", ".", "enm", "[", "i", "]", ",", "LYEXT_PAR_TYPE_ENUM", ",", "next", ",", "0", ",", "unres", ")", ")", "{", "type", "->", "info", ".", "enums", ".", "count", "=", "i", "+", "1", ";", "goto", "error", ";", "}", "/*", "the", "assigned", "name", "MUST", "NOT", "have", "any", "leading", "or", "trailing", "whitespace", "characters", "*/", "value", "=", "type", "->", "info", ".", "enums", ".", "enm", "[", "i", "]", ".", "name", ";", "if", "(", "isspace", "(", "value", "[", "0", "]", ")", "||", "isspace", "(", "value", "[", "strlen", "(", "value", ")", "-", "1", "]", ")", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_ENUM_WS", ",", "LY_VLOG_NONE", ",", "NULL", ",", "value", ")", ";", "type", "->", "info", ".", "enums", ".", "count", "=", "i", "+", "1", ";", "goto", "error", ";", "}", "if", "(", "!", "dertype", "->", "der", ")", "{", "/*", "directly", "derived", "type", "from", "enumeration", "built-in", "type", "*/", "/*", "check", "the", "name", "uniqueness", "*/", "for", "(", "j", "=", "0", ";", "j", "<", "i", ";", "j", "++", ")", "{", "if", "(", "ly_strequal", "(", "type", "->", "info", ".", "enums", ".", "enm", "[", "j", "]", ".", "name", ",", "value", ",", "1", ")", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_ENUM_DUPNAME", ",", "LY_VLOG_NONE", ",", "NULL", ",", "value", ")", ";", "type", "->", "info", ".", "enums", ".", "count", "=", "i", "+", "1", ";", "goto", "error", ";", "}", "}", "}", "else", "{", "/*", "restricted", "enumeration", "type", "-", "the", "name", "MUST", "be", "used", "in", "the", "base", "type", "*/", "enms_sc", "=", "dertype", "->", "info", ".", "enums", ".", "enm", ";", "for", "(", "j", "=", "0", ";", "j", "<", "dertype", "->", "info", ".", "enums", ".", "count", ";", "j", "++", ")", "{", "if", "(", "ly_strequal", "(", "enms_sc", "[", "j", "]", ".", "name", ",", "value", ",", "1", ")", ")", "{", "break;", "}", "}", "if", "(", "j", "==", "dertype", "->", "info", ".", "enums", ".", "count", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_ENUM_INNAME", ",", "LY_VLOG_NONE", ",", "NULL", ",", "value", ")", ";", "type", "->", "info", ".", "enums", ".", "count", "=", "i", "+", "1", ";", "goto", "error", ";", "}", "}", "val_set", "=", "0", ";", "LY_TREE_FOR_SAFE", "(", "next->child", ",", "next2", ",", "node", ")", "{", "if", "(", "!", "node", "->", "ns", ")", "{", "/*", "garbage", "*/", "continue;", "}", "<if", "type=\"elseif\">", "else", "if", "(", "strcmp", "(", "node", "->", "ns", "->", "value", ",", "LY_NSYIN", ")", ")", "{", "/*", "extensions", "*/", "if", "(", "lyp_yin_parse_subnode_ext", "(", "module", ",", "&", "type", "->", "info", ".", "enums", ".", "enm", "[", "i", "]", ",", "LYEXT_PAR_TYPE_ENUM", ",", "node", ",", "LYEXT_SUBSTMT_SELF", ",", "0", ",", "unres", ")", ")", "{", "goto", "error", ";", "}", "}", "<if", "type=\"elseif\">", "else", "if", "(", "!", "strcmp", "(", "node", "->", "name", ",", "\"value\"", ")", ")", "{", "if", "(", "val_set", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_TOOMANY", ",", "LY_VLOG_NONE", ",", "NULL", ",", "node", "->", "name", ",", "next", "->", "name", ")", ";", "type", "->", "info", ".", "enums", ".", "count", "=", "i", "+", "1", ";", "goto", "error", ";", "}", "GETVAL", "(", "ctx", ",", "value", ",", "node", ",", "\"value\"", ")", ";", "v_", "=", "strtoll", "(", "value", ",", "NULL", ",", "10", ")", ";", "/*", "range", "check", "*/", "if", "(", "v_", "<argument_list", "type=\"generic\">", "<", "INT32_MIN", "||", "v_", ">", "INT32_MAX", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_INARG", ",", "LY_VLOG_NONE", ",", "NULL", ",", "value", ",", "\"enum/value\"", ")", ";", "type", "->", "info", ".", "enums", ".", "count", "=", "i", "+", "1", ";", "goto", "error", ";", "}", "type", "->", "info", ".", "enums", ".", "enm", "[", "i", "]", ".", "value", "=", "v_", ";", "if", "(", "!", "dertype", "->", "der", ")", "{", "/*", "directly", "derived", "type", "from", "enumeration", "built-in", "type", "*/", "if", "(", "!", "i", ")", "{", "/*", "change", "value,", "which", "is", "assigned", "automatically,", "if", "first", "enum", "has", "value.", "*/", "v", "=", "type", "->", "info", ".", "enums", ".", "enm", "[", "i", "]", ".", "value", ";", "v", "++", ";", "}", "else", "{", "/*", "keep", "the", "highest", "enum", "value", "for", "automatic", "increment", "*/", "if", "(", "type", "->", "info", ".", "enums", ".", "enm", "[", "i", "]", ".", "value", ">=", "v", ")", "{", "v", "=", "type", "->", "info", ".", "enums", ".", "enm", "[", "i", "]", ".", "value", ";", "v", "++", ";", "}", "else", "{", "/*", "check", "that", "the", "value", "is", "unique", "*/", "for", "(", "j", "=", "0", ";", "j", "<", "i", ";", "j", "++", ")", "{", "if", "(", "type", "->", "info", ".", "enums", ".", "enm", "[", "j", "]", ".", "value", "==", "type", "->", "info", ".", "enums", ".", "enm", "[", "i", "]", ".", "value", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_ENUM_DUPVAL", ",", "LY_VLOG_NONE", ",", "NULL", ",", "type", "->", "info", ".", "enums", ".", "enm", "[", "i", "]", ".", "value", ",", "type", "->", "info", ".", "enums", ".", "enm", "[", "i", "]", ".", "name", ",", "type", "->", "info", ".", "enums", ".", "enm", "[", "j", "]", ".", "name", ")", ";", "type", "->", "info", ".", "enums", ".", "count", "=", "i", "+", "1", ";", "goto", "error", ";", "}", "}", "}", "}", "}", "val_set", "=", "1", ";", "if", "(", "lyp_yin_parse_subnode_ext", "(", "module", ",", "&", "type", "->", "info", ".", "enums", ".", "enm", "[", "i", "]", ",", "LYEXT_PAR_TYPE_ENUM", ",", "node", ",", "LYEXT_SUBSTMT_VALUE", ",", "0", ",", "unres", ")", ")", "{", "goto", "error", ";", "}", "for", "(", "j", "=", "0", ";", "j", "<", "type", "->", "info", ".", "enums", ".", "enm", "[", "i", "]", ".", "ext_size", ";", "++", "j", ")", "{", "/*", "set", "flag,", "which", "represent", "LYEXT_OPT_VALID", "*/", "if", "(", "type", "->", "info", ".", "enums", ".", "enm", "[", "i", "]", ".", "ext", "[", "j", "]", "->", "flags", "&", "LYEXT_OPT_VALID", ")", "{", "type", "->", "parent", "->", "flags", "|=", "LYS_VALID_EXT", ";", "break;", "}", "}", "}", "<if", "type=\"elseif\">", "else", "if", "(", "(", "module", "->", "version", ">=", "2", ")", "&&", "!", "strcmp", "(", "node", "->", "name", ",", "\"if-feature\"", ")", ")", "{", "YIN_CHECK_ARRAY_OVERFLOW_GOTO", "(", "ctx", ",", "c_ftrs", ",", "type", "->", "info", ".", "enums", ".", "enm", "[", "i", "]", ".", "iffeature_size", ",", "\"if-features\"", ",", "\"enum\"", ",", "error", ")", ";", "c_ftrs", "++", ";", "}", "else", "{", "LOGVAL", "(", "ctx", ",", "LYE_INSTMT", ",", "LY_VLOG_NONE", ",", "NULL", ",", "node", "->", "name", ")", ";", "goto", "error", ";", "}", "}", "if", "(", "!", "dertype", "->", "der", ")", "{", "/*", "directly", "derived", "type", "from", "enumeration", "*/", "if", "(", "!", "val_set", ")", "{", "/*", "assign", "value", "automatically", "*/", "if", "(", "v", ">", "INT32_MAX", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_INARG", ",", "LY_VLOG_NONE", ",", "NULL", ",", "\"2147483648\"", ",", "\"enum/value\"", ")", ";", "type", "->", "info", ".", "enums", ".", "count", "=", "i", "+", "1", ";", "goto", "error", ";", "}", "type", "->", "info", ".", "enums", ".", "enm", "[", "i", "]", ".", "value", "=", "v", ";", "type", "->", "info", ".", "enums", ".", "enm", "[", "i", "]", ".", "flags", "|=", "LYS_AUTOASSIGNED", ";", "v", "++", ";", "}", "}", "else", "{", "/*", "restricted", "enum", "type", "*/", "if", "(", "!", "val_set", ")", "{", "/*", "automatically", "assign", "value", "from", "base", "type", "*/", "type", "->", "info", ".", "enums", ".", "enm", "[", "i", "]", ".", "value", "=", "enms_sc", "[", "j", "]", ".", "value", ";", "type", "->", "info", ".", "enums", ".", "enm", "[", "i", "]", ".", "flags", "|=", "LYS_AUTOASSIGNED", ";", "}", "else", "{", "/*", "check", "that", "the", "assigned", "value", "corresponds", "to", "the", "original", "*", "value", "of", "the", "enum", "in", "the", "base", "type", "*/", "if", "(", "v_", "!=", "enms_sc", "[", "j", "]", ".", "value", ")", "{", "/*", "v_", "-", "assigned", "value", "in", "restricted", "enum", "*", "enms_sc[j].value", "-", "value", "assigned", "to", "the", "corresponding", "enum", "(detected", "above)", "in", "base", "type", "*/", "LOGVAL", "(", "ctx", ",", "LYE_ENUM_INVAL", ",", "LY_VLOG_NONE", ",", "NULL", ",", "type", "->", "info", ".", "enums", ".", "enm", "[", "i", "]", ".", "value", ",", "type", "->", "info", ".", "enums", ".", "enm", "[", "i", "]", ".", "name", ",", "enms_sc", "[", "j", "]", ".", "value", ")", ";", "type", "->", "info", ".", "enums", ".", "count", "=", "i", "+", "1", ";", "goto", "error", ";", "}", "}", "}", "/*", "if-features", "*/", "if", "(", "c_ftrs", ")", "{", "enms_sc", "=", "&", "type", "->", "info", ".", "enums", ".", "enm", "[", "i", "]", ";", "enms_sc", "->", "iffeature", "=", "calloc", "(", "c_ftrs", ",", "sizeof", "*", "enms_sc", "->", "iffeature", ")", ";", "if", "(", "!", "enms_sc", "->", "iffeature", ")", "{", "LOGMEM", "(", "ctx", ")", ";", "type", "->", "info", ".", "enums", ".", "count", "=", "i", "+", "1", ";", "goto", "error", ";", "}", "LY_TREE_FOR", "(", "next->child", ",", "node", ")", "{", "if", "(", "!", "strcmp", "(", "node", "->", "name", ",", "\"if-feature\"", ")", ")", "{", "rc", "=", "fill_yin_iffeature", "(", "(", "struct", "lys_node", "*", ")", "type", "->", "parent", ",", "0", ",", "node", ",", "&", "enms_sc", "->", "iffeature", "[", "enms_sc", "->", "iffeature_size", "]", ",", "unres", ")", ";", "enms_sc", "->", "iffeature_size", "++", ";", "if", "(", "rc", ")", "{", "type", "->", "info", ".", "enums", ".", "count", "=", "i", "+", "1", ";", "goto", "error", ";", "}", "}", "}", "}", "++", "i", ";", "}", "break;", "case", "LY_TYPE_IDENT", ":", "/*", "RFC", "6020", "9.10", "-", "base", "*/", "/*", "get", "base", "specification,", "at", "least", "one", "must", "be", "present", "*/", "LY_TREE_FOR_SAFE", "(", "yin->child", ",", "next", ",", "node", ")", "{", "if", "(", "strcmp", "(", "node", "->", "name", ",", "\"base\"", ")", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_INSTMT", ",", "LY_VLOG_NONE", ",", "NULL", ",", "node", "->", "name", ")", ";", "goto", "error", ";", "}", "GETVAL", "(", "ctx", ",", "value", ",", "yin", "->", "child", ",", "\"name\"", ")", ";", "/*", "store", "in", "the", "JSON", "format", "*/", "value", "=", "transform_schema2json", "(", "module", ",", "value", ")", ";", "if", "(", "!", "value", ")", "{", "goto", "error", ";", "}", "rc", "=", "unres_schema_add_str", "(", "module", ",", "unres", ",", "type", ",", "UNRES_TYPE_IDENTREF", ",", "value", ")", ";", "lydict_remove", "(", "ctx", ",", "value", ")", ";", "if", "(", "rc", "==", "-", "1", ")", "{", "goto", "error", ";", "}", "if", "(", "lyp_yin_parse_subnode_ext", "(", "module", ",", "type", ",", "LYEXT_PAR_TYPE", ",", "node", ",", "LYEXT_SUBSTMT_BASE", ",", "0", ",", "unres", ")", ")", "{", "goto", "error", ";", "}", "}", "if", "(", "!", "yin", "->", "child", ")", "{", "if", "(", "type", "->", "der", "->", "type", ".", "der", ")", "{", "/*", "this", "is", "just", "a", "derived", "type", "with", "no", "base", "required", "*/", "break;", "}", "LOGVAL", "(", "ctx", ",", "LYE_MISSCHILDSTMT", ",", "LY_VLOG_NONE", ",", "NULL", ",", "\"base\"", ",", "\"type\"", ")", ";", "goto", "error", ";", "}", "else", "{", "if", "(", "type", "->", "der", "->", "type", ".", "der", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_INSTMT", ",", "LY_VLOG_NONE", ",", "NULL", ",", "\"base\"", ")", ";", "goto", "error", ";", "}", "}", "if", "(", "yin", "->", "child", "->", "next", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_TOOMANY", ",", "LY_VLOG_NONE", ",", "NULL", ",", "yin", "->", "child", "->", "next", "->", "name", ",", "yin", "->", "name", ")", ";", "goto", "error", ";", "}", "break;", "case", "LY_TYPE_INST", ":", "/*", "RFC", "6020", "9.13.2", "-", "require-instance", "*/", "LY_TREE_FOR", "(", "yin->child", ",", "node", ")", "{", "if", "(", "!", "strcmp", "(", "node", "->", "name", ",", "\"require-instance\"", ")", ")", "{", "if", "(", "type", "->", "info", ".", "inst", ".", "req", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_TOOMANY", ",", "LY_VLOG_NONE", ",", "NULL", ",", "node", "->", "name", ",", "yin", "->", "name", ")", ";", "goto", "error", ";", "}", "GETVAL", "(", "ctx", ",", "value", ",", "node", ",", "\"value\"", ")", ";", "if", "(", "!", "strcmp", "(", "value", ",", "\"true\"", ")", ")", "{", "type", "->", "info", ".", "inst", ".", "req", "=", "1", ";", "}", "<if", "type=\"elseif\">", "else", "if", "(", "!", "strcmp", "(", "value", ",", "\"false\"", ")", ")", "{", "type", "->", "info", ".", "inst", ".", "req", "=", "-", "1", ";", "}", "else", "{", "LOGVAL", "(", "ctx", ",", "LYE_INARG", ",", "LY_VLOG_NONE", ",", "NULL", ",", "value", ",", "node", "->", "name", ")", ";", "goto", "error", ";", "}", "/*", "extensions", "*/", "if", "(", "lyp_yin_parse_subnode_ext", "(", "module", ",", "type", ",", "LYEXT_PAR_TYPE", ",", "node", ",", "LYEXT_SUBSTMT_REQINSTANCE", ",", "0", ",", "unres", ")", ")", "{", "goto", "error", ";", "}", "}", "else", "{", "LOGVAL", "(", "ctx", ",", "LYE_INSTMT", ",", "LY_VLOG_NONE", ",", "NULL", ",", "node", "->", "name", ")", ";", "goto", "error", ";", "}", "}", "if", "(", "type", "->", "der", "->", "type", ".", "der", "&&", "!", "type", "->", "info", ".", "inst", ".", "req", ")", "{", "/*", "inherit", "require-instance", "property", "*/", "type", "->", "info", ".", "inst", ".", "req", "=", "type", "->", "der", "->", "type", ".", "info", ".", "inst", ".", "req", ";", "}", "break;", "case", "LY_TYPE_BINARY", ":", "/*", "RFC", "6020", "9.8.1,", "9.4.4", "-", "length,", "number", "of", "octets", "it", "contains", "*/", "case", "LY_TYPE_INT8", ":", "case", "LY_TYPE_INT16", ":", "case", "LY_TYPE_INT32", ":", "case", "LY_TYPE_INT64", ":", "case", "LY_TYPE_UINT8", ":", "case", "LY_TYPE_UINT16", ":", "case", "LY_TYPE_UINT32", ":", "case", "LY_TYPE_UINT64", ":", "/*", "RFC", "6020", "9.2.4", "-", "range", "*/", "/*", "length", "and", "range", "are", "actually", "the", "same", "restriction,", "so", "process", "*", "them", "by", "this", "common", "code,", "we", "just", "need", "to", "differ", "the", "name", "and", "*", "structure", "where", "the", "information", "will", "be", "stored", "*/", "if", "(", "type", "->", "base", "==", "LY_TYPE_BINARY", ")", "{", "restrs", "=", "&", "type", "->", "info", ".", "binary", ".", "length", ";", "name", "=", "\"length\"", ";", "}", "else", "{", "restrs", "=", "&", "type", "->", "info", ".", "num", ".", "range", ";", "name", "=", "\"range\"", ";", "}", "LY_TREE_FOR", "(", "yin->child", ",", "node", ")", "{", "if", "(", "!", "strcmp", "(", "node", "->", "name", ",", "name", ")", ")", "{", "if", "(", "*", "restrs", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_TOOMANY", ",", "LY_VLOG_NONE", ",", "NULL", ",", "node", "->", "name", ",", "yin", "->", "name", ")", ";", "goto", "error", ";", "}", "GETVAL", "(", "ctx", ",", "value", ",", "node", ",", "\"value\"", ")", ";", "if", "(", "lyp_check_length_range", "(", "ctx", ",", "value", ",", "type", ")", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_INARG", ",", "LY_VLOG_NONE", ",", "NULL", ",", "value", ",", "name", ")", ";", "goto", "error", ";", "}", "*", "restrs", "=", "calloc", "(", "1", ",", "sizeof", "*", "*", "restrs", ")", ";", "LY_CHECK_ERR_GOTO", "(", "!", "(", "*", "restrs", ")", ",", "LOGMEM", "(", "ctx", ")", ",", "error", ")", ";", "(", "*", "restrs", ")", "->", "expr", "=", "lydict_insert", "(", "ctx", ",", "value", ",", "0", ")", ";", "/*", "get", "possible", "substatements", "*/", "if", "(", "read_restr_substmt", "(", "module", ",", "*", "restrs", ",", "node", ",", "unres", ")", ")", "{", "goto", "error", ";", "}", "for", "(", "j", "=", "0", ";", "j", "<", "(", "*", "restrs", ")", "->", "ext_size", ";", "++", "j", ")", "{", "/*", "set", "flag,", "which", "represent", "LYEXT_OPT_VALID", "*/", "if", "(", "(", "*", "restrs", ")", "->", "ext", "[", "j", "]", "->", "flags", "&", "LYEXT_OPT_VALID", ")", "{", "type", "->", "parent", "->", "flags", "|=", "LYS_VALID_EXT", ";", "break;", "}", "}", "}", "else", "{", "LOGVAL", "(", "ctx", ",", "LYE_INSTMT", ",", "LY_VLOG_NONE", ",", "NULL", ",", "node", "->", "name", ")", ";", "goto", "error", ";", "}", "}", "break;", "case", "LY_TYPE_LEAFREF", ":", "/*", "flag", "resolving", "for", "later", "use", "*/", "if", "(", "!", "parenttype", "&&", "lys_ingrouping", "(", "parent", ")", ")", "{", "/*", "just", "a", "flag", "-", "do", "not", "resolve", "*/", "parenttype", "=", "1", ";", "}", "/*", "RFC", "6020", "9.9.2", "-", "path", "*/", "LY_TREE_FOR", "(", "yin->child", ",", "node", ")", "{", "if", "(", "!", "strcmp", "(", "node", "->", "name", ",", "\"path\"", ")", "&&", "!", "type", "->", "der", "->", "type", ".", "der", ")", "{", "/*", "keep", "path", "for", "later", "*/", "}", "<if", "type=\"elseif\">", "else", "if", "(", "module", "->", "version", ">=", "2", "&&", "!", "strcmp", "(", "node", "->", "name", ",", "\"require-instance\"", ")", ")", "{", "if", "(", "type", "->", "info", ".", "lref", ".", "req", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_TOOMANY", ",", "LY_VLOG_NONE", ",", "NULL", ",", "node", "->", "name", ",", "yin", "->", "name", ")", ";", "goto", "error", ";", "}", "GETVAL", "(", "ctx", ",", "value", ",", "node", ",", "\"value\"", ")", ";", "if", "(", "!", "strcmp", "(", "value", ",", "\"true\"", ")", ")", "{", "type", "->", "info", ".", "lref", ".", "req", "=", "1", ";", "}", "<if", "type=\"elseif\">", "else", "if", "(", "!", "strcmp", "(", "value", ",", "\"false\"", ")", ")", "{", "type", "->", "info", ".", "lref", ".", "req", "=", "-", "1", ";", "}", "else", "{", "LOGVAL", "(", "ctx", ",", "LYE_INARG", ",", "LY_VLOG_NONE", ",", "NULL", ",", "value", ",", "node", "->", "name", ")", ";", "goto", "error", ";", "}", "/*", "extensions", "*/", "if", "(", "lyp_yin_parse_subnode_ext", "(", "module", ",", "type", ",", "LYEXT_PAR_TYPE", ",", "node", ",", "LYEXT_SUBSTMT_REQINSTANCE", ",", "0", ",", "unres", ")", ")", "{", "goto", "error", ";", "}", "}", "else", "{", "LOGVAL", "(", "ctx", ",", "LYE_INSTMT", ",", "LY_VLOG_NONE", ",", "NULL", ",", "node", "->", "name", ")", ";", "goto", "error", ";", "}", "}", "/*", "now", "that", "require-instance", "is", "properly", "set,", "try", "to", "find", "and", "resolve", "path", "*/", "LY_TREE_FOR", "(", "yin->child", ",", "node", ")", "{", "if", "(", "!", "strcmp", "(", "node", "->", "name", ",", "\"path\"", ")", "&&", "!", "type", "->", "der", "->", "type", ".", "der", ")", "{", "if", "(", "type", "->", "info", ".", "lref", ".", "path", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_TOOMANY", ",", "LY_VLOG_NONE", ",", "NULL", ",", "node", "->", "name", ",", "yin", "->", "name", ")", ";", "goto", "error", ";", "}", "GETVAL", "(", "ctx", ",", "value", ",", "node", ",", "\"value\"", ")", ";", "/*", "store", "in", "the", "JSON", "format", "*/", "type", "->", "info", ".", "lref", ".", "path", "=", "transform_schema2json", "(", "module", ",", "value", ")", ";", "if", "(", "!", "type", "->", "info", ".", "lref", ".", "path", ")", "{", "goto", "error", ";", "}", "/*", "try", "to", "resolve", "leafref", "path", "only", "when", "this", "is", "instantiated", "*", "leaf,", "so", "it", "is", "not:", "*", "-", "typedef\\'s", "type,", "*", "-", "in", "grouping", "definition,", "*", "-", "just", "instantiated", "in", "a", "grouping", "definition,", "*", "because", "in", "those", "cases", "the", "nodes", "referenced", "in", "path", "might", "not", "be", "present", "*", "and", "it", "is", "not", "a", "bug.", "*/", "if", "(", "!", "parenttype", "&&", "unres_schema_add_node", "(", "module", ",", "unres", ",", "type", ",", "UNRES_TYPE_LEAFREF", ",", "parent", ")", "==", "-", "1", ")", "{", "goto", "error", ";", "}", "/*", "extensions", "*/", "if", "(", "lyp_yin_parse_subnode_ext", "(", "module", ",", "type", ",", "LYEXT_PAR_TYPE", ",", "node", ",", "LYEXT_SUBSTMT_PATH", ",", "0", ",", "unres", ")", ")", "{", "goto", "error", ";", "}", "break;", "}", "}", "if", "(", "!", "type", "->", "info", ".", "lref", ".", "path", ")", "{", "if", "(", "!", "type", "->", "der", "->", "type", ".", "der", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_MISSCHILDSTMT", ",", "LY_VLOG_NONE", ",", "NULL", ",", "\"path\"", ",", "\"type\"", ")", ";", "goto", "error", ";", "}", "else", "{", "/*", "copy", "leafref", "definition", "into", "the", "derived", "type", "*/", "type", "->", "info", ".", "lref", ".", "path", "=", "lydict_insert", "(", "ctx", ",", "type", "->", "der", "->", "type", ".", "info", ".", "lref", ".", "path", ",", "0", ")", ";", "if", "(", "!", "type", "->", "info", ".", "lref", ".", "req", ")", "{", "type", "->", "info", ".", "lref", ".", "req", "=", "type", "->", "der", "->", "type", ".", "info", ".", "lref", ".", "req", ";", "}", "/*", "and", "resolve", "the", "path", "at", "the", "place", "we", "are", "(if", "not", "in", "grouping/typedef)", "*/", "if", "(", "!", "parenttype", "&&", "unres_schema_add_node", "(", "module", ",", "unres", ",", "type", ",", "UNRES_TYPE_LEAFREF", ",", "parent", ")", "==", "-", "1", ")", "{", "goto", "error", ";", "}", "}", "}", "break;", "case", "LY_TYPE_STRING", ":", "/*", "RFC", "6020", "9.4.4", "-", "length", "*/", "/*", "RFC", "6020", "9.4.6", "-", "pattern", "*/", "i", "=", "0", ";", "LY_TREE_FOR_SAFE", "(", "yin->child", ",", "next", ",", "node", ")", "{", "if", "(", "!", "strcmp", "(", "node", "->", "name", ",", "\"length\"", ")", ")", "{", "if", "(", "type", "->", "info", ".", "str", ".", "length", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_TOOMANY", ",", "LY_VLOG_NONE", ",", "NULL", ",", "node", "->", "name", ",", "yin", "->", "name", ")", ";", "goto", "error", ";", "}", "GETVAL", "(", "ctx", ",", "value", ",", "node", ",", "\"value\"", ")", ";", "if", "(", "lyp_check_length_range", "(", "ctx", ",", "value", ",", "type", ")", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_INARG", ",", "LY_VLOG_NONE", ",", "NULL", ",", "value", ",", "\"length\"", ")", ";", "goto", "error", ";", "}", "type", "->", "info", ".", "str", ".", "length", "=", "calloc", "(", "1", ",", "sizeof", "*", "type", "->", "info", ".", "str", ".", "length", ")", ";", "LY_CHECK_ERR_GOTO", "(", "!", "type", "->", "info", ".", "str", ".", "length", ",", "LOGMEM", "(", "ctx", ")", ",", "error", ")", ";", "type", "->", "info", ".", "str", ".", "length", "->", "expr", "=", "lydict_insert", "(", "ctx", ",", "value", ",", "0", ")", ";", "/*", "get", "possible", "sub-statements", "*/", "if", "(", "read_restr_substmt", "(", "module", ",", "type", "->", "info", ".", "str", ".", "length", ",", "node", ",", "unres", ")", ")", "{", "goto", "error", ";", "}", "for", "(", "j", "=", "0", ";", "j", "<", "type", "->", "info", ".", "str", ".", "length", "->", "ext_size", ";", "++", "j", ")", "{", "/*", "set", "flag,", "which", "represent", "LYEXT_OPT_VALID", "*/", "if", "(", "type", "->", "info", ".", "str", ".", "length", "->", "ext", "[", "j", "]", "->", "flags", "&", "LYEXT_OPT_VALID", ")", "{", "type", "->", "parent", "->", "flags", "|=", "LYS_VALID_EXT", ";", "break;", "}", "}", "lyxml_free", "(", "ctx", ",", "node", ")", ";", "}", "<if", "type=\"elseif\">", "else", "if", "(", "!", "strcmp", "(", "node", "->", "name", ",", "\"pattern\"", ")", ")", "{", "YIN_CHECK_ARRAY_OVERFLOW_GOTO", "(", "ctx", ",", "i", ",", "type", "->", "info", ".", "str", ".", "pat_count", ",", "\"patterns\"", ",", "\"type\"", ",", "error", ")", ";", "i", "++", ";", "}", "else", "{", "LOGVAL", "(", "ctx", ",", "LYE_INSTMT", ",", "LY_VLOG_NONE", ",", "NULL", ",", "node", "->", "name", ")", ";", "goto", "error", ";", "}", "}", "/*", "store", "patterns", "in", "array", "*/", "if", "(", "i", ")", "{", "if", "(", "!", "parenttype", "&&", "parent", "&&", "lys_ingrouping", "(", "parent", ")", ")", "{", "in_grp", "=", "1", ";", "}", "type", "->", "info", ".", "str", ".", "patterns", "=", "calloc", "(", "i", ",", "sizeof", "*", "type", "->", "info", ".", "str", ".", "patterns", ")", ";", "LY_CHECK_ERR_GOTO", "(", "!", "type", "->", "info", ".", "str", ".", "patterns", ",", "LOGMEM", "(", "ctx", ")", ",", "error", ")", ";", "#", "ifdef", "LY_ENABLED_CACHE", "if", "(", "!", "in_grp", ")", "{", "/*", "do", "not", "compile", "patterns", "in", "groupings", "*/", "type", "->", "info", ".", "str", ".", "patterns_pcre", "=", "calloc", "(", "2", "*", "i", ",", "sizeof", "*", "type", "->", "info", ".", "str", ".", "patterns_pcre", ")", ";", "LY_CHECK_ERR_GOTO", "(", "!", "type", "->", "info", ".", "str", ".", "patterns_pcre", ",", "LOGMEM", "(", "ctx", ")", ",", "error", ")", ";", "}", "#", "endif", "LY_TREE_FOR", "(", "yin->child", ",", "node", ")", "{", "GETVAL", "(", "ctx", ",", "value", ",", "node", ",", "\"value\"", ")", ";", "if", "(", "in_grp", ")", "{", "/*", "in", "grouping,", "just", "check", "the", "pattern", "syntax", "*/", "if", "(", "!", "(", "ctx", "->", "models", ".", "flags", "&", "LY_CTX_TRUSTED", ")", "&&", "lyp_check_pattern", "(", "ctx", ",", "value", ",", "NULL", ")", ")", "{", "goto", "error", ";", "}", "}", "#", "ifdef", "LY_ENABLED_CACHE", "else", "{", "/*", "outside", "grouping,", "check", "syntax", "and", "precompile", "pattern", "for", "later", "use", "by", "libpcre", "*/", "if", "(", "lyp_precompile_pattern", "(", "ctx", ",", "value", ",", "(", "pcre", "*", "*", ")", "&", "type", "->", "info", ".", "str", ".", "patterns_pcre", "[", "type", "->", "info", ".", "str", ".", "pat_count", "*", "2", "]", ",", "(", "pcre_extra", "*", "*", ")", "&", "type", "->", "info", ".", "str", ".", "patterns_pcre", "[", "type", "->", "info", ".", "str", ".", "pat_count", "*", "2", "+", "1", "]", ")", ")", "{", "goto", "error", ";", "}", "}", "#", "endif", "restr", "=", "&", "type", "->", "info", ".", "str", ".", "patterns", "[", "type", "->", "info", ".", "str", ".", "pat_count", "]", ";", "/*", "shortcut", "*/", "type", "->", "info", ".", "str", ".", "pat_count", "++", ";", "modifier", "=", "0x06", ";", "/*", "ACK", "*/", "name", "=", "NULL", ";", "if", "(", "module", "->", "version", ">=", "2", ")", "{", "LY_TREE_FOR_SAFE", "(", "node->child", ",", "next2", ",", "child", ")", "{", "if", "(", "child", "->", "ns", "&&", "!", "strcmp", "(", "child", "->", "ns", "->", "value", ",", "LY_NSYIN", ")", "&&", "!", "strcmp", "(", "child", "->", "name", ",", "\"modifier\"", ")", ")", "{", "if", "(", "name", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_TOOMANY", ",", "LY_VLOG_NONE", ",", "NULL", ",", "\"modifier\"", ",", "node", "->", "name", ")", ";", "goto", "error", ";", "}", "GETVAL", "(", "ctx", ",", "name", ",", "child", ",", "\"value\"", ")", ";", "if", "(", "!", "strcmp", "(", "name", ",", "\"invert-match\"", ")", ")", "{", "modifier", "=", "0x15", ";", "/*", "NACK", "*/", "}", "else", "{", "LOGVAL", "(", "ctx", ",", "LYE_INARG", ",", "LY_VLOG_NONE", ",", "NULL", ",", "name", ",", "\"modifier\"", ")", ";", "goto", "error", ";", "}", "/*", "get", "extensions", "of", "the", "modifier", "*/", "if", "(", "lyp_yin_parse_subnode_ext", "(", "module", ",", "restr", ",", "LYEXT_PAR_RESTR", ",", "child", ",", "LYEXT_SUBSTMT_MODIFIER", ",", "0", ",", "unres", ")", ")", "{", "goto", "error", ";", "}", "lyxml_free", "(", "ctx", ",", "child", ")", ";", "}", "}", "}", "len", "=", "strlen", "(", "value", ")", ";", "buf", "=", "malloc", "(", "(", "len", "+", "2", ")", "*", "sizeof", "*", "buf", ")", ";", "/*", "modifier", "byte", "+", "value", "+", "terminating", "NULL", "byte", "*/", "LY_CHECK_ERR_GOTO", "(", "!", "buf", ",", "LOGMEM", "(", "ctx", ")", ",", "error", ")", ";", "buf", "[", "0", "]", "=", "modifier", ";", "strcpy", "(", "&", "buf", "[", "1", "]", ",", "value", ")", ";", "restr", "->", "expr", "=", "lydict_insert_zc", "(", "ctx", ",", "buf", ")", ";", "/*", "get", "possible", "sub-statements", "*/", "if", "(", "read_restr_substmt", "(", "module", ",", "restr", ",", "node", ",", "unres", ")", ")", "{", "goto", "error", ";", "}", "for", "(", "j", "=", "0", ";", "j", "<", "restr", "->", "ext_size", ";", "++", "j", ")", "{", "/*", "set", "flag,", "which", "represent", "LYEXT_OPT_VALID", "*/", "if", "(", "restr", "->", "ext", "[", "j", "]", "->", "flags", "&", "LYEXT_OPT_VALID", ")", "{", "type", "->", "parent", "->", "flags", "|=", "LYS_VALID_EXT", ";", "break;", "}", "}", "}", "}", "break;", "case", "LY_TYPE_UNION", ":", "/*", "RFC", "6020", "7.4", "-", "type", "*/", "/*", "count", "number", "of", "types", "in", "union", "*/", "i", "=", "0", ";", "LY_TREE_FOR_SAFE", "(", "yin->child", ",", "next", ",", "node", ")", "{", "if", "(", "!", "strcmp", "(", "node", "->", "name", ",", "\"type\"", ")", ")", "{", "if", "(", "type", "->", "der", "->", "type", ".", "der", ")", "{", "/*", "type", "can", "be", "a", "substatement", "only", "in", "\"union\"", "type,", "not", "in", "derived", "types", "*/", "LOGVAL", "(", "ctx", ",", "LYE_INCHILDSTMT", ",", "LY_VLOG_NONE", ",", "NULL", ",", "\"type\"", ",", "\"derived", "type\"", ")", ";", "goto", "error", ";", "}", "YIN_CHECK_ARRAY_OVERFLOW_GOTO", "(", "ctx", ",", "i", ",", "type", "->", "info", ".", "uni", ".", "count", ",", "\"types\"", ",", "\"type\"", ",", "error", ")", ";", "i", "++", ";", "}", "else", "{", "LOGVAL", "(", "ctx", ",", "LYE_INSTMT", ",", "LY_VLOG_NONE", ",", "NULL", ",", "node", "->", "name", ")", ";", "goto", "error", ";", "}", "}", "if", "(", "!", "i", "&&", "!", "type", "->", "der", "->", "type", ".", "der", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_MISSCHILDSTMT", ",", "LY_VLOG_NONE", ",", "NULL", ",", "\"type\"", ",", "\"(union)", "type\"", ")", ";", "goto", "error", ";", "}", "/*", "inherit", "instid", "presence", "information", "*/", "if", "(", "(", "type", "->", "der", "->", "type", ".", "base", "==", "LY_TYPE_UNION", ")", "&&", "type", "->", "der", "->", "type", ".", "info", ".", "uni", ".", "has_ptr_type", ")", "{", "type", "->", "info", ".", "uni", ".", "has_ptr_type", "=", "1", ";", "}", "/*", "allocate", "array", "for", "union\\'s", "types", "...", "*/", "if", "(", "i", ")", "{", "type", "->", "info", ".", "uni", ".", "types", "=", "calloc", "(", "i", ",", "sizeof", "*", "type", "->", "info", ".", "uni", ".", "types", ")", ";", "LY_CHECK_ERR_GOTO", "(", "!", "type", "->", "info", ".", "uni", ".", "types", ",", "LOGMEM", "(", "ctx", ")", ",", "error", ")", ";", "}", "/*", "...", "and", "fill", "the", "structures", "*/", "LY_TREE_FOR", "(", "yin->child", ",", "node", ")", "{", "type", "->", "info", ".", "uni", ".", "types", "[", "type", "->", "info", ".", "uni", ".", "count", "]", ".", "parent", "=", "type", "->", "parent", ";", "rc", "=", "fill_yin_type", "(", "module", ",", "parent", ",", "node", ",", "&", "type", "->", "info", ".", "uni", ".", "types", "[", "type", "->", "info", ".", "uni", ".", "count", "]", ",", "parenttype", ",", "unres", ")", ";", "if", "(", "!", "rc", ")", "{", "type", "->", "info", ".", "uni", ".", "count", "++", ";", "if", "(", "module", "->", "version", "<", "2", ")", "{", "/*", "union\\'s", "type", "cannot", "be", "empty", "or", "leafref", "*/", "if", "(", "type", "->", "info", ".", "uni", ".", "types", "[", "type", "->", "info", ".", "uni", ".", "count", "-", "1", "]", ".", "base", "==", "LY_TYPE_EMPTY", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_INARG", ",", "LY_VLOG_NONE", ",", "NULL", ",", "\"empty\"", ",", "node", "->", "name", ")", ";", "rc", "=", "-", "1", ";", "}", "<if", "type=\"elseif\">", "else", "if", "(", "type", "->", "info", ".", "uni", ".", "types", "[", "type", "->", "info", ".", "uni", ".", "count", "-", "1", "]", ".", "base", "==", "LY_TYPE_LEAFREF", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_INARG", ",", "LY_VLOG_NONE", ",", "NULL", ",", "\"leafref\"", ",", "node", "->", "name", ")", ";", "rc", "=", "-", "1", ";", "}", "}", "if", "(", "(", "type", "->", "info", ".", "uni", ".", "types", "[", "type", "->", "info", ".", "uni", ".", "count", "-", "1", "]", ".", "base", "==", "LY_TYPE_INST", ")", "||", "(", "type", "->", "info", ".", "uni", ".", "types", "[", "type", "->", "info", ".", "uni", ".", "count", "-", "1", "]", ".", "base", "==", "LY_TYPE_LEAFREF", ")", "||", "(", "(", "type", "->", "info", ".", "uni", ".", "types", "[", "type", "->", "info", ".", "uni", ".", "count", "-", "1", "]", ".", "base", "==", "LY_TYPE_UNION", ")", "&&", "type", "->", "info", ".", "uni", ".", "types", "[", "type", "->", "info", ".", "uni", ".", "count", "-", "1", "]", ".", "info", ".", "uni", ".", "has_ptr_type", ")", ")", "{", "type", "->", "info", ".", "uni", ".", "has_ptr_type", "=", "1", ";", "}", "}", "if", "(", "rc", ")", "{", "/*", "even", "if", "we", "got", "EXIT_FAILURE,", "throw", "it", "all", "away,", "too", "much", "trouble", "doing", "something", "else", "*/", "for", "(", "i", "=", "0", ";", "i", "<", "type", "->", "info", ".", "uni", ".", "count", ";", "++", "i", ")", "{", "lys_type_free", "(", "ctx", ",", "&", "type", "->", "info", ".", "uni", ".", "types", "[", "i", "]", ",", "NULL", ")", ";", "}", "free", "(", "type", "->", "info", ".", "uni", ".", "types", ")", ";", "type", "->", "info", ".", "uni", ".", "types", "=", "NULL", ";", "type", "->", "info", ".", "uni", ".", "count", "=", "0", ";", "type", "->", "info", ".", "uni", ".", "has_ptr_type", "=", "0", ";", "type", "->", "der", "=", "NULL", ";", "type", "->", "base", "=", "LY_TYPE_DER", ";", "if", "(", "rc", "==", "EXIT_FAILURE", ")", "{", "ret", "=", "EXIT_FAILURE", ";", "}", "goto", "error", ";", "}", "}", "break;", "case", "LY_TYPE_BOOL", ":", "case", "LY_TYPE_EMPTY", ":", "/*", "no", "sub-statement", "allowed", "*/", "if", "(", "yin", "->", "child", ")", "{", "LOGVAL", "(", "ctx", ",", "LYE_INSTMT", ",", "LY_VLOG_NONE", ",", "NULL", ",", "yin", "->", "child", "->", "name", ")", ";", "goto", "error", ";", "}", "break;", "default:", "LOGINT", "(", "ctx", ")", ";", "goto", "error", ";", "}", "for", "(", "j", "=", "0", ";", "j", "<", "type", "->", "ext_size", ";", "++", "j", ")", "{", "/*", "set", "flag,", "which", "represent", "LYEXT_OPT_VALID", "*/", "if", "(", "type", "->", "ext", "[", "j", "]", "->", "flags", "&", "LYEXT_OPT_VALID", ")", "{", "type", "->", "parent", "->", "flags", "|=", "LYS_VALID_EXT", ";", "break;", "}", "}", "/*", "if", "derived", "type", "has", "extension,", "which", "need", "validate", "data", "*/", "dertype", "=", "&", "type", "->", "der", "->", "type", ";", "while", "(", "dertype", "->", "der", ")", "{", "if", "(", "dertype", "->", "parent", "->", "flags", "&", "LYS_VALID_EXT", ")", "{", "type", "->", "parent", "->", "flags", "|=", "LYS_VALID_EXT", ";", "}", "dertype", "=", "&", "dertype", "->", "der", "->", "type", ";", "}", "return", "EXIT_SUCCESS", ";", "error", ":", "lyxml_free_withsiblings", "(", "ctx", ",", "exts", ".", "child", ")", ";", "return", "ret", ";", "}'" ]
fill_yin_type
CESNET/libnetconf2
single_line
train
78
98
[ "Set", "the", "current", "line", "number" ]
[ "'void", "yyset_lineno", "(", "int", "line_number", ")", "{", "yylineno", "=", "line_number", ";", "}'" ]
yyset_lineno
HomerReid/scuff-em
multi_line
train
79
99
[ "Set", "the", "input", "stream" ]
[ "'void", "yyset_in", "(", "FILE", "*", "in_str", ")", "{", "yyin", "=", "in_str", ";", "}'" ]
yyset_in
HomerReid/scuff-em
multi_line
train
80
100
[ "Switch", "to", "a", "different", "input", "buffer" ]
[ "\"void", "yy_switch_to_buffer", "(", "YY_BUFFER_STATE", "new_buffer", ")", "{", "/*", "TODO.", "We", "should", "be", "able", "to", "replace", "this", "entire", "function", "body", "*", "with", "*", "yypop_buffer_state();", "*", "yypush_buffer_state(new_buffer);", "*/", "yyensure_buffer_stack", "()", ";", "if", "(", "YY_CURRENT_BUFFER", "==", "new_buffer", ")", "return", ";", "if", "(", "YY_CURRENT_BUFFER", ")", "{", "/*", "Flush", "out", "information", "for", "old", "buffer.", "*/", "*", "(", "yy_c_buf_p", ")", "=", "(", "yy_hold_char", ")", ";", "YY_CURRENT_BUFFER_LVALUE", "->", "yy_buf_pos", "=", "(", "yy_c_buf_p", ")", ";", "YY_CURRENT_BUFFER_LVALUE", "->", "yy_n_chars", "=", "(", "yy_n_chars", ")", ";", "}", "YY_CURRENT_BUFFER_LVALUE", "=", "new_buffer", ";", "yy_load_buffer_state", "(", ")", ";", "/*", "We", "don't", "actually", "know", "whether", "we", "did", "this", "switch", "during", "*", "EOF", "(yywrap())", "processing,", "but", "the", "only", "time", "this", "flag", "*", "is", "looked", "at", "is", "after", "yywrap()", "is", "called,", "so", "it's", "safe", "*", "to", "go", "ahead", "and", "always", "set", "it.", "*/", "(", "yy_did_buffer_switch_on_eof", ")", "=", "1", ";", "}\"" ]
yy_switch_to_buffer
HomerReid/scuff-em
multi_line
train
81
101
[ "Discard", "all", "buffered", "characters" ]
[ "'void", "yy_flush_buffer", "(", "YY_BUFFER_STATE", "b", ")", "{", "if", "(", "!", "b", ")", "return", ";", "b", "->", "yy_n_chars", "=", "0", ";", "/*", "We", "always", "need", "two", "end-of-buffer", "characters.", "The", "first", "causes", "*", "a", "transition", "to", "the", "end-of-buffer", "state.", "The", "second", "causes", "*", "a", "jam", "in", "that", "state.", "*/", "b", "->", "yy_ch_buf", "[", "0", "]", "=", "YY_END_OF_BUFFER_CHAR", ";", "b", "->", "yy_ch_buf", "[", "1", "]", "=", "YY_END_OF_BUFFER_CHAR", ";", "b", "->", "yy_buf_pos", "=", "&", "b", "->", "yy_ch_buf", "[", "0", "]", ";", "b", "->", "yy_at_bol", "=", "1", ";", "b", "->", "yy_buffer_status", "=", "YY_BUFFER_NEW", ";", "if", "(", "b", "==", "YY_CURRENT_BUFFER", ")", "yy_load_buffer_state", "(", ")", ";", "}'" ]
yy_flush_buffer
HomerReid/scuff-em
multi_line
train
82
102
[ "Start", "processing", "the", "queue", "if", "it", "is", "not", "running", "and", "fstorage", "is", "not", "paused" ]
[ "'static", "void", "queue_start", "(", "void", ")", "{", "if", "(", "(", "!", "nrf_atomic_flag_set_fetch", "(", "&", "m_flags", ".", "queue_running", ")", ")", "&&", "(", "!", "m_flags", ".", "paused", ")", ")", "{", "queue_process", "()", ";", "}", "}'" ]
queue_start
Lotlab/nrf52-keyboard
single_line
train
83
103
[ "Execute", "an", "operation", "in", "the", "queue" ]
[ "'static", "void", "queue_process", "(", "void", ")", "{", "uint32_t", "rc", ";", "if", "(", "m_flags", ".", "state", "==", "NRF_FSTORAGE_STATE_IDLE", ")", "{", "if", "(", "!", "queue_load_next", "()", ")", "{", "/*", "No", "more", "operations,", "nothing", "to", "do.", "*/", "m_flags", ".", "queue_running", "=", "false", ";", "return", ";", "}", "}", "m_flags", ".", "state", "=", "NRF_FSTORAGE_STATE_OP_EXECUTING", ";", "switch", "(", "m_p_cur_op", "->", "op_code", ")", "{", "case", "NRF_FSTORAGE_OP_WRITE", ":", "rc", "=", "write_execute", "(", "m_p_cur_op", ")", ";", "break;", "case", "NRF_FSTORAGE_OP_ERASE", ":", "rc", "=", "erase_execute", "(", "m_p_cur_op", ")", ";", "break;", "default:", "rc", "=", "NRF_ERROR_INTERNAL", ";", "break;", "}", "switch", "(", "rc", ")", "{", "case", "NRF_SUCCESS", ":", "{", "/*", "The", "operation", "was", "accepted", "by", "the", "SoftDevice.", "*", "If", "the", "SoftDevice", "is", "enabled,", "wait", "for", "a", "system", "event.", "Otherwise,", "*", "the", "SoftDevice", "call", "is", "synchronous", "and", "will", "not", "send", "an", "event", "so", "we", "simulate", "it.", "*/", "if", "(", "!", "m_flags", ".", "sd_enabled", ")", "{", "nrf_fstorage_sys_evt_handler", "(", "NRF_EVT_FLASH_OPERATION_SUCCESS", ",", "NULL", ")", ";", "}", "}", "break;", "case", "NRF_ERROR_BUSY", ":", "{", "/*", "The", "SoftDevice", "is", "executing", "a", "flash", "operation", "that", "was", "not", "requested", "by", "fstorage.", "*", "Stop", "processing", "the", "queue", "until", "a", "system", "event", "is", "received.", "*/", "m_flags", ".", "state", "=", "NRF_FSTORAGE_STATE_OP_PENDING", ";", "}", "break;", "default:", "{", "/*", "An", "error", "has", "occurred.", "We", "cannot", "proceed", "further", "with", "this", "operation.", "*/", "event_send", "(", "m_p_cur_op", ",", "NRF_ERROR_INTERNAL", ")", ";", "/*", "Reset", "the", "internal", "state", "so", "we", "can", "accept", "other", "operations.", "*/", "m_flags", ".", "state", "=", "NRF_FSTORAGE_STATE_IDLE", ";", "m_flags", ".", "queue_running", "=", "false", ";", "/*", "Free", "the", "current", "queue", "element.", "*/", "queue_free", "()", ";", "}", "break;", "}", "}'" ]
queue_process
Lotlab/nrf52-keyboard
single_line
train
84
104
[ "getdns_pp_bindata", "private", "function", "to", "pretty", "print", "bindata", "to", "a", "gldns_buffer" ]
[ "'static", "int", "getdns_pp_bindata", "(", "gldns_buffer", "*", "buf", ",", "getdns_bindata", "*", "bindata", ",", "int", "rdata_raw", ",", "int", "json", ")", "{", "size_t", "i", ",", "<type", "ref=\"prev\"/>", "p", "=", "gldns_buffer_position", "(", "buf", ")", ";", "uint8_t", "*", "dptr", ";", "char", "spc", "[", "1024", "]", ";", "if", "(", "!", "json", "&&", "gldns_buffer_printf", "(", "buf", ",", "\"", "<bindata", "\"", ")", "<", "0", ")", "return", "-", "1", ";", "/*", "Walk", "through", "all", "printable", "characters", "*/", "i", "=", "0", ";", "if", "(", "!", "rdata_raw", ")", "while", "(", "i", "<", "bindata", "->", "size", "&&", "isprint", "(", "bindata", "->", "data", "[", "i", "]", ")", ")", "i", "++", ";", "if", "(", "bindata", "->", "size", ">", "0", "&&", "i", "==", "bindata", "->", "size", ")", "{", "/*", "all", "printable?", "*/", "if", "(", "json", ")", "{", "const", "uint8_t", "*", "s", "=", "bindata", "->", "data", ";", "const", "uint8_t", "*", "e", "=", "s", "+", "bindata", "->", "size", ";", "const", "uint8_t", "*", "b", ";", "if", "(", "!", "gldns_buffer_reserve", "(", "buf", ",", "(", "e", "-", "s", ")", "+", "2", ")", ")", "return", "-", "1", ";", "gldns_buffer_write_u8", "(", "buf", ",", "\\'\"\\'", ")", ";", "for", "(", ";", ";", ")", "{", "for", "(", "b", "=", "s", ";", "b", "<", "e", "&&", "*", "b", "!=", "\\'\\\\\\\\\\'", "&&", "*", "b", "!=", "\\'\"\\'", ";", "b", "++", ")", ";", "/*", "pass", "*/", "if", "(", "b", "==", "e", ")", "break;", "if", "(", "!", "gldns_buffer_reserve", "(", "buf", ",", "(", "b", "-", "s", ")", "+", "3", ")", ")", "return", "-", "1", ";", "gldns_buffer_write", "(", "buf", ",", "s", ",", "b", "-", "s", ")", ";", "gldns_buffer_write_u8", "(", "buf", ",", "\\'\\\\\\\\\\'", ")", ";", "gldns_buffer_write_u8", "(", "buf", ",", "*", "b", ")", ";", "s", "=", "b", "+", "1", ";", "}", "if", "(", "s", "<", "e", ")", "gldns_buffer_write", "(", "buf", ",", "s", ",", "e", "-", "s", ")", ";", "gldns_buffer_write_u8", "(", "buf", ",", "\\'\"\\'", ")", ";", "}", "else", "{", "(", "void", ")", "snprintf", "(", "spc", ",", "sizeof", "(", "spc", ")", ",", "\"of", "\\\\\"%%.%ds\\\\\"%s>\"", ",", "(", "int", ")", "(", "i", ">", "32", "?", "32", ":", "i", ")", ",", "(", "i", ">", "32", "?", "\"...\"", ":", "\"\"", ")", ")", ";", "if", "(", "gldns_buffer_printf", "(", "buf", ",", "spc", ",", "bindata", "->", "data", ")", "<", "0", ")", "return", "-", "1", ";", "}", "}", "<if", "type=\"elseif\">", "else", "if", "(", "bindata", "->", "size", ">", "1", "&&", "/*", "null", "terminated", "printable", "*/", "i", "==", "bindata", "->", "size", "-", "1", "&&", "bindata", "->", "data", "[", "i", "]", "==", "0", ")", "{", "if", "(", "gldns_buffer_printf", "(", "buf", ",", "(", "json", "?", "\"\\\\\"%s\\\\\"\"", ":", "\"of", "\\\\\"%s\\\\\">\"", ")", ",", "bindata", "->", "data", ")", "<", "0", ")", "return", "-", "1", ";", "}", "<if", "type=\"elseif\">", "else", "if", "(", "bindata", "->", "size", "==", "1", "&&", "*", "bindata", "->", "data", "==", "0", ")", "{", "if", "(", "gldns_buffer_printf", "(", "buf", ",", "json", "?", "\"\\\\\".\\\\\"\"", ":", "\"for", ".>\"", ")", "<", "0", ")", "return", "-", "1", ";", "}", "<if", "type=\"elseif\">", "else", "if", "(", "_getdns_bindata_is_dname", "(", "bindata", ")", ")", "{", "(", "void", ")", "gldns_wire2str_dname_buf", "(", "bindata", "->", "data", ",", "bindata", "->", "size", ",", "spc", ",", "sizeof", "(", "spc", ")", ")", ";", "if", "(", "gldns_buffer_printf", "(", "buf", ",", "(", "json", "?", "\"\\\\\"%s\\\\\"\"", ":", "\"for", "%s>\"", ")", ",", "spc", ")", "<", "0", ")", "return", "-", "1", ";", "}", "<if", "type=\"elseif\">", "else", "if", "(", "json", ")", "{", "if", "(", "gldns_buffer_printf", "(", "buf", ",", "\"[\"", ")", "<", "0", ")", "return", "-", "1", ";", "for", "(", "dptr", "=", "bindata", "->", "data", ";", "dptr", "<", "bindata", "->", "data", "+", "bindata", "->", "size", ";", "dptr", "++", ")", "{", "if", "(", "dptr", ">", "bindata", "->", "data", ")", "{", "if", "(", "gldns_buffer_printf", "(", "buf", ",", "\",\"", ")", "<", "0", ")", "return", "-", "1", ";", "}", "if", "(", "gldns_buffer_printf", "(", "buf", ",", "\"%d\"", ",", "(", "int", ")", "*", "dptr", ")", "<", "0", ")", "return", "-", "1", ";", "}", "if", "(", "gldns_buffer_printf", "(", "buf", ",", "\"]\"", ")", "<", "0", ")", "return", "-", "1", ";", "}", "else", "{", "if", "(", "gldns_buffer_printf", "(", "buf", ",", "\"of", "0x\"", ")", "<", "0", ")", "return", "-", "1", ";", "for", "(", "dptr", "=", "bindata", "->", "data", ";", "dptr", "<", "bindata", "->", "data", "+", "bindata", "->", "size", ";", "dptr", "++", ")", "{", "if", "(", "dptr", "-", "bindata", "->", "data", ">=", "16", ")", "{", "if", "(", "gldns_buffer_printf", "(", "buf", ",", "\"...\"", ")", "<", "0", ")", "return", "-", "1", ";", "break;", "}", "if", "(", "gldns_buffer_printf", "(", "buf", ",", "\"%.2x\"", ",", "*", "dptr", ")", "<", "0", ")", "return", "-", "1", ";", "}", "if", "(", "gldns_buffer_printf", "(", "buf", ",", "\">\"", ")", "<", "0", ")", "return", "-", "1", ";", "}", "return", "gldns_buffer_position", "(", "buf", ")", "-", "p", ";", "}'" ]
getdns_pp_bindata
getdnsapi/getdns
multi_line
train
85
105
[ "getdns_pp_dict", "getdns_pretty_print_dict", "Return", "a", "character", "string", "containing", "a", "\"human", "readable\"", "representation", "of", "dict" ]
[ "'char", "*", "getdns_pretty_print_dict", "(", "const", "struct", "getdns_dict", "*", "dict", ")", "{", "gldns_buffer", "*", "buf", ";", "char", "*", "ret", ";", "if", "(", "!", "dict", ")", "return", "NULL", ";", "buf", "=", "gldns_buffer_new", "(", "8192", ")", ";", "if", "(", "!", "buf", ")", "return", "NULL", ";", "if", "(", "getdns_pp_dict", "(", "buf", ",", "0", ",", "dict", ",", "0", ")", "<", "0", ")", "{", "gldns_buffer_free", "(", "buf", ")", ";", "return", "NULL", ";", "}", "ret", "=", "(", "char", "*", ")", "gldns_buffer_export", "(", "buf", ")", ";", "gldns_buffer_free", "(", "buf", ")", ";", "return", "ret", ";", "}'" ]
getdns_pretty_print_dict
getdnsapi/getdns
multi_line
train
86
106
[ "getdns_dict_item_free", "private", "function", "used", "to", "release", "storage", "associated", "with", "a", "dictionary", "item" ]
[ "'static", "void", "getdns_dict_item_free", "(", "_getdns_rbnode_t", "*", "node", ",", "void", "*", "arg", ")", "{", "struct", "getdns_dict_item", "*", "d", "=", "(", "struct", "getdns_dict_item", "*", ")", "node", ";", "struct", "getdns_dict", "*", "dict", "=", "(", "struct", "getdns_dict", "*", ")", "arg", ";", "assert", "(", "node", ")", ";", "assert", "(", "arg", ")", ";", "switch", "(", "d", "->", "i", ".", "dtype", ")", "{", "case", "t_dict", ":", "getdns_dict_destroy", "(", "d", "->", "i", ".", "data", ".", "dict", ")", ";", "break;", "case", "t_list", ":", "getdns_list_destroy", "(", "d", "->", "i", ".", "data", ".", "list", ")", ";", "break;", "case", "t_bindata", ":", "_getdns_bindata_destroy", "(", "&", "dict", "->", "mf", ",", "d", "->", "i", ".", "data", ".", "bindata", ")", ";", "default", ":", "break;", "}", "if", "(", "node", "->", "key", ")", "GETDNS_FREE", "(", "dict", "->", "mf", ",", "(", "void", "*", ")", "node", "->", "key", ")", ";", "GETDNS_FREE", "(", "dict", "->", "mf", ",", "node", ")", ";", "}'" ]
getdns_dict_item_free
getdnsapi/getdns
multi_line
train
87
107
[ "getdns_dict_create", "_getdns_dict_copy", "private", "function", "used", "to", "make", "a", "copy", "of", "a", "dict", "structure,", "the", "caller", "is", "responsible", "for", "freeing", "storage", "allocated", "to", "returned", "value" ]
[ "'getdns_return_t", "_getdns_dict_copy", "(", "const", "struct", "getdns_dict", "*", "srcdict", ",", "struct", "getdns_dict", "*", "*", "dstdict", ")", "{", "struct", "getdns_dict_item", "*", "item", ";", "char", "*", "key", ";", "getdns_return_t", "retval", ";", "if", "(", "!", "dstdict", ")", "return", "GETDNS_RETURN_INVALID_PARAMETER", ";", "if", "(", "!", "srcdict", ")", "{", "*", "dstdict", "=", "NULL", ";", "return", "GETDNS_RETURN_GOOD", ";", "}", "*", "dstdict", "=", "getdns_dict_create_with_extended_memory_functions", "(", "srcdict", "->", "mf", ".", "mf_arg", ",", "srcdict", "->", "mf", ".", "mf", ".", "ext", ".", "malloc", ",", "srcdict", "->", "mf", ".", "mf", ".", "ext", ".", "realloc", ",", "srcdict", "->", "mf", ".", "mf", ".", "ext", ".", "free", ")", ";", "if", "(", "!", "*", "dstdict", ")", "return", "GETDNS_RETURN_GENERIC_ERROR", ";", "RBTREE_FOR", "(", "item", ",", "struct", "getdns_dict_item", "*", ",", "(struct", "_getdns_rbtree_t", "*)&(srcdict->root)", ")", "{", "key", "=", "(", "char", "*", ")", "item", "->", "node", ".", "key", ";", "switch", "(", "item", "->", "i", ".", "dtype", ")", "{", "case", "t_bindata", ":", "retval", "=", "getdns_dict_set_bindata", "(", "*", "dstdict", ",", "key", ",", "item", "->", "i", ".", "data", ".", "bindata", ")", ";", "break;", "case", "t_dict", ":", "retval", "=", "getdns_dict_set_dict", "(", "*", "dstdict", ",", "key", ",", "item", "->", "i", ".", "data", ".", "dict", ")", ";", "break;", "case", "t_int", ":", "retval", "=", "getdns_dict_set_int", "(", "*", "dstdict", ",", "key", ",", "item", "->", "i", ".", "data", ".", "n", ")", ";", "break;", "case", "t_list", ":", "retval", "=", "getdns_dict_set_list", "(", "*", "dstdict", ",", "key", ",", "item", "->", "i", ".", "data", ".", "list", ")", ";", "break;", "default:", "retval", "=", "GETDNS_RETURN_WRONG_TYPE_REQUESTED", ";", "break;", "}", "if", "(", "retval", "!=", "GETDNS_RETURN_GOOD", ")", "{", "getdns_dict_destroy", "(", "*", "dstdict", ")", ";", ";", "*", "dstdict", "=", "NULL", ";", "return", "retval", ";", "}", "}", "return", "GETDNS_RETURN_GOOD", ";", "}'" ]
_getdns_dict_copy
getdnsapi/getdns
multi_line
train
88
108
[ "getdns_pp_list", "private", "function", "to", "pretty", "print", "list", "to", "a", "gldns_buffer" ]
[ "'static", "int", "getdns_pp_list", "(", "gldns_buffer", "*", "buf", ",", "size_t", "indent", ",", "const", "getdns_list", "*", "list", ",", "int", "for_literals", ",", "int", "json", ")", "{", "size_t", "i", ",", "<type", "ref=\"prev\"/>", "length", ",", "<type", "ref=\"prev\"/>", "p", "=", "gldns_buffer_position", "(", "buf", ")", ";", "getdns_data_type", "dtype", ";", "struct", "getdns_dict", "*", "dict_item", ";", "struct", "getdns_list", "*", "list_item", ";", "struct", "getdns_bindata", "*", "bindata_item", ";", "uint32_t", "int_item", ";", "const", "char", "*", "strval", ";", "char", "abuf", "[", "80", "]", ";", "if", "(", "list", "==", "NULL", ")", "return", "0", ";", "if", "(", "gldns_buffer_printf", "(", "buf", ",", "\"[\"", ")", "<", "0", ")", "return", "-", "1", ";", "if", "(", "getdns_list_get_length", "(", "list", ",", "&", "length", ")", "!=", "GETDNS_RETURN_GOOD", ")", "return", "-", "1", ";", "indent", "+=", "2", ";", "for", "(", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "if", "(", "i", "&&", "gldns_buffer_printf", "(", "buf", ",", "\",\"", ")", "<", "0", ")", "return", "-", "1", ";", "if", "(", "json", "<", "2", "&&", "gldns_buffer_printf", "(", "buf", ",", "\"\\%s\"", ",", "getdns_indent", "(", "indent", ")", ")", "<", "0", ")", "return", "-", "1", ";", "if", "(", "getdns_list_get_data_type", "(", "list", ",", "i", ",", "&", "dtype", ")", "!=", "GETDNS_RETURN_GOOD", ")", "return", "-", "1", ";", "switch", "(", "dtype", ")", "{", "case", "t_int", ":", "if", "(", "getdns_list_get_int", "(", "list", ",", "i", ",", "&", "int_item", ")", ")", "return", "-", "1", ";", "if", "(", "!", "json", "&&", "for_literals", "&&", "(", "strval", "=", "_getdns_get_const_info", "(", "int_item", ")", "->", "name", ")", ")", "{", "if", "(", "gldns_buffer_printf", "(", "buf", ",", "\"%s\"", ",", "strval", ")", "<", "0", ")", "return", "-", "1", ";", "}", "<if", "type=\"elseif\">", "else", "if", "(", "0", ">", "gldns_buffer_printf", "(", "buf", ",", "\"%d\"", ",", "(", "int", ")", "int_item", ")", ")", "return", "-", "1", ";", "break;", "case", "t_bindata", ":", "if", "(", "getdns_list_get_bindata", "(", "list", ",", "i", ",", "&", "bindata_item", ")", "!=", "GETDNS_RETURN_GOOD", ")", "return", "-", "1", ";", "if", "(", "for_literals", "&&", "(", "bindata_item", "->", "size", "==", "4", "||", "bindata_item", "->", "size", "==", "16", ")", ")", "{", "if", "(", "gldns_buffer_printf", "(", "buf", ",", "(", "json", "?", "\"\\\\\"%s\\\\\"\"", ":", "\"", "<bindata", "for", "%s>\"", ")", ",", "inet_ntop", "(", "(", "bindata_item", "->", "size", "==", "4", "?", "AF_INET", ":", "AF_INET6", ")", ",", "bindata_item", "->", "data", ",", "abuf", ",", "sizeof", "(", "abuf", ")", "-", "1", ")", ")", "<", "0", ")", "return", "-", "1", ";", "}", "<if", "type=\"elseif\">", "else", "if", "(", "getdns_pp_bindata", "(", "buf", ",", "bindata_item", ",", "0", ",", "json", ")", "<", "0", ")", "return", "-", "1", ";", "break;", "case", "t_list", ":", "if", "(", "getdns_list_get_list", "(", "list", ",", "i", ",", "&", "list_item", ")", "!=", "GETDNS_RETURN_GOOD", ")", "return", "-", "1", ";", "if", "(", "getdns_pp_list", "(", "buf", ",", "indent", ",", "list_item", ",", "0", ",", "json", ")", "<", "0", ")", "return", "-", "1", ";", "break;", "case", "t_dict", ":", "if", "(", "getdns_list_get_dict", "(", "list", ",", "i", ",", "&", "dict_item", ")", "!=", "GETDNS_RETURN_GOOD", ")", "return", "-", "1", ";", "if", "(", "getdns_pp_dict", "(", "buf", ",", "indent", ",", "dict_item", ",", "json", ")", "<", "0", ")", "return", "-", "1", ";", "break;", "default:", "if", "(", "gldns_buffer_printf", "(", "buf", ",", "\"%s\"", ",", "unknown_str_l", "[", "json", "]", ")", "<", "0", ")", "return", "-", "1", ";", "}", "}", "indent", "-=", "2", ";", "if", "(", "json", "<", "2", "&&", "i", "&&", "gldns_buffer_printf", "(", "buf", ",", "\"\\%s\"", ",", "getdns_indent", "(", "indent", ")", ")", "<", "0", ")", "return", "-", "1", ";", "if", "(", "gldns_buffer_printf", "(", "buf", ",", "\"]\"", ")", "<", "0", ")", "return", "-", "1", ";", "return", "gldns_buffer_position", "(", "buf", ")", "-", "p", ";", "}'" ]
getdns_pp_list
getdnsapi/getdns
multi_line
train
89
109
[ "getdns_dict_set_int", "getdns_pp_dict", "private", "function", "to", "help", "with", "indenting" ]
[ "'static", "const", "char", "*", "getdns_indent", "(", "size_t", "indent", ")", "{", "static", "const", "char", "*", "spaces", "=", "\"", "\"", "\"", "\"", ";", "return", "spaces", "+", "80", "-", "(", "indent", "<", "80", "?", "indent", ":", "0", ")", ";", "}'" ]
getdns_indent
getdnsapi/getdns
multi_line
train
90
110
[ "getdns_pp_dict", "private", "function", "to", "pretty", "print", "dict", "to", "a", "gldns_buffer" ]
[ "'static", "int", "getdns_pp_dict", "(", "gldns_buffer", "*", "buf", ",", "size_t", "indent", ",", "const", "getdns_dict", "*", "dict", ",", "int", "json", ")", "{", "size_t", "i", ",", "<type", "ref=\"prev\"/>", "length", ",", "<type", "ref=\"prev\"/>", "p", "=", "gldns_buffer_position", "(", "buf", ")", ";", "struct", "getdns_dict_item", "*", "item", ";", "const", "char", "*", "strval", ";", "char", "abuf", "[", "80", "]", ";", "if", "(", "dict", "==", "NULL", ")", "return", "0", ";", "if", "(", "gldns_buffer_printf", "(", "buf", ",", "\"{\"", ")", "<", "0", ")", "return", "-", "1", ";", "i", "=", "0", ";", "indent", "+=", "2", ";", "RBTREE_FOR", "(", "item", ",", "struct", "getdns_dict_item", "*", ",", "(_getdns_rbtree_t", "*)&(dict->root)", ")", "{", "if", "(", "i", "&&", "gldns_buffer_printf", "(", "buf", ",", "\",\"", ")", "<", "0", ")", "return", "-", "1", ";", "if", "(", "json", "<", "2", "&&", "gldns_buffer_printf", "(", "buf", ",", "\"\\%s\"", ",", "getdns_indent", "(", "indent", ")", ")", "<", "0", ")", "return", "-", "1", ";", "if", "(", "gldns_buffer_printf", "(", "buf", ",", "\"\\\\\"%s\\\\\":\"", ",", "(", "const", "char", "*", ")", "item", "->", "node", ".", "key", ")", "<", "0", ")", "return", "-", "1", ";", "switch", "(", "item", "->", "i", ".", "dtype", ")", "{", "case", "t_int", ":", "if", "(", "!", "json", "&&", "(", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"type\"", ")", "==", "0", "||", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"type_covered\"", ")", "==", "0", "||", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"query_type\"", ")", "==", "0", "||", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"qtype\"", ")", "==", "0", ")", "&&", "(", "strval", "=", "_getdns_rr_type_name", "(", "item", "->", "i", ".", "data", ".", "n", ")", ")", ")", "{", "if", "(", "gldns_buffer_printf", "(", "buf", ",", "\"", "GETDNS_RRTYPE_%s\"", ",", "strval", ")", "<", "0", ")", "return", "-", "1", ";", "break;", "}", "if", "(", "!", "json", "&&", "(", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"answer_type\"", ")", "==", "0", "||", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"dnssec_status\"", ")", "==", "0", "||", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"tsig_status\"", ")", "==", "0", "||", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"status\"", ")", "==", "0", "||", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"append_name\"", ")", "==", "0", "||", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"follow_redirects\"", ")", "==", "0", "||", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"transport\"", ")", "==", "0", "||", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"resolution_type\"", ")", "==", "0", "||", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"tls_authentication\"", ")", "==", "0", "||", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"tls_min_version\"", ")", "==", "0", "||", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"tls_max_version\"", ")", "==", "0", "||", "/*", "extensions", "*/", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"add_warning_for_bad_dns\"", ")", "==", "0", "||", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"dnssec\"", ")", "==", "0", "||", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"dnssec_return_all_statuses\"", ")", "==", "0", "||", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"dnssec_return_full_validation_chain\"", ")", "==", "0", "||", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"dnssec_return_only_secure\"", ")", "==", "0", "||", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"dnssec_return_status\"", ")", "==", "0", "||", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"dnssec_return_validation_chain\"", ")", "==", "0", "||", "#", "if", "defined", "(", "DNSSEC_ROADBLOCK_AVOIDANCE", ")", "&&", "defined", "(", "HAVE_LIBUNBOUND", ")", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"dnssec_roadblock_avoidance\"", ")", "==", "0", "||", "#", "endif", "#", "ifdef", "EDNS_COOKIES", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"edns_cookies\"", ")", "==", "0", "||", "#", "endif", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"return_api_information\"", ")", "==", "0", "||", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"return_both_v4_and_v6\"", ")", "==", "0", "||", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"return_call_reporting\"", ")", "==", "0", ")", "&&", "(", "strval", "=", "_getdns_get_const_info", "(", "item", "->", "i", ".", "data", ".", "n", ")", "->", "name", ")", ")", "{", "if", "(", "gldns_buffer_printf", "(", "buf", ",", "\"", "%s\"", ",", "strval", ")", "<", "0", ")", "return", "-", "1", ";", "break;", "}", "if", "(", "!", "json", "&&", "(", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"class\"", ")", "==", "0", "||", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"qclass\"", ")", "==", "0", ")", "&&", "_getdns_print_class", "(", "buf", ",", "item", "->", "i", ".", "data", ".", "n", ")", ")", "break;", "if", "(", "!", "json", "&&", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"opcode\"", ")", "==", "0", "&&", "_getdns_print_opcode", "(", "buf", ",", "item", "->", "i", ".", "data", ".", "n", ")", ")", "break;", "if", "(", "!", "json", "&&", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"rcode\"", ")", "==", "0", "&&", "_getdns_print_rcode", "(", "buf", ",", "item", "->", "i", ".", "data", ".", "n", ")", ")", "break;", "if", "(", "!", "json", "&&", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"extended_rcode\"", ")", "==", "0", "&&", "item", "->", "i", ".", "data", ".", "n", ">=", "16", "&&", "_getdns_print_rcode", "(", "buf", ",", "item", "->", "i", ".", "data", ".", "n", ")", ")", "break;", "if", "(", "gldns_buffer_printf", "(", "buf", ",", "(", "json", "<", "2", "?", "\"", "%d\"", ":", "\"%d\"", ")", ",", "item", "->", "i", ".", "data", ".", "n", ")", "<", "0", ")", "return", "-", "1", ";", "break;", "case", "t_bindata", ":", "if", "(", "(", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"address_data\"", ")", "==", "0", "||", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"ipv4_address\"", ")", "==", "0", "||", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"ipv6_address\"", ")", "==", "0", "||", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"answer_ipv4_address\"", ")", "==", "0", "||", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"answer_ipv6_address\"", ")", "==", "0", ")", "&&", "(", "item", "->", "i", ".", "data", ".", "bindata", "->", "size", "==", "4", "||", "item", "->", "i", ".", "data", ".", "bindata", "->", "size", "==", "16", ")", ")", "{", "if", "(", "gldns_buffer_printf", "(", "buf", ",", "(", "json", "?", "\"\\\\\"%s\\\\\"\"", ":", "\"", "<bindata", "for", "%s>\"", ")", ",", "inet_ntop", "(", "(", "item", "->", "i", ".", "data", ".", "bindata", "->", "size", "==", "4", "?", "AF_INET", ":", "AF_INET6", ")", ",", "item", "->", "i", ".", "data", ".", "bindata", "->", "data", ",", "abuf", ",", "40", ")", ")", "<", "0", ")", "return", "-", "1", ";", "}", "<if", "type=\"elseif\">", "else", "if", "(", "!", "json", "&&", "(", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"pin-sha256\"", ")", "==", "0", "||", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"value\"", ")", "==", "0", ")", "&&", "item", "->", "i", ".", "data", ".", "bindata", "->", "size", ">", "0", "&&", "item", "->", "i", ".", "data", ".", "bindata", "->", "size", "%", "4", "==", "0", ")", "{", "if", "(", "getdns_pp_base64", "(", "buf", ",", "item", "->", "i", ".", "data", ".", "bindata", ")", "<", "0", ")", "return", "-", "1", ";", "}", "<if", "type=\"elseif\">", "else", "if", "(", "getdns_pp_bindata", "(", "buf", ",", "item", "->", "i", ".", "data", ".", "bindata", ",", "(", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"rdata_raw\"", ")", "==", "0", ")", ",", "json", ")", "<", "0", ")", "return", "-", "1", ";", "break;", "case", "t_list", ":", "/*", "Don\\'t", "put", "empty", "lists", "on", "a", "new", "line", "*/", "if", "(", "getdns_list_get_length", "(", "item", "->", "i", ".", "data", ".", "list", ",", "&", "length", ")", "!=", "GETDNS_RETURN_GOOD", ")", "return", "-", "1", ";", "if", "(", "length", "==", "0", ")", "{", "if", "(", "gldns_buffer_printf", "(", "buf", ",", "(", "json", "<", "2", "?", "\"", "[]\"", ":", "\"[]\"", ")", ")", "<", "0", ")", "return", "-", "1", ";", "break;", "}", "if", "(", "json", "<", "2", "&&", "gldns_buffer_printf", "(", "buf", ",", "\"\\%s\"", ",", "getdns_indent", "(", "indent", ")", ")", "<", "0", ")", "return", "-", "1", ";", "if", "(", "getdns_pp_list", "(", "buf", ",", "indent", ",", "item", "->", "i", ".", "data", ".", "list", ",", "(", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"namespaces\"", ")", "==", "0", "||", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"dns_transport_list\"", ")", "==", "0", "||", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"bad_dns\"", ")", "==", "0", "||", "strcmp", "(", "item", "->", "node", ".", "key", ",", "\"dns_root_servers\"", ")", "==", "0", ")", ",", "json", ")", "<", "0", ")", "return", "-", "1", ";", "break;", "case", "t_dict", ":", "if", "(", "json", "<", "2", "&&", "gldns_buffer_printf", "(", "buf", ",", "\"\\%s\"", ",", "getdns_indent", "(", "indent", ")", ")", "<", "0", ")", "return", "-", "1", ";", "if", "(", "getdns_pp_dict", "(", "buf", ",", "indent", ",", "item", "->", "i", ".", "data", ".", "dict", ",", "json", ")", "<", "0", ")", "return", "-", "1", ";", "break;", "default:", "if", "(", "gldns_buffer_printf", "(", "buf", ",", "\"%s\"", ",", "unknown_str_l", "[", "json", "]", ")", "<", "0", ")", "return", "-", "1", ";", "}", "i", "++", ";", "}", "indent", "-=", "2", ";", "if", "(", "json", "<", "2", "&&", "i", "&&", "gldns_buffer_printf", "(", "buf", ",", "\"\\%s\"", ",", "getdns_indent", "(", "indent", ")", ")", "<", "0", ")", "return", "-", "1", ";", "if", "(", "gldns_buffer_printf", "(", "buf", ",", "\"}\"", ")", "<", "0", ")", "return", "-", "1", ";", "return", "gldns_buffer_position", "(", "buf", ")", "-", "p", ";", "}'" ]
getdns_pp_dict
getdnsapi/getdns
multi_line
train
91
111
[ "Reenable", "compiling", "a", "prototype", "by", "unpatching", "any", "modified", "bytecode" ]
[ "'void", "lj_trace_reenableproto", "(", "GCproto", "*", "pt", ")", "{", "if", "(", "(", "pt", "->", "flags", "&", "PROTO_ILOOP", ")", ")", "{", "BCIns", "*", "bc", "=", "proto_bc", "(", "pt", ")", ";", "BCPos", "i", ",", "<type", "ref=\"prev\"/>", "sizebc", "=", "pt", "->", "sizebc", ";", ";", "pt", "->", "flags", "&=", "~", "PROTO_ILOOP", ";", "if", "(", "bc_op", "(", "bc", "[", "0", "]", ")", "==", "BC_IFUNCF", ")", "setbc_op", "(", "&", "bc", "[", "0", "]", ",", "BC_FUNCF", ")", ";", "for", "(", "i", "=", "1", ";", "i", "<", "sizebc", ";", "i", "++", ")", "{", "BCOp", "op", "=", "bc_op", "(", "bc", "[", "i", "]", ")", ";", "if", "(", "op", "==", "BC_IFORL", "||", "op", "==", "BC_IITERL", "||", "op", "==", "BC_ILOOP", ")", "setbc_op", "(", "&", "bc", "[", "i", "]", ",", "(", "int", ")", "op", "+", "(", "int", ")", "BC_LOOP", "-", "(", "int", ")", "BC_ILOOP", ")", ";", "}", "}", "}'" ]
lj_trace_reenableproto
openresty/stream-lua-nginx-module
single_line
train
92
112
[ "Handle", "commands", "and", "read", "requests" ]
[ "'static", "void", "usb_control_setup_read", "(", "usbd_device", "*", "usbd_dev", ",", "struct", "usb_setup_data", "*", "req", ")", "{", "usbd_dev", "->", "control_state", ".", "ctrl_buf", "=", "usbd_dev", "->", "ctrl_buf", ";", "usbd_dev", "->", "control_state", ".", "ctrl_len", "=", "req", "->", "wLength", ";", "if", "(", "usb_control_request_dispatch", "(", "usbd_dev", ",", "req", ")", ")", "{", "if", "(", "req", "->", "wLength", ")", "{", "usbd_dev", "->", "control_state", ".", "needs_zlp", "=", "needs_zlp", "(", "usbd_dev", "->", "control_state", ".", "ctrl_len", ",", "req", "->", "wLength", ",", "usbd_dev", "->", "desc", "->", "bMaxPacketSize0", ")", ";", "/*", "Go", "to", "data", "out", "stage", "if", "handled.", "*/", "usb_control_send_chunk", "(", "usbd_dev", ")", ";", "}", "else", "{", "/*", "Go", "to", "status", "stage", "if", "handled.", "*/", "usbd_ep_write_packet", "(", "usbd_dev", ",", "0", ",", "NULL", ",", "0", ")", ";", "usbd_dev", "->", "control_state", ".", "state", "=", "STATUS_IN", ";", "}", "}", "else", "{", "/*", "Stall", "endpoint", "on", "failure.", "*/", "stall_transaction", "(", "usbd_dev", ")", ";", "}", "}'" ]
usb_control_setup_read
libopencm3/libopencm3
single_line
train
93
118
[ "FIPS", "wrapper", "functions", "to", "block", "low", "level", "AES", "calls", "in", "FIPS", "mode" ]
[ "'int", "AES_set_encrypt_key", "(", "const", "unsigned", "char", "*", "userKey", ",", "const", "int", "bits", ",", "AES_KEY", "*", "key", ")", "{", "#", "ifdef", "OPENSSL_FIPS", "fips_cipher_abort", "(", "AES", ")", ";", "#", "endif", "return", "private_AES_set_encrypt_key", "(", "userKey", ",", "bits", ",", "key", ")", ";", "}'" ]
AES_set_encrypt_key
tpm2-software/tpm2-tss-engine
single_line
train
94
126
[ "@func", "GPS_D1006_Get", "Convert", "packet", "D1006", "to", "course", "structure" ]
[ "'void", "GPS_D1006_Get", "(", "GPS_PCourse", "*", "crs", ",", "UC", "*", "p", ")", "{", "int", "i", ";", "(", "*", "crs", ")", "->", "index", "=", "GPS_Util_Get_Short", "(", "p", ")", ";", "p", "+=", "sizeof", "(", "uint16", ")", ";", "p", "+=", "sizeof", "(", "uint16", ")", ";", "//", "unused", "for", "(", "i", "=", "0", ";", "i", "<", "16", ";", "++", "i", ")", "(", "*", "crs", ")", "->", "course_name", "[", "i", "]", "=", "*", "p", "++", ";", "(", "*", "crs", ")", "->", "track_index", "=", "GPS_Util_Get_Short", "(", "p", ")", ";", "p", "+=", "sizeof", "(", "uint16", ")", ";", "}'" ]
GPS_D1006_Get
OpenCPN/OpenCPN
multi_line
train
95
127
[ "@func", "GPS_A1008_Send", "Send", "Course", "Points", "to", "GPS" ]
[ "'int32", "GPS_A1008_Send", "(", "const", "char", "*", "port", ",", "GPS_PCourse_Point", "*", "cpt", ",", "int32", "n_cpt", ",", "gpsdevh", "*", "fd", ")", "{", "UC", "data", "[", "GPS_ARB_LEN", "]", ";", "GPS_PPacket", "tra", ";", "GPS_PPacket", "rec", ";", "int32", "i", ";", "int32", "len", ";", "if", "(", "!", "(", "tra", "=", "GPS_Packet_New", "()", ")", "||", "!", "(", "rec", "=", "GPS_Packet_New", "()", ")", ")", "return", "MEMORY_ERROR", ";", "GPS_Util_Put_Short", "(", "data", ",", "(", "US", ")", "n_cpt", ")", ";", "GPS_Make_Packet", "(", "&", "tra", ",", "LINK_ID", "[", "gps_link_type", "]", ".", "Pid_Records", ",", "data", ",", "2", ")", ";", "if", "(", "!", "GPS_Write_Packet", "(", "fd", ",", "tra", ")", ")", "return", "gps_errno", ";", "if", "(", "!", "GPS_Get_Ack", "(", "fd", ",", "&", "tra", ",", "&", "rec", ")", ")", "{", "GPS_Error", "(", "\"GPS_A1008_Send:", "Coursepoint", "start", "data", "not", "acknowledged\"", ")", ";", "return", "FRAMING_ERROR", ";", "}", "for", "(", "i", "=", "0", ";", "i", "<", "n_cpt", ";", "++", "i", ")", "{", "switch", "(", "gps_course_point_type", ")", "{", "case", "pD1012", ":", "GPS_D1012_Send", "(", "data", ",", "cpt", "[", "i", "]", ",", "&", "len", ")", ";", "break;", "default:", "GPS_Error", "(", "\"GPS_A1008_Send:", "Unknown", "couse_point", "type", "%d\\\"", ",", "gps_course_point_type", ")", ";", "return", "PROTOCOL_ERROR", ";", "}", "GPS_Make_Packet", "(", "&", "tra", ",", "LINK_ID", "[", "gps_link_type", "]", ".", "Pid_Course_Point", ",", "data", ",", "(", "US", ")", "len", ")", ";", "if", "(", "!", "GPS_Write_Packet", "(", "fd", ",", "tra", ")", ")", "return", "gps_errno", ";", "if", "(", "!", "GPS_Get_Ack", "(", "fd", ",", "&", "tra", ",", "&", "rec", ")", ")", "{", "GPS_Error", "(", "\"A1008_Send:", "Pid_Course_Point", "not", "acknowledged\"", ")", ";", "return", "gps_errno", ";", "}", "}", "GPS_Util_Put_Short", "(", "data", ",", "COMMAND_ID", "[", "gps_device_command", "]", ".", "Cmnd_Transfer_Course_Points", ")", ";", "GPS_Make_Packet", "(", "&", "tra", ",", "LINK_ID", "[", "gps_link_type", "]", ".", "Pid_Xfer_Cmplt", ",", "data", ",", "2", ")", ";", "if", "(", "!", "GPS_Write_Packet", "(", "fd", ",", "tra", ")", ")", "return", "gps_errno", ";", "if", "(", "!", "GPS_Get_Ack", "(", "fd", ",", "&", "tra", ",", "&", "rec", ")", ")", "{", "GPS_Error", "(", "\"A1008_Send:", "CoursePoint", "complete", "data", "not", "acknowledged\"", ")", ";", "return", "FRAMING_ERROR", ";", "}", "GPS_Packet_Del", "(", "&", "tra", ")", ";", "GPS_Packet_Del", "(", "&", "rec", ")", ";", "return", "1", ";", "}'" ]
GPS_A1008_Send
OpenCPN/OpenCPN
multi_line
train
96
128
[ "@func", "GPS_D303b_Get", "Get", "track", "data", "(A302", "protocol)", "used", "in", "Forerunner", "301" ]
[ "'void", "GPS_D303b_Get", "(", "GPS_PTrack", "*", "trk", ",", "UC", "*", "data", ")", "{", "UC", "*", "p", ";", "uint32", "t", ";", "uint32", "raw_lat", ",", "<type", "ref=\"prev\"/>", "raw_lon", ";", "int", "lat_undefined", ",", "<type", "ref=\"prev\"/>", "lon_undefined", ";", "p", "=", "data", ";", "/*", "Latitude", "and", "longitude", "are", "sometimes", "invalid", "(0x7fffffff", "or", "*", "maybe", "0xffffffff?)", "I", "guess", "this", "makes", "sense", "if", "the", "device", "is", "*", "reporting", "heart", "rate", "and", "time", "anyway.", "I", "presume", "that", "latitude", "*", "and", "longitude", "are", "defined", "or", "left", "undefined", "together?", "*/", "raw_lat", "=", "GPS_Util_Get_Int", "(", "p", ")", ";", "lat_undefined", "=", "!", "raw_lat", "||", "raw_lat", "==", "0x7fffffff", "||", "raw_lat", "==", "0xffffffff", ";", "if", "(", "lat_undefined", ")", "(", "*", "trk", ")", "->", "lat", "=", "0", ";", "else", "(", "*", "trk", ")", "->", "lat", "=", "GPS_Math_Semi_To_Deg", "(", "raw_lat", ")", ";", "p", "+=", "sizeof", "(", "int32", ")", ";", "raw_lon", "=", "GPS_Util_Get_Int", "(", "p", ")", ";", "lon_undefined", "=", "!", "raw_lon", "||", "raw_lon", "==", "0x7fffffff", "||", "raw_lon", "==", "0xffffffff", ";", "if", "(", "lon_undefined", ")", "(", "*", "trk", ")", "->", "lon", "=", "0", ";", "else", "(", "*", "trk", ")", "->", "lon", "=", "GPS_Math_Semi_To_Deg", "(", "raw_lon", ")", ";", "p", "+=", "sizeof", "(", "int32", ")", ";", "/*", "*", "Let", "the", "caller", "decide", "if", "it", "wants", "to", "toss", "trackpionts", "with", "only", "*", "heart", "rate", "and/or", "time", "data.", "*/", "if", "(", "lat_undefined", "||", "lon_undefined", ")", "{", "(", "*", "trk", ")", "->", "no_latlon", "=", "1", ";", "}", "if", "(", "lat_undefined", "!=", "lon_undefined", ")", "GPS_Warning", "(", "\"GPS_D303b_Get:", "assumption", "(lat_undefined", "==", "lon_undefined)", "violated\"", ")", ";", "t", "=", "GPS_Util_Get_Uint", "(", "p", ")", ";", "if", "(", "!", "t", "||", "t", "==", "0x7fffffff", "||", "t", "==", "0xffffffff", ")", "(", "*", "trk", ")", "->", "Time", "=", "0", ";", "else", "(", "*", "trk", ")", "->", "Time", "=", "GPS_Math_Gtime_To_Utime", "(", "(", "time_t", ")", "t", ")", ";", "p", "+=", "sizeof", "(", "uint32", ")", ";", "(", "*", "trk", ")", "->", "alt", "=", "GPS_Util_Get_Float", "(", "p", ")", ";", "p", "+=", "sizeof", "(", "float", ")", ";", "/*", "Heartrate", "is", "reported", "as", "0", "if", "there", "is", "no", "signal", "from", "*", "a", "heartrate", "monitor.", "*", "303", "and", "304", "are", "identical", "until", "now.", "*/", "switch", "(", "gps_trk_type", ")", "{", "case", "pD304", ":", "(", "*", "trk", ")", "->", "distance", "=", "GPS_Util_Get_Float", "(", "p", ")", ";", "(", "*", "trk", ")", "->", "distance_populated", "=", "(", "(", "*", "trk", ")", "->", "distance", "<=", "1e24", ")", ";", "p", "+=", "sizeof", "(", "float", ")", ";", "/*", "A", "float", "indicating", "number", "of", "meters", "travelled.", "*/", "(", "*", "trk", ")", "->", "heartrate", "=", "(", "*", "p", "++", ")", ";", "/*", "crank", "cadence,", "RPM,", "0xff", "if", "invalid.", "*/", "if", "(", "*", "p", "!=", "0xff", ")", "{", "(", "*", "trk", ")", "->", "cadence", "=", "(", "*", "p", ")", ";", "}", "p", "++", ";", "(", "*", "trk", ")", "->", "wsensor_pres", "=", "(", "*", "p", "++", ")", ";", "break;", "case", "pD303", ":", "(", "*", "trk", ")", "->", "heartrate", "=", "*", "p", "++", ";", "break;", "}", "return", ";", "}'" ]
GPS_D303b_Get
OpenCPN/OpenCPN
multi_line
train
97
129
[ "@funcstatic", "GPS_D108_Send", "Form", "waypoint", "data", "string" ]
[ "'static", "void", "GPS_D108_Send", "(", "UC", "*", "data", ",", "GPS_PWay", "way", ",", "int32", "*", "len", ")", "{", "UC", "*", "p", ";", "UC", "*", "q", ";", "int32", "i", ";", "p", "=", "data", ";", "*", "p", "++", "=", "way", "->", "wpt_class", ";", "*", "p", "++", "=", "(", "UC", ")", "way", "->", "colour", ";", "*", "p", "++", "=", "(", "UC", ")", "way", "->", "dspl", ";", "*", "p", "++", "=", "0x60", ";", "GPS_Util_Put_Short", "(", "p", ",", "(", "US", ")", "way", "->", "smbl", ")", ";", "p", "+=", "sizeof", "(", "int16", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "18", ";", "++", "i", ")", "*", "p", "++", "=", "way", "->", "subclass", "[", "i", "]", ";", "GPS_Util_Put_Int", "(", "p", ",", "(", "int32", ")", "GPS_Math_Deg_To_Semi", "(", "way", "->", "lat", ")", ")", ";", "p", "+=", "sizeof", "(", "int32", ")", ";", "GPS_Util_Put_Int", "(", "p", ",", "(", "int32", ")", "GPS_Math_Deg_To_Semi", "(", "way", "->", "lon", ")", ")", ";", "p", "+=", "sizeof", "(", "int32", ")", ";", "if", "(", "way", "->", "alt_is_unknown", ")", "{", "GPS_Util_Put_Float", "(", "p", ",", "(", "const", "float", ")", "1.0e25", ")", ";", "}", "else", "{", "GPS_Util_Put_Float", "(", "p", ",", "way", "->", "alt", ")", ";", "}", "p", "+=", "sizeof", "(", "float", ")", ";", "GPS_Util_Put_Float", "(", "p", ",", "way", "->", "dpth", ")", ";", "p", "+=", "sizeof", "(", "float", ")", ";", "GPS_Util_Put_Float", "(", "p", ",", "way", "->", "dst", ")", ";", "p", "+=", "sizeof", "(", "float", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "2", ";", "++", "i", ")", "*", "p", "++", "=", "way", "->", "state", "[", "i", "]", ";", "for", "(", "i", "=", "0", ";", "i", "<", "2", ";", "++", "i", ")", "*", "p", "++", "=", "way", "->", "cc", "[", "i", "]", ";", "q", "=", "(", "UC", "*", ")", "way", "->", "ident", ";", "i", "=", "XMIN", "(", "51", ",", "sizeof", "(", "way", "->", "ident", ")", ")", ";", "while", "(", "(", "*", "p", "++", "=", "*", "q", "++", ")", "&&", "i", "--", ")", ";", "q", "=", "(", "UC", "*", ")", "way", "->", "cmnt", ";", "i", "=", "XMIN", "(", "51", ",", "sizeof", "(", "way", "->", "cmnt", ")", ")", ";", "while", "(", "(", "*", "p", "++", "=", "*", "q", "++", ")", "&&", "i", "--", ")", ";", "q", "=", "(", "UC", "*", ")", "way", "->", "facility", ";", "i", "=", "XMIN", "(", "31", ",", "sizeof", "(", "way", "->", "facility", ")", ")", ";", "while", "(", "(", "*", "p", "++", "=", "*", "q", "++", ")", "&&", "i", "--", ")", ";", "q", "=", "(", "UC", "*", ")", "way", "->", "city", ";", "i", "=", "XMIN", "(", "25", ",", "sizeof", "(", "way", "->", "city", ")", ")", ";", "while", "(", "(", "*", "p", "++", "=", "*", "q", "++", ")", "&&", "i", "--", ")", ";", "q", "=", "(", "UC", "*", ")", "way", "->", "addr", ";", "i", "=", "XMIN", "(", "51", ",", "sizeof", "(", "way", "->", "addr", ")", ")", ";", "while", "(", "(", "*", "p", "++", "=", "*", "q", "++", ")", "&&", "i", "--", ")", ";", "q", "=", "(", "UC", "*", ")", "way", "->", "cross_road", ";", "i", "=", "XMIN", "(", "51", ",", "sizeof", "(", "way", "->", "cross_road", ")", ")", ";", "while", "(", "(", "*", "p", "++", "=", "*", "q", "++", ")", "&&", "i", "--", ")", ";", "*", "len", "=", "p", "-", "data", ";", "return", ";", "}'" ]
GPS_D108_Send
OpenCPN/OpenCPN
multi_line
train
98
130
[ "@func", "GPS_D311_Send", "Form", "track", "header", "data", "string" ]
[ "'void", "GPS_D311_Send", "(", "UC", "*", "data", ",", "GPS_PTrack", "trk", ",", "int32", "*", "len", ")", "{", "UC", "*", "p", ";", "p", "=", "data", ";", "GPS_Util_Put_Short", "(", "p", ",", "(", "US", ")", "strtoul", "(", "trk", "->", "trk_ident", ",", "NULL", ",", "0", ")", ")", ";", "p", "+=", "2", ";", "*", "len", "=", "p", "-", "data", ";", "return", ";", "}'" ]
GPS_D311_Send
OpenCPN/OpenCPN
multi_line
train
99

Dataset Card for "Capybara"

Dataset Summary

Dataset used to train BinT5. Please refer to the paper for more information.

Citation Information

@inproceedings{alkaswan2023extending,
  title={Extending Source Code Pre-Trained Language Models to Summarise Decompiled Binaries},
  author={Al-Kaswan, Ali and Ahmed, Toufique and Izadi, Maliheh and Sawant, Anand Ashok and Devanbu, Premkumar and van Deursen, Arie},
  booktitle={2023 IEEE International Conference on Software Analysis, Evolution and Reengineering (SANER)},
  pages={260--271},
  year={2023},
  organization={IEEE}
}
Downloads last month
0
Edit dataset card

Models trained or fine-tuned on AISE-TUDelft/Capybara