Пример #1
0
void SObject::ComputeSPos() {
  ComputeSLoc(cur_game->turn);
  frame = cur_game->frame;
  sxpos = (sxloc+10)/20 + 384;
  sypos = (syloc+10)/20 + 384;

  if(location && location->Represents()) {
    int space = (Space() + location->Represents()->Space()) / 2;
    if(abs(location->SXPos() - sxpos) < space
	&& abs(location->SYPos() - sypos) < space) {
      sxpos += space;
      sypos -= location->Represents()->Size()/2;
      sypos += Size()/2;
      }
    }

  int collide = 1;
  while(collide) {
    collide = 0; 
    int prior = (SType() != SOBJECT_PLANET);
    for(int ctr=0; ctr < int(system->objects.size()); ++ctr) {
      if(system->objects[ctr] == this) { continue; prior = 0; }
      int space = (Space() + system->objects[ctr]->Space()) / 2;
      if(system->objects[ctr]->frame == cur_game->frame
		&& (system->objects[ctr]->SType() == SOBJECT_PLANET || prior)
		&& abs(system->objects[ctr]->SXPos() - sxpos) < space
		&& abs(system->objects[ctr]->SYPos() - sypos) < space) {
	sypos += space;
	collide = 1;
	break;
	}
      }
    }
  }
Пример #2
0
bool MilestonePath::CheckSetMilestone(int i,const Config& x)
{
  if(i == 0) {
    //first milestone
    const Config& b=edges[i]->Goal();
    EdgePlanner* e2=IsVisible(Space(i),x,b);
    if(!e2) return false;
    edges[i] = e2;
    return true;
  }
  else if(i==(int)edges.size()) {
    Assert(!edges.empty());
    //last milestone
    const Config& a=edges[i-1]->Start();
    EdgePlanner* e1=IsVisible(Space(i-1),a,x);
    if(!e1) return false;
    edges[i-1] = e1;
    return true;
  }
  else {
    const Config& a=edges[i-1]->Start();
    const Config& b=edges[i]->Goal();
    EdgePlanner* e1=IsVisible(Space(i-1),a,x);
    if(!e1) return false;
    EdgePlanner* e2=IsVisible(Space(i),x,b);
    if(!e2) { delete e1; return false; }
    
    edges[i-1] = e1;
    edges[i] = e2;
    return true;
  }
}
Пример #3
0
bool MilestonePath::IsValid()
{
  if(edges.empty()) return false;
  CSpace* space=Space();
  for(size_t i=0;i<edges.size();i++) {
    if(Space(i) != space) return false;
    if(i!=0) 
      if(edges[i]->Start() != edges[i-1]->Goal()) return false;
  }
  return true;
}
Пример #4
0
Node* LayerSolver::insert(Box* box, Node* node)
{
	if (node->child[0] != NULL && node->child[1] != NULL)
	{
		Node* newNode = insert(box, node->child[0]);
		if (newNode != NULL)
		{
			return newNode;
		}
		return insert(box, node->child[1]);
	}
	else
	{
		if (node->occupied)
		{
			return NULL;
		}
		//int surfaceLeft = fitIntoSpace(box, node->space);
        int surfaceLeft = fitIntoSpaceMaxSurface(box, node->space);
		if (surfaceLeft==-1)
		{
			return NULL;
		}
		if (surfaceLeft == 0)
		{
			return node;
		}

		node->child[0] = new Node;
		node->child[0]->occupied = false;
		node->child[0]->child[0] = NULL;
		node->child[0]->child[1] = NULL;
		node->child[1] = new Node;
		node->child[1]->occupied = false;
		node->child[1]->child[0] = NULL;
		node->child[1]->child[1] = NULL;

		int dw = node->space.getWidth() - box->getX();
		int dh = node->space.getLength() - box->getZ();

		if (dw>dh) //pionowy podzial miejsca
		{
			node->child[0]->space = Space(node->space.getTopLeft(), box->getX(), node->space.getLength());
			node->child[1]->space = Space({ node->space.getTopLeft().x + box->getX(), node->space.getTopLeft().y }, node->space.getWidth() - box->getX(), node->space.getLength());
		}
		else // poziomy podzial miejsca
		{
			node->child[0]->space = Space(node->space.getTopLeft(), node->space.getWidth(), box->getZ());
			node->child[1]->space = Space({ node->space.getTopLeft().x, node->space.getTopLeft().y + box->getZ() }, node->space.getWidth(), node->space.getLength()-box->getZ());
		}
		return insert(box, node->child[0]);
	}
}
Пример #5
0
Real MilestonePath::Length() const
{
  Real len=0;
  for(size_t i=0;i<edges.size();i++)
    len += Space(i)->Distance(edges[i]->Start(),edges[i]->Goal());
  return len;
}
Пример #6
0
  static void PrintSourceForLocation(const SourceLocation &Loc,
                                     SourceManager &SM) {
    const char *LocData = SM.getCharacterData(Loc, /*Invalid=*/nullptr);
    unsigned LocColumn =
        SM.getSpellingColumnNumber(Loc, /*Invalid=*/nullptr) - 1;
    FileID FID = SM.getFileID(Loc);
    llvm::MemoryBuffer *Buffer = SM.getBuffer(FID, Loc, /*Invalid=*/nullptr);

    assert(LocData >= Buffer->getBufferStart() &&
           LocData < Buffer->getBufferEnd());

    const char *LineBegin = LocData - LocColumn;

    assert(LineBegin >= Buffer->getBufferStart());

    const char *LineEnd = nullptr;

    for (LineEnd = LineBegin; *LineEnd != '\n' && *LineEnd != '\r' &&
                              LineEnd < Buffer->getBufferEnd();
         ++LineEnd)
      ;

    llvm::StringRef LineString(LineBegin, LineEnd - LineBegin);

    llvm::errs() << LineString << '\n';
    std::string Space(LocColumn, ' ');
    llvm::errs() << Space.c_str() << '\n';
  }
