From 9f418e16473837cd986679d19e63fa0623ecfe92 Mon Sep 17 00:00:00 2001 From: jdh8d <jdh8d@git.zephyr-software.com> Date: Mon, 25 May 2015 00:32:46 +0000 Subject: [PATCH] Former-commit-id: 80b2b18726bfa93f2a7f31ffa4eb0d612a40ccc3 --- .gitattributes | 1 + src/drivers/irdb/stars_driver.cpp | 81 +++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 src/drivers/irdb/stars_driver.cpp diff --git a/.gitattributes b/.gitattributes index c6109a1d..26fe4194 100644 --- a/.gitattributes +++ b/.gitattributes @@ -59,6 +59,7 @@ src/drivers/Makefile.in -text src/drivers/idapro/Makefile.in -text src/drivers/idapro/SMPStaticAnalyzer.cpp -text src/drivers/irdb/Makefile.in -text +src/drivers/irdb/stars_driver.cpp -text src/interfaces/Makefile.in -text src/interfaces/abstract/Makefile.in -text src/interfaces/abstract/STARSInstruction.cpp -text diff --git a/src/drivers/irdb/stars_driver.cpp b/src/drivers/irdb/stars_driver.cpp new file mode 100644 index 00000000..d0507eea --- /dev/null +++ b/src/drivers/irdb/stars_driver.cpp @@ -0,0 +1,81 @@ +#include <stdlib.h> +#include <fstream> +#include <libIRDB-core.hpp> +#include <libgen.h> + +using namespace std; +using namespace libIRDB; + +#include "interfaces/abstract/STARSInterface.h" +#include "interfaces/irdb/STARSInterface.h" + +STARS_Interface_t* global_stars_interface = NULL; +STARS_Program_t *global_STARS_program = NULL; + + + +void usage(char* name) +{ + cerr<<"Usage: "<<name<<" <variant_id>\n"; +} + +int main(int argc, char **argv) +{ + if(argc != 2) + { + usage(argv[0]); + exit(1); + } + + string programName(argv[0]); + int variantID = atoi(argv[1]); + + VariantID_t *pidp=NULL; + + /* setup the interface to the sql server */ + pqxxDB_t pqxx_interface; + BaseObj_t::SetInterface(&pqxx_interface); + + pidp=new VariantID_t(variantID); + assert(pidp->IsRegistered()==true); + + cout<<argv[0]<<" started\n"; + + for(set<File_t*>::iterator it=pidp->GetFiles().begin(); + it!=pidp->GetFiles().end(); + ++it) + { + File_t* this_file = *it; + FileIR_t *firp = new FileIR_t(*pidp, this_file); + + cout<<"Transforming "<<this_file->GetURL()<<endl; + + assert(firp && pidp); + + try + { + + int success=true; + + // run stars + global_stars_interface = new STARS_IRDB_Interface_t(firp); + + //firp->WriteToDB(); + delete firp; + } + catch (DatabaseError_t pnide) + { + cerr << programName << ": Unexpected database error: " << pnide << "file url: " << this_file->GetURL() << endl; + } + catch (...) + { + cerr << programName << ": Unexpected error file url: " << this_file->GetURL() << endl; + } + } // end file iterator + + //cout<<"Commiting changes...\n"; + //pqxx_interface.Commit(); + + return 0; +} + -- GitLab