示例#1
0
int main(int argc, char* argv[])
{
  int i,j;
  int req[M];
  if(argc > 1)
    srand(atoi(argv[1]));

  if(secure() == 0)
    return -1;

      pp();

  while(1){
    for(i = 0; i < N; i++){
      if(finish(i))
        continue;
      printf("*******proc %d running******\n",i);
      for(j = 0; j < M; j++){
        if(need[i*M+j] == 0 || ava[j] == 0)
          req[j] = 0;
        else{
          int k=MIN(ava[j],need[i*M+j]);
          req[j] = (rand() % k) + 1;
        }
        alloc[i*M+j] += req[j];
        need[i*M+j] -= req[j];
        ava[j] -= req[j];
      }
      
      if(secure() == 0){
        for(j = 0; j < M; j++){
          alloc[i*M+j] -= req[j];
          need[i*M+j] += req[j];
          ava[j] += req[j];
        }
        printf("proc %d sleeping\n\n",i);
        //pp();  
      }else{
        if(finish(i))
          fre(i);
        printf("%d %d %d to proc %d\n\n",req[0],req[1],req[2],i);
        pp();
      }
      
      printf("\n");
      //getchar();
    }//for N

    if(ava[0] == 10 && ava[1] == 5 && ava[2] == 7)
      break;
  }

  return 0;
}
示例#2
0
//-------------------------------------------------------------------------------------------------
inline std::tstring_t
CookiePv0::dump() const
{
    std::tstring_t sRv;

    sRv = String::format(
            xT("[CookiePv0 dump]\n\n")
            xT("Name: %s\n")
            xT("Value: %s\n")
            xT("Domain: %s\n")
            xT("Path: %s\n")
            xT("Expires: %s\n")
            xT("Secure: %s\n")
            xT("HttpOnly: %s\n\n"),
            name().c_str(),
            value().c_str(),
            domain().c_str(),
            path().c_str(),
            expires().c_str(),
            String::castBool(secure()).c_str(),
            String::castBool(httpOnly()).c_str()
    );

    return sRv;
}
示例#3
0
// ------------------------------------------------------------------------
// CDRMConsume::HandleL
// ------------------------------------------------------------------------
//
void CDRMConsume::HandleL( ContentAccess::TIntent aIntent )
{
    DRMLOG( _L( "CDRMConsume::HandleL" ) );

    TTime time;
    TBool secure( SECURETIME( time ) );
    InitializeL( aIntent, secure, time );

    DRMLOG( _L( "CDRMConsume::HandleL ok" ) );
}
示例#4
0
    Listener::Listener(const string& name, const string &ip, int port, bool logConnect ) 
        : _port(port), _name(name), _ip(ip), _logConnect(logConnect), _elapsedTime(0) { 
#ifdef MONGO_SSL
        _ssl = 0;
        _sslPort = 0;

        if ( cmdLine.sslOnNormalPorts && cmdLine.sslServerManager ) {
            secure( cmdLine.sslServerManager );
        }
#endif
    }
示例#5
0
 string_type build() const
 {
     string_type res = name() + string_traits_type::convert("=") + as_string( value() );
     if ( !comment().empty() )
         res += string_traits_type::convert("; comment=") + as_string( comment() );
     if ( !expires().empty() )
         res += string_traits_type::convert("; expires=") + as_string( expires() );
     if ( !max_age().empty() )
         res += string_traits_type::convert("; max-Age=") + as_string( max_age() );
     if ( !path().empty() )
         res += string_traits_type::convert("; path=") + as_string( path() );
     if ( !domain().empty() )
         res += string_traits_type::convert("; domain=") + as_string( domain() );
     if ( !version().empty() )
         res += string_traits_type::convert("; version=") + as_string( version() );
     if ( http_only() )
         res += string_traits_type::convert("; httponly");
     if ( secure() )
         res += string_traits_type::convert("; secure");
     return res;
 }
