void VariableEditWindow::MessageReceived(BMessage* message) { switch (message->what) { case MSG_VARIABLE_VALUE_CHANGED: { Value* value; if (message->FindPointer("value", reinterpret_cast<void**>(&value)) == B_OK) { if (fNewValue != NULL) fNewValue->ReleaseReference(); fNewValue = value; } break; } case MSG_WRITE_VARIABLE_VALUE: { BMessage message(MSG_WRITE_VARIABLE_VALUE); message.AddPointer("node", fNode); message.AddPointer("value", fNewValue); // acquire a reference on behalf of the target BReference<Value> valueReference(fNewValue); if (BMessenger(fTarget).SendMessage(&message) == B_OK) { valueReference.Detach(); PostMessage(B_QUIT_REQUESTED); } break; } default: BWindow::MessageReceived(message); break; } }
static void paramValueData(ParserControl *parm, parseUnion *stateUnion) { parseUnion lvalp={0}; ct = localLex((parseUnion*)&stateUnion->xtokParamValueData, parm); if(ct == XTOK_VALUE) { dontLex = 1; value(parm, (parseUnion*)&stateUnion->xtokParamValueData.value); if(stateUnion->xtokParamValueData.value.type == typeValue_Instance) { stateUnion->xtokParamValueData.type = CMPI_instance; } } else if(ct == XTOK_VALUEREFERENCE) { dontLex = 1; valueReference(parm, (parseUnion*)&stateUnion->xtokParamValueData.valueRef); stateUnion->xtokParamValueData.type = CMPI_ref; } else if(ct == XTOK_VALUEARRAY) { dontLex = 1; valueArray(parm, (parseUnion*)&stateUnion->xtokParamValueData.valueArray); stateUnion->xtokParamValueData.type |= CMPI_ARRAY; } else if(ct == XTOK_VALUEREFARRAY) { dontLex = 1; valueRefArray(parm, (parseUnion*)&stateUnion->xtokParamValueData.valueRefArray); stateUnion->xtokParamValueData.type = CMPI_refA; } else { parseError("XTOK_VALUE or XTOK_VALUEREFERENCE or XTOK_VALUEARRAY or XTOK_VALUEREFARRAY", ct, parm); } }
void VariableEditWindow::TableCellEditEnded(Value* newValue) { BReference<Value> valueReference(newValue); BMessage message(MSG_VARIABLE_VALUE_CHANGED); message.AddPointer("value", newValue); if (PostMessage(&message) == B_OK) valueReference.Detach(); }
static void returnValueData(ParserControl *parm, parseUnion *stateUnion) { parseUnion lvalp ={0}; ct = localLex((parseUnion*)&stateUnion->xtokReturnValueData, parm); if(ct == XTOK_VALUE) { dontLex = 1; value(parm, (parseUnion*)&stateUnion->xtokReturnValueData.value); } else if(ct == XTOK_VALUEREFERENCE) { dontLex = 1; valueReference(parm, (parseUnion*)&stateUnion->xtokReturnValueData.ref); stateUnion->xtokReturnValueData.type = CMPI_ref; } else { parseError("XTOK_VALUE or XTOK_VALUEREFERENCE", ct, parm); } }
status_t ResolveValueNodeValueJob::_ResolveNodeValue() { // get the node child and parent node AutoLocker<ValueNodeContainer> containerLocker(fContainer); ValueNodeChild* nodeChild = fValueNode->NodeChild(); BReference<ValueNodeChild> nodeChildReference(nodeChild); ValueNode* parentNode = nodeChild->Parent(); BReference<ValueNode> parentNodeReference(parentNode); // Check whether the node child location has been resolved already // (successfully). status_t nodeChildResolutionState = nodeChild->LocationResolutionState(); bool nodeChildDone = nodeChildResolutionState != VALUE_NODE_UNRESOLVED; if (nodeChildDone && nodeChildResolutionState != B_OK) return nodeChildResolutionState; // If the child node location has not been resolved yet, check whether the // parent node location and value have been resolved already (successfully). bool parentDone = true; if (!nodeChildDone && parentNode != NULL) { status_t parentResolutionState = parentNode->LocationAndValueResolutionState(); parentDone = parentResolutionState != VALUE_NODE_UNRESOLVED; if (parentDone && parentResolutionState != B_OK) return parentResolutionState; } containerLocker.Unlock(); // resolve the parent node location and value, if necessary if (!parentDone) { status_t error = _ResolveParentNodeValue(parentNode); if (error != B_OK) { TRACE_LOCALS("ResolveValueNodeValueJob::_ResolveNodeValue(): value " "node: %p (\"%s\"): _ResolveParentNodeValue(%p) failed\n", fValueNode, fValueNode->Name().String(), parentNode); return error; } } // resolve the node child location, if necessary if (!nodeChildDone) { status_t error = _ResolveNodeChildLocation(nodeChild); if (error != B_OK) { TRACE_LOCALS("ResolveValueNodeValueJob::_ResolveNodeValue(): value " "node: %p (\"%s\"): _ResolveNodeChildLocation(%p) failed\n", fValueNode, fValueNode->Name().String(), nodeChild); return error; } } // resolve the node location and value ValueLoader valueLoader(fArchitecture, fDebuggerInterface, fTypeInformation, fCpuState); ValueLocation* location; Value* value; status_t error = fValueNode->ResolvedLocationAndValue(&valueLoader, location, value); if (error != B_OK) { TRACE_LOCALS("ResolveValueNodeValueJob::_ResolveNodeValue(): value " "node: %p (\"%s\"): fValueNode->ResolvedLocationAndValue() " "failed\n", fValueNode, fValueNode->Name().String()); return error; } BReference<ValueLocation> locationReference(location, true); BReference<Value> valueReference(value, true); // set location and value on the node containerLocker.Lock(); status_t nodeResolutionState = fValueNode->LocationAndValueResolutionState(); if (nodeResolutionState != VALUE_NODE_UNRESOLVED) return nodeResolutionState; fValueNode->SetLocationAndValue(location, value, B_OK); containerLocker.Unlock(); return B_OK; }