这篇教程C++ toplevel函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中toplevel函数的典型用法代码示例。如果您正苦于以下问题:C++ toplevel函数的具体用法?C++ toplevel怎么用?C++ toplevel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了toplevel函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: sKey void HTTPFormClass::saveFile(Stringp key, Stringp destPath) { string sKey(((StUTF8String) key).c_str()); for (std::vector<FormFile>::iterator it=sapi->files.begin(); it!=sapi->files.end(); it++) { if (sKey == (*it).name) { StUTF8String filenameUTF8(destPath); File* fp = Platform::GetInstance()->createFile(); if (!fp || !fp->open(filenameUTF8.c_str(), File::OPEN_WRITE)) { if(fp) { Platform::GetInstance()->destroyFile(fp); } toplevel()->throwError(kFileWriteError, destPath); } if ((int32_t)fp->write((*it).data.data(), (*it).data.length()) != (int32_t)(*it).data.length()) toplevel()->throwError(kFileWriteError, destPath); fp->close(); Platform::GetInstance()->destroyFile(fp); } } }
开发者ID:weimingtom,项目名称:mod-actionscript,代码行数:27,
示例2: toplevel avmplus::ArrayObject * CSocketClass::__gethostbyaddr(avmplus::Stringp addr, bool numeric) { if (!addr) { toplevel()->throwArgumentError(kNullArgumentError, "addr"); } avmplus::StUTF8String addrUTF8(addr); avmplus::ArrayObject *list = toplevel()->arrayClass()->newArray(); int count = 0; struct in_addr **addr_list; struct hostent *host; host = VMPI_gethostbyaddr( addrUTF8.c_str() ); if(host != NULL) { if(numeric) { addr_list = (struct in_addr **)host->h_addr_list; int i; for(i = 0; addr_list[i] != NULL; i++) { list->setUintProperty(i, core()->newStringUTF8( inet_ntoa(*addr_list[i]) )->atom()); } } else { list->setUintProperty(count++, core()->newStringUTF8( host->h_name )->atom()); if(host->h_aliases) { int x; for(x=0; host->h_aliases[x]; ++x) { list->setUintProperty(count++, core()->newStringUTF8( host->h_aliases[x] )->atom()); } } } } return list; }
开发者ID:Adime,项目名称:redtamarin,代码行数:35,
示例3: toplevel ArrayObject* StringClass::_split(Stringp in, Atom delimAtom, uint32 limit) { AvmCore* core = this->core(); if (limit == 0) return toplevel()->arrayClass->newArray(); if (in->length() == 0) { ArrayObject* out = toplevel()->arrayClass->newArray(); out->setUintProperty(0,in->atom()); return out; } // handle RegExp case if (AvmCore::istype(delimAtom, core->traits.regexp_itraits)) { RegExpObject *reObj = (RegExpObject*) AvmCore::atomToScriptObject(delimAtom); return reObj->split(in, limit); } ArrayObject *out = toplevel()->arrayClass->newArray(); Stringp delim = core->string(delimAtom); int ilen = in->length(); int dlen = delim->length(); int count = 0; if (dlen <= 0) { // delim is empty string, split on each char for (int i = 0; i < ilen && (unsigned)i < limit; i++) { Stringp sub = in->substr(i, 1); out->setUintProperty(count++, sub->atom()); } return out; } int32_t start = 0; while (start <= in->length()) { if ((limit != 0xFFFFFFFFUL) && (count >= (int) limit)) break; int32_t bgn = in->indexOf(delim, start); if (bgn < 0) // not found, use the string remainder bgn = in->length(); Stringp sub = in->substring(start, bgn); out->setUintProperty(count++, sub->atom()); start = bgn + delim->length(); } return out; }
开发者ID:changm,项目名称:tessa,代码行数:55,
示例4: Interpretvoid Interpret(char expr[]){ SetIntSignal(True); if(commandline(expr)) ; else if(seterror()==0) { initstack(); restoretemplates(); CloseAllIOFiles(); interrupted = False; if(parseinput(expr)) checkexpression(top(), True); else { checkexpression(top(), False); settop(modify_expression(top())); starttiming(); toplevel(); stoptiming(); } } SetIntSignal(False); initstack(); restoretemplates(); CloseAllIOFiles(); interrupted = False; Write("/n");}
开发者ID:gezichtshaar,项目名称:amanda,代码行数:29,
示例5: toplevel void SystemClass::trace(ArrayObject* a) { if (!a) toplevel()->throwArgumentError(kNullArgumentError, "array"); AvmCore* core = this->core(); PrintWriter& console = core->console; for (int i=0, n = a->getLength(); i < n; i++) { if (i > 0) console << ' '; Stringp s = core->string(a->getUintProperty(i)); for (int j = 0; j < s->length(); j++) { wchar c = (*s)[j]; // '/r' gets converted into '/n' // '/n' is left alone // '/r/n' is left alone if (c == '/r') { if (((j+1) < s->length()) && (*s)[j+1] == '/n') { console << '/r'; j++; } console << '/n'; } else { console << c; } } } console << '/n'; }
开发者ID:Jeffxz,项目名称:nodeas,代码行数:35,
示例6: mainint main(int argc, char *argv[]){ FILE *f = stdin; char *rc_file = absolute_path(RC_FILE); char *hist_file = absolute_path(HIST_FILE); if (argc > 1) { /* On travaille sur un shell script: lui passer les arguments et le lancer */ add_program_parameters_environ(argc-1, argv+1); return execute_script(argv[1]); } else { /* Imprimer une bannière */ fprintf(stderr, "Bienvenue sur %s version %s/n", SHELL_NAME, VERSION); /* lancer éventuellement le script d'initialisation de l'utilisateur*/ if (access(rc_file, R_OK) == 0) execute_script(rc_file); /* Passer les paramètres (ici 0 param) et appeler le toplevel de l'interprete */ add_program_parameters_environ(1, argv); /* Gérer l'historique (la sauvegarde se fera automatiquement) */ init_history(HISTORY_DEFAULT_SIZE, hist_file); /* Lancement du toplevel de l'interprète */ toplevel(f); fprintf(stderr, "Bye/n"); } return EXIT_SUCCESS;}
开发者ID:lasson-g,项目名称:polysh,代码行数:32,
示例7: ToString /** 15.2.4.5 Object.prototype.hasOwnProperty (V) When the hasOwnProperty method is called with argument V, the following steps are taken: 1. Let O be this object. 2. Call ToString(V). 3. If O doesn't have a property with the name given by Result(2), return false. 4. Return true. NOTE Unlike [[HasProperty]] (section 8.6.2.4), this method does not consider objects in the prototype chain. */ bool ObjectClass::_hasOwnProperty(Atom thisAtom, Stringp name) { AvmCore* core = this->core(); name = name ? core->internString(name) : (Stringp)core->knull; Traitsp t = NULL; switch (atomKind(thisAtom)) { case kObjectType: { // ISSUE should this look in traits and dynamic vars, or just dynamic vars. ScriptObject* obj = AvmCore::atomToScriptObject(thisAtom); // TODO // The change below is important as otherwise we will throw error in a call to hasAtomProperty for ByteArrayObject. // This gets us back to the behaviour which we had in Marlin. // A bugzilla bug [ 562224 ] has been created to address this issue more cleanly in near future return obj->traits()->getTraitsBindings()->findBinding(name, core->findPublicNamespace()) != BIND_NONE || obj->hasStringProperty(name); } case kNamespaceType: case kStringType: case kBooleanType: case kDoubleType: case kIntptrType: t = toplevel()->toTraits(thisAtom); break; default: return false; } // NOTE use caller's public namespace return t->getTraitsBindings()->findBinding(name, core->findPublicNamespace()) != BIND_NONE; }
开发者ID:bsdf,项目名称:trx,代码行数:41,
示例8: AvmAssert // memory changed so go through and update all reference to both the base // and the size of the global memory void DomainEnv::notifyGlobalMemoryChanged(uint8_t* newBase, uint32_t newSize) { AvmAssert(newBase != NULL); // real base address AvmAssert(newSize >= GLOBAL_MEMORY_MIN_SIZE); // big enough if (newSize < GLOBAL_MEMORY_MIN_SIZE) { newBase = m_globalMemoryScratch->scratch; newSize = GLOBAL_MEMORY_MIN_SIZE; } m_globalMemoryBase = newBase; // We require that MOps addresses be non-negative int32 values. // Furthermore, the bounds checks may fail to detect an out-of-bounds // access if the global memory size is not itself a non-negative int32. // See bug 723401. Since the size of a byte array may expand as // side-effect of other operations according to a policy not under direct // control of the user, it is not appropriate to signal an error here. // We simply silently ignore any excess allocation. // TODO: While we cannot do much about automatic resizing, an attempt // to explicitly set the size too large should throw an exception before // arriving here. m_globalMemorySize = (newSize > 0x7fffffff) ? 0x7fffffff : newSize; TELEMETRY_UINT32(toplevel()->core()->getTelemetry(), ".mem.bytearray.alchemy",m_globalMemorySize/1024); }
开发者ID:ajwfrost,项目名称:avmplus,代码行数:27,
示例9: emit_csourcestatic int emit_csource(void) { AST* tree = NULL; Parser* ctx = parser_new(NULL, stdin); while(NULL != (tree = normalize(toplevel(ctx)))) codegen(stdout, tree); return 0;}
开发者ID:mikedlowis-prototypes,项目名称:sclpl,代码行数:7,
示例10: core Traits *DomainObject::getTraits (Atom a) { if (ISNULL(a)) { return core()->traits.null_itraits; } if (a == kSpecialType) { return core()->traits.void_itraits; } switch (a & 7) { case kObjectType: return AvmCore::atomToScriptObject(a)->traits(); case kNamespaceType: return core()->traits.namespace_itraits; case kStringType: return core()->traits.string_itraits; case kBooleanType: return core()->traits.boolean_itraits; case kIntegerType: return core()->traits.int_itraits; case kDoubleType: return core()->traits.number_itraits; } toplevel()->throwArgumentError(kNotImplementedError, core()->toErrorString("value")); return core()->traits.void_itraits; }
开发者ID:FlowShift,项目名称:thane,代码行数:25,
示例11: return//new adds 11Stringp NativeWindowObject::AS3_renderMode_get(){// LOGWHERE(); if(m_pInitOptions) return m_pInitOptions->AS3_renderMode_get();//Stringp("auto");// return ((ShellToplevel*)toplevel())->getNativeWindowRenderModeClass()->getSlotAUTO();}
开发者ID:hgl888,项目名称:nashtest,代码行数:8,
示例12: toplevel Stringp ProgramClass::_popenRead(Stringp command) { if( !command ) { toplevel()->throwArgumentError(kNullArgumentError, "command"); } StUTF8String commandUTF8(command); FILE *read_fp; char buffer[BUFSIZ + 1]; int chars_read; VMPI_memset(buffer, '/0', sizeof(buffer)); read_fp = VMPI_popen(commandUTF8.c_str(), "r"); Stringp output = core()->newStringUTF8( "" ); if (read_fp != NULL) { chars_read = (int) fread(buffer, sizeof(char), BUFSIZ, read_fp); output = output->append( core()->newStringUTF8(buffer, chars_read) ); while(chars_read > 0) { buffer[chars_read - 1] = '/0'; chars_read = (int) fread(buffer, sizeof(char), BUFSIZ, read_fp); output = output->append( core()->newStringUTF8(buffer, chars_read) ); } VMPI_pclose(read_fp); return output; } return NULL; }
开发者ID:Adime,项目名称:redtamarin,代码行数:32,
示例13: initnamensxvoid Stubs::do_abc_setpropnsx(MethodFrame* f, const Multiname* name, Atom ns, Atom index, Atom object, Atom value) { Multiname tempname; initnamensx(env(f), name, ns, index, &tempname); Toplevel* t = toplevel(f); t->setproperty(object, &tempname, value, toVTable(t, object));}
开发者ID:AdiKo,项目名称:avmplus,代码行数:7,
示例14: ClassClosure NamespaceClass::NamespaceClass(VTable* cvtable) : ClassClosure(cvtable) { toplevel()->_namespaceClass = this; AvmAssert(traits()->getSizeOfInstance() == sizeof(NamespaceClass)); createVanillaPrototype(); }
开发者ID:AdiKo,项目名称:avmplus,代码行数:7,
示例15: core Atom ScriptObject::getAtomPropertyFromProtoChain(Atom name, ScriptObject* o, Traits *origObjTraits) const { // todo will delegate always be non-null here? if (o != NULL) { Atom searchname = name; Stringp s = core()->atomToString(name); AvmAssert(s->isInterned()); Atom ival = s->getIntAtom(); if (ival) { searchname = ival; } do { // ensure prototype is dynamic if (!o->vtable->traits->getHashtableOffset()) continue; Atom const value = o->getTable()->getNonEmpty(searchname); if (!InlineHashtable::isEmpty(value)) return value; } while ((o = o->delegate) != NULL); } // NOTE use default public since name is not used Multiname multiname(core()->getAnyPublicNamespace(), AvmCore::atomToString(name)); toplevel()->throwReferenceError(kReadSealedError, &multiname, origObjTraits); // unreached return undefinedAtom; }
开发者ID:bsdf,项目名称:trx,代码行数:30,
示例16: toplevel // this = argv[0] (ignored) // arg1 = argv[1] // argN = argv[argc] Atom RegExpClass::construct(int argc, Atom* argv) { AvmCore* core = this->core(); Stringp pattern; Atom patternAtom = (argc>0) ? argv[1] : undefinedAtom; Atom optionsAtom = (argc>1) ? argv[2] : undefinedAtom; if (AvmCore::istype(patternAtom, traits()->itraits)) { // Pattern is a RegExp object if (optionsAtom != undefinedAtom) { // ECMA 15.10.4.1 says to throw an error if flags specified toplevel()->throwTypeError(kRegExpFlagsArgumentError); } // Return a clone of the RegExp object RegExpObject* regExpObject = (RegExpObject*)AvmCore::atomToScriptObject(patternAtom); return (new (core->GetGC(), ivtable()->getExtraSize()) RegExpObject(regExpObject))->atom(); } else { if (patternAtom != undefinedAtom) { pattern = core->string(argv[1]); } else { // cn: disable this, breaking ecma3 tests. was: todo look into this. it's what SpiderMonkey does. pattern = core->kEmptyString; //core->newConstantStringLatin1("(?:)"); } } Stringp options = NULL; if (optionsAtom != undefinedAtom) { options = core->string(optionsAtom); } RegExpObject* inst = new (core->GetGC(), ivtable()->getExtraSize()) RegExpObject(this, pattern, options); return inst->atom(); }
开发者ID:Jeffxz,项目名称:nodeas,代码行数:37,
示例17: ToString /** 15.2.4.5 Object.prototype.hasOwnProperty (V) When the hasOwnProperty method is called with argument V, the following steps are taken: 1. Let O be this object. 2. Call ToString(V). 3. If O doesn C++ topo_mod_dprintf函数代码示例 C++ topfile函数代码示例
|