Пример #1
0
/*
 *  ======== putMod ========
 */
Int Text_putMod(Types_ModuleId mid, Char **bufp, Int len)
{
    Text_PrintVisState state;

    /* If this is an unnamed module... */
    if (mid <= Text_unnamedModsLastId) {
        return (Text_xprintf(bufp, "{module#%d}", mid));
    }
    
    /* If this is a dynamically registered module... */
    if (mid <= Text_registryModsLastId) {
        return (Text_xprintf(bufp, Registry_findById(mid)->modName));
    }

    /* If this is a static, named module, but the strings are not loaded... */
    if (!Text_isLoaded) {
        return (Text_xprintf(bufp, "{module-rope:%x}", mid));
    }
    
    /* Otherwise, this is a static, named module. */
    state.bufp = bufp;
    state.len = len < 0 ? 0x7fff : len;   /* 0x7fff == infinite, almost */;
    state.res = 0;
    
    Text_visitRopeFxn(mid, (Fxn)Text_printVisFxn, &state);
    
    return (state.res);
}
Пример #2
0
/*
 *  ======== putMod ========
 */
Int Text_putMod(Types_ModuleId mid, Char **bufp, Int len)
{

    /* If this is an unnamed module... */
    if (mid <= Text_unnamedModsLastId) {
        return (Text_xprintf(bufp, "{module#%d}", mid));
    }
    
    /* If this is a dynamically registered module... */
    if (mid <= Text_registryModsLastId) {
        return (Text_xprintf(bufp, Registry_findById(mid)->modName));
    }

    /* If this is a static, named module, but the strings are not loaded... */
    if (!Text_isLoaded) {
        return (Text_xprintf(bufp, "{module-rope:%x}", mid));
    }
    
    /* Otherwise, this is a static, named module. */
	return(Text_xprintf(bufp, "%s", Diags_dictElems[mid-0x8000].modName));
}