Home » Archimedes archive » Acorn User » AU 1997-10 A.adf » Extras » Apple][e/PD/BOB/ARMBOB/!ArmBob/progs/!Exec/main

Apple][e/PD/BOB/ARMBOB/!ArmBob/progs/!Exec/main

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn User » AU 1997-10 A.adf » Extras
Filename: Apple][e/PD/BOB/ARMBOB/!ArmBob/progs/!Exec/main
Read OK:
File size: 1057 bytes
Load address: 0000
Exec address: 0000
File contents
/******************************************************************
 *
 *  !Exec v.2 - an ArmBob wimp program         �  GCW 30/11/94
 *
 *  Run command file with pathname of file dragged onto icon.
 *
 *  See doc.tutorial.4
 *
 ******************************************************************/

main()
{
 @b = @(newstring(500));  // global message buffer

 /* Create vector of responses to the task manager */
 handler = newvector(20);         
 handler[Mouse_Click] = do_Mouse_Click;
 handler[Menu_Selection] = do_Menu_Selection;
 handler[User_Message] = handler[User_Message_Recorded] = do_Message;
 /* All but 4 of handler's components are nil */

 in (mesg_list= newstring(8)) put
     { Message_DataLoad; 0; }        // the messages we want to receive

 /* register task with window manager */
 wimp_init(310,"Exec",mesg_list);

 /* create vector of windows and get their handles */  
 (wind = newvector(1))[0] = "info";
 info = templates("<Exec$Dir>.Templates",wind)[0];

 icon = make_icon();
 menu = make_menu();

 /* global register vector for functions in loops that use swi */
 r = newvector(8);

 /******* the central loop takes place here ********/
 /* &1933 is the reason code mask.
    @b is the message buffer address.
    handler is the vector of message handlers.
    nil is the current value of the "user-parameter" - we
    might want to pass round a parameter to the handlers
    containing extra data that each could decode.  */

 (maskptr = newvector(1))[0] = &1933;
 event_process(maskptr,@b,handler,nil); 
}

do_Mouse_Click(a,user,m)
{
 if ((�(a+12)==-2) &&                   // iconbar
     (�(a+16)==icon))                   // icon
   switch (�(a+8))
    {
      case 2:                           // Menu button
       r[1] = menu;                     // use global r
       r[2] = �(a)-64;
       r[3] = 140;
       swi("Wimp_CreateMenu",r);
       break;
      case 1:                          // Adjust button
      case 4:                          // Select button
       oscli("Filer_run <Exec$Dir>.Exec");  // Exec must be a textfile
       break;
     }  
 return TRUE;  // i.e. continue
}

do_Menu_Selection(a,user,m)
{
 return (�(a)!=1);     
}

do_Message(a,user,m)
{
 switch(�(a+16))
    {
     case Message_Quit:
       return FALSE;  // i.e. do not continue
       break;
     case Message_DataLoad:  
        if (�(a+20)==-2 && �(a+24)==icon)
           act(a,user_process);
        return TRUE;
        break;
     default:
        return TRUE;
        break;
    }
}
 
make_icon()
{
 local r;
 in @b put 
 {
  -1;                       // right of icon bar
   0;                       // xmin of bounding box
   0;                       // ymin of bounding box
   64;                      // xmax of bounding box
   68;                      // ymax of bounding box
   &1700210a;               // icon flags
   @(sprite = "!exec");     // pointer to sprite name
   1;                       // Wimp sprite area
   8;                       // Length of spritename
 }
 (r = newvector(8))[1] = @b;
 swi("Wimp_CreateIcon",r);
 return(r[0]);
}

make_menu()
{
 in (menu = newstring(72)) put
 {
  "Exec"; 0; 0;                           // Menu title
   &70207;                                // colours
   100;                                   // width
   44;                                    // height 
   0;                                     // gap
   0;
   info;                                  // submenu
   1+(1<<4)+(9<<12)+(1<<16)+(7<<24);      // flags
   "Info"; 0; 0;                          // item title
   &80;                                   // last item
   -1;                                    // no submenu
   1+(1<<4)+(9<<12)+(1<<16)+(7<<24);      // flags
   "Quit"; 0;                             // item title
 }
 return(menu);
}

act(a,f)
{
 local filename, filetype;
 filename = $(a+44);
 filetype = �(a+40);
 ��(a+16,Message_DataLoadAck);
 ��(a+12,�(a+8));
 r[0] = User_Message_Acknowledge;
 r[1] = a;
 r[2] = 0;
 swi("Wimp_SendMessage",r);
 f(filename,filetype);
}

// ------- end of harness, do your own stuff here -------- //

user_process(fname,ftype)
{
 oscli("WimpTask Obey -c <Exec$Dir>.Exec "+fname); 
}
00000000  2f 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |/***************|
00000010  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00000040  2a 2a 2a 0a 20 2a 0a 20  2a 20 20 21 45 78 65 63  |***. *. *  !Exec|
00000050  20 76 2e 32 20 2d 20 61  6e 20 41 72 6d 42 6f 62  | v.2 - an ArmBob|
00000060  20 77 69 6d 70 20 70 72  6f 67 72 61 6d 20 20 20  | wimp program   |
00000070  20 20 20 20 20 20 a9 20  20 47 43 57 20 33 30 2f  |      .  GCW 30/|
00000080  31 31 2f 39 34 0a 20 2a  0a 20 2a 20 20 52 75 6e  |11/94. *. *  Run|
00000090  20 63 6f 6d 6d 61 6e 64  20 66 69 6c 65 20 77 69  | command file wi|
000000a0  74 68 20 70 61 74 68 6e  61 6d 65 20 6f 66 20 66  |th pathname of f|
000000b0  69 6c 65 20 64 72 61 67  67 65 64 20 6f 6e 74 6f  |ile dragged onto|
000000c0  20 69 63 6f 6e 2e 0a 20  2a 0a 20 2a 20 20 53 65  | icon.. *. *  Se|
000000d0  65 20 64 6f 63 2e 74 75  74 6f 72 69 61 6c 2e 34  |e doc.tutorial.4|
000000e0  0a 20 2a 0a 20 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |. *. ***********|
000000f0  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00000120  2a 2a 2a 2a 2a 2a 2a 2f  0a 0a 6d 61 69 6e 28 29  |*******/..main()|
00000130  0a 7b 0a 20 40 62 20 3d  20 40 28 6e 65 77 73 74  |.{. @b = @(newst|
00000140  72 69 6e 67 28 35 30 30  29 29 3b 20 20 2f 2f 20  |ring(500));  // |
00000150  67 6c 6f 62 61 6c 20 6d  65 73 73 61 67 65 20 62  |global message b|
00000160  75 66 66 65 72 0a 0a 20  2f 2a 20 43 72 65 61 74  |uffer.. /* Creat|
00000170  65 20 76 65 63 74 6f 72  20 6f 66 20 72 65 73 70  |e vector of resp|
00000180  6f 6e 73 65 73 20 74 6f  20 74 68 65 20 74 61 73  |onses to the tas|
00000190  6b 20 6d 61 6e 61 67 65  72 20 2a 2f 0a 20 68 61  |k manager */. ha|
000001a0  6e 64 6c 65 72 20 3d 20  6e 65 77 76 65 63 74 6f  |ndler = newvecto|
000001b0  72 28 32 30 29 3b 20 20  20 20 20 20 20 20 20 0a  |r(20);         .|
000001c0  20 68 61 6e 64 6c 65 72  5b 4d 6f 75 73 65 5f 43  | handler[Mouse_C|
000001d0  6c 69 63 6b 5d 20 3d 20  64 6f 5f 4d 6f 75 73 65  |lick] = do_Mouse|
000001e0  5f 43 6c 69 63 6b 3b 0a  20 68 61 6e 64 6c 65 72  |_Click;. handler|
000001f0  5b 4d 65 6e 75 5f 53 65  6c 65 63 74 69 6f 6e 5d  |[Menu_Selection]|
00000200  20 3d 20 64 6f 5f 4d 65  6e 75 5f 53 65 6c 65 63  | = do_Menu_Selec|
00000210  74 69 6f 6e 3b 0a 20 68  61 6e 64 6c 65 72 5b 55  |tion;. handler[U|
00000220  73 65 72 5f 4d 65 73 73  61 67 65 5d 20 3d 20 68  |ser_Message] = h|
00000230  61 6e 64 6c 65 72 5b 55  73 65 72 5f 4d 65 73 73  |andler[User_Mess|
00000240  61 67 65 5f 52 65 63 6f  72 64 65 64 5d 20 3d 20  |age_Recorded] = |
00000250  64 6f 5f 4d 65 73 73 61  67 65 3b 0a 20 2f 2a 20  |do_Message;. /* |
00000260  41 6c 6c 20 62 75 74 20  34 20 6f 66 20 68 61 6e  |All but 4 of han|
00000270  64 6c 65 72 27 73 20 63  6f 6d 70 6f 6e 65 6e 74  |dler's component|
00000280  73 20 61 72 65 20 6e 69  6c 20 2a 2f 0a 0a 20 69  |s are nil */.. i|
00000290  6e 20 28 6d 65 73 67 5f  6c 69 73 74 3d 20 6e 65  |n (mesg_list= ne|
000002a0  77 73 74 72 69 6e 67 28  38 29 29 20 70 75 74 0a  |wstring(8)) put.|
000002b0  20 20 20 20 20 7b 20 4d  65 73 73 61 67 65 5f 44  |     { Message_D|
000002c0  61 74 61 4c 6f 61 64 3b  20 30 3b 20 7d 20 20 20  |ataLoad; 0; }   |
000002d0  20 20 20 20 20 2f 2f 20  74 68 65 20 6d 65 73 73  |     // the mess|
000002e0  61 67 65 73 20 77 65 20  77 61 6e 74 20 74 6f 20  |ages we want to |
000002f0  72 65 63 65 69 76 65 0a  0a 20 2f 2a 20 72 65 67  |receive.. /* reg|
00000300  69 73 74 65 72 20 74 61  73 6b 20 77 69 74 68 20  |ister task with |
00000310  77 69 6e 64 6f 77 20 6d  61 6e 61 67 65 72 20 2a  |window manager *|
00000320  2f 0a 20 77 69 6d 70 5f  69 6e 69 74 28 33 31 30  |/. wimp_init(310|
00000330  2c 22 45 78 65 63 22 2c  6d 65 73 67 5f 6c 69 73  |,"Exec",mesg_lis|
00000340  74 29 3b 0a 0a 20 2f 2a  20 63 72 65 61 74 65 20  |t);.. /* create |
00000350  76 65 63 74 6f 72 20 6f  66 20 77 69 6e 64 6f 77  |vector of window|
00000360  73 20 61 6e 64 20 67 65  74 20 74 68 65 69 72 20  |s and get their |
00000370  68 61 6e 64 6c 65 73 20  2a 2f 20 20 0a 20 28 77  |handles */  . (w|
00000380  69 6e 64 20 3d 20 6e 65  77 76 65 63 74 6f 72 28  |ind = newvector(|
00000390  31 29 29 5b 30 5d 20 3d  20 22 69 6e 66 6f 22 3b  |1))[0] = "info";|
000003a0  0a 20 69 6e 66 6f 20 3d  20 74 65 6d 70 6c 61 74  |. info = templat|
000003b0  65 73 28 22 3c 45 78 65  63 24 44 69 72 3e 2e 54  |es("<Exec$Dir>.T|
000003c0  65 6d 70 6c 61 74 65 73  22 2c 77 69 6e 64 29 5b  |emplates",wind)[|
000003d0  30 5d 3b 0a 0a 20 69 63  6f 6e 20 3d 20 6d 61 6b  |0];.. icon = mak|
000003e0  65 5f 69 63 6f 6e 28 29  3b 0a 20 6d 65 6e 75 20  |e_icon();. menu |
000003f0  3d 20 6d 61 6b 65 5f 6d  65 6e 75 28 29 3b 0a 0a  |= make_menu();..|
00000400  20 2f 2a 20 67 6c 6f 62  61 6c 20 72 65 67 69 73  | /* global regis|
00000410  74 65 72 20 76 65 63 74  6f 72 20 66 6f 72 20 66  |ter vector for f|
00000420  75 6e 63 74 69 6f 6e 73  20 69 6e 20 6c 6f 6f 70  |unctions in loop|
00000430  73 20 74 68 61 74 20 75  73 65 20 73 77 69 20 2a  |s that use swi *|
00000440  2f 0a 20 72 20 3d 20 6e  65 77 76 65 63 74 6f 72  |/. r = newvector|
00000450  28 38 29 3b 0a 0a 20 2f  2a 2a 2a 2a 2a 2a 2a 20  |(8);.. /******* |
00000460  74 68 65 20 63 65 6e 74  72 61 6c 20 6c 6f 6f 70  |the central loop|
00000470  20 74 61 6b 65 73 20 70  6c 61 63 65 20 68 65 72  | takes place her|
00000480  65 20 2a 2a 2a 2a 2a 2a  2a 2a 2f 0a 20 2f 2a 20  |e ********/. /* |
00000490  26 31 39 33 33 20 69 73  20 74 68 65 20 72 65 61  |&1933 is the rea|
000004a0  73 6f 6e 20 63 6f 64 65  20 6d 61 73 6b 2e 0a 20  |son code mask.. |
000004b0  20 20 20 40 62 20 69 73  20 74 68 65 20 6d 65 73  |   @b is the mes|
000004c0  73 61 67 65 20 62 75 66  66 65 72 20 61 64 64 72  |sage buffer addr|
000004d0  65 73 73 2e 0a 20 20 20  20 68 61 6e 64 6c 65 72  |ess..    handler|
000004e0  20 69 73 20 74 68 65 20  76 65 63 74 6f 72 20 6f  | is the vector o|
000004f0  66 20 6d 65 73 73 61 67  65 20 68 61 6e 64 6c 65  |f message handle|
00000500  72 73 2e 0a 20 20 20 20  6e 69 6c 20 69 73 20 74  |rs..    nil is t|
00000510  68 65 20 63 75 72 72 65  6e 74 20 76 61 6c 75 65  |he current value|
00000520  20 6f 66 20 74 68 65 20  22 75 73 65 72 2d 70 61  | of the "user-pa|
00000530  72 61 6d 65 74 65 72 22  20 2d 20 77 65 0a 20 20  |rameter" - we.  |
00000540  20 20 6d 69 67 68 74 20  77 61 6e 74 20 74 6f 20  |  might want to |
00000550  70 61 73 73 20 72 6f 75  6e 64 20 61 20 70 61 72  |pass round a par|
00000560  61 6d 65 74 65 72 20 74  6f 20 74 68 65 20 68 61  |ameter to the ha|
00000570  6e 64 6c 65 72 73 0a 20  20 20 20 63 6f 6e 74 61  |ndlers.    conta|
00000580  69 6e 69 6e 67 20 65 78  74 72 61 20 64 61 74 61  |ining extra data|
00000590  20 74 68 61 74 20 65 61  63 68 20 63 6f 75 6c 64  | that each could|
000005a0  20 64 65 63 6f 64 65 2e  20 20 2a 2f 0a 0a 20 28  | decode.  */.. (|
000005b0  6d 61 73 6b 70 74 72 20  3d 20 6e 65 77 76 65 63  |maskptr = newvec|
000005c0  74 6f 72 28 31 29 29 5b  30 5d 20 3d 20 26 31 39  |tor(1))[0] = &19|
000005d0  33 33 3b 0a 20 65 76 65  6e 74 5f 70 72 6f 63 65  |33;. event_proce|
000005e0  73 73 28 6d 61 73 6b 70  74 72 2c 40 62 2c 68 61  |ss(maskptr,@b,ha|
000005f0  6e 64 6c 65 72 2c 6e 69  6c 29 3b 20 0a 7d 0a 0a  |ndler,nil); .}..|
00000600  64 6f 5f 4d 6f 75 73 65  5f 43 6c 69 63 6b 28 61  |do_Mouse_Click(a|
00000610  2c 75 73 65 72 2c 6d 29  0a 7b 0a 20 69 66 20 28  |,user,m).{. if (|
00000620  28 a3 28 61 2b 31 32 29  3d 3d 2d 32 29 20 26 26  |(.(a+12)==-2) &&|
00000630  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000640  20 20 20 2f 2f 20 69 63  6f 6e 62 61 72 0a 20 20  |   // iconbar.  |
00000650  20 20 20 28 a3 28 61 2b  31 36 29 3d 3d 69 63 6f  |   (.(a+16)==ico|
00000660  6e 29 29 20 20 20 20 20  20 20 20 20 20 20 20 20  |n))             |
00000670  20 20 20 20 20 20 2f 2f  20 69 63 6f 6e 0a 20 20  |      // icon.  |
00000680  20 73 77 69 74 63 68 20  28 a3 28 61 2b 38 29 29  | switch (.(a+8))|
00000690  0a 20 20 20 20 7b 0a 20  20 20 20 20 20 63 61 73  |.    {.      cas|
000006a0  65 20 32 3a 20 20 20 20  20 20 20 20 20 20 20 20  |e 2:            |
000006b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 2f  |               /|
000006c0  2f 20 4d 65 6e 75 20 62  75 74 74 6f 6e 0a 20 20  |/ Menu button.  |
000006d0  20 20 20 20 20 72 5b 31  5d 20 3d 20 6d 65 6e 75  |     r[1] = menu|
000006e0  3b 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |;               |
000006f0  20 20 20 20 20 20 2f 2f  20 75 73 65 20 67 6c 6f  |      // use glo|
00000700  62 61 6c 20 72 0a 20 20  20 20 20 20 20 72 5b 32  |bal r.       r[2|
00000710  5d 20 3d 20 a3 28 61 29  2d 36 34 3b 0a 20 20 20  |] = .(a)-64;.   |
00000720  20 20 20 20 72 5b 33 5d  20 3d 20 31 34 30 3b 0a  |    r[3] = 140;.|
00000730  20 20 20 20 20 20 20 73  77 69 28 22 57 69 6d 70  |       swi("Wimp|
00000740  5f 43 72 65 61 74 65 4d  65 6e 75 22 2c 72 29 3b  |_CreateMenu",r);|
00000750  0a 20 20 20 20 20 20 20  62 72 65 61 6b 3b 0a 20  |.       break;. |
00000760  20 20 20 20 20 63 61 73  65 20 31 3a 20 20 20 20  |     case 1:    |
00000770  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000780  20 20 20 20 20 20 2f 2f  20 41 64 6a 75 73 74 20  |      // Adjust |
00000790  62 75 74 74 6f 6e 0a 20  20 20 20 20 20 63 61 73  |button.      cas|
000007a0  65 20 34 3a 20 20 20 20  20 20 20 20 20 20 20 20  |e 4:            |
000007b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 2f 2f  |              //|
000007c0  20 53 65 6c 65 63 74 20  62 75 74 74 6f 6e 0a 20  | Select button. |
000007d0  20 20 20 20 20 20 6f 73  63 6c 69 28 22 46 69 6c  |      oscli("Fil|
000007e0  65 72 5f 72 75 6e 20 3c  45 78 65 63 24 44 69 72  |er_run <Exec$Dir|
000007f0  3e 2e 45 78 65 63 22 29  3b 20 20 2f 2f 20 45 78  |>.Exec");  // Ex|
00000800  65 63 20 6d 75 73 74 20  62 65 20 61 20 74 65 78  |ec must be a tex|
00000810  74 66 69 6c 65 0a 20 20  20 20 20 20 20 62 72 65  |tfile.       bre|
00000820  61 6b 3b 0a 20 20 20 20  20 7d 20 20 0a 20 72 65  |ak;.     }  . re|
00000830  74 75 72 6e 20 54 52 55  45 3b 20 20 2f 2f 20 69  |turn TRUE;  // i|
00000840  2e 65 2e 20 63 6f 6e 74  69 6e 75 65 0a 7d 0a 0a  |.e. continue.}..|
00000850  64 6f 5f 4d 65 6e 75 5f  53 65 6c 65 63 74 69 6f  |do_Menu_Selectio|
00000860  6e 28 61 2c 75 73 65 72  2c 6d 29 0a 7b 0a 20 72  |n(a,user,m).{. r|
00000870  65 74 75 72 6e 20 28 a3  28 61 29 21 3d 31 29 3b  |eturn (.(a)!=1);|
00000880  20 20 20 20 20 0a 7d 0a  0a 64 6f 5f 4d 65 73 73  |     .}..do_Mess|
00000890  61 67 65 28 61 2c 75 73  65 72 2c 6d 29 0a 7b 0a  |age(a,user,m).{.|
000008a0  20 73 77 69 74 63 68 28  a3 28 61 2b 31 36 29 29  | switch(.(a+16))|
000008b0  0a 20 20 20 20 7b 0a 20  20 20 20 20 63 61 73 65  |.    {.     case|
000008c0  20 4d 65 73 73 61 67 65  5f 51 75 69 74 3a 0a 20  | Message_Quit:. |
000008d0  20 20 20 20 20 20 72 65  74 75 72 6e 20 46 41 4c  |      return FAL|
000008e0  53 45 3b 20 20 2f 2f 20  69 2e 65 2e 20 64 6f 20  |SE;  // i.e. do |
000008f0  6e 6f 74 20 63 6f 6e 74  69 6e 75 65 0a 20 20 20  |not continue.   |
00000900  20 20 20 20 62 72 65 61  6b 3b 0a 20 20 20 20 20  |    break;.     |
00000910  63 61 73 65 20 4d 65 73  73 61 67 65 5f 44 61 74  |case Message_Dat|
00000920  61 4c 6f 61 64 3a 20 20  0a 20 20 20 20 20 20 20  |aLoad:  .       |
00000930  20 69 66 20 28 a3 28 61  2b 32 30 29 3d 3d 2d 32  | if (.(a+20)==-2|
00000940  20 26 26 20 a3 28 61 2b  32 34 29 3d 3d 69 63 6f  | && .(a+24)==ico|
00000950  6e 29 0a 20 20 20 20 20  20 20 20 20 20 20 61 63  |n).           ac|
00000960  74 28 61 2c 75 73 65 72  5f 70 72 6f 63 65 73 73  |t(a,user_process|
00000970  29 3b 0a 20 20 20 20 20  20 20 20 72 65 74 75 72  |);.        retur|
00000980  6e 20 54 52 55 45 3b 0a  20 20 20 20 20 20 20 20  |n TRUE;.        |
00000990  62 72 65 61 6b 3b 0a 20  20 20 20 20 64 65 66 61  |break;.     defa|
000009a0  75 6c 74 3a 0a 20 20 20  20 20 20 20 20 72 65 74  |ult:.        ret|
000009b0  75 72 6e 20 54 52 55 45  3b 0a 20 20 20 20 20 20  |urn TRUE;.      |
000009c0  20 20 62 72 65 61 6b 3b  0a 20 20 20 20 7d 0a 7d  |  break;.    }.}|
000009d0  0a 20 0a 6d 61 6b 65 5f  69 63 6f 6e 28 29 0a 7b  |. .make_icon().{|
000009e0  0a 20 6c 6f 63 61 6c 20  72 3b 0a 20 69 6e 20 40  |. local r;. in @|
000009f0  62 20 70 75 74 20 0a 20  7b 0a 20 20 2d 31 3b 20  |b put . {.  -1; |
00000a00  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000a10  20 20 20 20 20 20 2f 2f  20 72 69 67 68 74 20 6f  |      // right o|
00000a20  66 20 69 63 6f 6e 20 62  61 72 0a 20 20 20 30 3b  |f icon bar.   0;|
00000a30  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000a40  20 20 20 20 20 20 20 2f  2f 20 78 6d 69 6e 20 6f  |       // xmin o|
00000a50  66 20 62 6f 75 6e 64 69  6e 67 20 62 6f 78 0a 20  |f bounding box. |
00000a60  20 20 30 3b 20 20 20 20  20 20 20 20 20 20 20 20  |  0;            |
00000a70  20 20 20 20 20 20 20 20  20 20 20 2f 2f 20 79 6d  |           // ym|
00000a80  69 6e 20 6f 66 20 62 6f  75 6e 64 69 6e 67 20 62  |in of bounding b|
00000a90  6f 78 0a 20 20 20 36 34  3b 20 20 20 20 20 20 20  |ox.   64;       |
00000aa0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 2f  |               /|
00000ab0  2f 20 78 6d 61 78 20 6f  66 20 62 6f 75 6e 64 69  |/ xmax of boundi|
00000ac0  6e 67 20 62 6f 78 0a 20  20 20 36 38 3b 20 20 20  |ng box.   68;   |
00000ad0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000ae0  20 20 20 2f 2f 20 79 6d  61 78 20 6f 66 20 62 6f  |   // ymax of bo|
00000af0  75 6e 64 69 6e 67 20 62  6f 78 0a 20 20 20 26 31  |unding box.   &1|
00000b00  37 30 30 32 31 30 61 3b  20 20 20 20 20 20 20 20  |700210a;        |
00000b10  20 20 20 20 20 20 20 2f  2f 20 69 63 6f 6e 20 66  |       // icon f|
00000b20  6c 61 67 73 0a 20 20 20  40 28 73 70 72 69 74 65  |lags.   @(sprite|
00000b30  20 3d 20 22 21 65 78 65  63 22 29 3b 20 20 20 20  | = "!exec");    |
00000b40  20 2f 2f 20 70 6f 69 6e  74 65 72 20 74 6f 20 73  | // pointer to s|
00000b50  70 72 69 74 65 20 6e 61  6d 65 0a 20 20 20 31 3b  |prite name.   1;|
00000b60  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000b70  20 20 20 20 20 20 20 2f  2f 20 57 69 6d 70 20 73  |       // Wimp s|
00000b80  70 72 69 74 65 20 61 72  65 61 0a 20 20 20 38 3b  |prite area.   8;|
00000b90  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000ba0  20 20 20 20 20 20 20 2f  2f 20 4c 65 6e 67 74 68  |       // Length|
00000bb0  20 6f 66 20 73 70 72 69  74 65 6e 61 6d 65 0a 20  | of spritename. |
00000bc0  7d 0a 20 28 72 20 3d 20  6e 65 77 76 65 63 74 6f  |}. (r = newvecto|
00000bd0  72 28 38 29 29 5b 31 5d  20 3d 20 40 62 3b 0a 20  |r(8))[1] = @b;. |
00000be0  73 77 69 28 22 57 69 6d  70 5f 43 72 65 61 74 65  |swi("Wimp_Create|
00000bf0  49 63 6f 6e 22 2c 72 29  3b 0a 20 72 65 74 75 72  |Icon",r);. retur|
00000c00  6e 28 72 5b 30 5d 29 3b  0a 7d 0a 0a 6d 61 6b 65  |n(r[0]);.}..make|
00000c10  5f 6d 65 6e 75 28 29 0a  7b 0a 20 69 6e 20 28 6d  |_menu().{. in (m|
00000c20  65 6e 75 20 3d 20 6e 65  77 73 74 72 69 6e 67 28  |enu = newstring(|
00000c30  37 32 29 29 20 70 75 74  0a 20 7b 0a 20 20 22 45  |72)) put. {.  "E|
00000c40  78 65 63 22 3b 20 30 3b  20 30 3b 20 20 20 20 20  |xec"; 0; 0;     |
00000c50  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000c60  20 20 20 20 20 20 2f 2f  20 4d 65 6e 75 20 74 69  |      // Menu ti|
00000c70  74 6c 65 0a 20 20 20 26  37 30 32 30 37 3b 20 20  |tle.   &70207;  |
00000c80  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000c90  20 20 20 20 20 20 20 20  20 20 20 20 20 20 2f 2f  |              //|
00000ca0  20 63 6f 6c 6f 75 72 73  0a 20 20 20 31 30 30 3b  | colours.   100;|
00000cb0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000cd0  20 20 20 2f 2f 20 77 69  64 74 68 0a 20 20 20 34  |   // width.   4|
00000ce0  34 3b 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |4;              |
00000cf0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000d00  20 20 20 20 20 20 2f 2f  20 68 65 69 67 68 74 20  |      // height |
00000d10  0a 20 20 20 30 3b 20 20  20 20 20 20 20 20 20 20  |.   0;          |
00000d20  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000d30  20 20 20 20 20 20 20 20  20 20 20 2f 2f 20 67 61  |           // ga|
00000d40  70 0a 20 20 20 30 3b 0a  20 20 20 69 6e 66 6f 3b  |p.   0;.   info;|
00000d50  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000d70  20 20 2f 2f 20 73 75 62  6d 65 6e 75 0a 20 20 20  |  // submenu.   |
00000d80  31 2b 28 31 3c 3c 34 29  2b 28 39 3c 3c 31 32 29  |1+(1<<4)+(9<<12)|
00000d90  2b 28 31 3c 3c 31 36 29  2b 28 37 3c 3c 32 34 29  |+(1<<16)+(7<<24)|
00000da0  3b 20 20 20 20 20 20 2f  2f 20 66 6c 61 67 73 0a  |;      // flags.|
00000db0  20 20 20 22 49 6e 66 6f  22 3b 20 30 3b 20 30 3b  |   "Info"; 0; 0;|
00000dc0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000dd0  20 20 20 20 20 20 20 20  20 20 2f 2f 20 69 74 65  |          // ite|
00000de0  6d 20 74 69 74 6c 65 0a  20 20 20 26 38 30 3b 20  |m title.   &80; |
00000df0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000e10  20 20 2f 2f 20 6c 61 73  74 20 69 74 65 6d 0a 20  |  // last item. |
00000e20  20 20 2d 31 3b 20 20 20  20 20 20 20 20 20 20 20  |  -1;           |
00000e30  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000e40  20 20 20 20 20 20 20 20  20 2f 2f 20 6e 6f 20 73  |         // no s|
00000e50  75 62 6d 65 6e 75 0a 20  20 20 31 2b 28 31 3c 3c  |ubmenu.   1+(1<<|
00000e60  34 29 2b 28 39 3c 3c 31  32 29 2b 28 31 3c 3c 31  |4)+(9<<12)+(1<<1|
00000e70  36 29 2b 28 37 3c 3c 32  34 29 3b 20 20 20 20 20  |6)+(7<<24);     |
00000e80  20 2f 2f 20 66 6c 61 67  73 0a 20 20 20 22 51 75  | // flags.   "Qu|
00000e90  69 74 22 3b 20 30 3b 20  20 20 20 20 20 20 20 20  |it"; 0;         |
00000ea0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
00000eb0  20 20 20 20 2f 2f 20 69  74 65 6d 20 74 69 74 6c  |    // item titl|
00000ec0  65 0a 20 7d 0a 20 72 65  74 75 72 6e 28 6d 65 6e  |e. }. return(men|
00000ed0  75 29 3b 0a 7d 0a 0a 61  63 74 28 61 2c 66 29 0a  |u);.}..act(a,f).|
00000ee0  7b 0a 20 6c 6f 63 61 6c  20 66 69 6c 65 6e 61 6d  |{. local filenam|
00000ef0  65 2c 20 66 69 6c 65 74  79 70 65 3b 0a 20 66 69  |e, filetype;. fi|
00000f00  6c 65 6e 61 6d 65 20 3d  20 24 28 61 2b 34 34 29  |lename = $(a+44)|
00000f10  3b 0a 20 66 69 6c 65 74  79 70 65 20 3d 20 a3 28  |;. filetype = .(|
00000f20  61 2b 34 30 29 3b 0a 20  a3 a3 28 61 2b 31 36 2c  |a+40);. ..(a+16,|
00000f30  4d 65 73 73 61 67 65 5f  44 61 74 61 4c 6f 61 64  |Message_DataLoad|
00000f40  41 63 6b 29 3b 0a 20 a3  a3 28 61 2b 31 32 2c a3  |Ack);. ..(a+12,.|
00000f50  28 61 2b 38 29 29 3b 0a  20 72 5b 30 5d 20 3d 20  |(a+8));. r[0] = |
00000f60  55 73 65 72 5f 4d 65 73  73 61 67 65 5f 41 63 6b  |User_Message_Ack|
00000f70  6e 6f 77 6c 65 64 67 65  3b 0a 20 72 5b 31 5d 20  |nowledge;. r[1] |
00000f80  3d 20 61 3b 0a 20 72 5b  32 5d 20 3d 20 30 3b 0a  |= a;. r[2] = 0;.|
00000f90  20 73 77 69 28 22 57 69  6d 70 5f 53 65 6e 64 4d  | swi("Wimp_SendM|
00000fa0  65 73 73 61 67 65 22 2c  72 29 3b 0a 20 66 28 66  |essage",r);. f(f|
00000fb0  69 6c 65 6e 61 6d 65 2c  66 69 6c 65 74 79 70 65  |ilename,filetype|
00000fc0  29 3b 0a 7d 0a 0a 2f 2f  20 2d 2d 2d 2d 2d 2d 2d  |);.}..// -------|
00000fd0  20 65 6e 64 20 6f 66 20  68 61 72 6e 65 73 73 2c  | end of harness,|
00000fe0  20 64 6f 20 79 6f 75 72  20 6f 77 6e 20 73 74 75  | do your own stu|
00000ff0  66 66 20 68 65 72 65 20  2d 2d 2d 2d 2d 2d 2d 2d  |ff here --------|
00001000  20 2f 2f 0a 0a 75 73 65  72 5f 70 72 6f 63 65 73  | //..user_proces|
00001010  73 28 66 6e 61 6d 65 2c  66 74 79 70 65 29 0a 7b  |s(fname,ftype).{|
00001020  0a 20 6f 73 63 6c 69 28  22 57 69 6d 70 54 61 73  |. oscli("WimpTas|
00001030  6b 20 4f 62 65 79 20 2d  63 20 3c 45 78 65 63 24  |k Obey -c <Exec$|
00001040  44 69 72 3e 2e 45 78 65  63 20 22 2b 66 6e 61 6d  |Dir>.Exec "+fnam|
00001050  65 29 3b 20 0a 7d 0a                              |e); .}.|
00001057