Esempio n. 1
0
void __init start_vmm ( const struct multiboot_info *mbi )
{
	//Initialize serial port COM1, this must be done before calling outf
	setup_serial();
	outf("\n\n\n!!!!!!!!!!!BEGIN!!!!!!!!!!!\n\n\n");

	//Parse the command line that user pass to GRUB
	struct cmdline_option opt = parse_cmdline ( mbi );

	//Set up memory layout and store the layout in pml
	struct pmem_layout pml;
	setup_memory(mbi, &opt, &pml);

	struct vm_info vm;
	vm_create (&vm, pml.vmm_pmem_start, opt.vmm_pmem_size, &(pml.e820));

	outf("\n++++++ New virtual machine created. Going to start the VM\n");
	vm_init (&vm);

	//Debug
	//e820_print_map(&(pml.e820));

	outf ("\n++++++ Going to GRUB for the 2nd time\n");
	vm_boot (&vm);
}
/*
 * ATIMach64SubsequentMono8x8PatternFillRect --
 *
 * This function performs an 8x8 1bpp pattern fill.
 */
static void
ATIMach64SubsequentMono8x8PatternFillRect
(
    ScrnInfoPtr pScreenInfo,
    int         patx,
    int         paty,
    int         x,
    int         y,
    int         w,
    int         h
)
{
    ATIPtr pATI = ATIPTR(pScreenInfo);

    ATIDRISync(pScreenInfo);

    if (pATI->XModifier != 1)
    {
        x *= pATI->XModifier;
        w *= pATI->XModifier;

        outf(DST_CNTL, SetBits((x / 4) % 6, DST_24_ROT) |
            (DST_X_DIR | DST_Y_DIR | DST_24_ROT_EN));
    }

    /* Disable clipping if it gets in the way */
    ATIMach64ValidateClip(pATI, x, x + w - 1, y, y + h - 1);

    ATIMach64WaitForFIFO(pATI, 2);
    outf(DST_Y_X, SetWord(x, 1) | SetWord(y, 0));
    outf(DST_HEIGHT_WIDTH, SetWord(w, 1) | SetWord(h, 0));
}
/*
 * ATIMach64SetupForSolidLine --
 *
 * This function sets up the draw engine for a series of solid lines.  It is
 * not used for 24bpp because the engine doesn't support it.
 */
