void CMakeRunConfiguration::updateTargetInformation() { BuildTargetInfo bti = target()->applicationTargets().buildTargetInfo(buildKey()); aspect<ExecutableAspect>()->setExecutable(bti.targetFilePath); aspect<WorkingDirectoryAspect>()->setDefaultWorkingDirectory(bti.workingDirectory); aspect<LocalEnvironmentAspect>()->buildEnvironmentHasChanged(); auto terminalAspect = aspect<TerminalAspect>(); if (!terminalAspect->isUserSet()) terminalAspect->setUseTerminal(bti.usesTerminal); }
/* getDynamicValue: push value of cell onto stack */ void getDynamicValue( Array *array, Symbol *s ) { int index; char *key; ArrayCell *cell; /* create the key */ key = buildKey( array, s ); /* look for key */ index = findKey( array, s, key ); eFree( key ); if (index == -1) { /* no item */ pushStringCopy( "" ); } else { /* address of the cell */ cell = array->data.cell + index; tos++; stack[tos].datatype = cell->data.datatype; /* copy data to stack */ switch (cell->data.datatype) { case DATA_NUMBER: stack[tos].value.number = cell->data.value.number; break; case DATA_STRING: stack[tos].value.string = eCopyString( cell->data.value.string ); break; default: ePrintf( Runtime, "getDynamicElement: Array %s[%s] is corrupt", s->name, cell->key ); break; } } }
void addTransToAggregator(CatTransaction *pTrans) { sds key = buildKey((CatMessage *) pTrans); findCCHashMapCreateByFunAndOperate(g_transAggregator, key, createValFun, pTrans, findValOptFun, pTrans); }
inline TImage retrieveThumbnail(const boost::filesystem::path& imagePath) const { return retrieveThumbnail(buildKey(imagePath)); }
/* eraseArrayElement: erase a single item from an array */ void eraseArrayElement( Symbol *s ) { int index, usedCells, bytes; char *key; Array *array; ArrayCell *cell; Variant *element; /* get the array */ array = getArray( s ); eMemTest( "eraseArrayElement: array", array ); /* dynamic or static array? */ if (array->isDynamic) { /* get key */ key = buildKey( array, s ); index = findKey( array, s, key ); eFree( key ); /* found the key? */ if (index != -1) { /* cell to delete */ cell = array->data.cell+index; /* remove any string data */ eFree( cell->key ); if (cell->data.datatype == DATA_STRING) { eFree( cell->data.value.string ); } /* calculate chunk of memory to move */ usedCells = array->lower[0]; bytes = sizeof( ArrayCell ) * ((usedCells) - index); /* move memory, overlapping */ memmove( (void *)(cell), (void *)(cell+1), bytes ); /* last cell is now redundant */ cell = array->data.cell+usedCells; /* zap prior value */ cell->key = NULL; cell->data.datatype = DATA_UNDEFINED; /* decrease count */ (array->lower[0])--; } } else { /* get index */ index = getStaticIndex( array, s ); element = array->data.item+index; eMemTest( "eraseArrayElement: array element", element ); /* need to free string? */ if (element->datatype == DATA_STRING) { eMemTest( "eraseArrayElement: array element string", element->value.string ); eFree( element->value.string ); } /* set to zero */ element->datatype = DATA_NUMBER; element->value.number = 0; } }
/* setDynamicValue: set cell at index to value on stack */ void setDynamicValue( Array *array, Symbol *s ) { int index, hi, lo, isNew, c; char *key; Variant *stackData; ArrayCell *cell; /* make sure there is a value to set */ if (tos == 0) { ePrintf( Runtime, "setDynamicValue: stack underflow" ); } /* create the key */ key = buildKey( array, s ); /* assume it will be a new key */ isNew = 1; /* binary search */ lo = 0; hi = array->lower[0]-1; index = 0; while (lo <= hi) { index = floor((lo + hi) / 2); cell = array->data.cell+index; c = strcmp( key, cell->key ); if (c < 0) { hi = index - 1; } else if (c > 0) { lo = index + 1; } else { /* found prior key */ isNew = 0; break; } } /* no prior key? */ if (isNew) { /* create empty cell */ index = lo; insertDynamicCell( array, index ); } /* address of cell */ cell = array->data.cell + index; /* need to set key? */ if (isNew) { /* use key (already unique copy) */ cell->key = key; } else { /* don't need key */ eFree( key ); /* clean up old value */ if (cell->data.datatype == DATA_STRING) { eFree( cell->data.value.string ); } } /* resolve datatype */ stackData = getStackPointer( tos ); cell->data.datatype = stackData->datatype; if (stackData->datatype == DATA_STRING) { /* ref? */ if (stack[tos].datatype == DATA_REF) { /* need to make a unique copy */ cell->data.value.string = eCopyString( stackData->value.string ); } else { /* use directly */ cell->data.value.string = stackData->value.string; } } else if (stackData->datatype == DATA_NUMBER) { cell->data.value.number = stackData->value.number; } else { /* oops */ ePrintf( Runtime, "Can't assign %s to a Dynamic Array", datumName[stackData->datatype] ); } tos--; }
bool CMakeRunConfiguration::isBuildTargetValid() const { return Utils::anyOf(target()->applicationTargets().list, [this](const BuildTargetInfo &bti) { return bti.buildKey == buildKey(); }); }