static HSPToken *readTokens(HSP *sp) { FILE *cfg = NULL; if((cfg = fopen(sp->configFile, "r")) == NULL) { myLog(LOG_ERR,"cannot open config file %s : %s", sp->configFile, strerror(errno)); return NULL; } // collect the tokens in a (reversed) list HSPToken *tokens = newToken("start", 5); char line[HSP_MAX_LINELEN]; uint32_t lineNo = 0; while(fgets(line, HSP_MAX_LINELEN, cfg)) { lineNo++; char *p = line; // comments start with '#' p[strcspn(p, "#")] = '\0'; HSPToken *tok; while((tok = nextToken(p, &p)) != NULL) { tok->lineNo = lineNo; ADD_TO_LIST(tokens, tok); } } fclose(cfg); // get them in the right order tokens = reverseTokens(tokens); return tokens; }
HSPCollector *newCollector(HSPSFlowSettings *sFlowSettings) { HSPCollector *col = (HSPCollector *)my_calloc(sizeof(HSPCollector)); ADD_TO_LIST(sFlowSettings->collectors, col); sFlowSettings->numCollectors++; col->udpPort = SFL_DEFAULT_COLLECTOR_PORT; return col; }
void YogVM_add_locals(YogEnv* env, YogVM* vm, YogLocalsAnchor* locals) { YogVM_acquire_global_interp_lock(env, vm); ADD_TO_LIST(vm->locals, locals); YogVM_release_global_interp_lock(env, vm); }
void YogVM_add_handles(YogEnv* env, YogVM* vm, YogHandles* handles) { YogVM_acquire_global_interp_lock(env, vm); ADD_TO_LIST(vm->handles, handles); YogVM_release_global_interp_lock(env, vm); }
/** * Creates a new GuidStore structure, populates it with the uuid and dsIndex, * then adds it to the head of linked list of GuidStores (store). * Returns the new GuidStore at the head of the list. */ static GuidStore *newGuidStore(GuidStore *guidStore, char *uuid, uint32_t dsIndex) { GuidStore *newStore = (GuidStore *)my_calloc(sizeof(GuidStore)); memcpy(newStore->uuid, uuid, 16); newStore->dsIndex = dsIndex; ADD_TO_LIST(guidStore, newStore); return newStore; }
static HSPToken *reverseTokens(HSPToken *tokens) { HSPToken *rev = NULL; for(HSPToken *tok = tokens; tok; ) { HSPToken *nextTok = tok->nxt; ADD_TO_LIST(rev, tok); tok = nextTok; } return rev; }
EAPI void evas_event_feed_key_down(Evas *e, const char *keyname, const char *key, const char *string, const char *compose, unsigned int timestamp, const void *data) { int evt = tsuite_event_type_get(EVAS_CALLBACK_KEY_DOWN); void (*orig) (Evas *e, const char *keyname, const char *key, const char *string, const char *compose, unsigned int timestamp, const void *data) = dlsym(RTLD_NEXT, __func__); #ifdef DEBUG_TSUITE printf("Calling %s timestamp=<%u>\n", __func__, timestamp); #endif if (!strcmp(key, shot_key)) { #ifdef DEBUG_TSUITE printf("Take Screenshot: %s timestamp=<%u>\n", __func__, timestamp); #endif take_screenshot t = { timestamp, evas_list_find(e) }; if (t.n_evas >= 0) ADD_TO_LIST(TSUITE_EVENT_TAKE_SHOT, take_screenshot, t); orig(e, keyname, key, string, compose, timestamp, data); return; } if (vr_list && _hook_setting->recording) { /* Construct duplicate strings, free them when list if freed */ key_down_key_up t; t.timestamp = timestamp; t.keyname = eina_stringshare_add(keyname); t.key = eina_stringshare_add(key); t.string = eina_stringshare_add(string); t.compose = eina_stringshare_add(compose); t.n_evas = evas_list_find(e); if (t.n_evas >= 0) ADD_TO_LIST(evt, key_down_key_up, t); } orig(e, keyname, key, string, compose, timestamp, data); }
YogIndirectPointer* YogVM_alloc_indirect_ptr(YogEnv* env, YogVM* vm, YogVal val) { acquire_indirect_ptr_lock(env, vm); size_t size = sizeof(YogIndirectPointer); YogIndirectPointer* ptr = (YogIndirectPointer*)malloc(size); if (ptr == NULL) { YogError_out_of_memory(env, size); } ADD_TO_LIST(vm->indirect_ptr, ptr); ptr->val = val; release_indirect_ptr_lock(env, vm); return ptr; }
EAPI void evas_event_feed_mouse_move(Evas *e, int x, int y, unsigned int timestamp, const void *data) { mouse_move t = { x, y, timestamp, evas_list_find(e) }; #ifdef DEBUG_TSUITE printf("Calling %s timestamp=<%u>\n", __func__, timestamp); #endif int evt = tsuite_event_type_get(EVAS_CALLBACK_MOUSE_MOVE); if (t.n_evas >= 0) ADD_TO_LIST(evt, mouse_move, t); void (*orig) (Evas *e, int x, int y, unsigned int timestamp, const void *data) = dlsym(RTLD_NEXT, __func__); orig(e, x, y, timestamp, data); }
EAPI void evas_event_feed_mouse_wheel(Evas *e, int direction, int z, unsigned int timestamp, const void *data) { #ifdef DEBUG_TSUITE printf("Calling %s timestamp=<%u>\n", __func__, timestamp); #endif mouse_wheel t = { direction, z, timestamp, evas_list_find(e) }; int evt = tsuite_event_type_get(EVAS_CALLBACK_MOUSE_WHEEL); if (t.n_evas >= 0) ADD_TO_LIST(evt, mouse_wheel, t); void (*orig) (Evas *e, int direction, int z, unsigned int timestamp, const void *data) = dlsym(RTLD_NEXT, __func__); orig(e, direction, z, timestamp, data); }
EAPI void evas_event_feed_mouse_up(Evas *e, int b, Evas_Button_Flags flags, unsigned int timestamp, const void *data) { #ifdef DEBUG_TSUITE printf("Calling %s timestamp=<%u>\n", __func__, timestamp); #endif mouse_down_mouse_up t = { b, flags, timestamp, evas_list_find(e) }; int evt = tsuite_event_type_get(EVAS_CALLBACK_MOUSE_UP); if (t.n_evas >= 0) ADD_TO_LIST(evt, mouse_down_mouse_up, t); void (*orig) (Evas *e, int b, Evas_Button_Flags flags, unsigned int timestamp, const void *data) = dlsym(RTLD_NEXT, __func__); orig(e, b, flags, timestamp, data); }
EAPI void evas_event_feed_multi_move(Evas *e, int d, int x, int y, double rad, double radx, double rady, double pres, double ang, double fx, double fy, unsigned int timestamp, const void *data) { #ifdef DEBUG_TSUITE printf("Calling %s timestamp=<%u>\n", __func__, timestamp); #endif multi_move t = { d, x, y, rad, radx, rady, pres, ang, fx, fy, timestamp, evas_list_find(e) }; int evt = tsuite_event_type_get(EVAS_CALLBACK_MULTI_MOVE); if (t.n_evas >= 0) ADD_TO_LIST(evt, multi_move, t); void (*orig) (Evas *e, int d, int x, int y, double rad, double radx, double rady, double pres, double ang, double fx, double fy, unsigned int timestamp, const void *data) = dlsym(RTLD_NEXT, __func__); orig(e, d, x, y, rad, radx, rady, pres, ang, fx, fy, timestamp, data); }