/* * Overriden input setup method. Sets our defaults input for the controlled * character. */ void ABasePlayerController::SetupInputComponent() { InputComponent = ConstructObject<UInputComponent>(UInputComponent::StaticClass(), this, TEXT("PC_InputComponent0")); InputComponent->RegisterComponent(); //Check if valid check(InputComponent); //GAME PAD MAPPINGS TArray<FCustomBindingData> bindings1; bindings1.Add(FCustomBindingData(InputComponent->BindAxis("leftstick_vertical", this, &ABasePlayerController::MoveVertically))); bindings1.Add(FCustomBindingData(InputComponent->BindAxis("leftstick_horizontal", this, &ABasePlayerController::MoveHorizontally))); InputBindings.Add(GetEnumValue(EBindingAction::Movement), UCustomActionBindingComponent(bindings1)); TArray<FCustomBindingData> bindings2; bindings2.Add(FCustomBindingData(InputComponent->BindAxis("rightstick_vertical", this, &ABasePlayerController::RotateCameraVertically))); bindings2.Add(FCustomBindingData(InputComponent->BindAxis("rightstick_horizontal", this, &ABasePlayerController::RotateCameraHorizontally))); InputBindings.Add(GetEnumValue(EBindingAction::CameraMovement), UCustomActionBindingComponent(bindings2)); TArray<FCustomBindingData> bindings3; bindings3.Add(FCustomBindingData(InputComponent->BindAction("a_button", IE_Pressed, this, &ABasePlayerController::Jump))); bindings3.Add(FCustomBindingData(InputComponent->BindAction("a_button", IE_Released, this, &ABasePlayerController::StopJumping))); InputBindings.Add(GetEnumValue(EBindingAction::Jump), UCustomActionBindingComponent(bindings3)); //KEYBOARD MAPPINGS InputComponent->BindAxis("mouse_y", this, &ABasePlayerController::AddPitchInput); InputComponent->BindAxis("mouse_x", this, &ABasePlayerController::AddYawInput); }
/* * Method that blocks the input for the Local player. */ void ABasePlayerController::BlockInput_Implementation(EBindingAction Action) { UCustomActionBindingComponent* BindingComp = InputBindings.Find(GetEnumValue(Action)); if (!BindingComp) return; // Unbind and lock it so it cannot be used BindingComp->UnbindAction(InputComponent); BindingComp->SetLocked(true); }
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes, nsRuleData* aData) { if (aData->mSID == eStyleStruct_List) { if (aData->mListData->mType.GetUnit() == eCSSUnit_Null) { // type: enum const nsAttrValue* value = aAttributes->GetAttr(nsHTMLAtoms::type); if (value && value->Type() == nsAttrValue::eEnum) aData->mListData->mType.SetIntValue(value->GetEnumValue(), eCSSUnit_Enumerated); } } nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); }
/* * Method that allows input for an action. */ void ABasePlayerController::AllowInput_Implementation(EBindingAction Action) { UCustomActionBindingComponent* BindingComp = InputBindings.Find(GetEnumValue(Action)); if (!BindingComp) return; // Unlock and bind action if binded by default BindingComp->SetLocked(false); // If is binded by default, bind the control, else wait for it to be binded if (BindingComp->IsBindedByDefault()) { BindingComp->BindAction(InputComponent); } }
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes, nsRuleData* aData) { if (aData->mSIDs & NS_STYLE_INHERIT_BIT(List)) { nsCSSValue* listStyleType = aData->ValueForListStyleType(); if (listStyleType->GetUnit() == eCSSUnit_Null) { // type: enum const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::type); if (value && value->Type() == nsAttrValue::eEnum) listStyleType->SetIntValue(value->GetEnumValue(), eCSSUnit_Enumerated); } } nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); }
PRBool nsAttrValue::ParseEnumValue(const nsAString& aValue, const EnumTable* aTable, PRBool aCaseSensitive, const EnumTable* aDefaultValue) { ResetIfSet(); const EnumTable* tableEntry = aTable; while (tableEntry->tag) { if (aCaseSensitive ? aValue.EqualsASCII(tableEntry->tag) : aValue.LowerCaseEqualsASCII(tableEntry->tag)) { PRInt32 value = EnumTableEntryToValue(aTable, tableEntry); PRBool equals = aCaseSensitive || aValue.EqualsASCII(tableEntry->tag); if (!equals) { nsAutoString tag; tag.AssignASCII(tableEntry->tag); ToUpperCase(tag); if ((equals = tag.Equals(aValue))) { value |= NS_ATTRVALUE_ENUMTABLE_VALUE_NEEDS_TO_UPPER; } } SetIntValueAndType(value, eEnum, equals ? nsnull : &aValue); NS_ASSERTION(GetEnumValue() == tableEntry->value, "failed to store enum properly"); return PR_TRUE; } tableEntry++; } if (aDefaultValue) { NS_PRECONDITION(aTable <= aDefaultValue && aDefaultValue < tableEntry, "aDefaultValue not inside aTable?"); SetIntValueAndType(EnumTableEntryToValue(aTable, aDefaultValue), eEnum, &aValue); return PR_TRUE; } return PR_FALSE; }
PRBool nsAttrValue::ParseEnumValue(const nsAString& aValue, const EnumTable* aTable, PRBool aCaseSensitive) { ResetIfSet(); const EnumTable* tableEntry = aTable; while (tableEntry->tag) { if (aCaseSensitive ? aValue.EqualsASCII(tableEntry->tag) : aValue.LowerCaseEqualsASCII(tableEntry->tag)) { PRInt16 index; if (!GetEnumTableIndex(aTable, index)) { return PR_FALSE; } PRInt32 value = (tableEntry->value << NS_ATTRVALUE_ENUMTABLEINDEX_BITS) + index; PRBool equals = aCaseSensitive || aValue.EqualsASCII(tableEntry->tag); if (!equals) { nsAutoString tag; tag.AssignASCII(tableEntry->tag); ToUpperCase(tag); if ((equals = tag.Equals(aValue))) { value |= NS_ATTRVALUE_ENUMTABLE_VALUE_NEEDS_TO_UPPER; } } SetIntValueAndType(value, eEnum, equals ? nsnull : &aValue); NS_ASSERTION(GetEnumValue() == tableEntry->value, "failed to store enum properly"); return PR_TRUE; } tableEntry++; } return PR_FALSE; }
PRBool nsAttrValue::ParseEnumValue(const nsAString& aValue, const EnumTable* aTable, PRBool aCaseSensitive) { ResetIfSet(); while (aTable->tag) { if (aCaseSensitive ? aValue.EqualsASCII(aTable->tag) : aValue.LowerCaseEqualsASCII(aTable->tag)) { // Find index of EnumTable PRInt16 index = sEnumTableArray->IndexOf(aTable); if (index < 0) { index = sEnumTableArray->Length(); NS_ASSERTION(index <= NS_ATTRVALUE_ENUMTABLEINDEX_MAXVALUE, "too many enum tables"); if (!sEnumTableArray->AppendElement(aTable)) { return PR_FALSE; } } PRInt32 value = (aTable->value << NS_ATTRVALUE_ENUMTABLEINDEX_BITS) + index; SetIntValueAndType(value, eEnum); NS_ASSERTION(GetEnumValue() == aTable->value, "failed to store enum properly"); return PR_TRUE; } aTable++; } return PR_FALSE; }
short Directives() { int t; SkipWhiteSpace(); if (*FilePtr != '.') return 0; DataCharPtr = FilePtr; if (QToken(".eof")) { // mark end of label array as end of bss strcpy(Name, "_________eof_________"); Section = SECT_bss; DefineLabel(label_Local); SourceFileCheckEOF(LastTokenPtr() - FileTop); EndFile = 1; return 1; } GetToken(); t = ScanAsmToken(); switch(t) { //--------------------------------------------------------- case 0: Error(Error_Skip, "Illegal directive '%s'",Name); //--------------------------------------------------------- case dir_sourcefile: { int file; SkipWhiteSpace(); GetLFileName(); // SetCSourceFile(Name); file = SetSLD_Name(Name); SetCSourceFile(Name, file); return 1; } //--------------------------------------------------------- case dir_model: { int model=0; if (Token("full")) // Get return type model = MODEL_full; else if (Token("half")) // Get return type model = MODEL_half; else if (Token("compact")) // Get return type model = MODEL_compact; else if (Token("mini")) // Get return type model = MODEL_mini; else if (Token("tiny")) // Get return type model = MODEL_tiny; else Error(Error_Fatal, "invalid model type"); // if model is not set then set it if (!CurrentModel) CurrentModel = model; else { if (model != CurrentModel) Error(Error_Fatal, "multiple architectual models defined"); } return 1; } //--------------------------------------------------------- case dir_ctor: { SYMBOL* ref; imm = GetExpression(); // Get the number ref = GetLastSymbolRef(); if(pass_count > 1) { if (!ref) Error(Error_Fatal, "Constructor has bad reference"); ArraySet(&CtorArrayImm, CtorCount, imm); ArraySet(&CtorArray, CtorCount++, (int) ref); } return 1; } //--------------------------------------------------------- case dir_dtor: { SYMBOL* ref; imm = GetExpression(); // Get the number ref = GetLastSymbolRef(); if(pass_count > 1) { if (!ref) Error(Error_Fatal, "Destructor has bad reference"); ArraySet(&DtorArrayImm, DtorCount, imm); ArraySet(&DtorArray, DtorCount++, (int) ref); } return 1; } //--------------------------------------------------------- case dir_sourcedir: { SkipWhiteSpace(); GetLFileName(); SetCSourceDir(Name); return 1; } //--------------------------------------------------------- case dir_line: { int v; SkipWhiteSpace(); v = GetNum(); SetCSourceLine(v); SetSLD_Line(v); return 1; } //--------------------------------------------------------- case dir_dlab: { if (!ArgUseStabs) { SkipLine(); // Skip excess debug labels return 1; } // Define a label Section = SECT_code; GetAsmName(); DefineLabel(label_Local); return 1; } //--------------------------------------------------------- case dir_library: { SkipLine(); return 1; } //--------------------------------------------------------- case dir_exit: { if (NextToken("\"")) { GetStringName(1024); Error(Error_Fatal, "User: %s", Name); return 1; } Error(Error_Fatal, "Exiting with user error"); return 1; } //--------------------------------------------------------- case dir_asm_on: { return 1; } //--------------------------------------------------------- case dir_asm_off: { /* if (QToken(".asm_off")) { return 1; } */ return 1; } //--------------------------------------------------------- case dir_AllowFarBranches: { AllowFarBranches = 1; return 1; } //--------------------------------------------------------- case dir_bp: { return 1; } //--------------------------------------------------------- case dir_localscope: { SkipWhiteSpace(); if (Token("+")) { LocalScope++; return 1; } if (Token("reset")) { LocalScope = 1; return 1; } Error(Error_Fatal, "Bad .localscope type"); return 1; } //--------------------------------------------------------- case dir_func: { Function_Return_Type = RET_void; GetName(); ReplaceChar(Name, '.', '_'); Function_Param_Count = -1; if (Token(",")) { Function_Param_Count = GetNum(); if (Token(",")) // Get param count { if (Token("int")) // Get return type Function_Return_Type = RET_int; else if (Token("float")) Function_Return_Type = RET_float; else if (Token("double")) Function_Return_Type = RET_double; else if (Token("void")) Function_Return_Type = RET_void; else if (Token("?")) Function_Return_Type = RET_double; //patch fix } } DefineLabel(label_Function); return 1; } //--------------------------------------------------------- case dir_local: { GetName(); return 1; } //--------------------------------------------------------- case dir_vec_elt: { GetName(); return 1; } //--------------------------------------------------------- case dir_syscall: { char SysCallName[256]; char istr[4096]; char *iptr = 0; int v, p, r; p = 0; r = RET_void; GetName(); strcpy(SysCallName,Name); SkipWhiteSpace(); v = GetExpression(); if (Token(",")) // Get param count { p = GetExpression(); NeedToken(","); if (Token("int")) // Get return type r = RET_int; else if (Token("float")) r = RET_float; else if (Token("double")) r = RET_double; else if (Token("void")) r = RET_void; if (Token(",")) // Get interface { GetStringName(2048); strcpy(istr,Name); iptr = istr; } } if (Pass == 1) MapSysCall(SysCallName, v, p, r, iptr); return 1; } //--------------------------------------------------------- case dir_lfile: { SkipWhiteSpace(); GetLFileName(); strcpy(CurrentFile, Name); // CurrentFileLine = GetLineNumber(FileTop,GetPrevFilePtr()); AddFileSym(Name, LocalScope+1); GetRelPath(CurrentFile); return 1; } //--------------------------------------------------------- case dir_org: { int v = GetExpression(); if (v >= MAX_CODE_MEM) Error(Error_Fatal, ".org has illegal address"); CodeIP = v; //! CodePtr = &CodeMem[v]; printf("*Warning* org %x\n", v); return 1; } //--------------------------------------------------------- case dir_set: { SkipWhiteSpace(); // Catch Thunks if (Token("%")) { SYMBOL *ThunkSym; int v; v = GetDecNum(5); if (GetDecNumDigitCount() == 0) Error(Error_Fatal, "Missing Thunk Number"); NeedToken("="); SkipWhiteSpace(); GetName(); // Get the name of the thunk alias GetEnumValue(Name); // Evaluate the symbol ThunkSym = GetLastSymbolRef(); //N_FUN 141 4935 '_Z7XPClosev:F(0,6)' StabsEmit("N_THUNK %d %d '%s'\n", v, ThunkSym, Name); RegisterThunk(v, ThunkSym); return 1; } // Catch normal sets GetName(); // Get the new type Name NeedToken("="); RedefENum(Name, GetExpression()); return 1; } //--------------------------------------------------------- case dir_debug: { DEBUG = (short)GetExpression(); return 1; } //--------------------------------------------------------- case dir_info: { INFO = (short)GetExpression(); return 1; } //--------------------------------------------------------- case dir_list: { LIST = (short)GetExpression(); return 1; } //--------------------------------------------------------- case dir_show: { int exp = GetExpression(); if (Pass == 1) printf("%d",exp); if (!Token(";")) if (Pass == 1) printf("\n"); return 1; } //--------------------------------------------------------- case dir_print: //if (QToken(".print") || QToken(".?")) { int exp; char v; if (Token("\"")) { while(1) { v = *FilePtr; if (v == 0 || v == '"') break; printf("%c",v); FilePtr++; } NeedToken("\""); if (!Token(";")) printf("\n"); return 1; } exp = GetExpression(); printf("%d",exp); if (!Token(";")) printf("\n"); return 1; } //--------------------------------------------------------- case dir_ifdef: { GetName(); // Get the new type Name SkipWhiteSpace(); if (!SymbolExists(Name, section_Script, -1)) { if (NextToken("{")) { SkipPair('{','}'); } } return 1; } //--------------------------------------------------------- case dir_ifdefglobal: { GetName(); // Get the new type Name SkipWhiteSpace(); if (!SymbolExists(Name, section_Enum, 0)) { if (NextToken("{")) { SkipPair('{','}'); } } return 1; } //--------------------------------------------------------- case dir_ifndefglobal: { GetName(); // Get the new type Name SkipWhiteSpace(); if (SymbolExists(Name, section_Enum, 0)) { if (NextToken("{")) { SkipPair('{','}'); } } return 1; } //--------------------------------------------------------- case dir_ifndef: { GetName(); // Get the new type Name SkipWhiteSpace(); if (SymbolExists(Name, section_Script, -1)) { if (NextToken("{")) { SkipPair('{','}'); } } return 1; } //--------------------------------------------------------- case dir_if: { if (!GetExpression()) { SkipWhiteSpace(); if (NextToken("{")) { SkipPair('{','}'); } } return 1; } //--------------------------------------------------------- case dir_do: { // If we have a '{' just ignore it an keep going if (Token("{")) return 1; // Must be an expression then // if false then skip to while if (!GetExpression()) { SearchScopeForward(); NeedToken(".enddo"); } return 1; } //--------------------------------------------------------- case dir_enddo: { FilePtr = SearchScope(FilePtr); return 1; } //--------------------------------------------------------- case dir_while: { if (GetExpression()) { FilePtr = SearchScope(FilePtr); } return 1; } //--------------------------------------------------------- case dir_enum: { AsmEnums(); return 1; } //--------------------------------------------------------- case dir_breakpoint: { SkipWhiteSpace(); return 1; } //--------------------------------------------------------- case dir_globals_in_code: { GlobalsInCode = 1; SkipWhiteSpace(); return 1; } //--------------------------------------------------------- case dir_globl: // if (QToken(".globl") || QToken(".global") || QToken(".weak")) { unsigned int n; GetAsmName(); if (GlobalsInCode && (Section == SECT_code)) { //! *CodePtr++ = '*'; ArraySet(&CodeMemArray, CodeIP, '*'); CodeIP++; for (n=0;n<strlen(Name);n++) { //! *CodePtr++ = Name[n]; ArraySet(&CodeMemArray, CodeIP, Name[n]); CodeIP++; } //! *CodePtr++ = '*'; ArraySet(&CodeMemArray, CodeIP, '*'); CodeIP++; } if (LIST) printf("Found global '%s'\n",Name); DefineLabelGlobal(); //#ifdef INCLUDE_JAVAGEN // if (JavaPass) // JavaGen_Global(Name); //#endif SkipWhiteSpace(); return 1; } //--------------------------------------------------------- case dir_extern: // if (QToken(".extern") || QToken(".extrn")) { GetAsmName(); if (LIST) printf("Found external '%s'\n",Name); // SHOULD DO NOTHING //ExternDecl(Name); SkipWhiteSpace(); return 1; } //--------------------------------------------------------- case dir_byte: { SetAsmDataChar(); do { imm = GetExpression(); // Get the number WriteDataTypeArray(dir_byte, 1); WriteByte(imm); } while (QToken(",")); return 1; } //--------------------------------------------------------- case dir_half: { SetAsmDataChar(); do { imm = GetExpression(); // Get the number WriteDataTypeArray(dir_half, 2); WriteWord(imm); } while (QToken(",")); return 1; } //--------------------------------------------------------- case dir_word: { SYMBOL *ref; if (Section != SECT_data) Error(Error_Skip,"data word in not in data section"); SetAsmDataChar(); do { imm = GetExpression(); // Get the number WriteDataTypeArray(dir_word, 4); ref = GetLastSymbolRef(); WriteLongRef(imm, ref); } while (QToken(",")); return 1; } //--------------------------------------------------------- case dir_space: { SetAsmDataChar(); imm = GetExpression(); // Get the number if (LIST) printf("space %d\n",imm); if (!imm) return 1; WriteDataTypeArray(dir_space, imm); do { WriteByteSpace(0); } while(--imm); return 1; } //--------------------------------------------------------- case dir_string: { SetAsmDataChar(); WriteDataTypeArray(dir_string, 1); GetStrings(); return 1; } //--------------------------------------------------------- case dir_comm: { int LastSect = Section; SetAsmDataChar(); Section = SECT_bss; GetAsmName(); //!! make this global too DefineLabelGlobal(); DefineLabel(label_Local); NeedToken(","); imm = GetExpression(); // Get the number if (LIST) printf("comm %d to .bss\n",imm); if (imm == 0) return 1; WriteDataTypeArray(dir_comm, imm); BssIP += imm; Section = LastSect; return 1; } //--------------------------------------------------------- case dir_lcomm: { int LastSect = Section; SetAsmDataChar(); Section = SECT_bss; GetAsmName(); DefineLabel(label_Local); NeedToken(","); imm = GetExpression(); // Get the number if (LIST) printf("lcomm %d to .bss\n",imm); if (imm == 0) return 1; WriteDataTypeArray(dir_lcomm, imm); BssIP += imm; Section = LastSect; return 1; } //--------------------------------------------------------- case dir_align: { imm = GetExpression(); // Get the number if (Section == SECT_code) return 1; AddAlignRef(imm); return 1; } //--------------------------------------------------------- case dir_bss: { Section = SECT_bss; if (LIST) printf("** Section .bss IP = %x\n",BssIP); return 1; } //--------------------------------------------------------- case dir_data: { Section = SECT_data; if (LIST) printf("** Section .data IP = %x\n",DataIP); return 1; } //--------------------------------------------------------- case dir_code: // if (QToken(".code") || QToken(".text")) { Section = SECT_code; if (LIST) printf("** Section .code IP = %x\n",CodeIP); return 1; } //--------------------------------------------------------- case dir_ent: { SkipLine(); return 1; } //--------------------------------------------------------- case dir_end: return 1; //--------------------------------------------------------- case dir_stabs: { Parse_stabs(); //SkipLine(); return 1; } //--------------------------------------------------------- case dir_stabn: { Parse_stabn(); //SkipLine(); return 1; } //--------------------------------------------------------- case dir_stabd: { SkipLine(); return 1; } //--------------------------------------------------------- } // End of switch return 0; }
/** Convert a PyObject to a TValue as used when calling functions and setting properties in a generic way through Delphi RTTI. * \param O: PyObject to convert * \param TypeInfo: The expected return type * \return A TValue with a value of the type given by TypeInfo. * \throw EPyVclError on conversion errors. */ TValue ToValue(PyObject *O, TTypeInfo *TypeInfo) { TValue Result; switch(TypeInfo->Kind) { case tkClass: if(VclObject_Check(O)) Result = TValue::From(VclObject_AsObject(O)); else if(O == Py_None || PyLong_Check(O)) Result = TValue::From((TObject*)(O == Py_None ? NULL : PyLong_AsLong(O))); else throw EPyVclError("Cannot convert Python object of type '" + String(O->ob_type->tp_name) + "' to '" + AnsiString(TypeInfo->Name) + "'"); break; case tkEnumeration: if(PyUnicode_Check(O)) TValue::Make(GetEnumValue(TypeInfo, PyUnicode_AsUnicode(O)), TypeInfo, Result); if(PyLong_Check(O)) TValue::Make(PyLong_AsLong(O), TypeInfo, Result); break; case tkSet: TValue::Make(StringToSet(TypeInfo, PyUnicode_AsUnicode(O)), TypeInfo, Result); break; case tkInteger: Result = TValue::From(PyLong_AsUnsignedLongMask(O)); break; case tkUString: case tkString: case tkLString: case tkWString: Result = TValue::From(String(PyUnicode_AsUnicode(O))); break; case tkChar: case tkWChar: if(PyUnicode_GetSize(O) != 1) throw EPyVclError("Expected string with one character"); Result = TValue::From(PyUnicode_AsUnicode(O)[0]); break; case tkFloat: Result = TValue::From(PyFloat_AsDouble(O)); break; case tkRecord: { TRttiType *Type = Context.GetType(TypeInfo); std::vector<BYTE> Data(Type->TypeSize); DynamicArray<TRttiField*> Fields = Type->GetFields(); if(PyTuple_Size(O) != Fields.Length) throw EPyVclError("Expected tuple with " + IntToStr(Fields.Length) + " elements"); for(int I = 0; I < Fields.Length; I++) Fields[I]->SetValue(&Data[0], ToValue(PyTuple_GetItem(O, I), Fields[I]->FieldType->Handle)); TValue::Make(&Data[0], TypeInfo, Result); break; } case tkInt64: Result = TValue::From(PyLong_AsLongLong(O)); break; case tkPointer: if(AnsiString(TypeInfo->Name) == "PWideChar") TValue::Make(reinterpret_cast<int>(PyUnicode_AsUnicode(O)), TypeInfo, Result); else throw EPyVclError("Cannot convert Python object of type '" + String(O->ob_type->tp_name) + "' to '" + AnsiString(TypeInfo->Name) + "'"); break; case tkVariant: case tkArray: case tkInterface: case tkDynArray: case tkClassRef: case tkProcedure: case tkUnknown: case tkMethod: default: throw EPyVclError("Cannot convert Python object of type '" + String(O->ob_type->tp_name) + "' to '" + AnsiString(TypeInfo->Name) + "'"); } if(PyErr_Occurred()) throw EPyVclError("Cannot convert Python object of type '" + String(O->ob_type->tp_name) + "' to '" + AnsiString(TypeInfo->Name) + "'"); return Result; }
void ChangeData(VARINFO *info, char *text, int page) { if (info->type >= eFloat && info->type <= eImaginaryLongDouble) { float v; double v2; char data[10]; sscanf(text, "%f", &v); switch (info->type) { case eFloat: case eImaginary: WriteValue(info->address, &v, 4, &info->thread->regs); break; case eDouble: case eImaginaryDouble: v2 = v; WriteValue(info->address, &v2, 8, &info->thread->regs); break; case eLongDouble: case eImaginaryLongDouble: *(long double*)data = v; WriteValue(info->address, data, 10, &info->thread->regs); break; default: break; } } else if (info->type >= eComplex && info->type <= eComplexLongDouble) { float v[2]; double v2[2]; long double v4[2]; sscanf(text, "%f + %f * I", &v[0],&v[1]); switch (info->type) { case eComplex: WriteValue(info->address, &v[0], 8, &info->thread->regs); break ; case eComplexDouble: v2[0] = v[0]; v2[1] = v[1]; WriteValue(info->address, &v2[0], 16, &info->thread->regs); break ; case eComplexLongDouble: v4[0] = v[0]; v4[1] = v[1]; WriteValue(info->address, &v4[0], 20, &info->thread->regs); break ; } } else { LLONG_TYPE value; int size; if (info->enumx && !isdigit(text[0])) { value = GetEnumValue(watchinfo_list[page][info->watchindex].dbg_info, info, text); size = 4; } else { if (text[0] == '0' && text[1] == 'x') sscanf(text + 2, "%Lx", &value); else if ((text[strlen(text) - 1] & 0xDF) == 'H') sscanf(text, "%Lx", &value); else sscanf(text, "%Ld", &value); switch (info->type) { case eBool: case eBit: case eChar: case eUChar: size = 1; break; case eShort: case eUShort: case eChar16T: case eWcharT: size = 2; break; case eInt: case eLong: case eUInt: case eULong: size = 4; break; case eLongLong: case eULongLong: size = 8; break; } } if (info->bitfield) { char data[10]; int signedx; int v; HintBasicValue(info, &signedx, &data); v = *(int*)data; v &= ~(bitmask[info->bitlength - 1] << info->bitstart); value = v | ((value &bitmask[info->bitlength - 1]) << info ->bitstart); } WriteValue(info->address, &value, size, &info->thread->regs); if (info->pointer) { if (!value && info->subtype) { VARINFO *inf = info->subtype; info->subtype = 0; FreeTree(inf, page); FreeVarInfo(inf); } else RefreshAddresses(info->subtype, value, NULL, info->outofscope); } } RefreshData(watchinfo_list[page][info->watchindex].dbg_info, info); }
void nsAttrValue::ToString(nsAString& aResult) const { switch(Type()) { case eString: { nsStringBuffer* str = static_cast<nsStringBuffer*>(GetPtr()); if (str) { str->ToString(str->StorageSize()/sizeof(PRUnichar) - 1, aResult); } else { aResult.Truncate(); } break; } case eAtom: { nsIAtom *atom = static_cast<nsIAtom*>(GetPtr()); atom->ToString(aResult); break; } case eInteger: { nsAutoString intStr; intStr.AppendInt(GetIntInternal()); aResult = intStr; break; } case eColor: { nscolor v; GetColorValue(v); NS_RGBToHex(v, aResult); break; } case eEnum: { PRInt16 val = GetEnumValue(); const EnumTable* table = sEnumTableArray-> ElementAt(GetIntInternal() & NS_ATTRVALUE_ENUMTABLEINDEX_MASK); while (table->tag) { if (table->value == val) { aResult.AssignASCII(table->tag); return; } table++; } NS_NOTREACHED("couldn't find value in EnumTable"); break; } case ePercent: { nsAutoString intStr; intStr.AppendInt(GetIntInternal()); aResult = intStr + NS_LITERAL_STRING("%"); break; } case eCSSStyleRule: { aResult.Truncate(); MiscContainer *container = GetMiscContainer(); nsCSSDeclaration* decl = container->mCSSStyleRule->GetDeclaration(); if (decl) { decl->ToString(aResult); } break; } case eAtomArray: { MiscContainer* cont = GetMiscContainer(); PRInt32 count = cont->mAtomArray->Count(); if (count) { cont->mAtomArray->ObjectAt(0)->ToString(aResult); nsAutoString tmp; PRInt32 i; for (i = 1; i < count; ++i) { cont->mAtomArray->ObjectAt(i)->ToString(tmp); aResult.Append(NS_LITERAL_STRING(" ") + tmp); } } else { aResult.Truncate(); } break; } #ifdef MOZ_SVG case eSVGValue: { GetMiscContainer()->mSVGValue->GetValueString(aResult); } #endif } }