00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "common/string.h"
00019 #include "gui/client/client_gui.h"
00020
00021 typedef struct
00022 {
00023 char mm,dd;
00024 int yy;
00025 }DATE;
00026
00027 typedef struct
00028 {
00029 int hour,min,sec;
00030 }TIME;
00031
00032 int main()
00033 {
00034 volatile MSG msg;
00035 volatile MSG msg1;
00036 DATE dt;
00037 TIME tm;
00038 CREATE_INFO cr;
00039 COMP_CREATE_INFO cmp;
00040 RESIZE_INFO rs;
00041 SDD ret_val = -1;
00042 DB i;
00043 volatile char text[4096];
00044
00045 msg.length = sizeof(cr) + 1;
00046 msg.type = CREATE;
00047 msg.sub_type = WINDOW;
00048 cr.alias_id = 101;
00049 cr.cntr_id = 0;
00050 cr.height = 125;
00051 cr.width = 210;
00052 cr.style = W_NORESIZE;
00053 cr.x = 500;
00054 cr.y = 330;
00055 strcpy(cr.title,"Time-Date");
00056
00057 memcpy(msg.msg_buf,&cr,sizeof(cr));
00058
00059 __asm__ __volatile__("pushl %0"::"r"(&msg));
00060 __asm__ __volatile__("pushl %0"::"r"(GUI_PID));
00061 __asm__ __volatile__("int $0x30"::"a"(3));
00062
00063 msg.type = CREATE;
00064 msg.sub_type = DIALOG;
00065 msg.length = sizeof(cr);
00066 cr.alias_id = 102;
00067 cr.cntr_id = 101;
00068 cr.height = 80;
00069 cr.width = 180;
00070 cr.style = 0;
00071 cr.x = 515;
00072 cr.y = 350;
00073 strcpy(cr.title,"Error");
00074
00075 memcpy(msg.msg_buf,&cr,sizeof(cr));
00076
00077 asm("pushl %0"::"r"(&msg));
00078 asm("pushl %0"::"r"(GUI_PID));
00079 asm("int $0x30"::"a"(3));
00080
00081 msg.length = sizeof(cmp) + 1;
00082 msg.sub_type = LABEL;
00083 cmp.alias_id = 301;
00084 cmp.cntr_id = 102;
00085 cmp.cnt_type = WIND_TYPE;
00086 cmp.height = 10;
00087 cmp.width = 70;
00088 cmp.x = 2;
00089 cmp.y = 10;
00090 cmp.style = 0;
00091 strcpy(cmp.label,"Error in values entered.");
00092
00093 memcpy(msg.msg_buf,&cmp,sizeof(cmp));
00094
00095 asm("pushl %0"::"r"(&msg));
00096 asm("pushl %0"::"r"(GUI_PID));
00097 asm("int $0x30"::"a"(3));
00098
00099 msg.sub_type = BUTTON;
00100 cmp.alias_id = 302;
00101 cmp.cntr_id = 102;
00102 cmp.cnt_type = WIND_TYPE;
00103 cmp.height = 20;
00104 cmp.width = 20;
00105 cmp.x = 60;
00106 cmp.y = 30;
00107 cmp.style = 0;
00108 strcpy(cmp.label,"OK");
00109
00110 memcpy(msg.msg_buf,&cmp,sizeof(cmp));
00111
00112 __asm__ __volatile__("pushl %0"::"r"(&msg));
00113 __asm__ __volatile__("pushl %0"::"r"(GUI_PID));
00114 __asm__ __volatile__("int $0x30"::"a"(3));
00115
00116
00117
00118 msg.length = sizeof(cmp) + 1;
00119 msg.sub_type = LABEL;
00120 cmp.alias_id = 201;
00121 cmp.cntr_id = 101;
00122 cmp.cnt_type = WIND_TYPE;
00123 cmp.height = 20;
00124 cmp.width = 10;
00125 cmp.x = 5;
00126 cmp.y = 10;
00127 cmp.style = 0;
00128 strcpy(cmp.label,"DATE(dd/mm/yy)");
00129
00130 memcpy(msg.msg_buf,&cmp,sizeof(cmp));
00131
00132 asm("pushl %0"::"r"(&msg));
00133 asm("pushl %0"::"r"(GUI_PID));
00134 asm("int $0x30"::"a"(3));
00135
00136 msg.sub_type = LABEL;
00137 cmp.alias_id = 202;
00138 cmp.cntr_id = 101;
00139 cmp.cnt_type = WIND_TYPE;
00140 cmp.height = 20;
00141 cmp.width = 10;
00142 cmp.x = 5;
00143 cmp.y = 40;
00144 cmp.style = 0;
00145 strcpy(cmp.label,"TIME(hh/mm/ss)");
00146
00147 memcpy(msg.msg_buf,&cmp,sizeof(cmp));
00148
00149 asm("pushl %0"::"r"(&msg));
00150 asm("pushl %0"::"r"(GUI_PID));
00151 asm("int $0x30"::"a"(3));
00152
00153
00154 msg.sub_type = BUTTON;
00155 cmp.alias_id = 203;
00156 cmp.cntr_id = 101;
00157 cmp.cnt_type = WIND_TYPE;
00158 cmp.height = 20;
00159 cmp.width = 120;
00160 cmp.x = 40;
00161 cmp.y = 70;
00162 cmp.style = 0;
00163 strcpy(cmp.label,"SET TIME-DATE");
00164
00165 memcpy(msg.msg_buf,&cmp,sizeof(cmp));
00166
00167 __asm__ __volatile__("pushl %0"::"r"(&msg));
00168 __asm__ __volatile__("pushl %0"::"r"(GUI_PID));
00169 __asm__ __volatile__("int $0x30"::"a"(3));
00170
00171 msg.sub_type = TEXT;
00172 cmp.alias_id = 204;
00173 cmp.cntr_id = 101;
00174 cmp.cnt_type = WIND_TYPE;
00175 cmp.height = 15;
00176 cmp.width = 25;
00177 cmp.x = 110;
00178 cmp.y = 10;
00179 strcpy(cmp.label,"");
00180
00181 memcpy(msg.msg_buf,&cmp,sizeof(cmp));
00182
00183 __asm__ __volatile__("pushl %0"::"r"(&msg));
00184 __asm__ __volatile__("pushl %0"::"r"(GUI_PID));
00185 __asm__ __volatile__("int $0x30"::"a"(3));
00186
00187 msg.sub_type = TEXT;
00188 cmp.alias_id = 205;
00189 cmp.cntr_id = 101;
00190 cmp.cnt_type = WIND_TYPE;
00191 cmp.height = 15;
00192 cmp.width = 25;
00193 cmp.x = 140;
00194 cmp.y = 10;
00195 strcpy(cmp.label,"");
00196
00197 memcpy(msg.msg_buf,&cmp,sizeof(cmp));
00198
00199 __asm__ __volatile__("pushl %0"::"r"(&msg));
00200 __asm__ __volatile__("pushl %0"::"r"(GUI_PID));
00201 __asm__ __volatile__("int $0x30"::"a"(3));
00202
00203 msg.sub_type = TEXT;
00204 cmp.alias_id = 206;
00205 cmp.cntr_id = 101;
00206 cmp.cnt_type = WIND_TYPE;
00207 cmp.height = 15;
00208 cmp.width = 25;
00209 cmp.x = 170;
00210 cmp.y = 10;
00211 strcpy(cmp.label,"");
00212
00213 memcpy(msg.msg_buf,&cmp,sizeof(cmp));
00214
00215 __asm__ __volatile__("pushl %0"::"r"(&msg));
00216 __asm__ __volatile__("pushl %0"::"r"(GUI_PID));
00217 __asm__ __volatile__("int $0x30"::"a"(3));
00218
00219 msg.sub_type = TEXT;
00220 cmp.alias_id = 207;
00221 cmp.cntr_id = 101;
00222 cmp.cnt_type = WIND_TYPE;
00223 cmp.height = 15;
00224 cmp.width = 25;
00225 cmp.x = 110;
00226 cmp.y = 40;
00227 strcpy(cmp.label,"");
00228
00229 memcpy(msg.msg_buf,&cmp,sizeof(cmp));
00230
00231 __asm__ __volatile__("pushl %0"::"r"(&msg));
00232 __asm__ __volatile__("pushl %0"::"r"(GUI_PID));
00233 __asm__ __volatile__("int $0x30"::"a"(3));
00234
00235 msg.sub_type = TEXT;
00236 cmp.alias_id = 208;
00237 cmp.cntr_id = 101;
00238 cmp.cnt_type = WIND_TYPE;
00239 cmp.height = 15;
00240 cmp.width = 25;
00241 cmp.x = 140;
00242 cmp.y = 40;
00243 strcpy(cmp.label,"");
00244
00245 memcpy(msg.msg_buf,&cmp,sizeof(cmp));
00246
00247 __asm__ __volatile__("pushl %0"::"r"(&msg));
00248 __asm__ __volatile__("pushl %0"::"r"(GUI_PID));
00249 __asm__ __volatile__("int $0x30"::"a"(3));
00250
00251 msg.sub_type = TEXT;
00252 cmp.alias_id = 209;
00253 cmp.cntr_id = 101;
00254 cmp.cnt_type = WIND_TYPE;
00255 cmp.height = 15;
00256 cmp.width = 25;
00257 cmp.x = 170;
00258 cmp.y = 40;
00259 strcpy(cmp.label,"");
00260
00261 memcpy(msg.msg_buf,&cmp,sizeof(cmp));
00262
00263 __asm__ __volatile__("pushl %0"::"r"(&msg));
00264 __asm__ __volatile__("pushl %0"::"r"(GUI_PID));
00265 __asm__ __volatile__("int $0x30"::"a"(3));
00266
00267 msg.type = SHOW;
00268 msg.sub_type = WINDOW;
00269 msg.length = sizeof(DW);
00270 msg.msg_buf[0] = 101;
00271
00272 __asm__ __volatile__("pushl %0"::"r"(&msg));
00273 __asm__ __volatile__("pushl %0"::"r"(GUI_PID));
00274 __asm__ __volatile__("int $0x30"::"a"(3));
00275
00276 __asm__ __volatile__("pushl %eax");
00277 __asm__ __volatile__("popl %0"::"r"(ret_val));
00278
00279 i = 0;
00280
00281 while(1)
00282 {
00283 recv(&msg1);
00284
00285 switch(msg1.type)
00286 {
00287 case WM_CLICKED:
00288
00289 switch(msg1.sub_type)
00290 {
00291 case BUT_TYPE:
00292
00293 switch(*(DW*)msg1.msg_buf)
00294 {
00295 case 203:
00296 msg.type = FINISHED;
00297 msg.sub_type = BUT_TYPE;
00298 msg.length = sizeof(DD);
00299 msg.msg_buf[0] = 203;
00300
00301 __asm__ __volatile__("pushl %0"::"r"(&msg));
00302 __asm__ __volatile__("pushl %0"::"r"(GUI_PID));
00303 __asm__ __volatile__("int $0x30"::"a"(3));
00304
00305 msg.type = GET;
00306 msg.sub_type = TEXT;
00307 msg.length = 10;
00308 msg.msg_buf[0] = 204;
00309 *(DD*)(msg.msg_buf+2) = text;
00310
00311
00312 __asm__ __volatile__("pushl %0"::"r"(&msg));
00313 __asm__ __volatile__("pushl %0"::"r"(GUI_PID));
00314 __asm__ __volatile__("int $0x30"::"a"(3));
00315
00316 dt.dd = atoi(text);
00317
00318 msg.type = GET;
00319 msg.sub_type = TEXT;
00320 msg.length = 10;
00321 msg.msg_buf[0] = 205;
00322 *(DD*)(msg.msg_buf+2) = text;
00323
00324
00325 __asm__ __volatile__("pushl %0"::"r"(&msg));
00326 __asm__ __volatile__("pushl %0"::"r"(GUI_PID));
00327 __asm__ __volatile__("int $0x30"::"a"(3));
00328
00329 dt.mm = atoi(text);
00330
00331 msg.type = GET;
00332 msg.sub_type = TEXT;
00333 msg.length = 10;
00334 msg.msg_buf[0] = 206;
00335 *(DD*)(msg.msg_buf+2) = text;
00336
00337
00338 __asm__ __volatile__("pushl %0"::"r"(&msg));
00339 __asm__ __volatile__("pushl %0"::"r"(GUI_PID));
00340 __asm__ __volatile__("int $0x30"::"a"(3));
00341
00342 dt.yy = atoi(text);
00343
00344 msg.type = GET;
00345 msg.sub_type = TEXT;
00346 msg.length = 10;
00347 msg.msg_buf[0] = 207;
00348 *(DD*)(msg.msg_buf+2) = text;
00349
00350
00351 __asm__ __volatile__("pushl %0"::"r"(&msg));
00352 __asm__ __volatile__("pushl %0"::"r"(GUI_PID));
00353 __asm__ __volatile__("int $0x30"::"a"(3));
00354
00355 tm.hour = atoi(text);
00356
00357 msg.type = GET;
00358 msg.sub_type = TEXT;
00359 msg.length = 10;
00360 msg.msg_buf[0] = 208;
00361 *(DD*)(msg.msg_buf+2) = text;
00362
00363
00364 __asm__ __volatile__("pushl %0"::"r"(&msg));
00365 __asm__ __volatile__("pushl %0"::"r"(GUI_PID));
00366 __asm__ __volatile__("int $0x30"::"a"(3));
00367
00368 tm.min = atoi(text);
00369
00370 msg.type = GET;
00371 msg.sub_type = TEXT;
00372 msg.length = 10;
00373 msg.msg_buf[0] = 209;
00374 *(DD*)(msg.msg_buf+2) = text;
00375
00376 __asm__ __volatile__("pushl %0"::"r"(&msg));
00377 __asm__ __volatile__("pushl %0"::"r"(GUI_PID));
00378 __asm__ __volatile__("int $0x30"::"a"(3));
00379
00380 tm.sec = atoi(text);
00381
00382 if(dt.dd > 0 && dt.dd < 32 && dt.mm > 0 && dt.mm < 13 && dt.yy > 0 && dt.yy < 100 && tm.hour > 0 && tm.hour < 25 && tm.min > 0 && tm.min < 61 && tm.sec > 0 && tm.sec < 61)
00383 {
00384 __asm__ __volatile__("pushl %%eax"::"a"(&dt));
00385 __asm__ __volatile__("int $0x30"::"a"(31));
00386
00387 __asm__ __volatile__("pushl %%eax"::"a"(&tm));
00388 __asm__ __volatile__("int $0x30"::"a"(33));
00389 __asm__ __volatile__("int $0x30"::"a"(0));
00390 }
00391 else
00392 {
00393 msg.type = SHOW;
00394 msg.sub_type = DIALOG;
00395 msg.length = sizeof(DW);
00396 msg.msg_buf[0] = 102;
00397
00398 asm("pushl %0"::"r"(&msg));
00399 asm("pushl %0"::"r"(GUI_PID));
00400 asm("int $0x30"::"a"(3));
00401 }
00402
00403 break;
00404
00405 case 302 :
00406 msg.type = FINISHED;
00407 msg.sub_type = BUT_TYPE;
00408 msg.length = sizeof(DD);
00409 *(DW*)msg.msg_buf = 302;
00410
00411 __asm__ __volatile__("pushl %0"::"r"(&msg));
00412 __asm__ __volatile__("pushl %0"::"r"(GUI_PID));
00413 __asm__ __volatile__("int $0x30"::"a"(3));
00414
00415 msg.type = HIDE;
00416 msg.sub_type = DIALOG;
00417 msg.length = sizeof(DD);
00418 *(DW*)msg.msg_buf = 102;
00419
00420 asm("pushl %0"::"r"(&msg));
00421 asm("pushl %0"::"r"(GUI_PID));
00422 asm("int $0x30"::"a"(3));
00423
00424 break;
00425 }
00426 break;
00427 }
00428 break;
00429
00430 case WM_KEYPRESS:
00431 break;
00432
00433 case WM_DESTROY:
00434 __asm__ __volatile__("int $0x30"::"a"(0));
00435 break;
00436 }
00437
00438 }
00439 while(1);
00440 }
00441
00442 void recv(MSG *msg)
00443 {
00444 __asm__ __volatile__("pushl %0"::"r"(msg));
00445 __asm__ __volatile__("int $0x30"::"a"(4));
00446 }