Пример #7
0
Space AllocLogSpace()
 {
  auto len=__std_get_syslog_len();
  void *mem=__std_alloc(len);

  return Space(mem,len);
 }
Пример #8
0
Space AllocHeapSpace_int()
 {
  auto len=__std_get_heap_int_len();
  void *mem=__std_alloc(len);
 
  return Space(mem,len);
 }
Пример #9
0
void simnet() {
   Signal muxIn(4);
   Signal muxOut(1, "muxOut");
   Signal select(2);

   Space(SD("1b", "Note input/select line order: Incorrect order is a common mistake!"));       

   // Input lines
   Switch("1a", muxIn[3], '3');
   Space(SD("1a", "input[3]"));
   Switch("1a", muxIn[2], '2');
   Space(SD("1a", "input[2]"));
   Switch("1a", muxIn[1], '1');
   Space(SD("1a", "input[1]"));
   Switch("1a", muxIn[0], '0');
   Space(SD("1a", "input[0]"));

   // Select lines
   Switch("2b.1a", select[1], 'a');
   Space(SD("2b.2a", "select[1]"));
   Switch("2b.1b", select[0], 'b');
   Space(SD("2b.2b", "select[0]"));

   // select and muxIn are specified in MSB down to LSB order
   Mux("1b", select, muxIn, muxOut);

   Probe("1c", muxOut);
}
Пример #10
0
void IRTransmitter::Transmit(unsigned int *data, size_t length) {
    // First send the NEC RAW signal
    sig_time_ = micros(); // keeps rolling track of signal time to avoid impact of loop & code execution delays
    for (int i = 0; i < length; i++) {
        Mark(data[i++]); // also move pointer to next position
        if (i < length) Space(data[i]); // pointer will be moved by for loop
    }
    delay(500);
}
void TileCharacter::SetChar(int index)
{
	m_pTexture = L"";
	m_alt = false;
	m_pALT = L"";
	m_boundingBox = false;
	m_exit = false;
	m_spawn = false;

	switch(index)
	{
	case 0: Space();		break;
	case 1: NoSpace();		break;
	case 2: Removable();	break;
	case 3: SetExit();		break;
	case 4: SetSpawn();		break;
	default: Space();		break;
	}
}
Пример #12
0
void MilestonePath::SetMilestone(int i,const Config& x)
{
  if(i == 0) {
    //first milestone
    const Config& b=edges[i]->Goal();
    edges[i] = Space(i)->LocalPlanner(x,b);
  }
  else if(i==(int)edges.size()) {
    Assert(!edges.empty());
    //last milestone
    const Config& a=edges[i-1]->Start();
    edges[i-1] = Space(i-1)->LocalPlanner(a,x);
  }
  else {
    const Config& a=edges[i-1]->Start();
    const Config& b=edges[i]->Goal();
    edges[i-1] = Space(i-1)->LocalPlanner(a,x);
    edges[i] = Space(i)->LocalPlanner(x,b);
  }
}
Пример #13
0
void TerrainWrapper::Render()
{




	Controller * ctrl = static_cast<Controller*>(GetManager()->Get("Controller"));
	DataManager * dm = static_cast<DataManager*>(GetManager()->Get("DataManager"));


	Techniques * tech = static_cast<Techniques*>(dm->Get("Techniques"));
	ResourceLoader * res = static_cast<ResourceLoader*>(dm->Get("Resources"));
	Environment * env = static_cast<Environment*>(res->Get("Environment"));
	Camera * camera = static_cast<Camera*>(ctrl->Get("Camera"));
	View * view = camera->GetView();
	ViewInfo * info = camera->GetInfo();





	if (tech->GetSSAO()->OnGeometryPass())
	{


		tech->GetSSAO()->SetGeometryPassUniforms(view->getCamera(),
			view->getViewMatrix());


	}
	else if (tech->GetShadow()->OnShadowPass())
	{

		tech->GetShadow()->UniformMVP(tech->GetShadow()->GetDirectionalShadow(env, info, view));


	}
	else
	{


		Space(glm::mat4(1.0), view);


	}



	terra->Render(camera->GetFrustum(), false);




}
Пример #14
0
LayerSolver::LayerSolver(Bin* bin) : Solver(bin)
{
	Point2D p1 = { 0, 0 };
	int x = bin->getSizeX();
	int y = bin->getSizeZ();
	Point2D p2 = { x, 0 };
	Point2D p3 = { 0, y };
	Point2D p4 = { x,y };

	root = { { NULL, NULL }, Space(p1, p2, p3, p4), false };
	resultHeight = 0;
}
Пример #15
0
void LayerSolver::resetRoot()
{
	clearNode(root.child[0]);
	clearNode(root.child[1]);
	Point2D p1 = { 0, 0 };
	int x = bin->getSizeX();
	int y = bin->getSizeZ();
	Point2D p2 = { x, 0 };
	Point2D p3 = { 0, y };
	Point2D p4 = { x, y };
	root = { { NULL, NULL }, Space(p1, p2, p3, p4), false };
}
Пример #16
0
/* Main program*/
int main()

