void LPGPTranslator::write_problem(ostream & o,const problem * p) { o << "(define (problem " << p->name << ")\n\t(:domain " << p->domain_name << ")\n\t(:objects"; for_each(p->objects->begin(),p->objects->end(),Writer(o)); o << ")\n\t(:init "; for_each(p->initial_state->add_effects.begin(),p->initial_state->add_effects.end(),Writer(o)); for_each(p->initial_state->assign_effects.begin(),p->initial_state->assign_effects.end(),Writer(o)); o << ")\n\t(:goal " << *(p->the_goal) << ")\n"; if(p->metric) o << *(p->metric); o << ")\n"; };
void PrettyPrinter::write_problem(ostream & o,const problem * p) { o << "(define (problem " << p->name << ")\n\t(:domain " << p->domain_name << ")\n\t(:objects"; for_each(p->objects->begin(),p->objects->end(),Writer(o)); o << ")\n\t(:init "; inInitial = true; showType = false; for_each(p->initial_state->add_effects.begin(),p->initial_state->add_effects.end(),Writer(o)); for_each(p->initial_state->assign_effects.begin(),p->initial_state->assign_effects.end(),Writer(o)); inInitial = false; o << ")\n\t(:goal " << *(p->the_goal) << ")\n"; if(p->metric) o << *(p->metric); o << ")\n"; };
void LPGPTranslator::write_effect_lists(ostream & o,const effect_lists * p) { bool tt = (p->add_effects.size() + p->del_effects.size() + p->forall_effects.size() + p->cond_effects.size() + p->assign_effects.size() + p->timed_effects.size() > 1); if(tt) o << "(and"; for_each(p->add_effects.begin(),p->add_effects.end(),Writer(o)); for_each(p->del_effects.begin(),p->del_effects.end(),NotWriter(o)); for_each(p->forall_effects.begin(),p->forall_effects.end(),Writer(o)); for_each(p->cond_effects.begin(),p->cond_effects.end(),Writer(o)); for_each(p->assign_effects.begin(),p->assign_effects.end(),Writer(o)); for_each(p->timed_effects.begin(),p->timed_effects.end(),Writer(o)); if(tt) o << ")"; };
/// viewInheritance - Display the inheritance hierarchy of this C++ /// class using GraphViz. void CXXRecordDecl::viewInheritance(ASTContext& Context) const { QualType Self = Context.getTypeDeclType(this); std::string ErrMsg; sys::Path Filename = sys::Path::GetTemporaryDirectory(&ErrMsg); if (Filename.isEmpty()) { llvm::errs() << "Error: " << ErrMsg << "\n"; return; } Filename.appendComponent(Self.getAsString() + ".dot"); if (Filename.makeUnique(true,&ErrMsg)) { llvm::errs() << "Error: " << ErrMsg << "\n"; return; } llvm::errs() << "Writing '" << Filename.c_str() << "'... "; llvm::raw_fd_ostream O(Filename.c_str(), ErrMsg); if (ErrMsg.empty()) { InheritanceHierarchyWriter Writer(Context, O); Writer.WriteGraph(Self); llvm::errs() << " done. \n"; O.close(); // Display the graph DisplayGraph(Filename); } else { llvm::errs() << "error opening file for writing!\n"; } }
void FTransaction::FObjectRecord::Restore( FTransaction* Owner ) { if( !bRestored ) { bRestored = true; TArray<uint8> FlipData; TArray<FReferencedObject> FlipReferencedObjects; TArray<FName> FlipReferencedNames; TSharedPtr<ITransactionObjectAnnotation> FlipObjectAnnotation; if( Owner->bFlip ) { FlipObjectAnnotation = Object->GetTransactionAnnotation(); FWriter Writer( FlipData, FlipReferencedObjects, FlipReferencedNames, bWantsBinarySerialization ); SerializeContents( Writer, -Oper ); } FTransaction::FObjectRecord::FReader Reader( Owner, Data, ReferencedObjects, ReferencedNames, bWantsBinarySerialization ); SerializeContents( Reader, Oper ); if( Owner->bFlip ) { Exchange( ObjectAnnotation, FlipObjectAnnotation ); Exchange( Data, FlipData ); Exchange( ReferencedObjects, FlipReferencedObjects ); Exchange( ReferencedNames, FlipReferencedNames ); Oper *= -1; } } }
template <typename T> static std::string serialize(T &I) { SmallString<2048> Buffer; llvm::BitstreamWriter Stream(Buffer); ClangDocBitcodeWriter Writer(Stream); Writer.emitBlock(I); return Buffer.str().str(); }
void GameProperties::Save() { CIniWriter Writer(CFG_FILENAME); Writer.WriteInteger("settings" , "app_width" , GameProperties::Width); Writer.WriteInteger("settings" , "app_height" , GameProperties::Height); Writer.WriteInteger("settings" , "app_windowed" , GameProperties::Windowed); }
//???remove from here? make user use readers/writers directly? void CDataServer::SavePRM(const nString& FileName, PParams Content) { if (!Content.isvalid()) return; CFileStream File; if (!File.Open(FileName, SAM_WRITE)) return; CBinaryWriter Writer(File); Writer.WriteParams(*Content); }
//--------------------------------------------------------------------------- void __fastcall TForm1::FormSaveState(TObject *Sender) { SaveState->Stream->Clear(); if(!FClearState && AppAnalytics1->AllowTracking) { std::unique_ptr<TBinaryWriter> Writer(new TBinaryWriter(SaveState->Stream)); Writer->Write(AppAnalytics1->UserID); Writer->Write(AppAnalytics1->AllowTracking); } }
void RelaxTranslator::write_effect_lists(ostream & o,const effect_lists * p) { bool tt = (p->add_effects.size() + p->del_effects.size() + p->forall_effects.size() + p->cond_effects.size() + p->assign_effects.size() + p->timed_effects.size() > 1); if(tt || firstCall) o << "(and"; bool f = firstCall; firstCall = false; for_each(p->add_effects.begin(),p->add_effects.end(),Writer(o)); for_each(p->del_effects.begin(),p->del_effects.end(),NotWriter(o)); for_each(p->forall_effects.begin(),p->forall_effects.end(),Writer(o)); for_each(p->cond_effects.begin(),p->cond_effects.end(),Writer(o)); for_each(p->assign_effects.begin(),p->assign_effects.end(),Writer(o)); for_each(p->timed_effects.begin(),p->timed_effects.end(),Writer(o)); firstCall = f; if(tt || firstCall) o << ")"; };
medDataReaderWriter::Writer medDataReaderWriter::writer(const QString& path,const medAbstractData* data) { if (!data) return Writer(); QList<QString> writers = medAbstractDataFactory::instance()->writers(); static Writer dwriter; if (!dwriter.isNull() && dwriter->handled().contains(data->identifier()) && dwriter->canWrite(path)) return dwriter; for (int i=0;i<writers.size();++i) { dwriter = medAbstractDataFactory::instance()->writerSmartPointer(writers[i]); if (dwriter->handled().contains(data->identifier()) && dwriter->canWrite(path)) { dwriter->enableDeferredDeletion(false); return dwriter; } } return dwriter = Writer(); }
void PrettyPrinter::write_domain(ostream & o,const domain * p) { string s = pddl_req_flags_string(p->req ^ E_DURATIVE_ACTIONS); o << "(define (domain " << p->name << ")\n(:requirements " << s << ":continuous-effects)\n"; if(p->types) { o << "(:types " << *(p->types) << ")\n"; }; o << "(:predicates\n\t"; if(p->predicates) { for_each(p->predicates->begin(),p->predicates->end(),Writer(o)); }; // PredWriter pw(o); // p->ops->visit(&pw); o << ")\n"; if(p->functions) { o << "(:functions\n\t"; for_each(p->functions->begin(),p->functions->end(),Writer(o)); o << ")\n"; }; if(p->constants) { o << "(:constants\n\t"; for_each(p->constants->begin(),p->constants->end(),Writer(o)); o << ")\n"; }; o << "\n"; p->ops->write(o); o << ")\n"; };
void RelaxTranslator::write_domain(ostream & o,const domain * p) { string s = pddl_req_flags_string(p->req ^ E_TIME); o << "(define (domain " << p->name << ")\n(:requirements " << s << ")\n"; if(p->types) { o << "(:types " << *(p->types) << ")\n"; }; o << "(:predicates\n\t"; if(p->predicates) { for_each(p->predicates->begin(),p->predicates->end(),Writer(o)); }; o << ")\n"; if(p->functions) { o << "(:functions\n\t"; for_each(p->functions->begin(),p->functions->end(),Writer(o)); o << ")\n"; }; if(p->constants) { o << "(:constants\n\t"; for_each(p->constants->begin(),p->constants->end(),Writer(o)); o << ")\n"; }; o << "\n"; p->ops->write(o); o << ")\n"; };
void Profiles::Save() { CIniWriter Writer(PROFILES_FILENAME); for(int i = 0; i < 3; i++) { std::string Section = const_cast<char*>((std::string("prof")+ToString(i)).c_str()) ; Writer.WriteString(const_cast<char*>(Section.c_str()) , "name" , const_cast<char*>(Profiles::profiles[i].Name.c_str())); Writer.WriteInteger(const_cast<char*>(Section.c_str()) , "jump" , Profiles::profiles[i].Jump); Writer.WriteInteger(const_cast<char*>(Section.c_str()) , "flag" , Profiles::profiles[i].Flag); Writer.WriteInteger(const_cast<char*>(Section.c_str()) , "unlocked_level" , Profiles::profiles[i].UnlockedLevel); Writer.WriteInteger(const_cast<char*>(Section.c_str()) , "settedup" , Profiles::profiles[i].SettedUp); } }
void ezReloadableVariableBase::StoreVariables() { if (s_StoredVariables == NULL) s_StoredVariables = EZ_DEFAULT_NEW(MemStreamMap); ezReloadableVariableBase* pVar = GetFirstInstance(); while (pVar) { ezMemoryStreamWriter Writer(&(*s_StoredVariables)[pVar->m_szVariableName]); pVar->SaveState(Writer); pVar = pVar->GetNextInstance(); } }
void FTransaction::FObjectRecord::Save(FTransaction* Owner) { // common undo/redo path, before applying undo/redo buffer we save current state: check(Owner->bFlip); if (!bRestored) { FlipData.Empty(); FlipReferencedObjects.Empty(); FlipReferencedNames.Empty(); FlipObjectAnnotation = TSharedPtr<ITransactionObjectAnnotation>(); FlipObjectAnnotation = Object->GetTransactionAnnotation(); FWriter Writer(FlipData, FlipReferencedObjects, FlipReferencedNames, bWantsBinarySerialization); SerializeContents(Writer, -Oper); } }
bool cBlockArea::SaveToSchematicFile(const AString & a_FileName) { cFastNBTWriter Writer("Schematic"); Writer.AddShort("Width", m_SizeX); Writer.AddShort("Height", m_SizeY); Writer.AddShort("Length", m_SizeZ); Writer.AddString("Materials", "Alpha"); if (HasBlockTypes()) { Writer.AddByteArray("Blocks", (const char *)m_BlockTypes, GetBlockCount()); } else { AString Dummy(GetBlockCount(), 0); Writer.AddByteArray("Blocks", Dummy.data(), Dummy.size()); } if (HasBlockMetas()) { Writer.AddByteArray("Data", (const char *)m_BlockMetas, GetBlockCount()); } else { AString Dummy(GetBlockCount(), 0); Writer.AddByteArray("Data", Dummy.data(), Dummy.size()); } // TODO: Save entities and block entities Writer.BeginList("Entities", TAG_Compound); Writer.EndList(); Writer.BeginList("TileEntities", TAG_Compound); Writer.EndList(); Writer.Finish(); // Save to file cGZipFile File; if (!File.Open(a_FileName, cGZipFile::fmWrite)) { LOG("Cannot open file \"%s\" for writing.", a_FileName.c_str()); return false; } if (!File.Write(Writer.GetResult())) { LOG("Cannot write data to file \"%s\".", a_FileName.c_str()); return false; } return true; }
bool FJsonStructSerializerTest::RunTest( const FString& Parameters ) { // json { TArray<uint8> Buffer; FMemoryReader Reader(Buffer); FMemoryWriter Writer(Buffer); FJsonStructSerializerBackend SerializerBackend(Writer); FJsonStructDeserializerBackend DeserializerBackend(Reader); StructSerializerTest::TestSerialization(*this, SerializerBackend, DeserializerBackend); // uncomment this to look at the serialized data //uint8* Data = Buffer.GetData(); //GLog->Logf(TEXT("%s"), (TCHAR*)Data); } return true; }
void writeIfModified() { if(!file || !arch) return; // If modified, the archive is written back to the file. if(arch->modified()) { LOG_RES_MSG("Updating archive in ") << file->description(); // Make sure we have either a compressed or uncompressed version of // each entry in memory before destroying the source file. arch->cache(); file->clear(); Writer(*file) << *arch; file->flush(); } else { LOG_RES_VERBOSE("Not updating archive in %s (not changed)") << file->description(); } }
FTransaction::FObjectRecord::FObjectRecord(FTransaction* Owner, UObject* InObject, FScriptArray* InArray, int32 InIndex, int32 InCount, int32 InOper, int32 InElementSize, STRUCT_DC InDefaultConstructor, STRUCT_AR InSerializer, STRUCT_DTOR InDestructor) : Object ( InObject ) , Array ( InArray ) , Index ( InIndex ) , Count ( InCount ) , Oper ( InOper ) , ElementSize ( InElementSize ) , DefaultConstructor ( InDefaultConstructor ) , Serializer ( InSerializer ) , Destructor ( InDestructor ) , bRestored ( false ) , bWantsBinarySerialization ( true ) { // Blueprint compile-in-place can alter class layout so use tagged serialization for objects relying on a UBlueprint's Class if (UBlueprintGeneratedClass* Class = Cast<UBlueprintGeneratedClass>(InObject->GetClass())) { bWantsBinarySerialization = false; } ObjectAnnotation = Object->GetTransactionAnnotation(); FWriter Writer( Data, ReferencedObjects, ReferencedNames, bWantsBinarySerialization ); SerializeContents( Writer, Oper ); }
AString cSchematicFileSerializer::SaveToSchematicNBT(const cBlockArea & a_BlockArea) { cFastNBTWriter Writer("Schematic"); Writer.AddShort("Width", static_cast<Int16>(a_BlockArea.m_Size.x)); Writer.AddShort("Height", static_cast<Int16>(a_BlockArea.m_Size.y)); Writer.AddShort("Length", static_cast<Int16>(a_BlockArea.m_Size.z)); Writer.AddString("Materials", "Alpha"); if (a_BlockArea.HasBlockTypes()) { Writer.AddByteArray("Blocks", reinterpret_cast<const char *>(a_BlockArea.GetBlockTypes()), a_BlockArea.GetBlockCount()); } else { AString Dummy(a_BlockArea.GetBlockCount(), 0); Writer.AddByteArray("Blocks", Dummy.data(), Dummy.size()); } if (a_BlockArea.HasBlockMetas()) { Writer.AddByteArray("Data", reinterpret_cast<const char *>(a_BlockArea.GetBlockMetas()), a_BlockArea.GetBlockCount()); } else { AString Dummy(a_BlockArea.GetBlockCount(), 0); Writer.AddByteArray("Data", Dummy.data(), Dummy.size()); } Writer.AddInt("WEOffsetX", a_BlockArea.m_WEOffset.x); Writer.AddInt("WEOffsetY", a_BlockArea.m_WEOffset.y); Writer.AddInt("WEOffsetZ", a_BlockArea.m_WEOffset.z); // TODO: Save entities and block entities Writer.BeginList("Entities", TAG_Compound); Writer.EndList(); Writer.BeginList("TileEntities", TAG_Compound); Writer.EndList(); Writer.Finish(); return Writer.GetResult(); }
static bool DeserializeResponseToStruct(void* OutStruct, UStruct& TypeInfo, FHttpResponsePtr HttpResponse) { bool bResult = false; FString ResponseStr = HttpResponse->GetContentAsString(); FText ErrorText; if (HttpResponse.IsValid()) { if (EHttpResponseCodes::IsOk(HttpResponse->GetResponseCode())) { // Write string to FMemoryWriter to force unicode TArray<uint8> InBytes; FMemoryWriter Writer(InBytes); Writer.ArForceUnicode = true; Writer << ResponseStr; FMemoryReader Reader(InBytes); // FMemoryWriter writes size of string at beginning, need to ignore this or json parsing errors occur Reader.Seek(4); FJsonStructDeserializerBackend Backend(Reader); bResult = FStructDeserializer::Deserialize(OutStruct, TypeInfo, Backend); } else { ErrorText = FText::Format(LOCTEXT("InvalidResponse", "Invalid response. code={0} error={1}"), FText::FromString(FString::FromInt(HttpResponse->GetResponseCode())), FText::FromString(ResponseStr)); } } if (!bResult) { UE_LOG(LogLocalizationService, Warning, TEXT("%s"), *(ErrorText.ToString())); } return bResult; }
void FTransaction::FObjectRecord::Restore( FTransaction* Owner ) { if( !bRestored ) { bRestored = true; TArray<uint8> FlipData; TArray<UObject*> FlipReferencedObjects; TArray<FName> FlipReferencedNames; if( Owner->bFlip ) { FWriter Writer( FlipData, FlipReferencedObjects, FlipReferencedNames, bWantsBinarySerialization ); SerializeContents( Writer, -Oper ); } FTransaction::FObjectRecord::FReader Reader( Owner, Data, ReferencedObjects, ReferencedNames, bWantsBinarySerialization ); SerializeContents( Reader, Oper ); if( Owner->bFlip ) { Exchange( Data, FlipData ); Exchange( ReferencedObjects, FlipReferencedObjects ); Exchange( ReferencedNames, FlipReferencedNames ); Oper *= -1; } } }
void LPGPTranslator::write_domain(ostream & o,const domain * p) { o << "(define (domain " << p->name << ")\n(:requirements :strips :equality)\n"; o << "(:predicates\n\t"; if(p->predicates) { for_each(p->predicates->begin(),p->predicates->end(),Writer(o)); }; o << ")\n"; /* if(p->functions) { o << "(:functions\n\t"; for_each(p->functions->begin(),p->functions->end(),Writer(o)); o << ")\n"; }; */ p->ops->write(o); o << ")\n"; };
void FAnimationFrameSnapshot::InitializeFromInstance(UAnimInstance* Instance) { FBinaryObjectWriter Writer(Instance, SerializedData); TimeStamp = Instance->LifeTimer; }
//! Return a BlockWriter delivering to this BlockQueue. Writer GetWriter(size_t block_size = default_block_size) { return Writer(this, block_size); }
Writer Writer::sexpr(std::ostream& out) { return Writer(util::make_unique<SExprWriterImpl>(out)); }
Writer Writer::json(std::ostream& out) { return Writer(util::make_unique<JsonPrettyWriterImpl>(out)); }
void UK2Node_AddComponent::PostPasteNode() { Super::PostPasteNode(); // There is a template associated with this node that should be unique, but after a node is pasted, it either points to a // template shared by the copied node, or to nothing (when pasting into a different blueprint) const UEdGraphSchema_K2* K2Schema = GetDefault<UEdGraphSchema_K2>(); UBlueprint* Blueprint = GetBlueprint(); // Find the template name and return type pins UEdGraphPin* TemplateNamePin = GetTemplateNamePin(); UEdGraphPin* ReturnPin = GetReturnValuePin(); if ((TemplateNamePin != NULL) && (ReturnPin != NULL)) { // Find the current template if it exists FString TemplateName = TemplateNamePin->DefaultValue; UActorComponent* SourceTemplate = Blueprint->FindTemplateByName(FName(*TemplateName)); // Determine the type of the component needed UClass* ComponentClass = Cast<UClass>(ReturnPin->PinType.PinSubCategoryObject.Get()); if (ComponentClass) { ensure(NULL != Cast<UBlueprintGeneratedClass>(Blueprint->GeneratedClass)); // Create a new template object and update the template pin to point to it UActorComponent* NewTemplate = NewObject<UActorComponent>(Blueprint->GeneratedClass, ComponentClass, NAME_None, RF_ArchetypeObject|RF_Public); Blueprint->ComponentTemplates.Add(NewTemplate); TemplateNamePin->DefaultValue = NewTemplate->GetName(); // Copy the old template data over to the new template if it's compatible if ((SourceTemplate != NULL) && (SourceTemplate->GetClass()->IsChildOf(ComponentClass))) { TArray<uint8> SavedProperties; FObjectWriter Writer(SourceTemplate, SavedProperties); FObjectReader(NewTemplate, SavedProperties); } else if(TemplateBlueprint.Len() > 0) { // try to find/load our blueprint to copy the template UBlueprint* SourceBlueprint = FindObject<UBlueprint>(NULL, *TemplateBlueprint); if(SourceBlueprint != NULL) { SourceTemplate = SourceBlueprint->FindTemplateByName(FName(*TemplateName)); if ((SourceTemplate != NULL) && (SourceTemplate->GetClass()->IsChildOf(ComponentClass))) { TArray<uint8> SavedProperties; FObjectWriter Writer(SourceTemplate, SavedProperties); FObjectReader(NewTemplate, SavedProperties); } } TemplateBlueprint.Empty(); } } else { // Clear the template connection; can't resolve the type of the component to create ensure(false); TemplateNamePin->DefaultValue = TEXT(""); } } }
int main(int argc, char *argv[]) { int i,rc; Filter_t *fh; int max; if(argc > 1) parse_cmd_line(argc,argv); srand(getpid()); mai_init(); rc=ib_init_devport(&ib_dev, &ib_port, NULL); if (rc) { printf("ERROR: ib_init_devport failed, %s\n",cs_convert_status(rc)); exit(1); } for(i=0;i<fdcount;i++) { if ((rc = mai_open(0, ib_dev, ib_port, &fd[i])) != VSTATUS_OK) { printf("ERROR: can't open mai %s\n", cs_convert_status(rc)); exit(1); } } printf("\nINFO: PRE-TEST layers charecteristics %d\n",0); mode = fmode; switch(mode) { case FILTER_EXPOSED: printf("********** EXPOSED FILTER MODE *************\n"); break; case FILTER_METHOD: printf("********** METHOD MODE *********************\n"); break; case FILTER_AID: printf("********** AID MODE ************************\n"); break; case FILTER_AMOD: printf("********** AMOD MODE ************************\n"); break; case FILTER_ONCE: printf("********** ONCE MODE not supported *************************\n"); exit(-1); break; default: printf("********** UNKOWN MODE ***********************\n"); exit(-1); break; } memset(&all_filter,0,sizeof(all_filter)); max = fdcount; fh = &all_filter[0]; //First we linearly create the filters and delete them in the order //they were created. if(readers) { for(i=0;i<max;i++) { char name[32]; switch(mode) { case FILTER_EXPOSED: { IBhandle_t hd; fh->dev = ib_dev; fh->qp = MAI_FILTER_ANY; fh->port= ib_port; fh->type = MAI_TYPE_ANY; fh->value.bversion = i%2; fh->value.mclass = i%256; fh->value.cversion = i%256; fh->value.method = i%256; fh->value.status = i%(1<<16); fh->value.hopPointer = i%64; fh->value.hopCount = i%64; fh->value.tid = i; fh->value.aid = i%(1<<16); fh->value.amod = i; fh->mask.bversion = MAI_FMASK_ALL; fh->mask.mclass = MAI_FMASK_ALL; fh->mask.cversion = MAI_FMASK_ALL; fh->mask.method = MAI_FMASK_ALL; fh->mask.status = MAI_FMASK_ALL; fh->mask.hopPointer = MAI_FMASK_ALL; fh->mask.hopCount = MAI_FMASK_ALL; fh->mask.tid = MAI_FMASK_ALL; fh->mask.aid = MAI_FMASK_ALL; fh->mask.amod = MAI_FMASK_ALL; fh->active = (MAI_ACT_QP | MAI_ACT_DEV | MAI_ACT_TYPE | MAI_ACT_PORT | MAI_ACT_FMASK); sprintf(name,"Fil %d",i); MAI_SET_FILTER_NAME(fh,name); //now create the filter rc = mai_filter_hcreate(fd[i%fdcount],fh,flags,&all_handles[i]); if(rc != VSTATUS_OK) { printf("ERROR: %d - Unable to create filter\n",i); printf("ERROR: %s - mai_filter_create return status\n",cs_convert_status(rc)); exit(-1); } //now get the handle and compare .. make sure they //point to the same thing. rc = mai_filter_handle(fd[i%fdcount],fh,flags,&hd); if(rc != VSTATUS_OK) { printf("ERROR: %d - Unable to get filter handle\n",i); printf("ERROR: %s - mai_filter_handle return status\n",cs_convert_status(rc)); exit(-1); } if(hd != all_handles[i]) { printf("ERROR: %d - Filter handles do not agree\n",i); exit(-1); } fh++; } break; case FILTER_METHOD: { rc = mai_filter_method(fd[i%fdcount],flags,MAI_TYPE_INTERNAL,&all_handles[i],i/256,i%256); if(rc != VSTATUS_OK) { printf("ERROR: %d - Unable to create filter\n",i); printf("ERROR: %s - mai_filter_method return status\n",cs_convert_status(rc)); exit(-1); } } break; case FILTER_AID: { rc = mai_filter_aid(fd[i%fdcount],flags,MAI_TYPE_INTERNAL,&all_handles[i],i/256,i%256,i); if(rc != VSTATUS_OK) { printf("ERROR: %d - Unable to create filter\n",i); printf("ERROR: %s - mai_filter_aid return status\n",cs_convert_status(rc)); exit(-1); } } break; case FILTER_AMOD: { rc = mai_filter_amod(fd[i%fdcount],flags,MAI_TYPE_INTERNAL,&all_handles[i],i/256,i%256,i,i); if(rc != VSTATUS_OK) { printf("ERROR: %d - Unable to create filter\n",i); printf("ERROR: %s - mai_filter_amod return status\n",cs_convert_status(rc)); exit(-1); } } break; case FILTER_ONCE: { rc = mai_filter_once(fd[i%fdcount],flags,MAI_TYPE_INTERNAL,&all_handles[i],i/256,i); if(rc != VSTATUS_OK) { printf("ERROR: %d - Unable to create filter\n",i); printf("ERROR: %s - mai_filter_method return status\n",cs_convert_status(rc)); exit(-1); } } break; default: { printf("ERROR: %d - Unknown filter test mode\n",mode); exit(-1); } } } } if(writer) { //start the writer thread if(readers==0) { i=Writer(); shutdown_test(i); } else { //start the workert thread rc = vs_thread_create(&thandle[thread_cnt], (unsigned char*)"Writer",//name (void (*) (uint32_t,uint8_t**)) Writer, //func 0, //argc NULL, //argptr STACK_SIZE //stacksize ); if(rc) { printf("ERROR (%s): creating Writer thread\n", cs_convert_status(rc)); exit(-1); } printf("\nINFO: Writer thread created %s\n",cs_convert_status(rc)); thread_cnt++; } } if(readers) { int threads=0; int idx; if(fdcount > 2) { int threads; //start 2 normal readers and then //a wait_handle reader if(fdcount == 3) { threads = 1; idx = 2; } else { threads = 2; idx = fdcount - 2; } //now start single handle readers for(i=0;i<threads;i++) { thread_argv[thread_cnt][0] = (uint8_t*)(unsigned long)idx++; thread_argv[thread_cnt][1] = (uint8_t*)(unsigned long)1; rc = vs_thread_create(&thandle[thread_cnt], (unsigned char*)"Reader",//name (void (*) (uint32_t,uint8_t**))ThreadStart, //func 2, //argc (uint8_t **)&thread_argv[thread_cnt], //argptr STACK_SIZE //stacksize ); if(rc) { printf("ERROR (%s): creating reader thread\n", cs_convert_status(rc)); return -1; } thread_cnt++; } } //now do multi handle recv Reader(0,fdcount-threads); while(threads); } shutdown_test(mads-loop); return 0; }