Exemple #1
0
DgOutLocFile& 
DgOutGeoJSONFile::insert (DgPolygon& poly, const string* label,
   const DgLocation* cent)
{
   DgOutGeoJSONFile& o(*this);   

   rf().convert(poly);

   o << "{\"type\":\"Feature\",";
   o << "\"properties\":{";
   if (label)
      o << "\"name\":" << *label;
   o << "},";
   o << "\"geometry\":{";
   o << "\"type\":\"Polygon\",";
   o << "\"coordinates\":[[";

   vector<DgAddressBase *>& v = poly.addressVec();
   for(vector<DgAddressBase *>::iterator i = v.begin(); v.end() != i; ++i)
   {
         o.insert(rf().getVecAddress(*(*i)));
         o << ",";
   }

   // rewrite first vertex:
   o.insert(rf().getVecAddress(*v[0]));

   o << "]]}},";
   o.flush();

   return *this;
}
Exemple #2
0
static int
test1(gs_state * pgs, gs_memory_t * mem)
{
    int n;

    gs_scale(pgs, 72.0, 72.0);
    gs_translate(pgs, 4.25, 5.5);
    gs_scale(pgs, 4.0, 4.0);
    gs_newpath(pgs);
    for (n = 200; --n >= 0;) {
        int j;

#define rf() (rand() / (1.0 * 0x10000 * 0x8000))
        double r = rf(), g = rf(), b = rf();
        double x0 = rf(), y0 = rf(), x1 = rf(), y1 = rf(), x2 = rf(), y2 = rf();

        gs_setrgbcolor(pgs, r, g, b);
        for (j = 0; j < 6; j++) {
            gs_gsave(pgs);
            gs_rotate(pgs, 60.0 * j);
            gs_moveto(pgs, x0, y0);
            gs_lineto(pgs, x1, y1);
            gs_lineto(pgs, x2, y2);
            gs_fill(pgs);
            gs_grestore(pgs);
        }
    }
#undef mem
    return 0;
}
Exemple #3
0
int daFakeStarCoin::onCreate() {

	allocator.link(-1, GameHeaps[0], 0, 0x20);

	nw4r::g3d::ResFile rf(getResource("star_coin", "g3d/star_coin.brres"));
	bodyModel.setup(rf.GetResMdl("star_coinA"), &allocator, 0x224, 1, 0);
	SetupTextures_MapObj(&bodyModel, 0);

	allocator.unlink();

	ActivePhysics::Info HitMeBaby;
	HitMeBaby.xDistToCenter = 0.0;
	HitMeBaby.yDistToCenter = -3.0;
	HitMeBaby.xDistToEdge = 12.0;
	HitMeBaby.yDistToEdge = 15.0;
	HitMeBaby.category1 = 0x5;
	HitMeBaby.category2 = 0x0;
	HitMeBaby.bitfield1 = 0x4F;
	HitMeBaby.bitfield2 = 0xFFFFFFFF;
	HitMeBaby.unkShort1C = 0;
	HitMeBaby.callback = &dEn_c::collisionCallback;

	this->aPhysics.initWithStruct(this, &HitMeBaby);
	this->aPhysics.addToList();

	this->scale.x = 1.0;
	this->scale.y = 1.0;
	this->scale.z = 1.0;

	this->pos.x -= 120.0;
	this->pos.z = 3300.0;

	this->onExecute();
	return true;
}
Exemple #4
0
// load biterm topic assignments output by training precess
// each line is a doc, format:w1-w2:topic_w1-topic_w2 ...
// set topic recorder _nwz and _nw_z
void Infer::load_model() {
  ostringstream ss;
  ss << "dbz.k" << K;
  string pt = train_dir + ss.str();
  
  cout << "->load dbz from:" << pt << endl;
  ifstream rf( pt.c_str() );
  if (!rf) {
	EXIT_ERR("file not find:", pt.c_str());
  }

  string line;
  while(getline(rf, line)) {
	// read a doc
    istringstream iss(line);
	
	int w1, w2, k1, k2;
	char c1, c2, c3;
    while (iss >> w1 >> c1 >> w2 >> c2 >> k1 >> c3 >> k2) {
		// allocacte _nwz
	  while (_nwz.size() < w2+1) {
		vector<int> tmp(K);
		_nwz.push_back(tmp);
	  }
	  assert(k1 < K && k2 < K);
	  _nwz[w1][k1]++;
	  _nw_z[k1]++;
	  _nwz[w2][k2]++;
	  _nw_z[k2]++;
	}
  }

  printf("M=%d\n", _nwz.size());
}
void MessageOverlay::paintEvent(QPaintEvent *)
{
    QPainter p(this);
    QRect r(rect());
    QRectF rf(r.x()+0.5, r.y()+0.5, r.width()-1, r.height()-1);
    QColor borderCol=palette().color(QPalette::Highlight).darker(120);
    QColor col=palette().color(QPalette::Window);
    QPainterPath path=Utils::buildPath(rf, r.height()/4.0);
    col.setAlphaF(0.8);
    p.setRenderHint(QPainter::Antialiasing, true);
    p.fillPath(path, col);
    p.setPen(QPen(borderCol, qMax(2, r.height()/16)));
    p.drawPath(path);

    int pad=r.height()/4;
    if (cancelButton->isVisible()) {
        if (Qt::LeftToRight==layoutDirection() && !closeOnLeft) {
            rf.adjust(pad, pad, -((pad*2)+cancelButton->width()), -pad);
        } else {
            rf.adjust(((pad*2)+cancelButton->width()), pad, -pad, -pad);
        }
    } else {
        rf.adjust(pad, pad, -pad, -pad);
    }
    QFont fnt(QApplication::font());
    fnt.setBold(true);
    QFontMetrics fm(fnt);
    col=palette().color(QPalette::WindowText);

    p.setPen(col);
    p.setFont(fnt);
    p.drawText(rf, fm.elidedText(text, Qt::ElideRight, r.width(), QPalette::WindowText), QTextOption(Qt::LeftToRight==layoutDirection() ? Qt::AlignLeft : Qt::AlignRight));
    p.end();
}
Exemple #6
0
char rf(const char* str, char current){
  if(*str=='\0')
    return current;
  if(*str=='@')
    current = *(str+1);
  return rf(str+1, current);
}
Exemple #7
0
  void ObjectMemory::find_referers(Object* target, ObjectArray& result) {
    ObjectMemory::GCInhibit inhibitor(this);

    ObjectWalker walker(root_state_->om);
    GCData gc_data(root_state_);

    // Seed it with the root objects.
    walker.seed(gc_data);

    Object* obj = walker.next();

    RefererFinder rf(this, target);

    while(obj) {
      rf.reset();

      rf.scan_object(obj);

      if(rf.found_p()) {
        result.push_back(obj);
      }

      obj = walker.next();
    }
  }
