Exemplo n.º 1
0
void mSingleObj::calculateKeyParam()
{
	calculateNumRecords();
	int maxRun=MAX_NUM_RUN;
	m_numChanges=1;
	m_recordsPerChange=m_numRecords;
	for(int i=0;maxRun>i;i++) mpp_convergeTime[i].resize(m_numChanges);
}
Exemplo n.º 2
0
void save(){
  //add record
  if (saveOption == 0){
    ReadMystoreFromChild("add", subjInput, bodyInput, NULL);
    calculateNumRecords();
    recordNum = numRecords;
    display();
  }
  //edit record
  else{
    char strRecordNum[10];
    sprintf(strRecordNum, "%d", recordNum);
    ReadMystoreFromChild("edit", strRecordNum, subjInput, bodyInput);
    display();
  }
}
Exemplo n.º 3
0
//type is 0 or 1,
//if 0, then its find in subject
//if 1, then its find in body
void findRecords(char* key, int type){

  calculateNumRecords();
	//can return a maximum of 100 records
	//can only return records with ids < 10000
  fi = 0; // found records index


  
  char *test;
  
  
  int ri = 1; //record index
  char ris[5]; //record index as a string
  

  while(ri <= numRecords){	
    
    
    sprintf(ris,"%d",ri);
    ris[4] = '\0';
    
    
    ReadMystoreFromChild("display", ris, NULL, NULL);
    setNumStructsNeeded();
    ParseInput();
    
    

    if(type == 0){
      test = (char *)malloc(30 * sizeof(char));
      test = pairs[3].value;
    }
    
    else if(type == 1){	
      test = (char *)malloc(140 * sizeof(char));
      test = pairs[4].value;
    }
    
    int klen = strlen(key);
    
    int tlen = strlen(test);
    
    int ti = 0; //text index
    char exerpt[klen+1];
    
    char *testSpot;
    int loop = 1;
    
    while(ti < tlen){
      
      if(test[ti] == key[0]){
	testSpot = &test[ti];
	strncpy(exerpt, testSpot, klen);
	exerpt[klen] = '\0';
	if(strcmp(exerpt, key) == 0){
	  foundRecords[fi++] = ri;
	}
      }
      ti++;
    }
    
    
    ++ri;
  }
  
  numFoundRecords = fi;
  fi = 0;
  
}
Exemplo n.º 4
0
int main(){
  calculateNumRecords();
  welcomeScreen();
  return 1;
}
Exemplo n.º 5
0
void viewFoundRecordsHelper(){
  while (1){
    while ((c=getkey()) == KEY_NOTHING);
    //    xt_par2(XT_SET_ROW_COL_POS, 18, 1);
    //    xt_par0(XT_ERASE_LINE);
    if (c == KEY_LEFT){
      if (numFoundRecords != 1){
	fi--;
	if (fi < 0)
	  fi = numFoundRecords-1;
	displayFoundRecords();
	break;
      }
    }
    else if (c == KEY_RIGHT){
      if (numFoundRecords != 1){
	fi++;
	if (fi == numFoundRecords)
	  fi = 0;
	displayFoundRecords();
	break;
      }
    }
    else if (c == KEY_F3){
      if (numFoundRecords > 0){
	int tempRecordCounter = numRecords;
	deleteRecordHelper();
	calculateNumRecords();
	if (numRecords < tempRecordCounter)
	  numFoundRecords--;
	//numRecords --;
	if (fi == numRecords)
	  fi--;
	displayFoundRecords();
	break;
      }
      else{
	xt_par2(XT_SET_ROW_COL_POS, 18, 1);
	xt_par0(XT_ERASE_LINE);
	printf("No record to delete.");
      }
    }
    else if (c == KEY_F4){
      if (numRecords > 0)
	recordNum = 1;
      display();
      break;
    }
    else if (c == KEY_F5){
      findInputScreen();
      break;
    }
    else if (c == KEY_F6){
      if (numFoundRecords > 0){
	editRecord();
	//displayFoundRecords();
	break;
      }
      else{
	xt_par2(XT_SET_ROW_COL_POS, 18, 1);
	xt_par0(XT_ERASE_LINE);
	printf("No record to edit.");
      }
    }
  }
  getkey_terminate();
}