Lines Matching defs:plug
267 static void uplug_callPlug(UPlugData *plug, UPlugReason reason, UErrorCode *status) {
269 if(plug==NULL||U_FAILURE(*status)) {
272 token = (*(plug->entrypoint))(plug, reason, status);
279 static void uplug_unloadPlug(UPlugData *plug, UErrorCode *status) {
280 if(plug->awaitingLoad) { /* shouldn't happen. Plugin hasn'tbeen loaded yet.*/
284 if(U_SUCCESS(plug->pluginStatus)) {
285 /* Don't unload a plug which has a failing load status - means it didn't actually load. */
286 uplug_callPlug(plug, UPLUG_REASON_UNLOAD, status);
290 static void uplug_queryPlug(UPlugData *plug, UErrorCode *status) {
291 if(!plug->awaitingLoad || !(plug->level == UPLUG_LEVEL_UNKNOWN) ) { /* shouldn't happen. Plugin hasn'tbeen loaded yet.*/
295 plug->level = UPLUG_LEVEL_INVALID;
296 uplug_callPlug(plug, UPLUG_REASON_QUERY, status);
298 if(plug->level == UPLUG_LEVEL_INVALID) {
299 plug->pluginStatus = U_PLUGIN_DIDNT_SET_LEVEL;
300 plug->awaitingLoad = FALSE;
303 plug->pluginStatus = U_INTERNAL_PROGRAM_ERROR;
304 plug->awaitingLoad = FALSE;
309 static void uplug_loadPlug(UPlugData *plug, UErrorCode *status) {
310 if(!plug->awaitingLoad || (plug->level < UPLUG_LEVEL_LOW) ) { /* shouldn't happen. Plugin hasn'tbeen loaded yet.*/
314 uplug_callPlug(plug, UPLUG_REASON_LOAD, status);
315 plug->awaitingLoad = FALSE;
317 plug->pluginStatus = U_INTERNAL_PROGRAM_ERROR;
323 UPlugData *plug = NULL;
334 plug = &pluginList[pluginCount++];
336 plug->token = UPLUG_TOKEN;
337 plug->structSize = sizeof(UPlugData);
338 plug->name[0]=0;
339 plug->level = UPLUG_LEVEL_UNKNOWN; /* initialize to null state */
340 plug->awaitingLoad = TRUE;
341 plug->dontUnload = FALSE;
342 plug->pluginStatus = U_ZERO_ERROR;
343 plug->libName[0] = 0;
344 plug->config[0]=0;
345 plug->sym[0]=0;
346 plug->lib=NULL;
347 plug->entrypoint=NULL;
350 return plug;
355 UPlugData *plug;
361 plug = uplug_allocateEmptyPlug(status);
363 uprv_strncpy(plug->config, config, UPLUG_NAME_MAX);
365 plug->config[0] = 0;
369 uprv_strncpy(plug->sym, symName, UPLUG_NAME_MAX);
371 plug->sym[0] = 0;
374 plug->entrypoint = entrypoint;
375 plug->lib = lib;
376 uplug_queryPlug(plug, status);
378 return plug;
381 static void uplug_deallocatePlug(UPlugData *plug, UErrorCode *status) {
383 if(!plug->dontUnload) {
385 uplug_closeLibrary(plug->lib, &subStatus);
388 plug->lib = NULL;
395 pluginCount = uplug_removeEntryAt(pluginList, pluginCount, sizeof(plug[0]), uplug_pluginNumber(plug));
398 plug->awaitingLoad=FALSE;
399 plug->entrypoint=0;
400 plug->dontUnload=TRUE;
412 uplug_removePlug(UPlugData *plug, UErrorCode *status) {
418 if(cursor==plug) {
419 plugToRemove = plug;
513 uplug_getPlugLoadStatus(UPlugData *plug) {
514 return plug->pluginStatus;
525 UPlugData *plug = NULL;
527 plug = uplug_allocatePlug(entrypoint, config, lib, sym, status);
530 return plug;
532 uplug_deallocatePlug(plug, status);
539 UPlugData* plug = uplug_initPlugFromEntrypointAndLibrary(entrypoint, config, NULL, NULL, status);
540 uplug_loadPlug(plug, status);
541 return plug;
549 UPlugData *plug = uplug_allocateEmptyPlug(status);
552 plug->pluginStatus = loadStatus;
553 plug->awaitingLoad = FALSE; /* Won't load. */
554 plug->dontUnload = TRUE; /* cannot unload. */
557 uprv_strncpy(plug->sym, sym, UPLUG_NAME_MAX);
561 uprv_strncpy(plug->libName, libName, UPLUG_NAME_MAX);
565 uprv_strncpy(plug->name, nameOrError, UPLUG_NAME_MAX);
569 uprv_strncpy(plug->config, config, UPLUG_NAME_MAX);
572 return plug;
581 UPlugData *plug = NULL;
589 plug = uplug_initPlugFromEntrypointAndLibrary(entrypoint, config, lib, sym, status);
590 if(plug!=NULL&&U_SUCCESS(*status)) {
591 plug->lib = lib; /* plug takes ownership of library */
596 plug = uplug_initErrorPlug(libName,sym,config,"ERROR: Could not load entrypoint",(lib==NULL)?U_MISSING_RESOURCE_ERROR:*status,&subStatus);
604 plug = uplug_initErrorPlug(libName,sym,config,"ERROR: could not load library",(lib==NULL)?U_MISSING_RESOURCE_ERROR:*status,&subStatus);
606 return plug;
611 UPlugData *plug = NULL;
613 plug = uplug_initPlugFromLibrary(libName, sym, config, status);
614 uplug_loadPlug(plug, status);
616 return plug;
848 UPlugData *plug = uplug_initPlugFromLibrary(libName, symName, config, &subStatus);
854 DBG((stderr, " -> %p, %s\n", (void*)plug, u_errorName(subStatus)));
856 (void)plug; /* unused */