Home » Recent acquisitions » Acorn ADFS disks » adfs_AcornComputing_199407.adf » 9407 » 10_10Frnch/TechForum/help_gen/source

10_10Frnch/TechForum/help_gen/source

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 » Recent acquisitions » Acorn ADFS disks » adfs_AcornComputing_199407.adf » 9407
Filename: 10_10Frnch/TechForum/help_gen/source
Read OK:
File size: 1150 bytes
Load address: 0000
Exec address: 0000
File contents
/*
   Copyright Michael Rozdoba, 27/4/94
 */

/*
   Re Acorn's C RISC_OSLib, & support for interactive help on menus:
   The following is a more sophisticated version of help_genmessage, which provides support for
   context sensitive help, based on faded/ticked status of menu items, & allowing inclusion of
   the menu item text itself & of text registered at run-time with this code.
   It also supports generic help text, to cover several menu items, & attempts to permit a flexible
   mix of such help, via intelligently searching through a possible sequence of tags for message
   help texts until it finds the programmer supplied one.
   Lastly, it fixes the old fault of supplying inappropriate help, when over the work area of a submenu
   (eg when over a dotted line item separator) - previously, got help for the parent menu; now get
   custom help or no help, according to available messages.
   See accompanying notes for a description of the process used.
   NB not tested under RISC OS 3.5 - the reading of ticked status & menu text relies on wimp
      representation of menu data within the menu window, & although unlikely to change, this is
      not read via the formal API (application program interface), & cannot be guaranteed reliable
      under future OS.
 */

/*
   help__w & help__i should be assigned values of the requested help window/icon within a modified
   help_process, or prior to calling help_process (if its source code isn't available, in which case
   they may have to be non-static).

   help_register_insert should be called at least when help_register_handler is, & with a value of 0,
   if you have no text to insert.
 */

static          wimp_w help__w = -1;
static          wimp_i help__i = -1;
static           char *help__insert = 0;


static char help__encode(int i)
{
   return (i<10) ? '0'+i : ( (i<36) ? 'a'+(i-10) : 'z' ) ;
}

void help_register_insert(char *insert)
{
  help__insert = insert;
}