{
int x;
for (x=0;x<100;x++)
{
int i=0, numSpaces=13, numstars=1, count=0;
printf("\007");
	for (i=0;i<13;i++)
	{
		Space(numSpaces);
		stars(numstars,count);
		cout << endl;
		numSpaces--;
		numstars+=2 ;
	}

   for (i=14;i<16;i++)
   {
   	Space(numSpaces=11);
      cout<< '|';
      Space(numSpaces=4);
      cout<< '|'<<endl;
    }
    cout<< "           MERRY";

 count++;
  getch();
  clrscr();
printf ("\a");

 int y=0;
	for (numSpaces=12; numSpaces >= 0; numSpaces--)
	{

	Space(numSpaces);

	cout << '/';
	stars(25 - 2*(numSpaces),count);
	cout << '\\' << endl;
   }
   for (i=14;i<16;i++)
   {
   	Space(numSpaces=11);
      cout<< '|';
      Space(numSpaces=4);
      cout<< '|'<<endl;
    }
    cout<< "          CHRISTMAS";
 printf ("\a");
  getch();
  clrscr();


}


}
Пример #17
0
bool MilestonePath::IsFeasible()
{
  if(edges.empty()) return true;
  //first check endpoints 
  CSpace* space=Space();
  if(!space->IsFeasible(edges[0]->Start())) return false;
  for(size_t i=0;i<edges.size();i++) {
    if(!space->IsFeasible(edges[i]->Goal())) return false;
  }
  //then check edges
  for(size_t i=0;i<edges.size();i++) 
    if(!edges[i]->IsVisible()) return false;
  return true;
}
Пример #18
0
void DefineCommData(Symbol p)
{
	Align(p);
	GetAccessName(p);
	if (p->sclass == TK_STATIC)
	{
		Print("%s\t", p->aname);
		Space(p->ty->size);
	}
	else
	{
		Print("COMM\t%s:%d\n", p->aname, p->ty->size);
	}
}
Пример #19
0
void SObject::ComputeGPos() {
  ComputeGLoc(cur_game->turn);
  frame = cur_game->frame;
  gxpos = 34 + (gxloc+10)/20;
  gypos = 34 + (gyloc+10)/20;

  if(system && system != this) {
    int space = (Space() + system->Space()) / 2;
    if(abs(system->GXPos() - gxpos) < space
	&& abs(system->GYPos() - gypos) < space) {
      gxpos += space;
      gypos -= system->Size()/2;
      gypos += Size()/2;
      }
    }

  int collide = 1;
  while(collide) {
    collide = 0; 
    for(int ctr=0; ctr < int(system->objects.size()); ++ctr) {
      if(system->objects[ctr] == this) break;
      int space = (Space() + system->objects[ctr]->Space()) / 2;
      if(system->objects[ctr]->frame == cur_game->frame
		&& abs(system->objects[ctr]->gxpos - gxpos) < space
		&& abs(system->objects[ctr]->gypos - gypos) < space) {
	gypos += space;
	collide = 1;
	break;
	}
      }
    }




  }
