* @param arguments
   * @param unhandledoptionaction
   */
  public static void processCommandLineArguments(int count, String[] arguments, Keyword unhandledoptionaction) {
    if (Stella.$UNPROCESSED_COMMAND_LINE_ARGUMENTS$ == null) {
      Stella.$UNPROCESSED_COMMAND_LINE_ARGUMENTS$ = Stella.consifyCommandLineArguments(count, arguments);
    }
    { Cons cmdlineargs = Cons.copyConsList(Stella.$UNPROCESSED_COMMAND_LINE_ARGUMENTS$);
      String argument = null;
      int nargs = cmdlineargs.length();
      CmdLineOption option = null;
      Stella_Object value = null;
      Cons unprocessedargs = Cons.cons(null, Stella.$UNPROCESSED_COMMAND_LINE_ARGUMENTS$);
      Cons unprocessedtrailer = unprocessedargs;

      loop000 : while (!(cmdlineargs == Stella.NIL)) {
        { StringWrapper head000 = ((StringWrapper)(cmdlineargs.value));

          cmdlineargs = cmdlineargs.rest;
          argument = head000.wrapperValue;
        }
        nargs = nargs - 1;
        option = ((CmdLineOption)(Stella.$REGISTERED_COMMAND_LINE_OPTIONS$.lookup(StringWrapper.wrapString(argument))));
        value = null;
        if (option != null) {
          if (nargs < option.nArguments) {
            { Keyword testValue000 = option.errorAction;

              if (testValue000 == Stella.KWD_ERROR) {
                { OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

                  stream000.nativeStream.print("process-command-line-arguments: missing value for option: `" + argument + "'");
                  throw ((StellaException)(StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
                }
              }
              else if (testValue000 == Stella.KWD_WARN) {
                Stella.STANDARD_WARNING.nativeStream.println("Warning: process-command-line-arguments: missing value for option: `" + argument + "'");
              }
              else if (testValue000 == Stella.KWD_IGNORE) {
              }
              else {
                { OutputStringStream stream001 = OutputStringStream.newOutputStringStream();

                  stream001.nativeStream.print("`" + testValue000 + "' is not a valid case option");
                  throw ((StellaException)(StellaException.newStellaException(stream001.theStringReader()).fillInStackTrace()));
                }
              }
            }
            continue loop000;
          }
          switch (option.nArguments) {
            case 0: 
            break;
            case 1: 
              { StringWrapper head001 = ((StringWrapper)(cmdlineargs.value));

                cmdlineargs = cmdlineargs.rest;
                value = head001;
              }
              nargs = nargs - 1;
            break;
            default:
              { Cons value001 = Stella.NIL;

                { StringWrapper arg = null;
                  Cons iter000 = cmdlineargs;
                  int i = Stella.NULL_INTEGER;
                  int iter001 = 1;
                  int upperBound000 = option.nArguments;
                  boolean unboundedP000 = upperBound000 == Stella.NULL_INTEGER;
                  Cons collect000 = null;

                  for (;(!(iter000 == Stella.NIL)) &&
                            (unboundedP000 ||
                             (iter001 <= upperBound000)); iter000 = iter000.rest, iter001 = iter001 + 1) {
                    arg = ((StringWrapper)(iter000.value));
                    i = iter001;
                    if (collect000 == null) {
                      {
                        collect000 = Cons.cons(arg, Stella.NIL);
                        if (value001 == Stella.NIL) {
                          value001 = collect000;
                        }
                        else {
                          Cons.addConsToEndOfConsList(value001, collect000);
                        }
                      }
                    }
                    else {
                      {
                        collect000.rest = Cons.cons(arg, Stella.NIL);
                        collect000 = collect000.rest;
                      }
                    }
                  }
                }
                value = value001;
              }
              cmdlineargs = cmdlineargs.nthRest(option.nArguments);
              nargs = nargs - option.nArguments;
            break;
          }
          unprocessedtrailer.rest = unprocessedtrailer.nthRest(option.nArguments + 2);
          Stella.$UNPROCESSED_COMMAND_LINE_ARGUMENTS$ = ((Cons)(unprocessedargs.rest));
          try {
            edu.isi.stella.javalib.Native.funcall(option.handler, null, new java.lang.Object [] {option, value});
          } catch (java.lang.Exception e) {
            { Keyword testValue001 = option.errorAction;

              if (testValue001 == Stella.KWD_ERROR) {
                { OutputStringStream stream002 = OutputStringStream.newOutputStringStream();

                  stream002.nativeStream.print("Error during processing of `" + argument + "' option: `" + Stella.exceptionMessage(e) + "'");
                  throw ((StellaException)(StellaException.newStellaException(stream002.theStringReader()).fillInStackTrace()));
                }
              }
              else if (testValue001 == Stella.KWD_WARN) {
                Stella.STANDARD_WARNING.nativeStream.println("Warning: Error during processing of `" + argument + "' option: `" + Stella.exceptionMessage(e) + "'");
              }
              else if (testValue001 == Stella.KWD_IGNORE) {
              }
              else {
                { OutputStringStream stream003 = OutputStringStream.newOutputStringStream();

                  stream003.nativeStream.print("`" + testValue001 + "' is not a valid case option");
                  throw ((StellaException)(StellaException.newStellaException(stream003.theStringReader()).fillInStackTrace()));
                }
              }
            }
          }
        }
        else {
          unprocessedtrailer = unprocessedtrailer.rest;
        }
      }
      Stella.$UNPROCESSED_COMMAND_LINE_ARGUMENTS$ = ((Cons)(unprocessedargs.rest));
      { StringWrapper arg = null;
        Cons iter002 = Stella.$UNPROCESSED_COMMAND_LINE_ARGUMENTS$;

        loop002 : for (;!(iter002 == Stella.NIL); iter002 = iter002.rest) {
          arg = ((StringWrapper)(iter002.value));
          if (Stella.startsWithP(StringWrapper.unwrapString(arg), "-", 0)) {
            if (unhandledoptionaction == Stella.KWD_WARN) {
              Stella.STANDARD_WARNING.nativeStream.println("Warning: Unhandled command line option: `" + StringWrapper.unwrapString(arg) + "'");
            }
            else if (unhandledoptionaction == Stella.KWD_ERROR) {
              { OutputStringStream stream004 = OutputStringStream.newOutputStringStream();

                stream004.nativeStream.print("Unhandled command line option: `" + StringWrapper.unwrapString(arg) + "'");
                throw ((StellaException)(StellaException.newStellaException(stream004.theStringReader()).fillInStackTrace()));
              }
            }
            else if (unhandledoptionaction == Stella.KWD_IGNORE) {
              break loop002;
            }
            else {
              { OutputStringStream stream005 = OutputStringStream.newOutputStringStream();

                stream005.nativeStream.print("`" + unhandledoptionaction + "' is not a valid case option");
                throw ((StellaException)(StellaException.newStellaException(stream005.theStringReader()).fillInStackTrace()));
              }
            }
          }
        }
      }
    }
  }