xref: /aosp_15_r20/external/icu/libicu/cts_headers/unicode/icuplug.h (revision 0e209d3975ff4a8c132096b14b0e9364a753506e)
1*0e209d39SAndroid Build Coastguard Worker // © 2016 and later: Unicode, Inc. and others.
2*0e209d39SAndroid Build Coastguard Worker // License & terms of use: http://www.unicode.org/copyright.html
3*0e209d39SAndroid Build Coastguard Worker /*
4*0e209d39SAndroid Build Coastguard Worker ******************************************************************************
5*0e209d39SAndroid Build Coastguard Worker *
6*0e209d39SAndroid Build Coastguard Worker *   Copyright (C) 2009-2015, International Business Machines
7*0e209d39SAndroid Build Coastguard Worker *   Corporation and others.  All Rights Reserved.
8*0e209d39SAndroid Build Coastguard Worker *
9*0e209d39SAndroid Build Coastguard Worker ******************************************************************************
10*0e209d39SAndroid Build Coastguard Worker *
11*0e209d39SAndroid Build Coastguard Worker *  FILE NAME : icuplug.h
12*0e209d39SAndroid Build Coastguard Worker *
13*0e209d39SAndroid Build Coastguard Worker *   Date         Name        Description
14*0e209d39SAndroid Build Coastguard Worker *   10/29/2009   sl          New.
15*0e209d39SAndroid Build Coastguard Worker ******************************************************************************
16*0e209d39SAndroid Build Coastguard Worker */
17*0e209d39SAndroid Build Coastguard Worker 
18*0e209d39SAndroid Build Coastguard Worker /**
19*0e209d39SAndroid Build Coastguard Worker  * \file
20*0e209d39SAndroid Build Coastguard Worker  * \brief C API: ICU Plugin API
21*0e209d39SAndroid Build Coastguard Worker  *
22*0e209d39SAndroid Build Coastguard Worker  * <h2>C API: ICU Plugin API</h2>
23*0e209d39SAndroid Build Coastguard Worker  *
24*0e209d39SAndroid Build Coastguard Worker  * <p>C API allowing run-time loadable modules that extend or modify ICU functionality.</p>
25*0e209d39SAndroid Build Coastguard Worker  *
26*0e209d39SAndroid Build Coastguard Worker  * <h3>Loading and Configuration</h3>
27*0e209d39SAndroid Build Coastguard Worker  *
28*0e209d39SAndroid Build Coastguard Worker  * <p>At ICU startup time, the environment variable "ICU_PLUGINS" will be
29*0e209d39SAndroid Build Coastguard Worker  * queried for a directory name.  If it is not set, the preprocessor symbol
30*0e209d39SAndroid Build Coastguard Worker  * "DEFAULT_ICU_PLUGINS" will be checked for a default value.</p>
31*0e209d39SAndroid Build Coastguard Worker  *
32*0e209d39SAndroid Build Coastguard Worker  * <p>Within the above-named directory, the file  "icuplugins##.txt" will be
33*0e209d39SAndroid Build Coastguard Worker  * opened, if present, where ## is the major+minor number of the currently
34*0e209d39SAndroid Build Coastguard Worker  * running ICU (such as, 44 for ICU 4.4, thus icuplugins44.txt)</p>
35*0e209d39SAndroid Build Coastguard Worker  *
36*0e209d39SAndroid Build Coastguard Worker  * <p>The configuration file has this format:</p>
37*0e209d39SAndroid Build Coastguard Worker  *
38*0e209d39SAndroid Build Coastguard Worker  * <ul>
39*0e209d39SAndroid Build Coastguard Worker  * <li>Hash (#) begins a comment line</li>
40*0e209d39SAndroid Build Coastguard Worker  *
41*0e209d39SAndroid Build Coastguard Worker  * <li>Non-comment lines have two or three components:
42*0e209d39SAndroid Build Coastguard Worker  * LIBRARYNAME     ENTRYPOINT     [ CONFIGURATION .. ]</li>
43*0e209d39SAndroid Build Coastguard Worker  *
44*0e209d39SAndroid Build Coastguard Worker  * <li>Tabs or spaces separate the three items.</li>
45*0e209d39SAndroid Build Coastguard Worker  *
46*0e209d39SAndroid Build Coastguard Worker  * <li>LIBRARYNAME is the name of a shared library, either a short name if
47*0e209d39SAndroid Build Coastguard Worker  * it is on the loader path,  or a full pathname.</li>
48*0e209d39SAndroid Build Coastguard Worker  *
49*0e209d39SAndroid Build Coastguard Worker  * <li>ENTRYPOINT is the short (undecorated) symbol name of the plugin's
50*0e209d39SAndroid Build Coastguard Worker  * entrypoint, as above.</li>
51*0e209d39SAndroid Build Coastguard Worker  *
52*0e209d39SAndroid Build Coastguard Worker  * <li>CONFIGURATION is the entire rest of the line . It's passed as-is to
53*0e209d39SAndroid Build Coastguard Worker  * the plugin.</li>
54*0e209d39SAndroid Build Coastguard Worker  * </ul>
55*0e209d39SAndroid Build Coastguard Worker  *
56*0e209d39SAndroid Build Coastguard Worker  * <p>An example configuration file is, in its entirety:</p>
57*0e209d39SAndroid Build Coastguard Worker  *
58*0e209d39SAndroid Build Coastguard Worker  * \code
59*0e209d39SAndroid Build Coastguard Worker  * # this is icuplugins44.txt
60*0e209d39SAndroid Build Coastguard Worker  * testplug.dll    myPlugin        hello=world
61*0e209d39SAndroid Build Coastguard Worker  * \endcode
62*0e209d39SAndroid Build Coastguard Worker  * <p>Plugins are categorized as "high" or "low" level.  Low level are those
63*0e209d39SAndroid Build Coastguard Worker  * which must be run BEFORE high level plugins, and before any operations
64*0e209d39SAndroid Build Coastguard Worker  * which cause ICU to be 'initialized'.  If a plugin is low level but
65*0e209d39SAndroid Build Coastguard Worker  * causes ICU to allocate memory or become initialized, that plugin is said
66*0e209d39SAndroid Build Coastguard Worker  * to cause a 'level change'. </p>
67*0e209d39SAndroid Build Coastguard Worker  *
68*0e209d39SAndroid Build Coastguard Worker  * <p>At load time, ICU first queries all plugins to determine their level,
69*0e209d39SAndroid Build Coastguard Worker  * then loads all 'low' plugins first, and then loads all 'high' plugins.
70*0e209d39SAndroid Build Coastguard Worker  * Plugins are otherwise loaded in the order listed in the configuration file.</p>
71*0e209d39SAndroid Build Coastguard Worker  *
72*0e209d39SAndroid Build Coastguard Worker  * <h3>Implementing a Plugin</h3>
73*0e209d39SAndroid Build Coastguard Worker  * \code
74*0e209d39SAndroid Build Coastguard Worker  * U_CAPI UPlugTokenReturn U_EXPORT2
75*0e209d39SAndroid Build Coastguard Worker  * myPlugin (UPlugData *plug, UPlugReason reason, UErrorCode *status) {
76*0e209d39SAndroid Build Coastguard Worker  *   if(reason==UPLUG_REASON_QUERY) {
77*0e209d39SAndroid Build Coastguard Worker  *      uplug_setPlugName(plug, "Simple Plugin");
78*0e209d39SAndroid Build Coastguard Worker  *      uplug_setPlugLevel(plug, UPLUG_LEVEL_HIGH);
79*0e209d39SAndroid Build Coastguard Worker  *    } else if(reason==UPLUG_REASON_LOAD) {
80*0e209d39SAndroid Build Coastguard Worker  *       ... Set up some ICU things here....
81*0e209d39SAndroid Build Coastguard Worker  *    } else if(reason==UPLUG_REASON_UNLOAD) {
82*0e209d39SAndroid Build Coastguard Worker  *       ... unload, clean up ...
83*0e209d39SAndroid Build Coastguard Worker  *    }
84*0e209d39SAndroid Build Coastguard Worker  *   return UPLUG_TOKEN;
85*0e209d39SAndroid Build Coastguard Worker  *  }
86*0e209d39SAndroid Build Coastguard Worker  * \endcode
87*0e209d39SAndroid Build Coastguard Worker  *
88*0e209d39SAndroid Build Coastguard Worker  * <p>The UPlugData*  is an opaque pointer to the plugin-specific data, and is
89*0e209d39SAndroid Build Coastguard Worker  * used in all other API calls.</p>
90*0e209d39SAndroid Build Coastguard Worker  *
91*0e209d39SAndroid Build Coastguard Worker  * <p>The API contract is:</p>
92*0e209d39SAndroid Build Coastguard Worker  * <ol><li>The plugin MUST always return UPLUG_TOKEN as a return value- to
93*0e209d39SAndroid Build Coastguard Worker  * indicate that it is a valid plugin.</li>
94*0e209d39SAndroid Build Coastguard Worker  *
95*0e209d39SAndroid Build Coastguard Worker  * <li>When the 'reason' parameter is set to UPLUG_REASON_QUERY,  the
96*0e209d39SAndroid Build Coastguard Worker  * plugin MUST call uplug_setPlugLevel() to indicate whether it is a high
97*0e209d39SAndroid Build Coastguard Worker  * level or low level plugin.</li>
98*0e209d39SAndroid Build Coastguard Worker  *
99*0e209d39SAndroid Build Coastguard Worker  * <li>When the 'reason' parameter is UPLUG_REASON_QUERY, the plugin
100*0e209d39SAndroid Build Coastguard Worker  * SHOULD call uplug_setPlugName to indicate a human readable plugin name.</li></ol>
101*0e209d39SAndroid Build Coastguard Worker  *
102*0e209d39SAndroid Build Coastguard Worker  *
103*0e209d39SAndroid Build Coastguard Worker  * \internal ICU 4.4 Technology Preview
104*0e209d39SAndroid Build Coastguard Worker  */
105*0e209d39SAndroid Build Coastguard Worker 
106*0e209d39SAndroid Build Coastguard Worker 
107*0e209d39SAndroid Build Coastguard Worker #ifndef ICUPLUG_H
108*0e209d39SAndroid Build Coastguard Worker #define ICUPLUG_H
109*0e209d39SAndroid Build Coastguard Worker 
110*0e209d39SAndroid Build Coastguard Worker #include "unicode/utypes.h"
111*0e209d39SAndroid Build Coastguard Worker 
112*0e209d39SAndroid Build Coastguard Worker 
113*0e209d39SAndroid Build Coastguard Worker #if UCONFIG_ENABLE_PLUGINS || defined(U_IN_DOXYGEN)
114*0e209d39SAndroid Build Coastguard Worker 
115*0e209d39SAndroid Build Coastguard Worker 
116*0e209d39SAndroid Build Coastguard Worker 
117*0e209d39SAndroid Build Coastguard Worker /* === Basic types === */
118*0e209d39SAndroid Build Coastguard Worker 
119*0e209d39SAndroid Build Coastguard Worker #ifndef U_HIDE_INTERNAL_API
120*0e209d39SAndroid Build Coastguard Worker struct UPlugData;
121*0e209d39SAndroid Build Coastguard Worker /**
122*0e209d39SAndroid Build Coastguard Worker  * @{
123*0e209d39SAndroid Build Coastguard Worker  * Typedef for opaque structure passed to/from a plugin.
124*0e209d39SAndroid Build Coastguard Worker  * Use the APIs to access it.
125*0e209d39SAndroid Build Coastguard Worker  * @internal ICU 4.4 Technology Preview
126*0e209d39SAndroid Build Coastguard Worker  */
127*0e209d39SAndroid Build Coastguard Worker typedef struct UPlugData UPlugData;
128*0e209d39SAndroid Build Coastguard Worker 
129*0e209d39SAndroid Build Coastguard Worker /** @} */
130*0e209d39SAndroid Build Coastguard Worker 
131*0e209d39SAndroid Build Coastguard Worker /**
132*0e209d39SAndroid Build Coastguard Worker  * Random Token to identify a valid ICU plugin. Plugins must return this
133*0e209d39SAndroid Build Coastguard Worker  * from the entrypoint.
134*0e209d39SAndroid Build Coastguard Worker  * @internal ICU 4.4 Technology Preview
135*0e209d39SAndroid Build Coastguard Worker  */
136*0e209d39SAndroid Build Coastguard Worker #define UPLUG_TOKEN 0x54762486
137*0e209d39SAndroid Build Coastguard Worker 
138*0e209d39SAndroid Build Coastguard Worker /**
139*0e209d39SAndroid Build Coastguard Worker  * Max width of names, symbols, and configuration strings
140*0e209d39SAndroid Build Coastguard Worker  * @internal ICU 4.4 Technology Preview
141*0e209d39SAndroid Build Coastguard Worker  */
142*0e209d39SAndroid Build Coastguard Worker #define UPLUG_NAME_MAX              100
143*0e209d39SAndroid Build Coastguard Worker 
144*0e209d39SAndroid Build Coastguard Worker 
145*0e209d39SAndroid Build Coastguard Worker /**
146*0e209d39SAndroid Build Coastguard Worker  * Return value from a plugin entrypoint.
147*0e209d39SAndroid Build Coastguard Worker  * Must always be set to UPLUG_TOKEN
148*0e209d39SAndroid Build Coastguard Worker  * @see UPLUG_TOKEN
149*0e209d39SAndroid Build Coastguard Worker  * @internal ICU 4.4 Technology Preview
150*0e209d39SAndroid Build Coastguard Worker  */
151*0e209d39SAndroid Build Coastguard Worker typedef uint32_t UPlugTokenReturn;
152*0e209d39SAndroid Build Coastguard Worker 
153*0e209d39SAndroid Build Coastguard Worker /**
154*0e209d39SAndroid Build Coastguard Worker  * Reason code for the entrypoint's call
155*0e209d39SAndroid Build Coastguard Worker  * @internal ICU 4.4 Technology Preview
156*0e209d39SAndroid Build Coastguard Worker  */
157*0e209d39SAndroid Build Coastguard Worker typedef enum {
158*0e209d39SAndroid Build Coastguard Worker     UPLUG_REASON_QUERY = 0,     /**< The plugin is being queried for info. **/
159*0e209d39SAndroid Build Coastguard Worker     UPLUG_REASON_LOAD = 1,     /**< The plugin is being loaded. **/
160*0e209d39SAndroid Build Coastguard Worker     UPLUG_REASON_UNLOAD = 2,   /**< The plugin is being unloaded. **/
161*0e209d39SAndroid Build Coastguard Worker     /**
162*0e209d39SAndroid Build Coastguard Worker      * Number of known reasons.
163*0e209d39SAndroid Build Coastguard Worker      * @internal The numeric value may change over time, see ICU ticket #12420.
164*0e209d39SAndroid Build Coastguard Worker      */
165*0e209d39SAndroid Build Coastguard Worker     UPLUG_REASON_COUNT
166*0e209d39SAndroid Build Coastguard Worker } UPlugReason;
167*0e209d39SAndroid Build Coastguard Worker 
168*0e209d39SAndroid Build Coastguard Worker 
169*0e209d39SAndroid Build Coastguard Worker /**
170*0e209d39SAndroid Build Coastguard Worker  * Level of plugin loading
171*0e209d39SAndroid Build Coastguard Worker  *     INITIAL:  UNKNOWN
172*0e209d39SAndroid Build Coastguard Worker  *       QUERY:   INVALID ->  { LOW | HIGH }
173*0e209d39SAndroid Build Coastguard Worker  *     ERR -> INVALID
174*0e209d39SAndroid Build Coastguard Worker  * @internal ICU 4.4 Technology Preview
175*0e209d39SAndroid Build Coastguard Worker  */
176*0e209d39SAndroid Build Coastguard Worker typedef enum {
177*0e209d39SAndroid Build Coastguard Worker     UPLUG_LEVEL_INVALID = 0,     /**< The plugin is invalid, hasn't called uplug_setLevel, or can't load. **/
178*0e209d39SAndroid Build Coastguard Worker     UPLUG_LEVEL_UNKNOWN = 1,     /**< The plugin is waiting to be installed. **/
179*0e209d39SAndroid Build Coastguard Worker     UPLUG_LEVEL_LOW     = 2,     /**< The plugin must be called before u_init completes **/
180*0e209d39SAndroid Build Coastguard Worker     UPLUG_LEVEL_HIGH    = 3,     /**< The plugin can run at any time. **/
181*0e209d39SAndroid Build Coastguard Worker     /**
182*0e209d39SAndroid Build Coastguard Worker      * Number of known levels.
183*0e209d39SAndroid Build Coastguard Worker      * @internal The numeric value may change over time, see ICU ticket #12420.
184*0e209d39SAndroid Build Coastguard Worker      */
185*0e209d39SAndroid Build Coastguard Worker     UPLUG_LEVEL_COUNT
186*0e209d39SAndroid Build Coastguard Worker } UPlugLevel;
187*0e209d39SAndroid Build Coastguard Worker 
188*0e209d39SAndroid Build Coastguard Worker /**
189*0e209d39SAndroid Build Coastguard Worker  * Entrypoint for an ICU plugin.
190*0e209d39SAndroid Build Coastguard Worker  * @param plug the UPlugData handle.
191*0e209d39SAndroid Build Coastguard Worker  * @param reason the reason code for the entrypoint's call.
192*0e209d39SAndroid Build Coastguard Worker  * @param status Standard ICU error code. Its input value must
193*0e209d39SAndroid Build Coastguard Worker  *               pass the U_SUCCESS() test, or else the function returns
194*0e209d39SAndroid Build Coastguard Worker  *               immediately. Check for U_FAILURE() on output or use with
195*0e209d39SAndroid Build Coastguard Worker  *               function chaining. (See User Guide for details.)
196*0e209d39SAndroid Build Coastguard Worker  * @return A valid plugin must return UPLUG_TOKEN
197*0e209d39SAndroid Build Coastguard Worker  * @internal ICU 4.4 Technology Preview
198*0e209d39SAndroid Build Coastguard Worker  */
199*0e209d39SAndroid Build Coastguard Worker typedef UPlugTokenReturn (U_EXPORT2 UPlugEntrypoint) (
200*0e209d39SAndroid Build Coastguard Worker                   UPlugData *plug,
201*0e209d39SAndroid Build Coastguard Worker                   UPlugReason reason,
202*0e209d39SAndroid Build Coastguard Worker                   UErrorCode *status);
203*0e209d39SAndroid Build Coastguard Worker 
204*0e209d39SAndroid Build Coastguard Worker /* === Needed for Implementing === */
205*0e209d39SAndroid Build Coastguard Worker 
206*0e209d39SAndroid Build Coastguard Worker /**
207*0e209d39SAndroid Build Coastguard Worker  * Request that this plugin not be unloaded at cleanup time.
208*0e209d39SAndroid Build Coastguard Worker  * This is appropriate for plugins which cannot be cleaned up.
209*0e209d39SAndroid Build Coastguard Worker  * @see u_cleanup()
210*0e209d39SAndroid Build Coastguard Worker  * @param plug plugin
211*0e209d39SAndroid Build Coastguard Worker  * @param dontUnload  set true if this plugin can't be unloaded
212*0e209d39SAndroid Build Coastguard Worker  * @internal ICU 4.4 Technology Preview
213*0e209d39SAndroid Build Coastguard Worker  */
214*0e209d39SAndroid Build Coastguard Worker U_CAPI void U_EXPORT2
215*0e209d39SAndroid Build Coastguard Worker uplug_setPlugNoUnload(UPlugData *plug, UBool dontUnload);
216*0e209d39SAndroid Build Coastguard Worker 
217*0e209d39SAndroid Build Coastguard Worker /**
218*0e209d39SAndroid Build Coastguard Worker  * Set the level of this plugin.
219*0e209d39SAndroid Build Coastguard Worker  * @param plug plugin data handle
220*0e209d39SAndroid Build Coastguard Worker  * @param level the level of this plugin
221*0e209d39SAndroid Build Coastguard Worker  * @internal ICU 4.4 Technology Preview
222*0e209d39SAndroid Build Coastguard Worker  */
223*0e209d39SAndroid Build Coastguard Worker U_CAPI void U_EXPORT2
224*0e209d39SAndroid Build Coastguard Worker uplug_setPlugLevel(UPlugData *plug, UPlugLevel level);
225*0e209d39SAndroid Build Coastguard Worker 
226*0e209d39SAndroid Build Coastguard Worker /**
227*0e209d39SAndroid Build Coastguard Worker  * Get the level of this plugin.
228*0e209d39SAndroid Build Coastguard Worker  * @param plug plugin data handle
229*0e209d39SAndroid Build Coastguard Worker  * @return the level of this plugin
230*0e209d39SAndroid Build Coastguard Worker  * @internal ICU 4.4 Technology Preview
231*0e209d39SAndroid Build Coastguard Worker  */
232*0e209d39SAndroid Build Coastguard Worker U_CAPI UPlugLevel U_EXPORT2
233*0e209d39SAndroid Build Coastguard Worker uplug_getPlugLevel(UPlugData *plug);
234*0e209d39SAndroid Build Coastguard Worker 
235*0e209d39SAndroid Build Coastguard Worker /**
236*0e209d39SAndroid Build Coastguard Worker  * Get the lowest level of plug which can currently load.
237*0e209d39SAndroid Build Coastguard Worker  * For example, if UPLUG_LEVEL_LOW is returned, then low level plugins may load
238*0e209d39SAndroid Build Coastguard Worker  * if UPLUG_LEVEL_HIGH is returned, then only high level plugins may load.
239*0e209d39SAndroid Build Coastguard Worker  * @return the lowest level of plug which can currently load
240*0e209d39SAndroid Build Coastguard Worker  * @internal ICU 4.4 Technology Preview
241*0e209d39SAndroid Build Coastguard Worker  */
242*0e209d39SAndroid Build Coastguard Worker U_CAPI UPlugLevel U_EXPORT2
243*0e209d39SAndroid Build Coastguard Worker uplug_getCurrentLevel(void);
244*0e209d39SAndroid Build Coastguard Worker 
245*0e209d39SAndroid Build Coastguard Worker 
246*0e209d39SAndroid Build Coastguard Worker /**
247*0e209d39SAndroid Build Coastguard Worker  * Get plug load status
248*0e209d39SAndroid Build Coastguard Worker  * @return The error code of this plugin's load attempt.
249*0e209d39SAndroid Build Coastguard Worker  * @internal ICU 4.4 Technology Preview
250*0e209d39SAndroid Build Coastguard Worker  */
251*0e209d39SAndroid Build Coastguard Worker U_CAPI UErrorCode U_EXPORT2
252*0e209d39SAndroid Build Coastguard Worker uplug_getPlugLoadStatus(UPlugData *plug);
253*0e209d39SAndroid Build Coastguard Worker 
254*0e209d39SAndroid Build Coastguard Worker /**
255*0e209d39SAndroid Build Coastguard Worker  * Set the human-readable name of this plugin.
256*0e209d39SAndroid Build Coastguard Worker  * @param plug plugin data handle
257*0e209d39SAndroid Build Coastguard Worker  * @param name the name of this plugin. The first UPLUG_NAME_MAX characters willi be copied into a new buffer.
258*0e209d39SAndroid Build Coastguard Worker  * @internal ICU 4.4 Technology Preview
259*0e209d39SAndroid Build Coastguard Worker  */
260*0e209d39SAndroid Build Coastguard Worker U_CAPI void U_EXPORT2
261*0e209d39SAndroid Build Coastguard Worker uplug_setPlugName(UPlugData *plug, const char *name);
262*0e209d39SAndroid Build Coastguard Worker 
263*0e209d39SAndroid Build Coastguard Worker /**
264*0e209d39SAndroid Build Coastguard Worker  * Get the human-readable name of this plugin.
265*0e209d39SAndroid Build Coastguard Worker  * @param plug plugin data handle
266*0e209d39SAndroid Build Coastguard Worker  * @return the name of this plugin
267*0e209d39SAndroid Build Coastguard Worker  * @internal ICU 4.4 Technology Preview
268*0e209d39SAndroid Build Coastguard Worker  */
269*0e209d39SAndroid Build Coastguard Worker U_CAPI const char * U_EXPORT2
270*0e209d39SAndroid Build Coastguard Worker uplug_getPlugName(UPlugData *plug);
271*0e209d39SAndroid Build Coastguard Worker 
272*0e209d39SAndroid Build Coastguard Worker /**
273*0e209d39SAndroid Build Coastguard Worker  * Return the symbol name for this plugin, if known.
274*0e209d39SAndroid Build Coastguard Worker  * @param plug plugin data handle
275*0e209d39SAndroid Build Coastguard Worker  * @return the symbol name, or NULL
276*0e209d39SAndroid Build Coastguard Worker  * @internal ICU 4.4 Technology Preview
277*0e209d39SAndroid Build Coastguard Worker  */
278*0e209d39SAndroid Build Coastguard Worker U_CAPI const char * U_EXPORT2
279*0e209d39SAndroid Build Coastguard Worker uplug_getSymbolName(UPlugData *plug);
280*0e209d39SAndroid Build Coastguard Worker 
281*0e209d39SAndroid Build Coastguard Worker /**
282*0e209d39SAndroid Build Coastguard Worker  * Return the library name for this plugin, if known.
283*0e209d39SAndroid Build Coastguard Worker  * @param plug plugin data handle
284*0e209d39SAndroid Build Coastguard Worker  * @param status error code
285*0e209d39SAndroid Build Coastguard Worker  * @return the library name, or NULL
286*0e209d39SAndroid Build Coastguard Worker  * @internal ICU 4.4 Technology Preview
287*0e209d39SAndroid Build Coastguard Worker  */
288*0e209d39SAndroid Build Coastguard Worker U_CAPI const char * U_EXPORT2
289*0e209d39SAndroid Build Coastguard Worker uplug_getLibraryName(UPlugData *plug, UErrorCode *status);
290*0e209d39SAndroid Build Coastguard Worker 
291*0e209d39SAndroid Build Coastguard Worker /**
292*0e209d39SAndroid Build Coastguard Worker  * Return the library used for this plugin, if known.
293*0e209d39SAndroid Build Coastguard Worker  * Plugins could use this to load data out of their
294*0e209d39SAndroid Build Coastguard Worker  * @param plug plugin data handle
295*0e209d39SAndroid Build Coastguard Worker  * @return the library, or NULL
296*0e209d39SAndroid Build Coastguard Worker  * @internal ICU 4.4 Technology Preview
297*0e209d39SAndroid Build Coastguard Worker  */
298*0e209d39SAndroid Build Coastguard Worker U_CAPI void * U_EXPORT2
299*0e209d39SAndroid Build Coastguard Worker uplug_getLibrary(UPlugData *plug);
300*0e209d39SAndroid Build Coastguard Worker 
301*0e209d39SAndroid Build Coastguard Worker /**
302*0e209d39SAndroid Build Coastguard Worker  * Return the plugin-specific context data.
303*0e209d39SAndroid Build Coastguard Worker  * @param plug plugin data handle
304*0e209d39SAndroid Build Coastguard Worker  * @return the context, or NULL if not set
305*0e209d39SAndroid Build Coastguard Worker  * @internal ICU 4.4 Technology Preview
306*0e209d39SAndroid Build Coastguard Worker  */
307*0e209d39SAndroid Build Coastguard Worker U_CAPI void * U_EXPORT2
308*0e209d39SAndroid Build Coastguard Worker uplug_getContext(UPlugData *plug);
309*0e209d39SAndroid Build Coastguard Worker 
310*0e209d39SAndroid Build Coastguard Worker /**
311*0e209d39SAndroid Build Coastguard Worker  * Set the plugin-specific context data.
312*0e209d39SAndroid Build Coastguard Worker  * @param plug plugin data handle
313*0e209d39SAndroid Build Coastguard Worker  * @param context new context to set
314*0e209d39SAndroid Build Coastguard Worker  * @internal ICU 4.4 Technology Preview
315*0e209d39SAndroid Build Coastguard Worker  */
316*0e209d39SAndroid Build Coastguard Worker U_CAPI void U_EXPORT2
317*0e209d39SAndroid Build Coastguard Worker uplug_setContext(UPlugData *plug, void *context);
318*0e209d39SAndroid Build Coastguard Worker 
319*0e209d39SAndroid Build Coastguard Worker 
320*0e209d39SAndroid Build Coastguard Worker /**
321*0e209d39SAndroid Build Coastguard Worker  * Get the configuration string, if available.
322*0e209d39SAndroid Build Coastguard Worker  * The string is in the platform default codepage.
323*0e209d39SAndroid Build Coastguard Worker  * @param plug plugin data handle
324*0e209d39SAndroid Build Coastguard Worker  * @return configuration string, or else null.
325*0e209d39SAndroid Build Coastguard Worker  * @internal ICU 4.4 Technology Preview
326*0e209d39SAndroid Build Coastguard Worker  */
327*0e209d39SAndroid Build Coastguard Worker U_CAPI const char * U_EXPORT2
328*0e209d39SAndroid Build Coastguard Worker uplug_getConfiguration(UPlugData *plug);
329*0e209d39SAndroid Build Coastguard Worker 
330*0e209d39SAndroid Build Coastguard Worker /**
331*0e209d39SAndroid Build Coastguard Worker  * Return all currently installed plugins, from newest to oldest
332*0e209d39SAndroid Build Coastguard Worker  * Usage Example:
333*0e209d39SAndroid Build Coastguard Worker  * \code
334*0e209d39SAndroid Build Coastguard Worker  *    UPlugData *plug = NULL;
335*0e209d39SAndroid Build Coastguard Worker  *    while(plug=uplug_nextPlug(plug)) {
336*0e209d39SAndroid Build Coastguard Worker  *        ... do something with 'plug' ...
337*0e209d39SAndroid Build Coastguard Worker  *    }
338*0e209d39SAndroid Build Coastguard Worker  * \endcode
339*0e209d39SAndroid Build Coastguard Worker  * Not thread safe- do not call while plugs are added or removed.
340*0e209d39SAndroid Build Coastguard Worker  * @param prior pass in 'NULL' to get the first (most recent) plug,
341*0e209d39SAndroid Build Coastguard Worker  *  otherwise pass the value returned on a prior call to uplug_nextPlug
342*0e209d39SAndroid Build Coastguard Worker  * @return the next oldest plugin, or NULL if no more.
343*0e209d39SAndroid Build Coastguard Worker  * @internal ICU 4.4 Technology Preview
344*0e209d39SAndroid Build Coastguard Worker  */
345*0e209d39SAndroid Build Coastguard Worker U_CAPI UPlugData* U_EXPORT2
346*0e209d39SAndroid Build Coastguard Worker uplug_nextPlug(UPlugData *prior);
347*0e209d39SAndroid Build Coastguard Worker 
348*0e209d39SAndroid Build Coastguard Worker /**
349*0e209d39SAndroid Build Coastguard Worker  * Inject a plugin as if it were loaded from a library.
350*0e209d39SAndroid Build Coastguard Worker  * This is useful for testing plugins.
351*0e209d39SAndroid Build Coastguard Worker  * Note that it will have a 'NULL' library pointer associated
352*0e209d39SAndroid Build Coastguard Worker  * with it, and therefore no llibrary will be closed at cleanup time.
353*0e209d39SAndroid Build Coastguard Worker  * Low level plugins may not be able to load, as ordering can't be enforced.
354*0e209d39SAndroid Build Coastguard Worker  * @param entrypoint entrypoint to install
355*0e209d39SAndroid Build Coastguard Worker  * @param config user specified configuration string, if available, or NULL.
356*0e209d39SAndroid Build Coastguard Worker  * @param status error result
357*0e209d39SAndroid Build Coastguard Worker  * @return the new UPlugData associated with this plugin, or NULL if error.
358*0e209d39SAndroid Build Coastguard Worker  * @internal ICU 4.4 Technology Preview
359*0e209d39SAndroid Build Coastguard Worker  */
360*0e209d39SAndroid Build Coastguard Worker U_CAPI UPlugData* U_EXPORT2
361*0e209d39SAndroid Build Coastguard Worker uplug_loadPlugFromEntrypoint(UPlugEntrypoint *entrypoint, const char *config, UErrorCode *status);
362*0e209d39SAndroid Build Coastguard Worker 
363*0e209d39SAndroid Build Coastguard Worker 
364*0e209d39SAndroid Build Coastguard Worker /**
365*0e209d39SAndroid Build Coastguard Worker  * Inject a plugin from a library, as if the information came from a config file.
366*0e209d39SAndroid Build Coastguard Worker  * Low level plugins may not be able to load, and ordering can't be enforced.
367*0e209d39SAndroid Build Coastguard Worker  * @param libName DLL name to load
368*0e209d39SAndroid Build Coastguard Worker  * @param sym symbol of plugin (UPlugEntrypoint function)
369*0e209d39SAndroid Build Coastguard Worker  * @param config configuration string, or NULL
370*0e209d39SAndroid Build Coastguard Worker  * @param status error result
371*0e209d39SAndroid Build Coastguard Worker  * @return the new UPlugData associated with this plugin, or NULL if error.
372*0e209d39SAndroid Build Coastguard Worker  * @internal ICU 4.4 Technology Preview
373*0e209d39SAndroid Build Coastguard Worker  */
374*0e209d39SAndroid Build Coastguard Worker U_CAPI UPlugData* U_EXPORT2
375*0e209d39SAndroid Build Coastguard Worker uplug_loadPlugFromLibrary(const char *libName, const char *sym, const char *config, UErrorCode *status);
376*0e209d39SAndroid Build Coastguard Worker 
377*0e209d39SAndroid Build Coastguard Worker /**
378*0e209d39SAndroid Build Coastguard Worker  * Remove a plugin.
379*0e209d39SAndroid Build Coastguard Worker  * Will request the plugin to be unloaded, and close the library if needed
380*0e209d39SAndroid Build Coastguard Worker  * @param plug plugin handle to close
381*0e209d39SAndroid Build Coastguard Worker  * @param status error result
382*0e209d39SAndroid Build Coastguard Worker  * @internal ICU 4.4 Technology Preview
383*0e209d39SAndroid Build Coastguard Worker  */
384*0e209d39SAndroid Build Coastguard Worker U_CAPI void U_EXPORT2
385*0e209d39SAndroid Build Coastguard Worker uplug_removePlug(UPlugData *plug, UErrorCode *status);
386*0e209d39SAndroid Build Coastguard Worker #endif  /* U_HIDE_INTERNAL_API */
387*0e209d39SAndroid Build Coastguard Worker 
388*0e209d39SAndroid Build Coastguard Worker #endif /* UCONFIG_ENABLE_PLUGINS */
389*0e209d39SAndroid Build Coastguard Worker 
390*0e209d39SAndroid Build Coastguard Worker #endif /* _ICUPLUG */
391*0e209d39SAndroid Build Coastguard Worker 
392