]> hackdaworld.org Git - physik/nlsop.git/commitdiff
improved gui functionality (help + client info)
authorhackbard <hackbard>
Tue, 16 Nov 2004 11:34:46 +0000 (11:34 +0000)
committerhackbard <hackbard>
Tue, 16 Nov 2004 11:34:46 +0000 (11:34 +0000)
nlsop_general.h
nlsop_gui.c

index 5078ab5e5b5b8e9f4decba133aa210acc19148e6..d466775fa367e702a540862b7e26e9b6f534e2db 100644 (file)
@@ -12,6 +12,7 @@
 #define GUI_INFO 'i'
 #define GUI_ADDJOB 'a'
 #define GUI_QUIT 'q'
+#define GUI_HELP 'h'
 
 #define DATA_OK (1<<0)
 
index 3129fe29fdb3b2e7bba0c5e6f96ca917ac82e87e..e4677915503358528fd6b78e91b0785c2640f121 100644 (file)
@@ -109,6 +109,7 @@ int send_and_wait_for_answer(t_net *net,t_display *display,t_input *input) {
 
   int i,count;
   t_job job;
+  t_client client;
   char data;
   char string[MAX_CONTENT];
 
@@ -124,6 +125,7 @@ int send_and_wait_for_answer(t_net *net,t_display *display,t_input *input) {
     return -1;
   }
 
+  display_new_line(display,input,"jobs:");
   network_receive_chan(net,0,(unsigned char *)&count,sizeof(int));
   for(i=0;i<count;i++) {
     network_receive_chan(net,0,(unsigned char *)&job,sizeof(t_job));
@@ -134,6 +136,18 @@ int send_and_wait_for_answer(t_net *net,t_display *display,t_input *input) {
              job.info.diff_rate,job.info.dr_ac,job.progress);
     display_new_line(display,input,string);
   }
+  
+  display_new_line(display,input,"clients:");
+  network_receive_chan(net,0,(unsigned char *)&count,sizeof(int));
+  for(i=0;i<count;i++) {
+    network_receive_chan(net,0,(unsigned char *)&client,sizeof(t_client));
+    if(client.status&WORK) snprintf(string,MAX_CONTENT,
+                                    "channel %d: client is busy",
+                                    client.channel);
+    else snprintf(string,MAX_CONTENT,"channel %d: client is idle",
+                                     client.status);
+    display_new_line(display,input,string);
+  }
 
   display_new_line(display,input,"done");
 
@@ -269,6 +283,28 @@ int send_quit(t_net *net) {
   return 1;
 }
 
+int display_help(t_display *display,t_input *input) {
+
+  display_new_line(display,input,"h: show this help");
+  display_new_line(display,input,"i: get job/client info");
+  display_new_line(display,input,"a: add a job");
+  display_new_line(display,input,"  b: ballistic amorphization influence");
+  display_new_line(display,input,"  c: carbon induced amorphization influence");
+  display_new_line(display,input,"  s: stress induced amorphization influence");
+  display_new_line(display,input,"  d: diffusion interval");
+  display_new_line(display,input,"  D: diffusion rate");
+  display_new_line(display,input,"  S: simulation teps / dose");
+  display_new_line(display,input,"  C: collisions per ion");
+  display_new_line(display,input,"  r: stress influence range");
+  display_new_line(display,input,"  R: sputter rate");
+  display_new_line(display,input,"  x: save interval");
+  display_new_line(display,input,"  X: # cells in x direction");
+  display_new_line(display,input,"  Y: # cells in Y direction");
+  display_new_line(display,input,"  Z: # cells in Z direction");
+
+  return 1;
+}
+
 int get_command(t_event *event,void *allineed) {
 
   t_net *net;
@@ -286,6 +322,9 @@ int get_command(t_event *event,void *allineed) {
   /* if there was a new line! */
   if(input->c_count==0) {
     switch(input->content[0]) {
+      case GUI_HELP:
+        display_help(display,input);
+        break;
       case GUI_INFO:
         send_and_wait_for_answer(net,display,input);
         break;