Пример #20
0
void TimedMilestonePath::Split(Real dt,TimedMilestonePath& before,TimedMilestonePath& after) const
{
  before.edges.resize(0);
  before.durations.resize(0);
  after.edges.resize(0);
  after.durations.resize(0);

  CSpace* cspace = Space();
  if(dt < 0) {  //dt is before path
    before.edges.push_back(cspace->LocalPlanner(Begin(),Begin()));
    before.durations.push_back(0);
    after.edges.push_back(cspace->LocalPlanner(Begin(),Begin()));
    after.durations.push_back(-dt);
  }
 
  for(size_t i=0;i<edges.size();i++) {
    if(dt < 0) {
      after.edges.push_back(edges[i]);
      after.durations.push_back(durations[i]);
    }
    else {
      if(dt <= durations[i]) {
	//cut current path
	Config x;
	if(durations[i] == 0) x=edges[i]->Start();
	else edges[i]->Eval(dt/durations[i],x);
	before.edges.push_back(cspace->LocalPlanner(edges[i]->Start(),x));
	before.durations.push_back(dt);
	after.edges.push_back(cspace->LocalPlanner(x,edges[i]->Goal()));
	after.durations.push_back(durations[i]-dt);
      }
      else {
	before.edges.push_back(edges[i]);
	before.durations.push_back(durations[i]);
      }
      dt -= durations[i];
    }
  }

  if(dt > 0) {  //dt is longer than path
    before.edges.push_back(cspace->LocalPlanner(End(),End()));
    before.durations.push_back(dt);
    after.edges.push_back(cspace->LocalPlanner(End(),End()));
    after.durations.push_back(0);
  }
}
Пример #21
0
void ReadDefinition(FILE *f)
/*   --------------  */
{
    Boolean	LastWasPeriod=false;
    char	c;

    Buff = Alloc(BuffSize=50, char);
    BN = 0;

    while ( true )
    {
	c = InChar(f);

	if ( c == '|' ) SkipComment;

	if ( c == EOF || c == '\n' && LastWasPeriod )
	{
	    /*  The definition is complete.  Add a period if it's
		not there already and terminate the string  */

	    if ( ! LastWasPeriod ) Append('.');
	    Append(0);

	    return;
	}

	if ( Space(c) )
	{
	    Append(' ');
	}
	else
	if ( c == '\\' )
	{
	    /*  Escaped character -- bypass any special meaning  */

	    Append(InChar(f));
	}
	else
	{
	    LastWasPeriod = ( c == '.' );
	    Append(c);
	}
    }
}
Пример #22
0
int MilestonePath::Reduce(int numIters)
{
  CSpace* space=Space();
  //pick random points on the path, connect them if they're visible
  Config x1,x2;
  int i1,i2;
  int numsplices=0;
  for(int iters=0;iters<numIters;iters++) {
    i1 = rand()%edges.size();
    i2 = rand()%edges.size();
    if(i2 < i1) swap(i1,i2);
    else if(i1 == i2) continue;  //if they're on the same segment, forget it

    Real t1=Rand();
    Real t2=Rand();
    edges[i1]->Eval(t1,x1);
    edges[i2]->Eval(t2,x2);
    const Config& a=edges[i1]->Start();
    const Config& b=edges[i2]->Goal();
    EdgePlanner* e_x1x2=space->LocalPlanner(x1,x2);
    if(e_x1x2->IsVisible()) {
      EdgePlanner* e_ax1=space->LocalPlanner(a,x1);
      EdgePlanner* e_x2b=space->LocalPlanner(x2,b);
      if(e_ax1->IsVisible() && e_x2b->IsVisible()) {
	numsplices++;
	cout<<"Visible subsegment "<<i1<<"->"<<i2<<endl;
	//replace edges a->a',...,b'->b with a->x1,x1->x2,x2->b
	edges.erase(edges.begin()+i1,edges.begin()+i2+1);

	edges.insert(edges.begin()+i1,e_ax1);
	edges.insert(edges.begin()+i1+1,e_x1x2);
	edges.insert(edges.begin()+i1+2,e_x2b);
      }
      else {
	delete e_ax1;
	delete e_x2b;
      }
    }
    else {
      delete e_x1x2;
    }
  }
  return numsplices;
}
Пример #23
0
void simnet() {

   // Input and output signals and buses
   Signal A(8);
   Signal B(8);
   Signal Sum(8, "Sum");
   Signal Carry(1, "C");
   Signal Overflow(1, "V");

   // A bus input switches
   Switch("1a", A[7], '7');
   Switch("1a", A[6], '6');
   Switch("1a", A[5], '5');
   Switch("1a", A[4], '4');
   Switch("1a", A[3], '3');
   Switch("1a", A[2], '2');
   Switch("1a", A[1], '1');
   Switch("1a", A[0], '0');
   Space(SD("1a", "A Bus"));

   // B bus input switches
   Switch("3a", B[7], '&');
   Switch("3a", B[6], '^');
   Switch("3a", B[5], '%');
   Switch("3a", B[4], '$');
   Switch("3a", B[3], '#');
   Switch("3a", B[2], '@');
   Switch("3a", B[1], '!');
   Switch("3a", B[0], ')');
   Space(SD("3a", "B Bus"));

   Add8("2b",
        //inputs:
        A, B,
        //outputs:
        Sum,
        Carry,
        Overflow
   );

   int parts[] = {4};
   Probe("1c-2c.1a", Sum, 1, parts );
   Space(SD("3c", "Sum"));

   Space(SD("3b"));
   Probe("3b", Overflow);
   Space(SD("3b", "Overflow"));

   Probe("3c", Carry);
   Space(SD("3c", "Carry"));
}
Пример #24
0
int main() {
    // create space
    Space Space(A, B, NELEM, DIR_BC_LEFT, DIR_BC_RIGHT, P_INIT, NEQ);
    info("N_dof = %d", Space::get_num_dofs(&space));

    // Initialize the weak formulation.
    WeakForm wf;

    // Initialize the FE problem.
    DiscreteProblem *dp = new DiscreteProblem();
    dp->add_matrix_form(0, 0, jacobian_1_1);
    dp->add_matrix_form(0, 2, jacobian_1_3);
    dp->add_matrix_form(0, 3, jacobian_1_4);
    dp->add_matrix_form(1, 1, jacobian_2_2);
    dp->add_matrix_form(1, 2, jacobian_2_3);
    dp->add_matrix_form(1, 3, jacobian_2_4);
    dp->add_matrix_form(2, 0, jacobian_3_1);
    dp->add_matrix_form(2, 1, jacobian_3_2);
    dp->add_matrix_form(2, 2, jacobian_3_3);
    dp->add_matrix_form(3, 0, jacobian_4_1);
    dp->add_matrix_form(3, 1, jacobian_4_2);
    dp->add_matrix_form(3, 3, jacobian_4_4);
    dp->add_vector_form(0, residual_1);
    dp->add_vector_form(1, residual_2);
    dp->add_vector_form(2, residual_3);
    dp->add_vector_form(3, residual_4);
    dp->add_matrix_form_surf(0, 0, jacobian_surf_right_U_Re, BOUNDARY_RIGHT);
    dp->add_matrix_form_surf(0, 2, jacobian_surf_right_U_Im, BOUNDARY_RIGHT);
    dp->add_matrix_form_surf(1, 1, jacobian_surf_right_I_Re, BOUNDARY_RIGHT);
    dp->add_matrix_form_surf(1, 3, jacobian_surf_right_I_Im, BOUNDARY_RIGHT);

    // Newton's loop
    newton(dp, space, MATRIX_SOLVER, MATRIX_SOLVER_TOL, MATRIX_SOLVER_MAXITER,
           NEWTON_TOL, NEWTON_MAXITER);

    // Plot the solution.
    Linearizer l(&space);
    l.plot_solution("solution.gp");

    info("Done.");
    return 1;
}
Пример #25
0
bool BufferStream::Write(const void* data, size_t bytes)
{
	if (bytes == 0)
		return false;

	uint32 nfree = Space();
	if (bytes >= nfree)
	{
		if (!Resize())
			return false;
	}

	if (m_nHead <= m_nTail)
	{
		if (m_nHead == 0)
		{
			memcpy(&m_buffer[m_nTail], (char*)data, bytes);
		}
		else
		{
			nfree = m_nBufferLen - m_nTail;
			if (bytes > nfree)
			{
				memcpy(&m_buffer[m_nTail], (char*)data, nfree);
				memcpy(m_buffer, (char*)data + nfree, bytes - nfree);
			}
			else
			{
				memcpy(&m_buffer[m_nTail], (char*)data, bytes);
			}
		}
	}
	else
	{
		memcpy(&m_buffer[m_nTail], (char*)data, bytes);
	}

	m_nTail = (m_nTail + bytes) % m_nBufferLen;
	return true;
}
Пример #26
0
const ConnVector& ConnFinder::GetConnections()
{
    // Start by looping through each peak.
    for (PeakVector::RectangleVector::const_iterator pk =
            m_peaks.GetVector().begin();
            pk != m_peaks.GetVector().end(); pk++)
    {
        // Iterate over the outside of the rectangle. Start at the top right 
        // corner for the 3 o'clock port numbering convention.
        for (OutsideRectangleIterator rit(
                    Space(m_src.width, m_src.height),
                    (*pk),
                    Point(pk->GetX()+pk->GetWidth(), pk->GetY()));
                rit.More(); rit++)
        {
            // If it's a dark cell...
            uint8_t* data = Point::GetDataByPoint(m_src, rit.GetCurrent());
            if (data[0] < 0x7f || data[1] < 0x7f || data[2] < 0x7f)
            {
                // Add a green border to this edge (green "from" red "to").
                m_pwhite.GreenoutBorder(*pk, rit.GetCurrent(), true);
                data[0] = 0x00; data[1] = 0x00; data[2] = 0x00;
                m_pwhite.GreenoutBorder(*pk, rit.GetCurrent(), false);
                data[0] = 0x00; data[1] = 0x00; data[2] = 0x00;

                // Find the connections associated with this cell.
                m_cwhite.GreyoutConnection(rit.GetCurrent());

                // Leave it blue, not gray.
                data[0] = 0xff; data[1] = 0x7f; data[2] = 0x7f;
            }
        }
    }

    // Return what is currently cached in the cwhite object.
    return m_cwhite.GetConnections();
}
Пример #27
0
Space Glissando::space() const
      {
      return Space(0.0, spatium() * 2.0);
      }