static void
ATIMach64SetupForSolidLine
(
    ScrnInfoPtr  pScreenInfo,
    int          colour,
    int          rop,
    unsigned int planemask
)
{
    ATIPtr pATI = ATIPTR(pScreenInfo);

    ATIDRISync(pScreenInfo);

    ATIMach64WaitForFIFO(pATI, 5);
    outf(DP_WRITE_MASK, planemask);
    outf(DP_SRC, DP_MONO_SRC_ALLONES |
        SetBits(SRC_FRGD, DP_FRGD_SRC) | SetBits(SRC_BKGD, DP_BKGD_SRC));
    outf(DP_FRGD_CLR, colour);
    outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX));

    outf(CLR_CMP_CNTL, CLR_CMP_FN_FALSE);

    ATIMach64ValidateClip(pATI, pATI->NewHW.sc_left, pATI->NewHW.sc_right,
        pATI->NewHW.sc_top, pATI->NewHW.sc_bottom);
}
Esempio n. 4
0
static int ipfix_print_drecord( ipfixs_node_t      *s,
                                ipfixt_node_t      *t,
                                ipfix_datarecord_t *data,
                                void               *arg )
{
    char  tmpbuf[2000];
    int   i;
    FILE  *fp = (FILE*)arg;

    if ( !t || !s || !data )
        return -1;

    outf( fp, "DATA RECORD: \n" );
    outf( fp, " template id:  %u %s\n", t->ipfixt->tid,
          (t->ipfixt->nscopefields)?"(option record)":"" );
    outf( fp, " nfields:      %u\n", t->ipfixt->nfields );
    for ( i=0; i<t->ipfixt->nfields; i++ ) {
        outf( fp, " %s: ", t->ipfixt->fields[i].elem->ft->name );

        t->ipfixt->fields[i].elem->snprint( tmpbuf, sizeof(tmpbuf), 
                                            data->addrs[i], data->lens[i] );
        outf( fp, "%s\n", tmpbuf );
    }

    return 0;
}
Esempio n. 5
0
void
debug_back_trace (outf_channel stream)
{
  outf (stream, "*** Scheme Microcode Back Trace: ***\n");
  Back_Trace (stream);
  outf (stream, "*** End of Back Trace ***\n");
  outf_flush (stream);
}
Esempio n. 6
0
static void o_flush(void)
{
	if (o_qtype == 1)
		outf(") %d %d w\n", o_qh, o_qv);
	if (o_qtype == 2)
		outf("] %d %d g\n", o_qh, o_qv);
	o_qtype = 0;
}
Esempio n. 7
0
void EspServInfo::write_esp_binding_ng_ipp(EspMessageInfo *msgs)
{
    EspMethodInfo *mthi=NULL;

    outs("\n\n");
    outf("template <class base_binding> class CNg%sServiceBinding : public base_binding\n", name_);
    outs("{\npublic:\n");

    outf(1,"CNg%sServiceBinding(IPropertyTree* cfg, const char *bindname=NULL, const char *procname=NULL) : base_binding(cfg, bindname, procname){}\n", name_);
    
    outs(1,"IEspNgRequest* createRequest(const char *method)\n");
    outs(1,"{\n");
    int count=0;
    for (mthi=methods;mthi;mthi=mthi->next) 
    {
        outf(2,"%sif (!stricmp(method, \"%s\"))\n", (count++==0)? "" : "else ", mthi->getName());
        outs(2,"{\n");
        outf(3,"return new CNg%s(\"%s\");\n", mthi->getReq(), name_);
        outs(2,"}\n");
    }
    outs(2,"return NULL;\n");
    outs(1,"}\n\n");

    outs(1,"virtual IEspNgResponse* createResponse(const char *method)\n");
    outs(1,"{\n");
    count=0;
    for (mthi=methods;mthi;mthi=mthi->next) 
    {
        outf(2,"%sif (!stricmp(method, \"%s\"))\n", (count++==0)? "" : "else ", mthi->getName());
        outs(2,"{\n");
        outf(3,"return new CNg%s(\"%s\");\n", mthi->getResp(), name_);
        outs(2,"}\n");
    }
    outs(2,"return NULL;\n");
    outs(1,"}\n\n");

    //method ==> processRequest
    outs(1,"virtual int processRequest(IEspContext &context, const char *method_name, IEspNgRequest* req, IEspNgResponse* resp)\n");
    outs(1,"{\n");
    outf(2, "Owned<IEsp%s> iserv = (IEsp%s*)base_binding::getService();\n", name_, name_);
    count=0;
    for (mthi=methods;mthi;mthi=mthi->next) 
    {
        outf(2,"%sif (!stricmp(method_name, \"%s\")/*||!stricmp(req->queryName(), \"%s\")*/)\n", (count++==0)? "" : "else ", mthi->getName(), mthi->getReq());
        outs(2,"{\n");
        outf(3,"return iserv->on%s(context, *dynamic_cast<IEsp%s*>(req), *dynamic_cast<IEsp%s*>(resp));\n", mthi->getName(), mthi->getReq(), mthi->getResp());
        outs(2,"}\n");
    }
    outs(2,"return 0;\n");
    outs(1,"}\n\n");
    
    //method ==> getServiceName
    outf(1,"StringBuffer & getServiceName(StringBuffer &resp){resp.clear().append(\"%s\");}\n", name_);
    

    outs("};\n\n");
}
Esempio n. 8
0
static int ipfix_print_newmsg( ipfixs_node_t *s, ipfix_hdr_t *hdr, void *arg )
{
    char           timebuf[51];
    FILE           *fp = (FILE*)arg;

    /* print header
     */
    outf( fp, "IPFIX-HDR:\n version=%u,", hdr->version );
    if ( hdr->version == IPFIX_VERSION_NF9 ) {
        outf( fp, " records=%u\n", hdr->u.nf9.count );
        strftime( timebuf, 40, "%Y-%m-%d %T %Z", 
                  localtime( (const time_t *) &(hdr->u.nf9.unixtime) ));
        outf( fp, " sysuptime=%.3fs, unixtime=%lu (%s)\n", 
              (double)(hdr->u.nf9.sysuptime)/1000.0, 
              (u_long)hdr->u.nf9.unixtime, timebuf );
        outf( fp, " seqno=%lu,", (u_long)hdr->seqno );
        outf( fp, " sourceid=%lu\n", (u_long)hdr->sourceid );
    }
    else {
        outf( fp, " length=%u\n", hdr->u.ipfix.length );
        strftime( timebuf, 40, "%Y-%m-%d %T %Z", 
                  localtime( (const time_t *) &(hdr->u.ipfix.exporttime) ));
        outf( fp, " unixtime=%lu (%s)\n", 
              (u_long)hdr->u.ipfix.exporttime, timebuf );
        outf( fp, " seqno=%lu,", (u_long)hdr->seqno );
        outf( fp, " odid=%lu\n", (u_long)hdr->sourceid );
    }

    return 0;
}
Esempio n. 9
0
static int _mirrored_text_export(const struct lv_segment *seg, struct formatter *f)
{
        outf(f, "mirror_count = %u", seg->area_count);
        if (seg->status & PVMOVE)
                out_size(f, (uint64_t) seg->extents_copied * seg->lv->vg->extent_size,
                         "extents_moved = %" PRIu32, seg->extents_copied);
        if (seg->log_lv)
                outf(f, "mirror_log = \"%s\"", seg->log_lv->name);
        if (seg->region_size)
                outf(f, "region_size = %" PRIu32, seg->region_size);

        return out_areas(f, seg, "mirror");
}
Esempio n. 10
0
void ESDLcompiler::write_esp_ng_cpp()
{
    //create the *.esp file
    gOutfile = espngc;
    outf("// *** Source file generated by ESDL Version %s from %s.scm ***\n", ESDLVER, packagename);
    outf("// *** Not to be hand edited (changes will be lost on re-generation) ***\n\n"); 
    outf("#include \"%s_esp_ng.ipp\"\n\n\n", packagename);
    
    EspServInfo *si;
    for (si=servs;si;si=si->next) 
    {
        si->write_esp_binding_ng_cpp(msgs);
        outs("\n\n");
    }
}
Esempio n. 11
0
void LibraryUI::save() {
    QFile outf("libfile");
    outf.open(QIODevice::WriteOnly);
    QTextStream outstr(&outf);
    outstr << m_Lib->toString();
    outf.close();
}
Esempio n. 12
0
void CPluginsDialog::SaveCmds()
{
	CString dir = L"data";
	CreateDirectory(dir,NULL);
	dir += L"/";
	dir += _plugins->name().c_str();
	CreateDirectory(dir,NULL);
	
	CComDispatchDriver spScript;
	if(S_OK != m_spHtmlDoc->get_Script(&spScript))
	{
		return;
	}
	CComVariant varRet;  
	if(S_OK != spScript.Invoke0(L"get_cmds", &varRet))
	{
		return;
	}
	CString str = varRet;
	std::string utf8 = dark::windows::utf::to_utf8(str.GetBuffer());
	std::ofstream outf(dir + L"/cmds.json",std::ios::binary | std::ios::trunc | std::ios::out);
	if(outf.is_open())
	{
		outf.write(utf8.data(),utf8.size());
	}
}
Esempio n. 13
0
void call_dump_ism_entries::_(
  size_t the_ism_index,
  std::iostream::ios_base::openmode open_mode,
  std::string const& filename)
{
  std::ofstream outf(filename.c_str(), open_mode);
  for (
    ism_type::iterator pos = get_ism(the_ism_index).begin();
    pos!= get_ism(the_ism_index).end();
    ++pos
  ) {
    boost::mutex::scoped_lock l(*boost::tuples::get<4>(pos->second));
    if (boost::tuples::get<2>(pos->second)) {
      classad::ClassAd ad_ism_dump;
      ad_ism_dump.InsertAttr("id", pos->first);
      ad_ism_dump.InsertAttr(
        "update_time",
        boost::tuples::get<update_time_entry>(pos->second)
      );
      ad_ism_dump.InsertAttr(
        "expiry_time",
        boost::tuples::get<expiry_time_entry>(pos->second)
      );
      ad_ism_dump.Insert(
        "info",
        boost::tuples::get<ad_ptr_entry>(pos->second).get()->Copy()
      );
      outf << ad_ism_dump;
    }

    l.unlock();
  }
}
Int_t FitInvHist(TString str_infile, TString png_out_tag) {

	TFile* f_in = new TFile(str_infile);	
    

	vector<Double_t> fit_results = GetBWYieldPlusPoly((TH1F*)f_in->Get("h_massdist_accidsub"),png_out_tag,POLY_ORDER);	
	cout << "Yield of total histogram: " << fit_results[0] << " +/- " << fit_results[1] << " with chi2/ndf: " << fit_results[2] << endl;

    ofstream outf("data.txt");
    outf <<  fit_results[0] << endl;
    outf.close();


	TCanvas* c1 = new TCanvas ("c1","c1",800,600);
    TH1F *h_proton_p_theta_accidsub = (TH1F*)f_in->Get("h_proton_p_theta_accidsub");
    TH1F *h_pip_p_theta_accidsub = (TH1F*)f_in->Get("h_pip_p_theta_accidsub");
    TH1F *h_pim_p_theta_accidsub = (TH1F*)f_in->Get("h_pim_p_theta_accidsub");

    h_proton_p_theta_accidsub->Rebin2D();
    h_proton_p_theta_accidsub->Draw("COLZ");
    c1->Print("deltapi_proton_p_theta.png");
    h_pip_p_theta_accidsub->Rebin2D();
    h_pip_p_theta_accidsub->Draw("COLZ");
    c1->Print("deltapi_pip_p_theta.png");
    h_pim_p_theta_accidsub->Rebin2D();
    h_pim_p_theta_accidsub->Draw("COLZ");
    c1->Print("deltapi_pim_p_theta.png");
    delete c1;
	
	return 0;
}
Esempio n. 15
0
    //  Function initializes parameter structure for each thread and starts
    //  local_worker_function(s) in separate thread(s).
    void local_thr (i_transport *transport_, size_t msg_size_, 
        int msg_count_)
    {
        
        //  Timestamp captured after receiving first message.
        time_instant_t start_time = 0;

        //  Receive msg_nbr messages of msg_size.
        for (int msg_nbr = 0; msg_nbr < msg_count_; msg_nbr++)
        {
            size_t size = transport_->receive ();

            //  Capture arrival timestamp of the first message (test start).
            if (msg_nbr == 0)
                start_time  = now ();
            
            //  Check incomming message size.
            assert (size == msg_size_);
        }

        //  Capture test stop timestamp.
        time_instant_t stop_time = now();
        
        //  Send sync message to the peer.
        transport_->send (1);

        //  Calculate results.

        //  Test time in [ms] with [ms] resolution, do not use for math!!!
        uint64_t test_time = uint64_t (stop_time - start_time) /
            (uint64_t) 1000000;
                
        //  Throughput [msgs/s].
        uint64_t msg_thput = ((uint64_t) 1000000000 *
            (uint64_t) msg_count_) / (uint64_t) (stop_time - start_time);

        //  Throughput [Mb/s].
        uint64_t tcp_thput = (msg_thput * msg_size_ * 8) /
            (uint64_t) 1000000;
                
        std::cout << "Your average throughput is " << msg_thput 
            << " [msg/s]" << std::endl;
        std::cout << "Your average throughput is " << tcp_thput 
            << " [Mb/s]" << std::endl << std::endl;
 
        //  Save the results into tests.dat file.
        std::ofstream outf ("tests.dat", std::ios::out | std::ios::app);
        assert (outf.is_open ());
        
        //  Output file format, separate line for each run is appended 
        //  to the tests.dat file.
        //
        //  thread count, message count, msg size [B], test time [ms],
        //  throughput [msg/s],throughput [Mb/s]
        //
        outf << "1" << "," << msg_count_ << "," << msg_size_ << "," 
            << test_time << "," << msg_thput << "," << tcp_thput << std::endl;
        
        outf.close (); 
    }
