Example #1
0
/**
 * xslDbgEntities:
 * 
 * Print list of entites found 
 *
 * Returns 1 on sucess,
 *         0 otherwise
 */
int
xslDbgEntities(void)
{
    int result = 0;

    if (filesEntityList()) {
        int entityIndex;
        entityInfoPtr entInfo;

        if (getThreadStatus() == XSLDBG_MSG_THREAD_RUN) {
            /* notify that we are starting new list of entity names */
            notifyListStart(XSLDBG_MSG_ENTITIY_CHANGED);
            for (entityIndex = 0;
                 entityIndex < arrayListCount(filesEntityList());
                 entityIndex++) {
                entInfo = (entityInfoPtr) arrayListGet(filesEntityList(),
                                                       entityIndex);
                if (entInfo)
                    notifyListQueue(entInfo);

            }
            notifyListSend();
            result = 1;
        } else {
            for (entityIndex = 0;
                 entityIndex < arrayListCount(filesEntityList());
                 entityIndex++) {
                entInfo = (entityInfoPtr) arrayListGet(filesEntityList(),
                                                       entityIndex);
                if (entInfo) {
		    /* display identifier of an XML entity */
                    xsldbgGenericErrorFunc(i18n("Entity %1 ").arg(xsldbgText(entInfo->SystemID)));
                    if (entInfo->PublicID)
			xsldbgGenericErrorFunc(xsldbgText(entInfo->PublicID));
		    xsldbgGenericErrorFunc("\n");
                }
            }
            if (arrayListCount(filesEntityList()) == 0) {
                xsldbgGenericErrorFunc(i18n("No external General Parsed entities present.\n"));
            } else {
		xsldbgGenericErrorFunc(i18n("\tTotal of %n entity found.", "\tTotal of %n entities found.", arrayListCount(filesEntityList())) + QString("\n"));
            }

            result = 1;
        }
    }
    return result;
}
Example #2
0
/**
 * xslDbgShellShowParam:
 * @arg: Not used
 *
 * Print list of current paramters
 *
 * Returns 1 on success,
 *         0 otherwise
 */
int
xslDbgShellShowParam(xmlChar * arg)
{
    Q_UNUSED(arg);
    int result = 0;
    static const char *errorPrompt = I18N_NOOP("Unable to print parameters");

    if (getThreadStatus() == XSLDBG_MSG_THREAD_RUN) {
        int paramIndex = 0;
        int itemCount = arrayListCount(optionsGetParamItemList());

        notifyListStart(XSLDBG_MSG_PARAMETER_CHANGED);

        if (itemCount > 0) {
            parameterItemPtr paramItem = NULL;

            while (paramIndex < itemCount) {
                paramItem = (parameterItemPtr)
                    arrayListGet(optionsGetParamItemList(), paramIndex++);
                if (paramItem != NULL)
                    notifyListQueue(paramItem);
            }
        }
        notifyListSend();
        result = 1;
    } else {

        if (optionsPrintParamList())
            result = 1;
        else
        xsldbgGenericErrorFunc(QString("Error: %1\n").arg(i18n(errorPrompt)));
        xsldbgGenericErrorFunc("\n");
    }
    return result;
}
Example #3
0
/**
 * breakPointLinesCount:
 *
 * Return the number of hash tables of break points with the same line number
 *
 * Returns The number of hash tables of break points with the same line number
 */
int
breakPointLinesCount(void)
{
    if (!breakList) {
#ifdef WITH_XSLDBG_DEBUG_BREAKPOINTS
        xsltGenericError(xsltGenericErrorContext,
                         "Error: Breakpoints structures not initialized\n");
#endif
        return 0;
    } else
        return arrayListCount(breakList);
}
Example #4
0
/** 
 * xslDbgShellAddParam:
 * @arg: A string comprised of two words separated by
 *          one or more spaces which are in UTF-8 
 *
 * Add a libxslt parameter to be sent to libxslt later on
 *
 * Returns 1 on success,
 *         0 otherwise
*/
int
xslDbgShellAddParam(xmlChar * arg)
{
    int result = 0;
    parameterItemPtr paramItem = NULL;
    static const char *errorPrompt = I18N_NOOP("Failed to add parameter");
    xmlChar *opts[2];

    if (!arg) {
        xsldbgGenericErrorFunc(i18n("Error: Invalid arguments for the command %1.\n").arg("addparam"));
    }else{
	if ((xmlStrLen(arg) > 1) && splitString(arg, 2, opts) == 2) {
	    int count;
	    for (count = 0; count < arrayListCount(optionsGetParamItemList()); count++){
		paramItem = (parameterItemPtr)arrayListGet(optionsGetParamItemList(), count);
		if (paramItem != NULL){
		    if (xmlStrCmp(opts[0], paramItem->name) == 0){
			/* parameter exist just update its value */
			if (paramItem->value)
			    xmlFree(paramItem->value);
			paramItem->value = xmlStrdup(opts[1]); 
			return 1;
		    }
		}
	    }
	    paramItem = optionsParamItemNew(opts[0], opts[1]);
	    result = arrayListAdd(optionsGetParamItemList(), paramItem);
	} else {
	    xsldbgGenericErrorFunc(i18n("Error: Invalid arguments for the command %1.\n").arg("addparam"));
	}
    }
    if (!result)
        xsldbgGenericErrorFunc(QString("Error: %1\n").arg(i18n(errorPrompt)));
    else {
	xsldbgGenericErrorFunc("\n");
    }
    return result;
}