void GuildShell::dumpMembers(QTextStream& out) { QDateTime dt; GuildMemberDictIterator it(m_members); GuildMember* member; QString format("%1 %2 %3 %4%5%6%7 %8 %9"); QString dateFormat("ddd MMM dd hh:mm:ss yyyy"); // calculate the maximum class name width size_t maxClassNameLength = 0; for (uint8_t i = 1; i <= PLAYER_CLASSES; i++) if (classString(i).length() > maxClassNameLength) maxClassNameLength = classString(i).length(); out << "Guild has " << m_members.count() << " members: " << endl; int nameFieldWidth = - m_maxNameLength; int classFieldWidth = - maxClassNameLength; out << format.arg("Members", nameFieldWidth) .arg("Lv", 2).arg("Class", classFieldWidth) .arg("R", 1) .arg("B", 1) .arg("A", 1) .arg("P", 1) .arg("Last On", -24) .arg("Zone", -18); out << " Public Note" << endl; QString zone; while ((member = it.current())) { dt.setTime_t(member->lastOn()); zone = zoneString(member->zoneId()); if (member->zoneInstance()) zone += ":" + QString::number(member->zoneInstance()); out << format.arg(member->name(), nameFieldWidth) .arg(member->level(), 2).arg(member->classString(), classFieldWidth) .arg(member->guildRankString(), 1) .arg(member->bankRankString(), 1) .arg(member->altRankString(), 1) .arg(member->memberRankString(), 1) .arg(dt.toString(dateFormat), -24) .arg(zone, -18); out << " " << member->publicNote() << endl; ++it; } }
primitiveDropRequestFileName(void) { sqInt dropIndex; char *dropName; sqInt i; sqInt nameLength; sqInt nameOop; char *namePtr; if (!((methodArgumentCount()) == 1)) { return primitiveFail(); } dropIndex = stackIntegerValue(0); /* dropRequestFileName returns name or NULL on error */ dropName = dropRequestFileName(dropIndex); if (dropName == null) { return primitiveFail(); } nameLength = strlen(dropName); nameOop = instantiateClassindexableSize(classString(), nameLength); namePtr = firstIndexableField(nameOop); for (i = 0; i < nameLength; i += 1) { namePtr[i] = (dropName[i]); } pop(2); push(nameOop); return 0; }
primitiveGetUntrustedUserDirectory(void) { sqInt dirLen; char *dirName; sqInt dirOop; char *dirPtr; sqInt i; dirName = ioGetUntrustedUserDirectory(); if ((dirName == null) || (failed())) { return primitiveFail(); } dirLen = strlen(dirName); dirOop = instantiateClassindexableSize(classString(), dirLen); if (failed()) { return null; } dirPtr = firstIndexableField(dirOop); for (i = 0; i < dirLen; i += 1) { dirPtr[i] = (dirName[i]); } popthenPush(1, dirOop); return 0; }
primitiveGetMacintoshFileTypeAndCreatorFrom(void) { char *aFileName; char creator[8]; sqInt i; sqInt keyLength; sqInt oop; char *ptr; success(isBytes(stackValue(0))); aFileName = ((char *) (firstIndexableField(stackValue(0)))); if (failed()) { return null; } keyLength = byteSizeOf(((sqInt)(sqIntptr_t)(aFileName) - BaseHeaderSize)); sqInternetGetMacintoshFileTypeAndCreatorFromkeySizeinto(aFileName, keyLength, creator); oop = instantiateClassindexableSize(classString(), 8); ptr = firstIndexableField(oop); for (i = 0; i <= 7; i += 1) { ptr[i] = (creator[i]); } if (failed()) { return null; } popthenPush(2, oop); return null; }
primitiveErrorAndLog(void) { char *log; sqInt logLen; sqInt logObj; char *logObjData; sqInt resultObj; logLen = 0; log = getlog((&logLen)); resultObj = instantiateClassindexableSize(classArray(), 2); if (resultObj == 0) { primitiveFailFor(PrimErrNoMemory); return null; } storePointerofObjectwithValue(0, resultObj, integerObjectOf(errorAcorn())); if (logLen > 0) { pushRemappableOop(resultObj); logObj = instantiateClassindexableSize(classString(), logLen); if (failed()) { popRemappableOop(); primitiveFailFor(PrimErrNoMemory); return null; } resultObj = popRemappableOop(); logObjData = arrayValueOf(logObj); memcpy(logObjData, log, logLen); storePointerofObjectwithValue(1, resultObj, logObj); } popthenPush(1, resultObj); if (failed()) { return null; } return null; }
primitiveGetStringKeyedBy(void) { char *aKey; char aString[1025]; sqInt i; sqInt keyLength; sqInt oop; char *ptr; sqInt size; success(isBytes(stackValue(0))); aKey = ((char *) (firstIndexableField(stackValue(0)))); if (failed()) { return null; } keyLength = byteSizeOf(((sqInt)(sqIntptr_t)(aKey) - BaseHeaderSize)); size = sqInternetConfigurationGetStringKeyedBykeySizeinto(aKey, keyLength, aString); oop = instantiateClassindexableSize(classString(), size); ptr = firstIndexableField(oop); for (i = 0; i < size; i += 1) { ptr[i] = (aString[i]); } if (failed()) { return null; } popthenPush(2, oop); return null; }
primitiveDisassembleAtInMemory(void) { usqIntptr_t address; void *cpu; sqInt cpuAlien; sqInt instrLenOrErr; sqInt log; sqInt logLen; sqInt logObj; sqInt logObjData; char *memory; sqInt resultObj; logLen = 0; address = (BytesPerOop == 4 ? positive32BitValueOf(stackValue(1)) : positive64BitValueOf(stackValue(1))); success(isWordsOrBytes(stackValue(0))); memory = ((char *) (firstIndexableField(stackValue(0)))); cpuAlien = stackValue(2); if (failed()) { return null; } if (((cpu = ((longAt(cpuAlien + BaseHeaderSize)) > 0 ? (cpuAlien + BaseHeaderSize) + BytesPerOop : longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))) == 0) { primitiveFailFor(PrimErrBadReceiver); return null; } instrLenOrErr = disassembleForAtInSize(cpu, address, memory, byteSizeOf(((sqInt)(sqIntptr_t)(memory) - BaseHeaderSize))); if (instrLenOrErr < 0) { primitiveFailFor(PrimErrInappropriate); return null; } log = getlog((&logLen)); resultObj = instantiateClassindexableSize(classArray(), 2); if (resultObj == 0) { primitiveFailFor(PrimErrNoMemory); return null; } pushRemappableOop(resultObj); logObj = instantiateClassindexableSize(classString(), logLen); if (failed()) { popRemappableOop(); primitiveFailFor(PrimErrNoMemory); return null; } logObjData = arrayValueOf(logObj); memcpy(logObjData, log, logLen); resultObj = popRemappableOop(); storePointerofObjectwithValue(0, resultObj, integerObjectOf(instrLenOrErr)); storePointerofObjectwithValue(1, resultObj, logObj); if (failed()) { return null; } popthenPush(3, resultObj); return null; }
QString Item::filterString() const { QString buff; buff.sprintf("Name:%s:Race:%s:Class:%s:NPC:%d:X:%d:Y:%d:Z:%d", (const char*)transformedName(), (const char*)raceString(), (const char*)classString(), NPC(), x(), y(), z()); return buff; }
static sqInt makeDirEntryNamesizecreateDatemodDateisDirfileSizeposixPermissionsisSymlink(char *entryName, sqInt entryNameSize, sqInt createDate, sqInt modifiedDate, sqInt dirFlag, squeakFileOffsetType fileSize, sqInt posixPermissions, sqInt symlinkFlag) { // FilePlugin>>#makeDirEntryName:size:createDate:modDate:isDir:fileSize:posixPermissions:isSymlink: sqInt createDateOop; sqInt fileSizeOop; sqInt i; sqInt modDateOop; sqInt nameString; sqInt posixPermissionsOop; sqInt results; char *stringPtr; /* allocate storage for results, remapping newly allocated oops in case GC happens during allocation */ pushRemappableOop(instantiateClassindexableSize(classArray(), 7)); pushRemappableOop(instantiateClassindexableSize(classString(), entryNameSize)); pushRemappableOop(positive32BitIntegerFor(createDate)); pushRemappableOop(positive32BitIntegerFor(modifiedDate)); pushRemappableOop(positive64BitIntegerFor(fileSize)); pushRemappableOop(positive32BitIntegerFor(posixPermissions)); posixPermissionsOop = popRemappableOop(); fileSizeOop = popRemappableOop(); modDateOop = popRemappableOop(); createDateOop = popRemappableOop(); nameString = popRemappableOop(); /* copy name into Smalltalk string */ results = popRemappableOop(); stringPtr = firstIndexableField(nameString); for (i = 0; i < entryNameSize; i += 1) { stringPtr[i] = (entryName[i]); } storePointerofObjectwithValue(0, results, nameString); storePointerofObjectwithValue(1, results, createDateOop); storePointerofObjectwithValue(2, results, modDateOop); if (dirFlag) { storePointerofObjectwithValue(3, results, trueObject()); } else { storePointerofObjectwithValue(3, results, falseObject()); } storePointerofObjectwithValue(4, results, fileSizeOop); storePointerofObjectwithValue(5, results, posixPermissionsOop); if (symlinkFlag) { storePointerofObjectwithValue(6, results, trueObject()); } else { storePointerofObjectwithValue(6, results, falseObject()); } return results; }
void PluginScanInfoStruct::dump(const char* prefixMessage) const { fprintf(stderr, "%s plugin:%s type:%s class:%s name:%s label:%s required features:%d\n", prefixMessage, PLUGIN_GET_CSTRING(filePath()), typeString(), classString(), PLUGIN_GET_CSTRING(_name), PLUGIN_GET_CSTRING(_label), _requiredFeatures); }
/* AioPlugin>>#stringFromCString: */ static sqInt stringFromCString(const char *aCString) { sqInt len; sqInt newString; len = strlen(aCString); newString = instantiateClassindexableSize(classString(), len); strncpy(arrayValueOf(newString), aCString, len); return newString; }
primitiveLanguage(void) { sqInt oop; oop = instantiateClassindexableSize(classString(), 3); sqLocGetLanguageInto(firstIndexableField(oop)); if (failed()) { return null; } popthenPush(1, oop); return null; }
primitiveDigitGroupingSymbol(void) { sqInt oop; oop = instantiateClassindexableSize(classString(), 1); sqLocGetDigitGroupingSymbolInto(firstIndexableField(oop)); if (failed()) { return null; } popthenPush(1, oop); return null; }
primitiveDecimalSymbol(void) { // LocalePlugin>>#primitiveDecimalSymbol sqInt oop; oop = instantiateClassindexableSize(classString(), 1); sqLocGetDecimalSymbolInto(firstIndexableField(oop)); if (failed()) { return null; } popthenPush(1, oop); return null; }
primitiveCountry(void) { // LocalePlugin>>#primitiveCountry sqInt oop; oop = instantiateClassindexableSize(classString(), 3); sqLocGetCountryInto(firstIndexableField(oop)); if (failed()) { return null; } popthenPush(1, oop); return null; }
primitiveTimeFormat(void) { sqInt length; sqInt oop; length = sqLocTimeFormatSize(); oop = instantiateClassindexableSize(classString(), length); sqLocGetTimeFormatInto(firstIndexableField(oop)); if (failed()) { return null; } popthenPush(1, oop); return null; }
primitiveCurrencySymbol(void) { sqInt length; sqInt oop; length = sqLocCurrencySymbolSize(); oop = instantiateClassindexableSize(classString(), length); sqLocGetCurrencySymbolInto(firstIndexableField(oop)); if (failed()) { return null; } popthenPush(1, oop); return null; }
primitiveShortDateFormat(void) { // LocalePlugin>>#primitiveShortDateFormat sqInt length; sqInt oop; length = sqLocShortDateFormatSize(); oop = instantiateClassindexableSize(classString(), length); sqLocGetShortDateFormatInto(firstIndexableField(oop)); if (failed()) { return null; } popthenPush(1, oop); return null; }
/* RePlugin>>#allocateStringAndSetRcvrErrorStrFromCStr: */ static sqInt allocateStringAndSetRcvrErrorStrFromCStr(const char *aCStrBuffer) { sqInt errorStrObj; void *errorStrObjPtr; sqInt length; /* Allocate errorStrObj */ length = strlen(aCStrBuffer); errorStrObj = instantiateClassindexableSize(classString(), length); /* begin loadRcvrFromStackAt: */ rcvr = stackObjectValue(0); errorStrObjPtr = arrayValueOf(errorStrObj); memcpy(errorStrObjPtr,aCStrBuffer,length); /* begin rcvrErrorStrFrom: */ storePointerofObjectwithValue(4, rcvr, errorStrObj); return errorStrObj; }
primitiveGetStringProperty(void) { sqInt handle; sqInt i; char *oopPtr; sqInt propID; sqInt stringLen; sqInt stringOop; char *stringPtr; if (!((methodArgumentCount()) == 2)) { return primitiveFail(); } propID = stackIntegerValue(0); handle = stackIntegerValue(1); if (failed()) { return null; } stringPtr = sqGetStringPropertySSL(handle, propID); if (failed()) { return null; } if (stringPtr == null) { stringOop = nilObject(); } else { stringLen = strlen(stringPtr); stringOop = instantiateClassindexableSize(classString(), stringLen); oopPtr = firstIndexableField(stringOop); for (i = 0; i < stringLen; i += 1) { oopPtr[i] = (stringPtr[i]); } } popthenPush((methodArgumentCount()) + 1, stringOop); return 0; }
// ----------------------------------------------------------------------------- // CPIMEventPropertyConverter::ConvertClassFieldL // Converts Event.CLASS field to a vCalendar. // ----------------------------------------------------------------------------- // void CPIMEventPropertyConverter::ConvertClassFieldL(const CPIMItem& aItem, CParserVCalEntity& aParser, TPIMEventField aField, TInt aIndex) { JELOG2(EPim); const TInt classVal = aItem.getInt(aField, aIndex); TPtrC classString(KPIMClassStringConfidential); switch (classVal) { case EPIMEventClassConfidential: { classString.Set(KPIMClassStringConfidential); break; } case EPIMEventClassPrivate: { classString.Set(KPIMClassStringPrivate); break; } case EPIMEventClassPublic: { classString.Set(KPIMClassStringPublic); break; } default: { __ASSERT_DEBUG(EFalse, User::Invariant()); break; } } CParserPropertyValue* propertyValue = CParserPropertyValueHBufC::NewL( classString); AddPropertyToParserL(propertyValue, KVersitTokenCLASS(), aParser); // Needed cleanup stack items are popped out in the AddPropretyToParserL }
void GuildShell::guildMemberList(const uint8_t* data, size_t len) { // clear out any existing member data emit cleared(); m_members.clear(); m_maxNameLength = 0; // construct a netstream object on the data NetStream gml(data, len); // read the player name from the front of the stream QString player = gml.readText(); // read the player count from the stream uint32_t count; count = gml.readUInt32(); #ifdef GUILDSHELL_DIAG seqDebug("Guild has %d members:", count); #endif GuildMember* member; #ifdef GUILDSHELL_DIAG QDateTime dt; #endif // GUILDSHELL_DIAG // iterate over the data until we reach the end of it while (!gml.end()) { // create a new guildmember initializing it from the NetStream member = new GuildMember(gml); // insert the new member into the dictionary m_members.insert(member->name(), member); // check for new longest member name if (member->name().length() > m_maxNameLength) m_maxNameLength = member->name().length(); emit added(member); #ifdef GUILDSHELL_DIAG dt.setTime_t(member->lastOn()); seqDebug("%-64s\t%d\t%s\t%d\t%s\t'%s'\t%s:%d", (const char*)member->name(), member->level(), (const char*)classString(member->classVal()), member->guildRank(), (const char*)dt.toString(), (const char*)member->publicNote(), (const char*)m_zoneMgr->zoneNameFromID(member->zoneId()), member->zoneInstance()); #endif } emit loaded(); #ifdef GUILDSHELL_DIAG seqDebug("Finished processing %d guildmates. %d chars in longest name.", m_members.count(), m_maxNameLength); #endif // }
primitiveExecutableModulesAndOffsets(void) { const struct mach_header *h; const struct mach_header_64 *h64; sqInt i; const char *name; char *nameObjData; sqInt nimages; sqInt resultObj; const struct section *s; const struct section_64 *s64; usqIntptr_t size; usqIntptr_t slide; usqIntptr_t start; sqInt valueObj; # if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 /* _dyld_present was deprecated in 10.5 */ if (!(_dyld_present())) { return primitiveFail(); } # endif /* MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 */ nimages = _dyld_image_count(); resultObj = instantiateClassindexableSize(classArray(), nimages * 4); if (resultObj == 0) { return primitiveFail(); } pushRemappableOop(resultObj); for (i = 0; i < nimages; i += 1) { /* impossible start & size */ start = (size = -1); name = _dyld_get_image_name(i); slide = _dyld_get_image_vmaddr_slide(i); # if __x86_64__ h64 = (const struct mach_header_64 *)_dyld_get_image_header(i); if (!(h64 == null)) { s64 = getsectbynamefromheader_64(h64,SEG_TEXT,SECT_TEXT); if (!(s64 == null)) { start = s64->addr; size = s64->size; } } # else /* __x86_64__ */ h = _dyld_get_image_header(i); if (!(h == null)) { s = getsectbynamefromheader(h,SEG_TEXT,SECT_TEXT); if (!(s == null)) { start = s->addr; size = s->size; } } # endif /* __x86_64__ */ valueObj = instantiateClassindexableSize(classString(), strlen(name)); if (failed()) { popRemappableOop(); return primitiveFail(); } storePointerofObjectwithValue(i * 4, topRemappableOop(), valueObj); nameObjData = arrayValueOf(valueObj); memcpy(nameObjData, name, strlen(name)); valueObj = (BytesPerWord == 8 ? signed64BitIntegerFor(slide) : signed32BitIntegerFor(slide)); if (failed()) { popRemappableOop(); return primitiveFail(); } storePointerofObjectwithValue((i * 4) + 1, topRemappableOop(), valueObj); /* begin positiveMachineIntegerFor: */ valueObj = (BytesPerWord == 8 ? positive64BitIntegerFor(start) : positive32BitIntegerFor(start)); if (failed()) { popRemappableOop(); return primitiveFail(); } storePointerofObjectwithValue((i * 4) + 2, topRemappableOop(), valueObj); /* begin positiveMachineIntegerFor: */ valueObj = (BytesPerWord == 8 ? positive64BitIntegerFor(size) : positive32BitIntegerFor(size)); if (failed()) { popRemappableOop(); return primitiveFail(); } storePointerofObjectwithValue((i * 4) + 3, topRemappableOop(), valueObj); } resultObj = popRemappableOop(); return popthenPush(1, resultObj); }