Exemple #8
0
/*!
  \internal
  Read some random bytes into \a keybuf.

  If on linux (ie read embedded) the os MUST have /dev/[u]random
  available.
  */
void KeyFiler::randomizeKey( char keybuf[] )
{
    qint64 rc;
    QFile rf( RAND_DEV );
    if ( !rf.open( QIODevice::ReadOnly ))
    {
        time_t curTime = time(0);
        perror( "open " RAND_DEV );
#if defined(Q_OS_LINUX) || defined(_OS_LINUX_)
        qFatal( "Safe execution requires " RAND_DEV );
#endif
        qWarning( "Warning: Using inferior random numbers!" );
        srandom(curTime);  // this is very crappy
        long int r;
        for ( int i = 0; i < QSXE_KEY_LEN; i++ )
        {
            r = random();
            keybuf[i] = (char)r;
        }
    }
    else
    {
        rc = rf.read( keybuf, QSXE_KEY_LEN );
        rf.close();
        if ( rc != QSXE_KEY_LEN )
            qFatal( "read %s: %s", RAND_DEV, strerror(errno) );
    }
}
Exemple #9
0
void Label::OnDraw(Graphics *g) 
{
	if (_bmp == NULL)
		return;

	Rect r(_x, _y, _w, _h);
	g->DrawImage(_bmp, r, 0, 0, _w, _h, UnitPixel);	


	wstring wtext;	
	wtext.assign(_text.begin(), _text.end());

	SolidBrush b(_font_color);

	wstring wffname;
	wffname.assign(_font_family.begin(), _font_family.end());
	FontFamily ff(wffname.c_str());

	StringFormat sf(0, LANG_NEUTRAL);
	sf.SetLineAlignment(Gdiplus::StringAlignmentCenter);

	if (_align == TEXT_ALIGN_LEFT)
		sf.SetAlignment(Gdiplus::StringAlignmentNear);
	else if (_align == TEXT_ALIGN_CENTER)
		sf.SetAlignment(Gdiplus::StringAlignmentCenter);
	else if (_align == TEXT_ALIGN_RIGHT)
		sf.SetAlignment(Gdiplus::StringAlignmentFar);

	RectF rf(_x, _y, _w, _h);
	Font font(&ff, _font_size, Gdiplus::FontStyleRegular, UnitPixel);
	g->DrawString(wtext.c_str(), wtext.length(), &font, rf, &sf, &b);

}
int LogisticRegression::gradientAscent() {
	long double* deviations = new long double[sampleNum];
	int iterations = 0;
	do {
		++iterations;

		/*
		 * How to handle the case that 'z' is either too big or too small???
		 */
		// calculate deviations for all samples, one per sample.
		for(int i = 0; i < sampleNum; ++i)
			deviations[i] = categories[i] - rf(trainingSamples.getSample(i), 
				parameters, featureNum);

		// adjust parameters
		for(int j = 0; j < featureNum; ++j) {
			long double factor = 0.0;
			for(int i = 0; i < sampleNum; ++i) 
				factor +=  trainingSamples.getSample(i)[j] * deviations[i];
			parameters[j] += alpha * factor;
		}
	} while(convergent(deviations, categoryRange) == false);
	delete[] deviations;

	return iterations;
}
void stylesheets_upgrade()
// Upgrade older stylesheets to the currently used format.
{
  // Make the \r marker a section heading instead of a normal paragraph.
  {
    ReadFiles rf(Directories->get_stylesheets(), "", ".xml1");
    for (unsigned int i = 0; i < rf.files.size(); i++) {
      ustring filename = gw_build_filename(Directories->get_stylesheets(), rf.files[i]);
      gw_message(_("Updating stylesheet: ") + filename);
      ReadText rt (filename, true, false);
      stylesheet_upgrade_value (rt.lines, "r", "subtype", "2");
      unix_unlink (filename.c_str());
      ustring newfilename(filename);
      newfilename.replace(newfilename.length() - 1, 1, "2");
      write_lines (newfilename, rt.lines);
    }
  }

  // Note: The stylesheet.xml template has been updated thus far.
  // Every update listed below still needs to be entered into the template.

  // At the end of everything, check that we have at least one stylesheet.  
  {
    vector < ustring > stylesheets;
    stylesheet_get_ones_available(stylesheets);
    if (stylesheets.size() == 0) {
      stylesheet_create_new(STANDARDSHEET, stFull);
    }
  }
}
Exemple #12
0
int rf(int x)
{
	int temp = two(x) ;
	if ( temp == 1)
		return (x + 1);
	return rf( x + (1 << (temp - 1)));
}
Exemple #13
0
void MaxCutHyperheuristic::UpdateBestModel(std::string code, Prob problem,
                                           const std::vector<double>& metrics,
                                           double* bestProbability,
                                           Prob* bestProblem,
                                           std::string* bestCode,
                                           int* numBest) {
  std::ostringstream fname;
  fname << "hhdata/" << code << ".rf";
  std::string filename = fname.str();
  if (FileExists(filename)) {
    RandomForest rf(filename);
    double probability = rf.Predict(metrics);
    if (probability > *bestProbability) {
      // New best
      *bestProbability = probability;
      *bestProblem = problem;
      *bestCode = code;
      *numBest = 1;
    } else if (probability == *bestProbability &&
               Random::RandInt(0, *numBest) == *numBest) {
      // Tied the best and selected by streaming algorithm
      *bestProblem = problem;
      *bestCode = code;
      ++(*numBest);
    }
  }
}
/// Mine entry point for intercepted function
/// \param lpLibFileName Library file name
/// \param hFile File handle
/// \param dwFlags load flags
/// \return Loaded module.
static HMODULE WINAPI Mine_LoadLibraryExW(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags)
{
    RefTracker rf(&s_dwInsideLoadLibrary);

    if (s_dwInsideLoadLibrary == 1)
    {
        LogTrace(traceENTER, "lpLibFilename = %S, hFile = %p, dwFlags = %d", lpLibFileName, hFile, dwFlags);
    }

    HMODULE res = Real_LoadLibraryExW(lpLibFileName, hFile, dwFlags);
    DWORD realError = GetLastError();

    if (my_lstrcmpW(lpLibFileName, L"comctl32.dll") != 0)
    {
        // This function uses MessageBox - which will load comctl32.dll if necessary
        // To avoid recursion problems, only call it when a different DLL is being loaded.
        CheckForDebuggerAttach();
    }

    if (s_dwInsideLoadLibrary == 1)
    {
        CheckWrappers();
        LogTrace(traceEXIT, "returned 0x%p", res);
    }

    SetLastError(realError);
    return res;
}
int main(int argc, char* argv[])
{

  DCapp app(dn, ".dita", ".ditamap");

  app.Init(argc, argv);

  if (!app.Proc(D2M::SwitchList)) {
    fprintf(stderr, "usage: %s [-v] [-t \"Map Title\"] [-d \"D:\\path\\to\\DTDs\"]"
			"\n        [-i inifile.ini] [-o mapfile.ditamap] topicfile.dita\n", argv[0]);
    exit(dc_err_arg);
  }

  D2M::Verbose = app.verbose();

  XMLrfile rf(D2M::TopicFileName = app.rfile());
  if (rf.FErr() != fok)
    rf.Err();
	else
		D2M::TopicFile = &rf;

  HTMwfile wf(D2M::MapFileName = app.wfile());
  if (wf.FErr() != fok)
    wf.Err();
	else
		D2M::MapFile = &wf;

	// look in current directory for correct ini file
	DCirfile *inif = new DCirfile(D2M::IniFileName);

	if (inif->FErr() != fok) {
		delete inif;
		inif = new DCirfile("xml2htm.ini");
	}

	if (inif->FErr() != fok) {
		delete inif;
		inif = new DCirfile("xml2rtf.ini");
	}

	if ((inif->FErr() != fok)
	 && strcmp(D2M::IniFileName, "dita2map.ini")) {
		delete inif;
		inif = new DCirfile("dita2map.ini");
	}

	if (inif->FErr() == fok)
		D2M::IniFile = inif;  // make accessible everywhere

	D2M::InitCurrProps(); // set up vars per ini file


	D2M::ProcessTopic();

  rf.CloseFile();
  wf.CloseFile();
  wf.Err();      // if error, exits with the err (and a message)
  return dc_ok;  // so if we get here, it worked
}
/*
 * Stochastic gradient ascent algorithm is an improvement on gradient ascent algorithm.
 * The improvements include:
 * 1) For each update of parameters, only one sample instead of all samples is involved,
 * which reduces computation greatly.
 * 2) It's online, when new samples come, parameters can be updated to reflect their impact.
 */
