run.c

00001 /***************************************************************************
00002                           run.c  -  description
00003                           ---------------------
00004     begin                : 
00005     copyright            : (C) 2003 by Dynacube Team
00006     email                : mdshah82@yahoo.com
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018  #include "common/string.h"
00019  #include "gui/client/client_gui.h"
00020 
00021  int main()
00022  {
00023   volatile MSG msg;
00024   CREATE_INFO cr;
00025   COMP_CREATE_INFO cmp;
00026   RESIZE_INFO rs;
00027   SDD ret_val = -1;
00028   DB i;
00029   volatile char text[4096];
00030 
00031      msg.length = sizeof(cr);
00032      msg.type   = CREATE;
00033      msg.sub_type = WINDOW;
00034      cr.alias_id = 101;
00035      cr.cntr_id = 0;
00036      cr.height = 100;
00037      cr.width = 200;
00038      cr.style  = 0;
00039      cr.x = 5;
00040      cr.y = 465;
00041      strcpy(cr.title,"Run Command");
00042 
00043      memcpy(msg.msg_buf,&cr,sizeof(cr));
00044 
00045      __asm__ __volatile__("pushl %0"::"r"(&msg));
00046      __asm__ __volatile__("pushl %0"::"r"(GUI_PID));
00047      __asm__ __volatile__("int $0x30"::"a"(3));
00048 
00049      msg.sub_type = LABEL;
00050      cmp.alias_id = 201;
00051      cmp.cntr_id = 101;
00052      cmp.cnt_type = WIND_TYPE;
00053      cmp.height = 20;
00054      cmp.width = 50;
00055      cmp.x = 5;
00056      cmp.y = 10;
00057      cmp.style = 0;
00058      strcpy(cmp.label,"COMMAND");
00059 
00060      memcpy(msg.msg_buf,&cmp,sizeof(cmp));
00061 
00062      asm("pushl %0"::"r"(&msg));
00063      asm("pushl %0"::"r"(GUI_PID));
00064      asm("int $0x30"::"a"(3));
00065 
00066 
00067      msg.sub_type = BUTTON;
00068      cmp.alias_id = 202;
00069      cmp.cntr_id = 101;
00070      cmp.cnt_type = WIND_TYPE;
00071      cmp.height = 20;
00072      cmp.width = 100;
00073      cmp.x = 50;
00074      cmp.y = 40;
00075      cmp.style = 0;
00076      strcpy(cmp.label,"RUN COMMAND");
00077 
00078      memcpy(msg.msg_buf,&cmp,sizeof(cmp));
00079 
00080      __asm__ __volatile__("pushl %0"::"r"(&msg));
00081      __asm__ __volatile__("pushl %0"::"r"(GUI_PID));
00082      __asm__ __volatile__("int $0x30"::"a"(3));
00083 
00084      msg.sub_type = TEXT;
00085      cmp.alias_id = 203;
00086      cmp.cntr_id = 101;
00087      cmp.cnt_type = WIND_TYPE;
00088      cmp.height = 20;
00089      cmp.width = 110;
00090      cmp.x = 70;
00091      cmp.y = 10;
00092      strcpy(cmp.label,"");
00093 
00094      memcpy(msg.msg_buf,&cmp,sizeof(cmp));
00095 
00096      __asm__ __volatile__("pushl %0"::"r"(&msg));
00097      __asm__ __volatile__("pushl %0"::"r"(GUI_PID));
00098      __asm__ __volatile__("int $0x30"::"a"(3));
00099 
00100 
00101      msg.type     = SHOW;
00102      msg.sub_type = WINDOW;
00103      msg.length   = sizeof(DW);
00104      msg.msg_buf[0] = 101;
00105 
00106      __asm__ __volatile__("pushl %0"::"r"(&msg));
00107      __asm__ __volatile__("pushl %0"::"r"(GUI_PID));
00108      __asm__ __volatile__("int $0x30"::"a"(3));
00109 
00110      __asm__ __volatile__("pushl %eax");
00111      __asm__ __volatile__("popl %0"::"r"(ret_val));
00112 
00113      i = 0;
00114 
00115      while(1)
00116      {
00117        __asm__ __volatile__("pushl %0"::"r"(&msg));
00118        __asm__ __volatile__("int $0x30"::"a"(4));
00119 
00120        switch(msg.type)
00121        {
00122          case WM_CLICKED:
00123 
00124                 switch(msg.sub_type)
00125                 {
00126                  case BUT_TYPE:
00127                                                 msg.type     = GET;
00128                                         msg.sub_type = TEXT;
00129                                         msg.length   = 10;//sizeof(DW) + sizeof(DD);
00130                                         msg.msg_buf[0] = 203;
00131                                                 *(DD*)(msg.msg_buf+2) = text;
00132 
00133 
00134                                                 __asm__ __volatile__("pushl %0"::"r"(&msg));
00135                                         __asm__ __volatile__("pushl %0"::"r"(GUI_PID));
00136                                                 __asm__ __volatile__("int $0x30"::"a"(3));
00137                         
00138                                                 __asm__ __volatile__("pushl %%eax"::"a"(text));
00139                                         __asm__ __volatile__("movl $0x1, %eax");
00140                                         __asm__ __volatile__("int $0x30");
00141 
00142                         msg.type     = FINISHED;
00143                         msg.sub_type = BUT_TYPE;
00144                         msg.length   = sizeof(DD);
00145                                                 msg.msg_buf[0] = 202;
00146 
00147                         __asm__ __volatile__("pushl %0"::"r"(&msg));
00148                         __asm__ __volatile__("pushl %0"::"r"(GUI_PID));
00149                         __asm__ __volatile__("int $0x30"::"a"(3));
00150                         
00151                                 __asm__ __volatile__("int $0x30"::"a"(0));
00152 
00153                       break;
00154                 }
00155                 break;
00156 
00157          case WM_KEYPRESS:
00158                 break;
00159 
00160          case WM_DESTROY:
00161                 break;
00162        }
00163 
00164      }
00165      while(1);
00166 }

Generated on Thu Jul 27 23:52:27 2006 for Dynacube by  doxygen 1.4.7