public static SystemDefinition defineSystem(Stella_Object name, Cons options) {
    { String stringname = null;

      { Surrogate testValue000 = Stella_Object.safePrimaryType(name);

        if (Surrogate.subtypeOfStringP(testValue000)) {
          { StringWrapper name000 = ((StringWrapper)(name));

            stringname = name000.wrapperValue;
          }
        }
        else if (Surrogate.subtypeOfSymbolP(testValue000)) {
          { Symbol name000 = ((Symbol)(name));

            stringname = Native.stringDowncase(name000.symbolName);
          }
        }
        else {
          System.out.print("Illegal system name: " + name);
          return (null);
        }
      }
      { SystemDefinition self000 = SystemDefinition.newSystemDefinition();

        self000.name = stringname;
        { SystemDefinition system = self000;

          { PropertyList self001 = PropertyList.newPropertyList();

            self001.thePlist = options;
            { PropertyList plist = self001;

              { SystemDefinition value000 = null;

                { SystemDefinition s = null;
                  Cons iter000 = Stella.$SYSTEMDEFINITIONS$.theConsList;

                  loop000 : for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
                    s = ((SystemDefinition)(iter000.value));
                    if (Stella.stringEqlP(s.name, stringname)) {
                      value000 = s;
                      break loop000;
                    }
                  }
                }
                { SystemDefinition oldsystem = value000;

                  { Stella_Object key = null;
                    Stella_Object value = null;
                    Cons iter001 = plist.thePlist;

                    for (;!(iter001 == Stella.NIL); iter001 = iter001.rest.rest) {
                      key = iter001.value;
                      value = iter001.rest.value;
                      { GeneralizedSymbol testValue001 = ((GeneralizedSymbol)(key));

                        if (testValue001 == Stella.KWD_DIRECTORY) {
                          system.directory = Stella_Object.implodePathname(value);
                        }
                        else if (testValue001 == Stella.KWD_FILES) {
                          system.files = Cons.parseListOfFilePaths(((Cons)(value)));
                        }
                        else if (testValue001 == Stella.KWD_REQUIRED_SYSTEMS) {
                          system.requiredSystems = ((Cons)(value));
                          { Stella_Object sys = null;
                            Cons iter002 = ((Cons)(value));

                            for (;!(iter002 == Stella.NIL); iter002 = iter002.rest) {
                              sys = iter002.value;
                              Stella.getSystemDefinition(((StringWrapper)(sys)).wrapperValue);
                              if (!Stella.systemLoadedOrStartedUpP(((StringWrapper)(sys)).wrapperValue)) {
                                { Keyword currentaction = Stella.KWD_LOAD_SYSTEM;
                                  Keyword currentlanguage = Stella.runningInLanguage();

                                  if (((PropertyList)(Stella.$CURRENT_SYSTEM_ACTION$.get())) != null) {
                                    currentaction = ((Keyword)(((PropertyList)(Stella.$CURRENT_SYSTEM_ACTION$.get())).lookupWithDefault(Stella.KWD_ACTION, currentaction)));
                                    currentlanguage = ((Keyword)(((PropertyList)(Stella.$CURRENT_SYSTEM_ACTION$.get())).lookupWithDefault(Stella.KWD_LANGUAGE, currentlanguage)));
                                  }
                                  if (currentaction == Stella.KWD_MAKE_SYSTEM) {
                                    System.out.println("Making required system " + StringWrapper.unwrapString(((StringWrapper)(sys))));
                                    Stella.makeSystem(((StringWrapper)(sys)).wrapperValue, Cons.cons(currentlanguage, Stella.NIL));
                                  }
                                  else {
                                    System.out.println("Loading required system " + StringWrapper.unwrapString(((StringWrapper)(sys))));
                                    Stella.loadSystem(((StringWrapper)(sys)).wrapperValue, Cons.cons(currentlanguage, Stella.NIL));
                                  }
                                }
                              }
                            }
                          }
                        }
                        else if (testValue001 == Stella.KWD_LISP_ONLY_FILES) {
                          system.lispOnlyFiles = Cons.parseListOfFilePaths(((Cons)(value)));
                        }
                        else if (testValue001 == Stella.KWD_CPP_ONLY_FILES) {
                          system.cppOnlyFiles = Cons.parseListOfFilePaths(((Cons)(value)));
                        }
                        else if (testValue001 == Stella.KWD_JAVA_ONLY_FILES) {
                          system.javaOnlyFiles = Cons.parseListOfFilePaths(((Cons)(value)));
                        }
                        else if (testValue001 == Stella.KWD_DATA_FILES) {
                          system.dataFiles = Cons.parseListOfFilePaths(((Cons)(value)));
                        }
                        else if (testValue001 == Stella.KWD_PREPROCESSED_FILES) {
                          system.preprocessedFiles = Cons.parseListOfFilePaths(((Cons)(value)));
                        }
                        else if (testValue001 == Stella.KWD_CARDINAL_MODULE) {
                          system.cardinalModule = ((StringWrapper)(value)).wrapperValue;
                        }
                        else if (testValue001 == Stella.KWD_ROOT_SOURCE_DIRECTORY) {
                          system.sourceRootDirectory = ((StringWrapper)(value)).wrapperValue;
                        }
                        else if (testValue001 == Stella.KWD_ROOT_NATIVE_DIRECTORY) {
                          system.nativeRootDirectory = ((StringWrapper)(value)).wrapperValue;
                        }
                        else if (testValue001 == Stella.KWD_ROOT_BINARY_DIRECTORY) {
                          system.binaryRootDirectory = ((StringWrapper)(value)).wrapperValue;
                        }
                        else if ((testValue001 == Stella.KWD_BANNER) ||
                            (testValue001 == Stella.KWD_COPYRIGHT_HEADER)) {
                          system.banner = ((StringWrapper)(value)).wrapperValue;
                        }
                        else if (testValue001 == Stella.KWD_PRODUCTION_SETTINGS) {
                          system.productionSettings = ((Cons)(value));
                        }
                        else if (testValue001 == Stella.KWD_DEVELOPMENT_SETTINGS) {
                          system.developmentSettings = ((Cons)(value));
                        }
                        else if (testValue001 == Stella.KWD_FINALIZATION_FUNCTION) {
                          system.finalizationFunction = ((Symbol)(value));
                        }
                        else {
                          { OutputStringStream stream000 = OutputStringStream.newOutputStringStream();

                            stream000.nativeStream.print("`" + testValue001 + "' is not a valid case option");
                            throw ((StellaException)(StellaException.newStellaException(stream000.theStringReader()).fillInStackTrace()));
                          }
                        }
                      }
                    }
                  }
                  if (system.directory == null) {
                    system.directory = system.name;
                  }
                  Stella.$SYSTEMDEFINITIONS$.push(system);
                  if (oldsystem != null) {
                    {
                      System.out.println("Redefining system `" + system.name + "'");
                      System.out.println();
                    }
;
                    Stella.$SYSTEMDEFINITIONS$.remove(oldsystem);
                  }
                  return (system);
                }
              }
            }
          }
        }
      }
    }
  }