Ejemplo n.º 1
0
void sort_a()
{
    memcpy(B, A, sizeof(A));
    init_cs();
    sort(A, N, 0);
    Kl = INF;
}
Ejemplo n.º 2
0
void print()
{
    int i;
    printf("%d\n", Kl);
    init_cs();
    sort(Sol, N, 0);
    for (i = 1; i <= N; i++)
    {
        printf("%d ", Cs[i]);
        if (Sol[i] != Sol[i+1]) printf("\n");
    }
}
Ejemplo n.º 3
0
void main( void )
{
  // initialize all system relevant modules like
  // Clock System, Power Managment Module, I/O-Ports
  init_wdta ();
  init_port ();
  init_cs ();
  init_port_sw2 ();
  init_comp ();

//  __bis_SR_register(LPM4_bits+GIE);   // Enter LPM3, enable interrupts

  while (1)
  {
  	 delay_250ms(1);
     if (comp()==0)
	 {
       P1OUT |= 0x01;
       delay_1ms(200);
       P1OUT &= ~0x01;
	 }
  }
}
Ejemplo n.º 4
0
int main()
{
	// send header, there must not any printf before this
	printf("Content-Type: text/plain\n\n");
  	printf("Hello world\n\n");
	JUJU::CLog::setFile("/Users/juweihua/studio/projects/jsf/cs/cgi-bin/log");
/*	FILE* file = fopen("/Users/juweihua/studio/projects/jsf/cs/cgi-bin/log", "a+");
	fprintf(file, "=====hello====\n");
	fclose(file);
	cLOG("1");*/
	JUJU::CLog::enableStdOut(false);

//	debug("a=%s, b=%s", "aa", "bb");

    int i,n;
	printf("CONTENT-LENGTH: %s\n", getenv("CONTENT-LENGTH"));
	printf("QUERY_STRING: %s\n", getenv("QUERY_STRING"));
	printf("REQUEST_METHOD: %s\n", getenv("REQUEST_METHOD"));
	char* method = getenv("REQUEST_METHOD");
	char* content_length = getenv("CONTENT-LENGTH");
	char* query_string = getenv("QUERY_STRING");
// parser request
	n=0;
    char qs[2000] ="";
    char* pqs = qs;

// parse post data
    if(stricmp(method, "POST") == 0 && getenv("CONTENT-LENGTH") ){
/*	if (content_length != NULL)
    	n=atoi(getenv("CONTENT-LENGTH"));
	else if (query_string){
		n = strlen(query_string);
	}
    printf("content-length:%d\n",n);
*/
    for (i=0; i<n;i++){
        //int is-eq=0;
        char c=getchar();
//printf("%c", c);
        switch (c){
            case '&':
                *pqs='\n';
                pqs++;
                break;
            case '+':
                *pqs=' ';
                pqs++;
                break;
            case '%':{
                char s[3] = "";
                s[0]=getchar();
                s[1]=getchar();
                s[2]=0;
                *pqs=htoi(s);
                i+=2;
                pqs++;
                }
                break;
//case '=':
//c=':';
//is-eq=1;
//break;
            default:
            *pqs=c;
            pqs++;
        };
    }
    }
//printf("%s\n",getenv("QUERY_STRING"));
printf("qs=%s\n",qs);

try{
	init_cs();
	map<string, string> m;
	//object->command(param), return
	exec_cmd("test", "cmd", m);
}catch(...){
	return 0;	
}

	cLOG("2");


//fprintf(stdout, "=======================\n");

fflush(stdout);
SAFEDELETE(cs);
return 0;
}