Пример #28
0
string *InputFile::GetString () throw ()
{
	string *s;

	// Returns last string ungot since last call (if any)
	if (!UngotStrings.empty())
	{
		UngotString us = UngotStrings.top();
		UngotStrings.pop();
		s = us.first;
		NextChar = us.second;

		if (*s == "\n") CurrentLine++;
		return s;
	}

	// If there's nothing left from the previous line, let's read another one
	if (RestOfLine.empty())
	{
		// But first checks if EOF has been reached
		if (*this)
		{
			// Reads a new line and append a \n to it
			::getline (*this, RestOfLine);
			RestOfLine += "\n";
		}
		else
		{
			// Return EOF
			return 0;
		}
	}

	// Start scanning from the beginning
	string::iterator i = RestOfLine.begin();

	// Skip whitespaces and tabs
	while (Space (*i)) i++;

	// Is it an alphanumeric string or a special char like '[', '.', etc.?
	if (!AlphaNumeric (*i))
	{
		// If these characters appear twice in a row, they must be treated as a single string, as in << or //
		static char DoubleOperators[] = "/%<>$";
		string::iterator j = i + 1;

		for (unsigned int x = 0; x < sizeof(DoubleOperators); x++)
		{
			if (*i == DoubleOperators[x])
			{
				// Checks if the operator is repeated in the next character
				if (*i == *j)
				{
					j++;
					break;
				}
			}
		}

		s = new string (i, j);
		RestOfLine = string (j, RestOfLine.end());
	}
	else
	{
		// Saves in j the start point of the token string
		string::iterator j = i;

		// If the first character is alphanumeric, the token will consist of the
		// substring starting from j up to the first non-alphanumeric character
		while (AlphaNumeric (*i)) i++;

		// TokenString contains all the characters until before the first
		// non-alphanumeric character. RestOfLine will hold the
		// remaining of the string
		s = new string (j, i);
		RestOfLine = string (i, RestOfLine.end());
	}

	NextChar = (RestOfLine == "") ? 0 : RestOfLine[0];
	if (*s == "\n") CurrentLine++;
	return s;
}
Пример #29
0
Space BarLine::space() const
      {
      return Space(0.0, width());
      }
Пример #30
0
Space Breath::space() const
      {
      return Space(0.0, spatium() * 1.5);
      }