Changeset - 7a41ccaab4c9
[Not reviewed]
default
0 1 0
LordOfWar - 16 years ago 2009-10-01 01:21:36

changed up printJob and printFrame to require less parameters, and now printJob only passes a pointer to a frame to printFrame

create a loop in the main function to interact with the queue in order to test it... it still needs a bit of work though
1 file changed with 39 insertions and 6 deletions:
0 comments (0 inline, 0 general)
src/server/distrend.c
Show inline comments
 
@@ -429,54 +429,53 @@ int distrend_do_config(int argc, char *a
 

	
 
  xmlcleanup();
 
  return 0;
 
}
 
int distrend_config_free(struct distrend_config *config)
 
{
 
  options_free(config->options);
 
  free(config);
 

	
 
  return 0;
 
}
 
/* ************************** Test Functions ************************* */
 
void printFrameInfo(struct distrenjob *head, struct distrenjob *job, int frame_num)
 
void printFrameInfo(struct frameset *frame)
 
{
 
  char *status = "";
 
  frame_num = frame_num - job->frameset[0].num;
 

	
 
  switch(job->frameset[frame_num].status)
 
  switch(frame->status)
 
  {
 
    case FRAMESETSTATUS_UNASSIGNED:
 
      _distren_asprintf(&status, "%s", "unassigned");
 
      break;
 
    case FRAMESETSTATUS_ASSIGNED:
 
      _distren_asprintf(&status, "%s", "assigned");
 
      break;
 
    case FRAMESETSTATUS_DONE:
 
      _distren_asprintf(&status, "%s", "completed");
 
      break;
 
    case FRAMESETSTATUS_CANCELED:
 
      _distren_asprintf(&status, "%s", "canceled");
 
  }
 

	
 
  printf("frame #: %d --> %s", frame_num, status);
 
  printf("frame #: %d --> %s", frame->num, status);
 
}
 

	
 
void printJob(struct distrenjob *head, struct distrenjob *job)
 
void printJob(struct distrenjob *job)
 
{
 
  int counter;
 
  printf("frame_num: status");
 
  for(counter = 0; counter < job->total_frames; counter++)
 
    {
 
      printFrameInfo(head, job, job->frameset[counter].num);
 
      printFrameInfo(&job->frameset[counter]);
 
    }
 
}
 

	
 
void printJobInfo(struct distrenjob *head, struct distrenjob *job)
 
{
 
  printf("type: %d", job->type);
 
  printf("name: %s", job->email);
 
  printf("submitter: %s", job->submitter);
 
  printf("e-mail: %s", job->email);
 
  printf("priority, %d", job->priority);
 
  printf("completed: %d", job->completed_frames);
 
  printf("assigned: %d", job->assigned_frames);
 
@@ -527,24 +526,58 @@ int main(int argc, char *argv[])
 
    CLIENTSTATUS_UNINITIALIZED = 0,
 
    CLIENTSTATUS_BUSY = 1,
 
    CLIENTSTATUS_IDLE = 2
 
  } clientstatus;
 

	
 
  cont = 1;
 
  memset(&head, '\0', sizeof(struct distrenjob));
 

	
 
  start_data(); // Starts fresh or loads data from xml dump. Should we grab the return?
 

	
 
  distrend_do_config(argc, argv, &config);
 

	
 
  while(t==1)
 
  {
 
	  int command;
 
	  printf("1-->print all frames in a job");
 
	  printf("2-->examine certain job");
 
	  printf("3-->get a frame to render");
 
	  printf("4-->add a job");
 
	  printf("5-->delete a job");
 
	  printf("6-->exit menu");
 

	
 
	  command = scanf();
 

	
 
	  if(command == 6)
 
		  break;
 

	
 
	  switch(command)
 
	  {
 
	  case 1:
 
		  printf("job number:");
 
		  command = scanf();
 
		  printJob(distrenjob_get(head, command));
 
		  break;
 
	  case 2:
 

	
 
		  break;
 
	  case 3:
 
		  break;
 
	  case 4:
 
		  break;
 
	  case 5:
 
		  break;
 
	  }
 
  }
 

	
 
  distrend_listen(&listenset, config);
 
  /* This is called the "main loop" */
 
  while(cont)
 
    {
 
      struct distren_action *action;
 
      int clientsays = 0; /*< temporary example variable, will be replaced when we can handle messages */
 

	
 
      distrend_accept(&action);
 
      cont = distrend_do(action);
 

	
 
      /* Make the following code more event-driven */
 
      frame_watchdog(&head);
0 comments (0 inline, 0 general)