コード例 #1
0
ファイル: d_wedit.cpp プロジェクト: donzelot/openBCM
static void near contsearch (void)
//*************************************************************************
//
//  Sucht nach 'searchstr' und baut den Bildschirm an der gefundenen
//  Position neu auf
//
//*************************************************************************
{
  int count = 0;
  int slines = e->curline;
  unsigned sindex = e->readindex;
  int found = 0;
  int size = strlen(searchstr);
  unsigned i = linelength(e->readindex);

  if (e->curcol > i)
    i += e->readindex - 1;
  else
    i = e->readindex + e->curcol + 1;
  while (i < e->maxbuf)
  {
    while (((buf[i+count] ^ searchstr[count]) & 0x5f) == 0) count++;
    if (count == size)
    {
      found++;
      break;
    }
    count = 0;
    if (buf[i++] == LF)
    {
      slines++;
      sindex = i;
    }
  }
  if (found)
  {
    e->curcol = i-sindex;
    gotoline(slines, 0);
    testxoffset();
  }
  else
    msgline("Pattern not found");
}
コード例 #2
0
ファイル: Lineseg.cpp プロジェクト: dineshnitt/RayTracer
	double Lineseg :: totallength(){
		double len = 0.0;
		for(int i=0;i<(p.size()-1);i++)
			len+=linelength(p[i],p[i+1]);
		return len;
		}