/** * Check that all the types used in the signature of an imported function * are available in the module of the caller of the function * @param fd the declaration of the imported function * @throws XPathException if an error is found */ public void checkImportedFunctionSignature(XQueryFunction fd) throws XPathException { checkImportedType(fd.getResultType(), fd); for (int a=0; a<fd.getNumberOfArguments(); a++) { SequenceType argType = fd.getArgumentTypes()[a]; checkImportedType(argType, fd); } }
/** * Check that all the types used in the signature of an imported function * are available in the module of the caller of the function * @param fd the declaration of the imported function * @throws XPathException if an error is found */ public void checkImportedFunctionSignature(XQueryFunction fd) throws XPathException { checkImportedType(fd.getResultType(), fd); for (int a=0; a<fd.getNumberOfArguments(); a++) { SequenceType argType = fd.getArgumentTypes()[a]; checkImportedType(argType, fd); } }
} else if (referees.get(i + 1) instanceof XQueryFunction) { XQueryFunction next = (XQueryFunction) referees.get(i + 1); messageBuilder.append(" calls ").append(next.getFunctionName().getDisplayName()).append("#").append(next.getNumberOfArguments()).append("()");
} else if (referees.get(i + 1) instanceof XQueryFunction) { XQueryFunction next = (XQueryFunction) referees.get(i + 1); messageBuilder.append(" calls ").append(next.getFunctionName().getDisplayName()).append("#").append(next.getNumberOfArguments()).append("()");
XQueryFunction next = (XQueryFunction)referees.get(i + 1); message += " calls " + next.getFunctionName().getDisplayName() + "#" + next.getNumberOfArguments() + "()";
XQueryFunction next = (XQueryFunction)referees.get(i + 1); message += " calls " + next.getFunctionName().getDisplayName() + "#" + next.getNumberOfArguments() + "()";
/** * Produce diagnostic output showing the compiled and optimized expression tree for a function * * @param out the destination to be used */ public void explain(/*@NotNull*/ ExpressionPresenter out) throws XPathException { out.startElement("declareFunction"); out.emitAttribute("name", functionName.getDisplayName()); out.emitAttribute("arity", "" + getNumberOfArguments()); if (compiledFunction == null) { out.emitAttribute("unreferenced", "true"); } else { if (compiledFunction.isMemoFunction()) { out.emitAttribute("memo", "true"); } out.emitAttribute("tailRecursive", compiledFunction.isTailRecursive() ? "true" : "false"); body.export(out); } out.endElement(); }
/** * Produce diagnostic output showing the compiled and optimized expression tree for a function * @param out the destination to be used */ public void explain(ExpressionPresenter out) { out.startElement("declareFunction"); out.emitAttribute("name", functionName.getDisplayName()); out.emitAttribute("arity", ""+getNumberOfArguments()); if (compiledFunction == null) { out.emitAttribute("unreferenced", "true"); } else { if (compiledFunction.isMemoFunction()) { out.emitAttribute("memo", "true"); } out.emitAttribute("tailRecursive", (compiledFunction.isTailRecursive() ? "true" : "false")); body.explain(out); } out.endElement(); }
/** * Produce diagnostic output showing the compiled and optimized expression tree for a function * * @param out the destination to be used */ public void explain(/*@NotNull*/ ExpressionPresenter out) throws XPathException { out.startElement("declareFunction"); out.emitAttribute("name", functionName.getDisplayName()); out.emitAttribute("arity", "" + getNumberOfArguments()); if (compiledFunction == null) { out.emitAttribute("unreferenced", "true"); } else { if (compiledFunction.isMemoFunction()) { out.emitAttribute("memo", "true"); } out.emitAttribute("tailRecursive", compiledFunction.isTailRecursive() ? "true" : "false"); body.export(out); } out.endElement(); }
/** * Register a user-defined XQuery function. * <p>This method is intended for internal use only.</p> * * @param function the function being declared * @throws net.sf.saxon.trans.XPathException * if an error occurs, for example * a duplicate function name */ public void declareFunction(/*@NotNull*/ XQueryFunction function) throws XPathException { Configuration config = getConfiguration(); if (function.getNumberOfArguments() == 1) { StructuredQName name = function.getFunctionName(); SchemaType t = config.getSchemaType(name); if (t != null && t.isAtomicType()) { XPathException err = new XPathException("Function name " + function.getDisplayName() + " clashes with the name of the constructor function for an atomic type"); err.setErrorCode("XQST0034"); err.setIsStaticError(true); throw err; } } XQueryFunctionLibrary local = getLocalFunctionLibrary(); local.declareFunction(function); //if (!function.isPrivate()) { QueryModule main = getTopLevelModule(); main.globalFunctionLibrary.declareFunction(function); //} }
/** * Register a user-defined XQuery function. * <p>This method is intended for internal use only.</p> * * @param function the function being declared * @throws net.sf.saxon.trans.XPathException * if an error occurs, for example * a duplicate function name */ public void declareFunction(/*@NotNull*/ XQueryFunction function) throws XPathException { Configuration config = getConfiguration(); if (function.getNumberOfArguments() == 1) { StructuredQName name = function.getFunctionName(); SchemaType t = config.getSchemaType(name); if (t != null && t.isAtomicType()) { XPathException err = new XPathException("Function name " + function.getDisplayName() + " clashes with the name of the constructor function for an atomic type"); err.setErrorCode("XQST0034"); err.setIsStaticError(true); throw err; } } XQueryFunctionLibrary local = getLocalFunctionLibrary(); local.declareFunction(function); //if (!function.isPrivate()) { QueryModule main = getTopLevelModule(); main.globalFunctionLibrary.declareFunction(function); //} }
/** * Register a user-defined XQuery function. * <p/> * This method is intended for internal use only. * @param function the function being declared */ public void declareFunction(XQueryFunction function) throws XPathException { Configuration config = getConfiguration(); if (function.getNumberOfArguments() == 1) { StructuredQName name = function.getFunctionName(); int fingerprint = config.getNamePool().getFingerprint(name.getNamespaceURI(), name.getLocalName()); if (fingerprint != -1) { SchemaType t = config.getSchemaType(fingerprint); if (t != null && t.isAtomicType()) { XPathException err = new XPathException("Function name " + function.getDisplayName() + " clashes with the name of the constructor function for an atomic type"); err.setErrorCode("XQST0034"); err.setIsStaticError(true); throw err; } } } XQueryFunctionLibrary local = getLocalFunctionLibrary(); local.declareFunction(function); QueryModule main = getTopLevelModule(); main.globalFunctionLibrary.declareFunction(function); }
/** * Register a user-defined XQuery function. * <p/> * This method is intended for internal use only. * @param function the function being declared */ public void declareFunction(XQueryFunction function) throws XPathException { Configuration config = getConfiguration(); if (function.getNumberOfArguments() == 1) { StructuredQName name = function.getFunctionName(); int fingerprint = config.getNamePool().getFingerprint(name.getNamespaceURI(), name.getLocalName()); if (fingerprint != -1) { SchemaType t = config.getSchemaType(fingerprint); if (t != null && t.isAtomicType()) { XPathException err = new XPathException("Function name " + function.getDisplayName() + " clashes with the name of the constructor function for an atomic type"); err.setErrorCode("XQST0034"); err.setIsStaticError(true); throw err; } } } XQueryFunctionLibrary local = getLocalFunctionLibrary(); local.declareFunction(function); QueryModule main = getTopLevelModule(this); main.globalFunctionLibrary.declareFunction(function); }
aFunctionResolver.addUniqueFunction (aXQueryFunction.getFunctionName ().getNamespaceBinding ().getURI (), aXQueryFunction.getFunctionName ().getLocalPart (), aXQueryFunction.getNumberOfArguments (), new XPathFunctionFromUserFunction (aConfiguration, aXQController,
aFunctionResolver.addUniqueFunction (aXQueryFunction.getFunctionName ().getNamespaceBinding ().getURI (), aXQueryFunction.getFunctionName ().getLocalPart (), aXQueryFunction.getNumberOfArguments (), new XPathFunctionFromUserFunction (aConfiguration, aXQController,