/** * Finds the argument named <code>strArgName</code> in the specific intrinsic argument list and * returns its number. * * @param rgArgs The array of arguments * @param strArgName The generic name of the argument (defined in {@link Globals}) for which to * look * @return The number of the argument (i.e., the index within the <code>rgArgs</code> array), or * {@link InstructionListTranslator#UNDEFINED} if the argument couldn't be found */ private static int getArgNum(Argument[] rgArgs, String strArgName) { Argument arg = null; if (Globals.ARGNAME_LHS.equals(strArgName)) arg = Arguments.getLHS(rgArgs); else if (Globals.ARGNAME_RHS.equals(strArgName)) arg = Arguments.getRHS(rgArgs); else arg = Arguments.getNamedArgument(rgArgs, strArgName); return arg == null ? UNDEFINED : arg.getNumber(); }
/** * Finds the index of the argument in <code>rgArgs</code> which is the output argument. * * @param rgArgs The array of arguments to search * @return The index of the argument in <code>rgArgs</code> which is the output argument */ private static int getOutputArgumentIndex(Argument[] rgArgs) { Argument argOut = Arguments.getOutput(rgArgs); return argOut == null ? rgArgs.length - 1 : argOut.getNumber(); }