示例#1
0
void compiled_vframe::copy_outgoing_arg(fint argNo, NameDesc* nd2, compiled_vframe* vf, dummy_vframe* dummy, 
                                        NameDesc* nd, frame* oldBlkHome, OopOopTable* blkValues) {

  // we're restarting a send (e.g. after recompilation that left most
  // recent frame invalid); outgoing args were saved by assembly glue

  // On I386, ReturnTrap asm glue does not save the outgoing arguments.
  
  // Used to be:
  // if (!nd2->isIllegal())
  //   copyValue(nd, vf, nd2, oldBlkHome, blkValues); // get value from caller if possible
  // else
  //   copyValueTo(nd, new_string("<unknown outgoing argument>")); 

  Location loc= LocationOfSavedOutgoingArgInSendee(argNo);
  NameDesc* fromNd = new LocationNameDesc(loc, 0);
  if (!nd2->isIllegal()) {
    // verify that args were saved correctly
    oop val1 = vf->get_contents(nd2, false);
    oop val2 = dummy->get_contents(fromNd);
    if (val1 != val2)
      fatal3("inconsistent outgoing arg %d: %#lx vs. %#lx",
             argNo, val1, val2);
  }
  copyValue(nd, dummy, fromNd, oldBlkHome, blkValues);
}
示例#2
0
int
AssetManagerGlue::loadResourceValue(int ident, int density, TypedValue* outValue, bool resolve)
{
	const ResTable& res(getResources());

	Res_value value;
	ResTable_config config;
	uint32_t typeSpecFlags;
	ssize_t block = res.getResource(ident, &value, false, density, &typeSpecFlags, &config);
#if THROW_ON_BAD_ID
	if (block == BAD_INDEX) {
		jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!");
		return 0;
	}
#endif
	uint32_t ref = ident;
	if (resolve) {
		block = res.resolveReference(&value, block, &ref);
#if THROW_ON_BAD_ID
		if (block == BAD_INDEX) {
			jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!");
			return 0;
		}
#endif
	}
	return block >= 0 ? copyValue(outValue, &res, value, ref, block, typeSpecFlags, &config) : block;
}
示例#3
0
文件: Value.c 项目: zurl/MUA
ListNode * copyListDfs(ListNode * x) {
	if (x == NULL)return NULL;
	else {
		ListNode * node = (ListNode*)malloc(sizeof(ListNode));
		node->data = copyValue(x->data);
		node->next = copyListDfs(x->next);
		return node;
	}
}
示例#4
0
Mixed &Mixed::operator=(const Mixed &v) {

	const Type oldType = m_type;
	ValueType oldValue = m_value;

	copyValue(v);
	deleteValue(oldType, oldValue);

	return *this;
}
示例#5
0
PythonBrowserView::PythonBrowserView(PythonEngine *pythonEngine, PythonScriptingConsole *console, QWidget *parent)
    : QDockWidget(tr("Browser"), parent), pythonEngine(pythonEngine), console(console)
{
    setMinimumWidth(280);
    setObjectName("BrowserView");

    connect(pythonEngine, SIGNAL(executedExpression()), this, SLOT(executed()));
    connect(pythonEngine, SIGNAL(executedScript()), this, SLOT(executed()));

    trvBrowser = new QTreeWidget(this);
    trvBrowser->setContextMenuPolicy(Qt::CustomContextMenu);
    trvBrowser->setColumnCount(3);
    trvBrowser->setIndentation(18);
    trvBrowser->setColumnWidth(0, 200);
    trvBrowser->setColumnWidth(0, 200);

    QStringList headers;
    headers << tr("Name") << tr("Type") << tr("Value");
    trvBrowser->setHeaderLabels(headers);

    trvVariables = NULL;
    trvFunctions = NULL;
    trvClasses = NULL;
    trvOther = NULL;

    variableExpanded = true;
    functionExpanded = true;
    classExpanded = true;
    otherExpanded = false;

    executed();
    trvBrowser->sortItems(0, Qt::AscendingOrder);

    connect(trvBrowser, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(executeCommand(QTreeWidgetItem *, int)));
    connect(trvBrowser, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(doContextMenu(const QPoint &)));

    actCopyName = new QAction(icon(""), tr("Copy name"), this);
    connect(actCopyName, SIGNAL(triggered()), this, SLOT(copyName()));

    actCopyValue = new QAction(icon(""), tr("Copy value"), this);
    connect(actCopyValue, SIGNAL(triggered()), this, SLOT(copyValue()));

    actDelete = new QAction(icon(""), tr("&Delete"), this);
    connect(actDelete, SIGNAL(triggered()), this, SLOT(deleteVariable()));

    mnuContext = new QMenu(trvBrowser);
    mnuContext->addAction(actCopyName);
    mnuContext->addAction(actCopyValue);
    mnuContext->addSeparator();
    mnuContext->addAction(actDelete);

    setWidget(trvBrowser);
}
示例#6
0
void ElementProperty::initFromText(const ustring &text, bool isDefault) {
	//DEBUG_MSG("Init prop: " << name.c_str() << " = " << text.c_str() << " l: " << text.length())
	if(type == data_array && isDefault)	// load from INI file
		((ArrayValue*)value)->type = (DataType)atoi(text.c_str());
	else {
		parse(text, type, value);
		if(isDefault)
			copyValue(type, defValue, value);
		else
			change();
	}
}
element *mergeTwoSortedLinkedList(element *a, element *b) {
    element head;
    element *tail = &head;
    head.next = NULL;

    while(1) {
        if(a == NULL) {
            tail->next = b;
            break;
        } else if(b == NULL) {
            tail->next = a;
            break;
        }
        if(a->data < b->data) {
            copyValue(&(tail->next), &a);
        } else {
            copyValue(&(tail->next), &b);
        }
        tail = tail->next;
    }
    return head.next;
}
void
MetaAttribute::copyValueBytes(uint32 valueIndex, const ReadSection &rs, WriteSection &ws,
	uint32 &writeOffset) const
{
	uint32 numValues, valueOffset;
	unpackNumberOfValues(rs, numValues, valueOffset);

	// skip bytes before the desired value
	for (uint32 i = 0; i < valueIndex; i++)
		skipValue(rs, valueOffset);
		
	// copy the value bytes into the write section
	copyValue(rs, valueOffset, ws, writeOffset);
}
示例#9
0
String* String::set(int _iPos, const wchar_t* _pwstData)
{
    if (m_pRealData == NULL || _iPos >= m_iSize)
    {
        return NULL;
    }

    typedef String* (String::*set_t)(int, const wchar_t*);
    String* pIT = checkRef(this, (set_t)&String::set, _iPos, _pwstData);
    if (pIT != this)
    {
        return pIT;
    }

    deleteString(_iPos);
    m_pRealData[_iPos] = copyValue(_pwstData);
    return this;
}
示例#10
0
文件: shader.cpp 项目: atondwal/Core
void Vec4ArrayShaderUniform::setValue(const std::vector<vec4>& value) {
    if(baked) {
        bool match = true;

        for(size_t i=0;i<length;i++) {
            if(value[i] != this->value[i]) {
                match = false;
                break;
            }
        }

        if(match) return;
    }

    copyValue(value);

    modified = true;
    initialized = true;
}
示例#11
0
int
AssetManagerGlue::Theme::loadThemeAttributeValue(int ident, TypedValue* outValue, bool resolve)
{
	const ResTable& res(getResTable());

	Res_value value;
	// XXX value could be different in different configs!
	uint32_t typeSpecFlags = 0;
	ssize_t block = getAttribute(ident, &value, &typeSpecFlags);
	uint32_t ref = 0;
	if (resolve) {
		block = res.resolveReference(&value, block, &ref, &typeSpecFlags);
#if THROW_ON_BAD_ID
		if (block == BAD_INDEX) {
			jniThrowException(env, "java/lang/IllegalStateException", "Bad resource!");
			return 0;
		}
#endif
	}
	return block >= 0 ? copyValue(outValue, &res, value, ref, block, typeSpecFlags) : block;
}
示例#12
0
String* String::set(const wchar_t* const* _pwstData)
{
    typedef String* (String::*set_t)(const wchar_t * const*);
    String* pIT = checkRef(this, (set_t)&String::set, _pwstData);
    if (pIT != this)
    {
        return pIT;
    }

    for (int i = 0; i < m_iSize; i++)
    {
        if (m_pRealData == NULL || i >= m_iSize)
        {
            return NULL;
        }

        deleteString(i);
        m_pRealData[i] = copyValue(_pwstData[i]);
    }
    return this;
}
示例#13
0
void compiled_vframe::copy_outgoing_arg(fint argNo, NameDesc* nd2, compiled_vframe* vf, dummy_vframe* dummy, 
                                        NameDesc* nd, frame* oldBlkHome, OopOopTable* blkValues) {

  // we're restarting a send (e.g. after recompilation that left most
  // recent frame invalid); outgoing args were saved by assembly glue

  // Use the value saved by the ReturnTrap asm glue (saved_outregs on SPARC)
  // But verify it against the expression stack entry of the caller.
  // For a SIC method, the latter may not be available for verification.
  // -- dmu 6/99
  Location loc= LocationOfSavedOutgoingArgInSendee(argNo);
  NameDesc* fromNd = new LocationNameDesc(loc, 0);
  if (!nd2->isIllegal()) {
    // verify that args were saved correctly
    oop val1 = vf->get_contents(nd2, false);
    oop val2 = dummy->get_contents(fromNd);
    if (val1 != val2)
      fatal3("inconsistent outgoing arg %d: %#lx vs. %#lx",
             argNo, val1, val2);
  }
  copyValue(nd, dummy, fromNd, oldBlkHome, blkValues);
}
示例#14
0
文件: parsexp.c 项目: honza889/IFJ12
/** Prida polozku do vrcholu zasobniku */
void addToExpStack(ExpStack* stack, ExpItem item){
    // zvetseni zasobniku, neni-li dostatecne velky
    if(stack->count==stack->allocated){
        stack->allocated += 8;
        stack->array = resizeArray( stack->array, ExpItem, stack->allocated );
    }
    // pridani polozky
    stack->array[stack->count] = item;
    if(item.type==term){
        stack->termIndex = stack->count; // nyni je nevrcholovejsim terminalem
        
        // kopirovani hodnot pro potreby pozdejsiho uvolnovani pameti
        if( item.val.term.type == tokId )
        {
            stack->array[stack->count].val.term.data.id = copyRCString( &item.val.term.data.id );
        }
        if( item.val.term.type == tokLiteral )
        {
            stack->array[stack->count].val.term.data.val = copyValue( &item.val.term.data.val );
        }
    }
    stack->count++; // zvyseni poctu polozek
}
示例#15
0
文件: shader.cpp 项目: atondwal/Core
Vec4ArrayShaderUniform::Vec4ArrayShaderUniform(Shader* shader, const std::string& name, size_t length, const vec4* value) :
    length(length), ShaderUniform(shader, name, SHADER_UNIFORM_VEC4_ARRAY, "vec4") {
    this->value = new vec4[length];
    if(value != 0) copyValue(value);
}
示例#16
0
void ElementProperty::setValue(void *value) {
	copyValue(type, this->value, value);
	change();
}
示例#17
0
void AutomatableModelView::addDefaultActions( QMenu* menu )
{
	AutomatableModel* model = modelUntyped();

	AutomatableModelViewSlots* amvSlots = new AutomatableModelViewSlots( this, menu );

	menu->addAction( embed::getIconPixmap( "reload" ),
						AutomatableModel::tr( "&Reset (%1%2)" ).
							arg( model->displayValue( model->initValue<float>() ) ).
							arg( m_unit ),
						model, SLOT( reset() ) );

	menu->addSeparator();
	menu->addAction( embed::getIconPixmap( "edit_copy" ),
						AutomatableModel::tr( "&Copy value (%1%2)" ).
							arg( model->displayValue( model->value<float>() ) ).
							arg( m_unit ),
						model, SLOT( copyValue() ) );

	menu->addAction( embed::getIconPixmap( "edit_paste" ),
						AutomatableModel::tr( "&Paste value (%1%2)").
							arg( model->displayValue( AutomatableModel::copiedValue() ) ).
							arg( m_unit ),
						model, SLOT( pasteValue() ) );

	menu->addSeparator();

	menu->addAction( embed::getIconPixmap( "automation" ),
						AutomatableModel::tr( "Edit song-global automation" ),
							amvSlots,
							SLOT( editSongGlobalAutomation() ) );

	menu->addAction( QPixmap(),
						AutomatableModel::tr( "Remove song-global automation" ),
						amvSlots,
						SLOT( removeSongGlobalAutomation() ) );

	menu->addSeparator();

	if( model->hasLinkedModels() )
	{
		menu->addAction( embed::getIconPixmap( "edit-delete" ),
							AutomatableModel::tr( "Remove all linked controls" ),
							amvSlots, SLOT( unlinkAllModels() ) );
		menu->addSeparator();
	}

	QString controllerTxt;
	if( model->controllerConnection() )
	{
		Controller* cont = model->controllerConnection()->getController();
		if( cont )
		{
			controllerTxt = AutomatableModel::tr( "Connected to %1" ).arg( cont->name() );
		}
		else
		{
			controllerTxt = AutomatableModel::tr( "Connected to controller" );
		}

		QMenu* contMenu = menu->addMenu( embed::getIconPixmap( "controller" ), controllerTxt );

		contMenu->addAction( embed::getIconPixmap( "controller" ),
								AutomatableModel::tr("Edit connection..."),
								amvSlots, SLOT( execConnectionDialog() ) );
		contMenu->addAction( embed::getIconPixmap( "cancel" ),
								AutomatableModel::tr("Remove connection"),
								amvSlots, SLOT( removeConnection() ) );
	}
	else
	{
		menu->addAction( embed::getIconPixmap( "controller" ),
							AutomatableModel::tr("Connect to controller..."),
							amvSlots, SLOT( execConnectionDialog() ) );
	}
}
示例#18
0
Mixed::Mixed(const Mixed &v) {

	copyValue(v);
}
示例#19
0
bool ScriptInterpreter::execOpcode(byte opcode) {

	debugCN(kDebugScript, "opcode = %d (%s)\n", opcode, opcodeNames[opcode]);

	ScriptValue value1, value2, value3;
	uint32 temp;

	/* TODO: Put all opcodes into separate functions and into an array
			 (but only after all needed opcodes are known and frozen)
	*/

	switch (opcode) {

	case opRet:
		return false;

	case opPush:
		loadValue(value1);
		derefValue(value1);
		push(value1);
		return true;

	case opPush0:
		push(ScriptValue(0));
		return true;

	case opPush1:
		push(ScriptValue(1));
		return true;

	case opPushNeg1:
		push(ScriptValue(-1));
		return true;

	case opPop:
		loadValue(value1);
		pop(value2);
		copyValue(value1, value2);
		return true;

	case opMov:
		loadValue(value1);
		loadValue(value2);
		derefValue(value2);
		copyValue(value1, value2);
		return true;

	// Possibly join all jump variants into one opcode

	case opJmp:
		temp = _runningFunction->readUint32();
		debugCN(kDebugScript, "-> ofs = %08X\n", temp);
		_runningFunction->jumpAbsolute(temp);
		return true;

	case opJl:
		temp = _runningFunction->readUint32();
		if (_cmpFlags < 0) {
			debugCN(kDebugScript, "-> ofs = %08X\n", temp);
			_runningFunction->jumpAbsolute(temp);
		}
		return true;

	case opJle:
		temp = _runningFunction->readUint32();
		if (_cmpFlags <= 0) {
			debugCN(kDebugScript, "-> ofs = %08X\n", temp);
			_runningFunction->jumpAbsolute(temp);
		}
		return true;

	case opJg:
		temp = _runningFunction->readUint32();
		if (_cmpFlags > 0) {
			debugCN(kDebugScript, "-> ofs = %08X\n", temp);
			_runningFunction->jumpAbsolute(temp);
		}
		return true;

	case opJge:
		temp = _runningFunction->readUint32();
		if (_cmpFlags >= 0) {
			debugCN(kDebugScript, "-> ofs = %08X\n", temp);
			_runningFunction->jumpAbsolute(temp);
		}
		return true;

	case opJz:
		temp = _runningFunction->readUint32();
		if (_cmpFlags == 0) {
			debugCN(kDebugScript, "-> ofs = %08X\n", temp);
			_runningFunction->jumpAbsolute(temp);
		}
		return true;

	case opJnz:
		temp = _runningFunction->readUint32();
		if (_cmpFlags != 0) {
			debugCN(kDebugScript, "-> ofs = %08X\n", temp);
			_runningFunction->jumpAbsolute(temp);
		}
		return true;

	case opJmpByTable:
		temp = _runningFunction->readUint32();
		debugCN(kDebugScript, "-> index = %d\n", _registers[0].value);
		_runningFunction->jumpRelative(_registers[0].value * 4);
		temp = _runningFunction->readUint32();
		debugCN(kDebugScript, "-> ofs = %08X\n", temp);
		_runningFunction->jumpAbsolute(temp);
		return true;

	case opCmp:
		loadValue(value1);
		loadValue(value2);
		derefValue(value1);
		derefValue(value2);
		if (value1.type != kInteger || value2.type != kInteger)
			warning("ScriptInterpreter::execOpcode() Trying to compare non-integer values (%d, %d, line %d)", value1.type, value2.type, _lineNum);
		_cmpFlags = value1.value - value2.value;
		debugCN(kDebugScript, "-> cmp %d, %d\n", value1.value, value2.value);
		debugCN(kDebugScript, "-> _cmpFlags  = %d\n", _cmpFlags);
		return true;

	case opCall:
		temp = _runningFunction->readUint32();
		callFunction(temp);
		return true;

	case opCallKernel:
		temp = _runningFunction->readUint32();
		callKernelFunction(temp);
		return true;

	case opInc:
		loadValue(value1);
		value2 = value1;
		derefValue(value2);
		value2.value++;
		copyValue(value1, value2);
		return true;

	case opDec:
		loadValue(value1);
		value2 = value1;
		derefValue(value2);
		value2.value--;
		copyValue(value1, value2);
		return true;

	case opAdd:
		loadValue(value1);
		value3 = value1;
		loadValue(value2);
		derefValue(value3);
		derefValue(value2);
		value3.value += value2.value;
		copyValue(value1, value3);
		return true;

	case opSub:
		loadValue(value1);
		value3 = value1;
		loadValue(value2);
		derefValue(value3);
		derefValue(value2);
		value3.value -= value2.value;
		copyValue(value1, value3);
		return true;

	case opDebug:
		_lineNum = (int)_runningFunction->readUint32();
		return true;

	default:
		debugCN(kDebugScript, "Invalid opcode %d!\n", opcode);
		return false;

	}

}