Esempio n. 16
0
nomask private void main()
{
  outf("%s currently has the following quests:\n", mud_name());
  out(implode(QUEST_D->get_goals_for_quests_cmd(),"\n"));
  out("\n\nType help <questname> for more info about a quest.\n");

}
int main(int, char **)
{
    QFile outf("./sip/QtOpenGL/opengl_types.sip");

    if (!outf.open(QIODevice::WriteOnly|QIODevice::Truncate|QIODevice::Text))
        return 1;

    QTextStream out(&outf);

    if (sizeof (long) == sizeof (GLint))
        out << "typedef long GLint;\n";
    else
        out << "typedef int GLint;\n";

    if (sizeof (unsigned long) == sizeof (GLuint))
        out << "typedef unsigned long GLuint;\n";
    else
        out << "typedef unsigned GLuint;\n";

    if (sizeof (unsigned long) == sizeof (GLenum))
        out << "typedef unsigned long GLenum;\n";
    else
        out << "typedef unsigned GLenum;\n";

    if (sizeof (unsigned long) == sizeof (GLbitfield))
        out << "typedef unsigned long GLbitfield;\n";
    else
        out << "typedef unsigned GLbitfield;\n";

    out << "typedef float GLfloat;\n";

    return 0;
}
Esempio n. 18
0
void Dialog::on_pushButton_clicked()
{
    std::ofstream outf("Login Data.dat", std::ios::app);
    for (unsigned int i = 0 ; i < ui->listWidget->count() ; i++)
        outf << ui->listWidget->item(i)->text().toStdString() << std::endl;

}
Esempio n. 19
0
void Inventory::toFile(std::string filename){
    std::ofstream outf(filename);
    if (outf){
        if(filename == "game.txt"){
            for(int i = 0; i < numGames; i++){
                ItemADT* curr = gameStock.get(i);
                if(curr != nullptr){
                    outf << curr->fileFormat() + ",\n";
                }
            }
        }
        if(filename == "console.txt"){
            for(int i = 0; i < numConsoles; i++){
                ItemADT* curr = consoleStock.get(i);
                if(curr != nullptr){
                    outf << curr->fileFormat() + ",\n";
                }
            }

        }
        if(filename == "accessory.txt"){
            for(int i = 0; i < numAccessories; i++){
                ItemADT* curr = acessStock.get(i);
                if(curr != nullptr){
                    outf << curr->fileFormat() + ",\n";
                }
            }
        }	
//        outf.close();
    }
    else { // Print an error and exit
        outf.close();
        std::cout << "Unable to write to file.\n";
    }
}
Esempio n. 20
0
void xsection(Double_t rsi)
{
// Macro example for bases calculation.
  gROOT->Reset();
  TFile file("bases.root","RECREATE");

  jsf = new JSFSteer();    // required to read parameter from jsf.conf
  
  bases = new ZZHBases();
  bases->SetEcmInit(rsi);

//  bases->SetNoOfSample(10000);
//  bases->SetIteration1( 0.2, 10);
//  bases->SetIteration2( 0.1, 10);
  bases->Bases();
  bases->Bh_plot();
  bases->Userout();
  bases->Write();

  Double_t rs  = bases->GetEcmInit();
  Double_t sg  = bases->GetEstimate();
  Double_t dsg = bases->GetError();
  ofstream outf("xsection.zzh.dat",std::ios::app);
  outf << rs << " " << sg << " " << dsg << endl;

  file.Write();
}
Esempio n. 21
0
void ParamInfo::out_parameter(const char * pfx, int forclarion)
{
    if (forclarion && (clarion_special_type()==cte_cstr))
        outs("int, ");
    out_type();
    outf(" %s%s",pfx,name);
}
Esempio n. 22
0
/* -colin-
  if (m_SortValidFlag == FALSE)
  {
    Sort(DL_SAVINGS);
  }



  for (i = 0; i < (int) GetCount(); i++)
  {
    pMorpheme = GetAtSort(i);
    pMorpheme->Display( &List, i );

  }

}

void operator<< (ofstream& out, CMorphemeCollection& MC)
{
  for (int i = 0; i < MC.GetCount(); i++)
  out << MC.GetAt(i)->SpellOut() << " " << MC.GetAt(i)->GetDLSavings() << " ";

}

void CMorphemeCollection::Empty()
{

  m_TotalDLSavings = 0;
  TCollection<CMorpheme>::Empty();
}

void CMorphemeCollection::ClearAllMorphemeCounts()
{
  for (int  i = 0; i < GetCount(); i++)
  {
    GetAt(i)->SetMorphemeCount (0);
  }
}

  -colin- */
