X-Git-Url: https://hackdaworld.org/gitweb/?p=physik%2Fnlsop.git;a=blobdiff_plain;f=nlsop_gui.c;h=e4677915503358528fd6b78e91b0785c2640f121;hp=f2e8c9128568058606f21e4ab50fb4e5ad2f4c64;hb=HEAD;hpb=0fbb254a433dd25b5938be009d0835e2c6b17184 diff --git a/nlsop_gui.c b/nlsop_gui.c index f2e8c91..e467791 100644 --- a/nlsop_gui.c +++ b/nlsop_gui.c @@ -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;icontent,MAX_CONTENT); + ptr=command; - strtok(command," "); - while(strtok(NULL," ")!=NULL) { - switch(command[0]) { + ptr=strtok(command," "); + while((ptr=strtok(NULL," "))!=NULL) { + switch(ptr[0]) { case 'b': - info.b=atof(command+1); + info.b=atof(ptr+1); break; case 'c': - info.c=atof(command+1); + info.c=atof(ptr+1); break; case 's': - info.s=atof(command+1); + info.s=atof(ptr+1); break; case 'd': - info.diff_rate=atoi(command+1); + info.diff_rate=atoi(ptr+1); break; case 'D': - info.dr_ac=atof(command+1); + info.dr_ac=atof(ptr+1); break; case 'S': - info.steps=atoi(command+1); + info.steps=atoi(ptr+1); break; case 'C': - info.cpi=atoi(command+1); + info.cpi=atoi(ptr+1); break; case 'r': - info.range=atoi(command+1); + info.range=atoi(ptr+1); break; case 'R': - info.s_rate=atoi(command+1); + info.s_rate=atoi(ptr+1); break; case 'x': - info.save_rate=atoi(command+1); + info.save_rate=atoi(ptr+1); break; case 'X': - x=atoi(command+1); + x=atoi(ptr+1); break; case 'Y': - y=atoi(command+1); + y=atoi(ptr+1); break; case 'Z': - z=atoi(command+1); + z=atoi(ptr+1); break; default: display_new_line(display,input,"unknown command"); + dprintf(display->outfd,"unknown command %s\n",ptr); break; } } @@ -221,6 +238,12 @@ int send_job(t_net *net,t_input *input,t_display *display) { network_send_chan(net,0,(unsigned char *)&info,sizeof(info)); + display_new_line(display,input,"added new job:"); + snprintf(command,MAX_CONTENT,"b:%f | c:%f | s:%f | d: %d %f | %d", + info.b,info.c,info.s,info.diff_rate,info.dr_ac,info.steps); + display_new_line(display,input,command); + + return 1; } @@ -260,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; @@ -277,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; @@ -333,7 +381,7 @@ int main(int argc,char **argv) /* default values */ strcpy(logfile,LOGFILE); - strcpy(server_ip,""); + strcpy(server_ip,"137.250.82.105"); port=1025; /* parse/check argv */ @@ -405,8 +453,6 @@ int main(int argc,char **argv) /* wait for job */ event_start(&event,allyouneed,get_command,nothing); - dprintf(fd,"hu?\n"); - close(fd); return 1;