type stringclasses 5
values | content stringlengths 9 163k |
|---|---|
defines | #define SPECIALS "^$*+?.([%-" |
defines | #define MAX_ITEM 512 |
defines | #define FLAGS "-+ #0" |
defines | #define MAX_FORMAT (sizeof(FLAGS) + sizeof(LUA_INTFRMLEN) + 10) |
functions | int str_len (lua_State *L) {
size_t l;
luaL_checklstring(L, 1, &l);
lua_pushinteger(L, l);
return 1;
} |
functions | ptrdiff_t posrelat (ptrdiff_t pos, size_t len) {
/* relative string position: negative means back from end */
if (pos < 0) pos += (ptrdiff_t)len + 1;
return (pos >= 0) ? pos : 0;
} |
functions | int str_sub (lua_State *L) {
size_t l;
const char *s = luaL_checklstring(L, 1, &l);
ptrdiff_t start = posrelat(luaL_checkinteger(L, 2), l);
ptrdiff_t end = posrelat(luaL_optinteger(L, 3, -1), l);
if (start < 1) start = 1;
if (end > (ptrdiff_t)l) end = (ptrdiff_t)l;
if (start <= end)
lua_pushlstring(L,... |
functions | int str_reverse (lua_State *L) {
size_t l;
luaL_Buffer b;
const char *s = luaL_checklstring(L, 1, &l);
luaL_buffinit(L, &b);
while (l--) luaL_addchar(&b, s[l]);
luaL_pushresult(&b);
return 1;
} |
functions | int str_lower (lua_State *L) {
size_t l;
size_t i;
luaL_Buffer b;
const char *s = luaL_checklstring(L, 1, &l);
luaL_buffinit(L, &b);
for (i=0; i<l; i++)
luaL_addchar(&b, tolower(uchar(s[i])));
luaL_pushresult(&b);
return 1;
} |
functions | int str_upper (lua_State *L) {
size_t l;
size_t i;
luaL_Buffer b;
const char *s = luaL_checklstring(L, 1, &l);
luaL_buffinit(L, &b);
for (i=0; i<l; i++)
luaL_addchar(&b, toupper(uchar(s[i])));
luaL_pushresult(&b);
return 1;
} |
functions | int str_rep (lua_State *L) {
size_t l;
luaL_Buffer b;
const char *s = luaL_checklstring(L, 1, &l);
int n = luaL_checkint(L, 2);
luaL_buffinit(L, &b);
while (n-- > 0)
luaL_addlstring(&b, s, l);
luaL_pushresult(&b);
return 1;
} |
functions | int str_byte (lua_State *L) {
size_t l;
const char *s = luaL_checklstring(L, 1, &l);
ptrdiff_t posi = posrelat(luaL_optinteger(L, 2, 1), l);
ptrdiff_t pose = posrelat(luaL_optinteger(L, 3, posi), l);
int n, i;
if (posi <= 0) posi = 1;
if ((size_t)pose > l) pose = l;
if (posi > pose) return 0; /* empty ... |
functions | int str_char (lua_State *L) {
int n = lua_gettop(L); /* number of arguments */
int i;
luaL_Buffer b;
luaL_buffinit(L, &b);
for (i=1; i<=n; i++) {
int c = luaL_checkint(L, i);
luaL_argcheck(L, uchar(c) == c, i, "invalid value");
luaL_addchar(&b, uchar(c));
} |
functions | int writer (lua_State *L, const void* b, size_t size, void* B) {
(void)L;
luaL_addlstring((luaL_Buffer*) B, (const char *)b, size);
return 0;
} |
functions | int str_dump (lua_State *L) {
luaL_Buffer b;
luaL_checktype(L, 1, LUA_TFUNCTION);
lua_settop(L, 1);
luaL_buffinit(L,&b);
if (lua_dump(L, writer, &b) != 0)
luaL_error(L, "unable to dump given function");
luaL_pushresult(&b);
return 1;
} |
functions | int check_capture (MatchState *ms, int l) {
l -= '1';
if (l < 0 || l >= ms->level || ms->capture[l].len == CAP_UNFINISHED)
return luaL_error(ms->L, "invalid capture index");
return l;
} |
functions | int capture_to_close (MatchState *ms) {
int level = ms->level;
for (level--; level>=0; level--)
if (ms->capture[level].len == CAP_UNFINISHED) return level;
return luaL_error(ms->L, "invalid pattern capture");
} |
functions | int match_class (int c, int cl) {
int res;
switch (tolower(cl)) {
case 'a' : res = isalpha(c); break;
case 'c' : res = iscntrl(c); break;
case 'd' : res = isdigit(c); break;
case 'l' : res = islower(c); break;
case 'p' : res = ispunct(c); break;
case 's' : res = isspace(c); break;
case '... |
functions | int matchbracketclass (int c, const char *p, const char *ec) {
int sig = 1;
if (*(p+1) == '^') {
sig = 0;
p++; /* skip the `^' */
} |
functions | int singlematch (int c, const char *p, const char *ep) {
switch (*p) {
case '.': return 1; /* matches any char */
case L_ESC: return match_class(c, uchar(*(p+1)));
case '[': return matchbracketclass(c, p, ep-1);
default: return (uchar(*p) == c);
} |
functions | void push_onecapture (MatchState *ms, int i, const char *s,
const char *e) {
if (i >= ms->level) {
if (i == 0) /* ms->level == 0, too */
lua_pushlstring(ms->L, s, e - s); /* add whole match */
else
luaL_error(ms->L, "invalid capture index");
... |
functions | int push_captures (MatchState *ms, const char *s, const char *e) {
int i;
int nlevels = (ms->level == 0 && s) ? 1 : ms->level;
luaL_checkstack(ms->L, nlevels, "too many captures");
for (i = 0; i < nlevels; i++)
push_onecapture(ms, i, s, e);
return nlevels; /* number of strings pushed */
} |
functions | int str_find_aux (lua_State *L, int find) {
size_t l1, l2;
const char *s = luaL_checklstring(L, 1, &l1);
const char *p = luaL_checklstring(L, 2, &l2);
ptrdiff_t init = posrelat(luaL_optinteger(L, 3, 1), l1) - 1;
if (init < 0) init = 0;
else if ((size_t)(init) > l1) init = (ptrdiff_t)l1;
if (find && (lua_t... |
functions | int str_find (lua_State *L) {
return str_find_aux(L, 1);
} |
functions | int str_match (lua_State *L) {
return str_find_aux(L, 0);
} |
functions | int gmatch_aux (lua_State *L) {
MatchState ms;
size_t ls;
const char *s = lua_tolstring(L, lua_upvalueindex(1), &ls);
const char *p = lua_tostring(L, lua_upvalueindex(2));
const char *src;
ms.L = L;
ms.src_init = s;
ms.src_end = s+ls;
for (src = s + (size_t)lua_tointeger(L, lua_upvalueindex(3));
... |
functions | int gmatch (lua_State *L) {
luaL_checkstring(L, 1);
luaL_checkstring(L, 2);
lua_settop(L, 2);
lua_pushinteger(L, 0);
lua_pushcclosure(L, gmatch_aux, 3);
return 1;
} |
functions | int gfind_nodef (lua_State *L) {
return luaL_error(L, LUA_QL("string.gfind") " was renamed to "
LUA_QL("string.gmatch"));
} |
functions | void add_s (MatchState *ms, luaL_Buffer *b, const char *s,
const char *e) {
size_t l, i;
const char *news = lua_tolstring(ms->L, 3, &l);
for (i = 0; i < l; i++) {
if (news[i] != L_ESC)
luaL_addchar(b, news[i]);
else {
i++; /* skip ESC */
... |
functions | void add_value (MatchState *ms, luaL_Buffer *b, const char *s,
const char *e) {
lua_State *L = ms->L;
switch (lua_type(L, 3)) {
case LUA_TNUMBER:
case LUA_TSTRING: {
add_s(ms, b, s, e);
return;
} |
functions | int str_gsub (lua_State *L) {
size_t srcl;
const char *src = luaL_checklstring(L, 1, &srcl);
const char *p = luaL_checkstring(L, 2);
int tr = lua_type(L, 3);
int max_s = luaL_optint(L, 4, srcl+1);
int anchor = (*p == '^') ? (p++, 1) : 0;
int n = 0;
MatchState ms;
luaL_Buffer b;
luaL_argcheck(L, tr ... |
functions | void addquoted (lua_State *L, luaL_Buffer *b, int arg) {
size_t l;
const char *s = luaL_checklstring(L, arg, &l);
luaL_addchar(b, '"');
while (l--) {
switch (*s) {
case '"': case '\\': case '\n': {
luaL_addchar(b, '\\');
luaL_addchar(b, *s);
break;
} |
functions | void addintlen (char *form) {
size_t l = strlen(form);
char spec = form[l - 1];
strcpy(form + l - 1, LUA_INTFRMLEN);
form[l + sizeof(LUA_INTFRMLEN) - 2] = spec;
form[l + sizeof(LUA_INTFRMLEN) - 1] = '\0';
} |
functions | int str_format (lua_State *L) {
int top = lua_gettop(L);
int arg = 1;
size_t sfl;
const char *strfrmt = luaL_checklstring(L, arg, &sfl);
const char *strfrmt_end = strfrmt+sfl;
luaL_Buffer b;
luaL_buffinit(L, &b);
while (strfrmt < strfrmt_end) {
if (*strfrmt != L_ESC)
luaL_addchar(&b, *strfrmt+... |
functions | void createmetatable (lua_State *L) {
lua_createtable(L, 0, 1); /* create metatable for strings */
lua_pushliteral(L, ""); /* dummy string */
lua_pushvalue(L, -2);
lua_setmetatable(L, -2); /* set string metatable */
lua_pop(L, 1); /* pop dummy string */
lua_pushvalue(L, -2); /* string library... */
l... |
functions | int luaopen_string (lua_State *L) {
luaL_register(L, LUA_STRLIBNAME, strlib);
#if defined(LUA_COMPAT_GFIND)
lua_getfield(L, -1, "gmatch");
lua_setfield(L, -2, "gfind");
#endif
createmetatable(L);
return 1;
} |
includes |
#include <gtk/gtk.h> |
includes |
#include <stdio.h> |
includes | #include <stdlib.h> |
includes | #include <string.h> |
includes | #include <glib.h> |
functions | void
MoveListRolloutClicked(GtkWidget * pw, hintdata * phd)
{
cubeinfo ci;
int i, c, res;
move *m;
int *ai;
void *p;
GList *pl, *plSelList = MoveListGetSelectionList(phd);
if (!plSelList)
return;
GetMatchStateCubeInfo(&ci, &ms);
c = g_list_length(plSelList);
/* setup r... |
functions | void
ShowMove(hintdata * phd, const int f)
{
char *sz;
TanBoard anBoard;
if (f) {
move *pm;
GList *plSelList = MoveListGetSelectionList(phd);
if (!plSelList)
return;
/* the button is toggled */
pm = MoveListGetMove(phd, plSelList);
MoveListFreeSe... |
functions | void
MoveListTempMapClicked(GtkWidget * pw, hintdata * phd)
{
GList *pl;
char szMove[100];
matchstate *ams;
int i, c;
gchar **asz;
GList *plSelList = MoveListGetSelectionList(phd);
if (!plSelList)
return;
c = g_list_length(plSelList);
ams = (matchstate *) g_malloc(c * size... |
functions | void
MoveListMWC(GtkWidget * pw, hintdata * phd)
{
char sz[80];
int f = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(pw));
if (f != fOutputMWC) {
sprintf(sz, "set output mwc %s", fOutputMWC ? "off" : "on");
UserCommand(sz);
UserCommand("save settings");
} |
functions | void
EvalMoves(hintdata * phd, evalcontext * pec)
{
GList *pl;
cubeinfo ci;
int *ai;
GList *plSelList = MoveListGetSelectionList(phd);
if (!plSelList)
return;
GetMatchStateCubeInfo(&ci, &ms);
for (pl = plSelList; pl; pl = pl->next) {
scoreData sd;
sd.pm = MoveListG... |
functions | void
MoveListEvalPly(GtkWidget * pw, hintdata * phd)
{
char *szPly = (char *) g_object_get_data(G_OBJECT(pw), "user_data");
evalcontext ec = { TRUE, 0, TRUE, TRUE, 0.0 } |
functions | void
MoveListRolloutPresets(GtkWidget * pw, hintdata * phd)
{
const gchar *preset;
gchar *file = NULL;
gchar *path = NULL;
gchar *command = NULL;
preset = (const gchar *) g_object_get_data(G_OBJECT(pw), "user_data");
file = g_strdup_printf("%s.rol", preset);
path = g_build_filename(szHomeDi... |
functions | int
CompareInts(int *p0, int *p1)
{
return *p0 - *p1;
} |
functions | void
MoveListMove(GtkWidget * pw, hintdata * phd)
{
move m;
move *pm;
char szMove[40];
GList *plSelList = MoveListGetSelectionList(phd);
if (!plSelList)
return;
ShowMove(phd, TRUE);
pm = MoveListGetMove(phd, plSelList);
MoveListFreeSelectionList(plSelList);
memcpy(&m, pm, s... |
functions | void
HintSelect(GtkTreeSelection * selection, hintdata * phd)
{
CheckHintButtons(phd);
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(phd->pwShow))) {
int c = gtk_tree_selection_count_selected_rows(selection);
switch (c) {
case 0:
case 1:
ShowMove(phd, c);
... |
functions | int
CheckHintButtons(hintdata * phd)
{
GList *plSelList = MoveListGetSelectionList(phd);
int c = g_list_length(plSelList);
MoveListFreeSelectionList(plSelList);
gtk_widget_set_sensitive(phd->pwMove, c == 1 && phd->fButtonsValid);
gtk_widget_set_sensitive(phd->pwCopy, c && phd->fButtonsValid);
g... |
includes |
#include <dlfcn.h> |
includes | #include <string.h> |
includes | #include <stdlib.h> |
functions | void
plugin_load_all(void)
{
const unsigned int plugins_nb = cfg_size(globalconf.cfg, "plugins");
if(!plugins_nb)
return;
plugin_t *plugin = globalconf.plugins;
for(unsigned int plugin_n = 0; plugin_n < plugins_nb; plugin_n++)
{
plugin_t *new_plugin = plugin_load(cfg_getnstr(globalconf.cfg, "plug... |
functions | void
plugin_check_requirements(void)
{
for(plugin_t *plugin = globalconf.plugins; plugin; plugin = plugin->next)
plugin->enable = (!plugin->vtable->check_requirements ? true :
(*plugin->vtable->check_requirements)());
} |
functions | void
plugin_unload(plugin_t **plugin, const bool do_update_list)
{
if(do_update_list)
{
if((*plugin)->prev)
(*plugin)->prev->next = (*plugin)->next;
else
globalconf.plugins = (*plugin)->next;
} |
functions | void
plugin_unload_all(void)
{
plugin_t *plugin = globalconf.plugins;
plugin_t *plugin_next;
while(plugin != NULL)
{
plugin_next = plugin->next;
plugin_unload(&plugin, false);
plugin = plugin_next;
} |
includes |
#include <stdio.h> |
includes | #include <stdlib.h> |
defines |
#define MAXSIZ 32 * 1024 * 1024 + 310 |
main | int main(int argc, char** argv)
{
FILE *fp;
UCHAR *buf = malloc(MAXSIZ), *l;
int i, j = 0, k;
static UCHAR head[0x8c] = {
0x4c, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, /* +08(d) : g = h + 0x8c */
0x00, 0x00, 0x00, 0x00, 0x2e, 0x74, 0x65, 0x78,
0x74, 0x00, 0x... |
functions | sdt_result_t sdt_handle_valid(sdt_handle_t handle)
{
sdt_result_t result = SDT_ERR_HANDLE;
if ((handle > 0) && (handle < SDT_MAX_INSTANCE))
{
result = SDT_OK;
} |
functions | sdt_result_t sdt_determine_latency(sdt_instance_t *p_ins,
sdt_result_t result)
{
sdt_result_t retval = result;
uint32_t e_ssc = 0U;
if (p_ins != NULL)
{
if (p_ins->nlmi >= (uint32_t)p_ins->lmi_max) /* Init Values */
{
... |
functions | sdt_validity_t sdt_examine_crcfault(sdt_instance_t *p_ins)
{
sdt_validity_t valid = SDT_ERROR;
if (p_ins->state != SDT_INITIAL)
{
/*first error occurence sets up count down for supervision intervall*/
if (p_ins->cmRemainCycles == (uint32_t)0)
{
/*we are in the interv... |
functions | sdt_validity_t sdt_determine_channelquality(sdt_instance_t *p_ins)
{
sdt_validity_t valid = SDT_ERROR;
/*decrement cm counter, if not zero - we are FRESH and exiting*/
if (p_ins->cmRemainCycles > (uint32_t)0)
{
p_ins->cmRemainCycles--;
} |
functions | sdt_validity_t sdt_control_redundancy(sdt_instance_t *p_ins)
{
sdt_validity_t valid = SDT_ERROR;
/*check inhibit flag*/
#ifdef UNITTEST
printf("sdt_control_redundancy - redInvalidateAll: %d tmp_guard: %d\n", p_ins->redInvalidateAll, p_ins->tmp_guard);
#endif
if (p_ins->redInvalidateAll != (uint32_t)0)
... |
functions | sdt_validity_t sdt_determine_validity(sdt_instance_t *p_ins,
sdt_result_t result)
{
sdt_validity_t valid = SDT_ERROR;
sdt_validity_t valid_redundancy_check = SDT_ERROR;
sdt_result_t latency_check_result = SDT_OK;
if (p_ins != ... |
functions | sdt_result_t sdt_get_sdsink_parameters(sdt_handle_t handle,
uint16_t *p_rx_period,
uint16_t *p_tx_period,
uint8_t *p_n_rxsafe,
... |
functions | sdt_result_t sdt_set_sdsink_parameters(sdt_handle_t handle,
uint16_t rx_period,
uint16_t tx_period,
uint8_t n_rxsafe,
... |
functions | sdt_result_t sdt_get_counters(sdt_handle_t handle,
sdt_counters_t *p_counters)
{
sdt_result_t result = SDT_ERR_PARAM;
sdt_result_t mutex_result;
if (p_counters != NULL)
{
result = sdt_mutex_lock();
if (result == SDT_OK)
{
... |
functions | sdt_result_t sdt_reset_counters(sdt_handle_t handle)
{
sdt_result_t result;
sdt_result_t mutex_result;
result = sdt_mutex_lock();
if (result == SDT_OK)
{
result = sdt_handle_valid(handle);
if ((result == SDT_OK) && (priv_instance_array[handle].state != SDT_UNUSED))
... |
functions | sdt_result_t sdt_get_errno(sdt_handle_t handle,
sdt_result_t *p_errno)
{
sdt_result_t result = SDT_ERR_PARAM;
sdt_result_t mutex_result;
if (p_errno != NULL)
{
result = sdt_mutex_lock();
if (result == SDT_OK)
{
result... |
functions | sdt_result_t sdt_set_uic_fillvalue(sdt_handle_t handle,
uint32_t fillvalue)
{
sdt_result_t result;
sdt_result_t mutex_result;
result = sdt_mutex_lock();
if (result == SDT_OK)
{
result = sdt_handle_valid(handle);
... |
functions | sdt_result_t sdt_get_uic_fillvalue(sdt_handle_t handle,
uint32_t *p_fillvalue)
{
sdt_result_t result = SDT_ERR_PARAM;
sdt_result_t mutex_result;
if (p_fillvalue != NULL)
{
result = sdt_mutex_lock();
if (result == SDT_OK)
{
... |
functions | sdt_result_t sdt_get_ssc(sdt_handle_t handle,
uint32_t *p_ssc)
{
sdt_result_t result = SDT_ERR_PARAM;
sdt_result_t mutex_result;
if (p_ssc != NULL)
{
result = sdt_mutex_lock();
if (result == SDT_OK)
{
result = sdt_h... |
functions | sdt_result_t sdt_get_sid(sdt_handle_t handle,
uint32_t *p_sid1,
uint32_t *p_sid2,
uint8_t *p_sid2red)
{
sdt_result_t result = SDT_ERR_PARAM;
sdt_result_t mutex_result;
... |
functions | sdt_result_t sdt_set_sid(sdt_handle_t handle,
uint32_t sid1,
uint32_t sid2,
uint8_t sid2red)
{
sdt_result_t result;
sdt_result_t mutex_result;
result = sdt_mutex_l... |
functions | sdt_result_t sdt_get_validator(sdt_bus_type_t type,
uint32_t sid1,
uint32_t sid2,
uint8_t sid2red,
uint16_t v... |
functions | sdt_validity_t sdt_validate_pd(sdt_handle_t handle,
void *p_buf,
uint16_t len)
{
sdt_validity_t valid = SDT_ERROR;
sdt_result_t validationResult = SDT_ERR_SYS;
int32_t earlyExitFlag ... |
functions | sdt_result_t sdt_gen_sid(uint32_t *p_sid,
uint32_t smi,
const uint8_t consistid[],
uint32_t stc)
{
uint32_t i = 0U;
uint32_t zerofillFlag = 0U;
sdt_res... |
functions | void set_counters_near_limit( sdt_handle_t handle )
{
if( sdt_handle_valid(handle) == SDT_OK )
{
priv_instance_array[handle].counters.rx_count = 0xFFFFFFF8U;
priv_instance_array[handle].counters.err_count = 0xFFFFFFF8U;
priv_instance_array[handle].counters.sid_count = 0xFFFFFFF8U;
... |
includes |
#include <config.h> |
includes |
#include <isc/base64.h> |
includes | #include <isc/buffer.h> |
includes | #include <isc/mem.h> |
includes | #include <isc/string.h> |
includes |
#include <isccfg/cfg.h> |
includes |
#include <dns/tsig.h> |
includes | #include <dns/result.h> |
includes |
#include <named/log.h> |
includes |
#include <named/config.h> |
includes | #include <named/tsigconf.h> |
functions | isc_result_t
add_initial_keys(const cfg_obj_t *list, dns_tsig_keyring_t *ring,
isc_mem_t *mctx)
{
dns_tsigkey_t *tsigkey = NULL;
const cfg_listelt_t *element;
const cfg_obj_t *key = NULL;
const char *keyid = NULL;
unsigned char *secret = NULL;
int secretalloc = 0;
int secretlen = 0;
isc_result_t ret;
isc_st... |
functions | isc_result_t
ns_tsigkeyring_fromconfig(const cfg_obj_t *config, const cfg_obj_t *vconfig,
isc_mem_t *mctx, dns_tsig_keyring_t **ringp)
{
const cfg_obj_t *maps[3];
const cfg_obj_t *keylist;
dns_tsig_keyring_t *ring = NULL;
isc_result_t result;
int i;
REQUIRE(ringp != NULL && *ringp == NULL);
i = 0;
if (co... |
functions | uint32_t divToLog2(uint32_t div)
{
uint32_t log2;
/* Prescaler accepts an argument of 128 or less, valid values being 2^n */
EFM_ASSERT((div > 0) && (div <= 32768));
/* Count leading zeroes and "reverse" result, Cortex-M3 intrinsic */
log2 = (31 - __CLZ(div));
return log2;
} |
functions | void regSync(uint32_t mask)
{
/* Avoid deadlock if modifying the same register twice when freeze mode is
activated, or when no clock is selected for the BURTC. If no clock is
selected, then the sync is done once the clock source is set. */
if ((BURTC->FREEZE & BURTC_FREEZE_REGFREEZE)
|| ((BURTC->CTR... |
functions | void BURTC_Init(const BURTC_Init_TypeDef *burtcInit)
{
uint32_t ctrl;
uint32_t presc;
/* Check initializer structure integrity */
EFM_ASSERT(burtcInit != (BURTC_Init_TypeDef *) 0);
/* Clock divider must be between 1 and 128, really on the form 2^n */
EFM_ASSERT((burtcInit->clkDiv >= 1) && (burtcInit->clkDi... |
functions | void BURTC_CompareSet(unsigned int comp, uint32_t value)
{
(void) comp; /* Unused parameter when EFM_ASSERT is undefined. */
EFM_ASSERT(comp == 0);
/* Modification of COMP0 register requires sync with potential ongoing
* register updates in LF domain. */
regSync(BURTC_SYNCBUSY_COMP0);
/* Configure comp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.