BOOL help_genmessage(char *prefix, char *hit)
{
   int prefixlen = strlen(prefix);
   char tag[50];
   char *message;
   int i = prefixlen;
   wimp_icon ic;
   BOOL shaded, ticked;
   char ltag;
   char buf[256], buf2[256], ictxt[32], *repptr, *ptr, *ptr2;

   strcpy(tag, prefix);
   while (hit[i-prefixlen] > 0 && i-prefixlen < 25) {
     tag[i] = help__encode(hit[i-prefixlen] - 1);
     i++;
   }
   if (help__i==-1) {
     tag[i++] = 'N';
     shaded = ticked = FALSE;
   }
   else {
     if (wimpt_complain(wimp_get_icon_info(help__w, help__i, &ic))) return FALSE;
     shaded = ic.flags&wimp_INOSELECT ? TRUE : FALSE;
     if (wimp_get_icon_info(help__w, (help__i/3)*3, &ic)) ticked = FALSE;
     else ticked = ic.flags&(wimp_ITEXT | wimp_ISPRITE) ? TRUE : FALSE;
   }
   tag[i] = 0;

   ltag = tag[i-1];
   if (shaded) {
     tag[i+1] = 0;
     tag[i+0] = ltag;
     tag[i-1] = 'G';
     message  = msgs_lookup(tag);
     if (strcmp(message, tag) != 0) goto send_reply;
     tag[i+0] = 'M';
     message  = msgs_lookup(tag);
     if (strcmp(message, tag) != 0) goto send_reply;
     tag[i-1] = ltag;
     tag[i+0] = 0;
   }
   if (ticked) {
     tag[i+1] = 0;
     tag[i+0] = ltag;
     tag[i-1] = 'T';
     message  = msgs_lookup(tag);
     if (strcmp(message, tag) != 0) goto send_reply;
     tag[i+0] = 'M';
     message  = msgs_lookup(tag);
     if (strcmp(message, tag) != 0) goto send_reply;
     tag[i-1] = ltag;
     tag[i+0] = 0;
   }
   message  = msgs_lookup(tag);
   if (strcmp(message, tag) != 0) goto send_reply;
   tag[i-1] = 'M';
   message  = msgs_lookup(tag);
   if (strcmp(message, tag) != 0) goto send_reply;

   return FALSE;

   send_reply:
   repptr = message;
   if (strstr(repptr, "%s") && help__insert) {
     sprintf(buf, repptr, help__insert);
     repptr = buf;
   }
   ptr  = strstr(repptr, "%q");
   ptr2 = strstr(repptr, "%t");
   if (ptr || ptr2) {
     if (!wimp_get_icon_info(help__w, (help__i/3)*3+1, &ic)) {
       if (ic.flags & wimp_ITEXT) {
         if (ptr2) {
           ptr=ptr2;
           ictxt[0]=0;
         }
         else {
           ictxt[0]='\'';
           ictxt[1]=0;
         }
         strncat(ictxt, (ic.flags & wimp_INDIRECT) ? ic.data.indirecttext.buffer : ic.data.text, 32-3);
         if (!ptr2) strcat(ictxt, "'");
         strcpy(buf2, repptr);
         memcpy(ptr-repptr+buf2, "%s", 2);
         sprintf(buf, buf2, ictxt);
         repptr = buf;
       }
     }
   }
   help_reply(repptr);
   return TRUE;
}
00000000  0a 2f 2a 0a 20 20 20 43  6f 70 79 72 69 67 68 74  |./*.   Copyright|
00000010  20 4d 69 63 68 61 65 6c  20 52 6f 7a 64 6f 62 61  | Michael Rozdoba|
00000020  2c 20 32 37 2f 34 2f 39  34 0a 20 2a 2f 0a 0a 2f  |, 27/4/94. */../|
00000030  2a 0a 20 20 20 52 65 20  41 63 6f 72 6e 27 73 20  |*.   Re Acorn's |
00000040  43 20 52 49 53 43 5f 4f  53 4c 69 62 2c 20 26 20  |C RISC_OSLib, & |
00000050  73 75 70 70 6f 72 74 20  66 6f 72 20 69 6e 74 65  |support for inte|
00000060  72 61 63 74 69 76 65 20  68 65 6c 70 20 6f 6e 20  |ractive help on |
00000070  6d 65 6e 75 73 3a 0a 20  20 20 54 68 65 20 66 6f  |menus:.   The fo|
00000080  6c 6c 6f 77 69 6e 67 20  69 73 20 61 20 6d 6f 72  |llowing is a mor|
00000090  65 20 73 6f 70 68 69 73  74 69 63 61 74 65 64 20  |e sophisticated |
000000a0  76 65 72 73 69 6f 6e 20  6f 66 20 68 65 6c 70 5f  |version of help_|
000000b0  67 65 6e 6d 65 73 73 61  67 65 2c 20 77 68 69 63  |genmessage, whic|
000000c0  68 20 70 72 6f 76 69 64  65 73 20 73 75 70 70 6f  |h provides suppo|
000000d0  72 74 20 66 6f 72 0a 20  20 20 63 6f 6e 74 65 78  |rt for.   contex|
000000e0  74 20 73 65 6e 73 69 74  69 76 65 20 68 65 6c 70  |t sensitive help|
000000f0  2c 20 62 61 73 65 64 20  6f 6e 20 66 61 64 65 64  |, based on faded|
00000100  2f 74 69 63 6b 65 64 20  73 74 61 74 75 73 20 6f  |/ticked status o|
00000110  66 20 6d 65 6e 75 20 69  74 65 6d 73 2c 20 26 20  |f menu items, & |
00000120  61 6c 6c 6f 77 69 6e 67  20 69 6e 63 6c 75 73 69  |allowing inclusi|
00000130  6f 6e 20 6f 66 0a 20 20  20 74 68 65 20 6d 65 6e  |on of.   the men|
00000140  75 20 69 74 65 6d 20 74  65 78 74 20 69 74 73 65  |u item text itse|
00000150  6c 66 20 26 20 6f 66 20  74 65 78 74 20 72 65 67  |lf & of text reg|
00000160  69 73 74 65 72 65 64 20  61 74 20 72 75 6e 2d 74  |istered at run-t|
00000170  69 6d 65 20 77 69 74 68  20 74 68 69 73 20 63 6f  |ime with this co|
00000180  64 65 2e 0a 20 20 20 49  74 20 61 6c 73 6f 20 73  |de..   It also s|
00000190  75 70 70 6f 72 74 73 20  67 65 6e 65 72 69 63 20  |upports generic |
000001a0  68 65 6c 70 20 74 65 78  74 2c 20 74 6f 20 63 6f  |help text, to co|
000001b0  76 65 72 20 73 65 76 65  72 61 6c 20 6d 65 6e 75  |ver several menu|
000001c0  20 69 74 65 6d 73 2c 20  26 20 61 74 74 65 6d 70  | items, & attemp|
000001d0  74 73 20 74 6f 20 70 65  72 6d 69 74 20 61 20 66  |ts to permit a f|
000001e0  6c 65 78 69 62 6c 65 0a  20 20 20 6d 69 78 20 6f  |lexible.   mix o|
000001f0  66 20 73 75 63 68 20 68  65 6c 70 2c 20 76 69 61  |f such help, via|
00000200  20 69 6e 74 65 6c 6c 69  67 65 6e 74 6c 79 20 73  | intelligently s|
00000210  65 61 72 63 68 69 6e 67  20 74 68 72 6f 75 67 68  |earching through|
00000220  20 61 20 70 6f 73 73 69  62 6c 65 20 73 65 71 75  | a possible sequ|
00000230  65 6e 63 65 20 6f 66 20  74 61 67 73 20 66 6f 72  |ence of tags for|
00000240  20 6d 65 73 73 61 67 65  0a 20 20 20 68 65 6c 70  | message.   help|
00000250  20 74 65 78 74 73 20 75  6e 74 69 6c 20 69 74 20  | texts until it |
00000260  66 69 6e 64 73 20 74 68  65 20 70 72 6f 67 72 61  |finds the progra|
00000270  6d 6d 65 72 20 73 75 70  70 6c 69 65 64 20 6f 6e  |mmer supplied on|
00000280  65 2e 0a 20 20 20 4c 61  73 74 6c 79 2c 20 69 74  |e..   Lastly, it|
00000290  20 66 69 78 65 73 20 74  68 65 20 6f 6c 64 20 66  | fixes the old f|
000002a0  61 75 6c 74 20 6f 66 20  73 75 70 70 6c 79 69 6e  |ault of supplyin|
000002b0  67 20 69 6e 61 70 70 72  6f 70 72 69 61 74 65 20  |g inappropriate |
000002c0  68 65 6c 70 2c 20 77 68  65 6e 20 6f 76 65 72 20  |help, when over |
000002d0  74 68 65 20 77 6f 72 6b  20 61 72 65 61 20 6f 66  |the work area of|
000002e0  20 61 20 73 75 62 6d 65  6e 75 0a 20 20 20 28 65  | a submenu.   (e|
000002f0  67 20 77 68 65 6e 20 6f  76 65 72 20 61 20 64 6f  |g when over a do|
00000300  74 74 65 64 20 6c 69 6e  65 20 69 74 65 6d 20 73  |tted line item s|
00000310  65 70 61 72 61 74 6f 72  29 20 2d 20 70 72 65 76  |eparator) - prev|
00000320  69 6f 75 73 6c 79 2c 20  67 6f 74 20 68 65 6c 70  |iously, got help|
00000330  20 66 6f 72 20 74 68 65  20 70 61 72 65 6e 74 20  | for the parent |
00000340  6d 65 6e 75 3b 20 6e 6f  77 20 67 65 74 0a 20 20  |menu; now get.  |
00000350  20 63 75 73 74 6f 6d 20  68 65 6c 70 20 6f 72 20  | custom help or |
00000360  6e 6f 20 68 65 6c 70 2c  20 61 63 63 6f 72 64 69  |no help, accordi|
00000370  6e 67 20 74 6f 20 61 76  61 69 6c 61 62 6c 65 20  |ng to available |
00000380  6d 65 73 73 61 67 65 73  2e 0a 20 20 20 53 65 65  |messages..   See|
00000390  20 61 63 63 6f 6d 70 61  6e 79 69 6e 67 20 6e 6f  | accompanying no|
000003a0  74 65 73 20 66 6f 72 20  61 20 64 65 73 63 72 69  |tes for a descri|
000003b0  70 74 69 6f 6e 20 6f 66  20 74 68 65 20 70 72 6f  |ption of the pro|
000003c0  63 65 73 73 20 75 73 65  64 2e 0a 20 20 20 4e 42  |cess used..   NB|
000003d0  20 6e 6f 74 20 74 65 73  74 65 64 20 75 6e 64 65  | not tested unde|
000003e0  72 20 52 49 53 43 20 4f  53 20 33 2e 35 20 2d 20  |r RISC OS 3.5 - |
000003f0  74 68 65 20 72 65 61 64  69 6e 67 20 6f 66 20 74  |the reading of t|
00000400  69 63 6b 65 64 20 73 74  61 74 75 73 20 26 20 6d  |icked status & m|
00000410  65 6e 75 20 74 65 78 74  20 72 65 6c 69 65 73 20  |enu text relies |
00000420  6f 6e 20 77 69 6d 70 0a  20 20 20 20 20 20 72 65  |on wimp.      re|
00000430  70 72 65 73 65 6e 74 61  74 69 6f 6e 20 6f 66 20  |presentation of |
00000440  6d 65 6e 75 20 64 61 74  61 20 77 69 74 68 69 6e  |menu data within|
00000450  20 74 68 65 20 6d 65 6e  75 20 77 69 6e 64 6f 77  | the menu window|
00000460  2c 20 26 20 61 6c 74 68  6f 75 67 68 20 75 6e 6c  |, & although unl|
00000470  69 6b 65 6c 79 20 74 6f  20 63 68 61 6e 67 65 2c  |ikely to change,|
00000480  20 74 68 69 73 20 69 73  0a 20 20 20 20 20 20 6e  | this is.      n|
00000490  6f 74 20 72 65 61 64 20  76 69 61 20 74 68 65 20  |ot read via the |
000004a0  66 6f 72 6d 61 6c 20 41  50 49 20 28 61 70 70 6c  |formal API (appl|
000004b0  69 63 61 74 69 6f 6e 20  70 72 6f 67 72 61 6d 20  |ication program |
000004c0  69 6e 74 65 72 66 61 63  65 29 2c 20 26 20 63 61  |interface), & ca|
000004d0  6e 6e 6f 74 20 62 65 20  67 75 61 72 61 6e 74 65  |nnot be guarante|
000004e0  65 64 20 72 65 6c 69 61  62 6c 65 0a 20 20 20 20  |ed reliable.    |
000004f0  20 20 75 6e 64 65 72 20  66 75 74 75 72 65 20 4f  |  under future O|
00000500  53 2e 0a 20 2a 2f 0a 0a  2f 2a 0a 20 20 20 68 65  |S.. */../*.   he|
00000510  6c 70 5f 5f 77 20 26 20  68 65 6c 70 5f 5f 69 20  |lp__w & help__i |
00000520  73 68 6f 75 6c 64 20 62  65 20 61 73 73 69 67 6e  |should be assign|
00000530  65 64 20 76 61 6c 75 65  73 20 6f 66 20 74 68 65  |ed values of the|
00000540  20 72 65 71 75 65 73 74  65 64 20 68 65 6c 70 20  | requested help |
00000550  77 69 6e 64 6f 77 2f 69  63 6f 6e 20 77 69 74 68  |window/icon with|
00000560  69 6e 20 61 20 6d 6f 64  69 66 69 65 64 0a 20 20  |in a modified.  |
00000570  20 68 65 6c 70 5f 70 72  6f 63 65 73 73 2c 20 6f  | help_process, o|
00000580  72 20 70 72 69 6f 72 20  74 6f 20 63 61 6c 6c 69  |r prior to calli|
00000590  6e 67 20 68 65 6c 70 5f  70 72 6f 63 65 73 73 20  |ng help_process |
000005a0  28 69 66 20 69 74 73 20  73 6f 75 72 63 65 20 63  |(if its source c|
000005b0  6f 64 65 20 69 73 6e 27  74 20 61 76 61 69 6c 61  |ode isn't availa|
000005c0  62 6c 65 2c 20 69 6e 20  77 68 69 63 68 20 63 61  |ble, in which ca|
000005d0  73 65 0a 20 20 20 74 68  65 79 20 6d 61 79 20 68  |se.   they may h|
000005e0  61 76 65 20 74 6f 20 62  65 20 6e 6f 6e 2d 73 74  |ave to be non-st|
000005f0  61 74 69 63 29 2e 0a 0a  20 20 20 68 65 6c 70 5f  |atic)...   help_|
00000600  72 65 67 69 73 74 65 72  5f 69 6e 73 65 72 74 20  |register_insert |
00000610  73 68 6f 75 6c 64 20 62  65 20 63 61 6c 6c 65 64  |should be called|
00000620  20 61 74 20 6c 65 61 73  74 20 77 68 65 6e 20 68  | at least when h|
00000630  65 6c 70 5f 72 65 67 69  73 74 65 72 5f 68 61 6e  |elp_register_han|
00000640  64 6c 65 72 20 69 73 2c  20 26 20 77 69 74 68 20  |dler is, & with |
00000650  61 20 76 61 6c 75 65 20  6f 66 20 30 2c 0a 20 20  |a value of 0,.  |
00000660  20 69 66 20 79 6f 75 20  68 61 76 65 20 6e 6f 20  | if you have no |
00000670  74 65 78 74 20 74 6f 20  69 6e 73 65 72 74 2e 0a  |text to insert..|
00000680  20 2a 2f 0a 0a 73 74 61  74 69 63 20 20 20 20 20  | */..static     |
00000690  20 20 20 20 20 77 69 6d  70 5f 77 20 68 65 6c 70  |     wimp_w help|
000006a0  5f 5f 77 20 3d 20 2d 31  3b 0a 73 74 61 74 69 63  |__w = -1;.static|
000006b0  20 20 20 20 20 20 20 20  20 20 77 69 6d 70 5f 69  |          wimp_i|
000006c0  20 68 65 6c 70 5f 5f 69  20 3d 20 2d 31 3b 0a 73  | help__i = -1;.s|
000006d0  74 61 74 69 63 20 20 20  20 20 20 20 20 20 20 20  |tatic           |
000006e0  63 68 61 72 20 2a 68 65  6c 70 5f 5f 69 6e 73 65  |char *help__inse|
000006f0  72 74 20 3d 20 30 3b 0a  0a 0a 73 74 61 74 69 63  |rt = 0;...static|
00000700  20 63 68 61 72 20 68 65  6c 70 5f 5f 65 6e 63 6f  | char help__enco|
00000710  64 65 28 69 6e 74 20 69  29 0a 7b 0a 20 20 20 72  |de(int i).{.   r|
00000720  65 74 75 72 6e 20 28 69  3c 31 30 29 20 3f 20 27  |eturn (i<10) ? '|
00000730  30 27 2b 69 20 3a 20 28  20 28 69 3c 33 36 29 20  |0'+i : ( (i<36) |
00000740  3f 20 27 61 27 2b 28 69  2d 31 30 29 20 3a 20 27  |? 'a'+(i-10) : '|
00000750  7a 27 20 29 20 3b 0a 7d  0a 0a 76 6f 69 64 20 68  |z' ) ;.}..void h|
00000760  65 6c 70 5f 72 65 67 69  73 74 65 72 5f 69 6e 73  |elp_register_ins|
00000770  65 72 74 28 63 68 61 72  20 2a 69 6e 73 65 72 74  |ert(char *insert|
00000780  29 0a 7b 0a 20 20 68 65  6c 70 5f 5f 69 6e 73 65  |).{.  help__inse|
00000790  72 74 20 3d 20 69 6e 73  65 72 74 3b 0a 7d 0a 0a  |rt = insert;.}..|
000007a0  42 4f 4f 4c 20 68 65 6c  70 5f 67 65 6e 6d 65 73  |BOOL help_genmes|
000007b0  73 61 67 65 28 63 68 61  72 20 2a 70 72 65 66 69  |sage(char *prefi|
000007c0  78 2c 20 63 68 61 72 20  2a 68 69 74 29 0a 7b 0a  |x, char *hit).{.|
000007d0  20 20 20 69 6e 74 20 70  72 65 66 69 78 6c 65 6e  |   int prefixlen|
000007e0  20 3d 20 73 74 72 6c 65  6e 28 70 72 65 66 69 78  | = strlen(prefix|
000007f0  29 3b 0a 20 20 20 63 68  61 72 20 74 61 67 5b 35  |);.   char tag[5|
00000800  30 5d 3b 0a 20 20 20 63  68 61 72 20 2a 6d 65 73  |0];.   char *mes|
00000810  73 61 67 65 3b 0a 20 20  20 69 6e 74 20 69 20 3d  |sage;.   int i =|
00000820  20 70 72 65 66 69 78 6c  65 6e 3b 0a 20 20 20 77  | prefixlen;.   w|
00000830  69 6d 70 5f 69 63 6f 6e  20 69 63 3b 0a 20 20 20  |imp_icon ic;.   |
00000840  42 4f 4f 4c 20 73 68 61  64 65 64 2c 20 74 69 63  |BOOL shaded, tic|
00000850  6b 65 64 3b 0a 20 20 20  63 68 61 72 20 6c 74 61  |ked;.   char lta|
00000860  67 3b 0a 20 20 20 63 68  61 72 20 62 75 66 5b 32  |g;.   char buf[2|
00000870  35 36 5d 2c 20 62 75 66  32 5b 32 35 36 5d 2c 20  |56], buf2[256], |
00000880  69 63 74 78 74 5b 33 32  5d 2c 20 2a 72 65 70 70  |ictxt[32], *repp|
00000890  74 72 2c 20 2a 70 74 72  2c 20 2a 70 74 72 32 3b  |tr, *ptr, *ptr2;|
000008a0  0a 0a 20 20 20 73 74 72  63 70 79 28 74 61 67 2c  |..   strcpy(tag,|
000008b0  20 70 72 65 66 69 78 29  3b 0a 20 20 20 77 68 69  | prefix);.   whi|
000008c0  6c 65 20 28 68 69 74 5b  69 2d 70 72 65 66 69 78  |le (hit[i-prefix|
000008d0  6c 65 6e 5d 20 3e 20 30  20 26 26 20 69 2d 70 72  |len] > 0 && i-pr|
000008e0  65 66 69 78 6c 65 6e 20  3c 20 32 35 29 20 7b 0a  |efixlen < 25) {.|
000008f0  20 20 20 20 20 74 61 67  5b 69 5d 20 3d 20 68 65  |     tag[i] = he|
00000900  6c 70 5f 5f 65 6e 63 6f  64 65 28 68 69 74 5b 69  |lp__encode(hit[i|
00000910  2d 70 72 65 66 69 78 6c  65 6e 5d 20 2d 20 31 29  |-prefixlen] - 1)|
00000920  3b 0a 20 20 20 20 20 69  2b 2b 3b 0a 20 20 20 7d  |;.     i++;.   }|
00000930  0a 20 20 20 69 66 20 28  68 65 6c 70 5f 5f 69 3d  |.   if (help__i=|
00000940  3d 2d 31 29 20 7b 0a 20  20 20 20 20 74 61 67 5b  |=-1) {.     tag[|
00000950  69 2b 2b 5d 20 3d 20 27  4e 27 3b 0a 20 20 20 20  |i++] = 'N';.    |
00000960  20 73 68 61 64 65 64 20  3d 20 74 69 63 6b 65 64  | shaded = ticked|
00000970  20 3d 20 46 41 4c 53 45  3b 0a 20 20 20 7d 0a 20  | = FALSE;.   }. |
00000980  20 20 65 6c 73 65 20 7b  0a 20 20 20 20 20 69 66  |  else {.     if|
00000990  20 28 77 69 6d 70 74 5f  63 6f 6d 70 6c 61 69 6e  | (wimpt_complain|
000009a0  28 77 69 6d 70 5f 67 65  74 5f 69 63 6f 6e 5f 69  |(wimp_get_icon_i|
000009b0  6e 66 6f 28 68 65 6c 70  5f 5f 77 2c 20 68 65 6c  |nfo(help__w, hel|
000009c0  70 5f 5f 69 2c 20 26 69  63 29 29 29 20 72 65 74  |p__i, &ic))) ret|
000009d0  75 72 6e 20 46 41 4c 53  45 3b 0a 20 20 20 20 20  |urn FALSE;.     |
000009e0  73 68 61 64 65 64 20 3d  20 69 63 2e 66 6c 61 67  |shaded = ic.flag|
000009f0  73 26 77 69 6d 70 5f 49  4e 4f 53 45 4c 45 43 54  |s&wimp_INOSELECT|
00000a00  20 3f 20 54 52 55 45 20  3a 20 46 41 4c 53 45 3b  | ? TRUE : FALSE;|
00000a10  0a 20 20 20 20 20 69 66  20 28 77 69 6d 70 5f 67  |.     if (wimp_g|
00000a20  65 74 5f 69 63 6f 6e 5f  69 6e 66 6f 28 68 65 6c  |et_icon_info(hel|
00000a30  70 5f 5f 77 2c 20 28 68  65 6c 70 5f 5f 69 2f 33  |p__w, (help__i/3|
00000a40  29 2a 33 2c 20 26 69 63  29 29 20 74 69 63 6b 65  |)*3, &ic)) ticke|
00000a50  64 20 3d 20 46 41 4c 53  45 3b 0a 20 20 20 20 20  |d = FALSE;.     |
00000a60  65 6c 73 65 20 74 69 63  6b 65 64 20 3d 20 69 63  |else ticked = ic|
00000a70  2e 66 6c 61 67 73 26 28  77 69 6d 70 5f 49 54 45  |.flags&(wimp_ITE|
00000a80  58 54 20 7c 20 77 69 6d  70 5f 49 53 50 52 49 54  |XT | wimp_ISPRIT|
00000a90  45 29 20 3f 20 54 52 55  45 20 3a 20 46 41 4c 53  |E) ? TRUE : FALS|
00000aa0  45 3b 0a 20 20 20 7d 0a  20 20 20 74 61 67 5b 69  |E;.   }.   tag[i|
00000ab0  5d 20 3d 20 30 3b 0a 0a  20 20 20 6c 74 61 67 20  |] = 0;..   ltag |
00000ac0  3d 20 74 61 67 5b 69 2d  31 5d 3b 0a 20 20 20 69  |= tag[i-1];.   i|
00000ad0  66 20 28 73 68 61 64 65  64 29 20 7b 0a 20 20 20  |f (shaded) {.   |
00000ae0  20 20 74 61 67 5b 69 2b  31 5d 20 3d 20 30 3b 0a  |  tag[i+1] = 0;.|
00000af0  20 20 20 20 20 74 61 67  5b 69 2b 30 5d 20 3d 20  |     tag[i+0] = |
00000b00  6c 74 61 67 3b 0a 20 20  20 20 20 74 61 67 5b 69  |ltag;.     tag[i|
00000b10  2d 31 5d 20 3d 20 27 47  27 3b 0a 20 20 20 20 20  |-1] = 'G';.     |
00000b20  6d 65 73 73 61 67 65 20  20 3d 20 6d 73 67 73 5f  |message  = msgs_|
00000b30  6c 6f 6f 6b 75 70 28 74  61 67 29 3b 0a 20 20 20  |lookup(tag);.   |
00000b40  20 20 69 66 20 28 73 74  72 63 6d 70 28 6d 65 73  |  if (strcmp(mes|
00000b50  73 61 67 65 2c 20 74 61  67 29 20 21 3d 20 30 29  |sage, tag) != 0)|
00000b60  20 67 6f 74 6f 20 73 65  6e 64 5f 72 65 70 6c 79  | goto send_reply|
00000b70  3b 0a 20 20 20 20 20 74  61 67 5b 69 2b 30 5d 20  |;.     tag[i+0] |
00000b80  3d 20 27 4d 27 3b 0a 20  20 20 20 20 6d 65 73 73  |= 'M';.     mess|
00000b90  61 67 65 20 20 3d 20 6d  73 67 73 5f 6c 6f 6f 6b  |age  = msgs_look|
00000ba0  75 70 28 74 61 67 29 3b  0a 20 20 20 20 20 69 66  |up(tag);.     if|
00000bb0  20 28 73 74 72 63 6d 70  28 6d 65 73 73 61 67 65  | (strcmp(message|
00000bc0  2c 20 74 61 67 29 20 21  3d 20 30 29 20 67 6f 74  |, tag) != 0) got|
00000bd0  6f 20 73 65 6e 64 5f 72  65 70 6c 79 3b 0a 20 20  |o send_reply;.  |
00000be0  20 20 20 74 61 67 5b 69  2d 31 5d 20 3d 20 6c 74  |   tag[i-1] = lt|
00000bf0  61 67 3b 0a 20 20 20 20  20 74 61 67 5b 69 2b 30  |ag;.     tag[i+0|
00000c00  5d 20 3d 20 30 3b 0a 20  20 20 7d 0a 20 20 20 69  |] = 0;.   }.   i|
00000c10  66 20 28 74 69 63 6b 65  64 29 20 7b 0a 20 20 20  |f (ticked) {.   |
00000c20  20 20 74 61 67 5b 69 2b  31 5d 20 3d 20 30 3b 0a  |  tag[i+1] = 0;.|
00000c30  20 20 20 20 20 74 61 67  5b 69 2b 30 5d 20 3d 20  |     tag[i+0] = |
00000c40  6c 74 61 67 3b 0a 20 20  20 20 20 74 61 67 5b 69  |ltag;.     tag[i|
00000c50  2d 31 5d 20 3d 20 27 54  27 3b 0a 20 20 20 20 20  |-1] = 'T';.     |
00000c60  6d 65 73 73 61 67 65 20  20 3d 20 6d 73 67 73 5f  |message  = msgs_|
00000c70  6c 6f 6f 6b 75 70 28 74  61 67 29 3b 0a 20 20 20  |lookup(tag);.   |
00000c80  20 20 69 66 20 28 73 74  72 63 6d 70 28 6d 65 73  |  if (strcmp(mes|
00000c90  73 61 67 65 2c 20 74 61  67 29 20 21 3d 20 30 29  |sage, tag) != 0)|
00000ca0  20 67 6f 74 6f 20 73 65  6e 64 5f 72 65 70 6c 79  | goto send_reply|
00000cb0  3b 0a 20 20 20 20 20 74  61 67 5b 69 2b 30 5d 20  |;.     tag[i+0] |
00000cc0  3d 20 27 4d 27 3b 0a 20  20 20 20 20 6d 65 73 73  |= 'M';.     mess|
00000cd0  61 67 65 20 20 3d 20 6d  73 67 73 5f 6c 6f 6f 6b  |age  = msgs_look|
00000ce0  75 70 28 74 61 67 29 3b  0a 20 20 20 20 20 69 66  |up(tag);.     if|
00000cf0  20 28 73 74 72 63 6d 70  28 6d 65 73 73 61 67 65  | (strcmp(message|
00000d00  2c 20 74 61 67 29 20 21  3d 20 30 29 20 67 6f 74  |, tag) != 0) got|
00000d10  6f 20 73 65 6e 64 5f 72  65 70 6c 79 3b 0a 20 20  |o send_reply;.  |
00000d20  20 20 20 74 61 67 5b 69  2d 31 5d 20 3d 20 6c 74  |   tag[i-1] = lt|
00000d30  61 67 3b 0a 20 20 20 20  20 74 61 67 5b 69 2b 30  |ag;.     tag[i+0|
00000d40  5d 20 3d 20 30 3b 0a 20  20 20 7d 0a 20 20 20 6d  |] = 0;.   }.   m|
00000d50  65 73 73 61 67 65 20 20  3d 20 6d 73 67 73 5f 6c  |essage  = msgs_l|
00000d60  6f 6f 6b 75 70 28 74 61  67 29 3b 0a 20 20 20 69  |ookup(tag);.   i|
00000d70  66 20 28 73 74 72 63 6d  70 28 6d 65 73 73 61 67  |f (strcmp(messag|
00000d80  65 2c 20 74 61 67 29 20  21 3d 20 30 29 20 67 6f  |e, tag) != 0) go|
00000d90  74 6f 20 73 65 6e 64 5f  72 65 70 6c 79 3b 0a 20  |to send_reply;. |
00000da0  20 20 74 61 67 5b 69 2d  31 5d 20 3d 20 27 4d 27  |  tag[i-1] = 'M'|
00000db0  3b 0a 20 20 20 6d 65 73  73 61 67 65 20 20 3d 20  |;.   message  = |
00000dc0  6d 73 67 73 5f 6c 6f 6f  6b 75 70 28 74 61 67 29  |msgs_lookup(tag)|
00000dd0  3b 0a 20 20 20 69 66 20  28 73 74 72 63 6d 70 28  |;.   if (strcmp(|
00000de0  6d 65 73 73 61 67 65 2c  20 74 61 67 29 20 21 3d  |message, tag) !=|
00000df0  20 30 29 20 67 6f 74 6f  20 73 65 6e 64 5f 72 65  | 0) goto send_re|
00000e00  70 6c 79 3b 0a 0a 20 20  20 72 65 74 75 72 6e 20  |ply;..   return |
00000e10  46 41 4c 53 45 3b 0a 0a  20 20 20 73 65 6e 64 5f  |FALSE;..   send_|
00000e20  72 65 70 6c 79 3a 0a 20  20 20 72 65 70 70 74 72  |reply:.   repptr|
00000e30  20 3d 20 6d 65 73 73 61  67 65 3b 0a 20 20 20 69  | = message;.   i|
00000e40  66 20 28 73 74 72 73 74  72 28 72 65 70 70 74 72  |f (strstr(repptr|
00000e50  2c 20 22 25 73 22 29 20  26 26 20 68 65 6c 70 5f  |, "%s") && help_|
00000e60  5f 69 6e 73 65 72 74 29  20 7b 0a 20 20 20 20 20  |_insert) {.     |
00000e70  73 70 72 69 6e 74 66 28  62 75 66 2c 20 72 65 70  |sprintf(buf, rep|
00000e80  70 74 72 2c 20 68 65 6c  70 5f 5f 69 6e 73 65 72  |ptr, help__inser|
00000e90  74 29 3b 0a 20 20 20 20  20 72 65 70 70 74 72 20  |t);.     repptr |
00000ea0  3d 20 62 75 66 3b 0a 20  20 20 7d 0a 20 20 20 70  |= buf;.   }.   p|
00000eb0  74 72 20 20 3d 20 73 74  72 73 74 72 28 72 65 70  |tr  = strstr(rep|
00000ec0  70 74 72 2c 20 22 25 71  22 29 3b 0a 20 20 20 70  |ptr, "%q");.   p|
00000ed0  74 72 32 20 3d 20 73 74  72 73 74 72 28 72 65 70  |tr2 = strstr(rep|
00000ee0  70 74 72 2c 20 22 25 74  22 29 3b 0a 20 20 20 69  |ptr, "%t");.   i|
00000ef0  66 20 28 70 74 72 20 7c  7c 20 70 74 72 32 29 20  |f (ptr || ptr2) |
00000f00  7b 0a 20 20 20 20 20 69  66 20 28 21 77 69 6d 70  |{.     if (!wimp|
00000f10  5f 67 65 74 5f 69 63 6f  6e 5f 69 6e 66 6f 28 68  |_get_icon_info(h|
00000f20  65 6c 70 5f 5f 77 2c 20  28 68 65 6c 70 5f 5f 69  |elp__w, (help__i|
00000f30  2f 33 29 2a 33 2b 31 2c  20 26 69 63 29 29 20 7b  |/3)*3+1, &ic)) {|
00000f40  0a 20 20 20 20 20 20 20  69 66 20 28 69 63 2e 66  |.       if (ic.f|
00000f50  6c 61 67 73 20 26 20 77  69 6d 70 5f 49 54 45 58  |lags & wimp_ITEX|
00000f60  54 29 20 7b 0a 20 20 20  20 20 20 20 20 20 69 66  |T) {.         if|
00000f70  20 28 70 74 72 32 29 20  7b 0a 20 20 20 20 20 20  | (ptr2) {.      |
00000f80  20 20 20 20 20 70 74 72  3d 70 74 72 32 3b 0a 20  |     ptr=ptr2;. |
00000f90  20 20 20 20 20 20 20 20  20 20 69 63 74 78 74 5b  |          ictxt[|
00000fa0  30 5d 3d 30 3b 0a 20 20  20 20 20 20 20 20 20 7d  |0]=0;.         }|
00000fb0  0a 20 20 20 20 20 20 20  20 20 65 6c 73 65 20 7b  |.         else {|
00000fc0  0a 20 20 20 20 20 20 20  20 20 20 20 69 63 74 78  |.           ictx|
00000fd0  74 5b 30 5d 3d 27 5c 27  27 3b 0a 20 20 20 20 20  |t[0]='\'';.     |
00000fe0  20 20 20 20 20 20 69 63  74 78 74 5b 31 5d 3d 30  |      ictxt[1]=0|
00000ff0  3b 0a 20 20 20 20 20 20  20 20 20 7d 0a 20 20 20  |;.         }.   |
00001000  20 20 20 20 20 20 73 74  72 6e 63 61 74 28 69 63  |      strncat(ic|
00001010  74 78 74 2c 20 28 69 63  2e 66 6c 61 67 73 20 26  |txt, (ic.flags &|
00001020  20 77 69 6d 70 5f 49 4e  44 49 52 45 43 54 29 20  | wimp_INDIRECT) |
00001030  3f 20 69 63 2e 64 61 74  61 2e 69 6e 64 69 72 65  |? ic.data.indire|
00001040  63 74 74 65 78 74 2e 62  75 66 66 65 72 20 3a 20  |cttext.buffer : |
00001050  69 63 2e 64 61 74 61 2e  74 65 78 74 2c 20 33 32  |ic.data.text, 32|
00001060  2d 33 29 3b 0a 20 20 20  20 20 20 20 20 20 69 66  |-3);.         if|
00001070  20 28 21 70 74 72 32 29  20 73 74 72 63 61 74 28  | (!ptr2) strcat(|
00001080  69 63 74 78 74 2c 20 22  27 22 29 3b 0a 20 20 20  |ictxt, "'");.   |
00001090  20 20 20 20 20 20 73 74  72 63 70 79 28 62 75 66  |      strcpy(buf|
000010a0  32 2c 20 72 65 70 70 74  72 29 3b 0a 20 20 20 20  |2, repptr);.    |
000010b0  20 20 20 20 20 6d 65 6d  63 70 79 28 70 74 72 2d  |     memcpy(ptr-|
000010c0  72 65 70 70 74 72 2b 62  75 66 32 2c 20 22 25 73  |repptr+buf2, "%s|
000010d0  22 2c 20 32 29 3b 0a 20  20 20 20 20 20 20 20 20  |", 2);.         |
000010e0  73 70 72 69 6e 74 66 28  62 75 66 2c 20 62 75 66  |sprintf(buf, buf|
000010f0  32 2c 20 69 63 74 78 74  29 3b 0a 20 20 20 20 20  |2, ictxt);.     |
00001100  20 20 20 20 72 65 70 70  74 72 20 3d 20 62 75 66  |    repptr = buf|
00001110  3b 0a 20 20 20 20 20 20  20 7d 0a 20 20 20 20 20  |;.       }.     |
00001120  7d 0a 20 20 20 7d 0a 20  20 20 68 65 6c 70 5f 72  |}.   }.   help_r|
00001130  65 70 6c 79 28 72 65 70  70 74 72 29 3b 0a 20 20  |eply(repptr);.  |
00001140  20 72 65 74 75 72 6e 20  54 52 55 45 3b 0a 7d 0a  | return TRUE;.}.|
00001150