public static String readLine()
  {
   byte [] buffer = new byte[1024];
   int bytes = ((JavaArray)buffer).getElem(0);
   int length = buffer.length - 1;
   #ass "bytes length ACCEPT TO length";
   return JavaArray.createString(bytes, length);
  }
 public static void print(char y)
  {
   //System.out.print(y);
   JavaArray.print("" + y);
  }
 public static void print(String s)
  {
   //System.out.print(s);
   JavaArray.print(s);
  }
Beispiel #4
0
  public void init() throws ControlFlow {
    Base.init(base);
    DefaultBehavior.init(defaultBehavior);
    Mixins.init(mixins);
    system.init();
    Runtime.initRuntime(runtime);
    message.init();
    Ground.init(iokeGround, ground);
    Origin.init(origin);
    nil.init();
    _true.init();
    _false.init();
    text.init();
    symbol.init();
    number.init();
    range.init();
    pair.init();
    tuple.init();
    dateTime.init();
    lexicalContext.init();
    list.init();
    dict.init();
    set.init();
    call.init();
    Locals.init(locals);
    Condition.init(condition);
    Rescue.init(rescue);
    Handler.init(handler);
    io.init();
    FileSystem.init(fileSystem);
    regexp.init();
    JavaGround.init(javaGround);
    JavaArray.init(javaArray);
    javaWrapper.init();

    iokeGround.mimicsWithoutCheck(defaultBehavior);
    iokeGround.mimicsWithoutCheck(base);
    ground.mimicsWithoutCheck(iokeGround);
    ground.mimicsWithoutCheck(javaGround);
    origin.mimicsWithoutCheck(ground);

    mixins.mimicsWithoutCheck(defaultBehavior);

    system.mimicsWithoutCheck(ground);
    system.mimicsWithoutCheck(defaultBehavior);
    runtime.mimicsWithoutCheck(ground);
    runtime.mimicsWithoutCheck(defaultBehavior);

    nil.mimicsWithoutCheck(origin);
    _true.mimicsWithoutCheck(origin);
    _false.mimicsWithoutCheck(origin);
    text.mimicsWithoutCheck(origin);
    symbol.mimicsWithoutCheck(origin);
    number.mimicsWithoutCheck(origin);
    range.mimicsWithoutCheck(origin);
    pair.mimicsWithoutCheck(origin);
    dateTime.mimicsWithoutCheck(origin);

    message.mimicsWithoutCheck(origin);
    method.mimicsWithoutCheck(origin);

    list.mimicsWithoutCheck(origin);
    dict.mimicsWithoutCheck(origin);
    set.mimicsWithoutCheck(origin);

    condition.mimicsWithoutCheck(origin);
    rescue.mimicsWithoutCheck(origin);
    handler.mimicsWithoutCheck(origin);

    io.mimicsWithoutCheck(origin);

    fileSystem.mimicsWithoutCheck(origin);

    regexp.mimicsWithoutCheck(origin);

    method.init();
    defaultMethod.init();
    nativeMethod.init();
    lexicalBlock.init();
    defaultMacro.init();
    lexicalMacro.init();
    defaultSyntax.init();
    arity.init();
    call.mimicsWithoutCheck(origin);

    method.mimicsWithoutCheck(origin);
    defaultMethod.mimicsWithoutCheck(method);
    nativeMethod.mimicsWithoutCheck(method);
    defaultMacro.mimicsWithoutCheck(origin);
    lexicalMacro.mimicsWithoutCheck(origin);
    defaultSyntax.mimicsWithoutCheck(origin);
    arity.mimicsWithoutCheck(origin);
    lexicalBlock.mimicsWithoutCheck(origin);

    Restart.init(restart);
    restart.mimicsWithoutCheck(origin);

    javaWrapper.mimicsWithoutCheck(origin);

    Reflector.init(this);
    Hook.init(this);

    Sequence.init(sequence);
    iteratorSequence.init();
    keyValueIteratorSequence.init();

    addBuiltinScript(
        "benchmark",
        new Builtin() {
          public IokeObject load(Runtime runtime, IokeObject context, IokeObject message)
              throws ControlFlow {
            return ioke.lang.extensions.benchmark.Benchmark.create(runtime);
          }
        });

    addBuiltinScript(
        "readline",
        new Builtin() {
          public IokeObject load(Runtime runtime, IokeObject context, IokeObject message)
              throws ControlFlow {
            return ioke.lang.extensions.readline.Readline.create(runtime);
          }
        });

    try {
      evaluateString("use(\"builtin/A05_conditions\")", message, ground);
      evaluateString("use(\"builtin/A10_defaultBehavior\")", message, ground);
      evaluateString("use(\"builtin/A15_dmacro\")", message, ground);
      evaluateString("use(\"builtin/A20_comparing\")", message, ground);
      evaluateString("use(\"builtin/A25_defaultBehavior_inspection\")", message, ground);
      evaluateString("use(\"builtin/A30_system\")", message, ground);

      evaluateString("use(\"builtin/D05_number\")", message, ground);
      evaluateString("use(\"builtin/D10_call\")", message, ground);
      evaluateString("use(\"builtin/D15_range\")", message, ground);
      evaluateString("use(\"builtin/D20_booleans\")", message, ground);
      evaluateString("use(\"builtin/D25_list\")", message, ground);
      evaluateString("use(\"builtin/D30_dict\")", message, ground);
      evaluateString("use(\"builtin/D35_pair\")", message, ground);
      evaluateString("use(\"builtin/D37_tuple\")", message, ground);
      evaluateString("use(\"builtin/D40_text\")", message, ground);
      evaluateString("use(\"builtin/D43_regexp\")", message, ground);
      evaluateString("use(\"builtin/D45_fileSystem\")", message, ground);
      evaluateString("use(\"builtin/D50_runtime\")", message, ground);

      evaluateString("use(\"builtin/F05_case\")", message, ground);
      evaluateString("use(\"builtin/F10_comprehensions\")", message, ground);
      evaluateString("use(\"builtin/F15_message\")", message, ground);
      evaluateString("use(\"builtin/F20_set\")", message, ground);
      evaluateString("use(\"builtin/F25_cond\")", message, ground);
      evaluateString("use(\"builtin/F30_enumerable\")", message, ground);
      evaluateString("use(\"builtin/F32_sequence\")", message, ground);

      evaluateString("use(\"builtin/G05_aspects\")", message, ground);
      evaluateString("use(\"builtin/G10_origin\")", message, ground);
      evaluateString("use(\"builtin/G10_arity\")", message, ground);

      evaluateString("use(\"builtin/G50_hook\")", message, ground);

      evaluateString("use(\"builtin/H10_lexicalBlock\")", message, ground);

      evaluateString("use(\"builtin/J05_javaGround\")", message, ground);
    } catch (ControlFlow cf) {
    }
  }