void CMorphemeCollection::OutputMorphemes (QString& FileName)
{
	Q_ASSERT(!FileName.isEmpty());

  CMorpheme*      pMorpheme;
  QFile        file( FileName );

  if( file.open( QIODevice::WriteOnly ) )
  {
    Q3TextStream outf( &file );
    outf.setEncoding ( Q3TextStream::Unicode );

    outf.setf(2);
    outf << GetCount();

    Sort( KEY );
    for (int i = 0; i< (int)GetCount(); i++)
    {
      pMorpheme = GetAtSort(i);

      outf << endl;
      outf.width(20);
      outf.width(20);
      outf.width(20);
      outf.width(20);
      outf << pMorpheme->Display( 0, m_pMiniLex->GetOutFilter() );
      outf << pMorpheme->GetMorphemeCount();
      outf << pMorpheme->GetFrequency();
      outf << pMorpheme->GetSuffixList()->Display( 0, m_pMiniLex->GetOutFilter() );
    }

    file.close();
  }
}
void outputpoly()
{
    //if(!NO_DISPLAY) 
    //    return;
    ofstream outf(string(objfilename + "-" + to_string(k) + ".poly.kmeans.wighted").c_str());
    streambuf *default_buf=cout.rdbuf(); 
    cout.rdbuf( outf.rdbuf() ); 
    vector<CP_Vector3D> unique_ones;

    for (unsigned int i = 0; i < polyhedra.size(); i++)
    {
        for (unsigned int j = 0; j < polyhedra[i]->data.size(); j++)
        {
            CP_Vector3D p = polyhedra[i]->data[j];
            if(!KDop3D::isInVec(p, unique_ones))
            {
                unique_ones.push_back(p);
            }
        }
    }
    for (unsigned int i = 0; i < unique_ones.size(); i++)
    {
        //cout << unique_ones[i].toString() << endl;
        cout << unique_ones[i].x << " " << unique_ones[i].y << " "  << unique_ones[i].z   << endl;
    }
    cout.rdbuf(default_buf);
}
Esempio n. 24
0
void PerfTrace::storeResult() {
	total.stop();
	double tot_ms = total.elapsed() / 1000.0;
	string logFn = format("logs\\%s_%s_perf.txt", getExeFileName().c_str(), getTimeString().c_str());
	std::replace(logFn.begin(), logFn.end(), ':', '-');
	std::replace(logFn.begin(), logFn.end(), ' ', '_');
	logFn = getInstalledFileName(logFn);
	std::ofstream outf(logFn.c_str());
	outf << "Total frames: " << frame_cpu_times.size() << "\n";
	outf << "Total time: " << tot_ms << "\n";
	outf << "Average FPS: " << frame_cpu_times.size()*1000 / tot_ms << "\n\n";

	auto eff_copy = frame_eff_times;
	std::sort(eff_copy.begin(), eff_copy.end());
	auto l = eff_copy.size();
	outf << "99 % frame time: " << eff_copy[static_cast<int>(floor(l * 0.99))] << "\n";
	outf << "95 % frame time: " << eff_copy[static_cast<int>(floor(l * 0.95))] << "\n";
	outf << "75 % frame time: " << eff_copy[static_cast<int>(floor(l * 0.75))] << "\n\n";

	outf << "Individual frames (cpu;gpu;effective):\n";
	for(size_t i = 0; i < l; ++i) {
		outf << format("%8.4f,%8.4f,%8.4f\n", frame_cpu_times[i], frame_gpu_times[i], frame_eff_times[i]);
	}
	outf << "\n";
}
Esempio n. 25
0
int surface::findClosest(const vert & v)
{
    double minDistance = 99999;
    double EPS = 1E-6;
    int vertIndex = 999999999;
    bool modified = false;
    int count_vert = 0;
    for (uint i=0; i<vertlist.size(); i++) 
    {
        double currentDistance = v.EuclideanDistance(vertlist[i]);
        if (currentDistance < minDistance && currentDistance < EPS) 
        {
            modified = true;
            minDistance = currentDistance; 
            vertIndex = i;
        }
    }
    if (!modified)
    {
        count_vert ++; 
        cerr << "Warning: Not able to find matching vertex." << endl;
        cerr << "Target vertex position = " 
             << v.position << endl;
        cerr << "Recording the convergence in out/DEBUG_non-matched-vertex-list.txt" << endl;
        ofstream outf("out/DEBUG_non-matched-vertex-list.txt", ios::app);
        outf << "============== Vertex " << count_vert << "th discovered ================== "<< endl;
        outf << "Target vertex detailed information: " << endl;
        outf << "----------------------------------- " << endl;
        outf << "Position = " << v.position << endl;
        outf << "======================================================= " << endl;
        outf << "Iteration Updated_vertex Current_Distance " << endl;
        int count = 0; 
        double currentDistance;
        for (uint i=0; i<vertlist.size(); i++) 
        {
            currentDistance = v.EuclideanDistance(vertlist[i]);
            if (currentDistance < minDistance && currentDistance) 
            {
                count ++; 
                modified = true;
                minDistance = currentDistance; 
                vertIndex = i;
                //cout << "Current Distance = " << minDistance << endl;
                //cout << "Updated at vertex " << i << endl; 
                outf << count << " " << i << " " << minDistance << endl;
            }
        }
        cerr << "For this vertex, distance " << currentDistance << " is used. " << endl;
        outf << "For this vertex, distance " << currentDistance << " is used. " << endl;
        //if (true)
        //{
        //    cerr << "Error: Not able to find matching vertex. Exiting." << endl;
        //    exit(1);
        //}
        outf.close();
    }

    return vertIndex; 
}
Esempio n. 26
0
	void generate()
	{
#define HEX_DUMP_WIDTH 16
#define HEX_DUMP_SPACE_WIDTH 96
#define HEX_DUMP_FORMAT "%-" BX_STRINGIZE(HEX_DUMP_SPACE_WIDTH) "." BX_STRINGIZE(HEX_DUMP_SPACE_WIDTH) "s"
		const uint8_t* data = &m_buffer[0];
		uint32_t size = (uint32_t)m_buffer.size();

		outf("static const uint8_t %s[%d] =\n{\n", m_name.c_str(), size);

		if (NULL != data)
		{
			char hex[HEX_DUMP_SPACE_WIDTH+1];
			char ascii[HEX_DUMP_WIDTH+1];
			uint32_t hexPos = 0;
			uint32_t asciiPos = 0;
			for (uint32_t ii = 0; ii < size; ++ii)
			{
				bx::snprintf(&hex[hexPos], sizeof(hex)-hexPos, "0x%02x, ", data[asciiPos]);
				hexPos += 6;

				ascii[asciiPos] = isprint(data[asciiPos]) && data[asciiPos] != '\\' ? data[asciiPos] : '.';
				asciiPos++;

				if (HEX_DUMP_WIDTH == asciiPos)
				{
					ascii[asciiPos] = '\0';
					outf("\t" HEX_DUMP_FORMAT "// %s\n", hex, ascii);
					data += asciiPos;
					hexPos = 0;
					asciiPos = 0;
				}
			}

			if (0 != asciiPos)
			{
				ascii[asciiPos] = '\0';
				outf("\t" HEX_DUMP_FORMAT "// %s\n", hex, ascii);
			}
		}

		outf("};\n");
#undef HEX_DUMP_WIDTH
#undef HEX_DUMP_SPACE_WIDTH
#undef HEX_DUMP_FORMAT
	}
