4 * author: frank zirkelbach (frank.zirkelbach@physik.uni-augsburg.de)
6 * this program tries helping to understand the amorphous depuration
7 * and recrystallization of SiCx while ion implantation at temperatures
8 * below 400 degree celsius.
9 * hopefully the program will simulate the stabilization of the
10 * selforganizing lamella structure in the observed behaviour.
13 * - J. K. N. Lindner. Habil.Schrift, Universitaet Augsburg.
14 * - Maik Haeberlen. Diplomarbeit, Universitaet Augsburg.
16 * Copyright (C) 2004 Frank Zirkelbach
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation; either version 2 of the License, or
21 * (at your option) any later version.
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
38 #include <sys/types.h>
51 #include "nlsop_general.h"
53 #define LOGFILE "~/.nlsop_logfile"
58 printf("%s -i <ip> -p <port> -l <logfile>\n",prog);
63 * gui internal functions
66 int display_new_line(t_display *display,char *text) {
71 int send_and_wait_for_answer(t_net *net,t_display *display) {
76 int send_job(t_net *net,t_input *input,t_display *display) {
81 int get_command(t_event *event,void *allineed) {
87 unsigned char data[64];
89 net=(t_net *)allineed;
90 display=(t_display *)(allineed+sizeof(t_net));
91 input=(t_input *)(allineed+sizeof(t_net)+sizeof(t_display));
93 switch(input->content[0]) {
95 send_and_wait_for_answer(net,display);
98 send_job(net,input,display)
101 /* stop everything */
102 event_math(0,event,READ,REMOVE);
103 network_shutdown(net);
104 display_shutdown(display);
105 input_shutdown(input);
106 event_shutdown(event);
109 display_new_line(display,"unknown gui command");
120 int main(int argc,char **argv)
140 strcpy(logfile,LOGFILE);
141 strcpy(server_ip,"");
144 /* parse/check argv */
145 for(i=1;i<argc;i++) {
146 if(argv[i][0]=='-') {
152 strncpy(server_ip,argv[++i],16);
155 port=atoi(argv[++i]);
158 strncpy(logfile,argv[++i],64);
166 if(!strcmp(server_ip,"")) {
171 if((fd=open(logfile,O_WRONLY,O_CREAT))<0) {
172 printf("unable to open file %s\n",logfile);
176 allyouneed=malloc(sizeof(t_net)+sizeof(t_display)+sizeof(t_input));
177 memcpy(allyouneed,&net,sizeof(t_net));
178 memcpy(allyouneed+sizeof(t_net),&display,sizeof(t_display));
179 memcpy(allyouneed+sizeof(t_net)+sizeof(t_display),sizeof(t_input));
182 input_init(&input,fd);
183 input.mode=CONTENT_BUFFER|LINE_BUFFERED|INPUT_ECHO;
184 input_ios_init(&input);
187 event_init(&event,fd);
188 event_set_timeout(&event,0,0);
191 display_init(&display,fd);
193 /* user interaction */
194 event_math(0,&event,READ,ADD);
196 /* connect to server */
197 network_init(&net,fd);
198 network_set_connection_info(&net,0,server_ip,port);
199 if(network_connect(&net,0)==N_E_CONNECT) {
200 printf("unable to connect to server, aborting ...\n");
203 network_select(&net,0);
205 /* tell server: i am a client, i may work for you */
207 network_send(net.connection[0].fd,&data,1);
210 event_start(&event,allyouneed,get_command,NULL);