"Fossies" - the Fresh Open Source Software Archive

Member "xxgdb-1.12/mips_regex.h" (16 Nov 1994, 5442 Bytes) of package /linux/misc/old/xxgdb-1.12.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /*****************************************************************************
    2  *
    3  *  xdbx - X Window System interface to the dbx debugger
    4  *
    5  *  Copyright 1989 The University of Texas at Austin
    6  *  Copyright 1990 Microelectronics and Computer Technology Corporation
    7  *
    8  *  Permission to use, copy, modify, and distribute this software and its
    9  *  documentation for any purpose and without fee is hereby granted,
   10  *  provided that the above copyright notice appear in all copies and that
   11  *  both that copyright notice and this permission notice appear in
   12  *  supporting documentation, and that the name of The University of Texas
   13  *  and Microelectronics and Computer Technology Corporation (MCC) not be 
   14  *  used in advertising or publicity pertaining to distribution of
   15  *  the software without specific, written prior permission.  The
   16  *  University of Texas and MCC makes no representations about the 
   17  *  suitability of this software for any purpose.  It is provided "as is" 
   18  *  without express or implied warranty.
   19  *
   20  *  THE UNIVERSITY OF TEXAS AND MCC DISCLAIMS ALL WARRANTIES WITH REGARD TO
   21  *  THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
   22  *  FITNESS, IN NO EVENT SHALL THE UNIVERSITY OF TEXAS OR MCC BE LIABLE FOR
   23  *  ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
   24  *  RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
   25  *  CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
   26  *  CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   27  *
   28  *  Author:     Po Cheung
   29  *  Created:    November 24, 1989
   30  *
   31  *****************************************************************************/
   32 
   33 /*  mips_regex.h:
   34  *
   35  *  Regular expression pattern matching for dbx on DECStation.
   36  *
   37  *  The reg_token array indicates the register no. for each token type.
   38  *      reg_token[0] : message
   39  *      reg_token[1] : stop number
   40  *      reg_token[2] : function name
   41  *      reg_token[3] : line number
   42  *      reg_token[4] : file name
   43  *      reg_token[5] : display command output
   44  */
   45 
   46 #define TK_MESG         0
   47 #define TK_STOP         1
   48 #define TK_FUNC         2
   49 #define TK_LINE         3
   50 #define TK_FILE         4
   51 #define TK_DISP     5
   52 
   53 #define O_EXEC_GDB      0
   54 #define O_DONE          1
   55 #define O_STOPAT        2
   56 #define O_STOPIN        3
   57 #define O_UPDOWN        4
   58 #define O_FUNC          4
   59 #define O_BELL          5
   60 #define O_LIST          6
   61 #define O_FILE          7
   62 #define O_SEARCH        8
   63 #define O_PRINT         9
   64 #define O_DEBUG         10
   65 
   66 #define C_ANY       -1
   67 #define C_EXEC          0
   68 #define C_STOPAT        1
   69 #define C_STOPIN        2
   70 #define C_UPDOWN        3
   71 #define C_DELETE        4
   72 #define C_FUNC          5
   73 #define C_FILE          6
   74 #define C_USE           7
   75 #define C_LIST          8
   76 #define C_SEARCH        9
   77 #define C_PRINT     10
   78 #define C_STATUS    11
   79 
   80 
   81 static PatternRec output_pattern[] = {
   82     /* exec */
   83     {"\\(.*\n\\)*\\(\\(\\(\\(\[[0-9]+\\] \\)?\\(stopped at \\)?\\)\\|Bus error \
   84 \\|Segmentation fault \\|Interrupt \\)?\\[\\([^ ]+\\):\\([0-9]+\\).*\\]\\).*\n",
   85      NULL,
   86      {2, -1, 7, 8, -1, -1}
   87     },
   88     /* done */
   89     {"\\(.*\n\\)*Program terminated normally\n",
   90      NULL,
   91      {-1, -1, -1, -1, -1, -1}
   92     },
   93     /* stop at */
   94     {"\\[\\([0-9]+\\)\\] stop at \\(\"\\([^ ]+\\)\":\\)?\\([0-9]+\\)\n",
   95      NULL,
   96      {-1, 1, -1, 4, 3, -1}
   97     },
   98     /* stop in */
   99     {"\\(\\[.*\\]\n\\)*\\[\\([0-9]+\\)\\] stop in \\([^ ]+\\)\n",
  100      NULL,
  101      {-1, 2, 3, -1, -1, -1}
  102     },
  103     /* up, down, func */
  104     {"\\(.*\n\\)*\\([^ ]+\\):[ ]*\\([0-9]+\\).*\n",
  105      NULL,
  106      {2, -1, 2, 3, -1, -1}
  107     },
  108     /* bell */
  109     {"\n\\(not that many levels\\|program not active\\|program is not active\\|\
  110 cannot read register unless program is active\\|cannot dump unless program is \
  111 active\\)\n",
  112      NULL,
  113      {-1, -1, -1, -1, -1, -1}
  114     },
  115     /* list */
  116     {"[ ]*\\([0-9]+\\).*\n",
  117      NULL,
  118      {-1, -1, -1, 1, -1, -1}
  119     },
  120     /* file */
  121     {"\\([^ ]+\\)\n",
  122      NULL,
  123      {-1, -1, -1, -1, 1, -1}
  124     },
  125     /* search */
  126     {"[ ]*\\([0-9]+\\).*\n",
  127      NULL,
  128      {-1, -1, -1, 1, -1, -1}
  129     },
  130     /* print */
  131     {"\\(.+\n\\(.*\n\\)*\\)",
  132      NULL,
  133      { 1, -1, -1, -1, -1, -1}
  134     },
  135     /* dbx init */
  136     {"\\(.*\n\\)*.*\\(dbx version .*\nType 'help' for help.\nreading symbolic \
  137 information ...\n\\)\\(\nwarning: .*\n\\)?\\([^ ]+\\):[ ]*\\([0-9]+\\).*\n",
  138      NULL,
  139      {-1, -1, 4, 5, -1, -1}
  140     },
  141     NULL
  142 };
  143 
  144 static PatternRec command_pattern[] = {
  145     {"[ ]*\\(run\\|r\\|cont\\|c\\|next\\|n\\|step\\|s\\|return\\)\\( \\|\n\\)",
  146                         NULL, {-1, -1, -1, -1, -1, -1}},
  147     {"[ ]*\\(stop\\|st\\)[ ]+at[ ]+[0-9]+",     NULL, {-1, -1, -1, -1, -1, -1}},
  148     {"[ ]*\\(stop\\|st\\)[ ]+in[ ]+[^ ]+",      NULL, {-1, -1, -1, -1, -1, -1}},
  149     {"[ ]*\\(up\\|down\\)",                     NULL, {-1, -1, -1, -1, -1, -1}},
  150     {"[ ]*\\(delete\\|d\\)",                    NULL, {-1, -1, -1,  1, -1, -1}},
  151     {"[ ]*func[ ]*\\([^ ]+\\)[ ]*",             NULL, {-1, -1,  1, -1, -1, -1}},
  152     {"[ ]*file[ ]*",                    NULL, {-1, -1, -1, -1,  1, -1}},
  153     {"[ ]*use[ ]*",                     NULL, {-1, -1, -1, -1,  1, -1}},
  154     {"[ ]*list[ ]*",                    NULL, {-1, -1, -1, -1,  1, -1}},
  155     {"[ ]*\\(/\\|\?\\)",                        NULL, {-1, -1, -1, -1, -1, -1}},
  156     {"[ ]*\\(print\\|p\\)[ ]*[^ ]+",            NULL, {-1, -1, -1, -1, -1, -1}},
  157     {"[ ]*status[ ]*",                  NULL, {-1, -1, -1, -1,  1, -1}},
  158     NULL
  159 };