| OLD | NEW |
| 1 /* | 1 /* |
| 2 ****************************************************************************** | 2 ****************************************************************************** |
| 3 * | 3 * |
| 4 * Copyright (C) 2009-2015, International Business Machines | 4 * Copyright (C) 2009-2015, International Business Machines |
| 5 * Corporation and others. All Rights Reserved. | 5 * Corporation and others. All Rights Reserved. |
| 6 * | 6 * |
| 7 ****************************************************************************** | 7 ****************************************************************************** |
| 8 * | 8 * |
| 9 * FILE NAME : icuplug.c | 9 * FILE NAME : icuplug.c |
| 10 * | 10 * |
| 11 * Date Name Description | 11 * Date Name Description |
| 12 * 10/29/2009 sl New. | 12 * 10/29/2009 sl New. |
| 13 ****************************************************************************** | 13 ****************************************************************************** |
| 14 */ | 14 */ |
| 15 | 15 |
| 16 #include "unicode/icuplug.h" | 16 #include "unicode/icuplug.h" |
| 17 |
| 18 |
| 19 #if UCONFIG_ENABLE_PLUGINS |
| 20 |
| 21 |
| 17 #include "icuplugimp.h" | 22 #include "icuplugimp.h" |
| 18 #include "cstring.h" | 23 #include "cstring.h" |
| 19 #include "cmemory.h" | 24 #include "cmemory.h" |
| 20 #include "putilimp.h" | 25 #include "putilimp.h" |
| 21 #include "ucln.h" | 26 #include "ucln.h" |
| 22 #include <stdio.h> | 27 #include <stdio.h> |
| 23 #ifdef __MVS__ /* defined by z/OS compiler */ | 28 #ifdef __MVS__ /* defined by z/OS compiler */ |
| 24 #define _POSIX_SOURCE | 29 #define _POSIX_SOURCE |
| 25 #include <cics.h> /* 12 Nov 2011 JAM iscics() function */ | 30 #include <cics.h> /* 12 Nov 2011 JAM iscics() function */ |
| 26 #endif | 31 #endif |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 plug->awaitingLoad = FALSE; | 305 plug->awaitingLoad = FALSE; |
| 301 } | 306 } |
| 302 } else { | 307 } else { |
| 303 plug->pluginStatus = U_INTERNAL_PROGRAM_ERROR; | 308 plug->pluginStatus = U_INTERNAL_PROGRAM_ERROR; |
| 304 plug->awaitingLoad = FALSE; | 309 plug->awaitingLoad = FALSE; |
| 305 } | 310 } |
| 306 } | 311 } |
| 307 | 312 |
| 308 | 313 |
| 309 static void uplug_loadPlug(UPlugData *plug, UErrorCode *status) { | 314 static void uplug_loadPlug(UPlugData *plug, UErrorCode *status) { |
| 315 if(U_FAILURE(*status)) { |
| 316 return; |
| 317 } |
| 310 if(!plug->awaitingLoad || (plug->level < UPLUG_LEVEL_LOW) ) { /* shouldn't ha
ppen. Plugin hasn'tbeen loaded yet.*/ | 318 if(!plug->awaitingLoad || (plug->level < UPLUG_LEVEL_LOW) ) { /* shouldn't ha
ppen. Plugin hasn'tbeen loaded yet.*/ |
| 311 *status = U_INTERNAL_PROGRAM_ERROR; | 319 *status = U_INTERNAL_PROGRAM_ERROR; |
| 312 return; | 320 return; |
| 313 } | 321 } |
| 314 uplug_callPlug(plug, UPLUG_REASON_LOAD, status); | 322 uplug_callPlug(plug, UPLUG_REASON_LOAD, status); |
| 315 plug->awaitingLoad = FALSE; | 323 plug->awaitingLoad = FALSE; |
| 316 if(!U_SUCCESS(*status)) { | 324 if(!U_SUCCESS(*status)) { |
| 317 plug->pluginStatus = U_INTERNAL_PROGRAM_ERROR; | 325 plug->pluginStatus = U_INTERNAL_PROGRAM_ERROR; |
| 318 } | 326 } |
| 319 } | 327 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 345 plug->sym[0]=0; | 353 plug->sym[0]=0; |
| 346 plug->lib=NULL; | 354 plug->lib=NULL; |
| 347 plug->entrypoint=NULL; | 355 plug->entrypoint=NULL; |
| 348 | 356 |
| 349 | 357 |
| 350 return plug; | 358 return plug; |
| 351 } | 359 } |
| 352 | 360 |
| 353 static UPlugData *uplug_allocatePlug(UPlugEntrypoint *entrypoint, const char *co
nfig, void *lib, const char *symName, | 361 static UPlugData *uplug_allocatePlug(UPlugEntrypoint *entrypoint, const char *co
nfig, void *lib, const char *symName, |
| 354 UErrorCode *status) { | 362 UErrorCode *status) { |
| 355 UPlugData *plug; | 363 UPlugData *plug = uplug_allocateEmptyPlug(status); |
| 356 | |
| 357 if(U_FAILURE(*status)) { | 364 if(U_FAILURE(*status)) { |
| 358 return NULL; | 365 return NULL; |
| 359 } | 366 } |
| 360 | 367 |
| 361 plug = uplug_allocateEmptyPlug(status); | |
| 362 if(config!=NULL) { | 368 if(config!=NULL) { |
| 363 uprv_strncpy(plug->config, config, UPLUG_NAME_MAX); | 369 uprv_strncpy(plug->config, config, UPLUG_NAME_MAX); |
| 364 } else { | 370 } else { |
| 365 plug->config[0] = 0; | 371 plug->config[0] = 0; |
| 366 } | 372 } |
| 367 | 373 |
| 368 if(symName!=NULL) { | 374 if(symName!=NULL) { |
| 369 uprv_strncpy(plug->sym, symName, UPLUG_NAME_MAX); | 375 uprv_strncpy(plug->sym, symName, UPLUG_NAME_MAX); |
| 370 } else { | 376 } else { |
| 371 plug->sym[0] = 0; | 377 plug->sym[0] = 0; |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 #if UPLUG_TRACE | 869 #if UPLUG_TRACE |
| 864 DBG((stderr, "Can't open plugin file %s\n", plugin_file)); | 870 DBG((stderr, "Can't open plugin file %s\n", plugin_file)); |
| 865 #endif | 871 #endif |
| 866 } | 872 } |
| 867 } | 873 } |
| 868 uplug_loadWaitingPlugs(status); | 874 uplug_loadWaitingPlugs(status); |
| 869 #endif /* U_ENABLE_DYLOAD */ | 875 #endif /* U_ENABLE_DYLOAD */ |
| 870 gCurrentLevel = UPLUG_LEVEL_HIGH; | 876 gCurrentLevel = UPLUG_LEVEL_HIGH; |
| 871 ucln_registerCleanup(UCLN_UPLUG, uplug_cleanup); | 877 ucln_registerCleanup(UCLN_UPLUG, uplug_cleanup); |
| 872 } | 878 } |
| 879 |
| 880 #endif |
| 881 |
| 882 |
| OLD | NEW |