OniStatus initialize();

static Bool
initialize(
    XLCd lcd)
{
    XLCdPublicMethodsPart *methods = XLC_PUBLIC_METHODS(lcd);
    XLCdPublicMethodsPart *pub_methods = &publicMethods.pub;
    XLCdPublicPart *pub = XLC_PUBLIC_PART(lcd);
    char *name;
#if !defined(X_LOCALE)
    int len;
    char sinamebuf[256];
    char* siname;
#endif

    _XlcInitCTInfo();

    if (initialize_core(lcd) == False)
    return False;

    name = lcd->core->name;
#if !defined(X_LOCALE)
    /*
     * _XlMapOSLocaleName will return the same string or a substring
     * of name, so strlen(name) is okay
     */
    if ((len = strlen(name)) < sizeof sinamebuf)
        siname = sinamebuf;
    else
        siname = Xmalloc (len + 1);
    if (siname == NULL)
        return False;
    name = _XlcMapOSLocaleName(name, siname);
#endif
    /* _XlcResolveLocaleName will lookup the SI's name for the locale */
    if (_XlcResolveLocaleName(name, pub) == 0) {
#if !defined(X_LOCALE)
    if (siname != sinamebuf) Xfree (siname);
#endif
    return False;
    }
#if !defined(X_LOCALE)
    if (siname != sinamebuf)
        Xfree (siname);
#endif

    if (pub->default_string == NULL)
    pub->default_string = "";

    if (methods->get_values == NULL)
    methods->get_values = pub_methods->get_values;

    if (methods->get_resource == NULL)
    methods->get_resource = pub_methods->get_resource;

    return load_public(lcd);
}


###########################################################################

static Bool
initialize(XLCd lcd)
{
    XLCdPublicMethods superclass = (XLCdPublicMethods) _XlcPublicMethods;

    XLC_PUBLIC_METHODS(lcd)->superclass = superclass;

    if (superclass->pub.initialize) {
    if ((*superclass->pub.initialize)(lcd) == False)
        return False;
    }

#ifdef USE_DYNAMIC_LC
    if (initialize_core(lcd) == False)
    return False;
#endif

    if (load_generic(lcd) == False)
    return False;

    return True;
}

猜你喜欢

转载自blog.csdn.net/durongze/article/details/80235929