void LogisticRegression::stochasticGradientAscent() {
	for(int i = 0; i < sampleNum; ++i) {
		const float* sample = trainingSamples.getSample(i);
		long double deviation = categories[i] - rf(sample, parameters, featureNum);
		for(int j = 0; j < featureNum; ++j)
			parameters[j] += alpha * deviation * sample[j];
	}
}
Exemple #17
0
float ellf(float phi, float ak)
{
	float rf(float x, float y, float z);
	float s;

	s=sin(phi);
	return s*rf(SQR(cos(phi)),(1.0-s*ak)*(1.0+s*ak),1.0);
}
Exemple #18
0
float rj(float x, float y, float z, float p)
{
	float rc(float x, float y);
	float rf(float x, float y, float z);
	float a,alamb,alpha,ans,ave,b,beta,delp,delx,dely,delz,ea,eb,ec,
		ed,ee,fac,pt,rcx,rho,sqrtx,sqrty,sqrtz,sum,tau,xt,yt,zt;

	if (FMIN(FMIN(x,y),z) < 0.0 || FMIN(FMIN(x+y,x+z),FMIN(y+z,fabs(p))) < TINY
		|| FMAX(FMAX(x,y),FMAX(z,fabs(p))) > BIG)
			nrerror("invalid arguments in rj");
	sum=0.0;
	fac=1.0;
	if (p > 0.0) {
		xt=x;
		yt=y;
		zt=z;
		pt=p;
	} else {
		xt=FMIN(FMIN(x,y),z);
		zt=FMAX(FMAX(x,y),z);
		yt=x+y+z-xt-zt;
		a=1.0/(yt-p);
		b=a*(zt-yt)*(yt-xt);
		pt=yt+b;
		rho=xt*zt/yt;
		tau=p*pt/yt;
		rcx=rc(rho,tau);
	}
	do {
		sqrtx=sqrt(xt);
		sqrty=sqrt(yt);
		sqrtz=sqrt(zt);
		alamb=sqrtx*(sqrty+sqrtz)+sqrty*sqrtz;
		alpha=SQR(pt*(sqrtx+sqrty+sqrtz)+sqrtx*sqrty*sqrtz);
		beta=pt*SQR(pt+alamb);
		sum += fac*rc(alpha,beta);
		fac=0.25*fac;
		xt=0.25*(xt+alamb);
		yt=0.25*(yt+alamb);
		zt=0.25*(zt+alamb);
		pt=0.25*(pt+alamb);
		ave=0.2*(xt+yt+zt+pt+pt);
		delx=(ave-xt)/ave;
		dely=(ave-yt)/ave;
		delz=(ave-zt)/ave;
		delp=(ave-pt)/ave;
	} while (FMAX(FMAX(fabs(delx),fabs(dely)),
		FMAX(fabs(delz),fabs(delp))) > ERRTOL);
	ea=delx*(dely+delz)+dely*delz;
	eb=delx*dely*delz;
	ec=delp*delp;
	ed=ea-3.0*ec;
	ee=eb+2.0*delp*(ea-ec);
	ans=3.0*sum+fac*(1.0+ed*(-C1+C5*ed-C6*ee)+eb*(C7+delp*(-C8+delp*C4))
		+delp*ea*(C2-delp*C3)-C2*delp*ec)/(ave*sqrt(ave));
	if (p <= 0.0) ans=a*(b*ans+3.0*(rcx-rf(xt,yt,zt)));
	return ans;
}
Exemple #19
0
static size_t      proc_read(    struct uufile *f, void *dest, size_t bytes)
{
    size_t (*rf)( struct uufile *f, void *dest, size_t bytes) = f->impl;

    if(rf == 0)
        return -1;

    return rf( f, dest, bytes);
}
Exemple #20
0
void *loadall(struct arreader *a, int (*rf)( void *data, int len ), int size )
{
    char *ret = calloc( size+1, 1 );
    if( ret == 0 || size != rf( ret, size ) )
        die( a, "can't loadall");

    //printf("/=\n'%.*s'\n", size, ret );
    return ret;
}
Exemple #21
0
ErrorList::Provenance::Provenance( const String &src, int off, std::string msg ) : provenance( src ), msg( msg ) {
    if ( src.size() and off >= 0 ) {
        ReadFile rf( src.c_str() );
        _init( rf.data, rf.data + off );
    } else {
        line = -1;
        col  = -1;
    }
}
vector < ustring > resource_get_resources(vector < ustring > &filenames, bool list_deleted_ones)
{
  // Storage.
  vector < ustring > resources;
  filenames.clear();

  // Read the user's templates.
  ReadDirectories rd(Directories->get_resources(), "", "");
  for (unsigned int i = 0; i < rd.directories.size(); i++) {
    ustring filename = gw_build_filename(Directories->get_resources(), rd.directories[i], resource_template_ini ());
    if (g_file_test(filename.c_str(), G_FILE_TEST_IS_REGULAR)) {
      filenames.push_back(filename);
      resources.push_back(resource_get_title(filename));
    }
  }

  // Make a list of "deleted" resources and add to it the unwanted ones.
  // Add the user's resources to these too in order that the user's resources
  // override any templates named the same.
  ustring deleted_filename;
  if (!list_deleted_ones)
    deleted_filename = gw_build_filename(Directories->get_resources(), "deleted");
  ReadText rt(deleted_filename, true, true);
  set < ustring > unwanted_ones(rt.lines.begin(), rt.lines.end());
  for (unsigned int i = 0; i < resources.size(); i++) {
    unwanted_ones.insert(resources[i]);
  }

  // Add some standard templates to the "deleted" resource. Reason:
  // Some standard templates have been added that come with Bibledit.
  // These templates reference material that is not available by default,
  // but requires user action to install that. To facilitate easy creation
  // if these resources by the user, some templates have been added. These
  // templates are not for display, but only to base a new template upon.
  // Therefore these templates should not normally be visible, only when used
  // to create a new resource based upon these.
  if (!list_deleted_ones) {
    unwanted_ones.insert("NetBible");
  }
  // Read the templates that come with Bibledit.
  ReadFiles rf(Directories->get_package_data(), "resource", ".ini");
  for (unsigned int i = 0; i < rf.files.size(); i++) {
    ustring filename = gw_build_filename(Directories->get_package_data(), rf.files[i]);
    ustring title = resource_get_title(filename);
    if (unwanted_ones.find(title) != unwanted_ones.end())
      continue;
    filenames.push_back(filename);
    resources.push_back(title);
  }

  // Sort them.
  quick_sort(resources, filenames, 0, resources.size());

  // Give resources.
  return resources;
}
Exemple #23
0
QDebug Q_GUI_EXPORT &operator<<(QDebug &s, const QVectorPath &path)
{
    QRealRect vectorPathBounds = path.controlPointRect();
    QRectF rf(vectorPathBounds.x1, vectorPathBounds.y1,
              vectorPathBounds.x2 - vectorPathBounds.x1, vectorPathBounds.y2 - vectorPathBounds.y1);
    s << "QVectorPath(size:" << path.elementCount()
      << " hints:" << hex << path.hints()
      << rf << ")";
    return s;
}
// --------------------------------------------------------------------------
//
// Function
//		Name:    BackupStoreAccounts::Create(int32_t, int, int64_t, int64_t, const std::string &)
//		Purpose: Create a new account on the specified disc set.
//			 If rAsUsername is not empty, then the account information will be written under the
//			 username specified.
//		Created: 2003/08/21
//
// --------------------------------------------------------------------------
void BackupStoreAccounts::Create(int32_t ID, int DiscSet, int64_t SizeSoftLimit, int64_t SizeHardLimit, const std::string &rAsUsername)
{
	// Create the entry in the database
	BackupStoreAccountDatabase::Entry Entry(mrDatabase.AddEntry(ID,
		DiscSet));
	
	{
		// Become the user specified in the config file?
		std::auto_ptr<UnixUser> user;
		if(!rAsUsername.empty())
		{
			// Username specified, change...
			user.reset(new UnixUser(rAsUsername.c_str()));
			user->ChangeProcessUser(true /* temporary */);
			// Change will be undone at the end of this function
		}

		// Get directory name
		std::string dirName(MakeAccountRootDir(ID, DiscSet));
	
		// Create a directory on disc
		RaidFileWrite::CreateDirectory(DiscSet, dirName, true /* recursive */);
		
		// Create an info file
		BackupStoreInfo::CreateNew(ID, dirName, DiscSet, SizeSoftLimit, SizeHardLimit);
		
		// And an empty directory
		BackupStoreDirectory rootDir(BACKUPSTORE_ROOT_DIRECTORY_ID, BACKUPSTORE_ROOT_DIRECTORY_ID);
		int64_t rootDirSize = 0;
		// Write it, knowing the directory scheme
		{
			RaidFileWrite rf(DiscSet, dirName + "o01");
			rf.Open();
			rootDir.WriteToStream(rf);
			rootDirSize = rf.GetDiscUsageInBlocks();
			rf.Commit(true);
		}
	
		// Update the store info to reflect the size of the root directory
		std::auto_ptr<BackupStoreInfo> info(BackupStoreInfo::Load(ID, dirName, DiscSet, false /* ReadWrite */));
		info->ChangeBlocksUsed(rootDirSize);
		info->ChangeBlocksInDirectories(rootDirSize);
		info->AdjustNumDirectories(1);
		
		// Save it back
		info->Save();

		// Create the refcount database
		BackupStoreRefCountDatabase::Create(Entry)->Commit();
	}

	// As the original user...
	// Write the database back
	mrDatabase.Write();
}
Exemple #25
0
void Node::Node (String id, Comando* comandos[], bool debug){
	this->id = id;
	&this->comandos = *comandos;
	this->_debug = debug;
	this->_atencao = "C-00";

	StackArray pilha;
	JmmRf rf(2, 3, 0, true); // pinRx, pinTx, pinInterrupt e debug


};
int main(int argc, char **argv)
{
    if(argc >= 3){
        std::cout << std::boolalpha;
        Robot_filter rf(argv[1], argv[2]);
        std::cout << argv[2] << " should not be accessed by robots : " << rf.IsUrlPathExcluded() << std::endl;
    }
    else
        std::cout << "Command-line arguments are invalid." << std::endl;
    return 0;
}
Exemple #27
0
int  main()
{
	int num,x;
	scanf("%d",&num);
	for (int i = 0; i < num; i++)
	{
		scanf("%d",&x);
		printf("%d %d\n",lf(x),rf(x));
	}
	return 0;
}
Exemple #28
0
DllExport int
DCLmain(int argc, char* argv[])
{
  static bool dll_init = false;

  if (dll_init) {
    fprintf(stderr, "%s: DLL reinitialization error\n", argv[0]);
    exit(dc_err_arg);
  }
  dll_init = true;


#else

int
main(int argc, char *argv[])
{

#endif

  DCapp app(dc);

  app.Init(argc, argv);

  if (!app.Proc()) {
    fprintf(stderr, "usage: %s [-abmlp] [-o new_dcl_file] dcl_file\n", argv[0]);
    exit(dc_err_arg);
  }

  DCLrfile rf(app.rfile());
  if (rf.FErr() != fok)
    rf.Err();

  DCLwfile wf(app.wfile(), app.wtype());
  if (wf.FErr() != fok)
    wf.Err();

  // here all the work is done, one dcl ctl at a time

  DCctl c;
  while (!rf.eof()) {
    c = rf;
    wf = c;
  }
  rf.CloseFile();
  wf.CloseFile();

  // the envelope . . .

  rf.Err();      // these two just return if no err
  wf.Err();      // otherwise they exit with the err (and a message)
  return dc_ok;  // so if we get here, it worked
}
Exemple #29
0
LoggerModule::LoggerModule(bool verbose)
  : m_verbose(verbose)
{
  logger_instance = this;

  if (verbose) {
    app::ResourceFinder rf(false);
    rf.includeUserDir("aseprite.log");
    auto filename = rf.defaultFilename();
    base_set_log_filename(filename.c_str());
  }
}
Exemple #30
0
// The building compiler does not have __(de)register_frame but
// it may be found at runtime in a dynamically-loaded library.
// For example, this happens when building LLVM with Visual C++
// but using the MingW runtime.
void __register_frame(void *p) {
  static bool Searched = false;
  static void((*rf)(void *)) = 0;

  if (!Searched) {
    Searched = true;
    *(void **)&rf =
        llvm::sys::DynamicLibrary::SearchForAddressOfSymbol("__register_frame");
  }
  if (rf)
    rf(p);
}