char toArray(conjunto *ptr, char array[]) { if (ptr != NULL) { toArray(ptr->izquierda, array); strcat(array, ptr->idConjunto); //dato toArray(ptr->derecha, array); printf("%s\n", array); } return t; }
static void checkFetch( Teuchos::RCP<Teuchos::Comm<int> const> const &comm, View1 const &ranks, View1 const &indices, View2 const &v_exp, View2 const &v_ref, bool &success, Teuchos::FancyOStream &out ) { auto v_imp = DataTransferKit::Details::NearestNeighborOperatorImpl< DeviceType>::fetch( comm, ranks, indices, v_exp ); TEST_COMPARE_ARRAYS( toArray( v_imp ), toArray( v_ref ) ); }
int main(void) { lista_t *old; /* lê o número de pontos */ scanf("%d", &n); /* Cria a lista de pontos ordenados */ cria_lpo(); /* Coloca lista de pontos ordenados num array */ toArray(); print_array(); /* free da lista de pontos */ while(lpo != NULL) { old = lpo; lpo = lpo->next; free(old); } free(lpo); return 0; }
void HeadData::fromJson(const QJsonObject& json) { if (json.contains(JSON_AVATAR_HEAD_BLENDSHAPE_COEFFICIENTS)) { auto jsonValue = json[JSON_AVATAR_HEAD_BLENDSHAPE_COEFFICIENTS]; if (jsonValue.isArray()) { QVector<float> blendshapeCoefficients; QJsonArray blendshapeCoefficientsJson = jsonValue.toArray(); for (const auto& blendshapeCoefficient : blendshapeCoefficientsJson) { blendshapeCoefficients.push_back((float)blendshapeCoefficient.toDouble()); } setBlendshapeCoefficients(blendshapeCoefficients); } else if (jsonValue.isObject()) { QJsonObject blendshapeCoefficientsJson = jsonValue.toObject(); for (const QString& name : blendshapeCoefficientsJson.keys()) { float value = (float)blendshapeCoefficientsJson[name].toDouble(); setBlendshape(name, value); } } else { qWarning() << "Unable to deserialize head json: " << jsonValue; } } if (json.contains(JSON_AVATAR_HEAD_LOOKAT)) { auto relativeLookAt = vec3FromJsonValue(json[JSON_AVATAR_HEAD_LOOKAT]); if (glm::length2(relativeLookAt) > 0.01f) { setLookAtPosition((_owningAvatar->getOrientation() * relativeLookAt) + _owningAvatar->getPosition()); } } if (json.contains(JSON_AVATAR_HEAD_ROTATION)) { setHeadOrientation(quatFromJsonValue(json[JSON_AVATAR_HEAD_ROTATION])); } }
int main(int argc, char **argv) { pthread_t thread1, thread2, thread3; int filas=0, columnas=0, miniCuadrados = 0; FILE *file; file = fopen(argv[1],"r"); // file = fopen("datos1.txt", "r"); if(file==NULL){ printf("ERROR ABRIENDO ARCHIVO\n"); return 1; } toArray(file); fclose(file); pthread_create( &thread1, NULL, fila, &filas); pthread_create( &thread2, NULL, columna, &columnas); pthread_create( &thread3, NULL, miniCuadrado, &miniCuadrados); pthread_join( thread1,NULL); pthread_join( thread2,NULL); pthread_join( thread3,NULL); return 0; }
EncodedJSValue JSC_HOST_CALL JSTestSerializedScriptValueInterfaceConstructor::constructJSTestSerializedScriptValueInterface(ExecState* exec) { JSTestSerializedScriptValueInterfaceConstructor* jsConstructor = static_cast<JSTestSerializedScriptValueInterfaceConstructor*>(exec->callee()); if (exec->argumentCount() < 2) return throwVMError(exec, createTypeError(exec, "Not enough arguments")); const String& hello(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined).toString(exec)->value(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); RefPtr<SerializedScriptValue> data(SerializedScriptValue::create(exec, MAYBE_MISSING_PARAMETER(exec, 1, DefaultIsUndefined))); if (exec->hadException()) return JSValue::encode(jsUndefined()); size_t argsCount = exec->argumentCount(); if (argsCount <= 2) { JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl->constructorCallback(hello, data))); return JSValue::encode(result); } Array* transferList(toArray(MAYBE_MISSING_PARAMETER(exec, 2, DefaultIsUndefined))); if (exec->hadException()) return JSValue::encode(jsUndefined()); RefPtr<TestSerializedScriptValueInterface> object = TestSerializedScriptValueInterface::create(hello, data, transferList); return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), object.get()))); }
Variant UnaryOpExpression::eval(VariableEnvironment &env) const { if (m_op == '@') { Silencer s; s.enable(); return m_exp->eval(env); } else if (m_op == T_ISSET || m_op == T_EMPTY) { return m_exp->exist(env, m_op); } Variant exp(m_exp ? m_exp->eval(env) : null_variant); SET_LINE; switch (m_op) { case T_CLONE: return f_clone(exp); case '+': return +exp; case '-': return negate(exp); case '!': return !exp; case '~': return ~exp; case T_INT_CAST: return toInt64(exp); case T_DOUBLE_CAST: return toDouble(exp); case T_STRING_CAST: return toString(exp); case T_ARRAY_CAST: return toArray(exp); case T_OBJECT_CAST: return toObject(exp); case T_BOOL_CAST: return toBoolean(exp); case T_UNSET_CAST: return unset(exp); case T_EXIT: return f_exit(exp); case T_PRINT: return print(exp.toString()); case T_EVAL: return HPHP::eval(&env, env.currentObject(), exp); default: ASSERT(false); return Variant(); } }
static void testLeak(size_t alloc_size) { RuntimeOption::EvalGCTriggerPct = 0.50; RuntimeOption::EvalGCMinTrigger = 4 << 20; tl_heap->collect("testLeak"); tl_heap->setGCEnabled(true); clearSurpriseFlag(MemExceededFlag); tl_heap->setMemoryLimit(100 << 20); auto const target_alloc = int64_t{5} << 30; auto const vec_cap = (alloc_size - sizeof(ArrayData)) / sizeof(TypedValue); auto const vec = [vec_cap] { VecArrayInit vec{vec_cap}; for (int j = 0; j < vec_cap; ++j) { vec.append(make_tv<KindOfNull>()); } return vec.toArray(); }(); auto const start_alloc = tl_heap->getStatsRaw().mmAllocated(); for (int64_t i = 0; ; ++i) { auto vec_copy = vec; vec_copy.set(0, make_tv<KindOfInt64>(i)); vec_copy.detach(); if (tl_heap->getStatsRaw().mmAllocated() - start_alloc > target_alloc) { break; } if (UNLIKELY(checkSurpriseFlags())) handle_request_surprise(); } }
EncodedJSValue JSC_HOST_CALL jsTestSerializedScriptValueInterfacePrototypeFunctionAcceptTransferList(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestSerializedScriptValueInterface::s_info)) return throwVMTypeError(exec); JSTestSerializedScriptValueInterface* castedThis = jsCast<JSTestSerializedScriptValueInterface*>(asObject(thisValue)); ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestSerializedScriptValueInterface::s_info); TestSerializedScriptValueInterface* impl = static_cast<TestSerializedScriptValueInterface*>(castedThis->impl()); if (exec->argumentCount() < 1) return throwVMError(exec, createNotEnoughArgumentsError(exec)); RefPtr<SerializedScriptValue> data(SerializedScriptValue::create(exec, MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined), 0, 0)); if (exec->hadException()) return JSValue::encode(jsUndefined()); size_t argsCount = exec->argumentCount(); if (argsCount <= 1) { impl->acceptTransferList(data); return JSValue::encode(jsUndefined()); } Array* transferList(toArray(MAYBE_MISSING_PARAMETER(exec, 1, DefaultIsUndefined))); if (exec->hadException()) return JSValue::encode(jsUndefined()); impl->acceptTransferList(data, transferList); return JSValue::encode(jsUndefined()); }
bool Object::equal(const Object& v2) const { if (m_px == v2.get()) { return true; } if (!m_px || !v2.get()) { return false; } if (m_px->isCollection()) { return collectionEquals(m_px, v2.get()); } if (UNLIKELY(m_px->instanceof(SystemLib::s_DateTimeInterfaceClass))) { return c_DateTime::GetTimestamp(*this) == c_DateTime::GetTimestamp(v2); } if (v2.get()->getVMClass() != m_px->getVMClass()) { return false; } if (UNLIKELY(m_px->instanceof(SystemLib::s_ArrayObjectClass))) { // Compare the whole object, not just the array representation Array ar1(ArrayData::Create()); Array ar2(ArrayData::Create()); m_px->o_getArray(ar1, false); v2->o_getArray(ar2, false); return ar1->equal(ar2.get(), false); } return toArray().equal(v2.toArray()); }
/**jsdoc * A material or set of materials such as may be used by a {@link Entities.EntityType|Material} entity. * @typedef {object} MaterialResource * @property {number} materialVersion=1 - The version of the material. <em>Currently not used.</em> * @property {Material|Material[]} materials - The details of the material or materials. */ NetworkMaterialResource::ParsedMaterials NetworkMaterialResource::parseJSONMaterials(const QJsonDocument& materialJSON, const QUrl& baseUrl) { ParsedMaterials toReturn; if (!materialJSON.isNull() && materialJSON.isObject()) { QJsonObject materialJSONObject = materialJSON.object(); for (auto& key : materialJSONObject.keys()) { if (key == "materialVersion") { auto value = materialJSONObject.value(key); if (value.isDouble()) { toReturn.version = (uint)value.toInt(); } } else if (key == "materials") { auto materialsValue = materialJSONObject.value(key); if (materialsValue.isArray()) { QJsonArray materials = materialsValue.toArray(); for (auto material : materials) { if (!material.isNull() && material.isObject()) { auto parsedMaterial = parseJSONMaterial(material.toObject(), baseUrl); toReturn.networkMaterials[parsedMaterial.first] = parsedMaterial.second; toReturn.names.push_back(parsedMaterial.first); } } } else if (materialsValue.isObject()) { auto parsedMaterial = parseJSONMaterial(materialsValue.toObject(), baseUrl); toReturn.networkMaterials[parsedMaterial.first] = parsedMaterial.second; toReturn.names.push_back(parsedMaterial.first); } } } } return toReturn; }
bool Object::equal(const Object& v2) const { if (m_obj == v2.m_obj) { return true; } if (!m_obj || !v2) { return false; } if (m_obj->isCollection()) { return collections::equals(get(), v2.get()); } if (UNLIKELY(m_obj->instanceof(SystemLib::s_DateTimeInterfaceClass))) { return DateTimeData::getTimestamp(*this) == DateTimeData::getTimestamp(v2); } if (v2.get()->getVMClass() != m_obj->getVMClass()) { return false; } if (UNLIKELY(m_obj->instanceof(SystemLib::s_ArrayObjectClass))) { // Compare the whole object, not just the array representation auto ar1 = Array::Create(); auto ar2 = Array::Create(); m_obj->o_getArray(ar1); v2->o_getArray(ar2); return ar1->equal(ar2.get(), false); } return toArray().equal(v2.toArray()); }
Signal ReadGraph(const QJsonObject& obj) { Signal signal{}; auto it = obj.find("name"); if (it != obj.end()) { const auto sigName = it->toString(); signal.name = std::move(sigName); it = obj.find("color"); if (it != obj.end()) signal.graphic.color = it->toString(); it = obj.find("visible"); if (it != obj.end()) signal.graphic.visible = it->toBool(); it = obj.find("range"); if (it != obj.end()) { auto vec = ToVector(it->toArray()); signal.graphic.rangeLower = vec.front(); signal.graphic.rangeUpper = vec.back(); } it = obj.find("values"); if (it != obj.end() && it->isArray()) { signal.y = ToVector(it->toArray()); } it = obj.find("ticks"); if (it != obj.end() && it->isArray()) { signal.graphic.ticks = ToVector(it->toArray()); } it = obj.find("tickLabels"); if (it != obj.end() && it->isArray()) { signal.graphic.tickLabels = ToStrVector(it->toArray()); } } return signal; }
bool Object::less(const Object& v2) const { check_collection_compare(m_px, v2.get()); if (UNLIKELY(m_px->instanceof(SystemLib::s_DateTimeInterfaceClass))) { return c_DateTime::GetTimestamp(*this) < c_DateTime::GetTimestamp(v2); } return m_px != v2.m_px && toArray().less(v2.toArray()); }
std::string Color::stringify() const { std::array<double, 4> array = toArray(); return "rgba(" + util::toString(array[0]) + "," + util::toString(array[1]) + "," + util::toString(array[2]) + "," + util::toString(array[3]) + ")"; }
bool Object::less(const Object& v2) const { check_collection_compare(get(), v2.get()); if (UNLIKELY(m_obj->instanceof(SystemLib::s_DateTimeInterfaceClass))) { return DateTimeData::getTimestamp(*this) < DateTimeData::getTimestamp(v2); } return m_obj != v2.m_obj && toArray().less(v2.toArray()); }
int main(int argc, char *argv[]) { MPI_Init(&argc,&argv); MPI_Comm_size(MPI_COMM_WORLD, &size); MPI_Comm_rank(MPI_COMM_WORLD , &my_rank); // get my rank as char array my_rank_char = toArray(my_rank); int operation ; if (my_rank==0) { printf("Choose Operation\n[0] mirror\n[1] ping\n[2] flode\n[3] CollectAndmirror\n[4] mirrorFromFile\n"); scanf("%d",&operation); } // sending operations to processes MPI_Bcast (&operation, 1, MPI_INT,0, MPI_COMM_WORLD); if (operation == 0) { mirror("http://www.w3schools.com/html/html_links.asp"); }else if (operation == 1) { runPing("174.129.224.129"); }else if (operation == 2) { runFloode("193.227.14.57"); }else if (operation == 3) { runMirror("http://www.w3schools.com/html/html_links.asp"); }else if (operation == 4) { runMirrorFromFile(); } //ping //router:ping("192.168.1.1" , 100); //ecom :p ing("193.227.14.57" , 5000); //newgradiance : ping("174.129.224.129" , 5000); //mirror // wikipedia:("https://en.wikipedia.org/wiki/Portal:Contents/A–Z_index"); //cu.edu. : mirror("http://cu.edu.eg/Home"); //wekibedia dumbs DONOT USE Its larg: ("https://dumps.wikimedia.org/enwiki/20160407/"); // floode : flood("193.227.14.57"); // check reachablity //curl ( "newgradiance.com") ; MPI_Finalize(); return 0; }
EncodedJSValue JSC_HOST_CALL jsTestSerializedScriptValueInterfacePrototypeFunctionMultiTransferList(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestSerializedScriptValueInterface::s_info)) return throwVMTypeError(exec); JSTestSerializedScriptValueInterface* castedThis = jsCast<JSTestSerializedScriptValueInterface*>(asObject(thisValue)); ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestSerializedScriptValueInterface::s_info); TestSerializedScriptValueInterface* impl = static_cast<TestSerializedScriptValueInterface*>(castedThis->impl()); size_t argsCount = exec->argumentCount(); if (argsCount <= 0) { impl->multiTransferList(); return JSValue::encode(jsUndefined()); } RefPtr<SerializedScriptValue> first(SerializedScriptValue::create(exec, MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined), 0, 0)); if (exec->hadException()) return JSValue::encode(jsUndefined()); if (argsCount <= 1) { impl->multiTransferList(first); return JSValue::encode(jsUndefined()); } Array* tx(toArray(MAYBE_MISSING_PARAMETER(exec, 1, DefaultIsUndefined))); if (exec->hadException()) return JSValue::encode(jsUndefined()); if (argsCount <= 2) { impl->multiTransferList(first, tx); return JSValue::encode(jsUndefined()); } RefPtr<SerializedScriptValue> second(SerializedScriptValue::create(exec, MAYBE_MISSING_PARAMETER(exec, 2, DefaultIsUndefined), 0, 0)); if (exec->hadException()) return JSValue::encode(jsUndefined()); if (argsCount <= 3) { impl->multiTransferList(first, tx, second); return JSValue::encode(jsUndefined()); } Array* txx(toArray(MAYBE_MISSING_PARAMETER(exec, 3, DefaultIsUndefined))); if (exec->hadException()) return JSValue::encode(jsUndefined()); impl->multiTransferList(first, tx, second, txx); return JSValue::encode(jsUndefined()); }
//printing function for debugging void Bag::print() { cout << "This bag has size: " << size << endl; ULLI* printArray = toArray(); for (int i = 0; i < size; ++i) { cout << printArray[i] << " "; } cout << endl; }
float* toxi::geom::Matrix4x4::toFloatArra() { float* result; double* tmp = toArray(); for (int i = 0; i < 16; i++) { result[i] = ( float ) tmp[i]; } return result; }
Value & Value::operator[] (size_t index) const { const Array *array = toArray(); if (array) { if (index < array->values.size()) { return *array->values[index]; } } return null; }
var clone (const var& original) const override { Array<var> arrayCopy; if (const Array<var>* array = toArray (original.value)) for (int i = 0; i < array->size(); ++i) arrayCopy.add (array->getReference(i).clone()); return var (arrayCopy); }
bool Object::equal(CObjRef v2) const { if (m_px == v2.get()) return true; if (!m_px || !v2.get()) return false; if (isResource() || v2.isResource()) return false; return (v2.get()->o_isClass(m_px->o_getClassName()) && toArray().equal(v2.toArray())); }
result_t MongoCursor::toJSON(const char *key, v8::Local<v8::Value> &retVal) { result_t hr; v8::Local<v8::Array> as; hr = toArray(as); if (hr < 0) return hr; retVal = as; return 0; }
Spectrogram::Spectrogram(FramesCollection& frames): m_frameCount(frames.count()), m_spectrumSize(frames.getSamplesPerFrame()), m_fft(FftFactory::getFft(m_spectrumSize)), m_data(new SpectrogramDataType(m_frameCount)) { std::size_t i = 0; for (auto it = frames.begin(); it != frames.end(); ++it, ++i) { (*m_data)[i] = m_fft->fft(it->toArray()); } }
const QuickString &KeyListOpsMethods::getDistinctSortNum(bool asc) { toArray(true, asc ? ASC : DESC); vector<double>::iterator endIter = std::unique(_numArray.begin(), _numArray.end()); _retStr.clear(); for (vector<double>::iterator iter = _numArray.begin(); iter != endIter; iter++) { if (iter != _numArray.begin()) _retStr += _delimStr; _retStr.append(*iter); } return _retStr; }
static void checkSendAcrossNetwork( Teuchos::RCP<Teuchos::Comm<int> const> const &comm, View1 const &ranks, View2 const &v_exp, View2 const &v_ref, bool &success, Teuchos::FancyOStream &out ) { Tpetra::Distributor distributor( comm ); distributor.createFromSends( toArray( ranks ) ); // NOTE here we assume that the reference solution is sized properly auto v_imp = Kokkos::create_mirror( typename View2::memory_space(), v_ref ); DataTransferKit::Details::DistributedSearchTreeImpl< DeviceType>::sendAcrossNetwork( distributor, v_exp, v_imp ); // FIXME not sure why I need that guy but I do get a bus error when it // is not here... Kokkos::fence(); TEST_COMPARE_ARRAYS( toArray( v_imp ), toArray( v_ref ) ); }
req::ptr<Directory> opendir(const String& path) override { static Func* f = SystemLib::s_PharClass->lookupMethod(s_opendir.get()); auto ret = Variant::attach( g_context->invokeFunc(f, make_packed_array(path), nullptr, SystemLib::s_PharClass) ); Array files = ret.toArray(); if (files.empty()) { raise_warning("No such file or directory"); return nullptr; } return req::make<ArrayDirectory>(files); }
void FlowValue::dump(bool x) const { fflush(stderr); switch (type_) { case FlowValue::VOID: printf("void"); break; case FlowValue::BOOLEAN: printf(toBool() ? "true" : "false"); break; case FlowValue::NUMBER: printf("%lld", toNumber()); break; case FlowValue::REGEXP: printf("/%s/", toRegExp().c_str()); break; case FlowValue::IP: printf("ip(%s)", toIPAddress().str().c_str()); break; case FlowValue::FUNCTION: printf("fnref(0x%p)", reinterpret_cast<void*>(toFunction())); break; case FlowValue::STRING: printf("'%s'", toString()); break; case FlowValue::BUFFER: { long long length = toNumber(); const char *p = toString(); std::string data(p, p + length); printf("'%s'", data.c_str()); break; } case FlowValue::ARRAY: { const FlowArray& p = toArray(); printf("["); for (size_t k = 0, ke = p.size(); k != ke; ++k) { if (k) printf(", "); p[k].dump(false); } printf("]"); break; } default: break; } if (x) printf("\n"); }
var clone (const var& original) const override { Array<var> arrayCopy; if (auto* array = toArray (original.value)) { arrayCopy.ensureStorageAllocated (array->size()); for (auto& i : *array) arrayCopy.add (i.clone()); } return var (arrayCopy); }