Esempio n. 1
0
/*------------------------------------------------------*/
void	AuxDef (void)
{
	char c;
	while(Kbhit(CHAUX))
	{
		if(!AuxBuff)
			Auxp=AuxBuff=memalloc(LINK_LEN);
		switch(c=Getch(CHAUX))
		{
		case 0x0A:
		case 0x0D:
			puts_aux("\r\n");
			*Auxp=null;
			Auxp=AuxBuff;
			if(!strcmp("?v",Auxp))
				SysMessage(CHAUX);
			puts_aux(">");
			break;
		default:
			if(Auxp != &AuxBuff[LINK_LEN-1])
				*Auxp++=c;
			else
			{
				*Auxp=c;
				Putch('\b',CHAUX);
			}
			Putch(c,CHAUX);
			break;
		}
	}
}
void test6()
 {
  int buf[]={1,2,3,4,5};
  
  auto r=RangeReverse(buf);

  for(ulen i=0; i<r.len ;i++) Printf(Con,"#; ",r[i]);
  
  Putch(Con,'\n');
  
  for(ulen i=1; i<=r.len ;i++) Printf(Con,"#; ",r.back(i));
  
  Putch(Con,'\n');
 }
Esempio n. 3
0
/*--------------------------------------------------------*/
int			GpsComm(char *p)
			{
			char *q;

			Putch(0x10,CHGPS);
			for(q=p; *q != 0; ++q,++q) {
				Putch(getasc(q),CHGPS);
				if(getasc(q) == 0x10)
					Putch(0x10,CHGPS);
				}
			Putch(0x10,CHGPS);
			Putch(0x03,CHGPS);
			return(null);
			}
Esempio n. 4
0
/*......................................................................*/
void	JwSend(void)
		{
static	int	n;
		int	i,j;

		if(!CheckTask(JwSend,PIT_task)) {
			n=0;
			SetTask(JwSend,100,PIT_task);
			}
		for(i=j=0; i<=JwTx[0]; ++i)
			j += Putch(JwTx[i],CHAUX);
		Putch(j,CHAUX);
		if(++n >= 5)
			DeleteTask(JwSend,PIT_task);
		}
void test3()
 {
  PlatformRandom random;
  
  for(ulen cnt=10000; cnt ;cnt--)
    {
     Printf(Con,"cnt = #;   \r",cnt);
     
     RandomInt a(32,random);
     RandomInt b(32,random);
     
     Int P=a*b;

     if( P<0 ) P=-P;
     
     if( Math::NoPrimeTest<Int>::RandomTest(P,10,random) ) 
       {
        Printf(Con,"\nPassed 10\n");
        
        if( Math::NoPrimeTest<Int>::RandomTest(P,20,random) ) Printf(Con,"  Passed 30\n");
       }
    }
  
  Putch(Con,'\n');
 }
void test3()
 {
  DynArray<int> buf{1,2,3,4,5};
  
  for(auto r=RangeReverse(buf); +r ;++r) Printf(Con,"#; ",*r);
  
  Putch(Con,'\n');
 }
void test2()
 {
  int buf[]={1,2,3,4,5};
  
  for(int obj : RangeReverse(buf) ) Printf(Con,"#; ",obj);
  
  Putch(Con,'\n');
 }
void test1()
 {
  int buf[]={1,2,3,4,5};
  
  for(auto r=RangeReverse(buf); +r ;++r) Printf(Con,"#; ",*r);
  
  Putch(Con,'\n');
 }
 static void Print(P &out)
  {
   PrintCaseList<typename Meta::SplitCaseOf<0,CaseList>::First>::Print(out);
   
   Putch(out,'\n');
   
   PrintCaseList<typename Meta::SplitCaseOf<0,CaseList>::Last>::Print(out);
  }
Esempio n. 10
0
/*......................................................................*/
void	JwRec(void)
		{
static	ack_flag;
		int	j;

		if(Kbhit(CHAUX))
			if(CheckTask(JwSend,PIT_task))
				switch(j=Getch(CHAUX)) {
					case ACK_COM:  ack_flag = ACK_COM;
									break;
					case NACK_COM:	JwSend();
									break;
					default:		if((ack_flag == ACK_COM) && (j == JwTx[0]))
										DeleteTask(JwSend,PIT_task);
									ack_flag = 0;
									break;
					}
			else
				switch(JwCount)	{
					case	0:	JwCount=JwCheck=Getch(CHAUX);
								if(JwCount > 16)
									JwCount=0;
								else{
									JwCount++;
									Jw=JwRx;
									SetTask(JwDrop,50,PIT_task);
									}
								break;
					case	1:  if(JwExe()) {
									Putch(ACK_COM,CHAUX);
									Putch(JwRx[0],CHAUX);
									}
								else
									Putch(NACK_COM,CHAUX);
								JwCount--;
								DeleteTask(JwDrop,PIT_task);
								break;
					default: 	*Jw = Getch(CHAUX);
								JwCheck += *Jw++;
								JwCount--;
								break;
					}
		}
