Esempio n. 1
0
	void Aggregate::popN(Token n, ... ) const{
		CHECKUNDERFLOW(n);
		va_list refVars;va_start(refVars,n);
			for(uWord i=hP()->n-n;i<hP()->n;i++) *va_arg(refVars,Word*)=data(i);
		va_end(refVars);
		hP()->n-=n;
	}
Esempio n. 2
0
	void Aggregate::checkResize(Word n) const{
		uWord m=n+hP()->n,r=hP()->size;
		if(m>r){
			for(;m>r;r+=1+r/8);
			resize<hAggregate,Word>(r);
			hP()->size=r;
		}
	}
Esempio n. 3
0
	void Aggregate::checkUnderflow(Word n,const char* m)const{
		if(!isToken() || !((obj)n).isInt() || n>hP()->n){
			std::stringstream s;
			if(m) s<<m;
			s<<" checkUnderflow n="<<n<<" elements()="<<elements();
			throw(std::runtime_error(s.str()));
		}
	}
Esempio n. 4
0
static void OnProgressPaint(WindowControl * Sender, LKSurface& Surface) {
  RECT PrintAreaR = Sender->GetClientRect();
    
  const auto oldFont = Surface.SelectObject(MapWindowBoldFont);

  Surface.FillRect(&PrintAreaR, LKBrush_Petrol);

  // Create text area

  // we cannot use LKPen here because they are not still initialised for startup menu. no problem
  LKPen hP(PEN_SOLID,NIBLSCALE(1),RGB_GREEN);
  auto ohP = Surface.SelectObject(hP);
  const auto ohB = Surface.SelectObject(LKBrush_Petrol);
  Surface.Rectangle(PrintAreaR.left,PrintAreaR.top,PrintAreaR.right,PrintAreaR.bottom);
  Surface.SelectObject(ohP);
  hP.Release();

  hP.Create(PEN_SOLID,NIBLSCALE(1),RGB_BLACK);
  ohP = Surface.SelectObject(hP);
  Surface.SelectObject(LK_HOLLOW_BRUSH);
  InflateRect(&PrintAreaR, -NIBLSCALE(2), -NIBLSCALE(2));
  Surface.Rectangle(PrintAreaR.left,PrintAreaR.top,PrintAreaR.right,PrintAreaR.bottom);

  Surface.SetTextColor(RGB_WHITE);
  Surface.SetBackgroundTransparent();

  InflateRect(&PrintAreaR, -NIBLSCALE(2), -NIBLSCALE(2));
  
  const TCHAR* text = Sender->GetCaption();
  Surface.DrawText(text, &PrintAreaR, DT_VCENTER|DT_SINGLELINE);

  Surface.SelectObject(ohB);
  Surface.SelectObject(ohP);
  Surface.SelectObject(oldFont);
   
}
Esempio n. 5
0
	Word Aggregate::elements(uWord n) const{
		uWord r=hP()->n;hP()->n=n;return r;
}
Esempio n. 6
0
	Word Aggregate::elements() const{return hP()->n;}
Esempio n. 7
0
	Word Aggregate::maxElements() const{return hP()->size;}
Esempio n. 8
0
	Word& Aggregate::data(uWord i) const {return hP()->data(i);}
Esempio n. 9
0
	Word* Aggregate::dataP() const {return hP()->dataP();}
Esempio n. 10
0
void Aggregate::push(Word w) const{
	checkResize(1);
	hP()->data(hP()->n++)=w;
}
Esempio n. 11
0
Word& Aggregate::operator[](Word i) const {
#ifndef NBOUNDCHECKS
	ADJUSTOFFSET(elements(),i);
#endif
	return hP()->data(i);
}
Esempio n. 12
0
Word& Aggregate::at(Word i) const {
	ADJUSTOFFSET(elements(),i);
	return hP()->data(i);
}
Esempio n. 13
0
void Aggregate::roll(bool direction,int n){
	int d=elements();Word w;int i;
	if(direction)	{i=d-1;w=hP()->data(i);for(;i>=(d-n+1)	;i--) hP()->data(i)=hP()->data(i-1);}
	else						{i=d-n;w=hP()->data(i);for(;i<d-1			  ;i++) hP()->data(i)=hP()->data(i+1);}
	hP()->data(i)=w;
}