* @param returntypes
   * @param functionP
   * @param inputparameters
   * @param options
   * @return MethodSlot
   */
  public static MethodSlot defineStellaMethodSlot(Symbol inputname, Cons returntypes, boolean functionP, Cons inputparameters, KeywordKeyValueList options) {
    { MethodSlot newmethod = MethodSlot.newMethodSlot();
      Symbol name = ((Symbol)(inputname.permanentify()));

      newmethod.slotName = name;
      newmethod.methodFunctionP = functionP;
      MethodSlot.incorporateInputParameters(newmethod, inputparameters);
      MethodSlot.incorporateFirstInputParameter(newmethod);
      if (returntypes == Stella.NIL) {
        if (options.lookup(Stella.KWD_TYPE) != null) {
          returntypes = Cons.cons(options.lookup(Stella.KWD_TYPE), Stella.NIL);
        }
        else if (options.lookup(Stella.KWD_RETURN_TYPES) != null) {
          returntypes = Cons.cons(options.lookup(Stella.KWD_RETURN_TYPES), Stella.NIL);
        }
      }
      { StandardObject typespec = ((returntypes == Stella.NIL) ? Stella.SGT_STELLA_VOID : ((StandardObject)(returntypes.value.yieldTypeSpecifier())));

        if (Stella_Object.typeP(typespec)) {
          newmethod.slotBaseType = ((Surrogate)(typespec));
        }
        else {
          KeyValueList.setDynamicSlotValue(newmethod.dynamicSlots, Stella.SYM_STELLA_SLOT_TYPE_SPECIFIER, ((CompoundTypeSpecifier)(typespec)), null);
        }
      }
      if (!(returntypes == Stella.NIL)) {
        newmethod.methodReturnTypeSpecifiers = List.newList();
      }
      { Stella_Object ts = null;
        Cons iter000 = returntypes;
        List into000 = newmethod.methodReturnTypeSpecifiers();
        Cons collect000 = null;

        for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
          ts = iter000.value;
          if (collect000 == null) {
            {
              collect000 = Cons.cons(ts.yieldTypeSpecifier(), Stella.NIL);
              if (into000.theConsList == Stella.NIL) {
                into000.theConsList = collect000;
              }
              else {
                Cons.addConsToEndOfConsList(into000.theConsList, collect000);
              }
            }
          }
          else {
            {
              collect000.rest = Cons.cons(ts.yieldTypeSpecifier(), Stella.NIL);
              collect000 = collect000.rest;
            }
          }
        }
      }
      { Keyword key = null;
        Stella_Object value = null;
        KvListIterator iter001 = ((KvListIterator)(options.allocateIterator()));

        while (iter001.nextP()) {
          key = ((Keyword)(iter001.key));
          value = iter001.value;
          { Keyword testValue000 = ((Keyword)(key));

            if (testValue000 == Stella.KWD_PUBLICp) {
              newmethod.slotPublicP = ((BooleanWrapper)(value)).wrapperValue;
            }
            else if (testValue000 == Stella.KWD_ABSTRACTp) {
              newmethod.abstractP = ((BooleanWrapper)(value)).wrapperValue;
            }
            else if (testValue000 == Stella.KWD_NATIVEp) {
              KeyValueList.setDynamicSlotValue(newmethod.dynamicSlots, Stella.SYM_STELLA_METHOD_NATIVEp, (((BooleanWrapper)(value)).wrapperValue ? Stella.TRUE_WRAPPER : Stella.FALSE_WRAPPER), Stella.FALSE_WRAPPER);
            }
            else if (testValue000 == Stella.KWD_CONSTRUCTORp) {
              KeyValueList.setDynamicSlotValue(newmethod.dynamicSlots, Stella.SYM_STELLA_METHOD_CONSTRUCTORp, (((BooleanWrapper)(value)).wrapperValue ? Stella.TRUE_WRAPPER : Stella.FALSE_WRAPPER), Stella.FALSE_WRAPPER);
            }
            else if (testValue000 == Stella.KWD_GLOBALLY_INLINEp) {
              KeyValueList.setDynamicSlotValue(newmethod.dynamicSlots, Stella.SYM_STELLA_METHOD_GLOBALLY_INLINEp, (((BooleanWrapper)(value)).wrapperValue ? Stella.TRUE_WRAPPER : Stella.FALSE_WRAPPER), Stella.FALSE_WRAPPER);
            }
            else if (testValue000 == Stella.KWD_INLINE) {
              if (newmethod.methodInlinedFunctions().emptyP()) {
                KeyValueList.setDynamicSlotValue(newmethod.dynamicSlots, Stella.SYM_STELLA_METHOD_INLINED_FUNCTIONS, List.newList(), null);
              }
              { Surrogate testValue001 = Stella_Object.safePrimaryType(value);

                if (testValue001 == Stella.SGT_STELLA_CONS) {
                  { Cons value000 = ((Cons)(value));

                    { Stella_Object fnname = null;
                      Cons iter002 = value000;

                      for (;!(iter002 == Stella.NIL); iter002 = iter002.rest) {
                        fnname = iter002.value;
                        newmethod.methodInlinedFunctions().insert(((Symbol)(fnname)));
                      }
                    }
                  }
                }
                else if (Surrogate.subtypeOfSymbolP(testValue001)) {
                  { Symbol value000 = ((Symbol)(value));

                    newmethod.methodInlinedFunctions().insert(value000);
                  }
                }
                else {
                  Stella.STANDARD_WARNING.nativeStream.println("Warning: Illegal :inline argument: `" + value + "'");
                }
              }
            }
            else if (testValue000 == Stella.KWD_AUXILIARYp) {
              KeyValueList.setDynamicSlotValue(newmethod.dynamicSlots, Stella.SYM_STELLA_SLOT_AUXILIARYp, (((BooleanWrapper)(value)).wrapperValue ? Stella.TRUE_WRAPPER : Stella.FALSE_WRAPPER), Stella.FALSE_WRAPPER);
            }
            else if (testValue000 == Stella.KWD_DOCUMENTATION) {
              KeyValueList.setDynamicSlotValue(newmethod.dynamicSlots, Stella.SYM_STELLA_DOCUMENTATION, StringWrapper.wrapString(((StringWrapper)(value)).wrapperValue), Stella.NULL_STRING_WRAPPER);
            }
            else if ((testValue000 == Stella.KWD_TYPE) ||
                (testValue000 == Stella.KWD_RETURNS)) {
            }
            else if (testValue000 == Stella.KWD_STORAGE_SLOT) {
              KeyValueList.setDynamicSlotValue(newmethod.dynamicSlots, Stella.SYM_STELLA_STORAGE_SLOT, ((Symbol)(((Symbol)(value)).permanentify())), null);
            }
            else if (testValue000 == Stella.KWD_INHERITS_THROUGH) {
              KeyValueList.setDynamicSlotValue(newmethod.dynamicSlots, Stella.SYM_STELLA_METHOD_INHERITS_THROUGH, ((Symbol)(((Symbol)(value)).permanentify())), null);
            }
            else if (testValue000 == Stella.KWD_PROPERTIES) {
              KeyValueList.setDynamicSlotValue(newmethod.dynamicSlots, Stella.SYM_STELLA_PROPERTIES, ((List)(value)), null);
            }
            else if (testValue000 == Stella.KWD_META_ATTRIBUTES) {
              KeyValueList.setDynamicSlotValue(newmethod.dynamicSlots, Stella.SYM_STELLA_META_ATTRIBUTES, ((KeyValueList)(value)), null);
            }
            else if (testValue000 == Stella.KWD_COMMANDp) {
              KeyValueList.setDynamicSlotValue(newmethod.dynamicSlots, Stella.SYM_STELLA_METHOD_COMMANDp, (((BooleanWrapper)(value)).wrapperValue ? Stella.TRUE_WRAPPER : Stella.FALSE_WRAPPER), Stella.FALSE_WRAPPER);
            }
            else if (testValue000 == Stella.KWD_LISP_MACROp) {
              KeyValueList.setDynamicSlotValue(newmethod.dynamicSlots, Stella.SYM_STELLA_METHOD_LISP_MACROp, (((BooleanWrapper)(value)).wrapperValue ? Stella.TRUE_WRAPPER : Stella.FALSE_WRAPPER), null);
            }
            else if (testValue000 == Stella.KWD_EVALUATE_ARGUMENTSp) {
              KeyValueList.setDynamicSlotValue(newmethod.dynamicSlots, Stella.SYM_STELLA_METHOD_EVALUATE_ARGUMENTSp, (((BooleanWrapper)(value)).wrapperValue ? Stella.TRUE_WRAPPER : Stella.FALSE_WRAPPER), Stella.FALSE_WRAPPER);
            }
            else {
              if (!(Stella_Object.runOptionHandlerP(newmethod, key, value))) {
                { Object old$PrintreadablyP$000 = Stella.$PRINTREADABLYp$.get();

                  try {
                    Native.setBooleanSpecial(Stella.$PRINTREADABLYp$, true);
                    Stella.signalTranslationWarning();
                    if (!(Stella.suppressWarningsP())) {
                      Stella.printErrorContext(">> WARNING: ", Stella.STANDARD_WARNING);
                      {
                        Stella.STANDARD_WARNING.nativeStream.println();
                        Stella.STANDARD_WARNING.nativeStream.println(" Skipping invalid method option `" + Stella_Object.deUglifyParseTree(key) + "'");
                        Stella.STANDARD_WARNING.nativeStream.println("in the definition of method `" + newmethod.slotOwner + "'.`" + Stella_Object.deUglifyParseTree(name) + "'.");
                      }
;
                    }

                  } finally {
                    Stella.$PRINTREADABLYp$.set(old$PrintreadablyP$000);
                  }
                }
              }
            }
          }
        }
      }
      return (newmethod);
    }
  }