home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume3 / xdbx / part03 / sun_regex.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-03-14  |  3.2 KB  |  108 lines

  1. /****************************************************************************** 
  2.  *
  3.  *  xdbx - X Window System interface to dbx
  4.  *
  5.  *  Copyright 1989 The University of Texas at Austin
  6.  *
  7.  *  Author:    Po Cheung
  8.  *  Date:    March 10, 1989
  9.  *
  10.  *  Permission to use, copy, modify, and distribute this software and
  11.  *  its documentation for any purpose and without fee is hereby granted,
  12.  *  provided that the above copyright notice appear in all copies and that
  13.  *  both that copyright notice and this permission notice appear in
  14.  *  supporting documentation.  The University of Texas at Austin makes no 
  15.  *  representations about the suitability of this software for any purpose.  
  16.  *  It is provided "as is" without express or implied warranty.
  17.  *
  18.  ******************************************************************************/
  19.  
  20.  
  21. /*
  22.  *  Regular expression pattern matching
  23.  *  
  24.  *  The reg_token array indicates the register no. for each token type.
  25.  *      reg_token[0] : message
  26.  *      reg_token[1] : stop number
  27.  *      reg_token[2] : function name
  28.  *      reg_token[3] : line number
  29.  *      reg_token[4] : file name
  30.  */
  31.  
  32. #define    BRACKET        "(%d)" 
  33.  
  34. #define    TK_MESG     0
  35. #define TK_STOP        1
  36. #define TK_FUNC     2
  37. #define TK_LINE     3
  38. #define TK_FILE     4
  39.  
  40. #define    O_EXEC        0
  41. #define O_DONE        1
  42. #define O_STOPAT     2
  43. #define O_STOPIN     3
  44. #define O_UPDOWN     4
  45. #define O_BELL        5
  46. #define O_LIST        6
  47.  
  48. #define C_EXEC        0
  49. #define C_STOPAT    1
  50. #define C_STOPIN    2
  51. #define C_UPDOWN    3
  52. #define C_DELETE    4
  53. #define C_FUNC        5
  54. #define C_FILE        6
  55. #define C_DEBUG        7
  56. #define C_CD        8
  57.  
  58. static PatternRec output_pattern[] = {
  59.     {"\\(.*\n\\)*\\(\\(stopped\\|Bus error\\|Segmentation fault\\|Interrupt\\|\
  60. signal.*\\) in \\([^ ]+\\) at line \\([0-9]+\\)\\( in file\
  61.  \"\\([^ ]+\\)\"\\)?\\)\n", 
  62.      NULL,
  63.      {2, -1, 4, 5, 7}
  64.     },
  65.     {"\\(.*\n\\)*\\(execution completed\\|program exited with [0-9]+\\)",
  66.      NULL,
  67.      {-1, -1, -1, -1, -1}
  68.     },
  69.     {"(\\([0-9]+\\)) stop at \\(\"\\([^ ]+\\)\":\\)?\\([0-9]+\\)\n",
  70.      NULL,
  71.      {-1, 1, -1, 4, 3}
  72.     },
  73.     {"(\\([0-9]+\\)) stop in \\([^ ]+\\)\n",
  74.      NULL,
  75.      {-1, 1, 2, -1, -1}
  76.     },
  77.     {"Current function is \\([^ ]+\\)\n[ ]*\\([0-9]+\\).*\n",
  78.      NULL,
  79.      {-1, -1, 1, 2, 3}
  80.     },
  81.     {"\\(Already at the \\(top\\|bottom\\) call level\n\\|No active stack \
  82. frames\n\\|no program to run\n\\|program is not active\n\\|can't continue \
  83. execution\n\\|.*\ncan't write to process.*\\)",
  84.      NULL,
  85.      {-1, -1, -1, -1, -1}
  86.     },
  87.     {"[ ]*[0-9]+.*\n[ ]*[0-9]+.*\n[ ]*[0-9]+.*\n[ ]*[0-9]+.*\n[ ]*[0-9]+.*\n\
  88. [ ]*\\([0-9]+\\).*\n",
  89.      NULL,
  90.      {-1, -1, -1, 1, -1}
  91.     },
  92.     NULL 
  93. };
  94.  
  95.  
  96. static PatternRec command_pattern[] = {
  97.     {"[ ]*\\(run\\|cont\\|next\\|step\\).*\n",     NULL, {-1, -1, -1, -1, -1}},
  98.     {"[ ]*stop[ ]+at[ ]+[0-9]+.*\n",         NULL, {-1, -1, -1, -1, -1}},
  99.     {"[ ]*stop[ ]+in[ ]+.*\n",             NULL, {-1, -1, -1, -1, -1}},
  100.     {"[ ]*\\(up\\|down\\).*\n",         NULL, {-1, -1, -1, -1, -1}},
  101.     {"[ ]*delete.*\n",                 NULL, {-1, -1, -1,  1, -1}},
  102.     {"[ ]*func[ ]*\\([^ ]+\\)[ ]*\n",         NULL, {-1, -1,  1, -1, -1}},
  103.     {"[ ]*file[ ]*\\([^ ]+\\)[ ]*\n",         NULL, {-1, -1, -1, -1,  1}},
  104.     {"[ ]*debug[ ]*\\([^ ]+\\)[ ]*\n",         NULL, {-1, -1, -1, -1,  1}},
  105.     {"[ ]*cd[ ]*\\([^ ]+\\)[ ]*\n",         NULL, {-1, -1, -1, -1,  1}},
  106.     NULL
  107. };
  108.