home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 545a.lha / PowerVisor_v1.0 / Source.LZH / Source / GetQual.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-31  |  685 b   |  49 lines

  1. #include <exec/types.h>
  2. #include <pragmas/exec.h>
  3. #include <pragmas/keymap.h>
  4. #include <string.h>
  5.  
  6. struct myQual
  7.     {
  8.         char *str;
  9.         UWORD qual;
  10.     };
  11.  
  12. struct myQual Quals[] =
  13.     {
  14.         "lshift",    0x1,
  15.         "rshift",    0x2,
  16.         "ctrl",        0x8,
  17.         "lalt",        0x10,
  18.         "ralt",        0x20,
  19.         "lcmd",        0x40,
  20.         "rcmd",        0x80,
  21.         NULL,            0
  22.     };
  23.  
  24.  
  25. int __saveds __asm Qual (register __a0 char *cmdline, register __a2 APTR table[])
  26. {
  27.     char *p;
  28.     int qual;
  29.     struct myQual *mq;
  30.     char __regargs * (*GetString)(char *);
  31.  
  32.     GetString = table[9];
  33.     p = GetString (cmdline);
  34.  
  35.     qual = 0;
  36.     mq = Quals;
  37.     while (mq->str)
  38.         {
  39.             if (!strcmp (mq->str,p))
  40.                 {
  41.                     qual = (int)(mq->qual);
  42.                     break;
  43.                 }
  44.             mq++;
  45.         }
  46.  
  47.     return (qual);
  48. }
  49.