home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / x / volume3 / xdbx / part03 / bsd_regex.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-03-14  |  3.2 KB  |  110 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.  
  59. static PatternRec output_pattern[] = {
  60.     /* exec */
  61.     {"\\(.*\n\\)*\\(\[[0-9]+\] \\)?\\(\\(stopped\\|Bus error\\|Segmentation \
  62. fault\\|Interrupt\\) in \\([^ ]+\\) at line \
  63. \\([0-9]+\\)\\( in file \"\\([^ ]+\\)\"\\)?\\)\n", 
  64.      NULL,
  65.      {3, -1, 5, 6, 8}
  66.     },
  67.     /* done */
  68.     {"\\(.*\n\\)*execution completed",
  69.      NULL,
  70.      {-1, -1, -1, -1, -1}
  71.     },
  72.     /* stop at */
  73.     {"\\[\\([0-9]+\\)\\] stop at \\(\"\\([^ ]+\\)\":\\)?\\([0-9]+\\)\n",
  74.      NULL,
  75.      {-1, 1, -1, 4, 3}
  76.     },
  77.     /* stop in */
  78.     {"\\[\\([0-9]+\\)\\] stop in \\([^ ]+\\)\n",
  79.      NULL,
  80.      {-1, 1, 2, -1, -1}
  81.     },
  82.     /* updown */
  83.     {"\\([^ ]+\\)(.*), line \\([0-9]+\\) in \"\\([^ ]+\\)\"\n",
  84.      NULL,
  85.      {-1, -1, 1, 2, 3}
  86.     },
  87.     /* bell */
  88.     {"\\(not that many levels\n\\|can't continue execution\n\\)",
  89.      NULL,
  90.      {-1, -1, -1, -1, -1}
  91.     },
  92.     /* list */
  93.     {"\\([ ]*[0-9]+.*\n\\)*[ ]+\\([0-9]+\\)[ ]+{.*\n",
  94.      NULL,
  95.      {-1, -1, -1, 2, -1}
  96.     },
  97.     NULL
  98. };
  99.  
  100. static PatternRec command_pattern[] = {
  101.     {"[ ]*\\(run\\|cont\\|next\\|step\\).*\n",  NULL, {-1, -1, -1, -1, -1}},
  102.     {"[ ]*stop[ ]+at[ ]+[0-9]+.*\n",            NULL, {-1, -1, -1, -1, -1}},
  103.     {"[ ]*stop[ ]+in[ ]+.*\n",                  NULL, {-1, -1, -1, -1, -1}},
  104.     {"[ ]*\\(up\\|down\\).*\n",                 NULL, {-1, -1, -1, -1, -1}},
  105.     {"[ ]*delete.*\n",                          NULL, {-1, -1, -1,  1, -1}},
  106.     {"[ ]*func[ ]*\\([^ ]+\\)[ ]*\n",           NULL, {-1, -1,  1, -1, -1}},
  107.     {"[ ]*file[ ]*\\([^ ]+\\)[ ]*\n",           NULL, {-1, -1, -1, -1,  1}},
  108.     NULL
  109. };
  110.