// Initialize state. node_impl::node_impl (const char * name) { name_ (name); weight_ (0); degree_ (0); neighbors_ ().length (0); }
AUG_EXTERNC aug_result aug_getfield_(aug_seq_t seq, const struct aug_info_* info, unsigned n, struct aug_field* field) { char* ptr; if (n >= info->fields_) { /* Return empty field on detection of out-of-bounds condition. */ field->name_ = NULL; field->value_ = NULL; field->size_ = 0; return 0; } if (aug_setregion_(seq, AUG_HEADER, info->hsize_) < 0 || !(ptr = aug_seqaddr_(seq))) return -1; /* Move pointer to required field. */ ptr += offsetn_(ptr, n); field->name_ = name_(ptr); field->value_ = value_(ptr, nsize_(ptr)); field->size_ = vsize_(ptr) - 1; /* Minus null terminator. */ return 0; }
SAMPGDK_EXPORT int SAMPGDK_CALL SetPlayerName(int playerid, const char *name) { static AMX_NATIVE native = Wrapper::GetInstance()->GetNative("SetPlayerName"); FakeAmxHeapObject name_(name); cell params[] = { 2 * 4, playerid, name_.address() }; return native(&::fakeAmx, params); }
void node_impl::print (void) { cout << " Name: " << name_ () << endl; cout << " Weight: " << weight_ () << endl; cout << " Degree: " << degree_ () << endl; cout << " Neighbors: " << endl; for (size_t i = 0; i < neighbors_ ().length (); i++) cout << " " << neighbors_ ()[i]->name_ () << endl; }
SAMPGDK_EXPORT bool SAMPGDK_CALL GetPlayerName(int playerid, char *name, size_t size) { static AMX_NATIVE native = Wrapper::GetInstance()->GetNative("GetPlayerName"); FakeAmxHeapObject name_(size); cell params[] = { 3 * 4, playerid, name_.address(), size }; bool ret = native(&::fakeAmx, params) != 0; name_.GetAsString(name, size); return ret; }
void GlobalExceptionHandler::terminate() throw() { // add cerr to the log stream // and write all available information on // the exception to the log stream (potentially with an assigned file!) // and cerr std::cout << std::endl; std::cout << "---------------------------------------------------" << std::endl; std::cout << "FATAL: uncaught exception!" << std::endl; std::cout << "---------------------------------------------------" << std::endl; if ((line_() != -1) && (name_() != "unknown")) { std::cout << "last entry in the exception handler: " << std::endl; std::cout << "exception of type " << name_().c_str() << " occured in line " << line_() << ", function " << function_() << " of " << file_().c_str() << std::endl; std::cout << "error message: " << what_().c_str() << std::endl; } std::cout << "---------------------------------------------------" << std::endl; #ifndef OPENMS_WINDOWSPLATFORM // if the environment variable declared in OPENMS_CORE_DUMP_ENVNAME // is set, provoke a core dump (this is helpful to get a stack traceback) if (getenv(OPENMS_CORE_DUMP_ENVNAME) != 0) { #ifdef OPENMS_HAS_KILL std::cout << "dumping core file.... (to avoid this, unset " << OPENMS_CORE_DUMP_ENVNAME << " in your environment)" << std::endl; // provoke a core dump kill(getpid(), SIGSEGV); #endif } #endif // otherwise exit as default terminate() would: abort(); }
Reflective::RefObject_ptr RepositoryConnector::internal_lookup_simple ( MDE::BaseIDL::Container_ptr base, const char* simple_name ) { std::string name_( simple_name ); if ( name_.empty () ) throw NotFoundInRep ( "Empty name", simple_name ); MDE::BaseIDL::ContainedSet_var set = base->contents(); unsigned long idx = 0; while ( idx < set->length() ) { std::string str1 ( (*set)[idx]->identifier() ); if ( strcmp ( (*set)[idx]->identifier(), simple_name ) == 0 ) return MDE::BaseIDL::Contained::_duplicate ( (*set)[idx] ); ++idx; } throw NotFoundInRep ( "Not found", simple_name ); return MDE::BaseIDL::Contained::_nil(); }
AUG_EXTERNC aug_result aug_fieldntop_(aug_seq_t seq, const struct aug_info_* info, unsigned n, const char** name) { char* ptr; assert(seq && info && name); if (n >= info->fields_) { *name = NULL; aug_setexcept(aug_tlx, AUG_EXNONE); return -1; } if (aug_setregion_(seq, AUG_HEADER, info->hsize_) < 0 || !(ptr = aug_seqaddr_(seq))) return -1; *name = name_(ptr + offsetn_(ptr, n)); return 0; }
static unsigned offsetp_(void* begin, const char* name, unsigned* inout) { /* The inout parameter contains the number of fields on input, and the matching ordinal on output. */ char* ptr = begin; unsigned n; for (n = 0; n < *inout; ++n) { unsigned nsize = nsize_(ptr); if (0 == aug_strncasecmp(name, name_(ptr), nsize)) { *inout = n; break; } ptr += fieldsize_(ptr); } return (unsigned)(ptr - (char*)begin); }
char *OpenDDLParser::parseHeader( char *in, char *end ) { if( ddl_nullptr == in || in == end ) { return in; } Text *id( ddl_nullptr ); in = OpenDDLParser::parseIdentifier( in, end, &id ); #ifdef DEBUG_HEADER_NAME dumpId( id ); #endif // DEBUG_HEADER_NAME in = lookForNextToken( in, end ); if( ddl_nullptr != id ) { // store the node DDLNode *node( createDDLNode( id, this ) ); if( ddl_nullptr != node ) { pushNode( node ); } else { std::cerr << "nullptr returned by creating DDLNode." << std::endl; } delete id; Name *name_(ddl_nullptr); in = OpenDDLParser::parseName(in, end, &name_); std::unique_ptr<Name> name(name_); if( ddl_nullptr != name && ddl_nullptr != node ) { const std::string nodeName( name->m_id->m_buffer ); node->setName( nodeName ); } std::unique_ptr<Property> first; in = lookForNextToken(in, end); if (*in == Grammar::OpenPropertyToken[0]) { in++; std::unique_ptr<Property> prop, prev; while (*in != Grammar::ClosePropertyToken[0] && in != end) { Property *prop_(ddl_nullptr); in = OpenDDLParser::parseProperty(in, end, &prop_); prop.reset(prop_); in = lookForNextToken(in, end); if (*in != Grammar::CommaSeparator[0] && *in != Grammar::ClosePropertyToken[0]) { logInvalidTokenError(in, Grammar::ClosePropertyToken, m_logCallback); return ddl_nullptr; } if (ddl_nullptr != prop && *in != Grammar::CommaSeparator[0]) { if (ddl_nullptr == first) { first = std::move(prop); } if (ddl_nullptr != prev) { prev->m_next = prop.release(); } prev = std::move(prop); } } ++in; } // set the properties if (first && ddl_nullptr != node) { node->setProperties(first.release()); } } return in; }
inline Name DeprecatedName(const std::string& name) { Name name_(name); name_.deprecated = true; return name_; }