public static Cons collectStartupFormsFromSystemFile(SystemDefinition system) {
    { String systemfilename = Stella.makeSystemDefinitionFileName(system.name);
      Module module = null;
      Cons startupform = null;
      Cons startupforms = Stella.NIL;

      { Object old$Module$000 = Stella.$MODULE$.get();
        Object old$Context$000 = Stella.$CONTEXT$.get();

        try {
          Native.setSpecial(Stella.$MODULE$, ((Module)(Stella.$MODULE$.get())));
          Native.setSpecial(Stella.$CONTEXT$, ((Module)(Stella.$MODULE$.get())));
          { InputFileStream inputstream = null;

            try {
              inputstream = Stella.openInputFile(systemfilename, Stella.NIL);
              { Stella_Object tree = null;
                SExpressionIterator iter000 = InputStream.sExpressions(inputstream);
                Cons collect000 = null;

                loop000 : while (iter000.nextP()) {
                  tree = iter000.value;
                  startupform = null;
                  if (Stella_Object.safePrimaryType(tree) == Stella.SGT_STELLA_CONS) {
                    { Cons tree000 = ((Cons)(tree));

                      if (tree000.value == Stella.SYM_STELLA_DEFMODULE) {
                        Stella_Object.evaluate(tree000);
                        module = Stella.getStellaModule(Stella_Object.coerceToModuleName(tree000.rest.value, true), true);
                        if (module != null) {
                          startupform = Cons.list$(Cons.cons(Stella.SYM_STELLA_STARTUP_TIME_PROGN, Cons.cons(Stella.KWD_MODULES, Cons.cons(Module.yieldDefineModule(module), Cons.cons(Stella.NIL, Stella.NIL)))));
                        }
                      }
                      if (tree000.value == Stella.SYM_STELLA_IN_MODULE) {
                        Stella_Object.evaluate(tree000);
                      }
                    }
                  }
                  else {
                  }
                  if (startupform == null) {
                    continue loop000;
                  }
                  if (collect000 == null) {
                    {
                      collect000 = Cons.cons(startupform, Stella.NIL);
                      if (startupforms == Stella.NIL) {
                        startupforms = collect000;
                      }
                      else {
                        Cons.addConsToEndOfConsList(startupforms, collect000);
                      }
                    }
                  }
                  else {
                    {
                      collect000.rest = Cons.cons(startupform, Stella.NIL);
                      collect000 = collect000.rest;
                    }
                  }
                }
              }

            } finally {
              if (inputstream != null) {
                inputstream.free();
              }
            }
          }
          return (startupforms);

        } finally {
          Stella.$CONTEXT$.set(old$Context$000);
          Stella.$MODULE$.set(old$Module$000);
        }
      }
    }
  }