Value SuThread::Name(BuiltinArgs& args) { args.usage("Thread.Name() or Thread.Name(string)"); if (Value name = args.getValue("string", Value())) Fibers::set_name(name.gcstr()); args.end(); return new SuString(Fibers::get_name()); }
Value SuThread::Sleep(BuiltinArgs& args) { args.usage("Thread.Sleep(ms)"); int ms = args.getint("ms"); args.end(); Fibers::sleep(ms); return Value(); }
Value Sha256::Update(BuiltinArgs& args) { args.usage("sha256.Update(string)"); gcstring s = args.getgcstr("string"); args.end(); update(s); return this; }
Value BuiltinClass<SuThread>::callclass(BuiltinArgs& args) { args.usage("Thread(block)"); Value func = args.getValue("block"); args.end(); persist_if_block(func); Fibers::create(thread, new ThreadInfo(func)); return Value(); }
Value Md5::Update(BuiltinArgs& args) { args.usage("usage: md5.Update(string)"); gcstring s = args.getgcstr("string"); args.end(); update(s); return this; }
Value SuAdler32::Update(BuiltinArgs& args) { args.usage("usage: adler32.Update(string)"); gcstring s = args.getgcstr("string"); args.end(); update(s); return this; }
Value BuiltinClass<Sha256>::callclass(BuiltinArgs& args) { args.usage("Sha256(@strings)"); Sha256* a = new BuiltinInstance<Sha256>(); if (!args.hasUnnamed()) return a; while (Value x = args.getNextUnnamed()) a->update(x.gcstr()); return new SuString(a->value()); }
Value BuiltinClass<SuAdler32>::callclass(BuiltinArgs& args) { args.usage("usage: Adler32(@strings)"); SuAdler32* a = new BuiltinInstance<SuAdler32>(); if (! args.hasUnnamed()) return a; while (Value x = args.getNextUnnamed()) a->update(x.gcstr()); return a->value; }
Value SuThread::List(BuiltinArgs& args) { args.usage("Thread.List()").end(); SuObject* list = new SuObject(); Fibers::foreach_fiber_info([list](gcstring name, const char* status) { list->putdata(new SuString(name), status); }); return list; }
Value BuiltinClass<Md5>::instantiate(BuiltinArgs& args) { args.usage("usage: new Md5()"); args.end(); return new BuiltinInstance<Md5>(); }
Value Md5::ValueFn(BuiltinArgs& args) { args.usage("usage: md5.Value()"); args.end(); return new SuString(value()); }
Value SuAdler32::ValueFn(BuiltinArgs& args) { args.usage("usage: adler32.Value()"); args.end(); return value; }
Value BuiltinClass<SuAdler32>::instantiate(BuiltinArgs& args) { args.usage("usage: new Adler32()"); args.end(); return new BuiltinInstance<SuAdler32>(); }
Value Sha256::ValueFn(BuiltinArgs& args) { args.usage("sha256.Value()").end(); return new SuString(value()); }
Value BuiltinClass<Sha256>::instantiate(BuiltinArgs& args) { args.usage("new Sha256()").end(); return new BuiltinInstance<Sha256>(); }
Value SuThread::Count(BuiltinArgs& args) { args.usage("Thread.Count()").end(); return Fibers::size(); }