示例#6
0
void AsiMS2000::selectCommand(int commandNum)
{
  switch(commandNum)
  {
      case 0:
          accel();
          break;
      case 1:
          aalign();
          break;
      case 2:
          afcont();
          break;
      case 3:
          aflim();
          break;
      case 4:
          afocus();
          break;
      case 5:
          afset();
          break;
      case 6:
          afmove();
          break;
      case 7:
          ahome();
          break;
      case 8:
          aij();
          break;
      case 9:
          array();
          break;
      case 10:
          azero();
          break;
      case 11:
          backlash();
          break;
      case 12:
          bcustom();
          break;
      case 13:
          benable();
          break;
      case 14:
          build();
          break;
      case 15:
          cdate();
          break;
      case 16:
          cnts();
          break;
      case 17:
          customa();
          break;
      case 18:
          customb();
          break;
      case 19:
          dack();
          break;
      case 20:
          dump();
          break;
      case 21:
          ensync();
          break;
      case 22:
          epolarity();
          break;
      case 23:
          error();
          break;
      case 24:
          halt();
          break;
      case 25:
          here();
          break;
      case 26:
          home();
          break;
      case 27:
          info();
          break;
      case 28:
          joystick();
          break;
      case 29:
          jsspd();
          break;
      case 30:
          kadc();
          break;
      case 31:
          kd();
          break;
      case 32:
          ki();
          break;
      case 33:
          kp();
          break;
      case 34:
          lcd();
          break;
      case 35:
          led();
          break;
      case 36:
          lladdr();
          break;
      case 37:
          load();
          break;
      case 38:
          lock();
          break;
      case 39:
          lockrg();
          break;
      case 40:
          lockset();
          break;
      case 41:
          maintain();
          break;
      case 42:
          motctrl();
          break;
      case 43:
          move();
          break;
      case 44:
          movrel();
          break;
      case 45:
          pcros();
          break;
      case 46:
          pedal();
          break;
      case 47:
          rbmode();
          break;
      case 48:
          rdadc();
          break;
      case 49:
          rdsbyte();
          break;
      case 50:
          rdstat();
          break;
      case 51:
          relock();
          break;
      case 52:
          reset();
          break;
      case 53:
          rt();
          break;
      case 54:
          runaway();
          break;
      case 55:
          saveset();
          break;
      case 56:
          savepos();
          break;
      case 57:
          scan();
          break;
      case 58:
          scanr();
          break;
      case 59:
          scanv();
          break;
      case 60:
          secure();
          break;
      case 61:
          sethome();
          break;
      case 62:
          setlow();
          break;
      case 63:
          setup();
          break;
      case 64:
          si();
          break;
      case 65:
          speed();
          break;
      case 66:
          spin();
          break;
      case 67:
          status();
          break;
      case 68:
          stopbits();
          break;
      case 69:
          ttl();
          break;
      case 70:
          um();
          break;
      case 71:
          units();
          break;
      case 72:
          unlock();
          break;
      case 73:
          vb();
          break;
      case 74:
          vector();
          break;
      case 75:
          version();
          break;
      case 76:
          wait();
          break;
      case 77:
          where();
          break;
      case 78:
          who();
          break;
      case 79:
          wrdac();
          break;
      case 80:
          zero();
          break;
      case 81:
          z2b();
          break;
      case 82:
          zs();
          break;
      case 83:
          overshoot();
          break;
  }
}
示例#7
0
	ustring secure(const ustring &path)
	{
		return secure(path.c_str());
	}