Esempio n. 27
0
File: quests.c Progetto: Lundex/lima
nomask private void main()
{
  outf("%s currently has the following quests:\n", mud_name());
  out("(* after the quest indicates you have completed it)\n");
  out(implode(map(QUEST_D->get_goals_for_quests_cmd(),(:modify:)),"\n"));
  out("\n\nType help <questname> for more info about a quest.\n");
  out ("Or use the hint system.\n");
}
Esempio n. 28
0
static void o_queue(struct glyph *g)
{
	int type = 1 + (g->pos <= 0 || o_gname);
	if (o_qtype != type || o_qend != o_h || o_qv != o_v) {
		o_flush();
		o_qh = o_h;
		o_qv = o_v;
		o_qtype = type;
		outf(type == 1 ? "(" : "[");
	}
	if (o_qtype == 1) {
		if (g->pos >= ' ' && g->pos <= '~')
			outf("%s%c", strchr("()\\", g->pos) ? "\\" : "", g->pos);
		else
			outf("\\%d%d%d", (g->pos >> 6) & 7,
					(g->pos >> 3) & 7, g->pos & 7);
	} else {
Esempio n. 29
0
static int ipfix_print_newsource( ipfixs_node_t *s, void *arg ) 
{
    FILE *fp = (FILE*)arg;

    outf( fp, "#\n# new source: %s/%lu\n#\n",
          ipfix_col_input_get_ident( s->input ), (u_long)s->odid );
    return 0;
}
Esempio n. 30
0
/*#include "glite/wms/jdl/JobAdManipulation.h"
##include "glite/wms/jdl/PrivateAdManipulation.h"
#include "glite/wms/jdl/ManipulationExceptions.h"
#include "glite/wms/jdl/JDLAttributes.h"
#include "glite/wms/jdl/PrivateAttributes.h"

namespace jdl = glite::wms::jdl;
*/
int
main(int argc, char* argv[])
{
  std::ifstream inf;
  std::string   outputfile;

  // we read the ClassAds file.
  if (argc == 3) {
    inf.open(argv[1]);
    outputfile = argv[2];
  } else {
    std::cout << "Usage: "
         << argv[0]
         << " CLASSAD_CE_INFO_FILE"
	 << " CLASSAD_OUTPUT_FILE"
         << std::endl;
    return 1;
  }

  std::string input_ad;
  while (!inf.eof()) {
    std::string line;
    inf >> line;
    input_ad += line;
  }

  inf.close(); 

  // we define a ClassAds.
  classad::ClassAdParser parser;
  classad::ClassAd* ad = parser.ParseClassAd(input_ad.c_str());

  std::cout << "start parser: " << input_ad << std::endl;

  if (ad == 0)
  {
    std::cout << "Bad input classad file" << std::endl;
    return 1;
  }

  std::ofstream outf(outputfile.c_str());

  for (int i = 0; i<=3; i++) {
    classad::ClassAd ad1;

    ad1.InsertAttr("id", "ranatan.cnaf.infn.it:2190");

    ad1.InsertAttr("update_time", i);

    ad1.InsertAttr("expiry_time", 120+i);

    ad1.Insert("info", ad->Copy());

    outf << ad1;
  }

  delete ad;
}