Ejemplo n.º 1
0
int timer_handler(gpointer data)//make question
{
	int i;
	if (questionFlag == 0 && life > 0)
	{
		gtk_label_set_text(GTK_LABEL(label2), "♥Malang♥");
		isSensitive(1); // non sensitive button
		if (qidx != 0)
		{
			gtk_button_set_label(GTK_BUTTON(button[question[qidx - 1]]), " ");
		}
		if (waitingFlag == 0)
		{
			makeQuestion();
		}
		gtk_button_set_label(GTK_BUTTON(button[question[qidx]]), "O");
		
		qidx++;
		if (qidx == level)
		{
			questionFlag = 1;
			waitingFlag = 0;
		}
	}
	else if (life == 0) // game over
	{
		gtk_label_set_text(GTK_LABEL(label2), "Game is Over");
		isSensitive(1);
		return 0;
	}
	else
	{
		isSensitive(0);//sensitive button
		gtk_button_set_label(GTK_BUTTON(button[question[level - 1]]), " ");
		if (answerFlag == 1)
		{   //confirm
			if (confirmAnswer() == 1) //correct
			{
				isCorrect();
			}
			else //wrong
			{
				isWrong();
			}
		}
		else
		{
			printf("Input your answer...\n");
		}
	}
}
Ejemplo n.º 2
0
_BOOL add_to_job_name(EMBRYO_INFO *info,char which){
  char *sens_char = sensative_characters[isSensitive(&which)];
  if(strlen(info->forkseqname[info->fork_seq-1])+strlen(sens_char)+2 >MAX_JOB_NAME){
    errno = ENOMEM;
    return FALSE;
  }
  strcat(info->forkseqname[info->fork_seq-1]," ");
  strcat(info->forkseqname[info->fork_seq-1],sens_char);
  return TRUE;
}
Ejemplo n.º 3
0
/**
* attempts to form processes and their i/o connections from tkns
* tkns: ptr to the TOKENS
* procs: ptr to EMBRYO structs
* info: contains information about where to start( i.e to be used if we are continuing from a previous call to embryos_init)
* returns: status, return FALSE and errno is set to EINVAL for bad syntax or 0 if we don't have enough info (i.e go back to shell)
**/
_BOOL embryos_init(TOKENS *tkns,EMBRYO* procs, EMBRYO_INFO* info){
  if(info == NULL | tkns == NULL || procs == NULL) {errno = EFAULT; return FALSE;}
  char *cur_tkn;
  int which = CURR_TOKEN;

  for(;(cur_tkn = getToken(tkns,which))!=NULL;which=NEXT_TOKEN){
      switch (isSensitive(cur_tkn)) {
        //if not a sensitive character
        case 0:{
          //if there is at least 1 embryo already
          if(info->cur_proc !=-1){
            //call the post handler

            if(posthandlers[(info->last_sequence*-1)](procs,info,cur_tkn)  == FALSE ){
              info->err_character = cur_tkn;
              return FALSE;
            }

          }
          //else we need to create at least one proc
          //since there is no last_sequence yet
          else{
            if(!embryo_create(procs,info,cur_tkn))
              return FALSE;
          }
          break;
        }
        //is a sensitive char
        default:{
          //call the prehandler based on the *cur_tkn, which sensitive char it is
          if(  prehandlers[(*cur_tkn * -1)](procs,info,*cur_tkn)  == FALSE ){
            if(errno == EINVAL)//syntax error
              info->err_character = cur_tkn;
            return FALSE;
          }
          break;
        }
      }
  }

  if(info->last_sequence != '\0'){
    errno = 0;
    return FALSE;
  }

  return TRUE;
}
Ejemplo n.º 4
0
int QTweetStatusUpdateWithMedia::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QTweetNetBase::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 2)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 2;
    } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
        if (_id < 2)
            *reinterpret_cast<int*>(_a[0]) = -1;
        _id -= 2;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QString*>(_v) = status(); break;
        case 1: *reinterpret_cast< QString*>(_v) = imageFilename(); break;
        case 2: *reinterpret_cast< bool*>(_v) = isSensitive(); break;
        case 3: *reinterpret_cast< qint64*>(_v) = inReplyToStatusID(); break;
        case 4: *reinterpret_cast< double*>(_v) = latitude(); break;
        case 5: *reinterpret_cast< double*>(_v) = longitude(); break;
        case 6: *reinterpret_cast< QString*>(_v) = placeID(); break;
        case 7: *reinterpret_cast< bool*>(_v) = displayCoordinates(); break;
        }
        _id -= 8;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setStatus(*reinterpret_cast< QString*>(_v)); break;
        case 1: setImageFilename(*reinterpret_cast< QString*>(_v)); break;
        case 2: setSensitive(*reinterpret_cast< bool*>(_v)); break;
        case 3: setReplyToStatusID(*reinterpret_cast< qint64*>(_v)); break;
        case 4: setLatitude(*reinterpret_cast< double*>(_v)); break;
        case 5: setLongitude(*reinterpret_cast< double*>(_v)); break;
        case 6: setPlaceID(*reinterpret_cast< QString*>(_v)); break;
        case 7: setDisplayCoordinates(*reinterpret_cast< bool*>(_v)); break;
        }
        _id -= 8;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 8;
    } else if (_c == QMetaObject::RegisterPropertyMetaType) {
        if (_id < 8)
            *reinterpret_cast<int*>(_a[0]) = -1;
        _id -= 8;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}