public static PatternRecord createPatternRecord(ControlFrame frame, Description description, Vector externalarguments) {
    { PatternRecord patternrecord = PatternRecord.newPatternRecord();

      if (description != null) {
        patternrecord.description = description;
        if (externalarguments != null) {
          { Vector externalargumentscopy = Logic.copyPatternArguments(externalarguments, description);

            patternrecord.externalArguments = externalargumentscopy;
            patternrecord.booleanVector = Logic.argumentsVectorToBooleanVector(externalargumentscopy);
          }
        }
        else {
          { List oneslist = List.newList();

            { Iterator v = ((Iterator)(description.ioVariables.allocateIterator()));
              Cons collect000 = null;

              while (v.nextP()) {
                if (collect000 == null) {
                  {
                    collect000 = Cons.cons(Stella.ZERO_WRAPPER, Stella.NIL);
                    if (oneslist.theConsList == Stella.NIL) {
                      oneslist.theConsList = collect000;
                    }
                    else {
                      Cons.addConsToEndOfConsList(oneslist.theConsList, collect000);
                    }
                  }
                }
                else {
                  {
                    collect000.rest = Cons.cons(Stella.ZERO_WRAPPER, Stella.NIL);
                    collect000 = collect000.rest;
                  }
                }
              }
            }
            patternrecord.booleanVector = Logic.zeroOneListToBooleanVector(oneslist);
            oneslist.free();
          }
        }
      }
      patternrecord.collectionList = null;
      frame.patternRecord = patternrecord;
      patternrecord.controlFrame = frame;
      return (patternrecord);
    }
  }