Esempio n. 11
0
 static void Print(P &out)
  {
   PrintSplit<CaseList,Len-1>::Print(out);
   
   Printf(out,"-----\n\n");
   
   PrintCaseList<typename Meta::SplitCaseOf<Len,CaseList>::First>::Print(out);
   
   Putch(out,'\n');
   
   PrintCaseList<typename Meta::SplitCaseOf<Len,CaseList>::Last>::Print(out);
  }
Esempio n. 12
0
/*------------------------------------------------------*/
void	ReadPc (void)
{
	char c;
	while(Kbhit(CHPC))
	{
		if(!LinkBuff)
			Linkp=LinkBuff=memalloc(LINK_LEN);
		switch(c=Getch(CHPC))
		{
		case 0x0A:
		case 0x0D:
			puts_pc("\r\n");
			*Linkp=null;
			Linkp=LinkBuff;
			PcLinkDecode(Linkp);
			puts_pc(">");
			break;
		case 0x7F:
			if(Linkp != LinkBuff)
			{
				--Linkp;
				if(!LPP)
					puts_pc("\b \b");
			}
			break;
		default:
			if(Linkp != &LinkBuff[LINK_LEN-1])
				*Linkp++=c;
			else
			{
				*Linkp=c;
				if(!LPP)
					Putch('\b',CHPC);
			}
			if(!LPP)
				Putch(c,CHPC);
			break;
		}
	}
}
Esempio n. 13
0
void PrintFibre(P &out,const TopCompress &compress,PtrLen<const State> range)
 {
  ulen prop=range->getPropIndex();
  bool flag=false;

  for(State top : range )
    {
     ulen index=top.getPropIndex();

     Printf(out," #;:#;)",top.getIndex(),index);

     if( index!=prop ) flag=true;
    }

  if( flag )
    {
     for(State top : range )
       {
        Printf(out,"  #.b;\n  -----\n",compress.getProps()[top.getPropIndex()]);
       }
    }

  Putch(out,'\n');
 }
void test1()
 {
  Memo1 obj1;
  Memo1 obj2;
  Memo1 obj3;

  ObjMaster master1(obj1,"obj1");
  ObjMaster master2(obj2,"obj2");
  ObjMaster master3(obj3,"obj3");

  ObjMaster_delete master4(new Memo2(),"obj4");
  ObjMaster_delete master5(new Memo2(),"obj5");

  ObjHook hook1("obj1");
  ObjHook hook2("obj2");
  ObjHook hook3("obj3");
  ObjHook hook4("obj4");
  ObjHook hook5("obj5");

  Putch(Con,'\n');

  Memo1::Show(hook1.cast<Memo1>());
  Memo1::Show(hook2.cast<Memo1>());
  Memo1::Show(hook3.cast<Memo1>());
  Memo1::Show(hook4.cast<Memo1>());
  Memo1::Show(hook5.cast<Memo1>());

  Putch(Con,'\n');

  {
   ObjHost::List<ObjInfo> list;

   list.build();

   Show("ObjInfo",Range(list));
  }

  {
   ObjHost::List<ObjInfo_obj> list;

   list.build();

   Show("ObjInfo_obj",Range(list));
  }

  {
   ObjHost::List<ObjInfo_if<Memo1> > list;

   list.build();

   Show("ObjInfo_if",Range(list));
  }

  {
   ObjHost::List<ObjInfo_obj_if<Memo2> > list;

   list.build();

   Show("ObjInfo_obj_if",Range(list));
  }
 }
void show(R r)
 {
  for(; +r ;++r) Printf(Con,"#; ",*r);
  
  Putch(Con,'\n');
 }
Esempio n. 16
0
 static void Print(P &out)
  {
   PrintList<CC...>::Print(out);
   
   Putch(out,'\n');
  }