示例#8
0
void main(){
int gdriver = EGA, gmode = EGAHI, errorcode;
initgraph(&gdriver, &gmode, "c:\\tc\\bgi");
bk(); travel(); gravitas();
tvar=0;
m1c=m2c=adc=chdc=0;
signup_traction();

while(ch!=27)
{
if(kbhit())
{
ch=getch();
if(ch==77) {way(1);}
if(ch==75) {way(0);}
if(ch==80) {menu1();setcolor(6);settextstyle(2,0,4);
outtextxy(68,180,"<-");break;}
}}
flag1:
city();
m1c=0;
while(ch!=27)
{
gravitas();
if(kbhit())
{
ch=getch();

if(ch==80 && m1c<=15)                         //i city
{menu1();city();++m1c;ibar();tarrow(m1c);mcounter(m1c);}

if(ch==72 && m1c>=1 && m1c<=15)
{menu1();city();m1c--;ibar();tarrow(m1c);mcounter(m1c);}

if(ch==80 && m1c>=16 && m1c<=33)                 //2 city
{menu1();city2();m1c++;ibar();tarrow(m1c);mcounter(m1c);}

if(ch==72 && m1c>=16 && m1c<=33)
{menu1();city2();m1c--;ibar();tarrow(m1c);mcounter(m1c);}

if(ch==80 && m1c>=34 && m1c<=51)                 //3 city
{menu1();city3();m1c++;ibar();tarrow(m1c);mcounter(m1c);}

if(ch==72 && m1c>=34 && m1c<=51)
{menu1();city3();m1c--;ibar();tarrow(m1c);mcounter(m1c);}

if(ch==80 && m1c>=52 && m1c<56)                //4 city
{menu1();city4();m1c++;ibar();tarrow(m1c);mcounter(m1c);}

if(ch==72 && m1c>=52 && m1c<=56)
{menu1();city4();m1c--;ibar();tarrow(m1c);mcounter(m1c);}

if(ch==13)
{from=m1c; bk(); travel(); mcounter(m1c);from=m1c;if(tvar)tmcounter(m2c);break;}

if(ch==77) { bk();travel();menu2();tcity();mcounter(m1c);from=m1c;menu2();break;}
}}

//flag2:
m2c=0;
while(ch!=27)
{
gravitas();
if(kbhit())
{
ch=getch();

if(ch==80 && m2c<=15)                         //i city
{menu2();tcity();++m2c;tbar();arrow(m2c);tmcounter(m2c);}

if(ch==72 && m2c>=1 && m2c<=15)
{menu2();tcity();m2c--;tbar();arrow(m2c);tmcounter(m2c);}

if(ch==80 && m2c>=16 && m2c<=33)                 //2 city
{menu2();tcity2();m2c++;tbar();arrow(m2c);tmcounter(m2c);}

if(ch==72 && m2c>=16 && m2c<=33)
{menu2();tcity2();m2c--;tbar();arrow(m2c);tmcounter(m2c);}

if(ch==80 && m2c>=34 && m2c<=51)                 //3 city
{menu2();tcity3();m2c++;tbar();arrow(m2c);tmcounter(m2c);}

if(ch==72 && m2c>=34 && m2c<=51)
{menu2();tcity3();m2c--;tbar();arrow(m2c);tmcounter(m2c);}

if(ch==80 && m2c>=52 && m2c<56)                //4 city
{menu2();tcity4();m2c++;tbar();arrow(m2c);tmcounter(m2c);}

if(ch==72 && m2c>=52 && m2c<=56)
{menu2();tcity4();m2c--;tbar();arrow(m2c);tmcounter(m2c);}

if(ch==13)
{to=m2c; bk(); travel(); tvar=1;tmcounter(m2c);to=m2c;mcounter(m1c);break;}

if(ch==75)
{bk();travel(); to =m2c; tvar=1; tmcounter(m2c);to=m2c;menu1(); //goto flag1;
break;}

}
}

while(ch!=27)
{
gravitas();
if(kbhit())
{
ch=getch();
if(ch==80 && adc<10)
{admenu();adult();  adc++; adarrow(adc); adcounter(adc);}
if(ch==72 && adc>0)
{admenu();adult(); adc--; adarrow(adc);adcounter(adc);}
if(ch==77)
{adno=adc;chmenu();bk(); travel();tmcounter(m2c);mcounter(m1c);adcounter(adc);break;}
if(ch==13)
{adno=adc;bk(); travel();tmcounter(m2c);mcounter(m1c);adcounter(adc);break;}
}}

while(ch!=27)
{
gravitas();
if(kbhit())
{
ch=getch();
if(ch==80 && chdc<10)
{chmenu();child(); chdc++; charrow(chdc); chcounter(chdc);}
if(ch==72 && chdc>0)
{chmenu();child(); chdc--; charrow(chdc);chcounter(chdc);}
if(ch==77)
{chno=chdc;chmenu();bk(); travel();tmcounter(m2c);mcounter(m1c);adcounter(adc);chcounter(chdc); break;}
if(ch==13)
{chno=chdc;bk(); travel();tmcounter(m2c);mcounter(m1c);adcounter(adc);chcounter(chdc); break;}
}}

while(ch!=27)
{ gravitas();
if(kbhit())
{
ch=getch();
if(ch==80 && inc<10)
{inmenu();infant(); inc++; inarrow(inc); incounter(inc);}
if(ch==72 && inc>0)
{inmenu();infant(); inc--; inarrow(inc);incounter(inc);}
if(ch==77)
{inno=inc;inmenu();bk(); travel();tmcounter(m2c);mcounter(m1c);adcounter(adc);chcounter(chdc);incounter(inc); break;}
if(ch==13)
{inno=chdc;bk(); travel();tmcounter(m2c);mcounter(m1c);adcounter(adc);chcounter(chdc);incounter(inc); break;}
}}

while(ch!=27)
{
gravitas();
if(kbhit())
{
ch=getch();
if(ch==77) {ecob(1);suit=1;}
if(ch==75) {ecob(0);suit=0;}
if(ch==13) {break;}
}
}

setcolor(1);settextstyle(2,0,4);
ch=0;
while(ch!=13)
{
if(kbhit())
{da+=8;
ch=getch();
if(isalnum(ch) && da<=95)
{sprintf(dater,"%c",ch);
outtextxy(da,272,dater);}

if(ch==8 && da>=45 && da<=180)
{da=da-8;
setfillstyle(1,15);  bar(da,272,da+8,285);
da=da-8;}
}}

if(suit==0)flight(to);
if(suit==1)bflight(to);
traction();
secure();
money_transfer();

getch();
closegraph();}